$context['text'] .= Skin::build_block(i18n::s('Ping interface'), 'title', 'ping'); $context['text'] .= '<p>' . i18n::s('To spread updates') . '</p>'; $rows = array(); $rows[] = array(i18n::s('URL:'), '<b>' . $context['url_to_home'] . $context['url_to_root'] . 'services/ping.php</b>'); $rows[] = array(i18n::s('Documentation:'), Skin::build_link('services/ping.php', NULL, 'script')); $rows[] = array(i18n::s('Specifications:'), Skin::build_link('http://www.hixie.ch/specs/pingback/pingback', 'Pingback specification', 'external') . ', ' . Skin::build_link('http://www.xmlrpc.com/spec', 'XML-RPC Specification', 'external')); $context['text'] .= Skin::table(NULL, $rows); // search.php $context['text'] .= Skin::build_block(i18n::s('Search'), 'title', 'search'); $context['text'] .= '<p>' . i18n::s('Build a customised RSS feed based on any keyword') . '</p>'; $rows = array(); $rows[] = array(i18n::s('URL:'), '<b>' . $context['url_to_home'] . $context['url_to_root'] . 'services/search.php</b>'); $rows[] = array(i18n::s('Documentation:'), Skin::build_link('services/search.php', NULL, 'script')); $rows[] = array(i18n::s('Specifications:'), Skin::build_link('http://blogs.law.harvard.edu/tech/rss', 'RSS 2.0 Specification', 'external')); $context['text'] .= Skin::table(NULL, $rows); // xml_rpc.php $context['text'] .= Skin::build_block(i18n::s('Generic XML-RPC interface'), 'title', 'xml-rpc'); $context['text'] .= '<p>' . i18n::s('Bound to hooked back-end scripts') . '</p>'; $rows = array(); $rows[] = array(i18n::s('URL:'), '<b>' . $context['url_to_home'] . $context['url_to_root'] . 'services/xml_rpc.php</b>'); $rows[] = array(i18n::s('Documentation:'), Skin::build_link('services/xml_rpc.php', NULL, 'script')); $rows[] = array(i18n::s('Specification:'), Skin::build_link('http://www.xmlrpc.com/spec', 'XML-RPC Specification', 'external')); $context['text'] .= Skin::table(NULL, $rows); // page tools if (Surfer::is_associate()) { $context['page_tools'][] = Skin::build_link('services/configure.php', i18n::s('Configure'), 'basic'); } // referrals, if any $context['components']['referrals'] = Skin::build_referrals('services/index.php'); // render the skin render_skin();
$panels[] = array('referrals', i18n::s('Referrals'), 'referrals_panel', $referrals); } // // requests from search engines // $searches = ''; include_once $context['path_to_root'] . 'agents/referrals.php'; if ($result = Referrals::list_by_keywords(0, 50)) { // table row $headers = array(i18n::s('Keywords'), i18n::s('Count')); // table rows $rows = array(); while ($item = SQL::fetch($result)) { $rows[] = array('left=' . Skin::build_link($item['referer'], $item['keywords'], 'external'), 'left=' . Skin::build_number($item['hits'])); } // render the table $searches .= Skin::table($headers, $rows); } // display in a separate panel if (trim($searches)) { $panels[] = array('searches', i18n::s('Searches'), 'searches_panel', $searches); } // // assemble all tabs // $context['text'] .= Skin::build_tabs($panels); } // referrals, if any $context['components']['referrals'] = Skin::build_referrals('agents/index.php'); // render the skin render_skin();
$box['bar'] += array(Sections::get_url($item['id'], 'mail') => SECTIONS_EMAIL_IMG . i18n::s('Notify participants')); } // manage editors, for owners if (Sections::is_owned($item, $anchor, TRUE) || Surfer::is_associate()) { Skin::define_img('SECTIONS_ASSIGN_IMG', 'sections/assign.gif'); $box['bar'] += array(Users::get_url('section:' . $item['id'], 'select') => SECTIONS_ASSIGN_IMG . i18n::s('Manage participants')); // leave this section, for editors } elseif (Sections::is_assigned($item['id'])) { Skin::define_img('SECTIONS_ASSIGN_IMG', 'sections/assign.gif'); $box['bar'] += array(Users::get_url('section:' . $item['id'], 'leave') => SECTIONS_ASSIGN_IMG . i18n::s('Leave this section')); } // headers $headers = array(i18n::s('Person'), i18n::s('Watcher'), i18n::s('Editor'), i18n::s('Owner')); // layout columns if ($rows) { $box['text'] .= Skin::table($headers, $rows, 'grid'); } // actually render the html $users .= Skin::build_content(NULL, NULL, $box['text'], $box['bar']); } // display in a separate panel if ($users) { $label = i18n::s('Persons'); if ($users_count) { $label .= ' (' . $users_count . ')'; } $panels[] = array('users', $label, 'users_panel', $users); } // // assemble all tabs //
/** * display the content of one instance * * @see overlays/overlay.php * * @param array the hosting record * @return some HTML to be inserted into the resulting page */ function &get_view_text($host = NULL) { global $context; // we may look at enrolments include_once $context['path_to_root'] . 'shared/enrolments.php'; // minutes to go if (isset($this->attributes['date_stamp']) && $this->attributes['date_stamp'] > NULL_DATE) { $this->minutes_before_start = (sql::strtotime($this->attributes['date_stamp']) - time()) / 60; } else { $this->minutes_before_start = 120; } // prevent automatic start // minutes since the end of the event if (isset($this->attributes['duration']) && $this->attributes['duration']) { $this->minutes_since_stop = -($this->attributes['duration'] + $this->minutes_before_start); } else { $this->minutes_since_stop = -120; } // prevent automatic stop // tabular information $rows = array(); // initialize feed-back to end-user $this->feed_back = array('message' => '', 'status' => array(), 'menu' => array(), 'commands' => array(), 'reload_this_page' => FALSE); // maybe a bare instance if (!isset($this->attributes['status'])) { $this->attributes['status'] = 'created'; } // step 5 - end of the event if ($this->attributes['status'] == 'stopped') { // list enrolment for this meeting $query = "SELECT * FROM " . SQL::table_name('enrolments') . " WHERE anchor LIKE '" . SQL::escape($this->anchor->get_reference()) . "'"; if ($result = SQL::query($query)) { // browse the list $items = array(); while ($item = SQL::fetch($result)) { // a user registered on this server if ($item['user_id'] && ($user = Users::get($item['user_id']))) { // make an url $url = Users::get_permalink($user); // gather information on this user if (isset($user['full_name']) && $user['full_name']) { $label = $user['full_name'] . ' (' . $user['nick_name'] . ')'; } else { $label = $user['nick_name']; } $items[] = Skin::build_link($url, $label, 'user'); // we only have some e-mail address } else { $items[] = $item['user_email']; } } // shape a compact list if (count($items)) { $this->feed_back['status'][] = Skin::build_folded_box(i18n::s('Enrolment') . ' (' . count($items) . ')', Skin::finalize_list($items, 'compact')); } } // signal that the event is over $this->feed_back['status'][] = i18n::s('Event is over'); // display the follow-up message if (isset($this->attributes['follow_up_message']) && $this->attributes['follow_up_message']) { $this->feed_back['message'] .= Codes::render($this->attributes['follow_up_message']); } // possible transition to state 'stopped' } else { $this->transition_to_stopped(); } // step 4 - event has started if ($this->attributes['status'] == 'started') { // display the welcome message if (isset($this->attributes['welcome_message'])) { $this->feed_back['message'] .= Codes::render($this->attributes['welcome_message']); } // possible transition to state 'started' } else { $this->transition_to_started(); } // step 3 - waiting for event start if ($this->attributes['status'] == 'lobby') { // display the lobby message if (isset($this->attributes['lobby_message'])) { $this->feed_back['message'] .= Codes::render($this->attributes['lobby_message']); } // possible transition to state 'lobby' } else { $this->transition_to_lobby(); } // step 2 - enrolment has been opened if ($this->attributes['status'] == 'open') { // display the induction message if (isset($this->attributes['induction_message'])) { $this->feed_back['message'] .= Codes::render($this->attributes['induction_message']); } // possible transition to state 'open' } else { $this->transition_to_open(); } // step 1 - at the very beginning of the workflow if (!isset($this->attributes['status']) || $this->attributes['status'] == 'created') { // display the induction message if (isset($this->attributes['induction_message'])) { $this->feed_back['message'] .= Codes::render($this->attributes['induction_message']); } // possible transition to state 'created' } else { $this->transition_to_created(); } // event details if ($details = $this->get_event_details_text()) { $rows[] = array($this->get_event_details_label(), $details); } // meeting date if (isset($this->attributes['date_stamp']) && $this->attributes['date_stamp']) { // offer to update the calendar $button = ''; if ($this->attributes['status'] == 'stopped') { } elseif (enrolments::get_record($this->anchor->get_reference())) { $button = ' ' . Skin::build_link($this->get_url('fetch_ics'), '<img src="' . $context['url_to_root'] . 'included/jscalendar/img.gif" style="border: none; cursor: pointer;" title="' . i18n::s('Update my calendar') . '" onmouseover="this.style.background=\'red\';" onmouseout="this.style.background=\'\'" alt="' . i18n::s('Update my calendar') . '" />', 'basic'); } $rows[] = array(i18n::s('Date'), Skin::build_date($this->attributes['date_stamp'], 'full') . $button); } // meeting duration if (isset($this->attributes['duration']) && $this->attributes['duration'] && $this->attributes['duration'] < 1440) { switch ($this->attributes['duration']) { case 60: $duration = i18n::s('one hour'); break; case 120: $duration = i18n::s('two hours'); break; default: $duration = sprintf(i18n::s('%d minutes'), $this->attributes['duration']); break; } $rows[] = array(i18n::s('Duration'), $duration); } // build a link to the owner page, if any if (isset($this->attributes['chairman']) && $this->attributes['chairman']) { if ($user = Users::get($this->attributes['chairman'])) { $label = Users::get_link($user['full_name'], NULL, $user['id']); } else { $label = $this->attributes['chairman']; } $rows[] = array(i18n::s('Chairman'), $label); } // finalize status if (is_callable(array($this, 'finalize_status'))) { $this->feed_back['status'] = $this->finalize_status($this->feed_back['status']); } // finalize menu if (is_callable(array($this, 'finalize_menu'))) { $this->feed_back['menu'] = $this->finalize_menu($this->feed_back['menu']); } // we have to refresh the page if ($this->feed_back['reload_this_page']) { $reload_through_javascript = '<img alt="*" src="' . $context['url_to_home'] . $context['url_to_root'] . 'skins/_reference/ajax/ajax_spinner.gif" style="vertical-align:-3px" /> '; Page::insert_script('window.location.reload(true);'); $rows[] = array(i18n::s('Status'), $reload_through_javascript); // display the status line and/or buttons } elseif (count($this->feed_back['status']) || count($this->feed_back['menu'])) { $status = ''; // embed status line if (count($this->feed_back['status'])) { $status .= implode(BR, $this->feed_back['status']); } // embed menu bar if (count($this->feed_back['menu'])) { $status .= Skin::finalize_list($this->feed_back['menu'], 'menu_bar'); } $rows[] = array(i18n::s('Status'), $status); } // display commands to page owner if (count($this->feed_back['commands'])) { $rows[] = array('', Skin::finalize_list($this->feed_back['commands'], 'menu_bar')); } // format text in a table $text = Skin::table(NULL, $rows, 'grid'); // finalize feed-back if ($this->feed_back['message']) { $text .= Skin::build_box($this->get_message_label(), $this->feed_back['message']); } // allow for extensions if (is_callable(array($this, 'get_view_text_extension'))) { $text .= $this->get_view_text_extension(); } // job done return $text; }
/** * list articles as rows in a table * * @param resource the SQL result * @return string the rendered text **/ function layout($result) { global $context; // we return some text $text = ''; // empty list if (!SQL::count($result)) { return $text; } // build a list of articles $rows = array(); include_once $context['path_to_root'] . 'comments/comments.php'; include_once $context['path_to_root'] . 'links/links.php'; while ($item = SQL::fetch($result)) { // get the related overlay $overlay = Overlay::load($item, 'article:' . $item['id']); // get the anchor $anchor = Anchors::get($item['anchor']); // the url to view this item $url = Articles::get_permalink($item); // reset everything $title = $abstract = $author = ''; // signal articles to be published if (!isset($item['publish_date']) || $item['publish_date'] <= NULL_DATE || $item['publish_date'] > gmstrftime('%Y-%m-%d %H:%M:%S')) { $title .= DRAFT_FLAG; } // signal restricted and private articles if ($item['active'] == 'N') { $title .= PRIVATE_FLAG; } elseif ($item['active'] == 'R') { $title .= RESTRICTED_FLAG; } // indicate the id in the hovering popup $hover = i18n::s('View the page'); if (Surfer::is_member()) { $hover .= ' [article=' . $item['id'] . ']'; } // use the title to label the link if (is_object($overlay)) { $label = Codes::beautify_title($overlay->get_text('title', $item)); } else { $label = Codes::beautify_title($item['title']); } // use the title as a link to the page $title .= Skin::build_link($url, $label, 'basic', $hover); // signal locked articles if (isset($item['locked']) && $item['locked'] == 'Y' && Articles::is_owned($item, $anchor)) { $title .= ' ' . LOCKED_FLAG; } // flag articles updated recently if ($item['expiry_date'] > NULL_DATE && $item['expiry_date'] <= $context['now']) { $title .= ' ' . EXPIRED_FLAG; } elseif ($item['create_date'] >= $context['fresh']) { $title .= ' ' . NEW_FLAG; } elseif ($item['edit_date'] >= $context['fresh']) { $title .= ' ' . UPDATED_FLAG; } // the icon if ($item['thumbnail_url']) { $abstract .= '<a href="' . $context['url_to_root'] . $url . '"><img src="' . $item['thumbnail_url'] . '" class="right_image" alt="" /></a>'; } // the introductory text if (is_object($overlay)) { $abstract .= Codes::beautify_introduction($overlay->get_text('introduction', $item)); } elseif ($item['introduction']) { $abstract .= Codes::beautify_introduction($item['introduction']); } // insert overlay data, if any if (is_object($overlay)) { $abstract .= $overlay->get_text('list', $item); } // make some abstract out of main text if (!$item['introduction'] && $context['skins_with_details'] == 'Y') { $abstract .= Skin::cap(Codes::beautify($item['description'], $item['options']), 50); } // attachment details $details = array(); // info on related files if ($count = Files::count_for_anchor('article:' . $item['id'], TRUE)) { Skin::define_img('FILES_LIST_IMG', 'files/list.gif'); $details[] = FILES_LIST_IMG . sprintf(i18n::ns('%d file', '%d files', $count), $count); } // info on related links if ($count = Links::count_for_anchor('article:' . $item['id'], TRUE)) { Skin::define_img('LINKS_LIST_IMG', 'links/list.gif'); $details[] = LINKS_LIST_IMG . sprintf(i18n::ns('%d link', '%d links', $count), $count); } // comments if ($count = Comments::count_for_anchor('article:' . $item['id'], TRUE)) { Skin::define_img('COMMENTS_LIST_IMG', 'comments/list.gif'); $details[] = Skin::build_link(Comments::get_url('article:' . $item['id'], 'list'), COMMENTS_LIST_IMG . sprintf(i18n::ns('%d comment', '%d comments', $count), $count)); } // describe attachments if (count($details)) { $abstract .= '<p style="margin: 3px 0;">' . join(', ', $details) . '</p>'; } // anchors $anchors = array(); if ($members =& Members::list_categories_by_title_for_member('article:' . $item['id'], 0, 7, 'raw')) { foreach ($members as $category_id => $attributes) { // add background color to distinguish this category against others if (isset($attributes['background_color']) && $attributes['background_color']) { $attributes['title'] = '<span style="background-color: ' . $attributes['background_color'] . '; padding: 0 3px 0 3px;">' . $attributes['title'] . '</span>'; } $anchors[] = Skin::build_link(Categories::get_permalink($attributes), $attributes['title'], 'basic'); } } if (@count($anchors)) { $abstract .= '<p class="tags" style="margin: 3px 0">' . implode(' ', $anchors) . '</p>'; } // poster name if (isset($context['with_author_information']) && $context['with_author_information'] == 'Y') { if ($item['create_name']) { $author = Users::get_link($item['create_name'], $item['create_address'], $item['create_id']); } else { $author = Users::get_link($item['edit_name'], $item['edit_address'], $item['edit_id']); } } // more details $details =& Articles::build_dates($anchor, $item); // rating if ($item['rating_count'] && !(is_object($anchor) && $anchor->has_option('without_rating'))) { $details[] = Skin::build_link(Articles::get_url($item['id'], 'like'), Skin::build_rating_img((int) round($item['rating_sum'] / $item['rating_count'])), 'basic'); } // page details if (count($details)) { $details = '<p class="details">' . join(', ', $details) . '</p>'; } // this is another row of the output -- title, abstract, (author,) details if (isset($context['with_author_information']) && $context['with_author_information'] == 'Y') { $cells = array($title, $abstract, $author, $details); } else { $cells = array($title, $abstract, $details); } // append this row $rows[] = $cells; } // end of processing SQL::free($result); // headers if (isset($context['with_author_information']) && $context['with_author_information'] == 'Y') { $headers = array(i18n::s('Topic'), i18n::s('Abstract'), i18n::s('Poster'), i18n::s('Details')); } else { $headers = array(i18n::s('Topic'), i18n::s('Abstract'), i18n::s('Details')); } // return a sortable table $text .= Skin::table($headers, $rows, 'grid'); return $text; }
/** * list articles as topics in a forum * * @param resource the SQL result * @return string the rendered text **/ function layout($result) { global $context; // we return some text $text = ''; // empty list if (!SQL::count($result)) { return $text; } // page size for comments include_once $context['path_to_root'] . 'comments/layout_comments_as_updates.php'; $layout = new Layout_comments_as_updates(); // build a list of articles $rows = array(); include_once $context['path_to_root'] . 'comments/comments.php'; while ($item = SQL::fetch($result)) { // get the related overlay $overlay = Overlay::load($item, 'article:' . $item['id']); // get the anchor $anchor = Anchors::get($item['anchor']); // the url to view this item $url = Articles::get_permalink($item); // build a title if (is_object($overlay)) { $title = Codes::beautify_title($overlay->get_text('title', $item)); } else { $title = Codes::beautify_title($item['title']); } // reset everything $text = $prefix = $label = $suffix = $icon = ''; // signal articles to be published if (!isset($item['publish_date']) || $item['publish_date'] <= NULL_DATE || $item['publish_date'] > gmstrftime('%Y-%m-%d %H:%M:%S')) { $prefix .= DRAFT_FLAG; } // signal restricted and private articles if ($item['active'] == 'N') { $prefix .= PRIVATE_FLAG; } elseif ($item['active'] == 'R') { $prefix .= RESTRICTED_FLAG; } // flag expired articles, and articles updated recently if ($item['expiry_date'] > NULL_DATE && $item['expiry_date'] <= $context['now']) { $suffix = EXPIRED_FLAG . ' '; } elseif ($item['create_date'] >= $context['fresh']) { $suffix = NEW_FLAG . ' '; } elseif ($item['edit_date'] >= $context['fresh']) { $suffix = UPDATED_FLAG . ' '; } // rating if ($item['rating_count'] && !(is_object($anchor) && $anchor->has_option('without_rating'))) { $suffix .= ' ' . Skin::build_link(Articles::get_url($item['id'], 'like'), Skin::build_rating_img((int) round($item['rating_sum'] / $item['rating_count'])), 'basic'); } // select an icon for this thread $item['comments_count'] = Comments::count_for_anchor('article:' . $item['id']); if (is_object($overlay) && $overlay->attributes['overlay_type'] == 'poll') { Skin::define_img('POLL_IMG', 'articles/poll.gif'); $icon = POLL_IMG; } elseif ($item['rank'] < 10000) { Skin::define_img('STICKY_THREAD_IMG', 'articles/sticky_thread.gif'); $icon = STICKY_THREAD_IMG; } elseif (isset($item['comments_count']) && $item['comments_count'] >= 20) { Skin::define_img('VERY_HOT_THREAD_IMG', 'articles/very_hot_thread.gif'); $icon = VERY_HOT_THREAD_IMG; } elseif (isset($item['comments_count']) && $item['comments_count'] >= 10) { $icon = HOT_THREAD_IMG; } else { $icon = THREAD_IMG; } // indicate the id in the hovering popup $hover = i18n::s('View the page'); if (Surfer::is_member()) { $hover .= ' [article=' . $item['id'] . ']'; } // use the title as a link to the page $title = $prefix . Skin::build_link($url, ucfirst($title), 'basic', $hover) . $suffix; $suffix = ''; // the introductory text $introduction = ''; if (is_object($overlay)) { $introduction = $overlay->get_text('introduction', $item); } elseif ($item['introduction']) { $introduction = $item['introduction']; } if ($introduction) { $suffix .= BR . Codes::beautify_introduction($introduction); } // insert overlay data, if any if (is_object($overlay)) { $suffix .= $overlay->get_text('list', $item); } // shortcuts to comments pages if (isset($item['comments_count']) && ($pages = (int) ceil($item['comments_count'] / $layout->items_per_page())) && $pages > 1) { $suffix .= '<p class="details">Pages '; for ($index = 1; $index <= $pages; $index++) { $suffix .= Skin::build_link('comments/list.php?id=article:' . $item['id'] . '&page=' . $index, $index, 'basic', i18n::s('One page of comments')) . ' '; } $suffix .= Skin::build_link('comments/list.php?id=article:' . $item['id'] . '&page=' . $pages, MORE_IMG, 'basic', i18n::s('Most recent comments')) . '</p>'; } // links to sections and categories $anchors = array(); // the main anchor link if (is_object($anchor) && (!isset($this->focus) || $item['anchor'] != $this->focus)) { $anchors[] = Skin::build_link($anchor->get_url(), ucfirst($anchor->get_title()), 'basic', i18n::s('In this section')); } // list categories by title, if any if ($members =& Members::list_categories_by_title_for_member('article:' . $item['id'], 0, 7, 'raw')) { foreach ($members as $category_id => $attributes) { // add background color to distinguish this category against others if (isset($attributes['background_color']) && $attributes['background_color']) { $attributes['title'] = '<span style="background-color: ' . $attributes['background_color'] . '; padding: 0 3px 0 3px;">' . $attributes['title'] . '</span>'; } if (!isset($this->focus) || $this->focus != 'category:' . $category_id) { $anchors[] = Skin::build_link(Categories::get_permalink($attributes), $attributes['title'], 'basic', i18n::s('Related topics')); } } } // list section and categories in the suffix if (@count($anchors)) { $suffix .= '<p class="tags">' . implode(' ', $anchors) . '</p>'; } // the creator of this article $starter = ''; if ($item['create_name']) { $starter = '<span class="details">' . Users::get_link($item['create_name'], $item['create_address'], $item['create_id']) . '</span>'; } // the last editor $details = ''; if ($item['edit_date']) { // find a name, if any $user = ''; if ($item['edit_name']) { // label the action if (isset($item['edit_action'])) { $user .= Anchors::get_action_label($item['edit_action']) . ' '; } // name of last editor $user .= sprintf(i18n::s('by %s'), Users::get_link($item['edit_name'], $item['edit_address'], $item['edit_id'])); } $details .= $user . ' ' . Skin::build_date($item['edit_date']); } // signal locked articles if (isset($item['locked']) && $item['locked'] == 'Y' && Articles::is_owned($item, $anchor)) { $details .= ', ' . LOCKED_FLAG; } // poster details if ($details) { $details = '<p class="details">' . $details . "</p>\n"; } if (!isset($item['comments_count'])) { $item['comments_count'] = 0; } // this is another row of the output $cells = array($title . $suffix, 'center=' . $starter, 'center=' . $item['comments_count'], 'center=' . Skin::build_number($item['hits']), $details); if (THREAD_IMG) { $cells = array_merge(array($icon), $cells); } $rows[] = $cells; } // end of processing SQL::free($result); // headers $headers = array(i18n::s('Topic'), 'center=' . i18n::s('Poster'), 'center=' . i18n::s('Replies'), 'center=' . i18n::s('Views'), i18n::s('Last post')); if (THREAD_IMG) { $headers = array_merge(array(''), $headers); } // make a sortable table $output = Skin::table($headers, $rows, 'yabb'); return $output; }
/** * display content of main panel * * Everything is in a separate panel * * @param array the hosting record, if any * @return some HTML to be inserted into the resulting page */ function &get_view_text($host = NULL) { $text = ''; $rows = array(); // this page has an explicit owner if (isset($host['owner_id']) && ($user = Users::get($host['owner_id']))) { // allow for click-to-call $click_to_call = Users::get_click_to_call($user); // display information on the owner $rows[] = array(i18n::s('Owner'), Users::get_link($user['full_name'], NULL, $user['id']) . ' ' . $click_to_call); } // show progress $rows[] = array(i18n::s('Progress'), $this->get_progress_value()); // type $rows[] = array(i18n::s('Workflow'), self::get_type_value()); // the status and history $history = self::get_history(); $rows[] = array(i18n::s('Status'), self::get_status_label($this->attributes['status']) . $history); $text = Skin::table(NULL, $rows, 'grid'); return $text; }
$rows[] = array(i18n::s('Windows Live Messenger'), Skin::build_presence($item['msn_address'], 'msn') . ' ' . $item['msn_address']); } // a clickable aim address if (isset($item['aim_address']) && $item['aim_address']) { $rows[] = array(i18n::s('AIM'), Skin::build_presence($item['aim_address'], 'aim') . ' ' . $item['aim_address']); } // a clickable irc address if (isset($item['irc_address']) && $item['irc_address']) { $rows[] = array(i18n::s('IRC'), Skin::build_presence($item['irc_address'], 'irc') . ' ' . $item['irc_address']); } // a clickable icq number if (isset($item['icq_address']) && $item['icq_address']) { $rows[] = array(i18n::s('ICQ'), Skin::build_presence($item['icq_address'], 'icq') . ' ' . $item['icq_address']); } if (count($rows)) { $box['text'] .= Skin::table(NULL, $rows, 'wide'); } } // a full box if ($box['text']) { $information .= Skin::build_box(i18n::s('Instant communication'), $box['text'], 'folded'); } // pgp key if (isset($item['pgp_key']) && $item['pgp_key']) { $information .= Skin::build_box(i18n::s('Public key'), '<span style="font-size: 50%">' . $item['pgp_key'] . '</span>', 'folded'); } // show preferences only to related surfers and to associates // if (Surfer::get_id() == $item['id'] || Surfer::is_associate()) { $box = ''; // public or restricted or hidden profile
} // nothing has been posted } else { $context['page_title'] = i18n::s('Add a file'); // preserve referer address if (isset($_SERVER['HTTP_REFERER']) && $_SERVER['HTTP_REFERER']) { $link = $_SERVER['HTTP_REFERER']; } else { $link = 'skins/flexible/configure.php'; } // the form to select the file to upload $context['text'] = '<form method="post" action="' . $context['script_url'] . '" enctype="multipart/form-data">' . '<p style="margin: 0; padding: 0;">' . '<input type="file" name="upload" size="30" title="' . encode_field(i18n::s('Press to select a local file')) . '" />' . Skin::build_submit_button(i18n::s('Submit')) . '<input type="hidden" name="directory" value="' . $_REQUEST['directory'] . '" />' . '<input type="hidden" name="referer" value="' . $link . '" />' . '</p>' . '</form>'; $headers = array(i18n::s('Suffix'), i18n::s('Alignment'), i18n::s('Style'), i18n::s('Example')); $rows = array(); $rows[] = array('<tt>-x</tt>', i18n::s('repeat horizontally'), '<tt>repeat-x top left</tt>', '<tt>light_gray_bevel-x.jpg</tt>'); $rows[] = array('<tt>-m</tt>', i18n::s('center at the top'), '<tt>no-repeat top center</tt>', '<tt>ephemeral_header05-m.jpg</tt>'); $rows[] = array('<tt>-l</tt>', i18n::s('anchor to top left'), '<tt>no-repeat top left</tt>', '<tt>bar-grey-l.png</tt>'); $rows[] = array('<tt>-r</tt>', i18n::s('anchor to top right'), '<tt>no-repeat top right</tt>', '<tt>flowers-r.jpg</tt>'); $rows[] = array('<tt>-b</tt>', i18n::s('align to bottom, then repeat horizontally'), '<tt>repeat-x bottom left</tt>', '<tt>chrom_menu-b.png</tt>'); $rows[] = array('<tt>-bm</tt>', i18n::s('center at the bottom'), '<tt>no-repeat bottom center</tt>', '<tt>bamboo2-bm.gif</tt>'); $rows[] = array('<tt>-bl</tt>', i18n::s('anchor to bottom left'), '<tt>no-repeat bottom left</tt>', '<tt>bar-bl.gif</tt>'); $rows[] = array('<tt>-br</tt>', i18n::s('anchor to bottom right'), '<tt>no-repeat bottom right</tt>', '<tt>shadow_alpha-br.png</tt>'); $rows[] = array('<tt>-y</tt>', i18n::s('align to left, then repeat vertically'), '<tt>repeat-y top left</tt>', '<tt>sidebar-bg-y.png</tt>'); $rows[] = array('<tt>-ym</tt>', i18n::s('center, then repeat vertically'), '<tt>repeat-y top center</tt>', '<tt>hgradient-ym.jpg</tt>'); $rows[] = array('<tt>-yr</tt>', i18n::s('align to right, then repeat vertically'), '<tt>repeat-y top right</tt>', '<tt>sidebar-bg-yr.png</tt>'); $rows[] = array(i18n::s('other cases'), i18n::s('repeat horizontally and vertically'), '<tt>repeat</tt>', '<tt>p-chrom_degh.png</tt>'); // some suggestions $context['text'] .= '<p>' . i18n::s('Image will be aligned depending of its suffix, as depicted in the following table.') . '</p>' . Skin::table($headers, $rows); } // render the skin render_skin();
/** * list articles as rows in a table * * @param resource the SQL result * @return string the rendered text **/ function layout($result) { global $context; // we return some text $text = ''; // empty list if (!SQL::count($result)) { return $text; } // build a list of articles $rows = array(); include_once $context['path_to_root'] . 'comments/comments.php'; include_once $context['path_to_root'] . 'links/links.php'; while ($item = SQL::fetch($result)) { // get the related overlay $overlay = Overlay::load($item, 'article:' . $item['id']); // get the anchor $anchor = Anchors::get($item['anchor']); // the url to view this item $url = Articles::get_permalink($item); // reset everything $id = $summary = $owner = $type = $status = $update = $progress = ''; // link to the page $id = Skin::build_link($url, $item['id'], 'basic'); // signal articles to be published if (!isset($item['publish_date']) || $item['publish_date'] <= NULL_DATE || $item['publish_date'] > gmstrftime('%Y-%m-%d %H:%M:%S')) { $summary .= DRAFT_FLAG; } // signal restricted and private articles if ($item['active'] == 'N') { $summary .= PRIVATE_FLAG; } elseif ($item['active'] == 'R') { $summary .= RESTRICTED_FLAG; } // indicate the id in the hovering popup $hover = i18n::s('View the page'); if (Surfer::is_member()) { $hover .= ' [article=' . $item['id'] . ']'; } // use the title to label the link if (is_object($overlay)) { $label = Codes::beautify_title($overlay->get_text('title', $item)); } else { $label = Codes::beautify_title($item['title']); } // use the title as a link to the page $summary .= Skin::build_link($url, $label, 'basic', $hover); // signal locked articles if (isset($item['locked']) && $item['locked'] == 'Y' && Articles::is_owned($item, $anchor)) { $summary .= ' ' . LOCKED_FLAG; } // flag articles updated recently if ($item['expiry_date'] > NULL_DATE && $item['expiry_date'] <= $context['now']) { $summary .= ' ' . EXPIRED_FLAG; } elseif ($item['create_date'] >= $context['fresh']) { $summary .= ' ' . NEW_FLAG; } elseif ($item['edit_date'] >= $context['fresh']) { $summary .= ' ' . UPDATED_FLAG; } // attachment details $details = array(); // info on related files if ($count = Files::count_for_anchor('article:' . $item['id'])) { Skin::define_img('FILES_LIST_IMG', 'files/list.gif'); $details[] = FILES_LIST_IMG . sprintf(i18n::ns('%d file', '%d files', $count), $count); } // info on related links if ($count = Links::count_for_anchor('article:' . $item['id'], TRUE)) { Skin::define_img('LINKS_LIST_IMG', 'links/list.gif'); $details[] = LINKS_LIST_IMG . sprintf(i18n::ns('%d link', '%d links', $count), $count); } // comments if ($count = Comments::count_for_anchor('article:' . $item['id'], TRUE)) { Skin::define_img('COMMENTS_LIST_IMG', 'comments/list.gif'); $details[] = Skin::build_link(Comments::get_url('article:' . $item['id'], 'list'), COMMENTS_LIST_IMG . sprintf(i18n::ns('%d comment', '%d comments', $count), $count)); } // combine in-line details if (count($details)) { $summary .= ' <span class="details">' . trim(implode(' ', $details)) . '</span>'; } // dates $summary .= BR . '<span class="details">' . join(BR, Articles::build_dates($anchor, $item)) . '</span>'; // display all tags if ($item['tags']) { $summary .= BR . '<span class="tags">' . Skin::build_tags($item['tags'], 'article:' . $item['id']) . '</span>'; } // page owner if (isset($item['owner_id']) && ($owner = Users::get($item['owner_id']))) { $owner = Users::get_link($owner['full_name'], $owner['email'], $owner['id']); } // type is provided by the overlay if (is_object($overlay)) { $type = $overlay->get_value('type', ''); } // status value if (is_object($overlay)) { $status = $overlay->get_value('status', ''); } // progress value if (is_object($overlay)) { $progress = $overlay->get_value('progress', ''); } // this is another row of the output $cells = array($id, $summary, $owner, $type, $status, $progress); // append this row $rows[] = $cells; } // end of processing SQL::free($result); // headers $headers = array(i18n::s('Number'), i18n::s('Information'), i18n::s('Owner'), i18n::s('Type'), i18n::s('Status'), i18n::s('Progress')); // return a sortable table $text .= Skin::table($headers, $rows, 'grid'); return $text; }
/** * list articles as rows in a table * * @param resource the SQL result * @return string the rendered text **/ function layout($result) { global $context; // we return some text $text = ''; // empty list if (!SQL::count($result)) { return $text; } // we list pages for one surfer // sanity check if (!isset($this->focus)) { $this->focus = Surfer::get_id(); } // build a list of articles Skin::define_img('CHECKED_IMG', 'ajax/accept.png', '*'); $rows = array(); include_once $context['path_to_root'] . 'comments/comments.php'; include_once $context['path_to_root'] . 'links/links.php'; while ($item = SQL::fetch($result)) { // get the related overlay $overlay = Overlay::load($item, 'article:' . $item['id']); // get the anchor $anchor = Anchors::get($item['anchor']); // the url to view this item $url = Articles::get_permalink($item); // reset everything $summary = $update = $owner = $editor = $watcher = ''; // signal articles to be published if (!isset($item['publish_date']) || $item['publish_date'] <= NULL_DATE || $item['publish_date'] > gmstrftime('%Y-%m-%d %H:%M:%S')) { $summary .= DRAFT_FLAG; } // signal restricted and private articles if ($item['active'] == 'N') { $summary .= PRIVATE_FLAG; } elseif ($item['active'] == 'R') { $summary .= RESTRICTED_FLAG; } // indicate the id in the hovering popup $hover = i18n::s('View the page'); if (Surfer::is_member()) { $hover .= ' [article=' . $item['id'] . ']'; } // use the title to label the link if (is_object($overlay)) { $label = Codes::beautify_title($overlay->get_text('title', $item)); } else { $label = Codes::beautify_title($item['title']); } // use the title as a link to the page $summary .= Skin::build_link($url, $label, 'basic', $hover); // signal locked articles if (isset($item['locked']) && $item['locked'] == 'Y' && Articles::is_owned($item, $anchor)) { $summary .= ' ' . LOCKED_FLAG; } // flag articles updated recently if ($item['expiry_date'] > NULL_DATE && $item['expiry_date'] <= $context['now']) { $summary .= ' ' . EXPIRED_FLAG; } elseif ($item['create_date'] >= $context['fresh']) { $summary .= ' ' . NEW_FLAG; } elseif ($item['edit_date'] >= $context['fresh']) { $summary .= ' ' . UPDATED_FLAG; } // insert overlay data, if any if (is_object($overlay)) { $summary .= $overlay->get_text('list', $item); } // attachment details $details = array(); // info on related files if ($count = Files::count_for_anchor('article:' . $item['id'], TRUE)) { $details[] = sprintf(i18n::ns('%d file', '%d files', $count), $count); } // info on related links if ($count = Links::count_for_anchor('article:' . $item['id'], TRUE)) { $details[] = sprintf(i18n::ns('%d link', '%d links', $count), $count); } // comments if ($count = Comments::count_for_anchor('article:' . $item['id'], TRUE)) { $details[] = sprintf(i18n::ns('%d comment', '%d comments', $count), $count); } // the main anchor link if (is_object($anchor) && (!isset($this->focus) || $item['anchor'] != $this->focus)) { $details[] = sprintf(i18n::s('in %s'), Skin::build_link($anchor->get_url(), ucfirst($anchor->get_title()), 'basic')); } // combine in-line details if (count($details)) { $summary .= BR . '<span class="details">' . trim(implode(' · ', $details)) . '</span>'; } // display all tags if ($item['tags']) { $summary .= BR . '<span class="tags">' . Skin::build_tags($item['tags'], 'article:' . $item['id']) . '</span>'; } // dates // $update = '<span class="details">'.join(BR, Articles::build_dates($anchor, $item)).'</span>'; // watcher if (Articles::is_watched($item['id'], $this->focus)) { $watcher = CHECKED_IMG; } // editor if (Articles::is_assigned($item['id'], $this->focus)) { $editor = CHECKED_IMG; } // owner if (isset($item['owner_id']) && $item['owner_id'] == $this->focus) { $owner = CHECKED_IMG; } // this is another row of the output // $cells = array($summary, $update, $watcher, $editor, $owner); $cells = array($summary, $watcher, $editor, $owner); // append this row $rows[] = $cells; } // end of processing SQL::free($result); // headers // $headers = array(i18n::s('Page'), i18n::s('Dates'), i18n::s('Watcher'), i18n::s('Editor'), i18n::s('Owner')); $headers = array(i18n::s('Page'), i18n::s('Watcher'), i18n::s('Editor'), i18n::s('Owner')); // return a sortable table $text .= Skin::table($headers, $rows, 'grid'); return $text; }
$content = '<form method="post" action="' . $context['script_url'] . '" id="main_form"><div>'; // name of the new virtual host $content .= '<p>' . i18n::s('Virtual host to be created') . ' <input type="text" name="id" size="30" />'; // the submit button $content .= '<input type="hidden" name="action" value="new" />' . Skin::build_submit_button(i18n::s('Create'), NULL, NULL, 'go', 'no_spin_on_click'); // end of this form $content .= '</p></div></form>'; // insert a box $context['text'] .= Skin::build_box(i18n::s('Add a new virtual host'), $content); // set the focus on the backup button Page::insert_script('$("#id").focus();'); // list available configuration files if ($items = Safe::glob($context['path_to_root'] . 'parameters/virtual_*.include.php')) { $rows = array(); foreach ($items as $item) { if (preg_match('/parameters\\/virtual_(.+).include.php/', $item, $matches)) { $link = 'control/virtual.php?id=' . urlencode($matches[1]); $menu = array(); $menu[] = '<a href="' . $context['url_to_root'] . $link . '">' . i18n::s('view') . '</a>'; $menu[] = '<a href="' . $context['url_to_root'] . $link . '&action=edit">' . i18n::s('edit') . '</a>'; $menu[] = '<a href="' . $context['url_to_root'] . $link . '&action=delete">' . i18n::s('delete') . '</a>'; $rows[] = array($matches[1], '<a href="' . $context['url_to_root'] . $link . '">' . $matches[0] . '</a>', Skin::build_list($menu, 'menu')); } } // insert a box $row_headers = array(i18n::s('Host'), i18n::s('Configuration file'), i18n::s('Commands')); $context['text'] .= Skin::build_box(i18n::s('Configured virtual hosts'), Skin::table($row_headers, $rows)); } } // render the skin render_skin();