Index: branches/5.2.x/units/articles/articles_config.php =================================================================== --- branches/5.2.x/units/articles/articles_config.php (revision 16310) +++ branches/5.2.x/units/articles/articles_config.php (revision 16311) @@ -1,571 +1,576 @@ 'n', 'ItemClass' => Array ('class' => 'kCatDBItem', 'file' => '', 'build_event' => 'OnItemBuild'), 'ListClass' => Array ('class' => 'kCatDBList', 'file' => '', 'build_event' => 'OnListBuild'), 'EventHandlerClass' => Array ('class' => 'ArticlesEventHandler', 'file' => 'articles_event_handler.php', 'build_event' => 'OnBuild'), 'TagProcessorClass' => Array ('class' => 'ArticlesTagProcessor', 'file' => 'articles_tag_processor.php', 'build_event' => 'OnBuild'), 'AutoLoad' => true, 'ConfigPriority' => 0, 'RewritePriority' => 102, 'RewriteListener' => 'CategoryItemRewrite:RewriteListener', 'Hooks' => Array ( Array ( 'Mode' => hBEFORE, 'Conditional' => false, 'HookToPrefix' => 'c', 'HookToSpecial' => '*', 'HookToEvent' => Array ('OnAfterConfigRead'), 'DoPrefix' => '', 'DoSpecial' => '', 'DoEvent' => 'OnUpdateCategoryCustomFields', ), Array ( 'Mode' => hBEFORE, 'Conditional' => false, 'HookToPrefix' => '', 'HookToSpecial' => '*', 'HookToEvent' => Array ('OnAfterConfigRead'), 'DoPrefix' => 'cdata', 'DoSpecial' => '*', 'DoEvent' => 'OnDefineCustomFields', ), Array ( 'Mode' => hBEFORE, 'Conditional' => false, 'HookToPrefix' => '#file', 'HookToSpecial' => '*', 'HookToEvent' => Array ('OnAfterConfigRead'), 'DoPrefix' => '', 'DoSpecial' => '*', 'DoEvent' => 'OnCloneSubItem', ), Array ( 'Mode' => hBEFORE, 'Conditional' => false, 'HookToPrefix' => 'rev', 'HookToSpecial' => '*', 'HookToEvent' => Array ('OnAfterConfigRead'), 'DoPrefix' => '', 'DoSpecial' => '*', 'DoEvent' => 'OnCloneSubItem', ), Array ( 'Mode' => hBEFORE, 'Conditional' => false, 'HookToPrefix' => 'fav', 'HookToSpecial' => '*', 'HookToEvent' => Array ('OnAfterConfigRead'), 'DoPrefix' => '', 'DoSpecial' => '*', 'DoEvent' => 'OnCloneSubItem', ), 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', ), Array ( 'Mode' => hBEFORE, 'Conditional' => false, 'HookToPrefix' => 'ci', 'HookToSpecial' => '*', 'HookToEvent' => Array ('OnAfterConfigRead'), 'DoPrefix' => '', 'DoSpecial' => '*', 'DoEvent' => 'OnCloneSubItem', ), ), 'CatalogItem' => true, 'AdminTemplatePath' => 'articles', 'AdminTemplatePrefix' => 'articles_', 'SearchConfigPostfix' => 'articles', 'QueryString' => Array ( 1 => 'id', 2 => 'Page', 3 => 'PerPage', 4 => 'event', 5 => 'mode', ), 'ScheduledTasks' => Array( 'update_rss_articles' => Array('EventName' => 'OnUpdateRSSArticles', 'RunSchedule' => '* * * * *'), ), 'IDField' => 'NewsId', 'StatusField' => Array ('Status'), // field, that is affected by Approve/Decline events 'TitleField' => 'Title', // field, used in bluebar when editing existing item 'TitlePhrase' => 'la_Text_Article', // phrase used to specify item type in relationship list 'TitlePresets' => Array ( 'default' => Array ( 'new_status_labels' => Array ('n' => '!la_title_AddingArticle!'), 'edit_status_labels' => Array ('n' => '!la_title_EditingArticle!'), 'new_titlefield' => Array ('n' => '!la_title_NewArticle!'), ), 'articles_edit' => Array ('prefixes' => Array ('n'), 'format' => "#n_status# '#n_titlefield#' - !la_title_General!"), 'articles_categories' =>Array ('prefixes' => Array ('n', 'n-ci_List'), 'format' => "#n_status# '#n_titlefield#' - !la_title_Categories!"), 'articles_relations' => Array ('prefixes' => Array ('n'), 'format' => "#n_status# '#n_titlefield#' - !la_title_Relations!"), 'articles_images' => Array ('prefixes' => Array ('n'), 'format' => "#n_status# '#n_titlefield#' - !la_title_Images!"), 'articles_files' => Array ('prefixes' => Array ('n'), 'format' => "#n_status# '#n_titlefield#' - !la_title_Files!"), 'articles_reviews' => Array ('prefixes' => Array ('n'), 'format' => "#n_status# '#n_titlefield#' - !la_title_Reviews!"), 'articles_custom' => Array ('prefixes' => Array ('n'), 'format' => "#n_status# '#n_titlefield#' - !la_title_Custom!"), 'images_edit' => Array ( 'prefixes' => Array ('n', 'n-img'), 'new_status_labels' => Array ('n-img' => '!la_title_Adding_Image!'), 'edit_status_labels' => Array ('n-img' => '!la_title_Editing_Image!'), 'new_titlefield' => Array ('n-img' => '!la_title_New_Image!'), 'format' => "#n_status# '#n_titlefield#' - #n-img_status# '#n-img_titlefield#'", ), 'file_edit' => Array ( 'prefixes' => Array ('n', 'n-file'), 'new_status_labels' => Array ('n-file' => "!la_title_AddingFile!"), 'edit_status_labels' => Array ('n-file' => '!la_title_EditingFile!'), 'new_titlefield' => Array ('n-file' => '!la_title_NewFile!'), 'format' => "#n_status# '#n_titlefield#' - #n-file_status# '#n-file_titlefield#'", ), 'reviews_edit' => Array ( 'prefixes' => Array ('n', 'n-rev'), 'new_status_labels' => Array ('n-rev' =>"!la_title_Adding_Review! '!la_title_New_Review!'"), 'edit_status_labels' => Array ('n-rev' => '!la_title_Editing_Review!'), 'format' => "#n_status# '#n_titlefield#' - #n-rev_status#", ), 'relations_edit' => Array ( 'prefixes' => Array ('n', 'n-rel'), 'new_status_labels' => Array ('n-rel' =>"!la_title_Adding_Relationship! '!la_title_New_Relationship!'"), 'edit_status_labels' => Array ('n-rel' => '!la_title_Editing_Relationship!'), 'format' => "#n_status# '#n_titlefield#' - #n-rel_status#", ), 'tree_in-news' => Array ('format' => '!la_Text_Version! '.$this->Application->findModule('Name', 'In-News', 'Version')), 'articles_export' => Array ('format' => '!la_title_ArticlesExport!'), 'articles_import' => Array ('format' => '!la_title_ImportArticles!'), ), 'EditTabPresets' => Array ( 'Default' => Array ( Array ('title' => 'la_tab_General', 't' => 'in-news/articles/articles_edit', 'priority' => 1), Array ('title' => 'la_tab_Categories', 't' => 'in-news/articles/articles_categories', 'priority' => 2), Array ('title' => 'la_tab_Relations', 't' => 'in-news/articles/articles_relations', 'priority' => 3), Array ('title' => 'la_tab_Images', 't' => 'in-news/articles/articles_images', 'priority' => 4), Array ('title' => 'la_tab_Files', 't' => 'in-news/articles/articles_files', 'priority' => 5), Array ('title' => 'la_tab_Reviews', 't' => 'in-news/articles/articles_reviews', 'priority' => 6), Array ('title' => 'la_tab_Custom', 't' => 'in-news/articles/articles_custom', 'priority' => 7), ), ), 'PermItemPrefix' => 'NEWS', 'PermTabText' => 'In-News', 'PermSection' => Array ('main' => 'CATEGORY:in-news:articles_list', 'search' => 'in-news:configuration_search', 'custom' => 'in-news:configuration_custom'), 'Sections' => Array ( /*'in-news' => Array ( 'parent' => 'in-portal:root', 'icon' => 'settings_in-newz', 'label' => 'la_title_In-News', 'url' => Array ('t' => 'index', 'pass_section' => true, 'pass' => 'm'), 'permissions' => Array ('view'), 'priority' => 3.2, 'container' => true, 'type' => stTREE, ),*/ 'in-news:articles' => Array ( 'parent' => 'in-portal:site', 'icon' => 'articles', 'label' => 'la_tab_Articles', 'url' => Array ('t' => 'catalog/advanced_view', 'anchor' => 'tab-n.showall', 'pass' => 'm'), 'onclick' => 'setCatalogTab(\'n.showall\')', 'permissions' => Array ('view'), 'priority' => 3.3, 'type' => stTREE, ), // article settings 'in-news:setting_folder' => Array ( 'parent' => 'in-portal:system', 'icon' => 'conf_news', 'label' => 'la_title_In-News', 'use_parent_header' => 1, 'url' => Array ('t' => 'index', 'pass_section' => true, 'pass' => 'm'), 'permissions' => Array ('view'), 'priority' => 3.4, 'container' => true, 'type' => stTREE, ), /*'in-news:innews_general' => Array ( 'parent' => 'in-news:setting_folder', 'icon' => 'core:settings_general', 'label' => 'la_tab_GeneralSettings', 'url' => Array ('t' => 'config/config_general', 'pass_section' => true, 'pass' => 'm'), 'permissions' => Array ('view', 'add', 'edit'), 'priority' => 0.9, 'type' => stTREE, ),*/ 'in-news:configuration_output' => Array ( 'parent' => 'in-news:setting_folder', 'icon' => 'core:conf_output', 'label' => 'la_tab_ConfigOutput', 'url' => Array ('t' => 'config/config_general', 'pass_section' => true, 'pass' => 'm'), 'permissions' => Array ('view', 'add', 'edit'), 'priority' => 1, 'type' => stTREE, ), 'in-news:configuration_search' => Array ( 'parent' => 'in-news:setting_folder', 'icon' => 'core:conf_search', 'label' => 'la_tab_ConfigSearch', 'url' => Array ('t' => 'config/config_search', 'module_key' => 'articles', 'pass_section' => true, 'pass' => 'm'), 'permissions' => Array ('view', 'edit'), 'priority' => 2, 'type' => stTREE, ), 'in-news:configuration_custom' => Array ( 'parent' => 'in-news:setting_folder', 'icon' => 'core:conf_customfields', 'label' => 'la_tab_ConfigCustom', 'url' => Array ('t' => 'custom_fields/custom_fields_list', 'cf_type' => 2, 'pass_section' => true, 'pass' => 'm,cf'), 'permissions' => Array ('view', 'add', 'edit', 'delete'), 'priority' => 3, 'type' => stTREE, ), ), 'FilterMenu' => Array ( 'Groups' => Array ( Array ('mode' => 'AND', 'filters' => Array ('show_new'), 'type' => kDBList::HAVING_FILTER), Array ('mode' => 'AND', 'filters' => Array ('show_hot'), 'type' => kDBList::HAVING_FILTER), Array ('mode' => 'AND', 'filters' => Array ('show_pop'), 'type' => kDBList::HAVING_FILTER), Array ('mode' => 'AND', 'filters' => Array ('show_pick'), 'type' => kDBList::WHERE_FILTER), ), 'Filters' => Array ( 'show_new' => Array ('label' => 'la_Text_New', 'on_sql' => '', 'off_sql' => '`IsNew` != 1' ), 'show_hot' => Array ('label' => 'la_Text_Hot', 'on_sql' => '', 'off_sql' => '`IsHot` != 1' ), 'show_pop' => Array ('label' => 'la_Text_Pop', 'on_sql' => '', 'off_sql' => '`IsPop` != 1' ), 'show_pick' => Array ('label' => 'la_prompt_EditorsPick', 'on_sql' => '', 'off_sql' => '%1$s.`EditorsPick` != 1' ), ), ), 'CatalogSelectorName' => 'newslist', 'ItemPropertyMappings' => Array ( 'NewDays' => 'News_CatNewDays', // number of days item to be NEW 'MinPopVotes' => 'News_MinPopVotes', // minimum number of votes for an item to be POP 'MinPopRating' => 'News_MinPopRating',// minimum rating for an item to be POP 'MaxHotNumber' => 'News_MaxHotNumber',// maximum number of HOT items 'HotLimit' => 'News_HotLimit', // variable name in inp_Cache table 'ClickField' => 'Hits', // item click count is stored here (in item table) ), 'ItemType' => 2, // this is used when relation to product is added from in-portal and via-versa 'ViewMenuPhrase' => 'la_title_Articles', 'CatalogTabIcon' => 'in-news:icon16_articles.png', 'UsePendingEditing' => true, // item editing is controlled by NEWS.ADD/EDIT, NEWS.ADD/EDIT.PENDING permissions 'StatisticsInfo' => Array ( 'pending' => Array ( 'icon' => 'icon16_article_pending.gif', 'label' => 'la_Text_Articles', 'js_url' => '#url#', 'url' => Array ('t' => 'catalog/advanced_view', 'SetTab' => 'n', 'pass' => 'm,n.showall', 'n.showall_event' => 'OnSetFilterPattern', 'n.showall_filters' => 'show_active=0,show_pending=1,show_disabled=0,show_new=1,show_hot=1,show_pop=1,show_pick=1'), 'status' => STATUS_PENDING, ), ), 'TableName' => TABLE_PREFIX.'News', 'CustomDataTableName' => TABLE_PREFIX . 'NewsCustomData', 'CalculatedFields' => Array ( '' => Array ( 'UserName' => 'IF (ISNULL(u.Username), IF (%1$s.CreatedById = ' . USER_ROOT . ', "root", IF (%1$s.CreatedById = ' . USER_GUEST . ', "Guest", "n/a")), IF(u.Username = "", u.Email, u.Username))', 'CategoryId' => TABLE_PREFIX.'%3$sCategoryItems.CategoryId', 'Filename' => TABLE_PREFIX.'%3$sCategoryItems.Filename', 'CategoryFilename' => TABLE_PREFIX.'Categories.NamedParentPath', 'PrimaryCat' => TABLE_PREFIX.'%3$sCategoryItems.PrimaryCat', 'ParentPath' => TABLE_PREFIX.'Categories.ParentPath', 'AltName' => 'img.AltName', 'SameImages' => 'img.SameImages', 'LocalThumb' => 'img.LocalThumb', 'ThumbPath' => 'img.ThumbPath', 'ThumbUrl' => 'img.ThumbUrl', 'LocalImage' => 'img.LocalImage', 'LocalPath' => 'img.LocalPath', 'FullUrl' => 'img.Url', ), ), 'CacheModRewrite' => true, 'ListSQLs' => Array ( '' => ' SELECT %1$s.* %2$s FROM %1$s LEFT JOIN '.TABLE_PREFIX.'%3$sCategoryItems ON '.TABLE_PREFIX.'%3$sCategoryItems.ItemResourceId = %1$s.ResourceId LEFT JOIN '.TABLE_PREFIX.'Categories ON '.TABLE_PREFIX.'Categories.CategoryId = '.TABLE_PREFIX.'%3$sCategoryItems.CategoryId LEFT JOIN '.TABLE_PREFIX.'%3$sCatalogImages img ON img.ResourceId = %1$s.ResourceId AND img.DefaultImg = 1 {PERM_JOIN} LEFT JOIN '.TABLE_PREFIX.'Users u ON %1$s.CreatedById = u.PortalUserId LEFT JOIN '.TABLE_PREFIX.'%3$sNewsCustomData cust ON %1$s.ResourceId = cust.ResourceId', ), // key - special, value - list select sql 'ListSortings' => Array ( '' => Array ( 'ForcedSorting' => Array ('EditorsPick' => 'desc', 'Priority' => 'desc'), 'Sorting' => Array ('Title' => 'asc'), ) ), 'ItemSQLs' => Array ( '' => ' SELECT %1$s.* %2$s FROM %1$s LEFT JOIN '.TABLE_PREFIX.'%3$sCategoryItems ON '.TABLE_PREFIX.'%3$sCategoryItems.ItemResourceId = %1$s.ResourceId LEFT JOIN '.TABLE_PREFIX.'Categories ON '.TABLE_PREFIX.'Categories.CategoryId = '.TABLE_PREFIX.'%3$sCategoryItems.CategoryId LEFT JOIN '.TABLE_PREFIX.'%3$sCatalogImages img ON img.ResourceId = %1$s.ResourceId AND img.DefaultImg = 1 LEFT JOIN '.TABLE_PREFIX.'Users u ON %1$s.CreatedById = u.PortalUserId LEFT JOIN '.TABLE_PREFIX.'%3$sNewsCustomData cust ON %1$s.ResourceId = cust.ResourceId'), 'SubItems' => Array ('n-rev', 'n-ci', 'n-rel', 'n-img', 'n-cdata', 'n-fav', 'n-file'), 'Fields' => Array ( 'NewsId' => Array ('type' => 'int', 'not_null' => 1, 'default' => 0,), 'Title' => Array ('type' => 'string', /*'formatter' => 'kMultiLanguage', */'not_null' => 1, 'required' => 1, 'default' => '', 'max_len' => 255), 'AutomaticFilename' => Array ( 'type' => 'int', 'formatter' => 'kOptionsFormatter', 'options' => Array (0 => 'la_No', 1 => 'la_Yes'), 'use_phrases' => 1, 'not_null' => 1, 'default' => 1, ), 'Excerpt' => Array ('type' => 'string', /*'formatter' => 'kMultiLanguage',*/ 'default' => null), 'Author' => Array ('type' => 'string', 'not_null' => 1, 'default' => ''), 'Body' => Array ('type' => 'string', 'formatter' => 'kFormatter',/*'kMultiLanguage'*/ 'using_fck' => 1, 'required' => 1, 'default' => null), 'CreatedOn' => Array ('type' => 'int', 'formatter' => 'kDateFormatter', 'required' => 1, 'default' => '#NOW#'), 'TextFormat' => Array ('type' => 'int', 'not_null' => 1, 'default' => 0), 'EndOn' => Array ('type' => 'int', 'formatter' => 'kDateFormatter', 'default' => null), 'Hits' => Array ('type' => 'double', 'formatter' => 'kFormatter', 'format' => '%d', 'not_null' => 1, 'default' => 0), 'CachedRating' => Array ('type' => 'string', 'default' => 0), 'CachedVotesQty' => Array ('type' => 'int', 'not_null' => 1, 'default' => 0), 'CreatedById' => Array ( 'type' => 'int', 'formatter' => 'kLEFTFormatter', 'options' => Array (USER_ROOT => 'root', USER_GUEST => 'Guest'), 'left_sql' => 'SELECT %s FROM ' . TABLE_PREFIX . 'Users WHERE %s', 'left_key_field' => 'PortalUserId', 'left_title_field' => USER_TITLE_FIELD, 'error_msgs' => Array ('invalid_option' => '!la_error_UserNotFound!'), 'sample_value' => 'Guest', 'required' => 1, 'default' => NULL, ), 'Priority' => Array ('type' => 'int', 'not_null' => 1, 'default' => 0), 'Status' => Array ( 'type' => 'int', 'formatter' => 'kOptionsFormatter', 'options' => Array (1 => 'la_Active', 2 => 'la_Pending', 0 => 'la_Disabled'), 'use_phrases' => 1, 'not_null' => 1, 'default' => 2, ), 'EditorsPick' => Array ( 'type' => 'int', 'formatter' => 'kOptionsFormatter', 'options' => Array (1 => 'la_Yes', 0 => 'la_No'), 'use_phrases' => 1, 'not_null' => 1, 'default' => 0, ), 'LeadStory' => Array ( 'type' => 'int', 'formatter' => 'kOptionsFormatter', 'options' => Array (1 => 'la_Yes', 0 => 'la_No'), 'use_phrases' => 1, 'not_null' => 1, 'default' => 0, ), 'LeadCatStory' => Array ( 'type' => 'int', 'formatter' => 'kOptionsFormatter', 'options' => Array (1 => 'la_Yes', 0 => 'la_No'), 'use_phrases' => 1, 'not_null' => 1, 'default' => 0, ), 'ResourceId' => Array ('type' => 'int', 'default' => null), 'CachedReviewsQty' => Array ('type' => 'int', 'not_null' => 1, 'default' => 0), 'StartDate' => Array ('type' => 'int', 'formatter' => 'kDateFormatter', 'required' => 1, 'default' => '#NOW#'), '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), '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), 'Archived' => Array ('type' => 'int', 'formatter' => 'kOptionsFormatter', 'options' => Array (1 => 'la_Yes', 2 => 'la_No'), 'use_phrases' => 1, 'not_null' => 1, 'default' => 0), 'Modified' => Array ('type' => 'int', 'formatter' => 'kDateFormatter', 'default' => '#NOW#'), 'ModifiedById' => Array ('type' => 'int', 'formatter' => 'kLEFTFormatter', 'error_msgs' => Array ('invalid_option' => '!la_error_UserNotFound!'), 'options' => Array (USER_ROOT => 'root', USER_GUEST => 'Guest'), 'left_sql' => 'SELECT %s FROM '.TABLE_PREFIX.'Users WHERE %s', 'left_key_field' => 'PortalUserId', 'left_title_field' => USER_TITLE_FIELD, 'default' => NULL), 'OrgId' => Array ('type' => 'int', 'default' => null), 'MetaKeywords' => Array ('type' => 'string', 'default' => null), 'MetaDescription' => Array ('type' => 'string', 'formatter' => 'kFormatter', 'using_fck' => 1, 'default' => null), ), 'VirtualFields' => Array ( 'Relevance' => Array ('type' => 'float', 'default' => 0), 'MoreCategories' => Array ('type' => 'string', 'default' => ''), 'UserName' => Array ('type' => 'string', 'default' => ''), 'CategoryId' => Array ('type' => 'int', 'formatter' => 'kOptionsFormatter', 'options' => Array (), 'default' => 0), 'cust_RssOriginalURL' => Array ('type' => 'string', 'default' => ''), 'cust_RssArticleCRC' => Array ('type' => 'int', 'default' => 0), 'Filename' => Array ('type' => 'string', 'default' => ''), 'CategoryFilename' => Array ('type' => 'string', 'default' => ''), 'PrimaryCat' => Array ('type' => 'int', 'default' => 0), 'IsHot' => Array ('type' => 'int', 'default' => 0), 'IsNew' => Array ('type' => 'int', 'default' => 0), 'IsPop' => Array ('type' => 'int', 'default' => 0), 'CachedNavbar' => Array ('type' => 'string', 'default' => ''), 'ParentPath' => Array ('type' => 'string', 'default' => ''), + 'GenerateExcerpt' => array( + 'type' => 'int', + 'formatter' => 'kOptionsFormatter', 'options' => array(1 => 'la_Yes', 0 => 'la_No'), 'use_phrases' => 1, + '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' => ''), // export related fields: begin 'ExportFormat' => Array ('type' => 'int', 'formatter' => 'kOptionsFormatter', 'options' => Array (1 => 'CSV', /*2 => 'XML'*/), 'default' => 1), 'ExportFilename' => Array ('type' => 'string', 'default' => ''), 'FieldsSeparatedBy' => Array ('type' => 'string', 'default' => ','), 'FieldsEnclosedBy' => Array ('type' => 'string', 'default' => '"'), 'LineEndings' => Array ('type' => 'int', 'formatter' => 'kOptionsFormatter', 'options' => Array (1 => 'Windows', 2 => 'UNIX'), 'default' => 1), 'LineEndingsInside' => Array ('type' => 'int', 'formatter' => 'kOptionsFormatter', 'options' => Array (1 => 'CRLF', 2 => 'LF'), 'default' => 2), 'IncludeFieldTitles' => Array ( 'type' => 'int', 'formatter' => 'kOptionsFormatter', 'options' => Array (0 => 'la_No', 1 => 'la_Yes'), 'use_phrases' => 1, 'default' => 1, ), 'ExportColumns' => Array ('type' => 'string', 'formatter' => 'kOptionsFormatter', 'options' => Array (), 'default' => ''), 'AvailableColumns' => Array ('type' => 'string', 'formatter' => 'kOptionsFormatter', 'options' => Array (), 'default' => ''), 'CategoryFormat' => Array ('type' => 'int', 'formatter' => 'kOptionsFormatter', 'options' => Array (1 => 'la_MixedCategoryPath', 2 => 'la_SeparatedCategoryPath'), 'use_phrases' => 1, 'default' => 1), 'CategorySeparator' => Array ('type' => 'string', 'default' => ':'), 'IsBaseCategory' => Array ( 'type' => 'int', 'formatter' => 'kOptionsFormatter', 'options' => Array (0 => 'la_No', 1 => 'la_Yes'), 'use_phrases' => 1, 'default' => 0, ), // export related fields: end // import related fields: begin 'FieldTitles' => Array ('type' => 'int', 'formatter' => 'kOptionsFormatter', 'options' => Array (1 => 'la_Automatic', 2 => 'la_Manual'), 'use_phrases' => 1, 'default' => 1), 'ImportSource' => Array ('type' => 'int', 'formatter' => 'kOptionsFormatter', 'options' => Array (1 => 'la_Upload', 2 => 'la_Local'), 'use_phrases' => 1, 'default' => 2), 'ImportFilename' => Array ('type' => 'string', 'formatter' => 'kUploadFormatter', 'max_size' => MAX_UPLOAD_SIZE, 'upload_dir' => EXPORT_BASE_PATH . '/', 'default' => ''), 'ImportLocalFilename' => Array ('type' => 'string', 'formatter' => 'kOptionsFormatter', 'default' => ''), 'CheckDuplicatesMethod' => Array ('type' => 'int', 'formatter' => 'kOptionsFormatter', 'options' => Array (1 => 'la_IDField', 2 => 'la_OtherFields'), 'use_phrases' => 1, 'default' => 1), 'ReplaceDuplicates' => Array ('type' => 'int', 'formatter' => 'kOptionsFormatter', 'options' => Array (0 => 'la_No', 1 => 'la_Yes'), 'use_phrases' => 1, 'default' => 0), 'DuplicateCheckFields' => Array ('type' => 'string', 'formatter' => 'kOptionsFormatter', 'options' => Array ('Title' => 'TITLE'), 'default' => '|Title|'), 'SkipFirstRow' => Array ('type' => 'int', 'formatter' => 'kOptionsFormatter', 'options' => Array (1 => 'la_Yes', 0 => 'la_No'), 'use_phrases' => 1, 'default' => 1), // import related fields: end ), 'Grids' => Array ( 'Default' => Array ( 'Icons' => Array ( 0 => 'icon16_article_disabled.png', 1 => 'icon16_article.png', 2 => 'icon16_article_pending.png', 'NEW' => 'icon16_article_new.png', ), 'Fields' => Array ( 'NewsId' => Array ('title' => 'column:la_fld_Id', 'data_block' => 'grid_checkbox_td', 'filter_block' => 'grid_range_filter', 'width' => 60, ), 'Title' => Array ('data_block' => 'grid_catitem_td', 'filter_block' => 'grid_like_filter', 'width' => 200, ), 'Priority' => Array('filter_block' => 'grid_range_filter', 'width' => 65), 'UserName' => Array ('title' => 'column:la_fld_Author', 'filter_block' => 'grid_like_filter', 'width' => 100, ), 'LeadStory' => Array ('filter_block' => 'grid_options_filter', 'width' => 80, ), 'LeadCatStory' => Array ('filter_block' => 'grid_options_filter', 'width' => 85, ), 'Status' => Array ('filter_block' => 'grid_options_filter', 'width' => 70, ), 'CreatedOn' => Array ('filter_block' => 'grid_date_range_filter', 'width' => 140, ), 'StartDate' => Array ('filter_block' => 'grid_date_range_filter', 'width' => 140, ), 'EndOn' => Array ('data_block' => 'article_expire_td', 'filter_block' => 'grid_date_range_filter', 'width' => 140, ), ), ), 'Radio' => Array ( 'Icons' => Array ( 0 => 'icon16_article_disabled.png', 1 => 'icon16_article.png', 2 => 'icon16_article_pending.png', -2 => 'icon16_article_pending.png', // pending DUPLICATE item 'NEW' => 'icon16_article_new.gif', ), 'Selector' => 'radio', 'Fields' => Array ( 'NewsId' => Array ('title' => 'column:la_fld_Id', 'data_block' => 'grid_radio_td', 'filter_block' => 'grid_range_filter', 'width' => 60, ), 'Title' => Array ('data_block' => 'grid_catitem_td', 'filter_block' => 'grid_like_filter', 'width' => 200, ), 'Priority' => Array('filter_block' => 'grid_range_filter', 'width' => 65), 'UserName' => Array ('title' => 'column:la_fld_Author', 'filter_block' => 'grid_like_filter', 'width' => 100, ), 'LeadStory' => Array ('filter_block' => 'grid_options_filter', 'width' => 80, ), 'LeadCatStory' => Array ('filter_block' => 'grid_options_filter', 'width' => 85, ), 'Status' => Array ('filter_block' => 'grid_options_filter', 'width' => 70, ), 'CreatedOn' => Array ('filter_block' => 'grid_date_range_filter', 'width' => 140, ), 'StartDate' => Array ('filter_block' => 'grid_date_range_filter', 'width' => 140, ), 'EndOn' => Array ('data_block' => 'article_expire_td', 'filter_block' => 'grid_date_range_filter', 'width' => 140, ), ), ), ), 'ConfigMapping' => Array ( 'PerPage' => 'Perpage_News', 'ShortListPerPage' => 'Perpage_News_Short', 'ForceEditorPick' => 'News_ShowPick', 'DefaultSorting1Field' => 'News_SortField', 'DefaultSorting2Field' => 'News_SortField2', 'DefaultSorting1Dir' => 'News_SortOrder', 'DefaultSorting2Dir' => 'News_SortOrder2', 'RatingDelayValue' => 'News_RatingDelay_Value', 'RatingDelayInterval' => 'News_RatingDelay_Interval', ), ); Index: branches/5.2.x/units/articles/articles_event_handler.php =================================================================== --- branches/5.2.x/units/articles/articles_event_handler.php (revision 16310) +++ branches/5.2.x/units/articles/articles_event_handler.php (revision 16311) @@ -1,575 +1,575 @@ getObject(); /* @var $object kDBList */ if ( !$this->Application->isAdminUser ) { $where_clause = '(Archived = 0) AND (StartDate < ' . adodb_mktime() . ' OR StartDate = 0) AND (EndOn > ' . adodb_mktime() . ' OR EndOn IS NULL)'; $object->addFilter('archived_filter', $where_clause); } } /** * Return type clauses for list bulding on front * * @param kEvent $event * @return Array */ function getTypeClauses($event) { $type_clauses = parent::getTypeClauses($event); $type_clauses['site_lead']['include']='%1$s.LeadStory = 1 AND '.TABLE_PREFIX.'CategoryItems.PrimaryCat = 1'; $type_clauses['site_lead']['except']='%1$s.LeadStory <> 1 AND '.TABLE_PREFIX.'CategoryItems.PrimaryCat = 1'; $type_clauses['site_lead']['having_filter'] = false; $type_clauses['cat_lead']['include']='%1$s.LeadCatStory = 1 AND '.TABLE_PREFIX.'CategoryItems.PrimaryCat = 1'; $type_clauses['cat_lead']['except']='%1$s.LeadCatStory <> 1 AND '.TABLE_PREFIX.'CategoryItems.PrimaryCat = 1'; $type_clauses['cat_lead']['having_filter'] = false; return $type_clauses; } /** * [CRON] Deletes expired articles + update existing articles from rss feed with new data (key - article url) * * @param kEvent $event */ function OnUpdateRSSArticles($event) { if ( defined('IS_INSTALL') && IS_INSTALL ) { return; } $category_table = $this->Application->getUnitOption('c', 'TableName'); $custom_table = $this->Application->getUnitOption('c-cdata', 'TableName'); $category_custom_fields = $this->getCustomColumns('c'); $article_custom_fields = $this->getCustomColumns($event->Prefix); // update categories which sould be updated $sql = 'SELECT cd.*, c.CategoryId FROM '.$category_table.' c LEFT JOIN '.$custom_table.' cd ON c.ResourceId = cd.ResourceId WHERE (IF(cd.'.$category_custom_fields['RssLastUpdated'].' IS NULL, 0, cd.'.$category_custom_fields['RssLastUpdated'].') + cd.'.$category_custom_fields['RssUpdateInterval'].' * cd.'.$category_custom_fields['RssUpdateIntervalType'].' <= '.adodb_mktime().') AND (LENGTH('.$category_custom_fields['RssSource'].') > 0)'; $categories = $this->Conn->Query($sql, 'CategoryId'); if ($categories) { $resource_ids = Array(); foreach ($categories as $category_id => $category_data) { $resource_ids[] = $category_data['ResourceId']; $event->setEventParam('source_url', $category_data[ $category_custom_fields['RssSource'] ]); $event->setEventParam('category_id', $category_id); $event->setEventParam('custom_fields', $article_custom_fields); $event->setEventParam('life_time', $category_data[ $category_custom_fields['RssDefaultExpiration'] ] * $category_data[ $category_custom_fields['RssDefaultExpirationType'] ]); $this->parseFeed($event); } $sql = 'UPDATE '.$custom_table.' SET '.$category_custom_fields['RssLastUpdated'].' = '.adodb_mktime().' WHERE ResourceId IN ('.implode(',', $resource_ids).')'; $this->Conn->Query($sql); } // delete expired articles from feed categories $sql = 'SELECT c.CategoryId, c.ResourceId FROM '.$category_table.' c LEFT JOIN '.$custom_table.' cd ON c.ResourceId = cd.ResourceId WHERE ( IF(cd.'.$category_custom_fields['RssLastExpired'].' IS NULL, 0, cd.'.$category_custom_fields['RssLastExpired'].') + cd.'.$category_custom_fields['RssExpireInterval'].' * cd.'.$category_custom_fields['RssExpireIntervalType'].' <= '.adodb_mktime().') AND (cd.'.$category_custom_fields['RssDeleteExpired'].' = 1)'; $categories = $this->Conn->GetCol($sql, 'ResourceId'); $id_field = $this->Application->getUnitOption($event->Prefix, 'IDField'); $table = $this->Application->getUnitOption($event->Prefix, 'TableName'); $ci_table = $this->Application->getUnitOption($event->Prefix.'-ci', 'TableName'); if ($categories) { $article_custom_table = $this->Application->getUnitOption($event->Prefix.'-cdata', 'TableName'); $sql = 'SELECT main_table.'.$id_field.' FROM '.$table.' main_table LEFT JOIN '.$ci_table.' ci ON main_table.ResourceId = ci.ItemResourceId LEFT JOIN '.$article_custom_table.' cd ON main_table.ResourceId = cd.ResourceId WHERE (ci.PrimaryCat = 1) AND (ci.CategoryId IN ('.implode(',', $categories).')) AND (main_table.EndOn < '.adodb_mktime().' AND main_table.EndOn IS NOT NULL) AND (LENGTH(cd.'.$article_custom_fields['RssOriginalURL'].') > 0)'; $article_ids = $this->Conn->GetCol($sql); if ($article_ids) { $temp_handler = $this->Application->recallObject($event->getPrefixSpecial().'_TempHandler', 'kTempTablesHandler'); /* @var $temp_handler kTempTablesHandler */ $temp_handler->DeleteItems($event->Prefix, $event->Special, $article_ids); } $sql = 'UPDATE '.$custom_table.' SET '.$category_custom_fields['RssLastExpired'].' = '.adodb_mktime().' WHERE ResourceId IN ('.implode(',', array_keys($categories)).')'; $this->Conn->Query($sql); } } /** * Returns article ids & crc, that are created during feed import * * @param kEvent $event * @return Array */ function getFeedArticles($event) { $id_field = $this->Application->getUnitOption($event->Prefix, 'IDField'); $table = $this->Application->getUnitOption($event->Prefix, 'TableName'); $custom_table = $this->Application->getUnitOption($event->Prefix.'-cdata', 'TableName'); $crc_field = $event->getEventParam('custom_fields', 'RssArticleCRC'); $sql = 'SELECT main_table.'.$id_field.', cd.'.$crc_field.' FROM '.$table.' main_table LEFT JOIN '.$custom_table.' cd ON cd.ResourceId = main_table.ResourceId WHERE LENGTH(cd.'.$crc_field.') > 0'; return $this->Conn->GetCol($sql, $crc_field); } /** * Creates new, updates existing articles from feed url specified * * @param kEvent $event */ function parseFeed($event) { $source_urls = explode(',', $event->getEventParam('source_url')); if (count($source_urls) > 1) { foreach ($source_urls as $source_url) { $event->setEventParam('source_url', $source_url); $this->parseFeed($event); } return true; } $curl_helper = $this->Application->recallObject('CurlHelper'); /* @var $curl_helper kCurlHelper */ $curl_helper->followLocation = true; $curl_helper->setOptions( Array (CURLOPT_USERAGENT => 'Mozilla/5.0 (Windows; U; Windows NT 5.2; ru; rv:1.9.1.3) Gecko/20090824 Firefox/3.5.3 (.NET CLR 3.5.30729)') ); // otherwise FeedBurner will return HTML $xml_data = $curl_helper->Send($event->getEventParam('source_url')); if (!$xml_data) { return false; } $xml_helper = $this->Application->recallObject('kXMLHelper'); /* @var $xml_helper kXMLHelper */ $root_node =& $xml_helper->Parse($xml_data, kXMLHelper::XML_WITH_TEXT_NODES); $feed_types = Array ( 'rss_2.0' => 'channel', 'atom' => 'feed', ); foreach ($feed_types as $feed_type => $node_name) { $article_node =& $root_node->FindChild($node_name); if (is_object($article_node)) { break; } } if (!$article_node) { return false; } $category_id = $event->getEventParam('category_id'); $backup_category_id = $this->Application->GetVar('m_cat_id'); $this->Application->SetVar('m_cat_id', $category_id); switch ($feed_type) { case 'rss_2.0': $this->parseRssFeed($article_node, $event); break; case 'atom': $this->parseAtomFeed($article_node, $event); break; } $this->Application->SetVar('m_cat_id', $backup_category_id); } /** * Returns ML field names for article record * * @param kCatDBItem $object * @return Array */ function _getMLFields(&$object) { $ml_formatter = $this->Application->recallObject('kMultiLanguage'); /* @var $ml_formatter kMultiLanguage */ $title_field = 'Title'; $title_formatter = $object->GetFieldOption($title_field, 'formatter'); if ( $title_formatter == 'kMultiLanguage' ) { $title_field = $ml_formatter->LangFieldName($title_field); } $body_field = 'Body'; $body_formatter = $object->GetFieldOption($body_field, 'formatter'); if ( $body_formatter == 'kMultiLanguage' ) { $body_field = $ml_formatter->LangFieldName($body_field); } return Array ($title_field, $body_field); } /** * Parses RSS 2.0 feed * * @param kXMLNode $root_node * @param kEvent $event */ function parseRssFeed(&$root_node, $event) { $current_node = $root_node->firstChild; $feed_articles = $this->getFeedArticles($event); $object = $this->Application->recallObject($event->Prefix.'.-item', null, Array('skip_autoload' => true)); /* @var $object kDBItem */ list ($title_field, $body_field) = $this->_getMLFields($object); do { // IMAGE is information about channel and is not useful here if ($current_node->Name != 'ITEM') continue; // collect item data $data = Array(); $sub_node =& $current_node->firstChild; /* @var $sub_node kXMLNode */ do { if ($sub_node->Name == 'ATOM:SUMMARY') { $data[$sub_node->Name] = $this->getNodeContent($sub_node); } else { $data[$sub_node->Name] = $this->getNodeContent($sub_node, 'xhtml'); // $sub_node->firstChild->Data; // was $sub_node->Data; } } while ( ($sub_node =& $sub_node->NextSibling()) ); // create/update article $article_crc = kUtil::crc32($data['LINK'].$data['TITLE']); $article_id = getArrayValue($feed_articles, $article_crc); if ($article_id) { $object->Load($article_id); } else { $object->Clear(); } $object->SetDBField($title_field, $data['TITLE']); $object->SetDBField('cust_RssOriginalURL', $data['LINK']); $object->SetDBField('cust_RssArticleCRC', $article_crc); $object->SetDBField($body_field, !array_key_exists('DESCRIPTION', $data) ? $data['ATOM:SUMMARY'] : $data['DESCRIPTION']); $expiration_time = adodb_mktime() + $event->getEventParam('life_time'); $object->SetDBField('EndOn_date', $expiration_time); $object->SetDBField('EndOn_time', $expiration_time); $object->SetDBField('Status', STATUS_ACTIVE); $object->SetDBField('Author', 'root'); $object->SetDBField('CreatedById', USER_ROOT); $status = $object->isLoaded() ? $object->Update() : $object->Create(); } while (($current_node =& $current_node->NextSibling())); } /** * Returns parsed node content * * @param kXMLNode $node * @param string $content_type * @return string */ function getNodeContent(&$node, $content_type = null) { if ( !isset($content_type) ) { $content_type = $node->GetAttribute('TYPE'); } switch ($content_type) { case 'xhtml': $data = $node->GetXML(true); break; case 'html': $data = kUtil::unescape($node->GetXML(true), kUtil::ESCAPE_HTML); // $node->firstChild->Data // $node->Data break; default: $data = $node->GetXML(true); // $node->firstChild->Data; // $node->Data; also for 'text' break; } return trim($data); } /** * Parses ATOM feed * * @param kXMLNode $root_node * @param kEvent $event */ function parseAtomFeed(&$root_node, $event) { $current_node = $root_node->firstChild; $feed_articles = $this->getFeedArticles($event); $object = $this->Application->recallObject($event->Prefix.'.-item', null, Array('skip_autoload' => true)); /* @var $object kDBItem */ list ($title_field, $body_field) = $this->_getMLFields($object); do { if ($current_node->Name != 'ENTRY') continue; // collect item data $data = Array(); $sub_node =& $current_node->firstChild; /* @var $sub_node kXMLNode */ do { if ($sub_node->Name == 'LINK') { if ($sub_node->GetAttribute('REL') === false || $sub_node->GetAttribute('REL') == 'alternate') { $data[$sub_node->Name] = $sub_node->GetAttribute('HREF'); } } elseif ($sub_node->Name == 'CONTENT' || $sub_node->Name == 'SUMMARY' || $sub_node->Name == 'TITLE') { $data[$sub_node->Name] = $this->getNodeContent($sub_node); } else { $data[$sub_node->Name] = $sub_node->GetXML(true); // firstChild->Data; // $sub_node->Data } } while ( ($sub_node =& $sub_node->NextSibling()) ); // create/update article $article_crc = kUtil::crc32($data['LINK'].$data['TITLE']); $article_id = getArrayValue($feed_articles, $article_crc); if ($article_id) { $object->Load($article_id); } else { $object->Clear(); } $object->SetDBField($title_field, $data['TITLE']); $object->SetDBField('cust_RssOriginalURL', $data['LINK']); $object->SetDBField('cust_RssArticleCRC', $article_crc); $object->SetDBField($body_field, !array_key_exists('CONTENT', $data) ? $data['SUMMARY'] : $data['CONTENT']); $expiration_time = adodb_mktime() + $event->getEventParam('life_time'); $object->SetDBField('EndOn_date', $expiration_time); $object->SetDBField('EndOn_time', $expiration_time); $object->SetDBField('Status', STATUS_ACTIVE); $object->SetDBField('Author', 'root'); $object->SetDBField('CreatedById', USER_ROOT); $status = $object->isLoaded() ? $object->Update() : $object->Create(); } while (($current_node =& $current_node->NextSibling())); } function getCustomColumns($prefix) { $ml_formatter = $this->Application->recallObject('kMultiLanguage'); /* @var $ml_formatter kMultiLanguage */ $custom_fields = array_flip($this->Application->getUnitOption($prefix, 'CustomFields')); foreach ($custom_fields as $custom_name => $custom_id) { $custom_fields[$custom_name] = $ml_formatter->LangFieldName('cust_'.$custom_id); } return $custom_fields; } /** * Create missing excerpt * * @param kEvent $event * @return void * @access protected */ protected function OnBeforeItemUpdate(kEvent $event) { parent::OnBeforeItemUpdate($event); $this->createExcerpt($event); $this->cacheItemOwner($event, 'CreatedById', 'Author'); } /** * Create missing excerpt * * @param kEvent $event * @return void * @access protected */ protected function OnBeforeItemCreate(kEvent $event) { parent::OnBeforeItemCreate($event); $this->createExcerpt($event); $this->cacheItemOwner($event, 'CreatedById', 'Author'); } /** * Create excerpt if missing * * @param kEvent $event */ function createExcerpt($event) { $object = $event->getObject(); /* @var $object kDBItem */ - if ( !$object->GetField('Excerpt') || $this->Application->GetVar('generate_excerpt') ) { + if ( !$object->GetField('Excerpt') || $object->GetDBField('GenerateExcerpt') ) { $excerpt = strip_tags($object->GetField('Body')); $length = mb_strlen($excerpt); if ( $length > 100 ) { $excerpt = mb_substr(strip_tags($excerpt), 0, 100); if ( mb_substr($excerpt, -1) != ' ' ) { $pos = mb_strrpos($excerpt, ' '); if ( $pos ) { $excerpt = mb_substr($excerpt, 0, $pos); } } $excerpt .= '...'; } $excerpt_field = 'Excerpt'; $excerpt_formatter = $object->GetFieldOption('Excerpt', 'formatter'); if ( $excerpt_formatter == 'kMultiLanguage' ) { $ml_formatter = $this->Application->recallObject('kMultiLanguage'); /* @var $ml_formatter kMultiLanguage */ $excerpt_field = $ml_formatter->LangFieldName($excerpt_field); } $object->SetDBField($excerpt_field, $excerpt); } } /** * [HOOK] Updates category custom fields options in config * * @param kEvent $event */ function OnUpdateCategoryCustomFields($event) { $new_virtual_fields = Array( 'cust_RssSource' => Array('type' => 'string', 'default' => ''), 'cust_RssDefaultExpiration' => Array('type' => 'int', 'default' => ''), 'cust_RssDefaultExpirationType' => Array('type' => 'int', 'formatter' => 'kOptionsFormatter', 'use_phrases' => 1, 'options' => Array(60 => 'la_opt_min', 3600 => 'la_opt_hour', 86400 => 'la_opt_day', 2419200 => 'la_opt_month', 29030400 => 'la_opt_year'), 'default' => 60), 'cust_RssExpireInterval' => Array('type' => 'int', 'default' => ''), 'cust_RssExpireIntervalType' => Array('type' => 'int', 'formatter' => 'kOptionsFormatter', 'use_phrases' => 1, 'options' => Array(60 => 'la_opt_min', 3600 => 'la_opt_hour', 86400 => 'la_opt_day', 2419200 => 'la_opt_month'), 'default' => 60), 'cust_RssDeleteExpired' => Array('type' => 'int', 'formatter' => 'kOptionsFormatter', 'use_phrases' => 1, 'options' => Array(1 => 'la_Yes', 0 => 'la_No'), 'default' => 0), 'cust_RssUpdateInterval' => Array('type' => 'int', 'default' => ''), 'cust_RssUpdateIntervalType' => Array('type' => 'int', 'formatter' => 'kOptionsFormatter', 'use_phrases' => 1, 'options' => Array(60 => 'la_opt_min', 3600 => 'la_opt_hour', 86400 => 'la_opt_day', 2419200 => 'la_opt_month'), 'default' => 60), 'cust_RssLastUpdated' => Array('type' => 'int', 'formatter' => 'kDateFormatter', 'default' => ''), 'cust_RssLastExpired' => Array('type' => 'int', 'formatter' => 'kDateFormatter', 'default' => ''), ); $virtual_fields = $this->Application->getUnitOption('c', 'VirtualFields'); $virtual_fields = kUtil::array_merge_recursive($virtual_fields, $new_virtual_fields); $this->Application->setUnitOption('c', 'VirtualFields', $virtual_fields); } /** * Sets default expiration based on module setting * * @param kEvent $event * @return void * @access protected */ protected function OnPreCreate(kEvent $event) { parent::OnPreCreate($event); if ( $event->status != kEvent::erSUCCESS ) { return ; } $object = $event->getObject(); /* @var $object kDBItem */ $archive_days = $this->Application->ConfigValue('News_Archive'); if ( $archive_days ) { $expire_date = adodb_mktime() + $archive_days * 3600 * 24; $object->SetDBField('EndOn_date', $expire_date); $object->SetDBField('EndOn_time', $expire_date); } } /** * [HOOK] Allows to add cloned subitem to given prefix * * @param kEvent $event * @return void * @access protected */ protected function OnCloneSubItem(kEvent $event) { parent::OnCloneSubItem($event); if ( $event->MasterEvent->Prefix == 'rev' ) { $clones = $this->Application->getUnitOption($event->MasterEvent->Prefix, 'Clones'); $subitem_prefix = $event->Prefix . '-' . $event->MasterEvent->Prefix; $clones[$subitem_prefix]['ConfigMapping'] = Array ( 'PerPage' => 'Perpage_NewsReviews', 'ShortListPerPage' => 'Perpage_NewsReviews_Short', 'DefaultSorting1Field' => 'News_SortReviews', 'DefaultSorting2Field' => 'News_SortReviews2', 'DefaultSorting1Dir' => 'News_SortReviewsOrder', 'DefaultSorting2Dir' => 'News_SortReviewsOrder2', 'ReviewDelayInterval' => 'News_ReviewDelay_Interval', 'ReviewDelayValue' => 'News_ReviewDelay_Value', ); $this->Application->setUnitOption($event->MasterEvent->Prefix, 'Clones', $clones); } } } Index: branches/5.2.x/admin_templates/articles/articles_edit.tpl =================================================================== --- branches/5.2.x/admin_templates/articles/articles_edit.tpl (revision 16310) +++ branches/5.2.x/admin_templates/articles/articles_edit.tpl (revision 16311) @@ -1,132 +1,138 @@
- + " />

- + + + +
- \ No newline at end of file +