17 require_once SQ_INCLUDE_PATH.
'/asset_edit/asset_edit_fns.inc';
18 require_once SQ_INCLUDE_PATH.
'/asset_edit_interface.inc';
44 parent::__construct();
46 unset($this->static_screens[
'settings']);
47 unset($this->static_screens[
'preview']);
48 unset($this->static_screens[
'lookupValues']);
49 unset($this->static_screens[
'web_paths']);
50 unset($this->static_screens[
'metadata']);
51 unset($this->static_screens[
'metadataSchemas']);
52 unset($this->static_screens[
'workflow']);
53 unset($this->static_screens[
'tagging']);
54 unset($this->static_screens[
'dependants']);
55 unset($this->static_screens[
'linking']);
56 unset($this->static_screens[
'roles']);
57 unset($this->static_screens[
'permissions']);
77 $type_codes = $asset->attr(
'type_codes');
78 $asset_types = $GLOBALS[
'SQ_SYSTEM']->am->getTypeList();
80 foreach ($asset_types as $type_code) {
81 $info = $GLOBALS[
'SQ_SYSTEM']->am->getTypeInfo($type_code);
82 $options[$type_code] = $info[
'name'];
89 if (isset($_REQUEST[$prefix.
'_select_type'])) {
90 $selected = $_REQUEST[$prefix.
'_select_type'];
92 $selected = (isset($_REQUEST[$prefix.
'_type'])) ? $_REQUEST[$prefix.
'_type'] :
'';
96 <select name=
"<?php echo $prefix; ?>_select_type" onchange=
"this.form.submit();">
97 <option value=
"">-- <?php echo translate(
'select_asset_type'); ?> --</option>
99 foreach ($options as $type_code => $name) {
100 $style = (isset($type_codes[$type_code])) ?
' style="background-color: #C8BDCB";' :
'';
102 <option<?php echo $style; ?> value=
"<?php echo $type_code; ?>"<?php echo ($selected == $type_code) ?
' selected' :
''; ?>>
108 $o->addFormActionGetVar($prefix.
'_type', $selected, TRUE);
109 submit_button($prefix.
'_go', translate(
'go'));
110 echo
'<br />'.translate(
'type_code_precedence_over_root_node');
112 if (isset($_REQUEST[$prefix.
'_select_type']) && !empty($_REQUEST[$prefix.
'_select_type'])) {
113 echo
'<br/><br/><b>'.translate(
'currently_customising', $options[$_REQUEST[$prefix.
'_select_type']]).
'</b>';
151 $write_access = $asset->writeAccess(
'attributes');
153 if (isset($_REQUEST[$prefix.
'_select_type'])) {
154 $selected = $_REQUEST[$prefix.
'_select_type'];
156 $selected = (isset($_REQUEST[$prefix.
'_type'])) ? $_REQUEST[$prefix.
'_type'] :
'';
159 if (!empty($selected)) {
164 echo translate(
'customise_asset_selection');
169 return $write_access;
190 $wa = $asset->writeAccess(
'attributes');
191 $current_values = $asset->attr($attr_name);
194 $paint = in_array($selected, array_keys($current_values)) ? TRUE : FALSE;
200 $using_default = !isset($current_values[$selected][
'enabled']);
201 if ($using_default) {
202 echo translate(
'using_default_value_of',(($asset->attr(
'enabled')) ? translate(
'on') : translate(
'off'))).
'<br/>';
204 $caching = ($current_values[$selected][
'enabled']) ? 1 : 0;
206 combo_box($prefix.
'_enabled', Array(
'1' => translate(
'on'),
'0' => translate(
'off')), FALSE, $caching);
208 echo ($current_values[$selected][
'enabled']) ? translate(
'on') : translate(
'off');
212 check_box($prefix.
'_default_enabled',
'1', $using_default);
213 echo
' '.translate(
'use_default');
217 $o->openField(translate(
'default_expiry'),
'', translate(
'valid_cache_length'));
218 $using_default = !isset($current_values[$selected][
'expiry']);
219 if ($using_default) {
220 echo translate(
'using_default_value_of', $asset->attr(
'expiry').
' seconds').
'<br/>';
223 text_box($prefix.
'_expiry', $current_values[$selected][
'expiry'], 5);
225 echo $current_values[$selected][
'expiry'];
229 check_box($prefix.
'_default_expiry',
'1', $using_default);
230 echo
' '.translate(
'use_default');
234 $o->openField(translate(
'cache_manager_browser_cache_expiry'),
'', translate(
'cache_manager_browser_valid_cache_length'));
235 $using_default = !isset($current_values[$selected][
'browser_cache_expiry']);
236 if ($using_default) {
237 $browser_cache_expiry = $asset->attr(
'browser_cache_expiry');
238 if (empty($browser_cache_expiry)) {
239 echo translate(
'cache_manager_using_blank_default_value_equal_to',
'the system Default Expiry', $asset->attr(
'expiry').
' seconds').
'<br>';
241 echo translate(
'using_default_value_of', $browser_cache_expiry.
' seconds').
'<br/>';
245 text_box($prefix.
'_browser_cache_expiry', $current_values[$selected][
'browser_cache_expiry'], 5);
247 echo $current_values[$selected][
'browser_cache_expiry'];
252 check_box($prefix.
'_default_browser_cache_expiry',
'1', $using_default);
253 echo
' '.translate(
'use_default');
257 $o->openField(translate(
'http_header_cacheable_field'));
258 $using_default = !isset($current_values[$selected][
'send_cacheable_header']);
259 if ($using_default) {
260 echo translate(
'using_default_value_of', SQ_CONF_SEND_CACHEABLE_HEADER ? translate(
'yes') : translate(
'no')).
'<br/>';
263 combo_box($prefix.
'_send_cacheable_header', Array(
'1' => translate(
'on'),
'0' => translate(
'off')), FALSE, $current_values[$selected][
'send_cacheable_header']);
265 echo $current_values[$selected][
'send_cacheable_header'];
269 check_box($prefix.
'_default_send_cacheable_header',
'1', $using_default);
270 echo
' '.translate(
'use_default');
294 $current_values = $asset->attr($attr_name);
296 if ($asset->writeAccess(
'attributes') && !isset($_POST[$value_get_var]) && isset($_GET[$value_get_var])) {
297 $type = $_REQUEST[$value_get_var];
298 $defaults = Array(
'enabled',
'expiry',
'browser_cache_expiry',
'send_cacheable_header');
301 foreach ($defaults as $default) {
302 $using_default = FALSE;
303 if (!isset($_POST[$prefix.
'_default_'.$default])) {
304 if (!isset($current_values[$type][$default])) {
306 if($default ===
'send_cacheable_header') {
307 $current_values[$type][$default] = SQ_CONF_SEND_CACHEABLE_HEADER;
310 $current_values[$type][$default] = $asset->attr($default);
315 $using_default = TRUE;
316 if (isset($current_values[$type][$default])) {
317 unset($current_values[$type][$default]);
320 if (isset($_POST[$prefix.
'_'.$default]) && !$using_default) {
321 if (!isset($current_values[$type][$default]) || $current_values[$type][$default] != $_POST[$prefix.
'_'.$default]) {
322 $current_values[$type][$default] = $_POST[$prefix.
'_'.$default];
327 if (isset($current_values[$type]) && empty($current_values[$type])) {
328 unset($current_values[$type]);
331 if ($indicate_customised) {
333 if (count((array_diff($defaults, array_keys($current_values[$type])))) < count($defaults)) {
334 $current_values[$type][
'customised'] = 1;
336 $current_values[$type][
'customised'] = 0;
340 return ($save) ? $asset->setAttrValue($attr_name, $current_values) : FALSE;
376 $root_nodes = $asset->attr(
'root_nodes');
377 $wa = $asset->writeAccess(
'attributes');
378 if ($wa && empty($root_nodes)) {
379 $root_nodes = Array(0);
383 foreach ($root_nodes as $assetid => $data) {
392 hidden_field($prefix.
'_root_node_previous_values['.$key.
']', $assetid);
393 asset_finder($prefix.
'_root_node_X_'.$key.
'_X_', $assetid);
395 echo get_asset_tag_line($assetid);
401 if (isset($data[
'customised'])) {
402 $customised = $data[
'customised'];
406 if ($wa && !empty($assetid)) {
407 $radio_name = $prefix.
'_customise_root_node';
408 $radio_id = $prefix.
'_'.$assetid.
'_customise_root_node';
409 check_box($radio_name, $assetid, FALSE,
'this.form.submit();',
'id="'.$radio_id.
'"');
411 label(translate(
'view_customisations'), $radio_id);
413 label(translate(
'customise'), $radio_id);
417 $radio_name = $prefix.
'_customise_root_node';
418 $radio_id = $prefix.
'_'.$assetid.
'_customise_root_node';
419 check_box($radio_name, $assetid, FALSE,
'this.form.submit();',
'id="'.$radio_id.
'"');
420 label(
'<i>'.translate(
'view_customisations').
'</i>', $radio_id);
422 if (!empty($assetid)) {
423 echo
'<i>'.translate(
'not_yet_customised').
'</i>';
435 0 => translate(
'no'),
436 1 => translate(
'yes'),
438 $combo_name = $prefix.
'_all_underneath_X_'.$key.
'_X_';
439 combo_box($combo_name, $options, FALSE, $data[
'all_underneath']);
440 label(
' '.translate(
'include_all_assets'), $combo_name);
442 if ($data[
'all_underneath']) {
443 echo
'<b>'.translate(
'assets_underneath_root_node_affected').
'</b>';
445 echo
'<b>'.translate(
'assets_underneath_root_node_not_affected').
'</b>';
452 if ($wa && $key+1 === count($root_nodes)) {
453 $more_button_name = $prefix.
'_root_node_more_button_X_'.$key.
'_X_';
454 normal_button($more_button_name, translate(
'more').
'...',
'var table = prependLastTable(this); resetLastTableFields(table, false)');
463 if ($key !== count($root_nodes)) echo
'<br />';
466 if (isset($_REQUEST[$prefix.
'_customise_root_node']) && in_array($_REQUEST[$prefix.
'_customise_root_node'], array_keys($root_nodes))) {
468 echo
'<br/><br/><b>'.translate(
'currently_customising', get_asset_tag_line($_REQUEST[$prefix.
'_customise_root_node'])).
'</b>';
470 echo
'<br/><br/><b>'.translate(
'currently_viewing', get_asset_tag_line($_REQUEST[$prefix.
'_customise_root_node'])).
'</b>';
473 unset($_REQUEST[$prefix.
'_customise_root_node']);
477 <script type=
"text/javascript">
479 function prependLastTable(moreButton)
481 var lastTable = moreButton.parentNode;
482 while (lastTable.tagName !=
'TABLE') {
483 lastTable = lastTable.parentNode;
487 var lastSibling = lastTable.previousSibling;
488 var lastTableButtonCell = moreButton.parentNode;
491 var validLocation = moreButton.parentNode;
492 while (validLocation.className !=
'sq-backend-data') {
493 validLocation = validLocation.parentNode;
496 var clone = lastTable.cloneNode(
true);
499 validLocation.insertBefore(clone, lastTable.nextSibling);
502 lastTableButtonCell.appendChild(moreButton);
505 moreButton.parentNode.removeChild(moreButton);
508 var cloneCustomiseCell = clone.rows[0].cells[1];
509 removeElementChildNodes(cloneCustomiseCell);
512 var cloneCustomiseText = document.createElement(
'i');
513 cloneCustomiseCell.appendChild(cloneCustomiseText);
516 cloneCustomiseText.innerHTML = js_translate(
'customise_after_commit');
519 var cloneAssetFinderCell = clone.rows[0].cells[0];
520 removeElementChildNodes(cloneAssetFinderCell);
523 incrementTableFieldNames(clone);
526 cloneInnerHTML(lastTable.rows[0].cells[0], cloneAssetFinderCell);
528 lastTable.appendChild(document.createElement(
'br'));
534 function cloneInnerHTML(cellToCopy, cellToPopulate)
536 var htmlToClone = cellToCopy.innerHTML;
538 var currentKey = htmlToClone.match(/_X_(\d+)_X_/);
539 var newKey = parseInt(currentKey[1]) + 1;
540 cellToPopulate.innerHTML = htmlToClone.replace(/_X_(\d+)_X_/g,
'_X_' + newKey +
'_X_');
544 function removeElementChildNodes(element)
546 if (element.hasChildNodes()) {
547 while (element.childNodes.length > 0 ) {
548 element.removeChild(element.firstChild);
553 function incrementTableFieldNames(element)
556 var elementChildren = element.childNodes[i];
557 var tagName = element.tagName;
559 if ((tagName ==
'INPUT') || (tagName ==
'SELECT')) {
562 var currentKey = element.name.match(/_X_(\d+)_X_/);
563 var newKey = parseInt(currentKey[1]) + 1;
564 element.name = element.name.replace(/_X_(\d+)_X_/,
'_X_' + newKey +
'_X_');
565 element.id = element.id.replace(/_X_(\d+)_X_/,
'_X_' + newKey +
'_X_');
568 while (elementChildren) {
569 incrementTableFieldNames(elementChildren);
571 elementChildren = element.childNodes[i];
575 function resetLastTableFields(element, findTable)
579 var element = element.parentNode;
580 while (element.tagName !=
'TABLE') {
581 element = element.parentNode;
586 var elementChildren = element.childNodes[i];
587 var tagName = element.tagName;
589 if (tagName ==
'INPUT') {
591 if (element.type !=
'button') {
595 }
else if (tagName ==
'SELECT') {
596 element.selectedIndex = 0;
600 while (elementChildren) {
601 resetLastTableFields(elementChildren,
false);
603 elementChildren = element.childNodes[i];
626 $wa = $asset->writeAccess(
'attributes');
628 $root_node_key = $prefix.
'_root_node';
629 $submitted_root_nodes = Array();
631 foreach ($_POST as $key => $value) {
633 if (strpos($key,
'_X_')) {
635 if (preg_match(
"/^$root_node_key".
'_X_(\d+)_X_/', $key, $matches)) {
636 $current_row = $matches[1];
637 if (isset($_POST[$prefix.
'_root_node_previous_values'][$current_row])) {
638 $previous_value = $_POST[$prefix.
'_root_node_previous_values'][$current_row];
642 $previous_value =
'';
647 if (preg_match(
"/^$root_node_key/", $key)) {
648 $root_node = htmlspecialchars($_POST[$key][
'assetid']);
652 $deleteme[] = $previous_value;
656 if (empty($previous_value)) {
657 $submitted_root_nodes[$root_node][
'previous'] = $root_node;
659 $submitted_root_nodes[$root_node][
'previous'] = $previous_value;
661 }
else if (isset($submitted_root_nodes[$root_node]) && strpos($key,
'all_underneath')) {
662 $all_underneath = $_POST[$key];
663 $submitted_root_nodes[$root_node][
'all_underneath'] = $all_underneath;
669 $current_root_nodes = $asset->attr(
'root_nodes');
670 if (!empty($submitted_root_nodes)) {
671 foreach ($submitted_root_nodes as $assetid => $data) {
672 if (isset($current_root_nodes[$assetid])) {
674 foreach ($current_root_nodes[$assetid] as $key => $value) {
675 if (isset($data[$key])) {
676 $current_root_nodes[$assetid][$key] = $data[$key];
679 $current_root_nodes[$assetid][$key] = $value;
682 }
else if ($assetid !== $data[
'previous'] && isset($current_root_nodes[$data[
'previous']])) {
684 $old_values = $current_root_nodes[$data[
'previous']];
685 $current_root_nodes[$assetid] = $old_values;
686 unset($current_root_nodes[$data[
'previous']]);
687 }
else if (!empty($submitted_root_nodes[$assetid])) {
689 $current_root_nodes[$assetid] = $data;
691 unset($_REQUEST[$prefix.
'_customise_root_node']);
696 if (!empty($deleteme)) {
697 foreach($deleteme as $row => $assetid) {
698 unset($current_root_nodes[$assetid]);
703 if (isset($current_root_nodes[$assetid][
'previous'])) {
704 unset($current_root_nodes[$assetid][
'previous']);
708 $current_root_nodes = Array();
710 $asset->setAttrValue(
'root_nodes', $current_root_nodes);
729 $wa = $asset->writeAccess(
'attributes');
732 if (isset($_REQUEST[$prefix.
'_customise_root_node'])) {
736 echo translate(
'customise_root_node_selection');
738 echo translate(
'view_root_node_selection');
759 if (isset($_REQUEST[$prefix.
'_customise_root_node'])) {
760 $o->addFormActionGetVar($prefix.
'_customise_root_node', $_REQUEST[$prefix.
'_customise_root_node'], TRUE);
763 if (in_array($_REQUEST[$prefix.
'_customise_root_node'], array_keys($asset->attr(
'root_nodes')))) {
788 if (!$asset->writeAccess(
'attributes')) {
789 echo translate(
'cannot_clear_cache');
793 if (!$asset->canClearByAssetid()) {
794 echo translate(
'cannot_clear_cache_by_assetid');
798 multiple_asset_finder($prefix.
'_clear_cache', Array());
800 $o->openField(translate(
'level'));
802 'single' => translate(
'this_asset'),
803 'dependants' => translate(
'this_asset_and_dependants'),
804 'children' => translate(
'this_asset_and_children'),
806 combo_box($prefix.
'_level', $options,
'', FALSE);
809 $o->openField(translate(
'asset_types'));
810 $type_options = Array();
811 $asset_types = $GLOBALS[
'SQ_SYSTEM']->am->getTypeList();
812 foreach ($asset_types as $type_code) {
813 $info = $GLOBALS[
'SQ_SYSTEM']->am->getTypeInfo($type_code);
814 if ($info[
'allowed_access'] !=
'system' && $info[
'instantiable']) {
815 $type_options[$type_code] = $info[
'name'];
819 asort($type_options);
820 $type_options = array_reverse($type_options, TRUE);
821 $type_options[
''] =
'-- '.translate(
'all_asset_types').
' --';
822 $type_options = array_reverse($type_options, TRUE);
823 combo_box($prefix.
'_type_codes', $type_options, TRUE,
'', 8);
843 if (isset($_POST[$prefix.
'_clear_cache']) && $_POST[$prefix.
'_delete_all'] !=
'yes') {
844 $level = (isset($_POST[$prefix.
'_level'])) ? $_POST[$prefix.
'_level'] :
'single';
846 if (isset($_POST[$prefix.
'_type_codes']) && !empty($_POST[$prefix.
'_type_codes'][0])) {
847 $type_codes = $_POST[$prefix.
'_type_codes'];
849 $type_codes = Array();
852 $assets_info = array_get_index($_POST, $prefix.
'_clear_cache', Array());
854 foreach ($assets_info as $asset_info) {
855 if (!empty($asset_info[
'assetid'])) {
856 $assetids[] = $asset_info[
'assetid'];
860 $delete_all = $_POST[$prefix.
'_delete_all'];
862 $hh = $GLOBALS[
'SQ_SYSTEM']->getHipoHerder();
864 'assetid' => $assetids,
866 'type_codes' => $type_codes,
867 'delete_all' => $delete_all,
869 $hh->queueHipo(
'hipo_job_clear_cache', $vars);
890 if (!$asset->writeAccess(
'attributes')) {
891 echo translate(
'cannot_clear_cache');
895 $o->openField(translate(
'delete_all_cache'));
896 $delete_all_ops = Array(
897 'yes' => translate(
'yes'),
898 'no' => translate(
'no'),
900 combo_box($prefix.
'_delete_all', $delete_all_ops, FALSE,
'no', 0,
"onChange=\"Javascript: if (this.value == 'yes') { if(!confirm(js_translate('confirm_purge_cache'))) { this.value = 'no'; } } \"");
901 $o->note(translate(
'trash_cache_warning'));
921 if ($_POST[$prefix.
'_delete_all'] ==
'yes') {
922 $hh = $GLOBALS[
'SQ_SYSTEM']->getHipoHerder();
924 'delete_all' =>
'yes',
926 $hh->queueHipo(
'hipo_job_clear_cache', $vars);
949 $wa = $asset->writeAccess(
'attributes');
950 $caching_on = $asset->attr(
'enabled');
953 $cron_mgr = $GLOBALS[
'SQ_SYSTEM']->am->getSystemAsset(
'cron_manager');
956 $GLOBALS[
'SQ_SYSTEM']->am->includeAsset(
'cron_job_refresh_cache');
961 <span
class=
"sq-backend-warning"><b>NOTE:</b> The caching is turned off at the moment. Although you can add a job here, it will not have any effect</span><br /><br />
965 require_once SQ_FUDGE_PATH.
'/general/datetime.inc';
967 $edit_fns = $cron_job->getEditFns();
968 $edit_fns->paintInLineBackend($cron_job, $o, $prefix.
'_new_rc');
969 $o->note(translate(
'cron_manager_next_run', $cron_mgr->readableRefreshTime(), readable_datetime($cron_mgr->timeOfNextRun())));
973 echo translate(
'cron_manager_not_configured_refresh');
994 $wa = $asset->writeAccess(
'attributes');
996 $cron_mgr = $GLOBALS[
'SQ_SYSTEM']->am->getSystemAsset(
'cron_manager');
999 $GLOBALS[
'SQ_SYSTEM']->am->includeAsset(
'cron_job_refresh_cache');
1001 if ($asset->writeAccess(
'')) {
1003 $edit_fns = $rc->getEditFns();
1004 if ($edit_fns->processInLineBackend($rc, $o, $prefix.
'_new_rc')) {
1005 $rc->saveAttributes();
1010 $GLOBALS[
'SQ_SYSTEM']->changeDatabaseConnection(
'db2');
1011 $GLOBALS[
'SQ_SYSTEM']->doTransaction(
'BEGIN');
1012 if ($cron_mgr->addJob($rc, $GLOBALS[
'SQ_SYSTEM']->user)) {
1013 $GLOBALS[
'SQ_SYSTEM']->doTransaction(
'COMMIT');
1015 trigger_localised_error(
'CRON0054', E_USER_WARNING);
1016 $GLOBALS[
'SQ_SYSTEM']->doTransaction(
'ROLLBACK');
1019 $GLOBALS[
'SQ_SYSTEM']->restoreDatabaseConnection();
1044 $wa = $asset->writeAccess(
'attributes');
1045 $cron_mgr = $GLOBALS[
'SQ_SYSTEM']->am->getSystemAsset(
'cron_manager');
1046 $GLOBALS[
'SQ_SYSTEM']->am->includeAsset(
'cron_job_refresh_cache');
1047 $rc_jobs = $cron_mgr->getJobs(
'cron_job_refresh_cache');
1049 if (empty($rc_jobs)) {
1050 echo translate(
'cron_manager_refresh_no_job');
1053 <table
class=
"sq-backend-table">
1055 <th
class=
"sq-backend-table-header">When</th>
1056 <th
class=
"sq-backend-table-header">Status</th>
1057 <th
class=
"sq-backend-table-header">Run As</th>
1058 <th
class=
"sq-backend-table-header">Delete</th>
1061 foreach ($rc_jobs as $rc_job) {
1064 <td
class=
"sq-backend-table-cell">
1066 echo get_asset_tag_line($rc_job->attr(
'asset'));
1067 echo
'<br /><b>Scheduled At: </b>';
1068 echo $rc_job->readableWhen();
1071 <td
class=
"sq-backend-table-cell">
1073 if ($rc_job->attr(
'long') && $rc_job->attr(
'running')) {
1074 echo translate(
'cron_manager_refresh_cache_running');
1076 echo translate(
'cron_manager_refresh_cache_not_running');
1080 <td
class=
"sq-backend-table-cell">
1082 $user = $rc_job->getRunningUser();
1083 echo get_asset_tag_line($user->id);
1087 <td
class=
"sq-backend-table-cell">
1090 check_box($prefix.
'_remove_job_'.$rc_job->id);
1118 $wa = $asset->writeAccess(
'attributes');
1120 $cron_mgr = $GLOBALS[
'SQ_SYSTEM']->am->getSystemAsset(
'cron_manager');
1123 $GLOBALS[
'SQ_SYSTEM']->am->includeAsset(
'cron_job_refresh_cache');
1126 $jobs = $cron_mgr->getJobs(
'cron_job_refresh_cache');
1127 for ($i = 0; $i < count($jobs); $i++) {
1128 if (!empty($_POST[$prefix.
'_remove_job_'.($jobs[$i]->id)])) {
1130 if ($GLOBALS[
'SQ_SYSTEM']->am->acquireLock($cron_mgr->id,
'links')) {
1131 if (!$cron_mgr->removeJob($jobs[$i])) {
1132 trigger_localised_error(
'CRON0055', E_USER_WARNING);
1134 $GLOBALS[
'SQ_SYSTEM']->am->releaseLock($cron_mgr->id,
'links');
1153 $cron_mgr = $GLOBALS[
'SQ_SYSTEM']->am->getSystemAsset(
'cron_manager');
1154 $cron_epoc = (int)$cron_mgr->attr(
'epoch');
1155 $cron_refresh = (int)$cron_mgr->attr(
'refresh_time');
1157 return ($cron_epoc > 0) && ($cron_refresh > 0);
1177 $root_urls = explode(
"\n", SQ_CONF_SYSTEM_ROOT_URLS);
1178 $non_cachable_urls = $asset->attr(
'non_cachable_urls');
1179 $wa = $asset->writeAccess(
'attributes');
1181 <table
class=
"sq-backend-table" style=
"width: auto">
1184 <th><?php echo translate(
'url'); ?></th>
1185 <th><?php echo translate(
'use_cache'); ?></th>
1190 foreach ($root_urls as $i => $url) {
1193 <td><?php echo $url; ?></td>
1197 check_box($prefix.
'_url_'.$i, 1, !in_array($url, $non_cachable_urls));
1199 $filename = in_array($url, $non_cachable_urls) ?
'cross' :
'tick';
1200 echo
'<img src="'.sq_web_path(
'lib').
'/web/images/'.$filename.
'.gif" />';
1227 $root_urls = explode(
"\n", SQ_CONF_SYSTEM_ROOT_URLS);
1228 $cachable = Array();
1229 foreach ($root_urls as $i => $url) {
1230 if (!empty($_POST[$prefix.
'_url_'.$i])) {
1236 $non_cachable = array_diff($root_urls, $cachable);
1237 return $asset->setAttrValue(
'non_cachable_urls', $non_cachable);
1254 $wa = $asset->writeAccess(
'attributes');
1255 $current_type = $asset->attr(
'cache_storage_type');
1257 $storage_types = $GLOBALS[
'SQ_SYSTEM']->am->getTypeDescendants(
'cache_storage');
1258 $names = $GLOBALS[
'SQ_SYSTEM']->am->getTypeInfo($storage_types,
'name');
1262 foreach ($storage_types as $storage_type) {
1263 $GLOBALS[
'SQ_SYSTEM']->am->includeAsset($storage_type);
1264 if (eval(
'return '.$storage_type.
'::isAvailable();') === FALSE) {
1265 unset($names[$storage_type]);
1270 if (isset($names[
'cache_storage_'.$current_type]) === FALSE) {
1271 $current_type =
'default';
1275 combo_box($prefix.
'_cache_storage_type', $names, FALSE,
'cache_storage_'.$current_type);
1277 echo $names[
'cache_storage_'.$current_type];
1295 if ($asset->writeAccess(
'attributes') === FALSE)
return FALSE;
1297 $type = $_POST[$prefix.
'_cache_storage_type'];
1298 $type = substr($type, strlen(
'cache_storage_'));
1299 return $asset->setAttrValue(
'cache_storage_type', $type);
1320 $root_urls = explode(
"\n", SQ_CONF_SYSTEM_ROOT_URLS);
1321 $cacheable_header_urls = $asset->attr(
'non_cacheable_header_urls');
1322 $cacheable_user_header_urls = $asset->attr(
'user_cacheable_header_urls');
1323 $wa = $asset->writeAccess(
'attributes');
1325 <table
class=
"sq-backend-table" style=
"width: auto">
1328 <th><?php echo translate(
'url'); ?></th>
1329 <th><?php echo
"Send Headers"; ?></th>
1330 <th><?php echo
"Public User Only"; ?></th>
1335 foreach ($root_urls as $i => $url) {
1338 <td><?php echo $url; ?></td>
1342 check_box($prefix.
'_url_'.$i, 1, !in_array($url, $cacheable_header_urls));
1344 $filename = in_array($url, $cacheable_header_urls) ?
'cross' :
'tick';
1345 echo
'<img src="'.sq_web_path(
'lib').
'/web/images/'.$filename.
'.gif" />';
1352 check_box($prefix.
'_user_url_'.$i, 1, !in_array($url, $cacheable_user_header_urls));
1354 $filename = in_array($url, $cacheable_user_header_urls) ?
'cross' :
'tick';
1355 echo
'<img src="'.sq_web_path(
'lib').
'/web/images/'.$filename.
'.gif" />';
1385 $root_urls = explode(
"\n", SQ_CONF_SYSTEM_ROOT_URLS);
1386 $cachable = Array();
1387 foreach ($root_urls as $i => $url) {
1388 if (!empty($_POST[$prefix.
'_url_'.$i])) {
1394 $non_cachable = array_diff($root_urls, $cachable);
1396 $user_cachable = Array();
1397 foreach ($root_urls as $i => $url) {
1398 if (isset($_POST[$prefix.
'_user_url_'.$i]) && !empty($_POST[$prefix.
'_user_url_'.$i])) {
1399 $user_cachable[] = $url;
1403 $user_cacheable = array_diff($root_urls, $user_cachable);
1404 $asset->setAttrValue(
'user_cacheable_header_urls', $user_cacheable);
1406 return $asset->setAttrValue(
'non_cacheable_header_urls', $non_cachable);
1423 $o->openField(translate(
'http_header_cacheable_field'));
1424 echo (SQ_CONF_SEND_CACHEABLE_HEADER) ? translate(
'yes') : translate(
'no');
1425 $o->note(translate(
'cache_manager_send_cacheable_headers_settings_node'));