18 require_once SQ_PACKAGES_PATH.
'/cms/listing_engine/listing_engine_edit_fns.inc';
42 parent::__construct();
59 $ranges = $asset->attr(
'date_ranges');
62 echo translate(
'cms_whats_new_no_ranges');
64 foreach ($ranges as $id => $info) {
65 $options[$id] = $info[
'name'];
67 $options = array_reverse($options);
68 $options[] =
'-- '.translate(
'please_select').
' --';
69 $options = array_reverse($options);
71 combo_box($prefix.
'_range_id', $options, FALSE,
'', 0 ,
'onchange="this.form.submit();"');
108 if (!$asset->writeAccess(
'attributes'))
return FALSE;
109 check_box($prefix.
'_new_range');
145 require_once SQ_ATTRIBUTES_PATH.
'/datetime/datetime.inc';
146 $write_access = $asset->writeAccess(
'attributes');
148 if ($asset->attr(
'range_type') !==
'default') {
149 $range = $asset->attr(
'range_type');
150 $date_range_from =
'---------- --:--:--';
151 $date_range_to =
'---------- --:--:--';
154 $date_range_from = $asset->attr(
'date_range_from');
155 $date_range_to = $asset->attr(
'date_range_to');
158 $range_types = Array(
159 'default' =>
'Specified Range',
161 'week' =>
'This Week',
162 'month' =>
'This Month',
163 'year' =>
'This Year',
166 $o->openField(
'Range Type');
167 if ($write_access === TRUE) {
168 combo_box($prefix.
'_range_type', $range_types, FALSE, $range);
171 echo $range_types[$range];
173 $o->note(translate(
'cms_whats_new_range_type_note'));
176 foreach (Array(
'date_range_from',
'date_range_to') as $type) {
178 $o->openField(ucwords(str_replace(
'_',
' ', $type)));
182 $datetime->_edit_params[
'allow_period'] = TRUE;
183 $datetime->_edit_params[
'allow_period_today'] = TRUE;
184 $datetime->_edit_params[
'use_picker'] = TRUE;
185 $datetime->_edit_params[
'show'] = Array(
'y',
'm',
'd',
'h',
'i',
's');
186 $datetime->_edit_params[
'null'] = Array(
'y',
'm',
'd',
'h',
'i',
's');
188 foreach ($datetime->_edit_params[
'show'] as $u) {
189 $datetime->_edit_params[
'style'][$u] =
's';
191 $datetime->_edit_params[
'style'][
'y'] =
't';
192 $datetime->value = $$type;
194 $datetime->paint($prefix.
'_'.$type, !$write_access);
199 return $write_access;
216 if ($asset->writeAccess(
'attributes') === FALSE) {
220 require_once SQ_ATTRIBUTES_PATH.
'/datetime/datetime.inc';
222 $range_type = array_get_index($_POST, $prefix.
'_range_type',
'default');
225 if ($range_type !==
'default') {
226 if ($asset->attr(
'range_type') !== $range_type) {
227 $asset->setAttrValue(
'range_type', $range_type);
228 $asset->setAttrValue(
'date_range_from',
'---------- --:--:--');
229 $asset->setAttrValue(
'date_range_to',
'---------- --:--:--');
233 $asset->setAttrValue(
'range_type',
'default');
234 foreach (Array(
'date_range_from',
'date_range_to') as $type) {
236 $datetime->process($prefix.
'_'.$type);
238 if ($asset->attr($type) !== $datetime->value) {
239 $asset->setAttrValue($type, $datetime->value);
262 require_once SQ_ATTRIBUTES_PATH.
'/datetime/datetime.inc';
263 $write_access = $asset->writeAccess(
'attributes');
264 $ranges = $asset->attr(
'date_ranges');
266 if (isset($_POST[$prefix.
'_new_range'])) {
268 }
else if (isset($_POST[$prefix.
'_range_id']) && $_POST[$prefix.
'_range_id'] != 0 && isset($ranges[$_POST[$prefix.
'_range_id'] - 1])) {
270 $rangeid = $_POST[$prefix.
'_range_id'] - 1;
272 echo translate(
'cms_whats_new_select_range');
276 $range_name = isset($ranges[$rangeid][
'name']) ? $ranges[$rangeid][
'name'] :
'';
277 $o->addHiddenField($prefix.
'_curr_range_id', $rangeid);
282 text_box($prefix.
'_range_name', $range_name);
289 if ($rangeid === -1) {
291 $oldest_date =
'---------- --:--:--';
292 $newest_date =
'---------- --:--:--';
293 }
else if (array_key_exists(
'range_type', $ranges[$rangeid]) === TRUE) {
294 $range = $ranges[$rangeid][
'range_type'];
295 $oldest_date = isset($ranges[$rangeid][
'oldest_date']) ? $ranges[$rangeid][
'oldest_date'] :
'---------- --:--:--';
296 $newest_date = isset($ranges[$rangeid][
'newest_date']) ? $ranges[$rangeid][
'newest_date'] :
'---------- --:--:--';
299 $oldest_date =
'---------- --:--:--';
300 $newest_date =
'---------- --:--:--';
303 $range_types = Array(
304 'default' =>
'Specified Range',
306 'week' =>
'This Week',
307 'month' =>
'This Month',
308 'year' =>
'This Year',
311 $o->openField(
'Range Type');
312 if ($write_access === TRUE) {
313 combo_box($prefix.
'_range_type', $range_types, FALSE, $range);
315 echo $range_types[$range];
317 $o->note(translate(
'cms_whats_new_range_type_note'));
320 foreach (Array(
'oldest_date',
'newest_date') as $type) {
322 $o->openField(ucwords(str_replace(
'_',
' ', $type)));
326 $datetime->_edit_params[
'allow_period'] = TRUE;
327 $datetime->_edit_params[
'allow_period_today'] = TRUE;
328 $datetime->_edit_params[
'use_picker'] = TRUE;
329 $datetime->_edit_params[
'show'] = Array(
'y',
'm',
'd',
'h',
'i',
's');
330 $datetime->_edit_params[
'null'] = Array(
'y',
'm',
'd',
'h',
'i',
's');
332 foreach ($datetime->_edit_params[
'show'] as $u) {
333 $datetime->_edit_params[
'style'][$u] =
's';
335 $datetime->value = $$type;
337 $datetime->paint($prefix.
'_'.$type, !$write_access);
343 if ($asset->writeAccess(
'attributes') && trim($range_name) !=
'') {
344 $o->openField(translate(
'remove_question'));
345 check_box($prefix.
'_remove', FALSE);
349 return $write_access;
366 if (!isset($_POST[$prefix.
'_curr_range_id']) || !isset($_POST[$prefix.
'_range_name']) ) {
369 require_once SQ_ATTRIBUTES_PATH.
'/datetime/datetime.inc';
371 $ranges = $asset->attr(
'date_ranges');
372 $rangeid = $_POST[$prefix.
'_curr_range_id'];
373 $range_name = $_POST[$prefix.
'_range_name'];
374 $range_type = array_get_index($_POST, $prefix.
'_range_type',
'default');
377 if (isset($_POST[$prefix.
'_remove'])) {
378 unset($ranges[$rangeid]);
383 if ($rangeid == -1) {
385 if (trim($range_name) ==
'')
return FALSE;
386 $ranges[count($ranges)] = Array(
'name' => $range_name);
387 $current_range =& $ranges[count($ranges) - 1];
390 $current_range =& $ranges[$rangeid];
391 if (trim($range_name) !=
'' && $range_name != $current_range[
'name']) {
392 $current_range[
'name'] = $range_name;
397 if ($range_type !==
'default') {
398 if (array_get_index($current_range,
'range_type',
'default') !== $range_type) {
399 $current_range[
'range_type'] = $range_type;
400 unset($current_range[
'oldest_date']);
401 unset($current_range[
'newest_date']);
405 $current_range[
'range_type'] =
'default';
406 foreach (Array(
'oldest_date',
'newest_date') as $type) {
408 $datetime->process($prefix.
'_'.$type);
410 if (isset($current_range[$type]) && $current_range[$type] == $datetime->value) {
413 $current_range[$type] = $datetime->value;
420 $ranges = array_values($ranges);
421 $asset->setAttrValue(
'date_ranges', $ranges);
440 require_once SQ_INCLUDE_PATH.
'/general_occasional.inc';
441 $write_access = $asset->writeAccess(
'attributes');
443 $current = $asset->attr(
'link_types');
444 $link_types = get_link_type_names();
447 require_once SQ_LIB_PATH.
'/html_form/html_form.inc';
450 foreach ($link_types as $link_type => $link_type_name) {
451 if ($current & $link_type) {
452 $selected[] = $link_type;
456 combo_box($prefix.
'_link_types', $link_types, TRUE, $selected);
459 echo translate(
'cms_listing_no_link_types_selected');
462 foreach ($link_types as $link_type => $link_type_name) {
463 if ($current & $link_type) {
464 echo
'<li>'.$link_type_name.
'</li>';
471 return $write_access;
489 if (!$asset->writeAccess(
'attributes'))
return FALSE;
492 if (isset($_POST[$prefix.
'_link_types'])) {
493 foreach ($_POST[$prefix.
'_link_types'] as $link_type) {
494 $link_types |= $link_type;
498 return $asset->setAttrValue(
'link_types', $link_types);