if (!$zoom_type || $zoom_type == 'files') { if ($canvas['files']) { $attachments .= $canvas['files']; } $attachments_count += $canvas['files_count']; } // // links attached to this article // if (!$zoom_type || $zoom_type == 'links') { if ($canvas['links']) { $attachments .= $canvas['links']; } $attachments_count += $canvas['links_count']; } // build the full panel if ($attachments) { $label = i18n::s('Attachments'); if ($attachments_count) { $label .= ' (' . $attachments_count . ')'; } $panels[] = array('attachments', $label, 'attachments_panel', $attachments); } // // assemble all tabs // $text .= Skin::build_tabs($panels); // // trailer information // $text .= $canvas['trailer'];
if (!isset($context['files_url'])) { $context['files_url'] = ''; } $label = i18n::s('FTP prefix'); $input = '<input type="text" name="files_url" size="45" value="' . encode_field($context['files_url']) . '" maxlength="255" />'; $hint = i18n::s('The ftp:// address that is inserted in links used to download files remotely'); $fields[] = array($label, $input, $hint); // put the set of fields in the page $store .= Skin::build_form($fields); $fields = array(); // // assemble all tabs // $all_tabs = array(array('extensions', i18n::s('Extensions'), 'extensions_panel', $extensions), array('store', i18n::s('Storage'), 'store_panel', $store)); // let YACS do the hard job $context['text'] .= Skin::build_tabs($all_tabs); // // bottom commands // $menu = array(); // the submit button $menu[] = Skin::build_submit_button(i18n::s('Submit'), i18n::s('Press [s] to submit data'), 's'); // control panel if (file_exists('../parameters/control.include.php')) { $menu[] = Skin::build_link('control/', i18n::s('Control Panel'), 'span'); } // all skins if (file_exists('../parameters/control.include.php')) { $menu[] = Skin::build_link('files/', i18n::s('Files'), 'span'); } // insert the menu in the page
/** * list articles * * @param resource the SQL result * @return a string to be displayed * * @see layouts/layout.php **/ function layout($result) { global $context; // we return some text $text = ''; // empty list if (!SQL::count($result)) { return $text; } // no hovering label $href_title = ''; // we build an array for the skin::build_tabs() function $panels = array(); // process all items in the list while ($item = SQL::fetch($result)) { // get the main anchor $anchor = Anchors::get($item['anchor']); // get the related overlay, if any $overlay = Overlay::load($item, 'article:' . $item['id']); // panel content $text = ''; // insert anchor prefix if (is_object($anchor)) { $text .= $anchor->get_prefix(); } // the introduction text, if any if (is_object($overlay)) { $text .= Skin::build_block($overlay->get_text('introduction', $item), 'introduction'); } elseif (isset($item['introduction']) && trim($item['introduction'])) { $text .= Skin::build_block($item['introduction'], 'introduction'); } // get text related to the overlay, if any if (is_object($overlay)) { $text .= $overlay->get_text('view', $item); } // filter description, if necessary if (is_object($overlay)) { $description = $overlay->get_text('description', $item); } else { $description = $item['description']; } // the beautified description, which is the actual page body if ($description) { // use adequate label if (is_object($overlay) && ($label = $overlay->get_label('description'))) { $text .= Skin::build_block($label, 'title'); } // beautify the target page $text .= Skin::build_block($description, 'description', '', $item['options']); } // list files only to people able to change the page if (Articles::allow_modification($item, $anchor)) { $embedded = NULL; } else { $embedded = Codes::list_embedded($item['description']); } // build a complete box $box = array('bar' => array(), 'text' => ''); // count the number of files in this article if ($count = Files::count_for_anchor('article:' . $item['id'], FALSE, $embedded)) { if ($count > 20) { $box['bar'] += array('_count' => sprintf(i18n::ns('%d file', '%d files', $count), $count)); } // list files by date (default) or by title (option files_by_title) $offset = ($zoom_index - 1) * FILES_PER_PAGE; if (Articles::has_option('files_by', $anchor, $item) == 'title') { $items = Files::list_by_title_for_anchor('article:' . $item['id'], 0, 300, 'article:' . $item['id'], $embedded); } else { $items = Files::list_by_date_for_anchor('article:' . $item['id'], 0, 300, 'article:' . $item['id'], $embedded); } // actually render the html if (is_array($items)) { $box['text'] .= Skin::build_list($items, 'decorated'); } elseif (is_string($items)) { $box['text'] .= $items; } // the command to post a new file if (Files::allow_creation($item, $anchor, 'article')) { Skin::define_img('FILES_UPLOAD_IMG', 'files/upload.gif'); $box['bar'] += array('files/edit.php?anchor=' . urlencode('article:' . $item['id']) => FILES_UPLOAD_IMG . i18n::s('Add a file')); } } // some files have been attached to this page if ($page == 1 && $count > 1) { // the command to download all files $link = 'files/fetch_all.php?anchor=' . urlencode('article:' . $item['id']); if ($count > 20) { $label = i18n::s('Zip 20 first files'); } else { $label = i18n::s('Zip all files'); } $box['bar'] += array($link => $label); } // there is some box content if ($box['text']) { $text .= Skin::build_content('files', i18n::s('Files'), $box['text'], $box['bar']); } // list of comments $title_label = ''; if (is_object($anchor)) { $title_label = ucfirst($overlay->get_label('list_title', 'comments')); } if (!$title_label) { $title_label = i18n::s('Comments'); } // no layout yet $layout = NULL; // label to create a comment $add_label = ''; if (is_object($overlay)) { $add_label = $overlay->get_label('new_command', 'comments'); } if (!$add_label) { $add_label = i18n::s('Post a comment'); } // get a layout from anchor $layout =& Comments::get_layout($anchor, $item); // provide author information to layout if (is_object($layout) && isset($item['create_id']) && $item['create_id']) { $layout->set_focus('user:'******'create_id']); } // the maximum number of comments per page if (is_object($layout)) { $items_per_page = $layout->items_per_page(); } else { $items_per_page = COMMENTS_PER_PAGE; } // the first comment to list $offset = 0; if (is_object($layout) && method_exists($layout, 'set_offset')) { $layout->set_offset($offset); } // build a complete box $box = array('bar' => array(), 'prefix_bar' => array(), 'text' => ''); // feed the wall if (Comments::allow_creation($item, $anchor)) { $box['text'] .= Comments::get_form('article:' . $item['id']); } // a navigation bar for these comments if ($count = Comments::count_for_anchor('article:' . $item['id'])) { if ($count > 20) { $box['bar'] += array('_count' => sprintf(i18n::ns('%d comment', '%d comments', $count), $count)); } // list comments by date $items = Comments::list_by_date_for_anchor('article:' . $item['id'], $offset, $items_per_page, $layout, TRUE); // actually render the html if (is_array($items)) { $box['text'] .= Skin::build_list($items, 'rows'); } elseif (is_string($items)) { $box['text'] .= $items; } // navigation commands for comments $prefix = Comments::get_url('article:' . $item['id'], 'navigate'); $box['bar'] = array_merge($box['bar'], Skin::navigate(NULL, $prefix, $count, $items_per_page, $zoom_index)); } // ensure that the surfer can change content if (Articles::allow_modification($item, $anchor)) { // view or modify this section $menu = array(); $box['bar'] += array(Articles::get_permalink($item) => i18n::s('View the page')); if (!is_object($overlay) || !($label = $overlay->get_label('edit_command', 'articles'))) { $label = i18n::s('Edit this page'); } $box['bar'] += array(Articles::get_url($item['id'], 'edit') => $label); } // show commands if (count($box['bar'])) { // commands before the box $box['text'] = Skin::build_list($box['prefix_bar'], 'menu_bar') . $box['text']; // append the menu bar at the end $box['text'] .= Skin::build_list($box['bar'], 'menu_bar'); } // build a box if ($box['text']) { // put a title if there are other titles or if more than 2048 chars $title = ''; if (preg_match('/(<h1|<h2|<h3|<table|\\[title|\\[subtitle)/i', $context['text'] . $text) || strlen($context['text'] . $text) > 2048) { $title = $title_label; } // insert a full box $text .= Skin::build_box($title, $box['text'], 'header1', 'comments'); } // assemble the full panel $panels[] = array('att' . $item['id'], ucfirst(Skin::strip($item['title'], 30)), 'atc' . $item['id'], $text); } // there is some box content if (trim($box['text'])) { $text .= $box['text']; } // format tabs $text = Skin::build_tabs($panels); // end of processing SQL::free($result); return $text; }
$context['text'] .= '<input type="hidden" name="overlay_type" value="' . encode_field($overlay->get_type()) . '" />'; } // preserve attributes coming from template duplication if (!isset($item['id'])) { $hidden = array('behaviors', 'extra', 'icon_url', 'index_map', 'locked', 'meta', 'options', 'prefix', 'rank', 'source', 'suffix', 'thumbnail_url', 'trailer'); foreach ($hidden as $name) { if (isset($item[$name])) { $context['text'] .= '<input type="hidden" name="' . $name . '" value="' . $item[$name] . '" />'; } } } } // // assemble all tabs // $context['text'] .= Skin::build_tabs($panels); // // bottom commands // // assistant bottom has been defined in articles/edit.php if (isset($context['page_bottom'])) { $context['text'] .= $context['page_bottom']; } // transmit the id as a hidden field if (isset($item['id']) && $item['id']) { $context['text'] .= '<input type="hidden" name="id" value="' . $item['id'] . '" />'; } // anchor cannot be changed if (is_object($anchor)) { $context['text'] .= '<input type="hidden" name="anchor" value="' . $anchor->get_reference() . '" />'; }
/** * list sections * * @param resource the SQL result * @return a string to be displayed * * @see layouts/layout.php **/ function layout($result) { global $context; // we return some text $text = ''; // empty list if (!SQL::count($result)) { return $text; } // no hovering label $href_title = ''; // we build an array for the skin::build_tabs() function $panels = array(); // process all items in the list while ($item = SQL::fetch($result)) { // get the main anchor $anchor = Anchors::get($item['anchor']); // get the related overlay, if any $overlay = Overlay::load($item, 'section:' . $item['id']); // get the overlay for content of this section, if any $content_overlay = NULL; if (isset($item['content_overlay'])) { $content_overlay = Overlay::bind($item['content_overlay']); } // panel content $text = ''; // insert anchor prefix if (is_object($anchor)) { $text .= $anchor->get_prefix(); } // the introduction text, if any if (is_object($overlay)) { $text .= Skin::build_block($overlay->get_text('introduction', $item), 'introduction'); } elseif (isset($item['introduction']) && trim($item['introduction'])) { $text .= Skin::build_block($item['introduction'], 'introduction'); } // get text related to the overlay, if any if (is_object($overlay)) { $text .= $overlay->get_text('view', $item); } // filter description, if necessary if (is_object($overlay)) { $description = $overlay->get_text('description', $item); } else { $description = $item['description']; } // the beautified description, which is the actual page body if ($description) { // use adequate label if (is_object($overlay) && ($label = $overlay->get_label('description'))) { $text .= Skin::build_block($label, 'title'); } // beautify the target page $text .= Skin::build_block($description, 'description', '', $item['options']); } // delegate rendering to the overlay, where applicable if (is_object($content_overlay) && ($overlaid = $content_overlay->render('articles', 'section:' . $item['id'], 1))) { $text .= $overlaid; // regular rendering } elseif (!isset($item['articles_layout']) || $item['articles_layout'] != 'none') { // select a layout if (!isset($item['articles_layout']) || !$item['articles_layout']) { include_once '../articles/layout_articles.php'; $layout = new Layout_articles(); } else { $layout = Layouts::new_($item['articles_layout'], 'article'); } // avoid links to this page if (is_object($layout) && is_callable(array($layout, 'set_variant'))) { $layout->set_focus('section:' . $item['id']); } // the maximum number of articles per page if (is_object($layout)) { $items_per_page = $layout->items_per_page(); } else { $items_per_page = ARTICLES_PER_PAGE; } // sort and list articles $offset = 0; if (preg_match('/\\barticles_by_([a-z_]+)\\b/i', $item['options'], $matches)) { $order = $matches[1]; } elseif (is_callable(array($layout, 'items_order'))) { $order = $layout->items_order(); } else { $order = 'edition'; } // create a box $box = array('top_bar' => array(), 'text' => '', 'bottom_bar' => array()); // the command to post a new page //if(Articles::allow_creation($item, $anchor)) { if ($anchor->allows('creation', 'article')) { Skin::define_img('ARTICLES_ADD_IMG', 'articles/add.gif'); $url = 'articles/edit.php?anchor=' . urlencode('section:' . $item['id']); if (is_object($content_overlay) && ($label = $content_overlay->get_label('new_command', 'articles'))) { } else { $label = ARTICLES_ADD_IMG . i18n::s('Add a page'); } $box['top_bar'] += array($url => $label); } // list pages under preparation $this_section = new section(); $this_section->load_by_content($item, $anchor); if ($this_section->is_assigned()) { if ($order == 'publication' && ($items =& Articles::list_for_anchor_by('draft', 'section:' . $item['id'], 0, 20, 'compact'))) { if (is_array($items)) { $items = Skin::build_list($items, 'compact'); } $box['top_bar'] += array('_draft' => Skin::build_sliding_box(i18n::s('Draft pages'), $items)); } } // top menu if ($box['top_bar']) { $box['text'] .= Skin::build_list($box['top_bar'], 'menu_bar'); } // get pages $items =& Articles::list_for_anchor_by($order, 'section:' . $item['id'], $offset, $items_per_page, $layout); // items in the middle if (is_array($items) && isset($item['articles_layout']) && $item['articles_layout'] == 'compact') { $box['text'] .= Skin::build_list($items, 'compact'); } elseif (is_array($items)) { $box['text'] .= Skin::build_list($items, 'decorated'); } elseif (is_string($items)) { $box['text'] .= $items; } // no navigation bar with alistapart if (!isset($item['articles_layout']) || $item['articles_layout'] != 'alistapart') { // count the number of articles in this section if ($count = Articles::count_for_anchor('section:' . $item['id'])) { if ($count > 20) { $box['bottom_bar'] += array('_count' => sprintf(i18n::ns('%d page', '%d pages', $count), $count)); } // navigation commands for articles $home = Sections::get_permalink($item); $prefix = Sections::get_url($item['id'], 'navigate', 'articles'); $box['bottom_bar'] += Skin::navigate($home, $prefix, $count, $items_per_page, 1); } } // bottom menu if ($box['bottom_bar']) { $box['text'] .= Skin::build_list($box['bottom_bar'], 'menu_bar'); } // there is some box content if ($box['text']) { $text .= $box['text']; } } // layout sub-sections if (!isset($item['sections_layout']) || $item['sections_layout'] != 'none') { // select a layout if (!isset($item['sections_layout']) || !$item['sections_layout']) { include_once 'layout_sections.php'; $layout = new Layout_sections(); } else { $layout = Layouts::new_($item['sections_layout'], 'section'); } // the maximum number of sections per page if (is_object($layout)) { $items_per_page = $layout->items_per_page(); } else { $items_per_page = SECTIONS_PER_PAGE; } // build a complete box $box = array('top_bar' => array(), 'text' => '', 'bottom_bar' => array()); // the command to add a new section //if(Sections::allow_creation($item, $anchor)) { if ($anchor->allows('creation', 'section')) { Skin::define_img('SECTIONS_ADD_IMG', 'sections/add.gif'); $box['top_bar'] += array('sections/edit.php?anchor=' . urlencode('section:' . $item['id']) => SECTIONS_ADD_IMG . i18n::s('Add a section')); } // top menu if ($box['top_bar']) { $box['text'] .= Skin::build_list($box['top_bar'], 'menu_bar'); } // list items by family then title $offset = 0 * $items_per_page; $items = Sections::list_by_title_for_anchor('section:' . $item['id'], $offset, $items_per_page, $layout, TRUE); // actually render the html for the section if (is_array($items) && is_string($item['sections_layout']) && $item['sections_layout'] == 'compact') { $box['text'] .= Skin::build_list($items, 'compact'); } elseif (is_array($items)) { $box['text'] .= Skin::build_list($items, 'decorated'); } elseif (is_string($items)) { $box['text'] .= $items; } // count the number of subsections if ($count = Sections::count_for_anchor('section:' . $item['id'])) { if ($count > 20) { $box['bottom_bar'] = array('_count' => sprintf(i18n::ns('%d section', '%d sections', $count), $count)); } // navigation commands for sections $home = Sections::get_permalink($item); $prefix = Sections::get_url($item['id'], 'navigate', 'sections'); $box['bottom_bar'] += Skin::navigate($home, $prefix, $count, $items_per_page, 1); } // bottom menu if ($box['bottom_bar']) { $box['text'] .= Skin::build_list($box['bottom_bar'], 'menu_bar'); } // there is some box content if ($box['text']) { $text .= $box['text']; } } // ensure that the surfer can change content if (Sections::allow_modification($item, $anchor)) { // view or modify this section $menu = array(); $menu[] = Skin::build_link(Sections::get_permalink($item), i18n::s('View the sub-section'), 'span'); if (!is_object($overlay) || !($label = $overlay->get_label('edit_command', 'sections'))) { $label = i18n::s('Edit this sub-section'); } $menu[] = Skin::build_link(Sections::get_url($item['id'], 'edit'), $label, 'span'); $text .= Skin::finalize_list($menu, 'menu_bar'); } // assemble the full panel $panels[] = array('stt' . $item['id'], ucfirst(Skin::strip($item['title'], 30)), 'stc' . $item['id'], $text); } // format tabs if ($this->has_variant('as_array')) { $text = $panels; } else { $text = Skin::build_tabs($panels); } // end of processing SQL::free($result); return $text; }