Пример #1
0
 static function GetExtra($name = 'Side_Menu', $info = array())
 {
     global $dataDir, $langmessage;
     includeFile('tool/SectionContent.php');
     $name = str_replace(' ', '_', $name);
     $extra_content = self::ExtraContent($name, $file_stats);
     $wrap = gpOutput::ShowEditLink('Admin_Extra');
     if ($wrap) {
         ob_start();
         $edit_link = gpOutput::EditAreaLink($edit_index, 'Admin_Extra', $langmessage['edit'], 'cmd=edit&file=' . $name, array('title' => $name, 'data-cmd' => 'inline_edit_generic'));
         echo '<span class="nodisplay" id="ExtraEditLnks' . $edit_index . '">';
         echo $edit_link;
         echo common::Link('Admin_Extra', $langmessage['theme_content'], '', ' class="nodisplay"');
         echo '</span>';
         gpOutput::$editlinks .= ob_get_clean();
         //echo '<div class="editable_area" id="ExtraEditArea'.$edit_index.'" data-gp-editarea="'.$edit_index.'">'; // class="edit_area" added by javascript
         echo '<div class="editable_area" id="ExtraEditArea' . $edit_index . '">';
         echo section_content::RenderSection($extra_content, 0, '', $file_stats);
         echo '</div>';
     } else {
         echo section_content::RenderSection($extra_content, 0, '', $file_stats);
     }
 }
Пример #2
0
 function GetSection(&$section_num)
 {
     global $langmessage, $GP_NESTED_EDIT;
     if (!isset($this->file_sections[$section_num])) {
         trigger_error('invalid section number');
         return;
     }
     $curr_section_num = $section_num;
     $section_num++;
     $content = '';
     $section_data = $this->file_sections[$curr_section_num];
     $section_data += array('attributes' => array(), 'type' => 'text');
     $section_data['attributes'] += array('class' => '');
     $orig_attrs = json_encode($section_data['attributes']);
     $section_data['attributes']['data-gp-section'] = $curr_section_num;
     $section_types = section_content::GetTypes();
     if (gpOutput::ShowEditLink() && admin_tools::CanEdit($this->gp_index)) {
         if (isset($section_types[$section_data['type']])) {
             $title_attr = $section_types[$section_data['type']]['label'];
         } else {
             $title_attr = sprintf($langmessage['Section %s'], $curr_section_num + 1);
         }
         $attrs = array('title' => $title_attr, 'data-cmd' => 'inline_edit_generic', 'data-arg' => $section_data['type'] . '_inline_edit');
         $link = gpOutput::EditAreaLink($edit_index, $this->title, $langmessage['edit'], 'section=' . $curr_section_num . '&amp;revision=' . $this->fileModTime, $attrs);
         //section control links
         if ($section_data['type'] != 'wrapper_section') {
             ob_start();
             echo '<span class="nodisplay" id="ExtraEditLnks' . $edit_index . '">';
             echo $link;
             echo common::Link($this->title, $langmessage['Manage Sections'] . '...', 'cmd=ManageSections', array('class' => 'manage_sections', 'data-cmd' => 'inline_edit_generic', 'data-arg' => 'manage_sections'));
             echo '</span>';
             gpOutput::$editlinks .= ob_get_clean();
         }
         $section_data['attributes']['id'] = 'ExtraEditArea' . $edit_index;
         $section_data['attributes']['class'] .= ' editable_area';
         // class="edit_area" added by javascript
         //$section_data['attributes']['data-gp-editarea']	= $edit_index;
     }
     if (!isset($section_data['nodeName'])) {
         $content .= "\n" . '<div' . section_content::SectionAttributes($section_data['attributes'], $section_data['type']) . ' data-gp-attrs=\'' . htmlspecialchars($orig_attrs, ENT_QUOTES & ~ENT_COMPAT) . '\'>';
     } else {
         $content .= "\n" . '<' . $section_data['nodeName'] . section_content::SectionAttributes($section_data['attributes'], $section_data['type']) . ' data-gp-attrs=\'' . htmlspecialchars($orig_attrs, ENT_QUOTES & ~ENT_COMPAT) . '\'>';
     }
     if ($section_data['type'] == 'wrapper_section') {
         for ($cc = 0; $cc < $section_data['contains_sections']; $cc++) {
             $content .= $this->GetSection($section_num);
         }
     } else {
         $GP_NESTED_EDIT = true;
         $content .= section_content::RenderSection($section_data, $curr_section_num, $this->title, $this->file_stats);
         $GP_NESTED_EDIT = false;
     }
     if (!isset($section_data['nodeName'])) {
         $content .= '<div class="gpclear"></div>';
         $content .= '</div>';
     } else {
         $content .= '</' . $section_data['nodeName'] . '>';
     }
     return $content;
 }
Пример #3
0
 /**
  * Preview an include section
  *
  */
 function PreviewSection($section, $section_num, $title, $file_stats)
 {
     global $page, $langmessage;
     $page->ajaxReplace = array();
     switch ($section['type']) {
         case 'include':
             $data = array();
             $data['type'] = $section['type'];
             if (!empty($_POST['gadget_include'])) {
                 $data['include_type'] = 'gadget';
                 $data['content'] = $_POST['gadget_include'];
             } else {
                 $data['content'] = $_POST['file_include'];
             }
             $content = section_content::RenderSection($data, $section_num, $title, $file_stats);
             $page->ajaxReplace[] = array('gp_include_content', '', $content);
             return;
     }
     message($langmessage['OOPS'] . '(2)');
 }
Пример #4
0
 public function GetSection(&$section_num)
 {
     global $langmessage;
     if (!isset($this->file_sections[$section_num])) {
         trigger_error('invalid section number');
         return;
     }
     $curr_section_num = $section_num;
     $section_num++;
     $content = '';
     $section_data = $this->file_sections[$curr_section_num];
     //make sure section_data is an array
     $type = gettype($section_data);
     if ($type !== 'array') {
         trigger_error('$section_data is ' . $type . '. Array expected');
         return;
     }
     $section_data += array('attributes' => array(), 'type' => 'text');
     $section_data['attributes'] += array('class' => '');
     $orig_attrs = $section_data['attributes'];
     $section_data['attributes']['data-gp-section'] = $curr_section_num;
     $section_types = section_content::GetTypes();
     if (gpOutput::ShowEditLink() && admin_tools::CanEdit($this->gp_index)) {
         if (isset($section_types[$section_data['type']])) {
             $title_attr = $section_types[$section_data['type']]['label'];
         } else {
             $title_attr = sprintf($langmessage['Section %s'], $curr_section_num + 1);
         }
         $attrs = array('title' => $title_attr, 'data-cmd' => 'inline_edit_generic', 'data-arg' => $section_data['type'] . '_inline_edit');
         $link = gpOutput::EditAreaLink($edit_index, $this->title, $langmessage['edit'], 'section=' . $curr_section_num . '&amp;revision=' . $this->fileModTime, $attrs);
         //section control links
         if ($section_data['type'] != 'wrapper_section') {
             ob_start();
             echo '<span class="nodisplay" id="ExtraEditLnks' . $edit_index . '">';
             echo $link;
             echo common::Link($this->title, $langmessage['Manage Sections'], 'cmd=ManageSections', array('class' => 'manage_sections', 'data-cmd' => 'inline_edit_generic', 'data-arg' => 'manage_sections'));
             echo '<hr/>';
             echo common::Link($this->title, $langmessage['rename/details'], 'cmd=renameform', 'data-cmd="gpajax"');
             echo common::Link($this->title, $langmessage['Revision History'], 'cmd=ViewHistory', array('data-cmd' => 'gpabox'));
             echo '</span>';
             gpOutput::$editlinks .= ob_get_clean();
         }
         $section_data['attributes']['id'] = 'ExtraEditArea' . $edit_index;
         $section_data['attributes']['class'] .= ' editable_area';
         // class="edit_area" added by javascript
     }
     $content .= $this->SectionNode($section_data, $orig_attrs);
     if ($section_data['type'] == 'wrapper_section') {
         for ($cc = 0; $cc < $section_data['contains_sections']; $cc++) {
             $content .= $this->GetSection($section_num);
         }
     } else {
         gpOutput::$nested_edit = true;
         $content .= section_content::RenderSection($section_data, $curr_section_num, $this->title, $this->file_stats);
         gpOutput::$nested_edit = false;
     }
     if (!isset($section_data['nodeName'])) {
         $content .= '<div class="gpclear"></div>';
         $content .= '</div>';
     } else {
         $content .= section_content::EndTag($section_data['nodeName']);
     }
     return $content;
 }