18 require_once SQ_CORE_PACKAGE_PATH.
'/page/page_edit_fns.inc';
41 parent::__construct();
58 $asset_ids = $asset->getPageIds();
59 $asset_infos = $GLOBALS[
'SQ_SYSTEM']->am->getAssetInfo($asset_ids);
61 foreach ($asset_ids as $id) {
62 $edit_ids[$id] =
'contents';
64 $edit_links = $GLOBALS[
'SQ_SYSTEM']->am->getAssetBackendHref($edit_ids);
65 $write_access = $asset->writeAccess(
'content');
67 require_once SQ_LIB_PATH.
'/html_form/html_form.inc';
70 <script type=
"text/javascript">
71 function sortOrderMoveDown(currentOrder) {
72 if (!document.getElementById) {
73 alert(
'<?php echo translate('cms_form_no_getelementbyid
') ?>');
77 var form = document.getElementById(
'main_form');
79 var currentElement = document.getElementById(
'<?php echo $prefix ?>_order_o' + currentOrder);
80 var nextElement = document.getElementById(
'<?php echo $prefix ?>_order_o' + (currentOrder + 1));
83 if (!nextElement)
return;
85 if (!currentElement.innerHTML) {
86 alert(
'<?php echo translate('cms_form_no_innerhtml
') ?>');
91 var temp = currentElement.innerHTML;
92 currentElement.innerHTML = nextElement.innerHTML;
93 nextElement.innerHTML = temp;
96 var currentElement = document.getElementById(
'<?php echo $prefix ?>_order_t' + currentOrder);
97 var nextElement = document.getElementById(
'<?php echo $prefix ?>_order_t' + (currentOrder + 1));
99 var temp = currentElement.innerHTML;
100 currentElement.innerHTML = nextElement.innerHTML;
101 nextElement.innerHTML = temp;
106 temp = form.elements[
'<?php echo $prefix ?>_delete_page[' + (currentOrder+1) +
']'].checked;
107 form.elements[
'<?php echo $prefix ?>_delete_page[' + (currentOrder+1) +
']'].checked = form.elements[
'<?php echo $prefix ?>_delete_page[' + currentOrder +
']'].checked;
108 form.elements[
'<?php echo $prefix ?>_delete_page[' + currentOrder +
']'].checked = temp;
111 temp = form.elements[
'<?php echo $prefix ?>_order[reorder][' + (currentOrder+1) +
']'].value;
112 form.elements[
'<?php echo $prefix ?>_order[reorder][' + (currentOrder+1) +
']'].value = form.elements[
'<?php echo $prefix ?>_order[reorder][' + currentOrder +
']'].value;
113 form.elements[
'<?php echo $prefix ?>_order[reorder][' + currentOrder +
']'].value = temp;
117 function sortOrderMoveUp(currentOrder) {
119 if (!document.getElementById) {
120 alert(
'<?php echo translate('cms_form_no_getelementbyid
') ?>');
124 if (currentOrder == 0)
return;
126 var form = document.getElementById(
'main_form');
128 var currentElement = document.getElementById(
'<?php echo $prefix ?>_order_o' + currentOrder);
129 var prevElement = document.getElementById(
'<?php echo $prefix ?>_order_o' + (currentOrder - 1));
131 if (!currentElement.innerHTML) {
132 alert(
'<?php echo translate('cms_form_no_innerhtml
') ?>');
137 var temp = currentElement.innerHTML;
138 currentElement.innerHTML = prevElement.innerHTML;
139 prevElement.innerHTML = temp;
142 var currentElement = document.getElementById(
'<?php echo $prefix ?>_order_t' + currentOrder);
143 var prevElement = document.getElementById(
'<?php echo $prefix ?>_order_t' + (currentOrder - 1));
145 var temp = currentElement.innerHTML;
146 currentElement.innerHTML = prevElement.innerHTML;
147 prevElement.innerHTML = temp;
154 temp = form.elements[
'<?php echo $prefix ?>_delete_page[' + (currentOrder-1) +
']'].checked;
155 form.elements[
'<?php echo $prefix ?>_delete_page[' + (currentOrder-1) +
']'].checked = form.elements[
'<?php echo $prefix ?>_delete_page[' + currentOrder +
']'].checked;
156 form.elements[
'<?php echo $prefix ?>_delete_page[' + currentOrder +
']'].checked = temp;
159 temp = form.elements[
'<?php echo $prefix ?>_order[reorder][' + (currentOrder-1) +
']'].value;
160 form.elements[
'<?php echo $prefix ?>_order[reorder][' + (currentOrder-1) +
']'].value = form.elements[
'<?php echo $prefix ?>_order[reorder][' + currentOrder +
']'].value;
161 form.elements[
'<?php echo $prefix ?>_order[reorder][' + currentOrder +
']'].value = temp;
165 <table
class=
"sq-backend-table">
167 <th
class=
"sq-backend-table-header"><?php echo translate(
'name'); ?></th>
168 <th
class=
"sq-backend-table-header"><?php echo translate(
'link'); ?></th>
172 <th
class=
"sq-backend-table-header"><?php echo translate(
'delete'); ?>?</th>
173 <th
class=
"sq-backend-table-header"><?php echo translate(
'move'); ?>?</th>
179 if (empty($asset_ids)) {
182 <td colspan=
"5" style=
"text-align: center;"><?php echo translate(
'currently_no_pages_to_display'); ?></td>
187 $sort_order = $asset->getPageLinks();
188 foreach ($sort_order as $sort_id => $asset_info) {
191 <td
class=
"sq-backend-table-cell">
192 <span name=
"<?php echo $prefix.'_order_o'.$sort_id ?>" id=
"<?php echo $prefix.'_order_o'.$sort_id ?>"><?php echo $asset_infos[$asset_info[
'minorid']][
'name']; ?></span>
193 <?php hidden_field($prefix.
'_order[reorder]['.$sort_id.
']', $asset_info[
'minorid']); ?>
195 <td
class=
"sq-backend-table-cell">
196 <span name=
"<?php echo $prefix.'_order_t'.$sort_id ?>" id=
"<?php echo $prefix.'_order_t'.$sort_id ?>"><a href=
"<?php echo $edit_links[$asset_info['minorid']]; ?>"><?php echo translate(
'contents'); ?></a></span>
201 <td
class=
"sq-backend-table-cell">
202 <?php check_box($prefix.
'_delete_page['.$sort_id.
']'); ?>
204 <td align=
"center" width=
"100" class=
"sq-backend-table-cell">
207 ?><a href=
"#" onclick=
"sortOrderMoveUp(<?php echo $sort_id ?>); return false;"><script type=
"text/javascript">sq_print_icon(
"<?php echo sq_web_path('lib').'/web/images/icons/up_arrow.png' ?>",
"16",
"16",
"Move Up");</script></a><?php
209 if ($i != count($sort_order) -1) {
210 ?><a href=
"#" onclick=
"sortOrderMoveDown(<?php echo $sort_id ?>); return false;"><img src=
"<?php echo sq_web_path('lib').'/web/images/icons/down_arrow.png' ?>" width=
"16" height=
"16" border=
"0"alt=
"Move Down" /></a><?php
230 <?php echo translate(
'create_new_page'); ?>
233 <?php text_box($prefix.
'_new_page',
'',
'50'); ?>
257 $write_access = $asset->writeAccess(
'content');
259 $am = $GLOBALS[
'SQ_SYSTEM']->am;
261 if (isset($_POST[$prefix.
'_order'][
'reorder'])) {
262 $new_sort_order = $_POST[$prefix.
'_order'][
'reorder'];
263 $new_sort_order_flip = array_flip($new_sort_order);
265 $sort_order = $asset->getPageLinks();
266 $new_paths = Array();
267 $new_paths_next = Array();
269 foreach ($sort_order as $num => $asset_info) {
270 if ($num != $new_sort_order_flip[$asset_info[
'minorid']]) {
271 $asset->sortOrder($asset_info[
'linkid'], $sort_order[$new_sort_order_flip[$asset_info[
'minorid']]][
'sort_order'], $switch=FALSE);
276 if (isset($_POST[$prefix.
'_delete_page'])) {
277 if (isset($_POST[$prefix.
'_order'][
'reorder'])) {
278 $sort_order_array = $_POST[$prefix.
'_order'][
'reorder'];
282 $delete_list = Array();
283 foreach ($sort_order_array as $key => $id) {
284 if (array_get_index($_POST[$prefix.
'_delete_page'],$key,NULL)) {
285 $delete_list[$id] =
'1';
290 if ($write_access && isset($_POST[$prefix.
'_delete_page'])) {
292 $asset->_tmp[
'deleting_links'] = TRUE;
293 foreach ($delete_list as $id => $flag) {
294 $doomed_link = $am->getLinkByAsset($asset->id, $id);
295 $am->moveLink($doomed_link[
'linkid'], $am->getSystemAssetid(
'trash_folder'), SQ_LINK_TYPE_2,
'0');
296 $deleted = $am->getAsset($doomed_link[
'minorid']);
297 $deleted->saveWebPaths(Array());
301 $asset->_tmp[
'deleting_links'] = FALSE;
303 if ($write_access && isset($_POST[$prefix.
'_new_page']) && !empty($_POST[$prefix.
'_new_page'])) {
304 $asset->createChildPage($_POST[$prefix.
'_new_page']);
307 $asset->_tmp[
'no_sort_order_paths'] = TRUE;
308 $asset->linksUpdated();
310 return $write_access;