Page MenuHomeIn-Portal Phabricator

in-portal
No OneTemporary

File Metadata

Created
Sat, Feb 1, 4:49 PM

in-portal

Index: branches/5.0.x/core/units/categories/categories_config.php
===================================================================
--- branches/5.0.x/core/units/categories/categories_config.php (revision 13327)
+++ branches/5.0.x/core/units/categories/categories_config.php (revision 13328)
@@ -1,504 +1,506 @@
<?php
/**
* @version $Id$
* @package In-Portal
* @copyright Copyright (C) 1997 - 2009 Intechnic. All rights reserved.
* @license GNU/GPL
* In-Portal is Open Source software.
* This means that this software may have been modified pursuant
* the GNU General Public License, and as distributed it includes
* or is derivative of works licensed under the GNU General Public License
* or other free or open source software licenses.
* See http://www.in-portal.org/license for copyright notices and details.
*/
defined('FULL_PATH') or die('restricted access!');
$config = Array (
'Prefix' => 'c',
'ItemClass' => Array ('class' => 'CategoriesItem', 'file' => 'categories_item.php', 'build_event' => 'OnItemBuild'),
'ListClass' => Array ('class' => 'kDBList', 'file' => '', 'build_event' => 'OnListBuild'),
'EventHandlerClass' => Array ('class' => 'CategoriesEventHandler', 'file' => 'categories_event_handler.php', 'build_event' => 'OnBuild'),
'TagProcessorClass' => Array ('class' => 'CategoriesTagProcessor', 'file' => 'categories_tag_processor.php', 'build_event' => 'OnBuild'),
'RegisterClasses' => Array (
Array ('pseudo' => 'kPermCacheUpdater', 'class' => 'kPermCacheUpdater', 'file' => 'cache_updater.php', 'build_event' => ''),
),
'ConfigPriority' => 0,
'Hooks' => Array (
Array (
'Mode' => hAFTER,
'Conditional' => false,
'HookToPrefix' => 'adm', //self
'HookToSpecial' => '*',
'HookToEvent' => Array('OnRebuildThemes'),
'DoPrefix' => '',
'DoSpecial' => '',
'DoEvent' => 'OnAfterRebuildThemes',
),
Array (
'Mode' => hBEFORE,
'Conditional' => false,
'HookToPrefix' => '',
'HookToSpecial' => '*',
'HookToEvent' => Array('OnAfterConfigRead'),
'DoPrefix' => 'cdata',
'DoSpecial' => '*',
'DoEvent' => 'OnDefineCustomFields',
),
Array (
'Mode' => hBEFORE,
'Conditional' => false,
'HookToPrefix' => 'rel',
'HookToSpecial' => '*',
'HookToEvent' => Array ('OnAfterConfigRead'),
'DoPrefix' => '',
'DoSpecial' => '*',
'DoEvent' => 'OnCloneSubItem',
),
Array (
'Mode' => hBEFORE,
'Conditional' => false,
'HookToPrefix' => 'img',
'HookToSpecial' => '*',
'HookToEvent' => Array ('OnAfterConfigRead'),
'DoPrefix' => '',
'DoSpecial' => '*',
'DoEvent' => 'OnCloneSubItem',
),
),
'AutoLoad' => true,
'CatalogItem' => true,
'AdminTemplatePath' => 'categories',
'AdminTemplatePrefix' => 'categories_',
'SearchConfigPostfix' => 'category',
'QueryString' => Array (
1 => 'id',
2 => 'Page',
3 => 'event',
4 => 'mode',
),
'AggregateTags' => Array (
Array (
'AggregateTo' => 'm',
'AggregatedTagName' => 'CategoryLink',
'LocalTagName' => 'CategoryLink',
),
),
'IDField' => 'CategoryId',
'StatusField' => Array ('Status'), // 'Status'
'TitleField' => 'Name',
'TitlePhrase' => 'la_Text_Category',
'ItemType' => 1, // used for custom fields only
'StatisticsInfo' => Array (
'pending' => Array (
'icon' => 'icon16_cat_pending.gif',
'label' => 'la_tab_Categories',
'js_url' => '#url#',
'url' => Array('t' => 'catalog/advanced_view', 'SetTab' => 'c', 'pass' => 'm,c.showall', 'c.showall_event' => 'OnSetFilterPattern', 'c.showall_filters' => 'show_active=0,show_pending=1,show_disabled=0,show_new=1,show_pick=1'),
'status' => STATUS_PENDING,
),
),
'TableName' => TABLE_PREFIX.'Category',
'ViewMenuPhrase' => 'la_text_Categories',
'CatalogTabIcon' => 'icon16_sections.png',
'TitlePresets' => Array (
'default' => Array (
'new_status_labels' => Array ('c' => '!la_title_Adding_Category!'),
'edit_status_labels' => Array ('c' => '!la_title_Editing_Category!'),
'new_titlefield' => Array ('c' => '!la_title_New_Category!'),
),
'category_list' => Array ('prefixes' => Array ('c_List'), 'format' => "!la_title_Categories! (#c_recordcount#)"),
'catalog' => Array (
'prefixes' => Array (), 'format' => "<span id='category_path'>!la_title_Categories!</span>",
'toolbar_buttons' => Array ('select', 'cancel', 'upcat', 'homecat', 'new_cat', 'new_link', 'new_article', 'new_topic', 'new_product', 'edit', 'delete', 'new_listing', 'approve', 'decline', 'cut', 'copy', 'paste', 'move_up', 'move_down', 'tools', 'view', 'dbl-click')
),
'advanced_view' => Array (
'prefixes' => Array (), 'format' => "!la_title_AdvancedView!",
'toolbar_buttons' => Array ('select', 'cancel', 'new_cat', 'new_link', 'new_article', 'new_topic', 'new_product', 'edit', 'delete', 'new_listing', 'approve', 'decline', 'view', 'dbl-click'),
),
'reviews' => Array (
'prefixes' => Array (), 'format' => "!la_title_Reviews!",
'toolbar_buttons' => Array ('edit', 'delete', 'approve', 'decline', 'view', 'dbl-click',)
),
'review_edit' => Array ('prefixes' => Array (), 'format' => "!la_title_Editing_Review!"),
'categories_edit' => Array (
'prefixes' => Array ('c'), 'format' => "#c_status# '#c_titlefield#' - !la_title_General!",
),
'categories_properties' => Array (
'prefixes' => Array ('c'), 'format' => "#c_status# '#c_titlefield#' - !la_title_Properties!",
'toolbar_buttons' => Array ('select', 'cancel', 'prev', 'next'),
),
'categories_relations' => Array (
'prefixes' => Array ('c'), 'format' => "#c_status# '#c_titlefield#' - !la_title_Relations!",
'toolbar_buttons' => Array ('select', 'cancel', 'prev', 'next', 'new_item', 'edit', 'delete', 'approve', 'decline', 'view', 'dbl-click'),
),
'categories_related_searches' => Array (
'prefixes' => Array ('c'), 'format' => "#c_status# '#c_titlefield#' - !la_title_RelatedSearches!",
'toolbar_buttons' => Array ('select', 'cancel', 'prev', 'next', 'new_item', 'edit', 'delete', 'move_up', 'move_down', 'approve', 'decline', 'view', 'dbl-click'),
),
'categories_images' => Array (
'prefixes' => Array ('c'), 'format' => "#c_status# '#c_titlefield#' - !la_title_Images!",
'toolbar_buttons' => Array ('select', 'cancel', 'prev', 'next', 'new_item', 'edit', 'delete', 'move_up', 'move_down', 'primary_image', 'view', 'dbl-click'),
),
'categories_permissions' => Array (
'prefixes' => Array ('c', 'g_List'), 'format' => "#c_status# '#c_titlefield#' - !la_title_Permissions!",
'toolbar_buttons' => Array ('select', 'cancel', 'prev', 'next'),
),
'categories_custom' => Array ('prefixes' => Array ('c'), 'format' => "#c_status# '#c_titlefield#' - !la_title_Custom!"),
'categories_update' => Array ('prefixes' => Array (), 'format' => "!la_title_UpdatingCategories!"),
'images_edit' => Array (
'prefixes' => Array ('c', 'c-img'),
'new_status_labels' => Array ('c-img' => '!la_title_Adding_Image!'),
'edit_status_labels' => Array ('c-img' => '!la_title_Editing_Image!'),
'new_titlefield' => Array ('c-img' => ''),
'format' => "#c_status# '#c_titlefield#' - #c-img_status# '#c-img_titlefield#'",
'toolbar_buttons' => Array ('select', 'cancel'),
),
'relations_edit' => Array (
'prefixes' => Array ('c', 'c-rel'),
'new_status_labels' => Array ('c-rel' => "!la_title_Adding_Relationship! '!la_title_New_Relationship!'"),
'edit_status_labels' => Array ('c-rel' => '!la_title_Editing_Relationship!'),
'format' => "#c_status# '#c_titlefield#' - #c-rel_status#",
'toolbar_buttons' => Array ('select', 'cancel'),
),
'related_searches_edit' => Array (
'prefixes' => Array ('c', 'c-search'),
'new_status_labels' => Array ('c-search' => "!la_title_Adding_RelatedSearch_Keyword!"),
'edit_status_labels' => Array ('c-search' => '!la_title_Editing_RelatedSearch_Keyword!'),
'format' => "#c_status# '#c_titlefield#' - #c-search_status#",
'toolbar_buttons' => Array ('select', 'cancel'),
),
'edit_content' => Array ('format' => '!la_EditingContent!'),
'tree_site' => Array ('format' => '!la_selecting_categories!'),
),
'EditTabPresets' => Array (
'Default' => Array (
'general' => Array ('title' => 'la_tab_General', 't' => 'categories/categories_edit', 'priority' => 1),
'properties' => Array ('title' => 'la_tab_Properties', 't' => 'categories/categories_edit_properties', 'priority' => 2),
'relations' => Array ('title' => 'la_tab_Relations', 't' => 'categories/categories_edit_relations', 'priority' => 3),
'related_searches' => Array ('title' => 'la_tab_Related_Searches', 't' => 'categories/categories_edit_related_searches', 'priority' => 4),
'images' => Array ('title' => 'la_tab_Images', 't' => 'categories/categories_edit_images', 'priority' => 5),
'permissions' => Array ('title' => 'la_tab_Permissions', 't' => 'categories/categories_edit_permissions', 'priority' => 6),
'custom' => Array ('title' => 'la_tab_Custom', 't' => 'categories/categories_edit_custom', 'priority' => 7),
),
),
'PermItemPrefix' => 'CATEGORY',
'PermSection' => Array ('main' => 'CATEGORY:in-portal:categories', /*'search' => 'in-portal:configuration_search',*/ 'email' => 'in-portal:configuration_email', 'custom' => 'in-portal:configuration_custom'),
'Sections' => Array (
'in-portal:configure_categories' => Array (
'parent' => 'in-portal:website_setting_folder',
'icon' => 'conf_output',
'label' => 'la_tab_ConfigOutput',
'url' => Array ('t' => 'config/config_universal', 'pass_section' => true, 'pass' => 'm'),
'permissions' => Array ('view', 'edit'),
'priority' => 11.1,
'type' => stTREE,
),
'in-portal:configuration_search' => Array (
'parent' => 'in-portal:website_setting_folder',
'icon' => 'conf_search',
'label' => 'la_tab_ConfigSearch',
'url' => Array ('t' => 'config/config_search', 'module_key' => 'category', 'pass_section' => true, 'pass' => 'm'),
'permissions' => Array ('view', 'edit'),
'priority' => 11.2,
'type' => stTREE,
),
'in-portal:configuration_email' => Array (
'parent' => 'in-portal:website_setting_folder',
'icon' => 'conf_email',
'label' => 'la_tab_ConfigE-mail',
'url' => Array ('t' => 'config/config_email', 'module' => 'Core:Category', 'pass_section' => true, 'pass' => 'm'),
'permissions' => Array ('view', 'edit'),
'priority' => 11.3,
'type' => stTREE,
),
'in-portal:configuration_custom' => Array (
'parent' => 'in-portal:website_setting_folder',
'icon' => 'conf_customfields',
'label' => 'la_tab_ConfigCustom',
'url' => Array ('t' => 'custom_fields/custom_fields_list', 'cf_type' => 1, 'pass_section' => true, 'pass' => 'm,cf'),
'permissions' => Array ('view', 'add', 'edit', 'delete'),
'priority' => 11.4,
'type' => stTREE,
),
),
'FilterMenu' => Array (
'Groups' => Array (
Array ('mode' => 'AND', 'filters' => Array ('show_active', 'show_pending', 'show_disabled'), 'type' => WHERE_FILTER),
Array ('mode' => 'AND', 'filters' => Array ('show_new'), 'type' => HAVING_FILTER),
Array ('mode' => 'AND', 'filters' => Array ('show_pick'), 'type' => WHERE_FILTER),
),
'Filters' => Array (
'show_active' => Array ('label' =>'la_Active', 'on_sql' => '', 'off_sql' => 'Status != 1'),
'show_pending' => Array ('label' => 'la_Pending', 'on_sql' => '', 'off_sql' => 'Status != 2'),
'show_disabled' => Array ('label' => 'la_Disabled', 'on_sql' => '', 'off_sql' => 'Status != 0'),
's1' => Array (),
'show_new' => Array ('label' => 'la_Text_New', 'on_sql' => '', 'off_sql' => '`IsNew` != 1'),
'show_pick' => Array ('label' => 'la_prompt_EditorsPick', 'on_sql' => '', 'off_sql' => '`EditorsPick` != 1'),
)
),
'ListSQLs' => Array (
'' => ' SELECT %1$s.* %2$s
FROM %1$s
LEFT JOIN '.TABLE_PREFIX.'Images img ON img.ResourceId = %1$s.ResourceId AND img.DefaultImg = 1
LEFT JOIN '.TABLE_PREFIX.'PermCache ON '.TABLE_PREFIX.'PermCache.CategoryId = %1$s.CategoryId
LEFT JOIN '.TABLE_PREFIX.'%3$sCategoryCustomData cust ON %1$s.ResourceId = cust.ResourceId'
),
'SubItems' => Array ('c-rel', 'c-search','c-img', 'c-cdata', 'c-perm', 'content'),
'ListSortings' => Array (
'' => Array (
'Sorting' => Array ('Priority' => 'desc', 'Name' => 'asc'),
)
),
'CalculatedFields' => Array (
'' => Array (
'CurrentSort' => "REPLACE(ParentPath, CONCAT('|', ".'%1$s'.".CategoryId, '|'), '')",
+ 'AltName' => 'img.AltName',
'SameImages' => 'img.SameImages',
'LocalThumb' => 'img.LocalThumb',
'ThumbPath' => 'img.ThumbPath',
'ThumbUrl' => 'img.ThumbUrl',
'LocalImage' => 'img.LocalImage',
'LocalPath' => 'img.LocalPath',
'FullUrl' => 'img.Url',
'CreatedBySystem' => 'IF(ThemeId != 0, 1, 0)',
)
),
'CacheModRewrite' => true,
'Fields' => Array (
'CategoryId' => Array ('type' => 'int', 'not_null' => 1,'default' => 0),
'Type' => Array ('type' => 'int', 'not_null' => 1,'default' => 0),
'SymLinkCategoryId' => Array ('type' => 'int', 'default' => NULL),
'ParentId' => Array ('type' => 'int', 'formatter' => 'kOptionsFormatter', 'options' => Array (), 'not_null' => 1,'default' => 0, 'required' => 1),
'Name' => Array ('type' => 'string', 'formatter' => 'kMultiLanguage', 'not_null' => 1, 'required' => 1, 'default' => ''),
'Filename' => Array ('type' => 'string', 'not_null' => 1, 'default' => ''),
'AutomaticFilename' => Array (
'type' => 'int',
'formatter' => 'kOptionsFormatter',
'options' => Array (0 => 'la_No', 1 => 'la_Yes'), 'use_phrases' => 1,
'default' => 1, 'not_null' => 1,
),
'Description' => Array ('type' => 'string', 'formatter' => 'kMultiLanguage', 'using_fck' => 1, 'default' => null),
'CreatedOn' => Array ('type' => 'int', 'formatter' => 'kDateFormatter', 'required' => 1, 'default' => '#NOW#'),
'EditorsPick' => Array (
'type' => 'int',
'formatter' => 'kOptionsFormatter',
'options' => Array (0 => 'la_No', 1 => 'la_Yes'), 'use_phrases' => 1,
'default' => 0, 'not_null' => 1,
),
'Status' => Array ('type' => 'int', 'formatter' => 'kOptionsFormatter', 'options' => Array (1 => 'la_Active', 2 => 'la_Pending', 0 => 'la_Disabled' ), 'use_phrases' => 1, 'not_null' => 1,'default' => 1),
'Priority' => Array ('type' => 'int', 'not_null' => 1, 'formatter' => 'kOptionsFormatter', 'options' => Array (), 'default' => 0),
'MetaKeywords' => Array ('type' => 'string', 'formatter' => 'kFormatter', 'using_fck' => 1, 'default' => null),
'CachedDescendantCatsQty' => Array ('type' => 'int', 'default' => 0),
'CachedNavbar' => Array ('type' => 'string', 'formatter' => 'kMultiLanguage', 'default' => null),
'CreatedById' => Array ('type' => 'int', 'formatter' => 'kLEFTFormatter', 'error_msgs' => Array ('invalid_option' => '!la_error_UserNotFound!'), 'options' => Array (-1 => 'root', -2 => 'Guest'),'left_sql'=>'SELECT %s FROM '.TABLE_PREFIX.'PortalUser WHERE `%s` = \'%s\'', 'left_key_field' => 'PortalUserId', 'left_title_field' => 'Login', 'not_null' => 1,'default' => 0),
'ResourceId' => Array ('type' => 'int', 'default' => null),
'ParentPath' => Array ('type' => 'string', 'default' => null),
'TreeLeft' => Array ('type' => 'int', 'not_null' => 1, 'default' => 0),
'TreeRight' => Array ('type' => 'int', 'not_null' => 1, 'default' => 0),
'NamedParentPath' => Array ('type' => 'string', 'default' => null),
'MetaDescription' => Array ('type' => 'string', 'formatter' => 'kFormatter', 'using_fck' => 1, 'default' => null),
'HotItem' => Array ('type' => 'int', 'formatter' => 'kOptionsFormatter', 'options' => Array (2 => 'la_Auto', 1 => 'la_Always', 0 => 'la_Never'), 'use_phrases' => 1, 'not_null' => 1, 'default' => 2),
'NewItem' => Array ('type' => 'int', 'formatter' => 'kOptionsFormatter', 'options' => Array (2 => 'la_Auto', 1 => 'la_Always', 0 => 'la_Never'), 'use_phrases' => 1, 'not_null' => 1, 'default' => 2),
'PopItem' => Array ('type' => 'int', 'formatter' => 'kOptionsFormatter', 'options' => Array (2 => 'la_Auto', 1 => 'la_Always', 0 => 'la_Never'), 'use_phrases' => 1, 'not_null' => 1, 'default' => 2),
'Modified' => Array ('type' => 'int', 'formatter' => 'kDateFormatter', 'default' => '#NOW#'),
'ModifiedById' => Array ('type' => 'int', 'formatter' => 'kLEFTFormatter', 'error_msgs' => Array ('invalid_option' => '!la_error_UserNotFound!'), 'options' => Array (-1 => 'root', -2 => 'Guest'),'left_sql'=>'SELECT %s FROM '.TABLE_PREFIX.'PortalUser WHERE `%s` = \'%s\'', 'left_key_field' => 'PortalUserId', 'left_title_field' => 'Login', 'not_null' => 1,'default' => 0),
'CachedTemplate' => Array ('type' => 'string', 'not_null' => 1, 'default' => ''),
// fields from Pages
'Template' => Array (
'type' => 'string',
'formatter' => 'kOptionsFormatter',
'options_sql' => ' SELECT CONCAT(tf.Description, " :: ", FilePath, "/", TRIM(TRAILING ".tpl" FROM FileName) ) AS Title,
IF(tf.TemplateAlias <> "", tf.TemplateAlias, CONCAT(FilePath, "/", TRIM(TRAILING ".tpl" FROM FileName))) AS Value
FROM ' . TABLE_PREFIX . 'ThemeFiles AS tf
LEFT JOIN ' . TABLE_PREFIX . 'Theme AS t ON t.ThemeId = tf.ThemeId
WHERE (t.Enabled = 1) AND (tf.FileName NOT LIKE "%%.elm.tpl") AND (tf.FileName NOT LIKE "%%.des.tpl") AND (tf.FilePath = "/designs")
ORDER BY tf.Description ASC, tf.FileName ASC',
'option_key_field' => 'Value', 'option_title_field' => 'Title',
'error_msgs' => Array (
'no_inherit' => '!la_error_NoInheritancePossible!',
),
'required' => 1, 'not_null' => 1, 'default' => CATEGORY_TEMPLATE_INHERIT
),
'UseExternalUrl' => Array (
'type' => 'int',
'formatter' => 'kOptionsFormatter',
'options' => Array (0 => 'la_No', 1 => 'la_Yes'), 'use_phrases' => 1,
'not_null' => 1, 'default' => 0,
),
'ExternalUrl' => Array ('type' => 'string', 'max_len' => 255, 'not_null' => 1, 'default' => ''),
'UseMenuIconUrl' => Array (
'type' => 'int',
'formatter' => 'kOptionsFormatter',
'options' => Array (0 => 'la_No', 1 => 'la_Yes'), 'use_phrases' => 1,
'not_null' => 1, 'default' => 0,
),
'MenuIconUrl' => Array ('type' => 'string', 'max_len' => 255, 'not_null' => 1, 'default' => ''),
'Title' => Array ('type' => 'string', 'formatter' => 'kMultiLanguage', 'default' => '', 'not_null'=>1),
'MenuTitle' => Array ('type' => 'string', 'formatter' => 'kMultiLanguage', 'not_null' => 1, 'default' => ''),
'MetaTitle' => Array ('type' => 'string', 'default' => null),
'IndexTools' => Array ('type' => 'string', 'formatter' => 'kFormatter', 'using_fck' => 1, 'default' => null),
'IsMenu' => Array ('type' => 'int', 'formatter' => 'kOptionsFormatter', 'options' => Array (1 => 'la_Show', 0 => 'la_Hide'), 'use_phrases' => 1, 'not_null' => 1, 'default' => 1),
'IsSystem' => Array ('type' => 'int', 'formatter' => 'kOptionsFormatter', 'options' => Array (1 => 'la_System', 0 => 'la_text_User'), 'use_phrases' => 1, 'not_null' => 1, 'default' => 0),
'FormId' => Array (
'type' => 'int',
'formatter' => 'kOptionsFormatter', 'options' => Array ('' => ''),
'options_sql' => 'SELECT Title, FormId FROM '.TABLE_PREFIX.'Forms ORDER BY Title',
'option_key_field' => 'FormId', 'option_title_field' => 'Title',
'default' => 0
),
'FormSubmittedTemplate' => Array ('type' => 'string', 'default' => null),
'FriendlyURL' => Array ('type' => 'string', 'not_null' => 1, 'default' => ''),
'ThemeId' => Array ('type' => 'int', 'not_null' => 1, 'default' => 0),
),
'VirtualFields' => Array (
'CurrentSort' => Array('type' => 'string', 'default' => ''),
'IsNew' => Array('type' => 'int', 'default' => 0),
'OldPriority' => Array('type' => 'int', 'default' => 0),
// for primary image
+ 'AltName' => Array('type' => 'string', 'default' => ''),
'SameImages' => Array('type' => 'string', 'default' => ''),
'LocalThumb' => Array('type' => 'string', 'default' => ''),
'ThumbPath' => Array('type' => 'string', 'default' => ''),
'ThumbUrl' => Array('type' => 'string', 'default' => ''),
'LocalImage' => Array('type' => 'string', 'default' => ''),
'LocalPath' => Array('type' => 'string', 'default' => ''),
'FullUrl' => Array('type' => 'string', 'default' => ''),
'CreatedBySystem' => Array ('type' => 'int', 'formatter' => 'kOptionsFormatter', 'options' => Array (1 => 'la_System', 0 => 'la_text_User'), 'use_phrases' => 1, 'not_null' => 1, 'default' => 0),
),
'Grids' => Array(
'Default' => Array (
'Icons' => Array( // 'StatusField' => Array ('IsSystem', 'Status', 'IsMenu'), // 'Status'
'default' => 'icon_section.png',
'1_0_0' => 'icon16_section_system.png', // system
'1_0_1' => 'icon16_section_system.png', // system
'1_1_1' => 'icon16_section_system.png', // system
'0_0_0' => 'icon16_section_disabled.png', // disabled
'0_0_1' => 'icon16_section_disabled.png', // disabled
'0_1_0' => 'icon16_section_menuhidden.png', // hidden from menu
'0_2_0' => 'icon16_section_pending.png', // pending
'0_2_1' => 'icon16_section_pending.png', // pending
'NEW' => 'icon16_section_new.png', // section is new
),
'Fields' => Array(
'CategoryId' => Array( 'title'=>'la_col_Id', 'data_block' => 'grid_checkbox_td', 'filter_block' => 'grid_range_filter', 'width' => 55),
'Name' => Array( 'title'=>'la_col_PageTitle', 'data_block' => 'page_browse_td', 'filter_block' => 'grid_like_filter', 'width' => 250),
'Priority' => Array( 'title'=>'la_col_Priority', 'filter_block' => 'grid_options_filter', 'width' => 65),
'Modified' => Array( 'title'=>'la_col_Modified', 'filter_block' => 'grid_date_range_filter', 'width' => 170),
'Template' => Array( 'title'=>'la_col_TemplateType', 'filter_block' => 'grid_options_filter', 'width' => 220),
'IsMenu' => Array( 'title'=>'la_col_InMenu', 'filter_block' => 'grid_options_filter', 'width' => 70),
'CreatedBySystem' => Array( 'title'=>'la_col_System', 'filter_block' => 'grid_options_filter', 'width' => 100),
),
),
'Radio' => Array (
'Selector' => 'radio',
'Icons' => Array( // 'StatusField' => Array ('IsSystem', 'Status', 'IsMenu'), // 'Status'
'default' => 'icon_section.png',
'1_0_0' => 'icon16_section_system.png', // system
'1_0_1' => 'icon16_section_system.png', // system
'1_1_1' => 'icon16_section_system.png', // system
'0_0_0' => 'icon16_section_disabled.png', // disabled
'0_0_1' => 'icon16_section_disabled.png', // disabled
'0_1_0' => 'icon16_section_menuhidden.png', // hidden from menu
'0_2_0' => 'icon16_section_pending.png', // pending
'0_2_1' => 'icon16_section_pending.png', // pending
'NEW' => 'icon16_section_new.png', // section is new
),
'Fields' => Array(
'CategoryId' => Array( 'title'=>'la_col_Id', 'data_block' => 'grid_radio_td', 'filter_block' => 'grid_range_filter', 'width' => 55),
'Name' => Array( 'title'=>'la_col_PageTitle', 'data_block' => 'page_browse_td', 'filter_block' => 'grid_like_filter', 'width' => 250),
'Priority' => Array( 'title'=>'la_col_Priority', 'filter_block' => 'grid_options_filter', 'width' => 75),
'IsMenu' => Array( 'title'=>'la_col_InMenu', 'filter_block' => 'grid_options_filter', 'width' => 70),
'Modified' => Array( 'title'=>'la_col_Modified', 'filter_block' => 'grid_date_range_filter', 'width' => 170),
'Template' => Array( 'title'=>'la_col_TemplateType', 'filter_block' => 'grid_options_filter', 'width' => 220),
'CreatedBySystem' => Array( 'title'=>'la_col_System', 'filter_block' => 'grid_options_filter', 'width' => 100),
),
),
'Structure' => Array (
'Icons' => Array( // 'StatusField' => Array ('IsSystem', 'Status', 'IsMenu'), // 'Status'
'default' => 'icon_section.png',
'1_0_0' => 'icon16_section_system.png', // system
'1_0_1' => 'icon16_section_system.png', // system
'1_1_1' => 'icon16_section_system.png', // system
'0_0_0' => 'icon16_section_disabled.png', // disabled
'0_0_1' => 'icon16_section_disabled.png', // disabled
'0_1_0' => 'icon16_section_menuhidden.png', // hidden from menu
'0_2_0' => 'icon16_section_pending.png', // pending
'0_2_1' => 'icon16_section_pending.png', // pending
'NEW' => 'icon16_section_new.png', // section is new
),
'Fields' => Array(
'CategoryId' => Array( 'title'=>'la_col_Id', 'data_block' => 'grid_checkbox_td', 'filter_block' => 'grid_range_filter', 'width' => 55),
'Name' => Array( 'title'=>'la_col_PageTitle', 'data_block' => 'page_browse_td', 'filter_block' => 'grid_like_filter', 'width' => 250),
'Priority' => Array( 'title'=>'la_col_Priority', 'filter_block' => 'grid_options_filter', 'width' => 75),
'IsMenu' => Array( 'title'=>'la_col_InMenu', 'filter_block' => 'grid_options_filter', 'width' => 70),
'Path' => Array( 'title'=>'la_col_Path', 'data_block' => 'page_entercat_td', 'filter_block' => 'grid_like_filter'),
'Modified' => Array( 'title'=>'la_col_Modified', 'filter_block' => 'grid_date_range_filter', 'width' => 170),
'Template' => Array( 'title'=>'la_col_TemplateType', 'filter_block' => 'grid_options_filter', 'width' => 220),
'CreatedBySystem' => Array( 'title'=>'la_col_System', 'filter_block' => 'grid_options_filter', 'width' => 100),
),
),
),
'ConfigMapping' => Array (
'PerPage' => 'Perpage_Category',
'ShortListPerPage' => 'Perpage_Category_Short',
'DefaultSorting1Field' => 'Category_Sortfield',
'DefaultSorting2Field' => 'Category_Sortfield2',
'DefaultSorting1Dir' => 'Category_Sortorder',
'DefaultSorting2Dir' => 'Category_Sortorder2',
),
);
\ No newline at end of file
Index: branches/5.0.x/core/units/images/image_tag_processor.php
===================================================================
--- branches/5.0.x/core/units/images/image_tag_processor.php (revision 13327)
+++ branches/5.0.x/core/units/images/image_tag_processor.php (revision 13328)
@@ -1,478 +1,482 @@
<?php
/**
* @version $Id$
* @package In-Portal
* @copyright Copyright (C) 1997 - 2009 Intechnic. All rights reserved.
* @license GNU/GPL
* In-Portal is Open Source software.
* This means that this software may have been modified pursuant
* the GNU General Public License, and as distributed it includes
* or is derivative of works licensed under the GNU General Public License
* or other free or open source software licenses.
* See http://www.in-portal.org/license for copyright notices and details.
*/
class ImageTagProcessor extends kDBTagProcessor {
/**
* Prepares all image parameters as list block parameters (for easy usage)
*
* @param kDBList $object
* @param Array $block_params
* @author Alex
*/
function PrepareListElementParams(&$object, &$block_params)
{
$image_url = $this->ImageSrc($block_params);
if (!$image_url) {
return ;
}
$parent_prefix = $this->Application->getUnitOption($object->Prefix, 'ParentPrefix');
$parent_item =& $this->Application->recallObject($parent_prefix);
$block_params['img_path'] = $image_url;
$image_dimensions = $this->ImageSize($block_params);
$block_params['img_size'] = $image_dimensions ? $image_dimensions : ' width="'.$block_params['DefaultWidth'].'"';
$block_params['alt'] = $object->GetField('AltName')? $object->GetField('AltName') : htmlspecialchars($this->getItemTitle($parent_item));
$block_params['align'] = array_key_exists('align', $block_params) ? $block_params['align'] : 'left';
}
/**
* Returns value of object's title field
*
* @param kDBItem $object
* @return string
*/
function getItemTitle(&$object)
{
$title_field = $this->Application->getUnitOption($object->Prefix, 'TitleField');
return $object->GetField($title_field);
}
/**
* [AGGREGATED TAGS] works as <inp2:CatalogItemPrefix_Image, ImageSize, ImageSrc ..../>
*
* @param Array $params
* @return string
*/
function ItemImageTag($params)
{
$this->LoadItemImage($params);
return $this->$params['original_tag']($params);
}
function LargeImageExists($params)
{
$object =& $this->getObject($params);
if ($object->GetDBField('SameImages') == null || $object->GetDBField('SameImages') == 1) {
return false;
}
else {
return true;
}
}
function LoadItemImage($params)
{
$parent_item =& $this->Application->recallObject($params['PrefixSpecial']);
/* @var $parent_item kCatDBItem */
$object =& $this->Application->recallObject($this->getPrefixSpecial(), null, Array('skip_autoload' => true));
/* @var $object kDBItem */
$object->Clear();
// if we need primary thumbnail which is preloaded with category item's list
$is_primary = $this->SelectParam($params, 'primary,Primary');
$image_id = $this->Application->GetVar($this->Prefix.'_id');
if (
// is primary, when primary mark set OR name & field not given
($is_primary || !(isset($params['name']) || isset($params['field']))) &&
// primary image is preloaded AND direct id not given
isset($parent_item->Fields['ThumbPath']) && !$image_id
) {
$object->SetDefaultValues();
if (is_null($parent_item->GetDBField('SameImages'))) {
// JOIN definetly failed, because it's not-null column
$object->Loaded = false;
}
else {
$object->SetDBField('Url', $parent_item->GetDBField('FullUrl'));
- $object->SetDBField('AltName', $this->getItemTitle($parent_item));
- $object->SetDBFieldsFromHash($parent_item->GetFieldValues(), Array('SameImages', 'LocalThumb', 'ThumbPath', 'ThumbUrl', 'LocalImage', 'LocalPath'));
+ $object->SetDBFieldsFromHash($parent_item->GetFieldValues(), Array('AltName', 'SameImages', 'LocalThumb', 'ThumbPath', 'ThumbUrl', 'LocalImage', 'LocalPath'));
+
+ if (!$object->GetDBField('AltName')) {
+ $object->SetDBField('AltName', $this->getItemTitle($parent_item));
+ }
+
$object->Loaded = true;
}
}
else { // if requested image is not primary thumbnail - load it directly
$id_field = $this->Application->getUnitOption($this->Prefix, 'ForeignKey');
$parent_table_key = $this->Application->getUnitOption($this->Prefix, 'ParentTableKey');
$keys[$id_field] = $parent_item->GetDBField($parent_table_key);
// which image to load?
if ($is_primary) {
// by PrimaryImage mark
$keys['DefaultImg'] = 1;
}
elseif (getArrayValue($params, 'name')) {
// by ImageName
$keys['Name'] = $params['name'];
}
elseif (getArrayValue($params, 'field')) {
// by virtual field name in main object
$field_options = $parent_item->GetFieldOptions($params['field']);
$keys['Name'] = isset($field_options['original_field']) ? $field_options['original_field'] : $params['field'];
}
elseif ($image_id) {
// by ID
$keys['ImageId'] = $image_id;
}
else {
// by PrimaryImage if no other criteria given
$keys['DefaultImg'] = 1;
}
$object->Load($keys);
if (isset($params['field'])) {
$image_src = $parent_item->GetDBField($params['field']);
// when image is uploaded to virtual field in main item, but not saved to db
$object->SetDBField('ThumbPath', $image_src);
if (!$object->isLoaded() && $image_src) {
// set fields for displaing new image during main item suggestion with errors
$fields_hash = Array (
'Url' => '',
'ThumbUrl' => '',
'LocalPath' => '',
'SameImages' => 1,
'LocalThumb' => 1,
'LocalImage' => 1,
);
$object->SetDBFieldsFromHash($fields_hash);
$object->Loaded = true;
}
}
}
}
function getImageDimension($type, $params)
{
$ret = isset($params['Max'.$type]) ? $params['Max'.$type] : false;
if (!$ret) {
return $ret;
}
$parent_prefix = $this->Application->getUnitOption($this->Prefix, 'ParentPrefix');
if ($ret == 'thumbnail') {
$ret = $this->Application->ConfigValue($parent_prefix.'_ThumbnailImage'.$type);
}
if ($ret == 'fullsize') {
$ret = $this->Application->ConfigValue($parent_prefix.'_FullImage'.$type);
}
return $ret;
}
/**
* Appends "/" to beginning of image path (in case when missing)
*
* @param kDBItem $object
* @todo old in-portal doesn't append first slash, but we do => append first slash for him :)
*/
function makeRelativePaths(&$object)
{
$thumb_path = $object->GetDBField('ThumbPath');
if ($thumb_path && substr($thumb_path, 0, 1) != '/') {
$object->SetDBField('ThumbPath', '/'.$thumb_path);
}
$local_path = $object->GetDBField('LocalPath');
if ($local_path && substr($local_path, 0, 1) != '/') {
$object->SetDBField('LocalPath', '/'.$local_path);
}
}
function ImageSrc($params)
{
$object =& $this->getObject($params);
/* @var $object kDBItem */
$this->makeRelativePaths($object);
// show "noimage.gif" when requested image is missing OR was not uploaded
$use_default_image = !(defined('DBG_IMAGE_RECOVERY') && DBG_IMAGE_RECOVERY);
$src_image_url = $this->_getImageUrl($params);
$src_image = $this->_getImagePath($src_image_url);
if (!$object->isLoaded() || ($src_image_url && $src_image)) {
// we can auto-resize image, when it is stored locally
$max_width = $this->getImageDimension('Width', $params);
$max_height = $this->getImageDimension('Height', $params);
$format = array_key_exists('format', $params) ? $params['format'] : false;
if (!$max_width && $format) {
// user watermarks from format param
$max_width = $format;
}
if ($max_width > 0 || $max_height > 0 || $format) {
list ($max_width, $max_height) = $this->_transformParams($params, $max_width, $max_height);
if ($object->isLoaded() && file_exists($src_image)) {
$image_helper =& $this->Application->recallObject('ImageHelper');
/* @var $image_helper ImageHelper */
return $image_helper->ResizeImage($src_image, $max_width, $max_height);
}
elseif ($use_default_image) {
return $this->_getDefaultImage($params, $max_width, $max_height);
}
return $src_image_url;
}
}
if ($src_image_url) {
// convert full url to full path!
$dst_image = $this->_getImagePath($src_image_url);
$image_found = $dst_image ? file_exists($dst_image) : true;
if ($image_found) {
// image isn't deleted OR is stored on remote location
return $src_image_url;
}
}
// return Default Image or false if NOT specified (only for case, when SameImages = 0)
return $use_default_image ? $this->_getDefaultImage($params) : $src_image_url;
}
/**
* Get location on disk for images, stored locally and false for remote images
*
* @param string $src_image
* @return string
*/
function _getImagePath($src_image)
{
if (!$src_image) {
return false;
}
$base_url = rtrim($this->Application->BaseURL(), '/');
$dst_image = preg_replace('/^' . preg_quote($base_url, '/') . '/', FULL_PATH, $src_image, 1);
return $dst_image != $src_image ? $dst_image : false;
}
function _getImageUrl($params)
{
$object =& $this->getObject($params);
/* @var $object kDBItem */
$base_url = rtrim($this->Application->BaseURL(), '/');
// if we need thumbnail, or full image is same as thumbnail
$show_thumbnail = $this->SelectParam($params, 'thumbnail,Thumbnail') || // old style
(isset($params['MaxWidth']) && $params['MaxWidth'] == 'thumbnail') || // new style
(isset($params['MaxHeight']) && $params['MaxHeight'] == 'thumbnail');
if ($show_thumbnail || $object->GetDBField('SameImages')) {
// return local image or url
$ret = $object->GetDBField('LocalThumb') ? $base_url . $object->GetDBField('ThumbPath') : $object->GetDBField('ThumbUrl');
}
else { // if we need full which is not the same as thumb
$ret = $object->GetDBField('LocalImage') ? $base_url . $object->GetDBField('LocalPath') : $object->GetDBField('Url');
}
return $ret == $base_url ? '' : $ret;
}
/**
* Transforms Image/ImageSrc aggregated tag parameters into ones, that ResizeImage method understands
*
* @param Array $params
* @param int $max_width
* @param int $max_height
* @return Array
*/
function _transformParams($params, $max_width = false, $max_height = false)
{
$resize_format = 'resize:' . $max_width . 'x' . $max_height;
$crop = $this->SelectParam($params, 'Crop,crop');
if ($crop) {
if (strpos($crop, ';') === false) {
$crop = 'c|c';
}
$max_width = (is_null($max_height) ? $max_width : $resize_format) . ';crop:' . $crop;
$max_height = null;
}
$fill = $this->SelectParam($params, 'Fill,fill');
if ($fill) {
$max_width = (is_null($max_height) ? $max_width : $resize_format) . ';fill:' . $fill;
$max_height = null;
}
$watermark = $this->SelectParam($params, 'Watermark,watermark');
if ($watermark) {
$max_width = (is_null($max_height) ? $max_width : $resize_format) . ';wm:' . $watermark;
$max_height = null;
}
return Array ($max_width, $max_height);
}
/**
* Returns default full url to default images
*
* @param Array $params
* @param int $max_width
* @param int $max_height
* @return string
*/
function _getDefaultImage($params, $max_width = false, $max_height = false)
{
$default_image = $this->SelectParam($params, 'default_image,DefaultImage');
if (!$default_image) {
return '';
}
// show default image, use different base urls for admin and front-end
$base_url = rtrim($this->Application->BaseURL(), '/');
$sub_folder = $this->Application->isAdmin ? rtrim(IMAGES_PATH, '/') : THEMES_PATH;
if (($max_width !== false) || ($max_height !== false)) {
$image_helper =& $this->Application->recallObject('ImageHelper');
/* @var $image_helper ImageHelper */
$src_image = FULL_PATH . $sub_folder . '/' . $default_image;
return $image_helper->ResizeImage($src_image, $max_width, $max_height);
}
return $base_url . $sub_folder . '/' . $default_image;
}
function getFullPath($path)
{
if (!$path) {
return $path;
}
// absolute url
if (preg_match('/^(.*):\/\/(.*)$/U', $path)) {
return preg_replace('/^'.preg_quote($this->Application->BaseURL(), '/').'(.*)/', FULL_PATH.'/\\1', $path);
}
// relative url
return FULL_PATH.'/'.mb_substr(THEMES_PATH, 1).'/'.$path;
}
/**
* Makes size clause for img tag, such as
* ' width="80" height="100"' according to max_width
* and max_heght limits.
*
* @param array $params
* @return string
*/
function ImageSize($params)
{
$img_path = $this->getFullPath($params['img_path']);
$image_helper =& $this->Application->recallObject('ImageHelper');
/* @var $image_helper ImageHelper */
$max_width = $this->getImageDimension('Width', $params);
$max_height = $this->getImageDimension('Height', $params);
$image_dimensions = $image_helper->GetImageDimensions($img_path, $max_width, $max_height, $params);
if (!$image_dimensions) {
return false;
}
return ' width="'.$image_dimensions[0].'" height="'.$image_dimensions[1].'"';
}
/**
* Prepares image parameters & parses block with them (for admin)
*
* @param Array $params
* @return string
*/
function Image($params)
{
$image_url = $this->ImageSrc($params);
if (!$image_url) {
return ;
}
$object =& $this->getObject($params);
$params['img_path'] = $image_url;
$image_dimensions = $this->ImageSize($params);
$params['img_size'] = $image_dimensions ? $image_dimensions : ' width="'.$params['DefaultWidth'].'"';
$params['alt'] = htmlspecialchars($object->GetField('AltName')); // really used ?
$params['name'] = $this->SelectParam($params, 'block,render_as');
$params['align'] = array_key_exists('align', $params) ? $params['align'] : 'left';
$params['no_editing'] = 1;
if (!$object->isLoaded() && !$this->SelectParam($params, 'default_image,DefaultImage')) {
return false;
}
return $this->Application->ParseBlock($params);
}
/**
* Returns url for image in case when image source is url (for admin)
*
* @param Array $params
* @return string
*/
function ImageUrl($params)
{
$object =& $this->getObject($params);
if ($object->GetDBField('SameImages') ? $object->GetDBField('LocalThumb') : $object->GetDBField('LocalImage') ) {
$ret = $this->Application->Phrase(getArrayValue($params,'local_phrase'));
}
else {
$ret = $object->GetDBField('SameImages') ? $object->GetDBField('ThumbUrl') : $object->GetDBField('Url');
}
return $ret;
}
/**
* If data was modfied & is in TempTables mode, then parse block with name passed;
* remove modification mark if not in TempTables mode
*
* @param Array $params
* @return string
* @access public
* @author Alexey
*/
function SaveWarning($params)
{
if ($this->Prefix == 'c-img') {
return $this->Application->ProcessParsedTag('c', 'SaveWarning', $params);
}
return parent::SaveWarning($params);
}
}
\ No newline at end of file

Event Timeline