Example #1
0
 - delete / undelete
 - archive / unarchive
 - publish / unpublish
 - cancel edition
 - cancel draft 
 - submit draft to validation
 - validate
 - regenerate
 */
 $panelTitle = $cms_language->getMessage(MESSAGE_PAGE_ACTION);
 $panelPicto = 'atm-pic-big-action';
 $panelDisabled = $cms_user->hasPageClearance($cms_page->getID(), CLEARANCE_PAGE_VIEW) ? 'false' : 'true';
 $panelTipTitle = $cms_language->getMessage(MESSAGE_PAGE_ACTION_TIP_TITLE);
 $panelTip = $cms_language->getMessage(MESSAGE_PAGE_ACTION_TIP_DESC);
 if ($cms_user->hasPageClearance($cms_page->getID(), CLEARANCE_PAGE_VIEW)) {
     $hasSiblings = CMS_tree::hasSiblings($cms_page);
     $pageCopy = "\n\t\t\t\t\tmenu.addItem(new Ext.menu.Item({\n\t\t\t\t\t\ttext: '<span ext:qtip=\"" . $cms_language->getJsMessage(MESSAGE_PAGE_COPY_INFO) . "\">" . $cms_language->getJsMessage(MESSAGE_PAGE_COPY) . "</span>',\n\t\t\t\t\t\ticonCls: 'atm-pic-copy',\n\t\t\t\t\t\thandler: function() {\n\t\t\t\t\t\t\t//create window element\n\t\t\t\t\t\t\tvar win = new Automne.Window({\n\t\t\t\t\t\t\t\tid:\t\t\t\t'pageCopyWindow',\n\t\t\t\t\t\t\t\tcurrentPage:\t" . $cms_page->getID() . ",\n\t\t\t\t\t\t\t\tautoLoad:\t\t{\n\t\t\t\t\t\t\t\t\turl:\t\t'page-copy.php',\n\t\t\t\t\t\t\t\t\tparams:\t\t{\n\t\t\t\t\t\t\t\t\t\twinId:\t\t'pageCopyWindow',\n\t\t\t\t\t\t\t\t\t\tcurrentPage:" . $cms_page->getID() . "\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\tnocache:\ttrue,\n\t\t\t\t\t\t\t\t\tscope:\t\tthis\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\twin.show(this.getEl());\n\t\t\t\t\t\t}\n\t\t\t\t\t}));";
 } else {
     $pageCopy = '';
 }
 //draft
 if ($fromtab == 'edit' && $cms_user->getUserID() == $hasLock) {
     //cancel draft and submit draft to validation
     $pageDraft = "\n\t\t\t\t\tmenu.addSeparator();\n\t\t\t\t\tmenu.addItem(new Ext.menu.Item({\n\t\t\t\t\t\ttext: '<span ext:qtip=\"" . $cms_language->getJSMessage(MESSAGE_PAGE_DELETE_DRAFT_INFO) . "\">" . $cms_language->getJSMessage(MESSAGE_PAGE_DELETE_DRAFT) . "</span>',\n\t\t\t\t\t\ticonCls: 'atm-pic-draft-deletion',\n\t\t\t\t\t\thandler: function(){\n\t\t\t\t\t\t\tAutomne.message.popup({\n\t\t\t\t\t\t\t\tmsg: \t\t\t\t'" . $cms_language->getJSMessage(MESSAGE_PAGE_DELETE_DRAFT_CONFIRM) . "',\n\t\t\t\t\t\t\t\tbuttons: \t\t\tExt.MessageBox.OKCANCEL,\n\t\t\t\t\t\t\t\tanimEl: \t\t\tthis.getEl(),\n\t\t\t\t\t\t\t\tclosable: \t\t\tfalse,\n\t\t\t\t\t\t\t\ticon: \t\t\t\tExt.MessageBox.WARNING,\n\t\t\t\t\t\t\t\tfn: \t\t\t\tfunction (button) {\n\t\t\t\t\t\t\t\t\tif (button == 'ok') {\n\t\t\t\t\t\t\t\t\t\t//send to public or edited tab\n\t\t\t\t\t\t\t\t\t\tvar pubTab = tabs.getItem('public');\n\t\t\t\t\t\t\t\t\t\tif (!pubTab.disabled) {\n\t\t\t\t\t\t\t\t\t\t\ttabs.setActiveTab('public');\n\t\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\t\ttabs.setActiveTab('edited');\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tAutomne.server.call({\n\t\t\t\t\t\t\t\t\t\t\turl:\t\t\t\t'page-controler.php',\n\t\t\t\t\t\t\t\t\t\t\tparams: \t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\tcurrentPage:\t\t'" . $cms_page->getID() . "',\n\t\t\t\t\t\t\t\t\t\t\t\taction:\t\t\t\t'cancel_draft'\n\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\tfcnCallback: \t\tfunction() {\n\t\t\t\t\t\t\t\t\t\t\t\t//then reload page infos\n\t\t\t\t\t\t\t\t\t\t\t\ttabs.getPageInfos({\n\t\t\t\t\t\t\t\t\t\t\t\t\tpageId:\t\t'" . $cms_page->getID() . "',\n\t\t\t\t\t\t\t\t\t\t\t\t\tnoreload:\ttrue\n\t\t\t\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\tcallBackScope:\t\tthis\n\t\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t}\n\t\t\t\t\t}));\n\t\t\t\t\tmenu.addItem(new Ext.menu.Item({\n\t\t\t\t\t\ttext: '<span ext:qtip=\"" . $cms_language->getJSMessage(MESSAGE_PAGE_DRAFT_TO_VALIDATION_INFO) . "\">" . $cms_language->getJSMessage(MESSAGE_PAGE_DRAFT_TO_VALIDATION) . "</span>',\n\t\t\t\t\t\ticonCls: 'atm-pic-draft-validation',\n\t\t\t\t\t\thandler: function () {\n\t\t\t\t\t\t\t//submit page to validation\n\t\t\t\t\t\t\tAutomne.server.call({\n\t\t\t\t\t\t\t\turl:\t\t\t\t'page-controler.php',\n\t\t\t\t\t\t\t\tparams: \t\t\t{\n\t\t\t\t\t\t\t\t\tcurrentPage:\t\t'" . $cms_page->getID() . "',\n\t\t\t\t\t\t\t\t\taction:\t\t\t\t'submit_for_validation'\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\tfcnCallback: \t\tfunction() {\n\t\t\t\t\t\t\t\t\t//then reload page infos\n\t\t\t\t\t\t\t\t\ttabs.getPageInfos({\n\t\t\t\t\t\t\t\t\t\tpageId:\t\t'" . $cms_page->getID() . "',\n\t\t\t\t\t\t\t\t\t\tnoreload:\ttrue\n\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\tcallBackScope:\t\tthis\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t}\n\t\t\t\t\t}));";
 } else {
     $pageDraft = '';
 }
 if ($cms_user->hasPageClearance($cms_page->getID(), CLEARANCE_PAGE_EDIT)) {
     if ($hasLock) {
         //unlock
         if ($fromtab != 'edit' && ($cms_user->getUserID() == $hasLock || $cms_user->hasAdminClearance(CLEARANCE_ADMINISTRATION_EDITVALIDATEALL))) {
Example #2
0
            $property = '(' . $sibling->getID() . ')';
            $redirectlink = $sibling->getRedirectLink(true);
            if ($redirectlink->hasValidHREF()) {
                if ($redirectlink->getLinkType() == RESOURCE_LINK_TYPE_INTERNAL) {
                    $redirectPage = new CMS_page($redirectlink->getInternalLink());
                    if (!$redirectPage->hasError()) {
                        $property .= '<small class="atm-help" ext:qtip="' . $cms_language->getMessage(MESSAGE_PAGE_REDIRECT, array('\'' . $redirectPage->getTitle(true) . '\' (' . $redirectPage->getID() . ')')) . '"> &rArr; ' . $redirectPage->getID() . '</small>';
                    }
                } else {
                    $label = $redirectlink->getExternalLink();
                    $property .= '<small class="atm-help" ext:qtip="' . $cms_language->getMessage(MESSAGE_PAGE_REDIRECT, array(io::ellipsis($label, '80'))) . '"> &rArr; ' . io::ellipsis($label, '50') . '</small>';
                }
            }
        }
        $pageTitle = PAGE_LINK_NAME_IN_TREE ? $sibling->getLinkTitle() : $sibling->getTitle();
        $hasSiblings = CMS_tree::hasSiblings($sibling) ? true : false;
        $ddtext = '';
        $draggable = $allowDrop = false;
        $editableSibling = $cms_user->hasPageClearance($sibling->getId(), CLEARANCE_PAGE_EDIT);
        if ($enableDD) {
            //does this node draggable ? (/!\ only public nodes can be draggable)
            $draggable = !$sibling->isProtected() && $editableSibling && (!$hasSiblings || $cms_user->hasAdminClearance(CLEARANCE_ADMINISTRATION_REGENERATEPAGES) && $sibling->getID() != APPLICATION_ROOT_PAGE_ID) && $sibling->getPublication() == RESOURCE_PUBLICATION_PUBLIC;
            //does this node can be a drop target ?
            $allowDrop = !$maxlevelReached && $cms_user->hasPageClearance($sibling->getId(), CLEARANCE_PAGE_EDIT);
            //$ddtext = $allowDrop ? ' allowDrop' : '';
        }
        $nodes[] = array('id' => 'page' . $sibling->getID(), 'onClick' => $editableSibling || $sibling->getPublication() == RESOURCE_PUBLICATION_PUBLIC ? sprintf($onClick, $sibling->getID()) : '', 'onSelect' => sprintf($onSelect, $sibling->getID()), 'text' => io::htmlspecialchars($pageTitle) . ' ' . $property . $ddtext, 'status' => $sibling->getStatus()->getHTML(true, $cms_user, MOD_STANDARD_CODENAME, $sibling->getID()), 'leaf' => $maxlevelReached || !$hasSiblings, 'draggable' => $draggable, 'allowDrop' => $allowDrop, 'allowChildren' => true, 'disabled' => false, 'uiProvider' => 'page', 'selected' => $sibling->getID() == $currentPage, 'expanded' => in_array($sibling->getID(), $currentPageLineage));
    }
}
$view->setContent($nodes);
$view->show();
Example #3
0
$pageLanguage = sensitiveIO::sanitizeJSString($language->getLabel());
$languageValue = $language->getCode();
$pragmaValue = $cms_page->getPragma() != '' ? 'true' : 'false';
$languages = CMS_languagesCatalog::getAllLanguages(MOD_STANDARD_CODENAME);
$languagesDatas = array();
foreach ($languages as $aLanguage) {
    $languagesDatas[] = array($aLanguage->getCode(), $aLanguage->getLabel());
}
$languagesDatas = sensitiveIO::jsonEncode($languagesDatas);
$metas = sensitiveIO::sanitizeJSString($cms_page->getMetas(), false, true, true);
//this is a textarea, we must keep cariage return
/***************************************\
*               SUB-PAGES               *
\***************************************/
$siblings = '';
if (CMS_tree::hasSiblings($cms_page)) {
    $siblings = ", {\n\t\t\t\t\ttitle:\t'" . $cms_language->getMessage(MESSAGE_PAGE_SUBPAGES_LABEL) . "',\n\t\t\t\t\txtype:\t'atmPanel',\n\t\t\t\t\tid:\t\t'subPagesPanel',\n\t\t\t\t\tautoLoad:\t\t{\n\t\t\t\t\t\turl:\t\t'tree.php',\n\t\t\t\t\t\tparams:\t\t{\n\t\t\t\t\t\t\twinId:\t\t'subPagesPanel',\n\t\t\t\t\t\t\troot:\t\t'{$pageId}',\n\t\t\t\t\t\t\tshowRoot:\tfalse,\n\t\t\t\t\t\t\tmaxlevel:\t1,\n\t\t\t\t\t\t\thideMenu:\ttrue,\n\t\t\t\t\t\t\twindow:\t\tfalse,\n\t\t\t\t\t\t\theading:\t'" . $cms_language->getJSMessage(MESSAGE_PAGE_SUBPAGES_LIST_MESSAGE) . " " . sensitiveIO::sanitizeJSString($cms_page->getTitle()) . "." . ($cms_user->hasPageClearance($cms_page->getID(), CLEARANCE_PAGE_EDIT) ? ' ' . $cms_language->getJSMessage(MESSAGE_PAGE_DRAGANDDROP_MESSAGE) : '') . "',\n\t\t\t\t\t\t\tenableDD:\t" . ($cms_user->hasPageClearance($cms_page->getID(), CLEARANCE_PAGE_EDIT) ? 'true' : 'false') . "\n\t\t\t\t\t\t},\n\t\t\t\t\t\tnocache:\ttrue,\n\t\t\t\t\t\tscope:\t\tthis\n\t\t\t\t\t}\n\t            }";
}
/***************************************\
*              PAGE LOGS                *
\***************************************/
$logs = ", {\n\t\t\ttitle:\t'" . $cms_language->getMessage(MESSAGE_PAGE_LOG_LABEL) . "',\n\t\t\txtype:\t'atmPanel',\n\t\t\tlayout:\t'fit',\n\t\t\tid:\t\t'logPanel',\n\t\t\tautoLoad:\t\t{\n\t\t\t\turl:\t\t'page-logs.php',\n\t\t\t\tparams:\t\t{\n\t\t\t\t\twinId:\t\t'logPanel',\n\t\t\t\t\tcurrentPage:'{$pageId}',\n\t\t\t\t\taction:\t\t'view'\n\t\t\t\t},\n\t\t\t\tnocache:\ttrue,\n\t\t\t\tscope:\t\tthis\n\t\t\t}\n           }";
/***************************************\
*             MODULES TABS              *
\***************************************/
$modules = CMS_modulesCatalog::getALL();
$modulesTabs = '';
foreach ($modules as $aModule) {
    if ($aModule->getCodename() != MOD_STANDARD_CODENAME && $cms_user->hasModuleClearance($aModule->getCodename(), CLEARANCE_MODULE_EDIT) && method_exists($aModule, 'getPageTabsProperties')) {
        $tabsInfos = $aModule->getPageTabsProperties($cms_page, $cms_user);
        foreach ($tabsInfos as $tabInfos) {
    /** 
     * Recursive function to build items tree.
     *
     * @param mixed $items : current category or page
     * @param integer $count, to determine item in-tree depth
     * @param integer $parent_clearance, immediate parent item clearance
     * @return string HTML formated
     */
    function build_items_tree(&$item, $count, $parent_clearance)
    {
        global $moduleCodename, $cms_language, $cms_user, $profileId, $hash;
        //current user environment
        global $items_ids;
        //reference to all displayed items
        global $modules_clearances, $stack_clearances;
        //all clearances types available
        global $maxDepth, $clearance_colors;
        //displaying options
        global $disableFields;
        //disable status
        $s = '';
        $count++;
        // Current category clearance
        $i_default_clearance = $stack_clearances->getElementValueFromKey($item->getID());
        // Thig hidden but sets current category clearance identical
        // to its parent's one, used to hide some checkboxes
        $i_current_clearance = $i_default_clearance !== false ? (int) $i_default_clearance : $parent_clearance;
        if ($i_default_clearance !== false) {
            $bgColor = ' style="background-color:' . $clearance_colors[$i_default_clearance] . ';"';
        } elseif (!$i_default_clearance && $item->isRoot()) {
            $bgColor = ' style="background-color:' . $clearance_colors[CLEARANCE_MODULE_NONE] . ';"';
        } else {
            $bgColor = '';
        }
        $items_ids[] = $item->getID();
        if (is_a($item, 'CMS_moduleCategory')) {
            $hasSiblings = $item->hasSiblings();
        } else {
            $hasSiblings = CMS_tree::hasSiblings($item);
        }
        //Link to sub categories
        if ($hasSiblings) {
            if ($count < $maxDepth) {
                $thumbnail = '';
            } else {
                $thumbnail = '<a href="#" onclick="Automne.categories.open(' . $item->getID() . ', \'' . $hash . '\', this);return false;" title="ID : ' . $item->getID() . '">+</a>';
            }
        } else {
            $thumbnail = '';
        }
        //disabled checkboxes if needed
        if ($disableFields) {
            $disabled = ' disabled="disabled"';
        } else {
            //check if user has edition rights on item
            if (is_a($item, 'CMS_moduleCategory')) {
                $disabled = $cms_user->hasModuleCategoryClearance($item->getID(), CLEARANCE_MODULE_MANAGE) ? '' : ' disabled="disabled"';
            } else {
                $disabled = $cms_user->hasPageClearance($item->getId(), CLEARANCE_PAGE_EDIT) ? '' : ' disabled="disabled"';
            }
        }
        $label = is_a($item, 'CMS_moduleCategory') ? $item->getLabel() : $item->getTitle();
        $label = $disabled ? '<span style="color:grey;">' . $label . '</span>' : $label;
        // Get title and form actions
        $s .= '
			<li' . $bgColor . ' id="li-' . $hash . '-' . $item->getID() . '">
				<table border="0" cellpadding="0" cellspacing="0"' . $bgColor . ' onMouseOver="Automne.categories.onRow(this);" onMouseOut="Automne.categories.outRow(this);">
					<tr>
						<td width="100%">&nbsp;' . $thumbnail . '<span title="ID : ' . $item->getID() . '">' . $label . '</span></td>
						<td width="120">
							<table width="120" border="0" cellpadding="0" cellspacing="0" id="checkboxes-' . $hash . '-' . $item->getID() . '">
								<tr>';
        @reset($modules_clearances);
        while (list($msg, $value) = @each($modules_clearances)) {
            $sel = '';
            //check if user has edition rights on item
            if ($disableFields) {
                $disabled = ' disabled="disabled"';
            } else {
                if (is_a($item, 'CMS_moduleCategory')) {
                    $disabled = $cms_user->hasModuleCategoryClearance($item->getID(), CLEARANCE_MODULE_MANAGE) ? '' : ' disabled="disabled"';
                } else {
                    $disabled = $cms_user->hasPageClearance($item->getId(), CLEARANCE_PAGE_EDIT) ? '' : ' disabled="disabled"';
                }
            }
            if ($item->isRoot() || !$item->isRoot() && $parent_clearance !== $value) {
                // If none clearance defined yet, access is denied to any root category
                if (!$i_default_clearance && $value === CLEARANCE_MODULE_NONE && $item->isRoot() || $i_default_clearance !== false && (int) $i_default_clearance === $value) {
                    $sel = ' checked="checked"';
                }
                $s .= '<td width="30" align="center"><input type="checkbox"' . $disabled . ' onclick="Automne.categories.unselectOthers(\'' . $item->getID() . '\',\'' . $value . '\', \'' . $count . '\', \'' . $hash . '\');" id="check-' . $hash . '-' . $item->getID() . '_' . $value . '" name="cat' . $item->getID() . '" value="' . $value . '"' . $sel . $disabled . ' /></td>';
            } else {
                $s .= '<td width="30" align="center"><input type="checkbox"' . $disabled . ' onclick="Automne.categories.unselectOthers(\'' . $item->getID() . '\',\'' . $value . '\', \'' . $count . '\', \'' . $hash . '\');" id="check-' . $hash . '-' . $item->getID() . '_' . $value . '" name="cat' . $item->getID() . '" value="' . $value . '" style="display:none;"' . $disabled . ' /></td>';
            }
        }
        $s .= '					</tr>
							</table>
						</td>
					</tr>
				</table>';
        // Print siblings tree recursivly
        if ($hasSiblings) {
            if ($count < $maxDepth) {
                //get siblings
                if (is_a($item, 'CMS_moduleCategory')) {
                    $attrs = array("module" => $moduleCodename, "language" => $cms_language, "level" => $item->getID(), "root" => false, "attrs" => false, "cms_user" => &$cms_user);
                    $siblings = CMS_module::getModuleCategories($attrs);
                } else {
                    $siblings = CMS_tree::getSiblings($item);
                }
                // Prepare form actions here
                if (is_array($siblings) && $siblings) {
                    $s .= '<ul id="ul-' . $hash . '-' . $item->getID() . '">';
                    foreach ($siblings as $aSibling) {
                        if (is_a($item, 'CMS_moduleCategory')) {
                            $aSibling->setAttribute('language', $cms_language);
                        }
                        $s .= build_items_tree($aSibling, $count, $i_current_clearance);
                    }
                    $s .= '</ul>';
                }
            }
        }
        $s .= '</li>';
        return $s;
    }