Page Menu
Home
In-Portal Phabricator
Search
Configure Global Search
Log In
Files
F1056028
in-portal
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Wed, Jul 9, 12:20 PM
Size
18 KB
Mime Type
text/x-diff
Expires
Fri, Jul 11, 12:20 PM (8 h, 42 m)
Engine
blob
Format
Raw Data
Handle
681447
Attached To
rINP In-Portal
in-portal
View Options
Index: branches/unlabeled/unlabeled-1.15.2/core/units/groups/groups_config.php
===================================================================
--- branches/unlabeled/unlabeled-1.15.2/core/units/groups/groups_config.php (nonexistent)
+++ branches/unlabeled/unlabeled-1.15.2/core/units/groups/groups_config.php (revision 6730)
@@ -0,0 +1,123 @@
+<?php
+
+$config = Array(
+ 'Prefix' => 'g',
+
+ 'ItemClass' => Array('class' => 'GroupsItem', 'file' => 'groups_item.php', 'build_event' => 'OnItemBuild'),
+ 'ListClass' => Array('class' => 'kDBList', 'file' => '', 'build_event' => 'OnListBuild'),
+ 'EventHandlerClass' => Array('class' => 'GroupsEventHandler', 'file' => 'groups_event_handler.php','build_event'=>'OnBuild'),
+ 'TagProcessorClass' => Array('class' => 'kDBTagProcessor', 'file' => '','build_event'=>'OnBuild'),
+
+ 'AutoLoad' => true,
+
+ 'QueryString' => Array(
+ 1 => 'id',
+ 2 => 'page',
+ 3 => 'event',
+ 4 => 'mode',
+ ),
+
+ 'IDField' => 'GroupId',
+
+ 'StatusField' => Array('Enabled'),
+
+ 'TitleField' => 'Name',
+
+ 'TitlePresets' => Array(
+ 'default' => Array( 'new_status_labels' => Array('g' => '!la_title_Adding_Group!'),
+ 'edit_status_labels' => Array('g' => '!la_title_Editing_Group!'),
+ 'new_titlefield' => Array('g' => '!la_title_New_Group!'),
+ ),
+
+ 'groups_list' => Array('prefixes' => Array('g_List'), 'format' => "!la_title_Groups! (#g_recordcount#)"),
+
+ 'groups_edit' => Array('prefixes' => Array('g'), 'format' => "#g_status# '#g_titlefield#' - !la_title_General!"),
+
+ 'groups_edit_users' => Array('prefixes' => Array('g', 'g-ug_List'), 'format' => "#g_status# '#g_titlefield#' - !la_title_Users! (#g-ug_recordcount#)" ),
+
+ 'groups_edit_permissions' => Array('prefixes' => Array('g'), 'format' => "#g_status# '#g_titlefield#' - !la_title_Permissions!" ),
+
+ 'groups_edit_additional_permissions' => Array('prefixes' => Array('g'), 'format' => "#g_status# '#g_titlefield#' - !la_title_AdditionalPermissions!" ),
+
+ 'groups_select' => Array('prefixes' => Array('g_List'), 'format' => "!la_title_Groups! (#g_recordcount#) - !la_title_SelectGroup!"),
+ ),
+
+ 'PermSection' => Array('main' => 'in-portal:user_groups'),
+
+ 'TableName' => TABLE_PREFIX.'PortalGroup',
+
+ 'ListSQLs' => Array(
+ '' => '
+ SELECT %1$s.* %2$s FROM %1$s',
+ 'total' => '
+ SELECT %1$s.* %2$s FROM %1$s
+ LEFT JOIN '.TABLE_PREFIX.'UserGroup ug ON ug.GroupId = %1$s.GroupId',
+ ),
+
+ 'ItemSQLs' => Array('' => '
+ SELECT %1$s.* %2$s FROM %1$s
+ LEFT JOIN '.TABLE_PREFIX.'UserGroup ug ON ug.GroupId = %1$s.GroupId'),
+
+ 'ListSortings' => Array(
+ '' => Array(
+ 'Sorting' => Array('Name' => 'asc'),
+ )
+ ),
+
+ 'SubItems' => Array('g-perm', /*'g-ug'*/),
+ 'CalculatedFields' => Array(
+ 'total' => Array(
+ 'UserCount' => 'COUNT(ug.PortalUserId)',
+ ),
+ ),
+
+ 'Fields' => Array (
+ 'GroupId' => Array(),
+ 'Name' => Array('type' => 'string', 'not_null' => '1', 'required' => 1, 'default' => ''),
+ 'Description' => Array('type' => 'string','default' => ''),
+ 'CreatedOn' => Array('type' => 'double', 'formatter' => 'kDateFormatter', 'not_null' => '1','default' => '#NOW#'),
+ 'System' => Array('type' => 'int','not_null' => '1','default' => '0'),
+ 'Personal' => Array('type' => 'int','not_null' => '1','default' => '0'),
+ 'Enabled' => Array('type' => 'int', 'formatter' => 'kOptionsFormatter', 'options' => Array(1 => 'la_Enabled', 0 => 'la_Disabled'), 'use_phrases' => 1, 'not_null' => '1','default' => 1),
+ 'ResourceId' => Array('type' => 'int','not_null' => '1','default' => '0'),
+ ),
+
+ 'VirtualFields' => Array(
+ 'UserCount' => Array('type' => 'int', 'default' => 0),
+ ),
+
+ 'Grids' => Array(
+ 'Default' => Array(
+ 'Icons' => Array(1 => 'icon16_group.gif', 0 => 'icon16_group_disabled.gif'),
+ 'Fields' => Array(
+ 'GroupId' => Array('title' => 'la_col_Id', 'data_block' => 'grid_checkbox_td'),
+ 'Name' => Array('title' => 'la_col_GroupName'),
+ 'UserCount' => Array('title' => 'la_col_UserCount'),
+ ),
+ ),
+
+ 'Radio' => Array(
+ 'Icons' => Array(1 => 'icon16_group.gif', 0 => 'icon16_group_disabled.gif'),
+ 'Fields' => Array(
+ 'GroupId' => Array('title' => 'la_col_Id', 'data_block' => 'grid_radio_td'),
+ 'Name' => Array('title' => 'la_col_GroupName'),
+ 'Description' => Array('title' => 'la_col_Description'),
+ ),
+ ),
+
+ /*'GroupSelector' => Array(
+ 'Icons' => Array(0 => 'icon16_user_disabled.gif', 1 => 'icon16_user.gif', 2 => 'icon16_user_pending.gif'),
+ 'Fields' => Array(
+ 'Login' => Array('title' => 'la_col_Username', 'data_block' => 'grid_radio_td'),
+ 'LastName' => Array( 'title'=>'la_col_LastName'),
+ 'FirstName' => Array( 'title'=>'la_col_FirstName'),
+ 'Email' => Array( 'title'=>'la_col_Email'),
+ 'PrimaryGroup' => Array( 'title'=>'la_col_PrimaryGroup'),
+ 'CreatedOn_formatted' => Array('title' => 'la_col_CreatedOn', 'sort_field' => 'CreatedOn'),
+ ),
+ ),*/
+ ),
+
+ );
+
+?>
\ No newline at end of file
Property changes on: branches/unlabeled/unlabeled-1.15.2/core/units/groups/groups_config.php
___________________________________________________________________
Added: cvs2svn:cvs-rev
## -0,0 +1 ##
+1.15
\ No newline at end of property
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: branches/unlabeled/unlabeled-1.15.2/core/units/general/cat_tag_processor.php
===================================================================
--- branches/unlabeled/unlabeled-1.15.2/core/units/general/cat_tag_processor.php (nonexistent)
+++ branches/unlabeled/unlabeled-1.15.2/core/units/general/cat_tag_processor.php (revision 6730)
@@ -0,0 +1,217 @@
+<?php
+
+ class kCatDBTagProcessor extends kDBTagProcessor {
+
+ /**
+ * Permission Helper
+ *
+ * @var kPermissionsHelper
+ */
+ var $PermHelper = null;
+
+ function kCatDBTagProcessor()
+ {
+ parent::kDBTagProcessor();
+ $this->PermHelper = $this->Application->recallObject('PermissionsHelper');
+ }
+
+ function ItemIcon($params)
+ {
+ $object =& $this->Application->recallObject($this->getPrefixSpecial(),$this->Prefix, $params);
+
+ $grids = $this->Application->getUnitOption($this->Prefix,'Grids');
+ $icons =& $grids[ $params['grid'] ]['Icons'];
+
+ $status_fields = $this->Application->getUnitOption($this->Prefix,'StatusField');
+ if (!$status_fields) return $icons['default'];
+
+ $value = $object->GetDBField($status_fields[0]); // sets base status icon
+ /* @var $object kDBItem */
+ if ($value == STATUS_ACTIVE) {
+ if( $object->HasField('IsPop') && $object->GetDBField('IsPop') ) $value = 'POP';
+ if( $object->HasField('IsHot') && $object->GetDBField('IsHot') ) $value = 'HOT';
+ if( $object->HasField('IsNew') && $object->GetDBField('IsNew') ) $value = 'NEW';
+ if( $object->HasField('EditorsPick') && $object->GetDBField('EditorsPick') ) $value = 'PICK';
+ }
+
+ return isset($icons[$value]) ? $icons[$value] : $icons['default'];
+ }
+
+ /**
+ * Allows to create valid mod-rewrite compatible link to module item
+ *
+ * @param Array $params
+ * @param string $id_prefix
+ * @return string
+ */
+ function ItemLink($params, $id_prefix)
+ {
+ $params = array_merge($params, Array('pass' => 'm,'.$this->Prefix) );
+
+ $item_id = isset($params[$id_prefix.'_id']) && $params[$id_prefix.'_id'];
+ if (!$item_id) {
+ $item_id = $this->Application->GetVar($this->getPrefixSpecial().'_id');
+ if (!$item_id) {
+ $item_id = $this->Application->GetVar($this->Prefix.'_id');
+ }
+ }
+ $params[$this->Prefix.'_id'] = $item_id;
+
+ $object =& $this->getObject($params);
+ $params['m_cat_id'] = $object->GetDBField('CategoryId');
+ $params['pass_category'] = 1;
+
+ return $this->Application->ProcessParsedTag('m', 't', $params);
+ }
+
+ function CategoryPath($params)
+ {
+ if (!isset($params['cat_id'])) {
+ $params['cat_id'] = $this->Application->RecallVar($params['session_var'], 0);
+ }
+
+ return $this->Application->ProcessParsedTag('c', 'CategoryPath', $params);
+ }
+
+ function BuildListSpecial($params)
+ {
+ if ($this->Special != '') return $this->Special;
+ if ( isset($params['parent_cat_id']) ) {
+ $parent_cat_id = $params['parent_cat_id'];
+ }
+ else {
+ $parent_cat_id = $this->Application->GetVar('c_id');
+ if (!$parent_cat_id) {
+ $parent_cat_id = $this->Application->GetVar('m_cat_id');
+ }
+ }
+
+ $recursive = isset($params['recursive']);
+
+ $types = $this->SelectParam($params, 'types');
+ $except = $this->SelectParam($params, 'except');
+
+ if ($types.$except.$recursive == '') {
+ return parent::BuildListSpecial($params);
+ }
+
+ $special = crc32($parent_cat_id.$types.$except.$recursive);
+ return $special;
+ }
+
+ function ExportStatus($params)
+ {
+ $export_object =& $this->Application->recallObject('CatItemExportHelper');
+
+ $event = new kEvent($this->getPrefixSpecial().':OnDummy');
+
+ $action_method = 'perform'.ucfirst($this->Special);
+ $field_values = $export_object->$action_method($event);
+
+ // finish code is done from JS now
+ if ($field_values['start_from'] == $field_values['total_records'])
+ {
+ if ($this->Special == 'import') {
+ $this->Application->StoreVar('PermCache_UpdateRequired', 1);
+ $this->Application->Redirect('categories/cache_updater', Array('m_opener' => 'r', 'pass' => 'm', 'continue' => 1, 'no_amp' => 1));
+ }
+ elseif ($this->Special == 'export') {
+ $template = $this->Application->getUnitOption($this->Prefix, 'ModuleFolder').'/'.$this->Special.'_finish';
+ $this->Application->Redirect($template, Array('pass' => 'all'));
+ }
+ }
+
+ $export_options = $export_object->loadOptions($event);
+ return $export_options['start_from'] * 100 / $export_options['total_records'];
+ }
+
+ function CatalogItemCount($params)
+ {
+ $object =& $this->GetList($params);
+ if (!$object->Counted) {
+ $object->CountRecs();
+ }
+ return $object->NoFilterCount != $object->RecordsCount ? $object->RecordsCount.' / '.$object->NoFilterCount : $object->RecordsCount;
+ }
+
+ function ListReviews($params)
+ {
+ $prefix = $this->Prefix.'-rev';
+ $review_tag_processor =& $this->Application->recallObject($prefix.'.item_TagProcessor');
+ return $review_tag_processor->PrintList($params);
+ }
+
+ function ReviewCount($params)
+ {
+ $review_tag_processor =& $this->Application->recallObject('rev.item_TagProcessor');
+ return $review_tag_processor->TotalRecords($params);
+ }
+
+ function InitCatalogTab($params)
+ {
+ $tab_params['mode'] = $this->Application->GetVar('tm'); // single/multi selection possible
+ $tab_params['special'] = $this->Application->GetVar('ts'); // use special for this tab
+ $tab_params['dependant'] = $this->Application->GetVar('td'); // is grid dependant on categories grid
+
+ // set default params (same as in catalog)
+ if ($tab_params['mode'] === false) $tab_params['mode'] = 'multi';
+ if ($tab_params['special'] === false) $tab_params['special'] = '';
+ if ($tab_params['dependant'] === false) $tab_params['dependant'] = 'yes';
+
+ // pass params to block with tab content
+ $params['name'] = $params['render_as'];
+ $params['prefix'] = trim($this->Prefix.'.'.($tab_params['special'] ? $tab_params['special'] : $this->Special), '.');
+ $params['cat_prefix'] = trim('c.'.($tab_params['special'] ? $tab_params['special'] : $this->Special), '.');
+ $params['tab_mode'] = $tab_params['mode'];
+ $params['tab_dependant'] = $tab_params['dependant'];
+ $params['show_category'] = $tab_params['special'] == 'showall' ? 1 : 0; // this is advanced view -> show category name
+
+ return $this->Application->ParseBlock($params, 1);
+ }
+
+ /**
+ * Show CachedNavbar of current item primary category
+ *
+ * @param Array $params
+ * @return string
+ */
+ function CategoryName($params)
+ {
+ // show category cachednavbar of
+ $object =& $this->getObject($params);
+ $category_id = isset($params['cat_id']) ? $params['cat_id'] : $object->GetDBField('CategoryId');
+
+ $category_path = $this->Application->getCache('category_paths', $category_id);
+ if ($category_path === false) {
+ // not chached
+ if ($category_id > 0) {
+ $category_path = trim($this->CategoryName( Array('cat_id' => 0) ).' > '.str_replace('&|&', ' > ', $object->GetDBField('CachedNavbar')), ' > ');
+ }
+ else {
+ $category_path = $this->Application->Phrase( $this->Application->ConfigValue('Root_Name') );
+ }
+ $this->Application->setCache('category_paths', $category_id, $category_path);
+ }
+ return $category_path;
+ }
+
+ /**
+ * Allows to determine if original value should be shown
+ *
+ * @param Array $params
+ * @return bool
+ */
+ function DisplayOriginal($params)
+ {
+ // original id found & greather then zero + show original
+ $display_original = isset($params['display_original']) && $params['display_original'];
+
+ $object =& $this->getObject($params);
+ $perm_value = $this->PermHelper->ModifyCheckPermission($object->GetDBField('CreatedById'), $object->GetDBField('CategoryId'), $this->Prefix);
+
+ return $display_original && ($perm_value == 1) && $this->Application->GetVar($this->Prefix.'.original_id');
+ }
+
+ }
+
+?>
\ No newline at end of file
Property changes on: branches/unlabeled/unlabeled-1.15.2/core/units/general/cat_tag_processor.php
___________________________________________________________________
Added: cvs2svn:cvs-rev
## -0,0 +1 ##
+1.15
\ No newline at end of property
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: branches/unlabeled/unlabeled-1.15.2/core/units/general/main_event_handler.php
===================================================================
--- branches/unlabeled/unlabeled-1.15.2/core/units/general/main_event_handler.php (nonexistent)
+++ branches/unlabeled/unlabeled-1.15.2/core/units/general/main_event_handler.php (revision 6730)
@@ -0,0 +1,129 @@
+<?php
+
+ class MainEventHandler extends kEventHandler {
+
+
+ /**
+ * Description
+ *
+ * @var kDBConnection
+ * @access public
+ */
+ var $Conn;
+
+ /**
+ * Adds ability to address db connection
+ *
+ * @return kDBEventHandler
+ * @access public
+ */
+ function MainEventHandler()
+ {
+ parent::kBase();
+ $this->Conn =& $this->Application->GetADODBConnection();
+ }
+
+ /**
+ * Created url part for this module
+ *
+ * @param kEvent $event
+ */
+ function BuildEnv(&$event)
+ {
+ $prefix_special = $event->getPrefixSpecial();
+ $url_params = $event->getEventParam('url_params');
+
+ $query_vars = $this->Application->getUnitOption($event->Prefix, 'QueryString');
+
+ //if pass events is off and event is not implicity passed
+ if ( !$event->getEventParam('pass_events') && !isset($url_params[$prefix_special.'_event']) )
+ {
+ $url_params[$prefix_special.'_event'] = ''; // remove event from url if requested
+ //otherwise it will use value from get_var
+ }
+
+ if(!$query_vars) return true;
+
+ $processed_params = Array();
+ foreach($query_vars as $index => $var_name)
+ {
+ //if value passed in params use it, otherwise use current from application
+ $var_name = $prefix_special.'_'.$var_name;
+ $processed_params[$var_name] = isset( $url_params[$var_name] ) ? $url_params[$var_name] : $this->Application->GetVar($var_name);
+ if ( isset($url_params[$var_name]) ) unset( $url_params[$var_name] );
+ }
+
+ $ret = '';
+ $default_language_id = $this->Application->GetDefaultLanguageId();
+ if( $processed_params['m_lang'] && ($processed_params['m_lang'] != $default_language_id) )
+ {
+ $language_name = $this->Application->getCache('language_names', $processed_params['m_lang']);
+ if ($language_name === false) {
+ $sql = 'SELECT PackName
+ FROM '.TABLE_PREFIX.'Language
+ WHERE LanguageId = '.$processed_params['m_lang'];
+ $language_name = $this->Conn->GetOne($sql);
+ $this->Application->setCache('language_names', $processed_params['m_lang'], $language_name);
+ }
+ $ret .= $language_name.'/';
+ }
+
+ $default_theme_id = $this->Application->GetDefaultThemeId();
+ if( $processed_params['m_theme'] && ($processed_params['m_theme'] != $default_theme_id) )
+ {
+ $theme_name = $this->Application->getCache('theme_names', $processed_params['m_theme']);
+ if ($theme_name === false) {
+ $sql = 'SELECT Name
+ FROM '.TABLE_PREFIX.'Theme
+ WHERE ThemeId = '.$processed_params['m_theme'];
+ $theme_name = $this->Conn->GetOne($sql);
+ $this->Application->setCache('theme_names', $processed_params['m_theme'], $theme_name);
+
+ }
+ $ret .= $theme_name.'/';
+ }
+
+ if ($processed_params['m_cat_id'] > 0 && isset($url_params['pass_category']) && $url_params['pass_category']) {
+ $ret .= $this->Application->getFilename('c', $processed_params['m_cat_id']).'/';
+ $url_params['category_processed'] = true;
+ }
+ else {
+// $url_params['no_category'] = 1; // for debugging
+ }
+ unset($url_params['pass_category']); // unset it just in case
+
+ $force_page_adding = false;
+ if (getArrayValue($url_params, 'reset'))
+ {
+ unset($url_params['reset']);
+ if ($processed_params['m_cat_id'])
+ {
+ $processed_params['m_cat_page'] = 1;
+ $force_page_adding = true;
+ }
+ }
+
+ if( $processed_params['m_cat_page'] > 1 || $force_page_adding )
+ {
+ $ret = preg_replace('/(.*)\//', '\\1', $ret).'_'.$processed_params['m_cat_page'].'/';
+ }
+
+ $template = getArrayValue($url_params, 't');
+ $category_template = $processed_params['m_cat_id'] ? $this->Application->getCache('category_templates', $processed_params['m_cat_id']) : '';
+
+ // remove template from url if it is category index cached template
+ if ($template == $category_template || strtolower($template) == '__default__') {
+ $template = '';
+ }
+
+ if ($template) {
+ $ret .= $template.'/';
+ }
+ unset($url_params['t']);
+
+ $event->setEventParam('url_params', $url_params);
+ $event->setEventParam('env_string', strtolower($ret) );
+ }
+ }
+
+?>
\ No newline at end of file
Property changes on: branches/unlabeled/unlabeled-1.15.2/core/units/general/main_event_handler.php
___________________________________________________________________
Added: cvs2svn:cvs-rev
## -0,0 +1 ##
+1.15
\ No newline at end of property
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Event Timeline
Log In to Comment