Skip to content

Commit

Permalink
yacs 5.9beta16
Browse files Browse the repository at this point in the history
git-svn-id: http://yacs.googlecode.com/svn/trunk@65 799ccead-9442-0410-8758-a113ef2b9449
  • Loading branch information
bernard.paques committed May 17, 2009
1 parent 01ae1ce commit fbc6718
Show file tree
Hide file tree
Showing 177 changed files with 2,607 additions and 2,099 deletions.
2 changes: 1 addition & 1 deletion agents/configure.php
Expand Up @@ -342,7 +342,7 @@
}

// display updated parameters
$context['text'] .= Skin::build_box(i18n::s('Configuration parameters'), Safe::highlight_string($content), 'folder');
$context['text'] .= Skin::build_box(i18n::s('Configuration parameters'), Safe::highlight_string($content), 'folded');

// follow-up commands
$follow_up = i18n::s('Where do you want to go now?');
Expand Down
19 changes: 13 additions & 6 deletions articles/articles.php
Expand Up @@ -561,9 +561,9 @@ function &get_attributes($id, $attributes, $mutable=FALSE) {
$id = (string)$id;
$id = utf8::encode($id);

// strip extra text from enhanced ids '3-page-title' -> '3'
if($position = strpos($id, '-'))
$id = substr($id, 0, $position);
// // strip extra text from enhanced ids '3-page-title' -> '3'
// if($position = strpos($id, '-'))
// $id = substr($id, 0, $position);

// cache previous answers
static $cache;
Expand All @@ -588,8 +588,8 @@ function &get_attributes($id, $attributes, $mutable=FALSE) {
// do the job
$output =& SQL::query_first($query);

// save in cache
if(isset($output['id']))
// save in cache, but only on generic request
if(!$mutable && isset($output['id']) && ($attributes == '*'))
$cache[$id] = $output;

// return by reference
Expand Down Expand Up @@ -1011,11 +1011,12 @@ function &list_($offset=0, $count=10, $layout='decorated', $since=NULL) {
* @param int the number of items to display
* @param string 'decorated', etc or object, i.e., an instance of Layout_Interface
* @param boolean TRUE to list only pages shared with this surfer, FALSE otherwise
* @param boolean TRUE to list live pages, or FALSE to list locked and archived pages
* @return NULL on error, else an ordered array with $url => ($prefix, $label, $suffix, $icon)
*
* @see users/view.php
*/
function &list_assigned_by_date_for_anchor($anchor=NULL, $surfer_id, $offset=0, $count=20, $variant='decorated', $shared_page=FALSE) {
function &list_assigned_by_date_for_anchor($anchor=NULL, $surfer_id, $offset=0, $count=20, $variant='decorated', $shared_page=FALSE, $live=TRUE) {
global $context;

// display active items
Expand Down Expand Up @@ -1047,6 +1048,12 @@ function &list_assigned_by_date_for_anchor($anchor=NULL, $surfer_id, $offset=0,
} elseif($anchor)
$where = "(articles.anchor LIKE '".SQL::escape($anchor)."') AND ".$where;

// only live pages
if($live)
$where .= " AND (articles.locked != 'Y')";
else
$where .= " AND (articles.locked = 'Y')";

// limit to pages shared with this surfer
if($shared_page)
$query = "SELECT articles.*"
Expand Down
37 changes: 17 additions & 20 deletions articles/edit.php
Expand Up @@ -688,24 +688,22 @@
$fields[] = array($label, $input, $hint);

// the introduction
$label = i18n::s('Introduction');
if(!is_object($overlay) || !($label = $overlay->get_label('introduction', isset($item['id'])?'edit':'new')))
$label = i18n::s('Introduction');
$value = '';
if(isset($item['introduction']) && $item['introduction'])
$value = $item['introduction'];
elseif(isset($_SESSION['pasted_introduction']))
$value = $_SESSION['pasted_introduction'];
$input = '<textarea name="introduction" rows="3" cols="50" accesskey="i">'.encode_field($value).'</textarea>';
$hint = i18n::s('Also complements the title in lists featuring this page');
if(!is_object($overlay) || !($hint = $overlay->get_label('introduction_hint', isset($item['id'])?'edit':'new')))
$hint = i18n::s('Also complements the title in lists featuring this page');
$fields[] = array($label, $input, $hint);

// include overlay fields, if any
if(is_object($overlay)) {

// append editing fields for this overlay
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');
Expand All @@ -717,7 +715,9 @@
elseif(isset($_SESSION['pasted_text']))
$value = $_SESSION['pasted_text'];
$input = Surfer::get_editor('description', $value);
$fields[] = array($label, $input);
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');
Expand Down Expand Up @@ -780,7 +780,7 @@

// in a folded box
if($box)
$information .= Skin::build_box(i18n::s('Images'), $box, 'folder', 'edit_images');
$information .= Skin::build_box(i18n::s('Images'), $box, 'folded', 'edit_images');

}

Expand All @@ -792,15 +792,15 @@
if(Locations::are_allowed($anchor, $item)) {
$menu = array( 'locations/edit.php?anchor='.urlencode('article:'.$item['id']) => i18n::s('Add a location') );
$items = Locations::list_by_date_for_anchor('article:'.$item['id'], 0, 50, NULL);
$information .= Skin::build_box(i18n::s('Locations'), Skin::build_list($menu, 'menu_bar').Skin::build_list($items, 'decorated'), 'folder');
$information .= Skin::build_box(i18n::s('Locations'), Skin::build_list($menu, 'menu_bar').Skin::build_list($items, 'decorated'), 'folded');
}

// tables are reserved to associates
include_once '../tables/tables.php';
if(Tables::are_allowed($anchor, $item)) {
$menu = array( 'tables/edit.php?anchor='.urlencode('article:'.$item['id']) => i18n::s('Add a table') );
$items = Tables::list_by_date_for_anchor('article:'.$item['id'], 0, 50, NULL);
$information .= Skin::build_box(i18n::s('Tables'), Skin::build_list($menu, 'menu_bar').Skin::build_list($items, 'decorated'), 'folder');
$information .= Skin::build_box(i18n::s('Tables'), Skin::build_list($menu, 'menu_bar').Skin::build_list($items, 'decorated'), 'folded');
}

}
Expand Down Expand Up @@ -845,18 +845,15 @@
$fields[] = array($label, $input, $hint);

// add a folded box
$information .= Skin::build_box(i18n::s('More content'), Skin::build_form($fields), 'folder');
$information .= Skin::build_box(i18n::s('More content'), Skin::build_form($fields), 'folded');
$fields = array();

//
// content tab - management of the content tree
//
$content = '';

// this page
//

// the section, if one has not been defined yet or when an associate may move one
// the section
if(!is_object($anchor) || isset($item['id'])) {
$label = i18n::s('Section');
$input = Sections::get_radio_buttons($item['anchor'] ? $item['anchor'] : $_REQUEST['anchor']);
Expand Down Expand Up @@ -918,7 +915,7 @@

// add a folded box
if(count($fields))
$content .= Skin::build_box(i18n::s('Attachments'), Skin::build_form($fields), 'folder');
$content .= Skin::build_box(i18n::s('Attachments'), Skin::build_form($fields), 'folded');
$fields = array();

// home panel
Expand All @@ -938,7 +935,7 @@

// add a folded box
if($front)
$content .= Skin::build_box(i18n::s('Contribution to the site front page'), $front, 'folder');
$content .= Skin::build_box(i18n::s('Contribution to the site front page'), $front, 'folded');
$fields = array();

//
Expand All @@ -952,7 +949,7 @@
$label = Skin::build_link(Users::get_url('article:'.$item['id'], 'select'), i18n::s('Editors'), 'basic');
else
$label = i18n::s('Editors');
if(isset($item['id']) && ($items =& Members::list_editors_by_name_for_member('article:'.$item['id'], 0, USERS_LIST_SIZE, 'compact')))
if(isset($item['id']) && ($items =& Members::list_editors_by_name_for_member('article:'.$item['id'], 0, USERS_LIST_SIZE, 'comma')))
$input =& Skin::build_list($items, 'comma');
else
$input = i18n::s('Nobody has been assigned to this page.');
Expand Down Expand Up @@ -1125,7 +1122,7 @@


// add a folded box
$options .= Skin::build_box(i18n::s('More options'), Skin::build_form($fields), 'folder');
$options .= Skin::build_box(i18n::s('More options'), Skin::build_form($fields), 'folded');
$fields = array();

//
Expand Down
2 changes: 1 addition & 1 deletion articles/layout_articles_as_thread.php
Expand Up @@ -121,7 +121,7 @@ function &layout(&$result) {
$details[] = LOCKED_FLAG;

// page editors, except target surfer
if($friends =& Members::list_users_by_posts_for_member('article:'.$item['id'], 0, USERS_LIST_SIZE, 'compact', $this->layout_variant))
if($friends =& Members::list_users_by_posts_for_member('article:'.$item['id'], 0, USERS_LIST_SIZE, 'comma', $this->layout_variant))
$details[] = sprintf(i18n::s('with %s'), Skin::build_list($friends, 'comma'));

// combine in-line details
Expand Down
2 changes: 1 addition & 1 deletion articles/print.php
Expand Up @@ -188,7 +188,7 @@
$items = Comments::list_by_date_for_anchor('article:'.$item['id'], 0, 500, 'excerpt');

// actually list items
if(count($items))
if(is_array($items))
$context['text'] .= Skin::build_box(i18n::s('Comments'), Skin::build_list($items, 'rows'));

//
Expand Down
19 changes: 15 additions & 4 deletions articles/view.php
Expand Up @@ -115,6 +115,7 @@
*
* @author Bernard Paques
* @author GnapZ
* @author Christophe Battarel [email]christophe.battarel@altairis.fr[/email]
* @tester Ghjmora
* @tester Eoin
* @tester Mark
Expand Down Expand Up @@ -635,10 +636,14 @@
$details[] = EXPIRED_FLAG.' '.sprintf(i18n::s('Page has expired %s'), Skin::build_date($item['expiry_date']));
}

// article editors, for associates and section editors
if((Surfer::is_associate() || Articles::is_assigned($item['id']) || (is_object($anchor) && $anchor->is_editable())) && ($items =& Members::list_users_by_posts_for_member('article:'.$item['id'], 0, USERS_LIST_SIZE, 'compact')))
// page editors, for associates and section editors
if(Surfer::is_empowered() && Surfer::is_logged() && ($items =& Members::list_users_by_posts_for_member('article:'.$item['id'], 0, USERS_LIST_SIZE, 'comma')))
$details[] = sprintf(i18n::s('%s: %s'), Skin::build_link(Users::get_url('article:'.$item['id'], 'select'), i18n::s('Editors')), Skin::build_list($items, 'comma'));

// page watchers
if(Surfer::is_logged() && ($items =& Members::list_watchers_by_posts_for_anchor('article:'.$item['id'], 0, 50, 'comma')))
$details[] = sprintf(i18n::s('%s: %s'), i18n::s('Watchers'), Skin::build_list($items, 'comma'));

// no more details
if(count($details))
$text .= ucfirst(implode(BR."\n", $details)).BR."\n";
Expand Down Expand Up @@ -839,15 +844,21 @@

}

// 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(trim($item['description'])) {
if($description) {

// use adequate label
if(is_object($overlay) && ($label = $overlay->get_label('description')))
$text .= Skin::build_block($label, 'title');

// provide only the requested page
$pages = preg_split('/\s*\[page\]\s*/is', $item['description']);
$pages = preg_split('/\s*\[page\]\s*/is', $description);
if($page > count($pages))
$page = count($pages);
if($page < 1)
Expand Down
50 changes: 37 additions & 13 deletions articles/view_as_chat.php
Expand Up @@ -451,8 +451,44 @@
if(is_object($overlay))
$context['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
$context['text'] .= Skin::build_block($item['description'], 'description', '', $item['options']);
if($description) {

// use adequate label
if(is_object($overlay) && ($label = $overlay->get_label('description')))
$context['text'] .= Skin::build_block($label, 'title');

// provide only the requested page
$pages = preg_split('/\s*\[page\]\s*/is', $description);
if($page > count($pages))
$page = count($pages);
if($page < 1)
$page = 1;
$description = $pages[ $page-1 ];

// if there are several pages, remove toc and toq codes
if(count($pages) > 1)
$description = preg_replace('/\s*\[(toc|toq)\]\s*/is', '', $description);

// beautify the target page
$context['text'] .= Skin::build_block($description, 'description', '', $item['options']);

// if there are several pages, add navigation commands to browse them
if(count($pages) > 1) {
$page_menu = array( '_' => i18n::s('Pages') );
$home =& Sections::get_permalink($item);
$prefix = Sections::get_url($item['id'], 'navigate', 'pages');
$page_menu = array_merge($page_menu, Skin::navigate($home, $prefix, count($pages), 1, $page));

$context['text'] .= Skin::build_list($page_menu, 'menu_bar');
}
}

// add trailer information from the overlay, if any
if(is_object($overlay))
Expand Down Expand Up @@ -765,18 +801,6 @@
//
$lines = array();

// watch command is provided to logged surfers
if(Surfer::get_id() && !$zoom_type) {

$link = Users::get_url('article:'.$item['id'], 'track');

if($in_watch_list) {
$label = i18n::s('Forget');
Skin::define_img('WATCH_TOOL_IMG', 'icons/tools/watch.gif');
$lines[] = Skin::build_link($link, WATCH_TOOL_IMG.$label, 'basic', i18n::s('Manage your watch list'));
}
}

// get news from rss
if(isset($item['id']) && (!isset($context['skins_general_without_feed']) || ($context['skins_general_without_feed'] != 'Y')) ) {

Expand Down

0 comments on commit fbc6718

Please sign in to comment.