18 require_once SQ_CORE_PACKAGE_PATH.
'/page/page_edit_fns.inc';
19 require_once SQ_LIB_PATH.
'/html_form/html_form.inc';
43 parent::__construct();
44 $this->static_screens[
'details'][
'force_unlock'] = 0;
61 $write_access = $asset->writeAccess(
'attributes');
63 <table
class=
"sq-backend-table">
65 <td
class=
"sq-backend-table-header"><?php echo translate(
'cal_page_event_location'); ?></td>
66 <td
class=
"sq-backend-table-header"><?php echo translate(
'cal_page_event_css_class'); ?></td>
69 $locations = $asset->attr(
'root_nodes');
70 $location_info = $GLOBALS[
'SQ_SYSTEM']->am->getAssetInfo(array_keys($locations));
73 foreach ($locations as $location => $details) {
76 <td
class=
"sq-backend-table-cell">
79 asset_finder($prefix.
'_root_nodes['.$l.
']', $location);
81 echo get_asset_tag_line($location);
86 <td
class=
"sq-backend-table-cell">
89 text_box($prefix.
'_node_classes['.$l.
']', $details[
'class_name']);
91 echo $details[
'class_name'];
103 <td
class=
"sq-backend-table-cell"><?php asset_finder($prefix.
'_root_nodes['.$l.
']', 0); ?></td>
104 <td
class=
"sq-backend-table-cell"><?php text_box($prefix.
'_node_classes['.$l.
']',
''); ?></td>
127 if (isset($_POST[$prefix.
'_root_nodes']) || (isset($asset->_tmp[
'reverting_to_system_version']) && $asset->_tmp[
'reverting_to_system_version'])) {
128 $locations = Array();
129 foreach ($_POST[$prefix.
'_root_nodes'] as $index => $loc) {
130 if ($locid = $loc[
'assetid']) {
131 $locations[$locid] = isset($_POST[$prefix.
'_node_classes'][$index]) ? Array(
'class_name' => $_POST[$prefix.
'_node_classes'][$index]) : Array(
'class_name' =>
'');
134 return $asset->setAttrValue(
'root_nodes', $locations);
154 $write_access = $asset->writeAccess(
'attributes');
155 $current_views = $asset->attr(
'enabled_views');
156 $listing_entry_options = Array(
157 'title' => translate(
'cal_page_show_title_only'),
158 'bodycopy' => translate(
'cal_page_use_type_format_bodycopy'),
161 $current_list_entry_types = $asset->attr(
'list_entry_types');
163 <table
class=
"sq-backend-table">
165 $view_options = $asset->getViewOptions();
166 foreach ($view_options as $category => $options) {
170 <b><label
for=
"<?php echo $prefix.'_enabled_views['.$category.']'; ?>"><?php echo translate(
'cal_page_view_'.$category); ?></label></b>
175 combo_box($prefix.
'_enabled_views['.$category.
']', $options, 0, $current_views[$category], 0,
'style="width: 46ex;"');
177 echo $view_options[$category][$current_views[$category]];
182 if ($write_access && (strpos($current_views[$category],
'list') !== FALSE)) {
184 combo_box($prefix.
'_list_entry_types['.$category.
']', $listing_entry_options, 0, $current_list_entry_types[$category], 0);
185 $list_entry_cb = ob_get_contents();
187 echo translate(
'cal_page_list_entry_cb', $list_entry_cb);
189 }
else if (strpos($current_views[$category],
'list') !== FALSE) {
190 echo translate(
'cal_page_list_entry_unlocked', strtolower($listing_entry_options[$current_list_entry_types[$category]]));
218 $list_entry_types = $asset->attr(
'list_entry_types');
219 $unwanted_elts = array_diff(array_keys($_POST[$prefix.
'_enabled_views']), array_keys($asset->getViewOptions()));
220 if (empty($unwanted_elts)) {
221 $asset->setAttrValue(
'enabled_views', $_POST[$prefix.
'_enabled_views']);
222 $initial_view = $asset->attr(
'initial_view');
223 if (!($_POST[$prefix.
'_enabled_views'][$initial_view])) {
224 foreach ($_POST[$prefix.
'_enabled_views'] as $category => $view) {
226 $asset->setAttrValue(
'initial_view', $category);
231 foreach ($list_entry_types as $key => $value) {
232 if (isset($_POST[$prefix.
'_list_entry_types'][$key]) && in_array($_POST[$prefix.
'_list_entry_types'][$key], Array(
'title',
'bodycopy'))) {
233 $list_entry_types[$key] = $_POST[$prefix.
'_list_entry_types'][$key];
236 $asset->setAttrValue(
'list_entry_types', $list_entry_types);
257 $selected_view = $asset->attr(
'initial_view');
258 if ($asset->writeAccess(
'attributes')) {
259 $view_options = $asset->getViewOptions();
260 $enabled_views = $asset->attr(
'enabled_views');
261 foreach ($enabled_views as $name => $status) {
262 if (empty($status)) unset($view_options[$name]);
264 foreach ($view_options as $key => $val) {
265 $view_options[$key] = ucfirst($key).
' View';
267 if (!in_array($selected_view, array_keys($view_options))) {
268 $selected_view = current($view_options);
270 combo_box($prefix.
'_initial_view', $view_options, 0, $selected_view, 0);
291 $enabled_views = $asset->attr(
'enabled_views');
292 if (isset($_POST[$prefix.
'_initial_view']) && !empty($enabled_views[$_POST[$prefix.
'_initial_view']])) {
293 $asset->setAttrValue(
'initial_view', $_POST[$prefix.
'_initial_view']);
295 $x = current($enabled_views);
296 while (empty($x) && ($x !== FALSE)) {
297 $x = next($enabled_views);
299 $asset->setAttrValue(
'initial_view', key($enabled_views));
318 $hour_options = Array(12=>12, 1=>1, 2=>2, 3=>3, 4=>4, 5=>5, 6=>6, 7=>7, 8=>8, 9=>9, 10=>10, 11=>11, 12=>12);
319 $min_options = Array();
320 for ($i=0; $i < 60; $i += 5) {
321 $min_options[sprintf(
'%02d', $i)] = sprintf(
'%02d', $i);
323 $is_pm_options = Array(0=>
'am', 1=>
'pm');
324 combo_box($prefix.
'[hours]', $hour_options, FALSE, $default_hour, 0);
326 combo_box($prefix.
'[minutes]', $min_options, FALSE, sprintf(
'%02d', $default_min), 0);
328 combo_box($prefix.
'[is_pm]', $is_pm_options, FALSE, (
int)$default_is_pm, 0);
344 if (!isset($_POST[$prefix]))
return FALSE;
345 if ($_POST[$prefix][
'hours'] != (
int)$_POST[$prefix][
'hours']) {
348 if ($_POST[$prefix][
'minutes'] != (
int)$_POST[$prefix][
'minutes']) {
351 if ($_POST[$prefix][
'is_pm'] && ($_POST[$prefix][
'hours'] != 12)) {
352 $_POST[$prefix][
'hours'] += 12;
354 if (!$_POST[$prefix][
'is_pm'] && ($_POST[$prefix][
'hours'] == 12)) {
355 $_POST[$prefix][
'hours'] = 0;
357 return sprintf(
'%02d', $_POST[$prefix][
'hours']).
':'.$_POST[$prefix][
'minutes'];
374 if ($asset->writeAccess(
'attributes')) {
375 list($hour,$minute) = sscanf($asset->attr(
'day_starts_at'),
'%02d:%02d');
381 if ($hour == 0) $hour = 12;
385 echo $asset->attr(
'day_starts_at');
405 $asset->setAttrValue(
'day_starts_at', $value);
426 if ($asset->writeAccess(
'attributes')) {
427 list($hour,$minute) = sscanf($asset->attr(
'day_ends_at'),
'%02d:%02d');
433 if ($hour == 0) $hour = 12;
437 echo $asset->attr(
'day_ends_at');
456 if ($value ==
'00:00') $value =
'24:00';
457 $asset->setAttrValue(
'day_ends_at', $value);
478 $write_access = $asset->writeAccess(
'attributes');
479 $days_to_show = $asset->attr(
'week_view_show_days');
480 foreach ($asset->day_names as $day_number => $day_name) {
483 check_box($prefix.
'_show_days['.$day_number.
']', 1, $days_to_show[$day_number]);
486 <img src=
"<?php echo sq_web_path('lib'); ?>/web/images/<?php echo $days_to_show[$day_number] ? 'tick' : 'cross'; ?>.gif" width=
"15" height=
"15" />
508 if (isset($_POST[$prefix.
'_show_days']) && is_array($_POST[$prefix.
'_show_days'])) {
509 foreach (range(0, 6) as $day_number) {
510 if (!isset($_POST[$prefix.
'_show_days'][$day_number])) {
511 $_POST[$prefix.
'_show_days'][$day_number] = 0;
514 $asset->setAttrValue(
'week_view_show_days', $_POST[$prefix.
'_show_days']);
536 <p style=
"width: 80%; margin-left: 15ex"><?php echo translate(
'cal_page_look_and_feel_1'); ?></p>
538 <p style=
"width: 80%; margin-left: 15ex"><?php echo translate(
'cal_page_look_and_feel_2', sq_web_path(
'data').
'/asset_types/page_calendar/css/calendar_default.css'); ?></p>
540 <p style=
"width: 80%; margin-left: 15ex"><?php echo translate(
'cal_page_look_and_feel_3'); ?></p>
780 $title_formats = $asset->attr(
'view_title_formats');
781 if ($asset->writeAccess(
'attributes')) {
782 text_box($prefix.
'_title_format_'.$view, $title_formats[$view]);
783 ?><div
class=
"sq-backend-smallprint"><?php echo translate(
'cal_page_paint_title_format',
'http://au.php.net/manual/en/function.date.php'); ?></div><?php
785 echo $title_formats[$view].
' ("'.date($title_formats[$view], ((($view ==
'week') && (date(
'D') !=
'Mon')) ? strtotime(
'last Monday') : time())).
'")';
805 if (isset($_POST[$prefix.
'_title_format_'.$view])) {
806 $title_formats = $asset->attr(
'view_title_formats');
807 $title_formats[$view] = $_POST[$prefix.
'_title_format_'.$view];
808 $asset->setAttrValue(
'view_title_formats', $title_formats);
831 $heading_index = $view.
'_'.$time_period;
832 $heading_formats = $asset->attr(
'view_heading_formats');
833 if ($asset->writeAccess(
'attributes')) {
834 text_box($prefix.
'_heading_format_'.$heading_index, $heading_formats[$heading_index]);
835 ?><div
class=
"sq-backend-smallprint"><?php echo translate(
'cal_page_paint_heading_format',
'http://au.php.net/manual/en/function.date.php'); ?><?php
837 echo $heading_formats[$heading_index].
' ("'.date($heading_formats[$heading_index], ((($view ==
'week') && (date(
'D') !=
'Mon')) ? strtotime(
'last Monday') : time())).
'")';
858 $heading_index = $view.
'_'.$time_period;
859 if (isset($_POST[$prefix.
'_heading_format_'.$heading_index])) {
860 $heading_formats = $asset->attr(
'view_heading_formats');
861 $heading_formats[$heading_index] = $_POST[$prefix.
'_heading_format_'.$heading_index];
862 $asset->setAttrValue(
'view_heading_formats', $heading_formats);
884 $navi_limit = $asset->attr($view.
'_navi_limit');
885 if ($asset->writeAccess(
'attributes')) {
886 text_box($prefix.$view.
'_limit_backward', $navi_limit[
'backward'],2,2);
887 label(
' '.translate(
'cal_page_navi_limit_'.$view).
' backward ',$prefix.$view.
'_limit_backward');
888 text_box($prefix.$view.
'_limit_forward', $navi_limit[
'forward'],2,2);
889 label(
' '.translate(
'cal_page_navi_limit_'.$view).
' forward ',$prefix.$view.
'_limit_forward');
891 echo $navi_limit[
'forward'].
' '.translate(
'cal_page_navi_limit_'.$view).
' forward , '.$navi_limit[
'backward'].
' '.translate(
'cal_page_navi_limit_'.$view).
' backward';
911 $navi_limit = $asset->attr($view.
'_navi_limit');
912 if (($_POST[$prefix.$view.
'_limit_forward'] == $navi_limit[
'forward']) && ($_POST[$prefix.$view.
'_limit_backward'] == $navi_limit[
'backward'])) {
915 if (isset($_POST[$prefix.$view.
'_limit_forward'])) {
916 $navi_limit[
'forward'] = $_POST[$prefix.$view.
'_limit_forward'];
918 if (isset($_POST[$prefix.$view.
'_limit_backward'])) {
919 $navi_limit[
'backward'] = $_POST[$prefix.$view.
'_limit_backward'];
921 $asset->setAttrValue($view.
'_navi_limit', $navi_limit);
940 $write_access = $asset->writeAccess(
'attributes');
941 $all_root_nodes = $asset->attr(
'root_nodes');
942 $current_column_nodes = $asset->attr(
'columnise_day_view_by_root_node');
943 $location_info = $GLOBALS[
'SQ_SYSTEM']->am->getAssetInfo(array_keys($all_root_nodes));
945 <table
class=
"sq-backend-table">
947 <td
class=
"sq-backend-table-header"><?php echo translate(
'cal_page_event_source'); ?></td>
948 <td
class=
"sq-backend-table-header"><?php echo translate(
'cal_page_show_in_own_column_question'); ?></td>
951 foreach ($all_root_nodes as $id => $details) {
954 <td
class=
"sq-backend-table-cell"><?php echo get_asset_tag_line($id); ?></td>
955 <td
class=
"sq-backend-table-cell">
958 check_box($prefix.
'_root_nodes_columnised['.$id.
']',
'1', in_array($id, $current_column_nodes));
960 echo
'<img src="'.sq_web_path(
'lib').
'/web/images/'.(in_array($id, $current_column_nodes) ?
'tick' :
'cross').
'.gif" width="15" height="15" />';
969 <td
class=
"sq-backend-table-cell">
'Other'</td>
970 <td
class=
"sq-backend-table-cell">
973 check_box($prefix.
'_root_nodes_columnised[other]',
'1', in_array(
'*', $current_column_nodes));
975 echo
'<img src="'.sq_web_path(
'lib').
'/web/images/'.(in_array(
'*', $current_column_nodes) ?
'tick' :
'cross').
'.gif" width="15" height="15" />';
999 if (isset($_REQUEST[$prefix.
'_root_nodes_columnised']) && is_array($_REQUEST[$prefix.
'_root_nodes_columnised'])) {
1000 if ((isset($_REQUEST[$prefix.
'_root_nodes_columnised'][
'other']) && $_REQUEST[$prefix.
'_root_nodes_columnised'][
'other'])) {
1002 unset($_REQUEST[$prefix.
'_root_nodes_columnised'][
'other']);
1004 foreach ($_REQUEST[$prefix.
'_root_nodes_columnised'] as $id => $status) {
1005 if ($status) $val[] = $id;
1008 if (empty($val)) $val = Array(
'*');
1010 return $asset->setAttrValue(
'columnise_day_view_by_root_node', $val);
1165 $write_access = $asset->writeAccess(
'links');
1166 $current_value = $asset->attr(
'use_no_results_body_copy');
1167 $options = Array(1 =>
'Yes', 0 =>
'No');
1169 if ($write_access) {
1170 combo_box($prefix.
'_use_no_results_body_copy', $options, FALSE, $current_value);
1172 echo $options[$current_value];
1175 return $write_access;
1192 if (isset($_POST[$prefix.
'_use_no_results_body_copy'])) {
1193 if ($asset->createNoResultsBodycopy()) {
1194 $asset->setAttrValue(
'use_no_results_body_copy',$_POST[$prefix.
'_use_no_results_body_copy']);
1195 $asset->saveAttributes();