Index: branches/unlabeled/unlabeled-1.1.4/core/units/related_searches/related_searches_event_handler.php =================================================================== diff -u -N --- branches/unlabeled/unlabeled-1.1.4/core/units/related_searches/related_searches_event_handler.php (revision 0) +++ branches/unlabeled/unlabeled-1.1.4/core/units/related_searches/related_searches_event_handler.php (revision 10594) @@ -0,0 +1,24 @@ +getObject(); + + $table_info = $object->getLinkedInfo(); + + $source_itemtype = $this->Application->getUnitOption($table_info['ParentPrefix'], 'ItemType'); + $object->SetDBField('ItemType', $source_itemtype); + } + } + + +?> \ No newline at end of file Index: branches/unlabeled/unlabeled-1.1.4/core/admin_templates/categories/related_searches_edit.tpl =================================================================== diff -u -N --- branches/unlabeled/unlabeled-1.1.4/core/admin_templates/categories/related_searches_edit.tpl (revision 0) +++ branches/unlabeled/unlabeled-1.1.4/core/admin_templates/categories/related_searches_edit.tpl (revision 10594) @@ -0,0 +1,42 @@ + + + + + + + + + + + + + + + +
+ +
+ + + + + + + + + + +
+ Index: branches/unlabeled/unlabeled-1.1.4/core/units/files/file_tp.php =================================================================== diff -u -N --- branches/unlabeled/unlabeled-1.1.4/core/units/files/file_tp.php (revision 0) +++ branches/unlabeled/unlabeled-1.1.4/core/units/files/file_tp.php (revision 10594) @@ -0,0 +1,25 @@ +getPrefixSpecial().'_event'] = 'OnDownloadFile'; + $params['pass'] = 'm,'.$this->Application->getUnitOption($this->Prefix, 'ParentPrefix').','.$this->getPrefixSpecial(); + + return $this->ItemLink($params); + } + + function FileIcon($params) + { + $object =& $this->getObject($params); + /* @var $object kDBItem */ + + $last_dot = mb_strrpos($object->GetDBField('FilePath'), '.'); + $ext = ($last_dot !== false) ? mb_substr($object->GetDBField('FilePath'), $last_dot + 1).'.gif' : ''; + + return $ext ? $ext : $params['default']; + } + } + +?> \ No newline at end of file Index: branches/unlabeled/unlabeled-1.5.16/core/units/sections/sections_config.php =================================================================== diff -u -N -r8893 -r10594 --- branches/unlabeled/unlabeled-1.5.16/core/units/sections/sections_config.php (.../sections_config.php) (revision 8893) +++ branches/unlabeled/unlabeled-1.5.16/core/units/sections/sections_config.php (.../sections_config.php) (revision 10594) @@ -116,23 +116,12 @@ 'parent' => 'in-portal:users', 'icon' => 'in-portal:users', 'label' => 'la_tab_User_List', - 'url' => Array('index_file' => 'users/user_list.php', 'pass' => 'm', 'resetpage' => 1), + 'url' => Array('t' => 'in-portal/users/users_list', 'pass' => 'm'), 'permissions' => Array('view', 'add', 'edit', 'delete', 'advanced:ban', 'advanced:send_email', /*'advanced:add_favorite', 'advanced:remove_favorite',*/), 'priority' => 1, 'type' => stTREE, ), - 'in-portal:k4_user_list' => Array( - 'parent' => 'in-portal:users', - 'icon' => 'in-portal:users', - 'label' => 'la_title_K4Users', - 'url' => Array('t' => 'in-portal/users/users_list', 'pass' => 'm'), - 'permissions' => Array('view', 'add', 'edit', 'delete', 'advanced:ban', 'advanced:send_email', /*'advanced:add_favorite', 'advanced:remove_favorite',*/), - 'priority' => 1.5, - 'show_mode' => smDEBUG, - 'type' => stTREE, - ), - 'in-portal:user_groups' => Array( 'parent' => 'in-portal:users', 'icon' => 'in-portal:usergroups', @@ -143,8 +132,6 @@ 'type' => stTREE, ), - - 'in-portal:configure_users' => Array( 'parent' => 'in-portal:users', 'icon' => 'in-portal:users_settings', Index: branches/unlabeled/unlabeled-1.1.4/core/units/related_searches/related_searches_tag_processor.php =================================================================== diff -u -N --- branches/unlabeled/unlabeled-1.1.4/core/units/related_searches/related_searches_tag_processor.php (revision 0) +++ branches/unlabeled/unlabeled-1.1.4/core/units/related_searches/related_searches_tag_processor.php (revision 10594) @@ -0,0 +1,20 @@ +getObject($params); + $keyword = $object->GetDBField('Keyword'); + + return $this->Application->HREF($params['search_template'],'', Array('keywords' => $keyword)); + } +} + +?> \ No newline at end of file Index: branches/unlabeled/unlabeled-1.1.4/core/units/files/files_config.php =================================================================== diff -u -N --- branches/unlabeled/unlabeled-1.1.4/core/units/files/files_config.php (revision 0) +++ branches/unlabeled/unlabeled-1.1.4/core/units/files/files_config.php (revision 10594) @@ -0,0 +1,84 @@ + '#file', + 'ItemClass' => Array ('class' => 'kDBItem', 'file' => '', 'build_event' => 'OnItemBuild'), + 'ListClass' => Array ('class' => 'kDBList', 'file' => '', 'build_event' => 'OnListBuild'), + 'EventHandlerClass' => Array ('class' => 'FileEventHandler', 'file' => 'file_eh.php', 'build_event' => 'OnBuild'), + 'TagProcessorClass' => Array ('class' => 'FileTagProcessor', 'file' => 'file_tp.php', 'build_event' => 'OnBuild'), + + 'AutoLoad' => true, + + 'QueryString' => Array ( + 1 => 'id', + 2 => 'page', + 3 => 'event', + ), + + 'IDField' => 'FileId', + 'StatusField' => Array('Status', 'IsPrimary'), + + 'TitleField' => 'FileName', + 'TableName' => TABLE_PREFIX.'ItemFiles', + + 'ParentTableKey' => 'ResourceId', + 'ForeignKey' => 'ResourceId', + 'AutoDelete' => true, + 'AutoClone' => true, + + 'FilterMenu' => Array ( + 'Groups' => Array ( + Array ('mode' => 'AND', 'filters' => Array ('show_active','show_disabled'), 'type' => WHERE_FILTER), + ), + + 'Filters' => Array( + 'show_active' => Array('label' =>'la_Active', 'on_sql' => '', 'off_sql' => '%1$s.Status != 1' ), + 'show_disabled' => Array('label' => 'la_Disabled', 'on_sql' => '', 'off_sql' => '%1$s.Status != 0' ), + ) + ), + + 'ListSQLs' => Array ( + '' => 'SELECT * FROM %s', + ), + + 'ItemSQLs' => Array ( + '' => 'SELECT * FROM %s', + ), + + 'ListSortings' => Array ( + '' => Array ( + 'Sorting' => Array ('FileName' => 'asc'), + ) + ), + + 'Fields' => Array ( + 'FileId' => Array ('type' => 'int', 'not_null' => 1, 'default' => 0), + 'ResourceId' => Array ('type' => 'int', 'not_null' => 1, 'default' => 0), + 'FileName' => Array ('type' => 'string', 'max_len' => 255, 'required' => 1, 'not_null' => 1, 'default' => ''), + 'FilePath' => Array ( + 'type' => 'string', 'max_len' => 255, + 'formatter' => 'kUploadFormatter', 'upload_dir' => '/kernel/downloads/', 'include_path' => false, + 'size_field' => 'Size', 'content_type_field' => 'MimeType', 'max_size' => 50000000, + 'allowed_types' => Array ('application/pdf', 'application/msexcel', 'application/vnd.ms-excel', 'application/msword', 'application/mspowerpoint', 'application/zip', 'plain/text', 'application/x-gzip'), + 'not_null' => 1, 'required' => 1, 'default' => '' + ), + 'Size' => Array ('type' => 'int', 'not_null' => 1, 'default' => 0), + 'Status' => Array ('type' => 'int', 'formatter' => 'kOptionsFormatter', 'options' => Array (1 => 'la_Enabled', 0 => 'la_Disabled'), 'use_phrases' => 1, 'not_null' => 1, 'default' => 1), + 'CreatedOn' => Array ('type' => 'int', 'formatter' => 'kDateFormatter', 'not_null' => 1, 'default' => '#NOW#'), + 'CreatedById' => Array ('type' => 'int', 'not_null' => 1, 'default' => -1), + 'MimeType' => Array ('type' => 'string', 'max_len' => 255, 'not_null' => 1, 'default' => ''), + ), + + 'Grids' => Array ( + 'Default' => Array ( + 'Icons' => Array ('default' => 'icon16_custom.gif', '1_0' => 'icon16_file.gif', '1_1' => 'icon16_file_primary.gif', '0_0' => 'icon16_file_disabled.gif'), + 'Fields' => Array( + 'FileId' => Array ('title' => 'la_col_Id' , 'data_block' => 'grid_checkbox_td', 'module' => 'In-Portal'), + 'FileName' => Array ('title' => 'la_col_FileName'), + 'Status' => Array ('title' => 'la_col_Status'), + ), + ), + ), + ); + +?> \ No newline at end of file Index: branches/unlabeled/unlabeled-1.1.4/core/units/files/file_eh.php =================================================================== diff -u -N --- branches/unlabeled/unlabeled-1.1.4/core/units/files/file_eh.php (revision 0) +++ branches/unlabeled/unlabeled-1.1.4/core/units/files/file_eh.php (revision 10594) @@ -0,0 +1,89 @@ + Array('subitem' => 'view'), + ); + + $this->permMapping = array_merge($this->permMapping, $permissions); + } + + /** + * [HOOK] Allows to apply file functionality to specific config + * When main item is created, then #file config is cloned + * + * @param kEvent $event + */ + function OnDefineFiles(&$event) + { + $clones = $this->Application->getUnitOption('#file', 'Clones'); + $clones[$event->MasterEvent->Prefix.'-file'] = Array ( + 'ParentPrefix' => $event->MasterEvent->Prefix, + ); + $this->Application->setUnitOption('#file', 'Clones', $clones); + } + + /** + * Remembers user, who is created file record. Makes file primary if no other files are uploaded. + * + * @param kEvent $event + */ + function OnBeforeItemCreate(&$event) + { + $object =& $event->getObject(); + $object->SetDBField('CreatedById', $this->Application->RecallVar('user_id')); + } + + /** + * Resets primary file mark when more then one file is marked as primary + * + * @param kEvent $event + */ + function OnBeforeItemUpdate(&$event) + { + $object =& $event->getObject(); + + if (!$object->GetDBField('FileName')) { + $object->SetDBField('FileName', basename($object->GetDBField('FilePath'))); + } + } + + function SetCustomQuery(&$event) + { + parent::SetCustomQuery($event); + + $object =& $event->getObject(); + + if (!$this->Application->IsAdmin()) { + $object->addFilter('active_filter', '%1$s.Status = '.STATUS_ACTIVE); + } + } + + /** + * Returns file contents associated with item + * + * @param kEvent $event + */ + function OnDownloadFile(&$event) + { + $object =& $event->getObject(); + /* @var $object kDBItem */ + + $file_helper =& $this->Application->recallObject('FileHelper'); + /* @var $file_helper FileHelper */ + + $filename = $object->GetField('FilePath', 'full_path'); + $file_helper->DownloadFile($filename); + + $event->status = erSTOP; + } + } + +?> \ No newline at end of file Index: branches/unlabeled/unlabeled-1.1.4/core/units/related_searches/related_searches_config.php =================================================================== diff -u -N --- branches/unlabeled/unlabeled-1.1.4/core/units/related_searches/related_searches_config.php (revision 0) +++ branches/unlabeled/unlabeled-1.1.4/core/units/related_searches/related_searches_config.php (revision 10594) @@ -0,0 +1,101 @@ + 'search', + + 'Clones' => Array( + 'c-search' => Array('ParentPrefix' => 'c'), + /*'l-rel' => Array('ParentPrefix' => 'l'), + 'n-rel' => Array('ParentPrefix' => 'n'), + 'bb-rel'=> Array('ParentPrefix' => 'bb'), + 'p-rel' => Array('ParentPrefix' => 'p'), + 'cms-rel'=> Array('ParentPrefix' => 'cms'),*/ + ), + + 'ItemClass' => Array('class'=>'kDBItem','file'=>'','build_event'=>'OnItemBuild'), + 'ListClass' => Array('class'=>'kDBList','file'=>'','build_event'=>'OnListBuild'), + 'EventHandlerClass' => Array('class'=>'RelatedSearchEventHandler','file'=>'related_searches_event_handler.php','build_event'=>'OnBuild'), + 'TagProcessorClass' => Array('class'=>'RelatedSearchTagProcessor','file'=>'related_searches_tag_processor.php','build_event'=>'OnBuild'), + 'AutoLoad' => true, + + 'QueryString' => Array( + 1 => 'id', + 2 => 'page', + 3 => 'event', + ), + 'IDField' => 'RelatedSearchId', + 'StatusField' => Array('Enabled'), + 'TableName' => TABLE_PREFIX.'RelatedSearches', + 'ParentTableKey' => 'ResourceId', + 'ForeignKey' => 'ResourceId', + 'ParentPrefix' => 'c', + 'AutoDelete' => true, + 'AutoClone' => true, + + 'FilterMenu' => Array( + 'Groups' => Array( + Array('mode' => 'AND', 'filters' => Array('show_active','show_disabled'), 'type' => WHERE_FILTER), + Array('mode' => 'AND', 'filters' => Array('show_recip','show_oneway'), 'type' => WHERE_FILTER), + ), + 'Filters' => Array( + 'show_active' => Array('label' =>'la_Active', 'on_sql' => '', 'off_sql' => 'Enabled != 1' ), + 'show_disabled' => Array('label' => 'la_Disabled', 'on_sql' => '', 'off_sql' => 'Enabled != 0' ), + 's1' => Array(), + /* + 'show_recip' => Array('label' => 'la_Reciprocal', 'on_sql' => '', 'off_sql' => '%1$s.Type != 1' ), + 'show_oneway' => Array('label' => 'la_OneWay', 'on_sql' => '', 'off_sql' => '%1$s.Type != 2' ), + */ + ) + ), + + 'CalculatedFields' => Array( + '' => Array( + /* 'ItemName' => 'TRIM(CONCAT(#ITEM_NAMES#))', + 'ItemType' => '#ITEM_TYPES#', */ + ), + ), + + 'ListSQLs' => Array( ''=> 'SELECT %1$s.* %2$s FROM %1$s', + ), // key - special, value - list select sql + + 'ListSortings' => Array( + '' => Array( + 'ForcedSorting' => Array('Priority' => 'desc'), + 'Sorting' => Array('Keyword' => 'asc'), + ) + ), + 'ItemSQLs' => Array( '' => 'SELECT %1$s.* %2$s FROM %1$s',), + + 'Fields' => Array( + 'RelatedSearchId' => Array('type' => 'int', 'not_null' => 1, 'default' => 0), + 'ResourceId' => Array('type'=>'int', 'not_null' => 1, 'required' => 1, 'default' => 0), + 'Keyword' => Array('type'=>'string', 'required' => 1, 'not_null' => 1, 'default' => ''), + /* + 'SourceType' => Array('type'=>'int','not_null'=>1,'default'=>0), + 'TargetType' => Array('type'=>'int','not_null'=>1,'default'=>0), + */ + 'ItemType' => Array('type'=>'int', 'not_null' => 1, 'required' => 1, 'default' => 0), + 'Enabled' => Array('type'=>'int','formatter'=>'kOptionsFormatter','options'=>Array(0=>'la_Disabled',1=>'la_Enabled'),'not_null'=>1,'default'=>1,'use_phrases'=>1), + 'Priority' => Array('type'=>'int','not_null'=>1,'default'=>0), + ), + 'VirtualFields' => Array( + /* + 'ItemName' => Array(), + 'ItemType' => Array(), + */ + ), + + 'Grids' => Array( + 'Default' => Array( + 'Icons' => Array('default'=>'icon16_custom.gif','1_0'=>'icon16_relation_one-way.gif','0_0'=>'icon16_relation_one-way_disabled.gif','1_1'=>'icon16_relation_reciprocal.gif','0_1'=>'icon16_relation_reciprocal_disabled.gif'), // icons for each StatusField values, if no matches or no statusfield selected, then "default" icon is used + 'Fields' => Array( + /* 'RelatedSearchId' => Array( 'title'=>'la_col_Id', 'data_block' => 'grid_checkbox_td'), */ + 'Keyword' => Array( 'title'=>'la_col_Keyword', 'data_block' => 'grid_keyword_td'), + 'Enabled' => Array( 'title'=>'la_col_Status' ), + ), + + ), + ), + ); + +?> \ No newline at end of file Index: branches/unlabeled/unlabeled-1.5.16/core/admin_templates/groups/groups_edit.tpl =================================================================== diff -u -N -r8893 -r10594 --- branches/unlabeled/unlabeled-1.5.16/core/admin_templates/groups/groups_edit.tpl (.../groups_edit.tpl) (revision 8893) +++ branches/unlabeled/unlabeled-1.5.16/core/admin_templates/groups/groups_edit.tpl (.../groups_edit.tpl) (revision 10594) @@ -64,7 +64,7 @@ - + Index: branches/unlabeled/unlabeled-1.1.4/core/admin_templates/categories/categories_edit_related_searches.tpl =================================================================== diff -u -N --- branches/unlabeled/unlabeled-1.1.4/core/admin_templates/categories/categories_edit_related_searches.tpl (revision 0) +++ branches/unlabeled/unlabeled-1.1.4/core/admin_templates/categories/categories_edit_related_searches.tpl (revision 10594) @@ -0,0 +1,126 @@ + + + + + + + + + + + + + + + + + +
+ +
+ + + + " id=""> + img/itemicons/"> + + + + + + +"> + + + \ No newline at end of file Index: branches/unlabeled/unlabeled-1.5.16/core/admin_templates/categories/categories_tabs.tpl =================================================================== diff -u -N -r8893 -r10594 --- branches/unlabeled/unlabeled-1.5.16/core/admin_templates/categories/categories_tabs.tpl (.../categories_tabs.tpl) (revision 8893) +++ branches/unlabeled/unlabeled-1.5.16/core/admin_templates/categories/categories_tabs.tpl (.../categories_tabs.tpl) (revision 10594) @@ -22,6 +22,7 @@ +