Exemple #1
0
 public function __construct($args)
 {
     global $langmessage, $config;
     parent::__construct($args);
     $this->section_types = \gp\tool\Output\Sections::GetTypes();
     $this->page->ajaxReplace = array();
     $this->page->css_admin[] = '/include/css/admin_menu_new.css';
     $this->page->head_js[] = '/include/thirdparty/js/nestedSortable.js';
     $this->page->head_js[] = '/include/thirdparty/js/jquery_cookie.js';
     $this->page->head_js[] = '/include/js/admin_menu_new.js';
     $this->max_level_index = max(3, gp_max_menu_level - 1);
     $this->page->head_script .= 'var max_level_index = ' . $this->max_level_index . ';';
     $this->avail_menus['gpmenu'] = $langmessage['Main Menu'] . ' / ' . $langmessage['site_map'];
     $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;
         }
     }
     //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 = \gp\tool::GetCommand();
     $this->cmd = \gp\tool\Plugins::Filter('MenuCommand', array($cmd));
 }
Exemple #2
0
 /**
  * View all files in the trash
  *
  */
 public function Trash()
 {
     global $dataDir, $langmessage;
     $this->section_types = \gp\tool\Output\Sections::GetTypes();
     echo '<h2>' . $langmessage['trash'] . '</h2>';
     if (count($this->trash_files) == 0) {
         echo '<ul><li>' . $langmessage['TRASH_IS_EMPTY'] . '</li></ul>';
         return false;
     }
     echo '<form action="' . \gp\tool::GetUrl('Admin/Trash') . '" method="post">';
     echo '<table class="bordered striped full_width">';
     ob_start();
     echo '<tr><th colspan="3">';
     echo '<input type="checkbox" name="" class="check_all"/>';
     echo '</th><th>';
     echo '<button type="submit" name="cmd" value="RestoreDeleted" class="gppost gpsubmit">' . $langmessage['restore'] . '</button> ';
     echo '<button type="submit" name="cmd" value="DeleteFromTrash" class="gppost gpsubmit">' . $langmessage['delete'] . '</button>';
     echo '</th></tr>';
     $heading = ob_get_clean();
     echo $heading;
     // non-orphaned
     $orphaned = array();
     foreach ($this->trash_files as $trash_index => $info) {
         if (isset($info['orphaned'])) {
             $orphaned[$trash_index] = $info;
         } else {
             $this->TrashRow($trash_index, $info);
         }
     }
     // orphaned files
     if ($orphaned) {
         echo '<tr><td colspan="3">';
         echo '<input type="checkbox" style="visibility:hidden"> &nbsp; ';
         echo count($orphaned) . ' Orphaned Files Found';
         echo '</td><td>';
         echo '<a class="nowrap" data-cmd="ViewOrphaned">' . $langmessage['View'] . '</a> &nbsp; ';
         $q = array();
         $q['titles'] = array_keys($orphaned);
         $q = 'cmd=DeleteFromTrash&' . http_build_query($q);
         echo \gp\tool::Link('Admin/Trash', $langmessage['delete'], $q, array('data-cmd' => 'postlink'));
         echo '</td></tr>';
         foreach ($orphaned as $trash_index => $info) {
             $this->TrashRow($trash_index, $info);
         }
     }
     echo $heading;
     echo '</table>';
     echo '</form>';
 }
Exemple #3
0
 public function GetSection(&$section_num)
 {
     global $langmessage;
     if (!isset($this->file_sections[$section_num])) {
         trigger_error('invalid section number');
         return;
     }
     $curr_section_num = $section_num;
     $section_num++;
     $content = '';
     $section_data = $this->file_sections[$curr_section_num];
     //make sure section_data is an array
     $type = gettype($section_data);
     if ($type !== 'array') {
         trigger_error('$section_data is ' . $type . '. Array expected');
         return;
     }
     $section_data += array('attributes' => array(), 'type' => 'text');
     $section_data['attributes'] += array('class' => '');
     $orig_attrs = $section_data['attributes'];
     $section_data['attributes']['data-gp-section'] = $curr_section_num;
     $section_types = \gp\tool\Output\Sections::GetTypes();
     if (\gp\tool\Output::ShowEditLink() && \gp\admin\Tools::CanEdit($this->gp_index)) {
         if (isset($section_types[$section_data['type']])) {
             $title_attr = $section_types[$section_data['type']]['label'];
         } else {
             $title_attr = sprintf($langmessage['Section %s'], $curr_section_num + 1);
         }
         $attrs = array('title' => $title_attr, 'data-cmd' => 'inline_edit_generic', 'data-arg' => $section_data['type'] . '_inline_edit');
         $link = \gp\tool\Output::EditAreaLink($edit_index, $this->title, $langmessage['edit'], 'section=' . $curr_section_num, $attrs);
         $section_data['attributes']['data-gp-area-id'] = $edit_index;
         //section control links
         if ($section_data['type'] != 'wrapper_section') {
             ob_start();
             echo '<span class="nodisplay" id="ExtraEditLnks' . $edit_index . '">';
             echo $link;
             echo \gp\tool::Link($this->title, $langmessage['Manage Sections'], 'cmd=ManageSections', array('class' => 'manage_sections', 'data-cmd' => 'inline_edit_generic', 'data-arg' => 'manage_sections'));
             echo '<span class="gp_separator"></span>';
             echo \gp\tool::Link($this->title, $langmessage['rename/details'], 'cmd=renameform&index=' . urlencode($this->gp_index), 'data-cmd="gpajax"');
             echo \gp\tool::Link($this->title, $langmessage['Revision History'], 'cmd=ViewHistory', array('data-cmd' => 'gpabox'));
             echo '<span class="gp_separator"></span>';
             echo \gp\tool::Link('Admin/Menu', $langmessage['file_manager']);
             echo '</span>';
             \gp\tool\Output::$editlinks .= ob_get_clean();
         }
         $section_data['attributes']['id'] = 'ExtraEditArea' . $edit_index;
     }
     $content .= $this->SectionNode($section_data, $orig_attrs);
     if ($section_data['type'] == 'wrapper_section') {
         for ($cc = 0; $cc < $section_data['contains_sections']; $cc++) {
             $content .= $this->GetSection($section_num);
         }
     } else {
         \gp\tool\Output::$nested_edit = true;
         $content .= \gp\tool\Output\Sections::RenderSection($section_data, $curr_section_num, $this->title, $this->file_stats);
         \gp\tool\Output::$nested_edit = false;
     }
     if (!isset($section_data['nodeName'])) {
         $content .= '<div class="gpclear"></div>';
         $content .= '</div>';
     } else {
         $content .= \gp\tool\Output\Sections::EndTag($section_data['nodeName']);
     }
     return $content;
 }
Exemple #4
0
 /**
  * Display form for defining a new extra edit area
  *
  */
 public function NewExtraForm()
 {
     global $langmessage;
     $types = \gp\tool\Output\Sections::GetTypes();
     echo '<p>';
     echo '<form action="' . \gp\tool::GetUrl('Admin/Extra') . '" method="post">';
     echo '<input type="hidden" name="cmd" value="NewSection" />';
     echo '<input type="text" name="new_title" value="" size="15" class="gpinput" required/> ';
     echo '<select name="type" class="gpselect">';
     foreach ($types as $type => $info) {
         echo '<option value="' . $type . '">' . $info['label'] . '</option>';
     }
     echo '</select> ';
     echo '<input type="submit" name="" value="' . $langmessage['Add New Area'] . '" class="gpsubmit gpvalidate" data-cmd="gppost"/>';
     echo '</form>';
     echo '</p>';
 }
Exemple #5
0
 public function SelectContent_Areas($param, $count_gadgets)
 {
     global $dataDir, $langmessage, $config;
     $addQuery = 'cmd=addcontent&where=' . rawurlencode($param);
     echo '<div id="area_lists">';
     //extra content
     echo '<div id="layout_extra_content">';
     echo '<table class="bordered">';
     echo '<tr><th colspan="2">&nbsp;</th></tr>';
     $extrasFolder = $dataDir . '/data/_extra';
     $files = \gp\tool\Files::ReadDir($extrasFolder);
     asort($files);
     foreach ($files as $file) {
         $extraName = $file;
         echo '<tr><td>';
         echo str_replace('_', ' ', $extraName);
         echo '</td><td class="add">';
         echo \gp\tool::Link($this->layout_slug, $langmessage['add'], $addQuery . '&insert=Extra:' . $extraName, array('data-cmd' => 'creq'));
         echo '</td></tr>';
     }
     //new extra area
     echo '<tr><td>';
     echo '<form action="' . \gp\tool::GetUrl($this->layout_slug) . '" method="post">';
     echo '<input type="hidden" name="cmd" value="addcontent" />';
     echo '<input type="hidden" name="addtype" value="new_extra" />';
     echo '<input type="hidden" name="where" value="' . htmlspecialchars($param) . '" />';
     echo '<input type="text" name="extra_area" value="" size="15" class="gpinput"/>';
     $types = \gp\tool\Output\Sections::GetTypes();
     echo '<select name="type" class="gpselect">';
     foreach ($types as $type => $info) {
         echo '<option value="' . $type . '">' . $info['label'] . '</option>';
     }
     echo '</select> ';
     echo ' <input type="submit" name="" value="' . $langmessage['Add New Area'] . '" class="gpbutton"/>';
     echo '</form>';
     echo '</td><td colspan="2" class="add">';
     echo '<form action="' . \gp\tool::GetUrl($this->layout_slug) . '" method="post">';
     echo ' <input type="submit" name="cmd" value="' . $langmessage['cancel'] . '" class="admin_box_close gpcancel" />';
     echo '</form>';
     echo '</td></tr>';
     echo '</table>';
     echo '</div>';
     //gadgets
     if ($count_gadgets > 0) {
         echo '<div id="layout_gadgets" class="nodisplay">';
         echo '<table class="bordered">';
         echo '<tr><th colspan="2">&nbsp;</th></tr>';
         foreach ($config['gadgets'] as $gadget => $info) {
             echo '<tr>';
             echo '<td>';
             echo str_replace('_', ' ', $gadget);
             echo '</td>';
             echo '<td class="add">';
             echo \gp\tool::Link($this->layout_slug, $langmessage['add'], $addQuery . '&insert=' . $gadget, array('data-cmd' => 'creq'));
             echo '</td>';
             echo '</tr>';
         }
         echo '<tr><td colspan="2" class="add">';
         echo ' <input type="submit" name="cmd" value="' . $langmessage['cancel'] . '" class="admin_box_close gpcancel" />';
         echo '</td></tr>';
         echo '</table>';
         echo '</div>';
     }
     //menus
     echo '<div id="layout_menus" class="nodisplay">';
     echo '<form action="' . \gp\tool::GetUrl($this->layout_slug) . '" method="post">';
     echo '<input type="hidden" name="cmd" value="addcontent" />';
     echo '<input type="hidden" name="addtype" value="preset_menu" />';
     echo '<input type="hidden" name="where" value="' . htmlspecialchars($param) . '" />';
     echo '<table class="bordered">';
     $this->PresetMenuForm();
     echo '<tr><td colspan="2" class="add">';
     echo '<input type="submit" name="" value="' . $langmessage['Add New Menu'] . '" class="gpsubmit" />';
     echo ' <input type="submit" name="cmd" value="' . $langmessage['cancel'] . '" class="admin_box_close gpcancel" />';
     echo '</td></tr>';
     echo '</table>';
     echo '</form>';
     echo '</div>';
     echo '<div id="layout_custom" class="nodisplay">';
     //custom area
     echo '<form action="' . \gp\tool::GetUrl($this->layout_slug) . '" method="post">';
     echo '<input type="hidden" name="cmd" value="addcontent" />';
     echo '<input type="hidden" name="addtype" value="custom_menu" />';
     echo '<input type="hidden" name="where" value="' . htmlspecialchars($param) . '" />';
     $this->CustomMenuForm();
     echo '<tr><td colspan="2" class="add">';
     echo '<input type="submit" name="" value="' . $langmessage['Add New Menu'] . '" class="gpsubmit" />';
     echo ' <input type="submit" name="cmd" value="' . $langmessage['cancel'] . '" class="admin_box_close gpcancel" />';
     echo '</td></tr>';
     echo '</table>';
     echo '</form>';
     echo '</div>';
     echo '</div>';
 }