示例#1
0
if (Sections::allow_creation($item, $anchor)) {
    Skin::define_img('SECTIONS_ADD_IMG', 'sections/add.gif');
    $context['page_tools'][] = Skin::build_link('sections/edit.php?anchor=' . urlencode('section:' . $item['id']), SECTIONS_ADD_IMG . i18n::s('Add a section'), 'basic', i18n::s('Add a section'));
}
// comment this page if anchor does not prevent it
if (Comments::allow_creation($item, $anchor, 'section')) {
    Skin::define_img('COMMENTS_ADD_IMG', 'comments/add.gif');
    $context['page_tools'][] = Skin::build_link(Comments::get_url('section:' . $item['id'], 'comment'), COMMENTS_ADD_IMG . i18n::s('Post a comment'), 'basic', i18n::s('Express yourself, and say what you think.'));
}
// add a file, if upload is allowed
if (Files::allow_creation($item, $anchor, 'section')) {
    Skin::define_img('FILES_UPLOAD_IMG', 'files/upload.gif');
    $context['page_tools'][] = Skin::build_link('files/edit.php?anchor=' . urlencode('section:' . $item['id']), FILES_UPLOAD_IMG . i18n::s('Add a file'), 'basic', i18n::s('Attach related files.'));
}
// add a link
if (Links::allow_creation($item, $anchor, 'section')) {
    Skin::define_img('LINKS_ADD_IMG', 'links/add.gif');
    $context['page_tools'][] = Skin::build_link('links/edit.php?anchor=' . urlencode('section:' . $item['id']), LINKS_ADD_IMG . i18n::s('Add a link'), 'basic', i18n::s('Contribute to the web and link to relevant pages.'));
}
// post an image, if upload is allowed
if (Images::allow_creation($item, $anchor, 'section')) {
    Skin::define_img('IMAGES_ADD_IMG', 'images/add.gif');
    $context['page_tools'][] = Skin::build_link('images/edit.php?anchor=' . urlencode('section:' . $item['id']), IMAGES_ADD_IMG . i18n::s('Add an image'), 'basic', i18n::s('You can upload a camera shot, a drawing, or another image file.'));
}
// ensure that the surfer can change content
if (Sections::allow_modification($item, $anchor)) {
    // modify this page
    Skin::define_img('SECTIONS_EDIT_IMG', 'sections/edit.gif');
    if (!is_object($overlay) || !($label = $overlay->get_label('edit_command', 'sections'))) {
        $label = i18n::s('Edit this section');
    }
示例#2
0
文件: edit.php 项目: rair/yacs
    $anchor = Anchors::get($_REQUEST['anchor']);
} elseif (isset($_REQUEST['category']) && $_REQUEST['category']) {
    $anchor = Anchors::get('category:' . $_REQUEST['category']);
} elseif (isset($_REQUEST['section']) && $_REQUEST['section']) {
    $anchor = Anchors::get('section:' . $_REQUEST['section']);
} elseif (isset($context['arguments'][1])) {
    $anchor = Anchors::get($context['arguments'][0] . ':' . $context['arguments'][1]);
} elseif (isset($item['anchor'])) {
    $anchor = Anchors::get($item['anchor']);
}
// anchor owners can do what they want
if (is_object($anchor) && $anchor->is_owned()) {
    Surfer::empower();
    $permitted = TRUE;
    // editors can move forward
} elseif (!isset($item['id']) && Links::allow_creation($item, $anchor)) {
    $permitted = TRUE;
} elseif (is_object($anchor) && !$anchor->is_viewable()) {
    $permitted = FALSE;
} elseif (isset($item['edit_id']) && Surfer::is($item['edit_id'])) {
    $permitted = TRUE;
} else {
    $permitted = FALSE;
}
// do not always show the edition form
$with_form = FALSE;
// load the skin, maybe with a variant
load_skin('links', $anchor);
// clear the tab we are in, if any
if (is_object($anchor)) {
    $context['current_focus'] = $anchor->get_focus();
示例#3
0
if (is_array($items)) {
    // the command to list all files
    if (count($items)) {
        $items = array_merge($items, array(Files::get_url('article:' . $item['id'], 'list') => i18n::s('All files')));
    }
    $items = Skin::build_list($items, 'compact');
}
// display this aside the thread
if ($items || $invite) {
    $text .= Skin::build_box(i18n::s('Files'), '<div id="thread_files_panel">' . $items . '</div>' . $invite, 'boxes', 'files');
}
// links
//
// new links are allowed
$invite = '';
if (Links::allow_creation($item, $anchor)) {
    Skin::define_img('LINKS_ADD_IMG', 'links/add.gif');
    $link = 'links/edit.php?anchor=' . urlencode('article:' . $item['id']);
    $invite = Skin::build_link($link, LINKS_ADD_IMG . i18n::s('Add a link'));
}
// list links by date (default) or by title (option links_by_title)
if (Articles::has_option('links_by_title', $anchor, $item)) {
    $items = Links::list_by_title_for_anchor('article:' . $item['id'], 0, 20, 'compact');
} else {
    $items = Links::list_by_date_for_anchor('article:' . $item['id'], 0, 20, 'compact');
}
// actually render the html
if (is_array($items)) {
    $items = Skin::build_list($items, 'compact');
}
// display this aside the thread
示例#4
0
文件: view.php 项目: rair/yacs
     if (Images::allow_creation($item, $anchor, 'category')) {
         Skin::define_img('IMAGES_ADD_IMG', 'images/add.gif');
         $context['page_tools'][] = Skin::build_link('images/edit.php?anchor=' . urlencode('category:' . $item['id']), IMAGES_ADD_IMG . i18n::s('Add an image'), 'basic', i18n::s('You can upload a camera shot, a drawing, or another image file.'));
     }
     // add a file, if upload is allowed
     if (Files::allow_creation($item, $anchor, 'category')) {
         Skin::define_img('FILES_UPLOAD_IMG', 'files/upload.gif');
         $context['page_tools'][] = Skin::build_link('files/edit.php?anchor=' . urlencode('category:' . $item['id']), FILES_UPLOAD_IMG . i18n::s('Add a file'), 'basic', i18n::s('Attach related files.'));
     }
     // comment this page if anchor does not prevent it
     if (Comments::allow_creation($item, $anchor, 'category')) {
         Skin::define_img('COMMENTS_ADD_IMG', 'comments/add.gif');
         $context['page_tools'][] = Skin::build_link(Comments::get_url('category:' . $item['id'], 'comment'), COMMENTS_ADD_IMG . i18n::s('Post a comment'), 'basic', i18n::s('Express yourself, and say what you think.'));
     }
     // add a link
     if (Links::allow_creation($item, $anchor, 'category')) {
         Skin::define_img('LINKS_ADD_IMG', 'links/add.gif');
         $context['page_tools'][] = Skin::build_link('links/edit.php?anchor=' . urlencode('category:' . $item['id']), LINKS_ADD_IMG . i18n::s('Add a link'), 'basic', i18n::s('Contribute to the web and link to relevant pages.'));
     }
     // modify this item
     Skin::define_img('CATEGORIES_EDIT_IMG', 'categories/edit.gif');
     $context['page_tools'][] = Skin::build_link(Categories::get_url($item['id'], 'edit'), CATEGORIES_EDIT_IMG . i18n::s('Edit this category'), 'basic', i18n::s('Press [e] to edit'), FALSE, 'e');
     // delete this item
     Skin::define_img('CATEGORIES_DELETE_IMG', 'categories/delete.gif');
     $context['page_tools'][] = Skin::build_link(Categories::get_url($item['id'], 'delete'), CATEGORIES_DELETE_IMG . i18n::s('Delete this category'));
     // manage persons assigned to this category
     Skin::define_img('CATEGORIES_ASSIGN_IMG', 'categories/assign.gif');
     $context['page_tools'][] = Skin::build_link(Users::get_url('category:' . $item['id'], 'select'), CATEGORIES_ASSIGN_IMG . i18n::s('Manage members'));
 }
 // add extra information from the overlay, if any
 if (is_object($overlay)) {