Index: branches/2.8.x/CHANGELOG
===================================================================
--- branches/2.8.x/CHANGELOG	(revision 1581)
+++ branches/2.8.x/CHANGELOG	(revision 1582)
@@ -11,6 +11,10 @@
 ! = Update/Change
 
 =========================== add small Features 2.8.2 ==========================
+19 Jan-2012 Build 1582 Dietmar Woellbrink (Luisehahne)
+# wysiwyg module, fix issues with magic_quote_gpc if on
+# form module, fix regex for radio and checkbox (Tks to Ruud)
+! form module, make show submission table scrollable
 17 Jan-2012 Build 1581 Werner v.d.Decken(DarkViper)
 # wysiwyg module some little typo fixes a.s.o.
 17 Jan-2012 Build 1580 Dietmar Woellbrink (Luisehahne)
Index: branches/2.8.x/wb/admin/interface/version.php
===================================================================
--- branches/2.8.x/wb/admin/interface/version.php	(revision 1581)
+++ branches/2.8.x/wb/admin/interface/version.php	(revision 1582)
@@ -52,5 +52,5 @@
 
 // check if defined to avoid errors during installation (redirect to admin panel fails if PHP error/warnings are enabled)
 if(!defined('VERSION')) define('VERSION', '2.8.2');
-if(!defined('REVISION')) define('REVISION', '1581');
+if(!defined('REVISION')) define('REVISION', '1582');
 if(!defined('SP')) define('SP', 'SP2');
Index: branches/2.8.x/wb/modules/form/view.php
===================================================================
--- branches/2.8.x/wb/modules/form/view.php	(revision 1581)
+++ branches/2.8.x/wb/modules/form/view.php	(revision 1582)
@@ -75,7 +75,7 @@
 		$field_id = $params[0][0];
 		$seperator = $params[0][1];
 
-		$label_id = 'wb_'.preg_replace('/[^a-z0-1]/i', '_', $key).$field_id;
+		$label_id = 'wb_'.preg_replace('/[^a-z0-9]/i', '_', $key).$field_id;
 		if(in_array($key, $params[1])) {
 			$key = '<input class="frm-field_checkbox" type="checkbox" id="'.$label_id.'" name="field'.$field_id.'['.$idx.']" value="'.$key.'" />'.'<label for="'.$label_id.'" class="frm-checkbox_label">'.$key.'</lable>'.$seperator.PHP_EOL;
 		} else {
@@ -89,7 +89,7 @@
 		$field_id = $params[0];
 		$group = $params[1];
 		$seperator = $params[2];
-		$label_id = 'wb_'.preg_replace('/[^a-z0-1]/i', '_', $n).$field_id;
+		$label_id = 'wb_'.preg_replace('/[^a-z0-9]/i', '_', $n).$field_id;
 		if($n == $params[3]) {
 			$n = '<input class="frm-field_checkbox" type="radio" id="'.$label_id.'" name="field'.$field_id.'" value="'.$n.'" checked="checked" />'.'<label for="'.$label_id.'" class="frm-checkbox_label">'.$n.'</label>'.$seperator.PHP_EOL;
 		} else {
Index: branches/2.8.x/wb/modules/form/backend.js
===================================================================
--- branches/2.8.x/wb/modules/form/backend.js	(nonexistent)
+++ branches/2.8.x/wb/modules/form/backend.js	(revision 1582)
@@ -0,0 +1,186 @@
+/**
+ *
+ *  Scrollable HTML table
+ *  http://www.webtoolkit.info/
+ *  for Chrome, Safari, Opera
+ *  http://s7u.blogspot.com/
+ **/
+
+ function ScrollableTable (tableEl, tableHeight, tableWidth) {
+  tableHeight = tableHeight * screen.height * 0.01;
+  this.initIEengine = function () {
+
+   this.containerEl.style.overflowY = 'auto';
+   if (this.tableEl.parentElement.clientHeight - this.tableEl.offsetHeight < 0) {
+    this.tableEl.style.width = this.newWidth - this.scrollWidth +'px';
+   } else {
+    this.containerEl.style.overflowY = 'auto';
+    this.containerEl.style.overflowX = 'hidden';
+    this.tableEl.style.width = this.newWidth +'px';
+   }
+
+   if (this.thead) {
+    var trs = this.thead.getElementsByTagName('tr');
+    for (x=0; x < trs.length; x++) {
+     trs[x].style.position ='relative';
+     trs[x].style.setExpression("top",  "this.parentElement.parentElement.parentElement.scrollTop + 'px'");
+    }
+   }
+
+   if (this.tfoot) {
+    var trs = this.tfoot.getElementsByTagName('tr');
+    for (x=0; x < trs.length; x++) {
+     trs[x].style.position ='relative';
+     trs[x].style.setExpression("bottom",  "(this.parentElement.parentElement.offsetHeight - this.parentElement.parentElement.parentElement.clientHeight - this.parentElement.parentElement.parentElement.scrollTop) + 'px'");
+    }
+   }
+
+   eval("window.attachEvent('onresize', function () { document.getElementById('" + this.tableEl.id + "').style.visibility = 'hidden'; document.getElementById('" + this.tableEl.id + "').style.visibility = 'visible'; } )");
+  };
+
+
+  this.initFFengine = function () {
+   this.containerEl.style.overflow = 'hidden';
+   this.tableEl.style.width = this.newWidth + 'px';
+   var headHeight = (this.thead) ? this.thead.clientHeight : 0;
+   var footHeight = (this.tfoot) ? this.tfoot.clientHeight : 0;
+
+
+   var bodyHeight = this.tbody.clientHeight;
+   var trs = this.tbody.getElementsByTagName('tr');
+   if (bodyHeight >= (this.newHeight - (headHeight + footHeight))) {
+     this.tbody.style.overflow = 'scroll';
+   }
+   else {
+  this.tbody.style.overflow = 'auto';
+   }
+   /*
+    Chrome is built on Mozilla. Some script to assign width for tables dynamically.
+   */
+ var isChrome = (navigator.userAgent.toUpperCase().indexOf('MOZILLA')> -1 || navigator.userAgent.toUpperCase().indexOf('OPERA')> -1);
+
+   if(isChrome){
+    this.thead.style.display ="inline-block";
+    this.tfoot.style.display ="inline-block";
+    this.tbody.style.display ="inline-block";
+    this.tbody.style.overflow ="auto";
+
+
+    var count = trs[0].getElementsByTagName('th').length || trs[0].getElementsByTagName('td').length;
+    var colArray = new Array(count);
+
+    /*Thead*/
+    trs = this.tableEl.getElementsByTagName('tr');
+    for(var i=0; i < trs.length ; i++ ){
+     var cols = trs[i].getElementsByTagName('th') || trs[i].getElementsByTagName('td');
+     for(var j=0; j < cols.length ; j++){
+      if(colArray[j]==null || colArray[j] < cols[j].clientWidth){
+       colArray[j] =cols[j].clientWidth;
+      }
+     }
+    }
+
+    var sumArray=0;
+    for(i =0; i < colArray.length; i++){
+     sumArray += colArray[i];
+    }
+
+    /* if the width of any cell is greater */
+    if (sumArray < (this.newWidth - this.scrollWidth)){
+     var newCount =0;
+     var nWidth =0;
+     for(i =0; i < colArray.length; i++){
+      var wid = (this.newWidth - this.scrollWidth)/count;
+      if(wid < colArray[i]){
+       newCount++;
+       nWidth += colArray[i];
+      }
+     }
+     var newWid = ((this.newWidth - this.scrollWidth) - nWidth)/(count-newCount);
+     for(i =0; i < colArray.length; i++){
+      var wid = (this.newWidth - this.scrollWidth)/count;
+      if(wid >= colArray[i]){
+       colArray[i]= newWid;
+      }
+     }
+    }
+
+    /*Thead */
+    trs = this.thead.getElementsByTagName('tr');
+    for(var i=0; i < trs.length ; i++ ){
+     var cols = trs[i].getElementsByTagName('th')||trs[i].getElementsByTagName('td');
+     for(var j=0; j < cols.length ; j++){
+      cols[j].style.width = colArray[j] + 'px';
+     }
+     var tcell1 = trs[i].insertCell(cols.length);
+     tcell1.setAttribute("width", this.scrollWidth -2 +'px' );
+    }
+    /*Tbody */
+    trs = this.tbody.getElementsByTagName('tr');
+    for(var i=0; i < trs.length ; i++ ){
+     var cols = trs[i].getElementsByTagName('td');
+     for(var j=0; j < cols.length ; j++){
+      cols[j].style.width = colArray[j] + 'px';
+     }
+    }
+    /*Tfoot */
+    trs = this.tfoot.getElementsByTagName('tr');
+    for(var i=0; i < trs.length ; i++ ){
+     var cols = trs[i].getElementsByTagName('th')||trs[i].getElementsByTagName('td');
+     for(var j=0; j < cols.length ; j++){
+      cols[j].style.width = colArray[j] + 'px';
+     }
+     var tcell1 = trs[i].insertCell(cols.length);
+     tcell1.setAttribute("width", this.scrollWidth -2 +'px');
+    }
+
+   }
+   else{ // else block is for Firefox
+    trs = this.tbody.getElementsByTagName('tr');
+    for (x=0; x < trs.length; x++) {
+     var tds = trs[x].getElementsByTagName('td');
+     tds[tds.length-1].style.paddingRight += this.scrollWidth + 'px';
+    }
+
+   }
+
+   var cellSpacing = (this.tableEl.offsetHeight - (this.tbody.clientHeight + headHeight + footHeight)) / 4;
+   this.tbody.style.height = (this.newHeight - (headHeight + cellSpacing * 2) - (footHeight + cellSpacing * 2)) + 'px';
+
+  };
+
+  this.tableEl = tableEl;
+  this.scrollWidth = 16;
+
+  this.originalHeight = this.tableEl.clientHeight;
+  this.originalWidth = this.tableEl.clientWidth;
+
+  this.newHeight = parseInt(tableHeight);
+  this.newWidth = tableWidth ? parseInt(tableWidth) : this.originalWidth;
+
+  this.tableEl.style.height = 'auto';
+  this.tableEl.removeAttribute('height');
+
+  this.containerEl = this.tableEl.parentNode.insertBefore(document.createElement('div'), this.tableEl);
+  this.containerEl.appendChild(this.tableEl);
+  this.containerEl.style.height = this.newHeight + 'px';
+  this.containerEl.style.width = this.newWidth + 'px';
+
+
+  var thead = this.tableEl.getElementsByTagName('thead');
+  this.thead = (thead[0]) ? thead[0] : null;
+
+  var tfoot = this.tableEl.getElementsByTagName('tfoot');
+  this.tfoot = (tfoot[0]) ? tfoot[0] : null;
+
+  var tbody = this.tableEl.getElementsByTagName('tbody');
+  this.tbody = (tbody[0]) ? tbody[0] : null;
+
+  if (!this.tbody) return;
+   this.containerEl.style.overflow = 'auto';
+
+  if (document.all && document.getElementById && !window.opera) this.initIEengine();
+  if (!document.all && document.getElementById ) this.initFFengine();
+
+
+ }

Property changes on: branches/2.8.x/wb/modules/form/backend.js
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Date Author Id Revision HeadURL
\ No newline at end of property
Index: branches/2.8.x/wb/modules/form/view_submission.php
===================================================================
--- branches/2.8.x/wb/modules/form/view_submission.php	(revision 1581)
+++ branches/2.8.x/wb/modules/form/view_submission.php	(revision 1582)
@@ -54,7 +54,7 @@
 </tr>
 <tr>
 	<td><?php echo $TEXT['SUBMITTED']; ?>:</td>
-	<td><?php echo gmdate(TIME_FORMAT.', '.DATE_FORMAT, $submission['submitted_when']+TIMEZONE); ?></td>
+	<td><?php echo gmdate(DATE_FORMAT .', '.TIME_FORMAT, $submission['submitted_when']+TIMEZONE); ?></td>
 </tr>
 <tr>
 	<td><?php echo $TEXT['USER']; ?>:</td>
Index: branches/2.8.x/wb/modules/form/modify.php
===================================================================
--- branches/2.8.x/wb/modules/form/modify.php	(revision 1581)
+++ branches/2.8.x/wb/modules/form/modify.php	(revision 1582)
@@ -28,6 +28,7 @@
 if(function_exists('ini_set')) {
 	ini_set('arg_separator.output', '&amp;');
 }
+
 include_once(WB_PATH.'/framework/functions.php');
 
 $sec_anchor = (defined( 'SEC_ANCHOR' ) && ( SEC_ANCHOR != '' )  ? '#'.SEC_ANCHOR.$section['section_id'] : '' );
@@ -42,7 +43,7 @@
 }
 
 ?>
-<table summary="" cellpadding="0" cellspacing="0" border="0" width="100%">
+<table summary="" cellpadding="0" cellspacing="0" border="0" width="916">
 <tr>
 	<td align="left" width="33%">
 		<input type="button" value="<?php echo $TEXT['ADD'].' '.$TEXT['FIELD']; ?>" onclick="javascript: window.location = '<?php echo WB_URL; ?>/modules/form/add_field.php?page_id=<?php echo $page_id; ?>&amp;section_id=<?php echo $section_id; ?>';" style="width: 100%;" />
@@ -67,24 +68,27 @@
 		$num_fields = $query_fields->numRows();
 		$row = 'a';
 		?>
-		<table summary="" cellpadding="2" cellspacing="0" border="0" width="100%">
+		<table summary="" cellpadding="2" cellspacing="0" border="0">
+		<thead>
 			<tr style="background-color: #dddddd; font-weight: bold;">
-				<td width="20" style="padding-left: 5px;">&nbsp;</td>
-				<td width="30" style="text-align: right;">ID</td>
-				<td width="400"><?php print $TEXT['FIELD']; ?></td>
-				<td width="175"><?php print $TEXT['TYPE']; ?></td>
-				<td width="100"><?php print $TEXT['REQUIRED']; ?></td>
-				<td width="175">
+				<th width="20" style="padding-left: 5px;">&nbsp;</th>
+				<th width="30" style="text-align: right;">ID</th>
+				<th width="400"><?php print $TEXT['FIELD']; ?></th>
+				<th width="175"><?php print $TEXT['TYPE']; ?></th>
+				<th width="100"><?php print $TEXT['REQUIRED']; ?></th>
+				<th width="175">
 				<?php
 					echo $TEXT['MULTISELECT'];
 				?>
-				</td>
-				<td width="175" colspan="3">
+				</th>
+				<th width="175" colspan="3">
 				<?php
 					echo $TEXT['ACTIONS'];
 				?>
-				</td>
+				</th>
 			</tr>
+		</thead>
+		<tbody>
 		<?php
 		while($field = $query_fields->fetchRow(MYSQL_ASSOC)) {
 			?>
@@ -123,7 +127,7 @@
 					}
 					?>
 				</td>
-				<td>
+				<td style="text-align: center;">
 				<?php
 				if ($field['type'] != 'group_begin') {
 					if($field['required'] == 1) { echo $TEXT['YES']; } else { echo $TEXT['NO']; }
@@ -138,7 +142,7 @@
 				}
 				?>
 				</td>
-				<td width="20">
+				<td width="20" style="text-align: center;">
 				<?php if($field['position'] != 1) { ?>
 					<a href="<?php echo WB_URL; ?>/modules/form/move_up.php?page_id=<?php echo $page_id; ?>&amp;section_id=<?php echo $section_id; ?>&amp;field_id=<?php echo $admin->getIDKEY($field['field_id']); ?>" title="<?php echo $TEXT['MOVE_UP']; ?>">
 						<img src="<?php echo THEME_URL; ?>/images/up_16.png" border="0" alt="^" />
@@ -145,7 +149,7 @@
 					</a>
 				<?php } ?>
 				</td>
-				<td width="20">
+				<td width="20" style="text-align: center;">
 				<?php if($field['position'] != $num_fields) { ?>
 					<a href="<?php echo WB_URL; ?>/modules/form/move_down.php?page_id=<?php echo $page_id; ?>&amp;section_id=<?php echo $section_id; ?>&amp;field_id=<?php echo $admin->getIDKEY($field['field_id']); ?>" title="<?php echo $TEXT['MOVE_DOWN']; ?>">
 						<img src="<?php echo THEME_URL; ?>/images/down_16.png" border="0" alt="v" />
@@ -152,16 +156,16 @@
 					</a>
 				<?php } ?>
 				</td>
-				<td width="20">
+				<td width="20" style="text-align: center;">
 <?php
 				$url = (WB_URL.'/modules/form/delete_field.php?page_id='.$page_id.'&amp;section_id='.$section_id.'&amp;field_id='.$admin->getIDKEY($field['field_id']))
- ?>
+?>
 					<a href="javascript: confirm_link('<?php echo url_encode($TEXT['ARE_YOU_SURE']); ?>', '<?php echo $url; ?>');" title="<?php echo $TEXT['DELETE']; ?>">
 						<img src="<?php echo THEME_URL; ?>/images/delete_16.png" border="0" alt="X" />
 					</a>
 				</td>
 			</tr>
-			<?php
+<?php
 			// Alternate row color
 			if($row == 'a') {
 				$row = 'b';
@@ -169,7 +173,8 @@
 				$row = 'a';
 			}
 		}
-		?>
+?>
+		</tbody>
 		</table>
 		<?php
 	} else {
@@ -183,38 +188,67 @@
 <h2><?php echo $TEXT['SUBMISSIONS']; ?></h2>
 
 <?php
-
 // Query submissions table
-$sql  = 'SELECT * FROM `'.TABLE_PREFIX.'mod_form_submissions` ';
+/*
+$sql  = 'SELECT * FROM `'.TABLE_PREFIX.'mod_form_submissions`  ';
 $sql .= 'WHERE `section_id` = '.(int)$section_id.' ';
 $sql .= 'ORDER BY `submitted_when` ASC ';
+*/
+$sql  = 'SELECT s.*, u.`display_name` ';
+$sql .=            'FROM `'.TABLE_PREFIX.'mod_form_submissions` s ';
+$sql .= 'LEFT OUTER JOIN `'.TABLE_PREFIX.'users` u ';
+$sql .= 'ON u.`user_id` = s.`submitted_by` ';
+$sql .= 'WHERE s.`section_id` = '.(int)$section_id.' ';
+$sql .= 'ORDER BY s.`submitted_when` ASC ';
+
 if($query_submissions = $database->query($sql)) {
+?>
+<!-- submissions -->
+		<table summary="" cellpadding="2" cellspacing="0" border="0" class="" id="frm-ScrollTable" >
+		<thead>
+		<tr style="background-color: #dddddd; font-weight: bold;">
+			<th width="23" style="text-align: center;">&nbsp;</th>
+			<th width="33" style="text-align: right;"> ID </th>
+			<th width="250" style="padding-left: 10px;"><?php echo $TEXT['SUBMITTED'] ?></th>
+			<th width="240" style="padding-left: 10px;"><?php echo $TEXT['USER']; ?></th>
+			<th width="250">&nbsp;</th>
+			<th width="20">&nbsp;</th>
+			<th width="20">&nbsp;</th>
+			<th width="20">&nbsp;</th>
+			<th width="20">&nbsp;</th>
+		</tr>
+		</thead>
+		<tbody>
+<?php
 	if($query_submissions->numRows() > 0) {
-		?>
-		<table summary="" cellpadding="2" cellspacing="0" border="0" width="100%">
-		<?php
 		// List submissions
 		$row = 'a';
 		while($submission = $query_submissions->fetchRow(MYSQL_ASSOC)) {
-			?>
+        $submission['display_name'] = (($submission['display_name']!=null) ? $submission['display_name'] : $TEXT['UNKNOWN']);
+?>
 			<tr class="row_<?php echo $row; ?>">
-				<td width="20" style="padding-left: 5px;">
+				<td width="20" style="padding-left: 5px;text-align: center;">
 					<a href="<?php echo WB_URL; ?>/modules/form/view_submission.php?page_id=<?php echo $page_id; ?>&amp;section_id=<?php echo $section_id; ?>&amp;submission_id=<?php echo $admin->getIDKEY($submission['submission_id']); ?>" title="<?php echo $TEXT['OPEN']; ?>">
 						<img src="<?php echo THEME_URL; ?>/images/folder_16.png" alt="<?php echo $TEXT['OPEN']; ?>" border="0" />
 					</a>
 				</td>
-				<td width="237"><?php echo $TEXT['SUBMISSION_ID'].': '.$submission['submission_id']; ?></td>
-				<td><?php echo $TEXT['SUBMITTED'].': '.gmdate(TIME_FORMAT.', '.DATE_FORMAT, $submission['submitted_when']+TIMEZONE); ?></td>
-				<td width="20">
+				<td width="30" style="padding-right: 5px;text-align: right;"><?php echo $submission['submission_id']; ?></td>
+				<td width="250" style="padding-left: 10px;"><?php echo gmdate(DATE_FORMAT.', '.TIME_FORMAT, $submission['submitted_when']+TIMEZONE ); ?></td>
+				<td width="250" style="padding-left: 10px;"><?php echo $submission['display_name']; ?></td>
+				<td width="240">&nbsp;</td>
+				<td width="20" style="text-align: center;">&nbsp;</td>
+				<td width="20">&nbsp;</td>
+				<td width="20" style="text-align: center;">
 <?php
 				$url = (WB_URL.'/modules/form/delete_submission.php?page_id='.$page_id.'&amp;section_id='.$section_id.'&amp;submission_id='.$admin->getIDKEY($submission['submission_id']))
- ?>
+?>
 					<a href="javascript: confirm_link('<?php echo url_encode($TEXT['ARE_YOU_SURE']); ?>', '<?php echo $url; ?>');" title="<?php echo $TEXT['DELETE']; ?>">
 						<img src="<?php echo THEME_URL; ?>/images/delete_16.png" border="0" alt="X" />
 					</a>
 				</td>
+				<td width="20">&nbsp;</td>
 			</tr>
-			<?php
+<?php
 			// Alternate row color
 			if($row == 'a') {
 				$row = 'b';
@@ -222,10 +256,33 @@
 				$row = 'a';
 			}
 		}
-		?>
-		</table>
-		<?php
 	} else {
-		echo $TEXT['NONE_FOUND'];
+?>
+<tr><td><?php echo $TEXT['NONE_FOUND'] ?></td></tr>
+<?php
 	}
-}
\ No newline at end of file
+?>
+		</tbody>
+		<tfoot>
+		<tr style="background-color: #dddddd; font-weight: bold;">
+			<th width="23" style="text-align: center;">&nbsp;</th>
+			<th width="33" style="text-align: right;"> ID </th>
+			<th width="250" style="padding-left: 10px;"><?php echo $TEXT['SUBMITTED'] ?></th>
+			<th width="250" style="padding-left: 10px;"><?php echo $TEXT['USER']; ?></th>
+			<th width="250">&nbsp;</th>
+			<th width="20">&nbsp;</th>
+			<th width="20">&nbsp;</th>
+			<th width="20">&nbsp;</th>
+			<th width="20">&nbsp;</th>
+		</tr>
+		</tfoot>
+		</table>
+<?php
+} else {
+	echo $database->get_error().'<br />';
+	echo $sql;
+}
+?>
+<script type="text/javascript">
+var t = new ScrollableTable(document.getElementById('frm-ScrollTable'), 30, 916);
+</script>
\ No newline at end of file
Index: branches/2.8.x/wb/modules/form/backend.css
===================================================================
--- branches/2.8.x/wb/modules/form/backend.css	(revision 1581)
+++ branches/2.8.x/wb/modules/form/backend.css	(revision 1582)
@@ -1,8 +1,18 @@
 .frm-setting_name { vertical-align :top; width :30%; white-space :nowrap; }
 .frm-setting_value { vertical-align :top; width :70%; }
 .frm-newsection { border-top :1px dashed #ffffff; }
+.row_a { background : transparent; }
+.row_b { background : #dfebff; }
 /* 
   The definitions below provide the style for the edit CSS button 
   Required CSS class name: input.mod_moduledirectory_edit_css
 */
 input.mod_form_edit_css { color :#000000; background-color :#f0f0f0; border :1px solid #808080; padding :2px; margin :0; margin-left :625px; margin-top :-20px; margin-bottom :5px; width :110px; }
+
+
+  table#frm-ScrollTable { text-align :left; font-size :12px; border :1px ridge #dadada; font-family :verdana; background :transparent; color :#0066ff; }
+  table#frm-ScrollTable thead  { cursor :pointer; }
+  table#frm-ScrollTable thead tr,
+  table#frm-ScrollTable tfoot tr { background :transparent; }
+  table#frm-ScrollTable tbody tr {  }
+  td, th { border :0px ridge #dadada; }
