/** * 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" name="tabs" class="selected">' . $langmessage['new_file'] . '</a>'; echo ' <a href="#gp_Insert_Hidden" name="tabs">' . $langmessage['Available Pages'] . '</a>'; echo ' <a href="#gp_Insert_Deleted" name="tabs">' . $langmessage['restore_from_trash'] . '</a>'; echo ' <a href="#gp_Insert_External" name="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> </th><th> </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'); editing_page::SectionTypes(); 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="menupost gpsubmit"/> '; 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 ' <input type="text" name="search" value="" class="gpinput gpsearch" />'; echo '</th><th class="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="menupost gpsubmit" />'; 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 ' <input type="text" name="search" value="" class="gpinput gpsearch" />'; echo '</th><th class="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="menupost gpsubmit" />'; 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>'; }
/** * 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> </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>'; }
function Trash() { global $dataDir, $langmessage; echo '<h2>' . $langmessage['trash'] . '</h2>'; $trashtitles = admin_trash::TrashFiles(); if (count($trashtitles) == 0) { echo '<ul><li>' . $langmessage['TRASH_IS_EMPTY'] . '</li></ul>'; return false; } echo '<form action="' . common::GetUrl('Admin_Trash') . '" method="post">'; echo '<table class="bordered">'; echo '<tr>'; echo '<th><input type="checkbox" name="" class="check_all"/></th>'; echo '<th>'; echo '<input type="submit" name="cmd" value="' . $langmessage['restore'] . '" class="gppost gpsubmit" />'; echo ' '; echo '<input type="submit" name="cmd" value="' . $langmessage['delete'] . '" class="gppost gpsubmit" />'; echo '</th>'; echo '</tr>'; $i = 0; foreach ($trashtitles as $title => $info) { echo '<tr class="' . ($i++ % 2 ? 'even' : '') . '">'; echo '<td>'; echo '<label style="display:block;">'; echo '<input type="checkbox" name="title[' . htmlspecialchars($title) . ']" value="1" />'; echo ' '; echo htmlspecialchars(str_replace('_', ' ', $title)); echo '</label>'; echo '</td>'; echo '<td>'; echo common::Link('Admin_Trash', $langmessage['restore'], 'cmd=restore_one&title[' . rawurlencode($title) . ']=1', 'name="postlink"'); echo ' '; echo common::Link('Admin_Trash', $langmessage['delete'], 'cmd=delete_one&title[' . rawurlencode($title) . ']=1', 'name="postlink"'); echo '</td>'; echo '</tr>'; } echo '<tr>'; echo '<th><input type="checkbox" name="" class="check_all"/></th>'; echo '<th>'; echo '<input type="submit" name="cmd" value="' . $langmessage['restore'] . '" class="gppost gpsubmit" />'; echo ' '; echo '<input type="submit" name="cmd" value="' . $langmessage['delete'] . '" class="gppost gpsubmit" />'; echo '</th>'; echo '</tr>'; echo '</table>'; echo '</form>'; }
/** * Get the $info array for $title for use with $gp_titles * @static */ static function GetInfo($trash_index) { global $dataDir; static $trash_titles = false; if ($trash_titles === false) { $trash_titles = admin_trash::TrashFiles(); } if (!array_key_exists($trash_index, $trash_titles)) { return false; } $title_info = $trash_titles[$trash_index]; $trash_dir = $dataDir . '/data/_trash/' . $trash_index; //make sure we have a file or dir if (empty($title_info['rm_path'])) { if (empty($title_info['file'])) { $title_info['file'] = $trash_index . '.php'; } $title_info['rm_path'] = $dataDir . '/data/_trash/' . $title_info['file']; $title_info['page_file'] = $dataDir . '/data/_trash/' . $title_info['file']; } //make sure we have a label if (empty($title_info['label'])) { $title_info['label'] = admin_tools::LabelToSlug($trash_index); } //make sure we have a file_type if (empty($title_info['type'])) { $title_info['type'] = admin_trash::GetTypes($title_info['page_file']); } return $title_info; }