Esempio n. 1
0
 function __construct(&$source, $criteria = array())
 {
     $criteria = $source->makeCriteria($criteria);
     $this->_source_array = array_combine_key(array_keys(AMPContent_Lookup::instance('galleryMap')), $source->search($criteria));
     $this->_init_renderer($source);
     $this->_tree = new AMP_System_Data_Tree($source);
 }
Esempio n. 2
0
 function _formFooter()
 {
     $renderer =& AMP_get_renderer();
     $current_section_edit_link = false;
     $current_class_edit_link = false;
     $base_footer = '&nbsp;&nbsp;<a href="' . AMP_Url_AddVars(AMP_SYSTEM_URL_ARTICLE, array('nosearch=1')) . '" class="standout">' . sprintf(AMP_TEXT_VIEW_ALL, AMP_pluralize(ucfirst(AMP_TEXT_ARTICLE))) . '</a>';
     //sectional edit link
     $current_section = isset($_REQUEST['section']) && $_REQUEST['section'] ? $_REQUEST['section'] : false;
     if (!$current_section) {
         $current_section = isset($_REQUEST['type']) && $_REQUEST['type'] ? $_REQUEST['type'] : false;
     }
     if ($current_section) {
         $section_names = AMPContent_Lookup::instance('sections');
         $section_name = isset($section_names[$current_section]) ? $section_names[$current_section] : false;
         $current_section_edit_link = $renderer->separator() . $renderer->link(AMP_Url_AddVars(AMP_SYSTEM_URL_SECTION, array('id=' . $current_section)), $renderer->image(AMP_SYSTEM_ICON_EDIT, array('width' => '16', 'height' => '16', 'border' => 0)) . $renderer->space() . AMP_TEXT_EDIT . $renderer->space() . AMP_TEXT_SECTION . $renderer->space() . AMP_trimText($section_name, 20, false));
     }
     //class edit link
     $current_class = isset($_REQUEST['class']) && $_REQUEST['class'] ? $_REQUEST['class'] : false;
     if ($current_class) {
         $class_names = AMPContent_Lookup::instance('classes');
         $class_name = isset($class_names[$current_class]) ? $class_names[$current_class] : false;
         $current_class_edit_link = $renderer->separator() . $renderer->link(AMP_Url_AddVars(AMP_SYSTEM_URL_CLASS, array('id=' . $current_class)), $renderer->image(AMP_SYSTEM_ICON_EDIT, array('width' => '16', 'height' => '16', 'border' => 0)) . $renderer->space() . AMP_TEXT_EDIT . $renderer->space() . AMP_TEXT_CLASS . $renderer->space() . AMP_trimText($class_name, 20, false));
     }
     return $base_footer . $current_section_edit_link . $current_class_edit_link . $renderer->newline();
 }
Esempio n. 3
0
 function render_toolbar_gallery(&$toolbar)
 {
     $gallery_options =& AMPContent_Lookup::instance('galleries');
     $gallery_options = array('' => sprintf(AMP_TEXT_SELECT, AMP_TEXT_GALLERY)) + $gallery_options;
     $panel_contents = $this->_renderer->select('gallery_id', null, $gallery_options, array('class' => 'searchform_element'));
     return $toolbar->add_panel('gallery', $panel_contents);
 }
Esempio n. 4
0
 function _getClassName($class_id)
 {
     $classNames = AMPContent_Lookup::instance('class');
     if (!isset($classNames[$class_id])) {
         return false;
     }
     return $classNames[$class_id];
 }
Esempio n. 5
0
 function render_toolbar_publish(&$toolbar)
 {
     $section_options =& AMPContent_Lookup::instance('sectionMap');
     $section_options = array('' => 'Select Section') + $section_options;
     $class_options =& AMPContent_Lookup::instance('classes');
     $content = $this->_renderer->span(AMP_TEXT_PUBLISH_TO . ':&nbsp;', array('class' => 'searchform_label')) . AMP_buildSelect('section_id', $section_options, null, $this->_renderer->makeAttributes(array('class' => 'searchform_element'))) . '&nbsp;' . AMP_buildSelect('class_id', $class_options, 1, $this->_renderer->makeAttributes(array('class' => 'searchform_element'))) . '&nbsp;';
     return $toolbar->addTab('publish', $content);
 }
Esempio n. 6
0
 function addCriteriaPublic()
 {
     $protected_sections = AMPContent_Lookup::instance('protectedSections');
     if (empty($protected_sections)) {
         return;
     }
     $this->addCriteria('type not in( ' . join(',', array_keys($protected_sections)) . ' )');
 }
Esempio n. 7
0
 function render_type($source)
 {
     $faq_types =& AMPContent_Lookup::instance('faqTypes');
     if (!isset($faq_types[$source->getType()])) {
         return false;
     }
     return $faq_types[$source->getType()];
 }
Esempio n. 8
0
 function renderPublish(&$toolbar)
 {
     $renderer =& $this->_getRenderer();
     $section_options =& AMPContent_Lookup::instance('sectionMap');
     $section_options = array('' => 'Select Section') + $section_options;
     $class_options =& AMPContent_Lookup::instance('classes');
     $toolbar->addEndContent($renderer->inDiv('<a name="publish_targeting"></a>' . $renderer->inSpan(AMP_TEXT_PUBLISH_TO . ':&nbsp;', array('class' => 'searchform_label')) . AMP_buildSelect('section_id', $section_options, null, $renderer->makeAttributes(array('class' => 'searchform_element'))) . '&nbsp;' . AMP_buildSelect('class_id', $class_options, 1, $renderer->makeAttributes(array('class' => 'searchform_element'))) . '&nbsp;' . $toolbar->renderDefault('publish') . '&nbsp;' . "<input type='button' name='hidePublish' value='Cancel' onclick='window.change_any( \"publish_targeting\");'>&nbsp;", array('class' => 'AMPComponent_hidden', 'id' => 'publish_targeting')), 'publish_targeting');
     return "<input type='button' name='showPublish' value='Publish' onclick='window.change_any( \"publish_targeting\");window.scrollTo( 0, document.anchors[\"publish_targeting\"].y );'>&nbsp;";
 }
Esempio n. 9
0
 function commit_update()
 {
     require_once 'AMP/Content/RSS/Subscription/Subscription.php';
     $current_subscription_list =& AMPContent_Lookup::instance('RSS_Subscriptions');
     foreach ($current_subscription_list as $subscription_id => $subscription_name) {
         $sub = new RSS_Subscription(AMP_Registry::getDbcon(), $subscription_id);
         $sub->update();
     }
     AMP_flush_common_cache();
     ampredirect(AMP_SYSTEM_URL_RSS_AGGREGATOR);
 }
Esempio n. 10
0
 function addCriteriaSection($section_id)
 {
     if (!is_numeric($section_id)) {
         return false;
     }
     $sections =& AMPContent_Lookup::instance('sections');
     if (!isset($sections[$section_id])) {
         return false;
     }
     $this->addCriteria('type=' . $section_id);
 }
Esempio n. 11
0
 function render_toolbar_move(&$toolbar)
 {
     $gallery_options =& AMPContent_Lookup::instance('galleryMap');
     if ($gallery_options) {
         $gallery_options = array('' => 'Select Gallery') + $gallery_options;
     } else {
         $gallery_options = array('' => AMP_TEXT_NONE_AVAILABLE);
     }
     $panel_contents = $this->_renderer->select('gallery_id', null, $gallery_options, array('class' => 'searchform_element'));
     return $toolbar->add_panel('move', $panel_contents);
 }
Esempio n. 12
0
 function render_toolbar_move(&$toolbar)
 {
     $section_options =& AMPContent_Lookup::instance('sectionMap');
     if ($section_options) {
         $section_options = array('' => 'Select Section', AMP_CONTENT_MAP_ROOT_SECTION => '__' . AMP_SITE_NAME . '__') + $section_options;
     } else {
         $section_options = array('' => 'Select Section', AMP_CONTENT_MAP_ROOT_SECTION => AMP_SITE_NAME);
     }
     $panel_contents = $this->_renderer->select('section_id', null, $section_options, array('class' => 'searchform_element'));
     return $toolbar->add_panel('move', $panel_contents);
 }
Esempio n. 13
0
 function getNavName()
 {
     if (!($navid = $this->getNavId())) {
         return false;
     }
     $nav_names =& AMPContent_Lookup::instance('navs');
     if (isset($nav_names[$navid])) {
         return $nav_names[$navid];
     }
     return false;
 }
Esempio n. 14
0
 function getFeedName()
 {
     $feed_id = $this->getSubscriptionId();
     if (!$feed_id) {
         return false;
     }
     $names_lookup =& AMPContent_Lookup::instance('RSS_Subscriptions');
     if (isset($names_lookup[$feed_id])) {
         return $names_lookup[$feed_id];
     }
     return $feed_id;
 }
Esempio n. 15
0
 function renderMove(&$toolbar)
 {
     $renderer =& $this->_getRenderer();
     $type_options =& AMPContent_Lookup::instance('linkTypeMap');
     if ($type_options) {
         $type_options = array('' => 'Select Link Type') + $type_options;
     } else {
         $type_options = array('' => 'Select Link Type');
     }
     $toolbar->addEndContent($renderer->inDiv('<a name="move_targeting"></a>' . AMP_buildSelect('link_type_id', $type_options, null, $renderer->makeAttributes(array('class' => 'searchform_element'))) . '&nbsp;' . $toolbar->renderDefault('move') . '&nbsp;' . "<input type='button' name='hideMove' value='Cancel' onclick='window.change_any( \"move_targeting\");'>&nbsp;", array('class' => 'AMPComponent_hidden', 'id' => 'move_targeting')), 'move_targeting');
     return "<input type='button' name='showMove' value='Move' onclick='window.change_any( \"move_targeting\");'>&nbsp;";
 }
Esempio n. 16
0
 function _describeLayoutAnchor($id)
 {
     $lookup_set = array(AMP_TEXT_PUBLIC_PAGE => AMPContent_Lookup::instance('navLayoutsByIntrotext'), AMP_TEXT_CLASS => AMPContent_Lookup::instance('navLayoutsByClass'), AMP_TEXT_SECTION => AMPContent_Lookup::instance('navLayoutsBySection'), AMP_TEXT_SECTION_LIST => AMPContent_Lookup::instance('navLayoutsBySectionList'));
     $lookup_names_set = array(AMP_TEXT_PUBLIC_PAGE => AMPContent_Lookup::instance('introTexts'), AMP_TEXT_CLASS => AMPContent_Lookup::instance('classes'), AMP_TEXT_SECTION => AMPContent_Lookup::instance('sections'), AMP_TEXT_SECTION_LIST => AMPContent_Lookup::instance('sections'));
     foreach ($lookup_set as $description => $values) {
         if (!isset($values[$id])) {
             continue;
         }
         return sprintf(AMP_TEXT_CONTENT_NAV_LAYOUT_HEADER, ucwords($description), $lookup_names_set[$description][$values[$id]]);
     }
     return false;
 }
Esempio n. 17
0
 function renderMove(&$toolbar)
 {
     $renderer =& $this->_getRenderer();
     $section_options =& AMPContent_Lookup::instance('sectionMap');
     if ($section_options) {
         $section_options = array('' => 'Select Section', AMP_CONTENT_MAP_ROOT_SECTION => '__' . AMP_SITE_NAME . '__') + $section_options;
     } else {
         $section_options = array('' => 'Select Section', AMP_CONTENT_MAP_ROOT_SECTION => AMP_SITE_NAME);
     }
     $toolbar->addEndContent($renderer->inDiv('<a name="move_targeting"></a>' . AMP_buildSelect('section_id', $section_options, null, $renderer->makeAttributes(array('class' => 'searchform_element'))) . '&nbsp;' . $toolbar->renderDefault('move') . '&nbsp;' . "<input type='button' name='hideMove' value='Cancel' onclick='window.change_any( \"move_targeting\");'>&nbsp;", array('class' => 'AMPComponent_hidden', 'id' => 'move_targeting')), 'move_targeting');
     //return "<input type='button' name='showMove' value='Move' onclick='window.change_any( \"move_targeting\");window.scrollTo( 0, document.anchors[\"move_targeting\"].y );'>&nbsp;";
     return "<input type='button' name='showMove' value='Move' onclick='window.change_any( \"move_targeting\");\$( \"move_targeting\").scrollTo();'>&nbsp;";
 }
Esempio n. 18
0
 function output()
 {
     if (!($class_set =& AMPContent_Lookup::instance('activeClasses'))) {
         return false;
     }
     $output = "";
     foreach ($class_set as $id => $name) {
         $output .= $this->_renderer->link(AMP_Url_AddVars(AMP_SYSTEM_URL_ARTICLE, array('class' => 'class=' . $id, 'AMPSearch' => 'AMPSearch=1')), $name) . $this->_renderer->newline();
         //$output .= '<a href = "article_list.php?class='. $id . '">'. $name . "</a><BR>\n";
         //$output .= '<a href = "article_list.php?class='. $class_id . '">'. $class_set[ $class_id ] . "</a> ( ".  $class_count ." ) <BR>\n";
     }
     return $output;
 }
Esempio n. 19
0
 function onInitForm(&$controller)
 {
     $form =& $controller->get_form();
     if ($section_def = $form->getField('section') && !empty($this->public_permitted_sections)) {
         $section_values =& AMPContent_Lookup::instance('sectionMap');
         $allowed_sections = array_combine_key($this->public_permitted_sections, $section_values);
         $allowed_ordered_sections = array_combine_key($section_values, $allowed_sections);
         $form->setFieldValueSet('section', $allowed_ordered_sections);
     }
     if ($class_def = $form->getField('class') && !empty($this->public_permitted_classes)) {
         $class_values =& AMPContent_Lookup::instance('classes');
         $allowed_classes = array_combine_key($this->public_permitted_classes, $class_values);
         $form->setFieldValueSet('class', $allowed_classes);
     }
 }
Esempio n. 20
0
 function buildMap()
 {
     $sql = "Select " . join(", ", $this->fields) . " from articletype " . " where id != " . AMP_CONTENT_SECTION_ID_TOOL_PAGES . " order by " . $this->getParentFieldSql() . ", textorder, id DESC";
     if (AMP_DISPLAYMODE_DEBUG) {
         AMP_debugSQL($sql, 'content_map');
     }
     $this->dataset =& $this->dbcon->CacheGetAssoc($sql);
     $this->childset =& AMPContent_Lookup::instance('sectionParents');
     //$this->top = $this->find_top( $this->top );
     if ($this->find_top($this->top) != $this->top) {
         foreach ($this->top_set as $topchild) {
             $this->childset[$topchild] = $this->top;
             $this->dataset[$topchild]['parent'] = $this->top;
         }
     }
     $this->buildLevel($this->top);
 }
Esempio n. 21
0
 function _showSheetLocations(&$source, $fieldname)
 {
     $filename = $source->getName();
     $section_locations = AMPContentLookup_StylesheetLocationSections::instance($filename);
     $template_locations = AMPContentLookup_StylesheetLocationTemplates::instance($filename);
     if (!($section_locations || $template_locations)) {
         return false;
     }
     $section_names = AMPContent_Lookup::instance('sections');
     $template_names = AMPSystem_Lookup::instance('templates');
     $output = '';
     if ($section_locations) {
         $output .= $this->_renderSheetLocations($section_locations, $section_names, AMP_TEXT_SECTION, AMP_SYSTEM_URL_SECTION);
     }
     if ($template_locations) {
         $output .= $this->_renderSheetLocations($template_locations, $template_names, AMP_TEXT_TEMPLATE, AMP_SYSTEM_URL_TEMPLATE);
     }
     return $output;
 }
Esempio n. 22
0
 function _processBody($body)
 {
     $htmlbody = $body;
     if (!$this->_article->isHtml()) {
         $htmlbody = converttext($body);
     }
     // link hot words
     if ($hw =& AMPContent_Lookup::instance('hotwords')) {
         $htmlbody = str_replace(array_keys($hw), array_values($hw), $htmlbody);
     }
     //insert sidebar
     if ($sb = $this->_article->getSidebar()) {
         $find = '[-sidebar-]';
         if (!($sb_class = $this->_article->getSidebarClass())) {
             $sb_class = AMP_CONTENT_SIDEBAR_CLASS_DEFAULT;
         }
         $replace = '<div class="' . $sb_class . '">' . nl2br($sb) . '</div>';
         $htmlbody = str_replace($find, $replace, $htmlbody);
     }
     return $this->_HTML_bodyText($htmlbody);
 }
Esempio n. 23
0
 function onInitForm(&$controller)
 {
     if ($id = $controller->assert_var('id')) {
         return false;
     }
     $permitted_names = array('introtext_id' => 'introTexts', 'section_id' => 'sections', 'section_id_list' => 'sections', 'class_id' => 'classes');
     foreach ($permitted_names as $request_var => $name_lookup_tag) {
         $request_value = $controller->assert_var($request_var);
         if (!$request_value) {
             continue;
         }
         $form =& $controller->get_form();
         $form->setDefaultValue($request_var, $request_value);
         $name_lookup =& AMPContent_Lookup::instance($name_lookup_tag);
         if (!isset($name_lookup[$request_value])) {
             continue;
         }
         $name_value = $name_lookup[$request_value];
         if ($request_var == 'section_id_list') {
             $name_value .= ' ' . ucfirst(AMP_TEXT_LIST);
         }
         $form->setDefaultValue('name', $name_value);
     }
 }
Esempio n. 24
0
 function makeCriteriaPublic()
 {
     $protected_sections = AMPContent_Lookup::instance('protectedSections');
     if (empty($protected_sections)) {
         return false;
     }
     return 'type not in( ' . join(',', array_keys($protected_sections)) . ' )';
 }
Esempio n. 25
0
 function &instance($partial_title = null)
 {
     if (!isset($partial_title)) {
         return parent::instance('title');
     }
     static $lookup = false;
     if (!$lookup) {
         $lookup = new AMPContentLookup_Title($partial_title);
     } else {
         $lookup->setCriteriaPartialName($partial_title);
         $lookup->init();
     }
     return $lookup->dataset;
 }
Esempio n. 26
0
<?php

if (file_exists_incpath('custom.sources.inc.php')) {
    include_once 'custom.sources.inc.php';
}
$class_names =& AMPContent_Lookup::instance('class');
if (!defined('AMP_TEXT_SECTIONLIST_ARTICLES_FEATURES') && defined('AMP_CONTENT_CLASS_FEATURE')) {
    define('AMP_TEXT_SECTIONLIST_ARTICLES_FEATURES', sprintf(AMP_TEXT_SECTIONLIST_ARTICLES_FEATURES_TEMPLATE, $class_names[AMP_CONTENT_CLASS_FEATURE]));
}
if (!defined('AMP_TEXT_SECTIONLIST_ARTICLES_PLUS_CLASS') && defined('AMP_CONTENT_SECTION_PLUS_CLASS')) {
    define('AMP_TEXT_SECTIONLIST_ARTICLES_PLUS_CLASS', sprintf(AMP_TEXT_SECTIONLIST_ARTICLES_PLUS_CLASS_TEMPLATE, $class_names[AMP_CONTENT_SECTION_PLUS_CLASS]));
}
Esempio n. 27
0
 function _HTML_gallerySelect()
 {
     $sel_attr = array('class' => 'go', 'onchange' => 'AMP_openURL( "' . AMP_SITE_URL . AMP_CONTENT_URL_GALLERY . '?gal="+this.value );');
     return AMP_buildSelect('gallery_jump', AMPContent_Lookup::instance('galleryMap'), $this->_gallery->id, $this->_HTML_makeAttributes($sel_attr));
 }
Esempio n. 28
0
 function renderGallery(&$toolbar)
 {
     $renderer =& $this->_getRenderer();
     $gallery_options =& AMPContent_Lookup::instance('galleries');
     $gallery_options = array('' => sprintf(AMP_TEXT_SELECT, AMP_TEXT_GALLERY)) + $gallery_options;
     $toolbar->addEndContent($renderer->inDiv('<a name="gallery_targeting"></a>' . AMP_buildSelect('gallery_id', $gallery_options, null, $renderer->makeAttributes(array('class' => 'searchform_element'))) . '&nbsp;' . $toolbar->renderDefault('gallery') . '&nbsp;' . "<input type='button' name='hideGallery' value='" . AMP_TEXT_CANCEL . "' onclick='window.change_any( \"gallery_targeting\");'>&nbsp;", array('class' => 'AMPComponent_hidden', 'id' => 'gallery_targeting')), 'gallery_targeting');
     return "<input type='button' name='showGallery' value='" . AMP_TEXT_GALLERY . "' onclick='window.change_any( \"gallery_targeting\");if ( \$(\"recalculate_sizes\").style.display==\"block\") window.change_any( \"recalculate_sizes\" );window.scrollTo( 0, document.anchors[\"gallery_targeting\"].y );'>&nbsp;";
 }
Esempio n. 29
0
 function _readLayoutAnchor()
 {
     $result = false;
     if ($section_id = $this->getSectionId()) {
         $names_lookup = AMPContent_Lookup::instance('sections');
         $result = array('description' => AMP_TEXT_SECTION, 'id' => $section_id, 'name' => $names_lookup[$section_id], 'class' => 'Section');
     }
     if ($section_id_list = $this->getSectionIdList()) {
         $names_lookup = AMPContent_Lookup::instance('sections');
         $result = array('description' => AMP_TEXT_SECTION_LIST, 'id' => $section_id_list, 'name' => $names_lookup[$section_id_list], 'class' => 'Section');
     }
     if ($class_id = $this->getClassId()) {
         $names_lookup = AMPContent_Lookup::instance('classes');
         $result = array('description' => AMP_TEXT_CLASS, 'id' => $class_id, 'name' => $names_lookup[$class_id], 'class' => 'ContentClass');
     }
     if ($publicpage_id = $this->getPublicPageId()) {
         $names_lookup = AMPContent_Lookup::instance('introtexts');
         $result = array('description' => AMP_TEXT_PUBLIC_PAGE, 'id' => $publicpage_id, 'name' => $names_lookup[$publicpage_id], 'class' => 'AMPSystem_IntroText');
     }
     $this->mergeData(array('layout_anchor' => $result));
 }
Esempio n. 30
0
 function _renderSectionHeader($article)
 {
     $section_header_lookup = AMPContent_Lookup::instance('sectionHeaders');
     $section_id = array_search($article->id, $section_header_lookup);
     if (!$section_id) {
         return false;
     }
     $section_url = AMP_SITE_URL . AMP_Url_AddVars(AMP_CONTENT_URL_ARTICLE, array('list=type', 'type=' . $section_id));
     $section_names_lookup = AMP_lookup('sections');
     $section_name = isset($section_names_lookup[$section_id]) ? $section_names_lookup[$section_id] : false;
     return $this->_renderer->inSpan(AMP_TEXT_SECTION_HEADER . ': ' . $this->_renderer->link($section_url, $section_name, array('target' => 'blank'))) . $this->_renderer->newline();
 }