Пример #1
0
 function admin_menu_new()
 {
     global $langmessage, $page, $config;
     $page->ajaxReplace = array();
     $page->css_admin[] = '/include/css/admin_menu_new.css';
     $page->head_js[] = '/include/thirdparty/js/nestedSortable.js';
     $page->head_js[] = '/include/thirdparty/js/jquery_cookie.js';
     $page->head_js[] = '/include/js/admin_menu_new.js';
     $this->max_level_index = max(3, gp_max_menu_level - 1);
     $page->head_script .= 'var max_level_index = ' . $this->max_level_index . ';';
     $cmd = common::GetCommand();
     $this->avail_menus['gpmenu'] = $langmessage['Main Menu'];
     $this->avail_menus['all'] = $langmessage['All Pages'];
     $this->avail_menus['hidden'] = $langmessage['Not In Main Menu'];
     $this->avail_menus['nomenus'] = $langmessage['Not In Any Menus'];
     $this->avail_menus['search'] = $langmessage['search pages'];
     if (isset($config['menus'])) {
         foreach ($config['menus'] as $id => $menu_label) {
             $this->avail_menus[$id] = $menu_label;
         }
     }
     //early commands
     switch ($cmd) {
         case 'altmenu_create':
             $this->AltMenu_Create();
             break;
         case 'rm_menu':
             $this->AltMenu_Remove();
             break;
         case 'alt_menu_rename':
             $this->AltMenu_Rename();
             break;
     }
     //read cookie settings
     if (isset($_COOKIE['gp_menu_prefs'])) {
         parse_str($_COOKIE['gp_menu_prefs'], $this->cookie_settings);
     }
     $this->SetMenuID();
     $this->SetMenuArray();
     $this->SetCollapseSettings();
     $this->SetQueryInfo();
     $cmd_after = gpPlugin::Filter('MenuCommand', array($cmd));
     if ($cmd !== $cmd_after) {
         $cmd = $cmd_after;
         if ($cmd === 'return') {
             return;
         }
     }
     switch ($cmd) {
         case 'rename_menu_prompt':
             $this->RenameMenuPrompt();
             return;
             //menu creation
         //menu creation
         case 'newmenu':
             $this->NewMenu();
             return;
             //rename
         //rename
         case 'renameform':
             $this->RenameForm();
             //will die()
             return;
         case 'renameit':
             $this->RenameFile();
             break;
         case 'hide':
             $this->Hide();
             break;
         case 'drag':
             $this->SaveDrag();
             break;
         case 'trash_page':
         case 'trash':
             $this->MoveToTrash($cmd);
             break;
         case 'add_hidden':
             $this->AddHidden();
             return;
         case 'new_hidden':
             $this->NewHiddenFile();
             break;
         case 'new_redir':
             $this->NewHiddenFile_Redir();
             return;
         case 'copyit':
             $this->CopyPage();
             break;
         case 'copypage':
             $this->CopyForm();
             return;
             // Page Insertion
         // Page Insertion
         case 'insert_before':
         case 'insert_after':
         case 'insert_child':
             $this->InsertDialog($cmd);
             return;
         case 'restore':
             $this->RestoreFromTrash();
             break;
         case 'insert_from_hidden':
             $this->InsertFromHidden();
             break;
         case 'new_file':
             $this->NewFile();
             break;
             //layout
         //layout
         case 'layout':
         case 'uselayout':
         case 'restorelayout':
             includeFile('tool/Page_Layout.php');
             $page_layout = new page_layout($cmd, 'Admin_Menu', $this->query_string);
             if ($page_layout->result()) {
                 return;
             }
             break;
             //external links
         //external links
         case 'new_external':
             $this->NewExternal();
             break;
         case 'edit_external':
             $this->EditExternal();
             return;
         case 'save_external':
             $this->SaveExternal();
             break;
     }
     $this->ShowForm($cmd);
 }
Пример #2
0
 function InheritingLayout($searchLevel, &$menu, &$result)
 {
     global $gp_titles;
     $children = true;
     do {
         $menu_key = key($menu);
         $info = current($menu);
         if (!isset($info['level'])) {
             break;
         }
         $level = $info['level'];
         if ($level < $searchLevel) {
             return;
         }
         if ($level > $searchLevel) {
             if ($children) {
                 page_layout::InheritingLayout($level, $menu, $result);
             } else {
                 unset($menu[$menu_key]);
             }
             continue;
         }
         unset($menu[$menu_key]);
         if (!empty($gp_titles[$menu_key]['gpLayout'])) {
             $children = false;
             continue;
         }
         $children = true;
         //exclude external links
         if ($menu_key[0] == '_') {
             continue;
         }
         $label = common::GetLabelIndex($menu_key, false);
         $result[] = common::LabelSpecialChars($label);
     } while (count($menu) > 0);
 }