Ejemplo n.º 1
0
 /**
  * Display the dialog for inserting pages into a menu
  *
  */
 public function InsertDialog($cmd = null)
 {
     global $langmessage, $gp_index;
     if (is_null($cmd)) {
         $cmd = $this->cmd;
     }
     $_REQUEST['gpx_content'] = 'gpabox';
     //create format of each tab
     ob_start();
     echo '<div id="%s" class="%s">';
     echo '<form action="' . \gp\tool::GetUrl('Admin/Menu/Ajax') . '" method="post">';
     echo '<input type="hidden" name="insert_where" value="' . htmlspecialchars($_REQUEST['insert_where']) . '" />';
     echo '<input type="hidden" name="insert_how" value="' . htmlspecialchars($cmd) . '" />';
     echo '<table class="bordered full_width">';
     echo '<thead><tr><th>&nbsp;</th></tr></thead>';
     echo '</table>';
     $format_top = ob_get_clean();
     ob_start();
     echo '<p>';
     echo '<button type="submit" name="cmd" value="%s" class="gpsubmit" data-cmd="gppost">%s</button>';
     echo '<button class="admin_box_close gpcancel">' . $langmessage['cancel'] . '</button>';
     echo '</p>';
     echo '</form>';
     echo '</div>';
     $format_bottom = ob_get_clean();
     echo '<div class="inline_box">';
     //tabs
     echo '<div class="layout_links">';
     echo ' <a href="#gp_Insert_Copy" data-cmd="tabs" class="selected">' . $langmessage['Copy'] . '</a>';
     echo ' <a href="#gp_Insert_New" data-cmd="tabs">' . $langmessage['new_file'] . '</a>';
     echo ' <a href="#gp_Insert_Hidden" data-cmd="tabs">' . $langmessage['Available'] . '</a>';
     echo ' <a href="#gp_Insert_External" data-cmd="tabs">' . $langmessage['External Link'] . '</a>';
     echo ' <a href="#gp_Insert_Deleted" data-cmd="tabs">' . $langmessage['trash'] . '</a>';
     echo '</div>';
     // Copy
     echo sprintf($format_top, 'gp_Insert_Copy', '');
     echo '<table class="bordered full_width">';
     echo '<tr><td>';
     echo $langmessage['label'];
     echo '</td><td>';
     echo '<input type="text" name="title" maxlength="100" size="50" value="" class="gpinput full_width" required/>';
     echo '</td></tr>';
     echo '<tr><td>';
     echo $langmessage['Copy'];
     echo '</td><td>';
     \gp\admin\Menu\Tools::ScrollList($gp_index);
     echo '</td></tr>';
     echo '</table>';
     echo sprintf($format_bottom, 'CopyPage', $langmessage['Copy']);
     // Insert New
     echo sprintf($format_top, 'gp_Insert_New', 'nodisplay');
     echo '<table class="bordered full_width">';
     echo '<tr><td>';
     echo $langmessage['label'];
     echo '</td><td>';
     echo '<input type="text" name="title" maxlength="100" value="" size="50" class="gpinput full_width" required />';
     echo '</td></tr>';
     echo '<tr><td>';
     echo $langmessage['Content Type'];
     echo '</td><td>';
     echo '<div id="new_section_links">';
     \gp\Page\Edit::NewSections(true);
     echo '</div>';
     echo '</td></tr>';
     echo '</table>';
     echo sprintf($format_bottom, 'NewFile', $langmessage['create_new_file']);
     // Insert Hidden
     $avail = $this->GetAvail_Current();
     if (!empty($avail)) {
         echo sprintf($format_top, 'gp_Insert_Hidden', 'nodisplay');
         $avail = array_flip($avail);
         \gp\admin\Menu\Tools::ScrollList($avail, 'keys[]', 'checkbox', true);
         echo sprintf($format_bottom, 'InsertFromHidden', $langmessage['insert_into_menu']);
     }
     // Insert Deleted / Restore from trash
     $scroll_list = $this->TrashScrolllist();
     if (!empty($scroll_list)) {
         echo sprintf($format_top, 'gp_Insert_Deleted', 'nodisplay');
         echo $scroll_list;
         echo sprintf($format_bottom, 'RestoreFromTrash', $langmessage['restore_from_trash']);
     }
     //Insert External
     echo '<div id="gp_Insert_External" class="nodisplay">';
     $args = array();
     $args['insert_how'] = $cmd;
     $args['insert_where'] = $_REQUEST['insert_where'];
     $this->ExternalForm('NewExternal', $langmessage['insert_into_menu'], $args);
     echo '</div>';
     echo '</div>';
 }
Ejemplo n.º 2
0
 /**
  * Perform various section editing commands
  *
  */
 public function SectionEdit()
 {
     global $langmessage;
     $this->page->file_sections =& $this->file_sections;
     //hack so the SaveSection filter works
     $_REQUEST['section'] = 0;
     if (!parent::SectionEdit()) {
         return false;
     }
     return true;
 }