Project

General

Profile

« Previous | Next » 

Revision 1584

Added by Dietmar almost 13 years ago

! form module, shows email-adress from body tag
- remove scrollable table in overview form module

View differences:

branches/2.8.x/CHANGELOG
12 12

  
13 13
=========================== add small Features 2.8.2 ==========================
14 14
19 Jan-2012 Build 1583 Dietmar Woellbrink (Luisehahne)
15
! form module, shows email-adress from body tag
16
- remove scrollable table in overview form module 
15 17
! forgot upload save.php in wysiwyg module
16 18
19 Jan-2012 Build 1582 Dietmar Woellbrink (Luisehahne)
17 19
# wysiwyg module, fix issues with magic_quote_gpc if on
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', '1583');
55
if(!defined('REVISION')) define('REVISION', '1584');
56 56
if(!defined('SP')) define('SP', 'SP2');
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
 }
187 0

  
branches/2.8.x/wb/modules/form/view.php
469 469
						$sql .= 'submitted_by=\''.$submitted_by.'\', ';
470 470
						$sql .= 'body=\''.$email_body.'\' ';
471 471
						if($database->query($sql)) {
472
/*
472

  
473
						if(!$database->is_error()) {
474
							$success = true;
475
						}
473 476
						// Make sure submissions table isn't too full
474 477
						$query_submissions = $database->query("SELECT submission_id FROM ".TABLE_PREFIX."mod_form_submissions ORDER BY submitted_when");
475 478
						$num_submissions = $query_submissions->numRows();
......
484 487
								}
485 488
							}
486 489
						}
487
*/
488
						if(!$database->is_error()) {
489
							$success = true;
490
						}
491 490
					}  // numRows
492 491
	 			}
493 492
	 			}
branches/2.8.x/wb/modules/form/modify.php
29 29
	ini_set('arg_separator.output', '&amp;');
30 30
}
31 31

  
32
// load module language file
33
$lang = (dirname(__FILE__)) . '/languages/' . LANGUAGE . '.php';
34
require_once(!file_exists($lang) ? (dirname(__FILE__)) . '/languages/EN.php' : $lang );
35

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

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

  
45 49
?>
46
<table summary="" cellpadding="0" cellspacing="0" border="0" width="916">
50
<table summary="" width="100%" cellpadding="0" cellspacing="0" border="0" width="916">
47 51
<tr>
48 52
	<td align="left" width="33%">
49 53
		<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%;" />
......
68 72
		$num_fields = $query_fields->numRows();
69 73
		$row = 'a';
70 74
		?>
71
		<table summary="" cellpadding="2" cellspacing="0" border="0">
75
		<table summary="" width="100%" cellpadding="2" cellspacing="0" border="0">
72 76
		<thead>
73 77
			<tr style="background-color: #dddddd; font-weight: bold;">
74 78
				<th width="20" style="padding-left: 5px;">&nbsp;</th>
......
194 198
$sql .= 'WHERE `section_id` = '.(int)$section_id.' ';
195 199
$sql .= 'ORDER BY `submitted_when` ASC ';
196 200
*/
197
$sql  = 'SELECT s.*, u.`display_name` ';
201
$sql  = 'SELECT s.*, u.`display_name`, u.`email` ';
198 202
$sql .=            'FROM `'.TABLE_PREFIX.'mod_form_submissions` s ';
199 203
$sql .= 'LEFT OUTER JOIN `'.TABLE_PREFIX.'users` u ';
200 204
$sql .= 'ON u.`user_id` = s.`submitted_by` ';
......
204 208
if($query_submissions = $database->query($sql)) {
205 209
?>
206 210
<!-- submissions -->
207
		<table summary="" cellpadding="2" cellspacing="0" border="0" class="" id="frm-ScrollTable" >
211
		<table summary="" width="100%" cellpadding="2" cellspacing="0" border="0" class="" id="frm-ScrollTable" >
208 212
		<thead>
209 213
		<tr style="background-color: #dddddd; font-weight: bold;">
210 214
			<th width="23" style="text-align: center;">&nbsp;</th>
211 215
			<th width="33" style="text-align: right;"> ID </th>
212 216
			<th width="250" style="padding-left: 10px;"><?php echo $TEXT['SUBMITTED'] ?></th>
213 217
			<th width="240" style="padding-left: 10px;"><?php echo $TEXT['USER']; ?></th>
214
			<th width="250">&nbsp;</th>
218
			<th width="250"><?php echo $TEXT['EMAIL'].' '.$MOD_FORM['FROM'] ?></th>
215 219
			<th width="20">&nbsp;</th>
216 220
			<th width="20">&nbsp;</th>
217 221
			<th width="20">&nbsp;</th>
......
224 228
		// List submissions
225 229
		$row = 'a';
226 230
		while($submission = $query_submissions->fetchRow(MYSQL_ASSOC)) {
227
        $submission['display_name'] = (($submission['display_name']!=null) ? $submission['display_name'] : $TEXT['UNKNOWN']);
231
	        $submission['display_name'] = (($submission['display_name']!=null) ? $submission['display_name'] : '');
232
			$sBody = $submission['body'];
233
			$regex = "/[a-z0-9\-_]?[a-z0-9.\-_]+[a-z0-9\-_]?@[a-z0-9.-]+\.[a-z]{2,}/iU";
234
			preg_match ($regex, $sBody, $output);
235
			$submission['email'] = $output['0'];
228 236
?>
229 237
			<tr class="row_<?php echo $row; ?>">
230 238
				<td width="20" style="padding-left: 5px;text-align: center;">
......
235 243
				<td width="30" style="padding-right: 5px;text-align: right;"><?php echo $submission['submission_id']; ?></td>
236 244
				<td width="250" style="padding-left: 10px;"><?php echo gmdate(DATE_FORMAT.', '.TIME_FORMAT, $submission['submitted_when']+TIMEZONE ); ?></td>
237 245
				<td width="250" style="padding-left: 10px;"><?php echo $submission['display_name']; ?></td>
238
				<td width="240">&nbsp;</td>
246
				<td width="240"><?php echo $submission['email']; ?></td>
239 247
				<td width="20" style="text-align: center;">&nbsp;</td>
240 248
				<td width="20">&nbsp;</td>
241 249
				<td width="20" style="text-align: center;">
......
269 277
			<th width="33" style="text-align: right;"> ID </th>
270 278
			<th width="250" style="padding-left: 10px;"><?php echo $TEXT['SUBMITTED'] ?></th>
271 279
			<th width="250" style="padding-left: 10px;"><?php echo $TEXT['USER']; ?></th>
272
			<th width="250">&nbsp;</th>
280
			<th width="250"><?php echo $TEXT['EMAIL'].' '.$MOD_FORM['FROM'] ?></th>
273 281
			<th width="20">&nbsp;</th>
274 282
			<th width="20">&nbsp;</th>
275 283
			<th width="20">&nbsp;</th>
......
282 290
	echo $database->get_error().'<br />';
283 291
	echo $sql;
284 292
}
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
9 9
*/
10 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 11

  
12

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

Also available in: Unified diff