Exemplo n.º 1
0
 /**
  * Load the inline editor for a theme image
  *
  */
 public function InlineEdit()
 {
     $section = array();
     $section['type'] = 'image';
     \gp\tool\Output\Ajax::InlineEdit($section);
     die;
 }
Exemplo n.º 2
0
 /**
  * Send js to client for managing content sections
  *
  */
 public static function ManageSections()
 {
     global $langmessage, $page;
     $scripts = array();
     //output links
     ob_start();
     if ($page->pagetype == 'display') {
         echo '<div id="section_sorting_wrap" class="inline_edit_area">';
         echo '<ul id="section_sorting" class="section_drag_area" title="Organize"></ul>';
         echo '<div>' . $langmessage['add'] . '</div>';
         echo '<div id="new_section_links">';
         self::NewSections();
         echo '</div>';
         echo '</div>';
     }
     echo '<div id="ck_editable_areas" class="inline_edit_area">';
     echo '<ul></ul>';
     echo '</div>';
     $scripts[] = array('code' => 'var section_types = ' . json_encode(ob_get_clean()) . ';');
     //selectable classes
     $avail_classes = \gp\admin\Settings\Classes::GetClasses();
     $scripts[] = array('code' => 'var gp_avail_classes = ' . json_encode($avail_classes) . ';');
     $scripts[] = array('object' => 'gp_editing', 'file' => '/include/js/inline_edit/inline_editing.js');
     if (empty($_REQUEST['mode'])) {
         $scripts[] = array('object' => 'gp_editing', 'code' => 'gp_editing.is_extra_mode = false;');
     } else {
         $scripts[] = array('object' => 'gp_editing', 'code' => 'gp_editing.is_extra_mode = true;');
     }
     $scripts[] = array('file' => '/include/js/inline_edit/manage_sections.js');
     \gp\tool\Output\Ajax::SendScripts($scripts);
     die;
 }
Exemplo n.º 3
0
 /**
  * Save UI values for the current user
  *
  */
 public static function SaveGPUI()
 {
     global $gpAdmin;
     self::SetGPUI();
     //send response so an error is not thrown
     echo \gp\tool\Output\Ajax::Callback($_REQUEST['jsoncallback']) . '([]);';
     die;
     //for debugging
     die('debug: ' . pre($_POST) . 'result: ' . pre($gpAdmin));
 }
Exemplo n.º 4
0
 /**
  * Perform various section editing commands
  *
  * @return bool true if $section should be saved
  *
  */
 public static function SectionEdit($cmd, &$section, $section_num, $title, $file_stats)
 {
     global $langmessage;
     switch ($cmd) {
         case 'include_dialog':
             self::IncludeDialog($section);
             return false;
         case 'inlineedit':
             \gp\tool\Output\Ajax::InlineEdit($section);
             die;
         case 'save_inline':
             return self::SectionFromPost($section, $section_num, $title, $file_stats);
     }
     msg($langmessage['OOPS'] . ' (Unknown Command)');
     return false;
 }
Exemplo n.º 5
0
 public static function RunOut()
 {
     global $page;
     $page->RunScript();
     //prepare the admin content
     if (\gp\tool::LoggedIn()) {
         \gp\admin\Tools::AdminHtml();
     }
     //decide how to send the content
     self::Prep();
     switch (\gp\tool::RequestType()) {
         // <a data-cmd="admin_box">
         case 'flush':
             self::Flush();
             break;
             // remote request
             // file browser
         // remote request
         // file browser
         case 'body':
             \gp\tool::CheckTheme();
             self::BodyAsHTML();
             break;
         case 'admin':
             self::AdminHtml();
             break;
             // <a data-cmd="gpajax">
             // <a data-cmd="gpabox">
             // <input data-cmd="gpabox">
         // <a data-cmd="gpajax">
         // <a data-cmd="gpabox">
         // <input data-cmd="gpabox">
         case 'json':
             \gp\tool::CheckTheme();
             \gp\tool\Output\Ajax::Response();
             break;
         case 'content':
             self::Content();
             break;
         default:
             \gp\tool::CheckTheme();
             self::Template();
             break;
     }
     // if logged in, don't send 304 response
     if (\gp\tool::LoggedIn()) {
         //empty edit links if there isn't a layout
         if (!$page->gpLayout) {
             self::$editlinks = '';
         }
         return;
     }
     // attempt to send 304 response
     if ($page->fileModTime > 0) {
         global $wbMessageBuffer;
         $len = strlen(self::$head_content) + strlen(self::$head_js) + ob_get_length();
         if (count($wbMessageBuffer)) {
             $len += strlen(json_encode($wbMessageBuffer));
         }
         \gp\tool::Send304(\gp\tool::GenEtag($page->fileModTime, $len));
     }
 }