Project

General

Profile

« Previous | Next » 

Revision 1582

Added by Dietmar over 12 years ago

  1. wysiwyg module, fix issues with magic_quote_gpc if on
  2. form module, fix regex for radio and checkbox (Tks to Ruud)
    ! form module, make show submission table scrollable

View differences:

branches/2.8.x/CHANGELOG
11 11
! = Update/Change
12 12

  
13 13
=========================== add small Features 2.8.2 ==========================
14
19 Jan-2012 Build 1582 Dietmar Woellbrink (Luisehahne)
15
# wysiwyg module, fix issues with magic_quote_gpc if on
16
# form module, fix regex for radio and checkbox (Tks to Ruud)
17
! form module, make show submission table scrollable
14 18
17 Jan-2012 Build 1581 Werner v.d.Decken(DarkViper)
15 19
# wysiwyg module some little typo fixes a.s.o.
16 20
17 Jan-2012 Build 1580 Dietmar Woellbrink (Luisehahne)
branches/2.8.x/wb/admin/interface/version.php
52 52

  
53 53
// check if defined to avoid errors during installation (redirect to admin panel fails if PHP error/warnings are enabled)
54 54
if(!defined('VERSION')) define('VERSION', '2.8.2');
55
if(!defined('REVISION')) define('REVISION', '1581');
55
if(!defined('REVISION')) define('REVISION', '1582');
56 56
if(!defined('SP')) define('SP', 'SP2');
branches/2.8.x/wb/modules/form/view.php
75 75
		$field_id = $params[0][0];
76 76
		$seperator = $params[0][1];
77 77

  
78
		$label_id = 'wb_'.preg_replace('/[^a-z0-1]/i', '_', $key).$field_id;
78
		$label_id = 'wb_'.preg_replace('/[^a-z0-9]/i', '_', $key).$field_id;
79 79
		if(in_array($key, $params[1])) {
80 80
			$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;
81 81
		} else {
......
89 89
		$field_id = $params[0];
90 90
		$group = $params[1];
91 91
		$seperator = $params[2];
92
		$label_id = 'wb_'.preg_replace('/[^a-z0-1]/i', '_', $n).$field_id;
92
		$label_id = 'wb_'.preg_replace('/[^a-z0-9]/i', '_', $n).$field_id;
93 93
		if($n == $params[3]) {
94 94
			$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;
95 95
		} else {
branches/2.8.x/wb/modules/form/backend.js
1
/**
2
 *
3
 *  Scrollable HTML table
4
 *  http://www.webtoolkit.info/
5
 *  for Chrome, Safari, Opera
6
 *  http://s7u.blogspot.com/
7
 **/
8

  
9
 function ScrollableTable (tableEl, tableHeight, tableWidth) {
10
  tableHeight = tableHeight * screen.height * 0.01;
11
  this.initIEengine = function () {
12

  
13
   this.containerEl.style.overflowY = 'auto';
14
   if (this.tableEl.parentElement.clientHeight - this.tableEl.offsetHeight < 0) {
15
    this.tableEl.style.width = this.newWidth - this.scrollWidth +'px';
16
   } else {
17
    this.containerEl.style.overflowY = 'auto';
18
    this.containerEl.style.overflowX = 'hidden';
19
    this.tableEl.style.width = this.newWidth +'px';
20
   }
21

  
22
   if (this.thead) {
23
    var trs = this.thead.getElementsByTagName('tr');
24
    for (x=0; x < trs.length; x++) {
25
     trs[x].style.position ='relative';
26
     trs[x].style.setExpression("top",  "this.parentElement.parentElement.parentElement.scrollTop + 'px'");
27
    }
28
   }
29

  
30
   if (this.tfoot) {
31
    var trs = this.tfoot.getElementsByTagName('tr');
32
    for (x=0; x < trs.length; x++) {
33
     trs[x].style.position ='relative';
34
     trs[x].style.setExpression("bottom",  "(this.parentElement.parentElement.offsetHeight - this.parentElement.parentElement.parentElement.clientHeight - this.parentElement.parentElement.parentElement.scrollTop) + 'px'");
35
    }
36
   }
37

  
38
   eval("window.attachEvent('onresize', function () { document.getElementById('" + this.tableEl.id + "').style.visibility = 'hidden'; document.getElementById('" + this.tableEl.id + "').style.visibility = 'visible'; } )");
39
  };
40

  
41

  
42
  this.initFFengine = function () {
43
   this.containerEl.style.overflow = 'hidden';
44
   this.tableEl.style.width = this.newWidth + 'px';
45
   var headHeight = (this.thead) ? this.thead.clientHeight : 0;
46
   var footHeight = (this.tfoot) ? this.tfoot.clientHeight : 0;
47

  
48

  
49
   var bodyHeight = this.tbody.clientHeight;
50
   var trs = this.tbody.getElementsByTagName('tr');
51
   if (bodyHeight >= (this.newHeight - (headHeight + footHeight))) {
52
     this.tbody.style.overflow = 'scroll';
53
   }
54
   else {
55
  this.tbody.style.overflow = 'auto';
56
   }
57
   /*
58
    Chrome is built on Mozilla. Some script to assign width for tables dynamically.
59
   */
60
 var isChrome = (navigator.userAgent.toUpperCase().indexOf('MOZILLA')> -1 || navigator.userAgent.toUpperCase().indexOf('OPERA')> -1);
61

  
62
   if(isChrome){
63
    this.thead.style.display ="inline-block";
64
    this.tfoot.style.display ="inline-block";
65
    this.tbody.style.display ="inline-block";
66
    this.tbody.style.overflow ="auto";
67

  
68

  
69
    var count = trs[0].getElementsByTagName('th').length || trs[0].getElementsByTagName('td').length;
70
    var colArray = new Array(count);
71

  
72
    /*Thead*/
73
    trs = this.tableEl.getElementsByTagName('tr');
74
    for(var i=0; i < trs.length ; i++ ){
75
     var cols = trs[i].getElementsByTagName('th') || trs[i].getElementsByTagName('td');
76
     for(var j=0; j < cols.length ; j++){
77
      if(colArray[j]==null || colArray[j] < cols[j].clientWidth){
78
       colArray[j] =cols[j].clientWidth;
79
      }
80
     }
81
    }
82

  
83
    var sumArray=0;
84
    for(i =0; i < colArray.length; i++){
85
     sumArray += colArray[i];
86
    }
87

  
88
    /* if the width of any cell is greater */
89
    if (sumArray < (this.newWidth - this.scrollWidth)){
90
     var newCount =0;
91
     var nWidth =0;
92
     for(i =0; i < colArray.length; i++){
93
      var wid = (this.newWidth - this.scrollWidth)/count;
94
      if(wid < colArray[i]){
95
       newCount++;
96
       nWidth += colArray[i];
97
      }
98
     }
99
     var newWid = ((this.newWidth - this.scrollWidth) - nWidth)/(count-newCount);
100
     for(i =0; i < colArray.length; i++){
101
      var wid = (this.newWidth - this.scrollWidth)/count;
102
      if(wid >= colArray[i]){
103
       colArray[i]= newWid;
104
      }
105
     }
106
    }
107

  
108
    /*Thead */
109
    trs = this.thead.getElementsByTagName('tr');
110
    for(var i=0; i < trs.length ; i++ ){
111
     var cols = trs[i].getElementsByTagName('th')||trs[i].getElementsByTagName('td');
112
     for(var j=0; j < cols.length ; j++){
113
      cols[j].style.width = colArray[j] + 'px';
114
     }
115
     var tcell1 = trs[i].insertCell(cols.length);
116
     tcell1.setAttribute("width", this.scrollWidth -2 +'px' );
117
    }
118
    /*Tbody */
119
    trs = this.tbody.getElementsByTagName('tr');
120
    for(var i=0; i < trs.length ; i++ ){
121
     var cols = trs[i].getElementsByTagName('td');
122
     for(var j=0; j < cols.length ; j++){
123
      cols[j].style.width = colArray[j] + 'px';
124
     }
125
    }
126
    /*Tfoot */
127
    trs = this.tfoot.getElementsByTagName('tr');
128
    for(var i=0; i < trs.length ; i++ ){
129
     var cols = trs[i].getElementsByTagName('th')||trs[i].getElementsByTagName('td');
130
     for(var j=0; j < cols.length ; j++){
131
      cols[j].style.width = colArray[j] + 'px';
132
     }
133
     var tcell1 = trs[i].insertCell(cols.length);
134
     tcell1.setAttribute("width", this.scrollWidth -2 +'px');
135
    }
136

  
137
   }
138
   else{ // else block is for Firefox
139
    trs = this.tbody.getElementsByTagName('tr');
140
    for (x=0; x < trs.length; x++) {
141
     var tds = trs[x].getElementsByTagName('td');
142
     tds[tds.length-1].style.paddingRight += this.scrollWidth + 'px';
143
    }
144

  
145
   }
146

  
147
   var cellSpacing = (this.tableEl.offsetHeight - (this.tbody.clientHeight + headHeight + footHeight)) / 4;
148
   this.tbody.style.height = (this.newHeight - (headHeight + cellSpacing * 2) - (footHeight + cellSpacing * 2)) + 'px';
149

  
150
  };
151

  
152
  this.tableEl = tableEl;
153
  this.scrollWidth = 16;
154

  
155
  this.originalHeight = this.tableEl.clientHeight;
156
  this.originalWidth = this.tableEl.clientWidth;
157

  
158
  this.newHeight = parseInt(tableHeight);
159
  this.newWidth = tableWidth ? parseInt(tableWidth) : this.originalWidth;
160

  
161
  this.tableEl.style.height = 'auto';
162
  this.tableEl.removeAttribute('height');
163

  
164
  this.containerEl = this.tableEl.parentNode.insertBefore(document.createElement('div'), this.tableEl);
165
  this.containerEl.appendChild(this.tableEl);
166
  this.containerEl.style.height = this.newHeight + 'px';
167
  this.containerEl.style.width = this.newWidth + 'px';
168

  
169

  
170
  var thead = this.tableEl.getElementsByTagName('thead');
171
  this.thead = (thead[0]) ? thead[0] : null;
172

  
173
  var tfoot = this.tableEl.getElementsByTagName('tfoot');
174
  this.tfoot = (tfoot[0]) ? tfoot[0] : null;
175

  
176
  var tbody = this.tableEl.getElementsByTagName('tbody');
177
  this.tbody = (tbody[0]) ? tbody[0] : null;
178

  
179
  if (!this.tbody) return;
180
   this.containerEl.style.overflow = 'auto';
181

  
182
  if (document.all && document.getElementById && !window.opera) this.initIEengine();
183
  if (!document.all && document.getElementById ) this.initFFengine();
184

  
185

  
186
 }
0 187

  
branches/2.8.x/wb/modules/form/view_submission.php
54 54
</tr>
55 55
<tr>
56 56
	<td><?php echo $TEXT['SUBMITTED']; ?>:</td>
57
	<td><?php echo gmdate(TIME_FORMAT.', '.DATE_FORMAT, $submission['submitted_when']+TIMEZONE); ?></td>
57
	<td><?php echo gmdate(DATE_FORMAT .', '.TIME_FORMAT, $submission['submitted_when']+TIMEZONE); ?></td>
58 58
</tr>
59 59
<tr>
60 60
	<td><?php echo $TEXT['USER']; ?>:</td>
branches/2.8.x/wb/modules/form/modify.php
28 28
if(function_exists('ini_set')) {
29 29
	ini_set('arg_separator.output', '&amp;');
30 30
}
31

  
31 32
include_once(WB_PATH.'/framework/functions.php');
32 33

  
33 34
$sec_anchor = (defined( 'SEC_ANCHOR' ) && ( SEC_ANCHOR != '' )  ? '#'.SEC_ANCHOR.$section['section_id'] : '' );
......
42 43
}
43 44

  
44 45
?>
45
<table summary="" cellpadding="0" cellspacing="0" border="0" width="100%">
46
<table summary="" cellpadding="0" cellspacing="0" border="0" width="916">
46 47
<tr>
47 48
	<td align="left" width="33%">
48 49
		<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 68
		$num_fields = $query_fields->numRows();
68 69
		$row = 'a';
69 70
		?>
70
		<table summary="" cellpadding="2" cellspacing="0" border="0" width="100%">
71
		<table summary="" cellpadding="2" cellspacing="0" border="0">
72
		<thead>
71 73
			<tr style="background-color: #dddddd; font-weight: bold;">
72
				<td width="20" style="padding-left: 5px;">&nbsp;</td>
73
				<td width="30" style="text-align: right;">ID</td>
74
				<td width="400"><?php print $TEXT['FIELD']; ?></td>
75
				<td width="175"><?php print $TEXT['TYPE']; ?></td>
76
				<td width="100"><?php print $TEXT['REQUIRED']; ?></td>
77
				<td width="175">
74
				<th width="20" style="padding-left: 5px;">&nbsp;</th>
75
				<th width="30" style="text-align: right;">ID</th>
76
				<th width="400"><?php print $TEXT['FIELD']; ?></th>
77
				<th width="175"><?php print $TEXT['TYPE']; ?></th>
78
				<th width="100"><?php print $TEXT['REQUIRED']; ?></th>
79
				<th width="175">
78 80
				<?php
79 81
					echo $TEXT['MULTISELECT'];
80 82
				?>
81
				</td>
82
				<td width="175" colspan="3">
83
				</th>
84
				<th width="175" colspan="3">
83 85
				<?php
84 86
					echo $TEXT['ACTIONS'];
85 87
				?>
86
				</td>
88
				</th>
87 89
			</tr>
90
		</thead>
91
		<tbody>
88 92
		<?php
89 93
		while($field = $query_fields->fetchRow(MYSQL_ASSOC)) {
90 94
			?>
......
123 127
					}
124 128
					?>
125 129
				</td>
126
				<td>
130
				<td style="text-align: center;">
127 131
				<?php
128 132
				if ($field['type'] != 'group_begin') {
129 133
					if($field['required'] == 1) { echo $TEXT['YES']; } else { echo $TEXT['NO']; }
......
138 142
				}
139 143
				?>
140 144
				</td>
141
				<td width="20">
145
				<td width="20" style="text-align: center;">
142 146
				<?php if($field['position'] != 1) { ?>
143 147
					<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']; ?>">
144 148
						<img src="<?php echo THEME_URL; ?>/images/up_16.png" border="0" alt="^" />
145 149
					</a>
146 150
				<?php } ?>
147 151
				</td>
148
				<td width="20">
152
				<td width="20" style="text-align: center;">
149 153
				<?php if($field['position'] != $num_fields) { ?>
150 154
					<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']; ?>">
151 155
						<img src="<?php echo THEME_URL; ?>/images/down_16.png" border="0" alt="v" />
152 156
					</a>
153 157
				<?php } ?>
154 158
				</td>
155
				<td width="20">
159
				<td width="20" style="text-align: center;">
156 160
<?php
157 161
				$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']))
158
 ?>
162
?>
159 163
					<a href="javascript: confirm_link('<?php echo url_encode($TEXT['ARE_YOU_SURE']); ?>', '<?php echo $url; ?>');" title="<?php echo $TEXT['DELETE']; ?>">
160 164
						<img src="<?php echo THEME_URL; ?>/images/delete_16.png" border="0" alt="X" />
161 165
					</a>
162 166
				</td>
163 167
			</tr>
164
			<?php
168
<?php
165 169
			// Alternate row color
166 170
			if($row == 'a') {
167 171
				$row = 'b';
......
169 173
				$row = 'a';
170 174
			}
171 175
		}
172
		?>
176
?>
177
		</tbody>
173 178
		</table>
174 179
		<?php
175 180
	} else {
......
183 188
<h2><?php echo $TEXT['SUBMISSIONS']; ?></h2>
184 189

  
185 190
<?php
186

  
187 191
// Query submissions table
188
$sql  = 'SELECT * FROM `'.TABLE_PREFIX.'mod_form_submissions` ';
192
/*
193
$sql  = 'SELECT * FROM `'.TABLE_PREFIX.'mod_form_submissions`  ';
189 194
$sql .= 'WHERE `section_id` = '.(int)$section_id.' ';
190 195
$sql .= 'ORDER BY `submitted_when` ASC ';
196
*/
197
$sql  = 'SELECT s.*, u.`display_name` ';
198
$sql .=            'FROM `'.TABLE_PREFIX.'mod_form_submissions` s ';
199
$sql .= 'LEFT OUTER JOIN `'.TABLE_PREFIX.'users` u ';
200
$sql .= 'ON u.`user_id` = s.`submitted_by` ';
201
$sql .= 'WHERE s.`section_id` = '.(int)$section_id.' ';
202
$sql .= 'ORDER BY s.`submitted_when` ASC ';
203

  
191 204
if($query_submissions = $database->query($sql)) {
205
?>
206
<!-- submissions -->
207
		<table summary="" cellpadding="2" cellspacing="0" border="0" class="" id="frm-ScrollTable" >
208
		<thead>
209
		<tr style="background-color: #dddddd; font-weight: bold;">
210
			<th width="23" style="text-align: center;">&nbsp;</th>
211
			<th width="33" style="text-align: right;"> ID </th>
212
			<th width="250" style="padding-left: 10px;"><?php echo $TEXT['SUBMITTED'] ?></th>
213
			<th width="240" style="padding-left: 10px;"><?php echo $TEXT['USER']; ?></th>
214
			<th width="250">&nbsp;</th>
215
			<th width="20">&nbsp;</th>
216
			<th width="20">&nbsp;</th>
217
			<th width="20">&nbsp;</th>
218
			<th width="20">&nbsp;</th>
219
		</tr>
220
		</thead>
221
		<tbody>
222
<?php
192 223
	if($query_submissions->numRows() > 0) {
193
		?>
194
		<table summary="" cellpadding="2" cellspacing="0" border="0" width="100%">
195
		<?php
196 224
		// List submissions
197 225
		$row = 'a';
198 226
		while($submission = $query_submissions->fetchRow(MYSQL_ASSOC)) {
199
			?>
227
        $submission['display_name'] = (($submission['display_name']!=null) ? $submission['display_name'] : $TEXT['UNKNOWN']);
228
?>
200 229
			<tr class="row_<?php echo $row; ?>">
201
				<td width="20" style="padding-left: 5px;">
230
				<td width="20" style="padding-left: 5px;text-align: center;">
202 231
					<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']; ?>">
203 232
						<img src="<?php echo THEME_URL; ?>/images/folder_16.png" alt="<?php echo $TEXT['OPEN']; ?>" border="0" />
204 233
					</a>
205 234
				</td>
206
				<td width="237"><?php echo $TEXT['SUBMISSION_ID'].': '.$submission['submission_id']; ?></td>
207
				<td><?php echo $TEXT['SUBMITTED'].': '.gmdate(TIME_FORMAT.', '.DATE_FORMAT, $submission['submitted_when']+TIMEZONE); ?></td>
208
				<td width="20">
235
				<td width="30" style="padding-right: 5px;text-align: right;"><?php echo $submission['submission_id']; ?></td>
236
				<td width="250" style="padding-left: 10px;"><?php echo gmdate(DATE_FORMAT.', '.TIME_FORMAT, $submission['submitted_when']+TIMEZONE ); ?></td>
237
				<td width="250" style="padding-left: 10px;"><?php echo $submission['display_name']; ?></td>
238
				<td width="240">&nbsp;</td>
239
				<td width="20" style="text-align: center;">&nbsp;</td>
240
				<td width="20">&nbsp;</td>
241
				<td width="20" style="text-align: center;">
209 242
<?php
210 243
				$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']))
211
 ?>
244
?>
212 245
					<a href="javascript: confirm_link('<?php echo url_encode($TEXT['ARE_YOU_SURE']); ?>', '<?php echo $url; ?>');" title="<?php echo $TEXT['DELETE']; ?>">
213 246
						<img src="<?php echo THEME_URL; ?>/images/delete_16.png" border="0" alt="X" />
214 247
					</a>
215 248
				</td>
249
				<td width="20">&nbsp;</td>
216 250
			</tr>
217
			<?php
251
<?php
218 252
			// Alternate row color
219 253
			if($row == 'a') {
220 254
				$row = 'b';
......
222 256
				$row = 'a';
223 257
			}
224 258
		}
225
		?>
226
		</table>
227
		<?php
228 259
	} else {
229
		echo $TEXT['NONE_FOUND'];
260
?>
261
<tr><td><?php echo $TEXT['NONE_FOUND'] ?></td></tr>
262
<?php
230 263
	}
231
}
264
?>
265
		</tbody>
266
		<tfoot>
267
		<tr style="background-color: #dddddd; font-weight: bold;">
268
			<th width="23" style="text-align: center;">&nbsp;</th>
269
			<th width="33" style="text-align: right;"> ID </th>
270
			<th width="250" style="padding-left: 10px;"><?php echo $TEXT['SUBMITTED'] ?></th>
271
			<th width="250" style="padding-left: 10px;"><?php echo $TEXT['USER']; ?></th>
272
			<th width="250">&nbsp;</th>
273
			<th width="20">&nbsp;</th>
274
			<th width="20">&nbsp;</th>
275
			<th width="20">&nbsp;</th>
276
			<th width="20">&nbsp;</th>
277
		</tr>
278
		</tfoot>
279
		</table>
280
<?php
281
} else {
282
	echo $database->get_error().'<br />';
283
	echo $sql;
284
}
285
?>
286
<script type="text/javascript">
287
var t = new ScrollableTable(document.getElementById('frm-ScrollTable'), 30, 916);
288
</script>
branches/2.8.x/wb/modules/form/backend.css
1 1
.frm-setting_name { vertical-align :top; width :30%; white-space :nowrap; }
2 2
.frm-setting_value { vertical-align :top; width :70%; }
3 3
.frm-newsection { border-top :1px dashed #ffffff; }
4
.row_a { background : transparent; }
5
.row_b { background : #dfebff; }
4 6
/* 
5 7
  The definitions below provide the style for the edit CSS button 
6 8
  Required CSS class name: input.mod_moduledirectory_edit_css
7 9
*/
8 10
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; }
11

  
12

  
13
  table#frm-ScrollTable { text-align :left; font-size :12px; border :1px ridge #dadada; font-family :verdana; background :transparent; color :#0066ff; }
14
  table#frm-ScrollTable thead  { cursor :pointer; }
15
  table#frm-ScrollTable thead tr,
16
  table#frm-ScrollTable tfoot tr { background :transparent; }
17
  table#frm-ScrollTable tbody tr {  }
18
  td, th { border :0px ridge #dadada; }

Also available in: Unified diff