remember($action, $_REQUEST))) { $item = $_REQUEST; $with_form = TRUE; // else display the updated page } else { // cascade changes on access rights if($_REQUEST['active'] != $item['active']) Anchors::cascade('section:'.$item['id'], $_REQUEST['active']); // touch the related anchor if(is_object($anchor)) $anchor->touch('section:update', $item['id'], isset($_REQUEST['silent']) && ($_REQUEST['silent'] == 'Y'), isset($_REQUEST['notify_watchers']) && ($_REQUEST['notify_watchers'] == 'Y'), isset($_REQUEST['notify_followers']) && ($_REQUEST['notify_followers'] == 'Y')); // display the updated page Safe::redirect($context['url_to_home'].$context['url_to_root'].Sections::get_permalink($item)); } // create a new section } elseif(!$_REQUEST['id'] = sections::post($_REQUEST)) { $item = $_REQUEST; $with_form = TRUE; // successful post } else { // allow back-referencing from overlay $_REQUEST['self_reference'] = 'section:'.$_REQUEST['id']; $_REQUEST['self_url'] = $context['url_to_root'].Sections::get_permalink($_REQUEST); // post an overlay, with the new section id --don't stop on error if(is_object($overlay)) $overlay->remember('insert', $_REQUEST); // touch the related anchor if(is_object($anchor)) $anchor->touch('section:create', $_REQUEST['id'], isset($_REQUEST['silent']) && ($_REQUEST['silent'] == 'Y'), isset($_REQUEST['notify_watchers']) && ($_REQUEST['notify_watchers'] == 'Y'), isset($_REQUEST['notify_followers']) && ($_REQUEST['notify_followers'] == 'Y')); // increment the post counter of the surfer Users::increment_posts(Surfer::get_id()); // get the new item $section =& Anchors::get('section:'.$_REQUEST['id'], TRUE); // reward the poster for new posts $context['page_title'] = i18n::s('Thank you for your contribution'); $context['text'] .= '

'.i18n::s('Please review the new page carefully and fix possible errors rapidly.').'

'; // list persons that have been notified $context['text'] .= Mailer::build_recipients(i18n::s('Persons that have been notified')); // follow-up commands $follow_up = i18n::s('What do you want to do now?'); $menu = array(); $menu = array_merge($menu, array($section->get_url() => i18n::s('View the section'))); if(Surfer::may_upload()) $menu = array_merge($menu, array('images/edit.php?anchor='.urlencode('section:'.$_REQUEST['id']) => i18n::s('Add an image'))); if(preg_match('/\bwith_files\b/i', $section->item['options']) && Surfer::may_upload()) $menu = array_merge($menu, array('files/edit.php?anchor='.urlencode('section:'.$_REQUEST['id']) => i18n::s('Upload a file'))); if(preg_match('/\bwith_links\b/i', $section->item['options'])) $menu = array_merge($menu, array('links/edit.php?anchor='.urlencode('section:'.$_REQUEST['id']) => i18n::s('Add a link'))); if(is_object($anchor)) $menu = array_merge($menu, array('sections/edit.php?anchor='.urlencode($anchor->get_reference()) => i18n::s('Add another section'))); $follow_up .= Skin::build_list($menu, 'menu_bar'); $context['text'] .= Skin::build_block($follow_up, 'bottom'); // log the creation of a new section $label = sprintf(i18n::c('New section: %s'), strip_tags($section->get_title())); if(is_object($anchor)) $description = sprintf(i18n::s('Sent by %s in %s'), Surfer::get_name(), $anchor->get_title()); else $description = sprintf(i18n::s('Sent by %s'), Surfer::get_name()); $description .= "\n\n".$section->get_teaser('basic') ."\n\n".$context['url_to_home'].$context['url_to_root'].$section->get_url(); Logger::notify('sections/edit.php', $label, $description); } // display the form on GET } else $with_form = TRUE; // display the form if($with_form) { // the form to edit a section $context['text'] .= '
'; $fields = array(); // // panels // $panels = array(); // // index tab - fields that contribute directly to the section index page // $text = ''; // the title if(!is_object($overlay) || !($label = $overlay->get_label('title', isset($item['id'])?'edit':'new'))) $label = i18n::s('Title').' *'; // copy this as compact title on initial edit if((!isset($item['index_title']) || !$item['index_title']) && isset($item['title'])) $item['index_title'] = $item['title']; $input = '' .''; if(!is_object($overlay) || !($hint = $overlay->get_label('title_hint', isset($item['id'])?'edit':'new'))) $hint = i18n::s('Please provide a meaningful title.'); $fields[] = array($label, $input, $hint); // the introduction if(!is_object($overlay) || !($label = $overlay->get_label('introduction', isset($item['id'])?'edit':'new'))) $label = i18n::s('Introduction'); $input = ''; if(!is_object($overlay) || !($hint = $overlay->get_label('introduction_hint', isset($item['id'])?'edit':'new'))) $hint = i18n::s('Appears at the site map, near section title'); $fields[] = array($label, $input, $hint); // include overlay fields, if any if(is_object($overlay)) $fields = array_merge($fields, $overlay->get_fields($item)); // the description label if(!is_object($overlay) || !($label = $overlay->get_label('description', isset($item['id'])?'edit':'new'))) $label = i18n::s('Description'); // use the editor if possible $input = Surfer::get_editor('description', isset($item['description'])?$item['description']:''); if(!is_object($overlay) || !($hint = $overlay->get_label('description_hint', isset($item['id'])?'edit':'new'))) $hint = ''; $fields[] = array($label, $input, $hint); // tags $label = i18n::s('Tags'); $input = '
'; $hint = i18n::s('A comma-separated list of keywords'); $fields[] = array($label, $input, $hint); // append regular fields $text .= Skin::build_form($fields); $fields = array(); // settings for attached pages // // layout for related articles $label = i18n::s('Layout'); $input = ''; $custom_layout = ''; if(!isset($item['articles_layout'])) $item['articles_layout'] = 'decorated'; elseif(!preg_match('/(accordion|alistapart|carrousel|compact|daily|decorated|digg|hardboiled|jive|map|newspaper|none|simile|slashdot|table|tagged|titles|yabb)/', $item['articles_layout'])) { $custom_layout = $item['articles_layout']; $item['articles_layout'] = 'custom'; } $input .= ''); $input .= BR.'' .JS_PREFIX .'function append_to_content_options(keyword) {'."\n" .' var target = $("content_options");'."\n" .' target.value = target.value + " " + keyword;'."\n" .'}'."\n" .JS_SUFFIX."\n"; $keywords = array(); $keywords[] = 'auto_publish - '.i18n::s('Pages are not reviewed prior publication'); $keywords[] = 'anonymous_edit - '.i18n::s('Allow anonymous surfers to change content'); $keywords[] = 'members_edit - '.i18n::s('Allow members to change content'); $keywords[] = 'comments_as_wall - '.i18n::s('Allow easy interactions between people'); $keywords[] = 'no_comments - '.i18n::s('Disallow post of new comments'); $keywords[] = 'files_by_title - '.i18n::s('Sort files by title (and not by date)'); $keywords[] = 'no_files - '.i18n::s('Prevent the upload of new files'); $keywords[] = 'links_by_title - '.i18n::s('Sort links by title (and not by date)'); $keywords[] = 'no_links - '.i18n::s('Disallow post of new links'); $keywords[] = 'with_neighbours - '.i18n::s('Add links to previous and next pages in the same section'); $keywords[] = 'view_as_chat - '.i18n::s('Real-time collaboration'); $keywords[] = 'view_as_tabs - '.i18n::s('Tabbed panels'); $keywords[] = 'view_as_wiki - '.i18n::s('Discussion is separate from content'); $keywords[] = 'view_as_foo_bar - '.sprintf(i18n::s('Branch out to %s'), 'articles/view_as_foo_bar.php'); $keywords[] = 'edit_as_simple - '.sprintf(i18n::s('Branch out to %s'), 'articles/edit_as_simple.php'); if(isset($context['content_without_details']) && ($context['content_without_details'] == 'Y')) $keywords[] = 'with_details - '.i18n::s('Show page details to all surfers'); $keywords[] = 'without_rating - '.i18n::s('Surfers are not allowed to rate pages in this section'); $keywords[] = 'rate_as_digg - '.i18n::s('Ask explicitly for more votes'); $keywords[] = 'with_export_tools - '.i18n::s('Add conversion tools to PDF, MS-Word'); $keywords[] = 'with_prefix_profile - '.i18n::s('Introduce the poster before main text'); $keywords[] = 'with_suffix_profile - '.i18n::s('Append some poster details at the bottom of the page'); $keywords[] = 'with_extra_profile - '.i18n::s('Append some poster details aside the page (adequate to most weblogs)'); $hint = i18n::s('You may combine several keywords:').Skin::finalize_list($keywords, 'compact'); $fields[] = array($label, $input, $hint); // content overlay if(Surfer::is_associate()) { $label = i18n::s('Overlay'); $input = ''; $hint = sprintf(i18n::s('Script used to %s in this section'), Skin::build_link('overlays/', i18n::s('overlay articles'), 'help')); $fields[] = array($label, $input, $hint); } // content template if(Surfer::is_associate()) { $label = i18n::s('Templates'); $input = ''; $hint = sprintf(i18n::s('One or several %s. This setting overrides the overlay setting.'), Skin::build_link(Sections::get_url('templates'), i18n::s('templates'), 'help')); $fields[] = array($label, $input, $hint); } // the prefix $label = i18n::s('Header'); $input = ''; $hint = i18n::s('To be inserted at the top of related pages.'); $fields[] = array($label, $input, $hint); // the suffix $label = i18n::s('Footer'); $input = ''; $hint = i18n::s('To be inserted at the bottom of related pages.'); $fields[] = array($label, $input, $hint); // append fields $text .= Skin::build_box(i18n::s('Pages'), Skin::build_form($fields), 'folded'); $fields = array(); // settings for sub-sections // // layout for sub-sections - default is 'decorated' $label = i18n::s('Layout'); if(!isset($item['sections_count']) || ($item['sections_count'] < 1)) $item['sections_count'] = SECTIONS_PER_PAGE; $input = sprintf(i18n::s('List up to %s sub-sections with the following layout:'), '').BR; $custom_layout = ''; if(!isset($item['sections_layout'])) $item['sections_layout'] = 'none'; elseif(!preg_match('/(accordion|carrousel|compact|decorated|folded|freemind|inline|jive|map|slashdot|titles|yabb|none)/', $item['sections_layout'])) { $custom_layout = $item['sections_layout']; $item['sections_layout'] = 'custom'; } $input .= '') .BR.''; $hint = sprintf(i18n::s('Script used to %s in this section'), Skin::build_link('overlays/', i18n::s('overlay sub-sections'), 'help')); $fields[] = array($label, $input, $hint); } // append fields $text .= Skin::build_box(i18n::s('Sub-sections'), Skin::build_form($fields), 'folded'); $fields = array(); // rendering options // trailer information $label = i18n::s('Trailer'); $input = Surfer::get_editor('trailer', isset($item['trailer'])?$item['trailer']:''); $hint = i18n::s('Text to be appended at the bottom of the page, after all other elements attached to this page.'); $fields[] = array($label, $input, $hint); // the icon url may be set after the page has been created if(isset($item['id'])) { $label = i18n::s('Image'); $input = ''; $hint = ''; // show the current icon if(isset($item['icon_url']) && $item['icon_url']) { $input .= ''.BR; $command = i18n::s('Change'); } elseif(Surfer::may_upload()) { $hint .= i18n::s('Image to be displayed in the panel aside the page.'); $command = i18n::s('Add an image'); } $value = ''; if(isset($item['icon_url']) && $item['icon_url']) $value = $item['icon_url']; $input .= ''; if(Surfer::may_upload()) $input .= ' '.Skin::build_link('images/edit.php?anchor='.urlencode('section:'.$item['id']).'&action=icon', $command, 'button').''; $fields[] = array($label, $input, $hint); } // extra information $label = i18n::s('Extra'); $input = Surfer::get_editor('extra', isset($item['extra'])?$item['extra']:''); $hint = i18n::s('Text to be inserted in the panel aside the page. Use [box.extra=title]content[/box] or plain HTML.'); $fields[] = array($label, $input, $hint); // news can be either a static or an animated list $label = i18n::s('News'); if(!isset($item['index_news_count']) || ($item['index_news_count'] < 1) || ($item['index_news_count'] > 7)) $item['index_news_count'] = 5; $input = ''); $input .= BR.''; // resources attached to this anchor else { // images $box = ''; if(Images::allow_creation($anchor, $item, 'section')) { $menu = array( 'images/edit.php?anchor='.urlencode('section:'.$item['id']) => i18n::s('Add an image') ); $box .= Skin::build_list($menu, 'menu_bar'); } if($items = Images::list_by_date_for_anchor('section:'.$item['id'])) $box .= Skin::build_list($items, 'decorated'); if($box) $text .= Skin::build_box(i18n::s('Images'), $box, 'folded'); // files $box = ''; if(Files::allow_creation($anchor, $item, 'section')) { $menu = array( 'files/edit.php?anchor='.urlencode('section:'.$item['id']) => i18n::s('Add a file') ); $box .= Skin::build_list($menu, 'menu_bar'); } if($items = Files::list_embeddable_for_anchor('section:'.$item['id'], 0, 50)) $box .= Skin::build_list($items, 'decorated'); if($box) $text .= Skin::build_box(i18n::s('Files'), $box, 'folded'); // locations $box = ''; if(Locations::allow_creation($anchor, $item, 'section')) { $menu = array( 'locations/edit.php?anchor='.urlencode('section:'.$item['id']) => i18n::s('Add a location') ); $box .= Skin::build_list($menu, 'menu_bar'); } if($items = Locations::list_by_date_for_anchor('section:'.$item['id'], 0, 50, 'section:'.$item['id'])) $box .= Skin::build_list($items, 'decorated'); if($box) $text .= Skin::build_box(i18n::s('Locations'), $box, 'folded'); // tables $box = ''; if(Tables::allow_creation($anchor, $item, 'section')) { $menu = array( 'tables/edit.php?anchor='.urlencode('section:'.$item['id']) => i18n::s('Add a table') ); $box .= Skin::build_list($menu, 'menu_bar'); } if($items = Tables::list_by_date_for_anchor('section:'.$item['id'], 0, 50, 'section:'.$item['id'])) $box .= Skin::build_list($items, 'decorated'); if($box) $text .= Skin::build_box(i18n::s('Tables'), $box, 'folded'); } // display in a separate panel if($text) $panels[] = array('resources', i18n::s('Resources'), 'resources_panel', $text); // // options tab // $text = ''; // provide information to section owner, and to editors of parent section if(Sections::is_owned($item, $anchor) || Surfer::is_associate()) { // owner if(isset($item['owner_id'])) { $label = i18n::s('Owner'); if($owner = Users::get($item['owner_id'])) $input = Users::get_link($owner['full_name'], $owner['email'], $owner['id']); else $input = i18n::s('No owner has been found.'); // only real owner can delegate to another person if(Sections::is_owned($item, $anchor, TRUE) || Surfer::is_associate()) $input .= ' '.Skin::build_link(Sections::get_url($item['id'], 'own'), i18n::s('Change'), 'button').''; $fields[] = array($label, $input); } // editors $label = i18n::s('Editors'); if(isset($item['id']) && ($items =& Members::list_editors_for_member('section:'.$item['id'], 0, USERS_LIST_SIZE, 'comma'))) $input =& Skin::build_list($items, 'comma'); else $input = i18n::s('No editor has been assigned to this section.'); if(isset($item['id'])) { // allow to involve more persons $input .= ' '.Skin::build_link(Sections::get_url($item['id'], 'invite'), i18n::s('Invite participants'), 'button').''; // only real owner can manage editors if(Sections::is_owned($item, $anchor, TRUE) || Surfer::is_associate()) $input .= ' '.Skin::build_link(Users::get_url('section:'.$item['id'], 'select'), i18n::s('Manage editors'), 'button').''; } $fields[] = array($label, $input); // readers $label = i18n::s('Readers'); if(isset($item['id']) && ($items =& Members::list_readers_by_name_for_member('section:'.$item['id'], 0, 30, 'comma'))) $input =& Skin::build_list($items, 'comma'); else $input = i18n::s('No reader has been assigned to this section.'); $fields[] = array($label, $input); } // the active flag: Yes/public, Restricted/logged, No/associates --we don't care about inheritance, to enable security changes afterwards $label = i18n::s('Access'); // maybe a public page $input = 'is_hidden()) $hint = i18n::s('Parent is private, and this will be re-enforced anyway'); elseif(is_object($anchor) && !$anchor->is_public()) $hint = i18n::s('Parent is not public, and this will be re-enforced anyway'); else $hint = i18n::s('Who is allowed to access?'); // expand the form $fields[] = array($label, $input, $hint); // locked: Yes / No $label = i18n::s('Locker'); $input = ''); $input .= BR.''; $input = i18n::s('Content of this section should be:').BR; $input .= ''; // layout options related to the site map } else { // associates may decide if the top-level section will be hidden on the site map or not if(Surfer::is_associate()) { // define how this section appear at the site map $label= ''; $input = i18n::s('This section should be:').BR .''); $input .= BR.''; // preserve previous settings } else { if(isset($item['index_map'])) $text .= ''; if(isset($item['rank'])) $text .= ''; } } // 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 if(isset($item['thumbnail_url']) && $item['thumbnail_url']) { $input .= ''.BR; $command = i18n::s('Change'); } elseif(Surfer::may_upload()) { $hint .= i18n::s('Upload a small image to illustrate this page when it is listed into parent page.'); $command = i18n::s('Add an image'); } $input .= ''; if(Surfer::may_upload()) $input .= ' '.Skin::build_link('images/edit.php?anchor='.urlencode('section:'.$item['id']).'&action=thumbnail', $command, 'button').''; $fields[] = array($label, $input, $hint); } // the activation date $label = i18n::s('Activation date'); // adjust date from UTC time zone to surfer time zone $value = ''; if(isset($item['activation_date']) && ($item['activation_date'] > NULL_DATE)) $value = Surfer::from_GMT($item['activation_date']); $input = Skin::build_input('activation_date', $value, 'date_time'); $hint = i18n::s('Publish content in the future - automatically'); $fields[] = array($label, $input, $hint); // the expiry date $label = i18n::s('Expiry date'); // adjust date from UTC time zone to surfer time zone $value = ''; if(isset($item['expiry_date']) && ($item['expiry_date'] > NULL_DATE)) $value = Surfer::from_GMT($item['expiry_date']); $input = Skin::build_input('expiry_date', $value, 'date_time'); $hint = i18n::s('Remove content on dead-line - automatically'); $fields[] = array($label, $input, $hint); // provide my id $me = isset($item['id']) ? $item['id'] : NULL; // reference to parent section $ref = is_object($anchor) ? $anchor->get_reference(): NULL; // associates can anchor the section anywhere if(Surfer::is_associate()) { $label = i18n::s('Section'); $input =& Skin::build_box(i18n::s('Select parent container'), Sections::get_radio_buttons($ref, $me), 'folded'); $fields[] = array($label, $input); // parent section is defined and surfer is an editor of it }elseif(is_object($anchor) && ($anchor->is_assigned())) { $label = i18n::s('Section'); $input =& Skin::build_box(i18n::s('Select parent container'), Sections::get_radio_buttons($ref, $me), 'folded'); $fields[] = array($label, $input); // preserve the existing anchor } else $text .= ''; // append fields $parent .= Skin::build_form($fields); $fields = array(); // append fields if(is_object($anchor)) $label = sprintf(i18n::s('Contribution to "%s"'), $anchor->get_title()); else $label = i18n::s('Appearance at the site map'); $text .= Skin::build_box($label, $parent, 'folded'); // contribution to the front page // if(Surfer::is_associate()) { // options for recent pages of this section $input = i18n::s('Content of this section should be:').BR; $input .= ''; $hint = sprintf(i18n::s('To designate a section by its name in the %s'), Skin::build_link('go.php', i18n::s('page selector'), 'help')); $fields[] = array($label, $input, $hint); // the family $label = i18n::s('Family'); $input = ''; $hint = i18n::s('Comes before the title; Used to categorize sections in forums'); $fields[] = array($label, $input, $hint); // compact title $label = i18n::s('Compact title'); $input = ''; $hint = i18n::s('Alternate title used in lists and in the contextual menu'); $fields[] = array($label, $input, $hint); // rendering options $label = i18n::s('Rendering'); $input = '' .JS_PREFIX .'function append_to_options(keyword) {'."\n" .' var target = $("options");'."\n" .' target.value = target.value + " " + keyword;'."\n" .'}'."\n" .JS_SUFFIX."\n"; $keywords = array(); $keywords[] = 'articles_by_publication - '.i18n::s('Sort pages by publication date'); $keywords[] = 'articles_by_rating - '.i18n::s('Sort pages by rating'); $keywords[] = 'articles_by_title - '.i18n::s('Sort pages by title'); $keywords[] = 'articles_by_reverse_title - '.i18n::s('Sort pages by reverse order of titles'); $keywords[] = 'articles_by_reverse_rank - '.i18n::s('Sort pages by reverse rank'); $keywords[] = 'with_deep_news - '.i18n::s('List recent pages from sub-sections'); $keywords[] = 'with_files - '.i18n::s('Files can be added to the index page'); $keywords[] = 'files_by_title - '.i18n::s('Sort files by title (and not by date)'); $keywords[] = 'with_links - '.i18n::s('Links can be added to the index page'); $keywords[] = 'links_by_title - '.i18n::s('Sort links by title (and not by date)'); $keywords[] = 'with_extra_profile - '.i18n::s('Display profile of section owner'); $keywords[] = 'with_comments - '.i18n::s('The index page itself is a thread of discussion'); $local['label_fr'] = "les membres peuvent ajouter une section"; $local['label_en'] = "Members can add a section"; $keywords[] = 'with_sections - '.i18n::l($local, 'label'); $keywords[] = 'comments_as_wall - '.i18n::s('Allow easy interactions between people'); $keywords[] = 'view_as_tabs - '.i18n::s('Tabbed panels'); $keywords[] = 'view_as_foo_bar - '.sprintf(i18n::s('Branch out to %s'), 'sections/view_as_foo_bar.php'); $keywords[] = 'edit_as_foo_bar - '.sprintf(i18n::s('Branch out to %s'), 'sections/edit_as_foo_bar.php'); $keywords[] = 'skin_foo_bar - '.i18n::s('Apply a specific theme (in skins/foo_bar)'); $keywords[] = 'variant_foo_bar - '.i18n::s('To load template_foo_bar.php instead of the regular template'); $keywords[] = 'no_contextual_menu - '.i18n::s('No information about surrounding sections'); $keywords[] = 'anonymous_edit - '.i18n::s('Allow anonymous surfers to edit content'); $keywords[] = 'members_edit - '.i18n::s('Allow members to edit content'); $hint = i18n::s('You may combine several keywords:').Skin::finalize_list($keywords, 'compact'); $fields[] = array($label, $input, $hint); // language of this page $label = i18n::s('Language'); $input = i18n::get_languages_select(isset($item['language'])?$item['language']:''); $hint = i18n::s('Select the language used for this page'); $fields[] = array($label, $input, $hint); // meta information $label = i18n::s('Meta information'); $input = ''; $hint = i18n::s('Type here any XHTML tags to be put in page header.'); $fields[] = array($label, $input, $hint); // behaviors if(Surfer::is_associate()) { $label = i18n::s('Behaviors'); $input = ''; $hint = sprintf(i18n::s('One %s per line'), Skin::build_link('behaviors/', i18n::s('behavior'), 'help')); $fields[] = array($label, $input, $hint); } // associates can change the overlay --complex interface if(Surfer::is_associate() && Surfer::has_all()) { // current type $overlay_type = ''; if(is_object($overlay)) $overlay_type = $overlay->get_type(); // list overlays available on this system $label = i18n::s('Change the overlay'); $input = ''; $fields[] = array($label, $input, $hint); // remember the overlay type } elseif(is_object($overlay)) $text .= ''; // add a folded box if(count($fields)) { $text .= Skin::build_box(i18n::s('More options'), Skin::build_form($fields), 'folded'); $fields = array(); } // display in a separate panel if($text) $panels[] = array('options', i18n::s('Options'), 'options_panel', $text); // // assemble all tabs // $context['text'] .= Skin::build_tabs($panels); // // bottom commands // $menu = array(); // the submit button $menu[] = Skin::build_submit_button(i18n::s('Submit'), i18n::s('Press [s] to submit data'), 's'); // cancel button if(isset($item['id'])) $menu[] = Skin::build_link(Sections::get_permalink($item), i18n::s('Cancel'), 'span'); // insert the menu in the page $context['text'] .= Skin::finalize_list($menu, 'assistant_bar'); // optional checkboxes $context['text'] .= '

'; // notify watchers if(!isset($item['id'])) $context['text'] .= ' '.i18n::s('Notify watchers.').BR; // notify people following me if(!isset($item['id']) && Surfer::get_id() && is_object($anchor) && !$anchor->is_hidden()) $context['text'] .= ' '.i18n::s('Notify my followers.').BR; // do not stamp edition date -- complex command if(isset($item['id']) && Surfer::has_all()) $context['text'] .= ' '.i18n::s('Do not change modification date.').BR; // validate page content $context['text'] .= ' '.i18n::s('Ensure this post is valid XHTML.').'

'; // transmit the id as a hidden field if(isset($item['id']) && $item['id']) $context['text'] .= ''; // end of the form $context['text'] .= '
'; // append the script used for data checking on the browser $context['page_footer'] .= JS_PREFIX .'// check that main fields are not empty'."\n" .'func'.'tion validateDocumentPost(container) {'."\n" ."\n" .' // title is mandatory'."\n" .' if(!container.index_title.value) {'."\n" .' alert("'.i18n::s('Please provide a meaningful title.').'");'."\n" .' Yacs.stopWorking();'."\n" .' return false;'."\n" .' }'."\n" ."\n" .' // successful check'."\n" .'// return true;'."\n" .'}'."\n" ."\n" .'// update title'."\n" .'func'.'tion updateTitle() {'."\n" ."\n" .' if(!$("title").value) {'."\n" .' $("title").value = $("index_title").value;'."\n" .' }'."\n" .' if($("shadow_title").value == $("title").value) {'."\n" .' $("title").value = $("index_title").value;'."\n" .' }'."\n" .' $("shadow_title").value = $("index_title").value;'."\n" .'}'."\n" ."\n" .'// observe changes in form'."\n" .'Event.observe("index_title", "change", updateTitle);'."\n" ."\n" .'// disable editor selection on change'."\n" .'func'.'tion detectChanges() {'."\n" ."\n" .' var nodes = $$("form#main_form input");'."\n" .' for(var index = 0; index < nodes.length; index++) {'."\n" .' var node = nodes[index];'."\n" .' Event.observe(node, "change", function() { $("preferred_editor").disabled = true; });'."\n" .' }'."\n" ."\n" .' nodes = $$("form#main_form textarea");'."\n" .' for(var index = 0; index < nodes.length; index++) {'."\n" .' var node = nodes[index];'."\n" .' Event.observe(node, "change", function() { $("preferred_editor").disabled = true; });'."\n" .' }'."\n" ."\n" .' nodes = $$("form#main_form select");'."\n" .' for(var index = 0; index < nodes.length; index++) {'."\n" .' var node = nodes[index];'."\n" .' Event.observe(node, "change", function() { $("preferred_editor").disabled = true; });'."\n" .' }'."\n" .'}'."\n" ."\n" .'// observe changes in form'."\n" .'Event.observe(window, "load", detectChanges);'."\n" ."\n" .'// set the focus on first form field'."\n" .'$("index_title").focus();'."\n" ."\n" .'// enable tags autocompletion'."\n" .'Event.observe(window, "load", function() { new Ajax.Autocompleter("tags", "tags_choices", "'.$context['url_to_root'].'categories/complete.php", { paramName: "q", minChars: 1, frequency: 0.4, tokens: "," }); });'."\n" .JS_SUFFIX."\n"; // content of the help box $help = ''; // splash message for new pages if(!isset($item['id']) && !count($context['error'])) $help .= '

'.i18n::s('Please describe the new section and hit the submit button. You will then be able to post images, files and links on subsequent forms.').'

'; // html and codes $help .= '

'.sprintf(i18n::s('%s and %s are available to enhance text rendering.'), Skin::build_link('codes/', i18n::s('YACS codes'), 'help'), Skin::build_link('smileys/', i18n::s('smileys'), 'help')).'

'; // locate mandatory fields $help .= '

'.i18n::s('Mandatory fields are marked with a *').'

'; // change to another editor $help .= '

'; // drive associates to the Content Assistant if(Surfer::is_associate()) $help .= '

'.sprintf(i18n::s('Use the %s to populate this server.'), Skin::build_link('help/populate.php', i18n::s('Content Assistant'), 'shortcut')).'

'."\n"; // in a side box $context['components']['boxes'] = Skin::build_box(i18n::s('Help'), $help, 'boxes', 'help'); } // render the skin render_skin(); ?>