Project

General

Profile

« Previous | Next » 

Revision 552

Added by thorn almost 17 years ago

added new module-based search-function and publish-by-date code

View differences:

sections.php
135 135
	// Make our own menu list
136 136
	$block[1] = $TEXT['MAIN'];
137 137
}
138
?>
138 139

  
140
<?php // include jscalendar-setup
141
	require_once(WB_PATH."/include/jscalendar/wb-setup.php");
142
	// override some vars:
143
	//$jscal_lang = "en"; //- calendar-language (default: wb-backend-language)
144
	//$jscal_today = ""; // - date, the calendar offers if the text-field is empty (default: today)
145
	//$jscal_firstday = "0"; // - first-day-of-week (0-sunday, 1-monday, ...) (default: 0(EN) or 1(everything else))
146
	//$jscal_format = "Y-m-d H:i"; // - initial-format used for the text-field (default: from wb-backend-date-format)
147
	//$jscal_ifformat = "%Y-%m-%d %H:%M"; // - format for jscalendar (default: wb-backend-date-format)
139 148
?>
140 149
<table cellpadding="5" cellspacing="0" border="0" align="center" width="100%" height="50" style="margin-bottom: 10px;">
141 150
<tr style="background-color: #F0F0F0;">
......
154 163
</table>
155 164

  
156 165
<?php
157
$query_sections = $database->query("SELECT section_id,module,position,block FROM ".TABLE_PREFIX."sections WHERE page_id = '$page_id' ORDER BY position ASC");
166
$query_sections = $database->query("SELECT section_id,module,position,block,publ_start,publ_end FROM ".TABLE_PREFIX."sections WHERE page_id = '$page_id' ORDER BY position ASC");
158 167
if($query_sections->numRows() > 0) {
159 168
?>
160 169
<form name="section_properties" action="<?php echo ADMIN_URL; ?>/pages/sections_save.php?page_id=<?php echo $page_id; ?>" method="post">
......
165 174
	<?php if(SECTION_BLOCKS) { ?>
166 175
	<td style="display: {DISPLAY_BLOCK}"><?php echo $TEXT['BLOCK']; ?>:</td>
167 176
	<?php } ?>
177
	<td><?php echo $TEXT['PUBL_START_DATE']; ?>:</td>
178
	<td><?php echo $TEXT['PUBL_END_DATE']; ?>:</td>
168 179
	<td colspan="3" width="60"><?php echo $TEXT['ACTIONS']; ?>:</td>
169 180
</tr>
170 181
<?php
......
175 186
		if(!is_numeric(array_search($section['module'], $module_permissions))) {
176 187
			?>
177 188
			<tr>
178
				<td style="width: 250px;"><a href="<?php echo ADMIN_URL; ?>/pages/modify.php?page_id=<?php echo $page_id; ?>#<?php echo $section['section_id']; ?>"><?php echo $module_name; ?></a></td>
189
				<td style="width: <?php if(SECTION_BLOCKS) print "120"; else print "200"; ?>px;"><a href="<?php echo ADMIN_URL; ?>/pages/modify.php?page_id=<?php echo $page_id; ?>#<?php echo $section['section_id']; ?>"><?php echo $module_name; ?></a></td>
179 190
				<?php if(SECTION_BLOCKS) { ?>
180 191
				<td>
181 192
					<select name="block<?php echo $section['section_id']; ?>" style="width: 150px;">
......
188 199
						?>
189 200
					</select>
190 201
				</td>
191
				<?php } ?>
202
				<?php } // jscalendar-stuff following ?>
203
				<td><input type="text" id="start_date<?php echo $section['section_id']; ?>" name="start_date<?php echo $section['section_id']; ?>" value="<?php if($section['publ_start']==0) print ""; else print date($jscal_format, $section['publ_start'])?>" style="width: 120px;" />
204
					<img src="<?php echo WB_URL ?>/include/jscalendar/img.gif" id="trigger_start<?php echo $section['section_id']; ?>" style="cursor: pointer; border: 1px solid red;" title="Calendar" onmouseover="this.style.background='red';" onmouseout="this.style.background=''" /></td>
205
				<td><input type="text" id="end_date<?php echo $section['section_id']; ?>" name="end_date<?php echo $section['section_id']; ?>" value="<?php if($section['publ_end']==0) print ""; else print date($jscal_format, $section['publ_end'])?>" style="width: 120px;" />
206
					<img src="<?php echo WB_URL ?>/include/jscalendar/img.gif" id="trigger_stop<?php echo $section['section_id']; ?>" style="cursor: pointer; border: 1px solid red;" title="Calendar" onmouseover="this.style.background='red';" onmouseout="this.style.background=''" /></td>
192 207
				<td width="20">
193 208
					<?php if($section['position'] != 1) { ?>
194 209
					<a href="<?php echo ADMIN_URL; ?>/pages/move_up.php?page_id=<?php echo $page_id; ?>&section_id=<?php echo $section['section_id']; ?>">
......
214 229
	}
215 230
	?>
216 231
	<tr>
217
		<td>&nbsp;</td>
218
		<?php if(SECTION_BLOCKS) { ?>
219
		<td><input type="submit" name="save" value="<?php echo $TEXT['SAVE']; ?>" style="width: 150px;" /></td>
220
		<?php } ?>
221
		<td colspan="3" width="60">&nbsp;</td>
232
		<td align="center" colspan="<?php if(SECTION_BLOCKS) print "7"; else print "6"; ?>"><input type="submit" name="save" value="<?php echo $TEXT['SAVE']; ?>" style="width: 150px;" /></td>
222 233
	</tr>
223 234
	</table>
224 235

  
225 236
</form>
226

  
227 237
<?php
238
	// now add the calendars -- remember to to set the range to [1970, 2037] if the date is used as timestamp!
239
	// the loop is simply a copy from above.
240
	$query_sections = $database->query("SELECT section_id,module FROM ".TABLE_PREFIX."sections WHERE page_id = '$page_id' ORDER BY position ASC");
241
	if($query_sections->numRows() > 0) {
242
		$num_sections = $query_sections->numRows();
243
		while($section = $query_sections->fetchRow()) {
244
			// Get the modules real name
245
			$module_name=$database->get_one("SELECT name FROM ".TABLE_PREFIX."addons WHERE directory='".$section['module']."'");
246
			if(!is_numeric(array_search($section['module'], $module_permissions))) {
247
	?>			
248
				<script type="text/javascript">
249
					Calendar.setup(
250
						{
251
							inputField  : "start_date<?php echo $section['section_id']; ?>",
252
							ifFormat    : "<?php echo $jscal_ifformat ?>",
253
							button      : "trigger_start<?php echo $section['section_id']; ?>",
254
							firstDay    : <?php echo $jscal_firstday ?>,
255
							showsTime   : "true",
256
							timeFormat  : "24",
257
							date        : "<?php echo $jscal_today ?>",
258
							range       : [1970, 2037],
259
							step        : 1
260
						}
261
					);
262
				</script>
263
				<script type="text/javascript">
264
					Calendar.setup(
265
						{
266
							inputField  : "end_date<?php echo $section['section_id']; ?>",
267
							ifFormat    : "<?php echo $jscal_ifformat ?>",
268
							button      : "trigger_stop<?php echo $section['section_id']; ?>",
269
							firstDay    : <?php echo $jscal_firstday ?>,
270
							showsTime   : "true",
271
							timeFormat  : "24",
272
							date        : "<?php echo $jscal_today ?>",
273
							range       : [1970, 2037],
274
							step        : 1
275
						}
276
					);
277
				</script>
278
<?php
279
			}
280
		}
281
	}
282
?>
283
<?php
228 284
}
229 285

  
230 286
// Work-out if we should show the "Add Section" form
......
268 324
// Print admin footer
269 325
$admin->print_footer();
270 326

  
271
?>
327
?>

Also available in: Unified diff