示例#1
0
 /**
  * Display the dialog for inserting pages into a menu
  *
  */
 function InsertDialog($cmd)
 {
     global $langmessage, $page;
     includeFile('admin/admin_trash.php');
     echo '<div class="inline_box">';
     echo '<div class="layout_links">';
     echo ' <a href="#gp_Insert_New" data-cmd="tabs" class="selected">' . $langmessage['new_file'] . '</a>';
     echo ' <a href="#gp_Insert_Hidden" data-cmd="tabs">' . $langmessage['Available Pages'] . '</a>';
     echo ' <a href="#gp_Insert_Deleted" data-cmd="tabs">' . $langmessage['restore_from_trash'] . '</a>';
     echo ' <a href="#gp_Insert_External" data-cmd="tabs">' . $langmessage['External Link'] . '</a>';
     echo '</div>';
     // Insert New
     echo '<div id="gp_Insert_New">';
     echo '<form action="' . $this->GetUrl('Admin_Menu') . '" method="post">';
     echo '<table class="bordered full_width">';
     echo '<tr><th>&nbsp;</th><th>&nbsp;</th></tr>';
     echo '<tr>';
     echo '<td>' . $langmessage['label'] . '</td>';
     echo '<td><input type="text" name="title" maxlength="100" value="" size="50" class="gpinput" /></td>';
     echo '</tr>';
     echo '<tr>';
     echo '<td>' . $langmessage['Content Type'] . '</td>';
     echo '<td>';
     includeFile('tool/editing_page.php');
     echo '<div id="new_section_links">';
     editing_page::NewSections(true);
     echo '</div>';
     echo '</td>';
     echo '</tr>';
     echo '</table>';
     echo '<p>';
     echo '<input type="hidden" name="insert_how" value="' . htmlspecialchars($cmd) . '" />';
     echo '<input type="hidden" name="insert_where" value="' . htmlspecialchars($_GET['insert_where']) . '" />';
     echo '<input type="hidden" name="cmd" value="new_file" />';
     echo '<input type="submit" name="aaa" value="' . $langmessage['create_new_file'] . '" class="gpsubmit" data-cmd="gppost"/> ';
     echo '<input type="submit" value="' . $langmessage['cancel'] . '" class="admin_box_close gpcancel" /> ';
     echo '</p>';
     echo '</form>';
     echo '</div>';
     // Insert Hidden
     echo '<div id="gp_Insert_Hidden" class="nodisplay">';
     if ($this->is_main_menu) {
         $avail = $this->GetAvailable();
     } else {
         $avail = $this->GetAvail_Current();
     }
     if (count($avail) == 0) {
         echo '<p>';
         echo $langmessage['Empty'];
         echo '</p>';
     } else {
         echo '<form action="' . common::GetUrl('Admin_Menu') . '" method="post">';
         echo '<table class="bordered full_width">';
         echo '<thead><tr><th>';
         echo $langmessage['title'];
         echo ' &nbsp; <input type="text" name="search" value="" class="gpinput gpsearch" />';
         echo '</th><th class="gp_right">';
         echo $langmessage['insert_into_menu'];
         echo '</th></tr></thead>';
         echo '</table>';
         echo '<ul class="gpui-scrolllist ui-menu ui-widget ui-widget-content ui-corner-all">';
         //sort by label
         $sort_avail = array();
         foreach ($avail as $index => $title) {
             $sort_avail[$index] = common::GetLabel($title);
         }
         natcasesort($sort_avail);
         foreach ($sort_avail as $index => $label) {
             echo '<li class="ui-menu-item">';
             echo '<label class="ui-corner-all">';
             echo '<input type="checkbox" name="keys[]" value="' . htmlspecialchars($index) . '" />';
             echo common::LabelSpecialChars($label);
             echo '<span class="slug">';
             echo '/' . $avail[$index];
             echo '</span>';
             echo '</label>';
             echo '</li>';
         }
         echo '</ul>';
         echo '<p>';
         echo '<input type="hidden" name="insert_how" value="' . htmlspecialchars($cmd) . '" />';
         echo '<input type="hidden" name="insert_where" value="' . htmlspecialchars($_GET['insert_where']) . '" />';
         echo '<input type="hidden" name="cmd" value="insert_from_hidden"  />';
         echo '<input type="submit" name="" value="' . $langmessage['insert_into_menu'] . '" class="gpsubmit" data-cmd="gppost" />';
         echo ' <input type="submit" value="' . $langmessage['cancel'] . '" class="admin_box_close gpcancel" /> ';
         echo '</p>';
         echo '</form>';
     }
     echo '</div>';
     // Insert Deleted / Restore from trash
     echo '<div id="gp_Insert_Deleted" class="nodisplay">';
     $trashtitles = admin_trash::TrashFiles();
     if (count($trashtitles) == 0) {
         echo '<p>' . $langmessage['TRASH_IS_EMPTY'] . '</p>';
     } else {
         echo '<form action="' . common::GetUrl('Admin_Menu') . '" method="post">';
         echo '<table class="bordered full_width"><thead>';
         echo '<tr><th>' . $langmessage['title'];
         echo ' &nbsp; <input type="text" name="search" value="" class="gpinput gpsearch" />';
         echo '</th><th class="gp_right">';
         echo $langmessage['restore'];
         echo '</th></tr>';
         echo '</thead></table>';
         echo '<ul class="gpui-scrolllist ui-menu ui-widget ui-widget-content ui-corner-all">';
         foreach ($trashtitles as $title => $info) {
             echo '<li class="ui-menu-item">';
             echo '<label class="ui-corner-all">';
             echo '<input type="checkbox" name="titles[]" value="' . htmlspecialchars($title) . '" />';
             echo $info['label'];
             echo '<span class="slug">';
             echo '/' . $title;
             echo '</span>';
             echo '</label></li>';
         }
         echo '</ul>';
         echo '<p>';
         echo '<input type="hidden" name="insert_how" value="' . htmlspecialchars($cmd) . '" />';
         echo '<input type="hidden" name="insert_where" value="' . htmlspecialchars($_GET['insert_where']) . '" />';
         echo '<input type="hidden" name="cmd" value="restore"  />';
         echo '<input type="submit" name="" value="' . $langmessage['restore'] . '" class="gpsubmit" data-cmd="gppost"/>';
         echo ' <input type="submit" value="' . $langmessage['cancel'] . '" class="admin_box_close gpcancel" /> ';
         echo '</p>';
         echo '</form>';
     }
     echo '</div>';
     //Insert External
     echo '<div id="gp_Insert_External" class="nodisplay">';
     $args['insert_how'] = $cmd;
     $args['insert_where'] = $_GET['insert_where'];
     $this->ExternalForm('new_external', $langmessage['insert_into_menu'], $args);
     echo '</div>';
     echo '</div>';
 }
示例#2
0
 /**
  * Display the dialog for inserting pages into a menu
  *
  */
 public function InsertDialog($cmd)
 {
     global $langmessage, $page, $gp_index;
     includeFile('admin/admin_trash.php');
     //create format of each tab
     ob_start();
     echo '<div id="%s" class="%s">';
     echo '<form action="' . common::GetUrl('Admin_Menu') . '" method="post">';
     echo '<input type="hidden" name="insert_where" value="' . htmlspecialchars($_GET['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>';
     $this->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>';
     includeFile('tool/editing_page.php');
     echo '<div id="new_section_links">';
     editing_page::NewSections(true);
     echo '</div>';
     echo '</td></tr>';
     echo '</table>';
     echo sprintf($format_bottom, 'new_file', $langmessage['create_new_file']);
     // Insert Hidden
     $avail = $this->GetAvail_Current();
     if ($avail) {
         echo sprintf($format_top, 'gp_Insert_Hidden', 'nodisplay');
         $avail = array_flip($avail);
         $this->ScrollList($avail, 'keys[]', 'checkbox', true);
         echo sprintf($format_bottom, 'insert_from_hidden', $langmessage['insert_into_menu']);
     }
     // Insert Deleted / Restore from trash
     $trashtitles = admin_trash::TrashFiles();
     if ($trashtitles) {
         echo sprintf($format_top, 'gp_Insert_Deleted', 'nodisplay');
         echo '<div class="gpui-scrolllist">';
         echo '<input type="text" name="search" value="" class="gpsearch" placeholder="' . $langmessage['Search'] . '" autocomplete="off" />';
         foreach ($trashtitles as $title => $info) {
             echo '<label>';
             echo '<input type="checkbox" name="titles[]" value="' . htmlspecialchars($title) . '" />';
             echo '<span>';
             echo $info['label'];
             echo '<span class="slug">';
             if (isset($info['title'])) {
                 echo '/' . $info['title'];
             } else {
                 echo '/' . $title;
             }
             echo '</span>';
             echo '</span>';
             echo '</label>';
         }
         echo '</div>';
         echo sprintf($format_bottom, 'restore', $langmessage['restore_from_trash']);
     }
     //Insert External
     echo '<div id="gp_Insert_External" class="nodisplay">';
     $args['insert_how'] = $cmd;
     $args['insert_where'] = $_GET['insert_where'];
     $this->ExternalForm('new_external', $langmessage['insert_into_menu'], $args);
     echo '</div>';
     echo '</div>';
 }