Пример #1
0
 static function CurrentLayout($index)
 {
     global $config, $gp_titles, $gpLayouts;
     static $Inherit_Info;
     if (is_null($Inherit_Info)) {
         $Inherit_Info = admin_menu_tools::Inheritance_Info();
     }
     if (isset($gp_titles[$index]['gpLayout'])) {
         $layout = $gp_titles[$index]['gpLayout'];
         if (isset($gpLayouts[$layout])) {
             return $layout;
         }
     }
     if (isset($Inherit_Info[$index]['parent_layout'])) {
         $layout = $Inherit_Info[$index]['parent_layout'];
         if (isset($gpLayouts[$layout])) {
             return $layout;
         }
     }
     return $config['gpLayout'];
 }
Пример #2
0
 function SearchDisplay()
 {
     global $langmessage, $gpLayouts, $gp_index, $gp_menu;
     $Inherit_Info = admin_menu_tools::Inheritance_Info();
     switch ($this->curr_menu_id) {
         case 'search':
             $show_list = $this->GetSearchList();
             break;
         case 'all':
             $show_list = array_keys($gp_index);
             break;
         case 'hidden':
             $show_list = $this->GetAvailable();
             break;
         case 'nomenus':
             $show_list = $this->GetNoMenus();
             break;
     }
     $show_list = array_values($show_list);
     //to reset the keys
     $show_list = array_reverse($show_list);
     //show newest first
     $max = count($show_list);
     while ($this->search_page * $this->search_max_per_page > $max) {
         $this->search_page--;
     }
     $start = $this->search_page * $this->search_max_per_page;
     $stop = min(($this->search_page + 1) * $this->search_max_per_page, $max);
     ob_start();
     echo '<div class="gp_search_links">';
     echo '<span class="showing">';
     echo sprintf($langmessage['SHOWING'], $start + 1, $stop, $max);
     echo '</span>';
     if ($start !== 0 || $stop < $max) {
         for ($i = 0; $i * $this->search_max_per_page < $max; $i++) {
             $class = '';
             if ($i == $this->search_page) {
                 $class = ' class="current"';
             }
             echo $this->Link('Admin_Menu', $i + 1, 'page=' . $i, 'name="gpajax"' . $class);
         }
     }
     echo $this->Link('Admin_Menu', $langmessage['create_new_file'], 'cmd=add_hidden', ' title="' . $langmessage['create_new_file'] . '" name="gpajax"');
     echo '</div>';
     $links = ob_get_clean();
     echo $links;
     echo '<table class="bordered">';
     echo '<thead>';
     echo '<tr><th>';
     echo $langmessage['file_name'];
     echo '</th><th>';
     echo $langmessage['Child Pages'];
     echo '</th>';
     echo '</tr>';
     echo '</thead>';
     echo '<tbody>';
     if (count($show_list) > 0) {
         for ($i = $start; $i < $stop; $i++) {
             $title = $show_list[$i];
             $title_index = $gp_index[$title];
             echo '<tr><td>';
             $label = common::GetLabel($title);
             echo common::Link($title, common::LabelSpecialChars($label));
             //area only display on mouseover
             echo '<div>';
             echo '<b>Options:</b>';
             $img = '<span class="menu_icon page_edit_icon"></span>';
             echo $this->Link('Admin_Menu', $img . $langmessage['rename/details'], 'cmd=renameform&title=' . urlencode($title), ' title="' . $langmessage['rename/details'] . '" name="gpajax" ');
             $img = '<span class="menu_icon copy_icon"></span>';
             echo $this->Link('Admin_Menu', $img . $langmessage['Copy'], 'cmd=copypage&title=' . urlencode($title), ' title="' . $langmessage['Copy'] . '" name="gpabox"');
             $layout = admin_menu_tools::CurrentLayout($title_index);
             $layout_info = $gpLayouts[$layout];
             $img = '<span style="background-color:' . $layout_info['color'] . ';" class="layout_icon"></span>';
             echo $this->Link('Admin_Menu', $img . $layout_info['label'], 'cmd=layout&index=' . urlencode($title_index), ' title="' . $langmessage['layout'] . '" name="gpabox"');
             $is_special = common::SpecialOrAdmin($title);
             if (!$is_special) {
                 $img = '<span class="menu_icon bin_icon"></span>';
                 echo $this->Link('Admin_Menu', $img . $langmessage['delete'], 'cmd=trash&index=' . urlencode($title_index), ' title="' . $langmessage['delete_page'] . '" name="menupost" class="gpconfirm" ');
             }
             gpPlugin::Action('MenuPageOptions', array($title, $title_index, false, $layout_info));
             //stats
             echo '<br/>';
             echo '<b>' . $langmessage['Page Info'] . ':</b>';
             $this->FileStats($title_index, $title, $is_special);
             echo '</div>';
             echo '</td><td>';
             if (isset($Inherit_Info[$title_index]) && isset($Inherit_Info[$title_index]['children'])) {
                 echo $Inherit_Info[$title_index]['children'];
             } elseif (isset($gp_menu[$title_index])) {
                 echo '0';
             } else {
                 echo $langmessage['Not In Main Menu'];
             }
             echo '</td></tr>';
         }
     }
     echo '</tbody>';
     echo '</table>';
     if (count($show_list) == 0) {
         echo '<p>';
         echo $langmessage['Empty'];
         echo '</p>';
     }
     echo '<br/>';
     echo $links;
 }
Пример #3
0
 /**
  * Display current layout, list of available layouts and list of titles affected by the layout setting for $title
  *
  */
 function SelectLayout($url, $query_string)
 {
     global $gp_titles, $gpLayouts, $langmessage, $config, $gp_index;
     $index = $_REQUEST['index'];
     $title = common::IndexToTitle($index);
     if (!$title) {
         echo $langmessage['OOPS'];
         return;
     }
     $this->title = $title;
     $Inherit_Info = admin_menu_tools::Inheritance_Info();
     $curr_layout = admin_menu_tools::CurrentLayout($index);
     $curr_info = $gpLayouts[$curr_layout];
     echo '<div class="inline_box">';
     echo '<h3>';
     echo $langmessage['current_layout'] . ': &nbsp; ';
     echo '<span class="layout_color_id" style="background-color:' . $curr_info['color'] . ';" title="' . $curr_info['color'] . '"></span> &nbsp; ';
     echo str_replace('_', ' ', $curr_info['label']);
     echo '</h3>';
     if (!empty($gp_titles[$index]['gpLayout'])) {
         echo '<p>';
         if (isset($Inherit_Info[$index]['parent_layout'])) {
             $parent_layout = $Inherit_Info[$index]['parent_layout'];
         } else {
             $parent_layout = $config['gpLayout'];
         }
         $parent_info = $gpLayouts[$parent_layout];
         echo $langmessage['restore'] . ': ';
         $span = '<span class="layout_color_id" style="background-color:' . $parent_info['color'] . ';" title="' . $parent_info['color'] . '"></span> ';
         echo common::Link($url, $span . $parent_info['label'], $query_string . 'cmd=restorelayout&index=' . urlencode($index), ' title="' . $langmessage['restore'] . '" name="postlink" ', 'restore');
         echo '</p>';
     }
     echo '<table class="bordered full_width">';
     echo '<tr>';
     echo '<th>';
     echo $langmessage['available_layouts'];
     echo '</th>';
     echo '<th>';
     echo $langmessage['theme'];
     echo '</th>';
     echo '</tr>';
     if (count($gpLayouts) < 2) {
         echo '<tr><td colspan="2">';
         echo $langmessage['Empty'];
         echo '</td></tr>';
         echo '</table>';
         echo common::Link('Admin_Theme_Content', $langmessage['new_layout']);
         echo '</div>';
         return;
     }
     foreach ($gpLayouts as $layout => $info) {
         if ($layout == $curr_layout) {
             continue;
         }
         echo '<tr>';
         echo '<td>';
         echo '<span class="layout_color_id" style="background-color:' . $info['color'] . ';" title="' . $info['color'] . '">';
         echo '</span> ';
         if ($layout != $curr_layout) {
             echo common::Link($url, $info['label'], $query_string . 'cmd=uselayout&index=' . urlencode($index) . '&layout=' . urlencode($layout), 'name="postlink"', 'use_' . $layout);
         }
         echo '</td>';
         echo '<td>';
         echo $info['theme'];
         echo '</td>';
         echo '</tr>';
     }
     echo '</table>';
     //show affected pages
     $affected = page_layout::GetAffectedFiles($index);
     echo '<br/>';
     echo '<table class="bordered full_width">';
     echo '<tr><th>' . $langmessage['affected_files'] . '</th></tr></table>';
     echo '<p class="sm">' . $langmessage['about_layout_change'] . '</p>';
     echo '<p class="admin_note" style="width:35em">';
     $label = common::GetLabelIndex($index, false);
     echo common::LabelSpecialChars($label);
     $i = 0;
     foreach ($affected as $affected_label) {
         $i++;
         echo ', ' . $affected_label;
     }
     echo '</p>';
     echo '<p>';
     echo ' <input type="submit" value="' . $langmessage['cancel'] . '" class="admin_box_close gpcancel" /> ';
     echo '</p>';
     echo '<p class="admin_note">';
     echo '<b>' . $langmessage['see_also'] . '</b> ';
     echo common::Link('Admin_Theme_Content', $langmessage['layouts']);
     echo '</p>';
     echo '</div>';
 }
Пример #4
0
 /**
  * Display row
  *
  */
 function SearchDisplayRow($title)
 {
     global $langmessage, $gpLayouts, $gp_index, $gp_menu;
     $title_index = $gp_index[$title];
     $is_special = common::SpecialOrAdmin($title);
     $file = gpFiles::PageFile($title);
     $stats = @stat($file);
     $mtime = false;
     $size = false;
     $layout = admin_menu_tools::CurrentLayout($title_index);
     $layout_info = $gpLayouts[$layout];
     if ($stats) {
         $mtime = $stats['mtime'];
         $size = $stats['size'];
     }
     echo '<tr><td>';
     $label = common::GetLabel($title);
     echo common::Link($title, common::LabelSpecialChars($label));
     //area only display on mouseover
     echo '<div><div>';
     //style="position:absolute;bottom:0;left:10px;right:10px;"
     echo $this->Link('Admin_Menu', $langmessage['rename/details'], 'cmd=renameform&index=' . urlencode($title_index), array('title' => $langmessage['rename/details'], 'data-cmd' => 'gpajax'));
     echo $this->Link('Admin_Menu', $langmessage['Copy'], 'cmd=copypage&index=' . urlencode($title_index), array('title' => $langmessage['Copy'], 'data-cmd' => 'gpabox'));
     echo '<span>';
     echo $langmessage['layout'] . ': ';
     echo $this->Link('Admin_Menu', $layout_info['label'], 'cmd=layout&index=' . urlencode($title_index), array('title' => $langmessage['layout'], 'data-cmd' => 'gpabox'));
     echo '</span>';
     if (!$is_special) {
         echo $this->Link('Admin_Menu', $langmessage['delete'], 'cmd=trash&index=' . urlencode($title_index), array('title' => $langmessage['delete_page'], 'data-cmd' => 'postlink', 'class' => 'gpconfirm'));
     }
     gpPlugin::Action('MenuPageOptions', array($title, $title_index, false, $layout_info));
     //stats
     if (gpdebug) {
         echo '<span>Data Index: ' . $title_index . '</span>';
     }
     echo '</div>&nbsp;</div>';
     //types
     echo '</td><td>';
     $this->TitleTypes($title_index);
     //children
     echo '</td><td>';
     if (isset($Inherit_Info[$title_index]) && isset($Inherit_Info[$title_index]['children'])) {
         echo $Inherit_Info[$title_index]['children'];
     } elseif (isset($gp_menu[$title_index])) {
         echo '0';
     } else {
         echo $langmessage['Not In Main Menu'];
     }
     //size
     echo '</td><td>';
     if ($size) {
         echo admin_tools::FormatBytes($size);
     }
     //modified
     echo '</td><td>';
     if ($mtime) {
         echo common::date($langmessage['strftime_datetime'], $mtime);
     }
     echo '</td></tr>';
 }