$hint = i18n::s('Remove content on dead-line - automatically'); $fields[] = array($label, $input, $hint); // the parent category if (Surfer::is_associate() && (!isset($item['nick_name']) || !preg_match('/^(week|month)/', $item['nick_name']))) { $label = i18n::s('Parent category'); $to_avoid = NULL; if (isset($item['id'])) { $to_avoid = 'category:' . $item['id']; } $to_select = NULL; if (isset($item['anchor'])) { $to_select = $item['anchor']; } elseif (isset($_REQUEST['anchor'])) { $to_select = $_REQUEST['anchor']; } $input = '<select name="anchor">' . Categories::get_options($to_avoid, $to_select) . '</select>'; $hint = i18n::s('Please carefully select a parent category.'); $fields[] = array($label, $input, $hint); } elseif (is_object($anchor)) { $context['text'] .= '<input type="hidden" name="anchor" value="' . $anchor->get_reference() . '" />'; } // the thumbnail url may be set after the page has been created if (isset($item['id'])) { $label = i18n::s('Thumbnail'); $input = ''; $hint = ''; // show the current thumbnail $input = ''; if (isset($item['thumbnail_url']) && $item['thumbnail_url']) { $input .= '<img src="' . $item['thumbnail_url'] . '" alt="" />' . BR; $command = i18n::s('Change');
Safe::header('Status: 401 Unauthorized', TRUE, 401); Logger::error(i18n::s('You are not allowed to perform this operation.')); // build a form to associates some categories to this item } else { // actual update if (isset($_REQUEST['anchor']) && isset($_REQUEST['member'])) { // on error display the form again if ($error = Members::toggle($_REQUEST['anchor'], $_REQUEST['member'], isset($_REQUEST['father']) ? $_REQUEST['father'] : '')) { Logger::error($error); } } // the current list of linked categories $categories =& Members::list_categories_by_title_for_member($member, 0, CATEGORIES_LIST_SIZE, 'raw'); // the form to link additional categories if (!is_array($categories) || count($categories) < CATEGORIES_LIST_SIZE) { $context['text'] .= '<form method="post" action="' . $context['script_url'] . '"><div style="margin-bottom: 2em;">' . i18n::s('Select a category') . ' <select name="anchor">' . Categories::get_options($categories) . '</select>' . ' ' . Skin::build_submit_button(i18n::s('Categorize')) . '<input type="hidden" name="member" value="' . encode_field($member) . '">' . '</div></form>' . "\n"; } // the current list of linked categories if (count($categories)) { // display attached categories with unlink buttons $context['text'] .= '<p>' . i18n::s('All categories that have been associated to this page:') . '</p>'; // browse the list foreach ($categories as $category_id => $attributes) { // make an url $url = Categories::get_permalink($attributes); // gather information on this category $prefix = $suffix = $type = $icon = ''; $label = Skin::strip($attributes['title']); // add background color to distinguish this category against others if (isset($attributes['background_color']) && $attributes['background_color']) { $label = '<span style="background-color: ' . $attributes['background_color'] . '; padding: 0 3px 0 3px;">' . $label . '</span>';
$menu[] = Skin::build_submit_button(i18n::s('Categorize')); $menu[] = Skin::build_link(Sections::get_url($item['id'], 'manage'), 'Cancel', 'span'); $context['text'] .= Skin::finalize_list($menu, 'assistant_bar'); $context['text'] .= '</form>'; // nothing to do } else { Logger::error(i18n::s('No page has been selected.')); } // associate selected pages } elseif ($action == 'associate_sections') { // sections if (isset($_REQUEST['selected_sections'])) { // actually a form $context['text'] .= '<form method="post" action="' . $context['script_url'] . '" id="main_form"><p>' . "\n" . '<input type="hidden" name="action" value="associate_confirmed" />' . "\n" . '<input type="hidden" name="id" value="' . $item['id'] . '" />' . "\n"; // target section $context['text'] .= '<p>' . i18n::s('Associate pages below to') . BR . '<select name=associate_to>' . Categories::get_options() . '</select></p>'; // selected pages $context['text'] .= $selected_sections; // follow-up commands $menu = array(); $menu[] = Skin::build_submit_button(i18n::s('Categorize')); $menu[] = Skin::build_link(Sections::get_url($item['id'], 'manage'), 'Cancel', 'span'); $context['text'] .= Skin::finalize_list($menu, 'assistant_bar'); $context['text'] .= '</form>'; // nothing to do } else { Logger::error(i18n::s('No section has been selected.')); } // actual association } elseif ($action == 'associate_confirmed') { // nothing to do