Page MenuHomeIn-Portal Phabricator

in-portal
No OneTemporary

File Metadata

Created
Thu, Jun 19, 4:01 AM

in-portal

Index: branches/unlabeled/unlabeled-1.17.2/core/kernel/utility/event.php
===================================================================
--- branches/unlabeled/unlabeled-1.17.2/core/kernel/utility/event.php (nonexistent)
+++ branches/unlabeled/unlabeled-1.17.2/core/kernel/utility/event.php (revision 7642)
@@ -0,0 +1,312 @@
+<?php
+
+ class kEvent extends kBase {
+
+ /**
+ * Event reference, that
+ * created this event
+ *
+ * @var kEvent
+ * @access public
+ */
+ var $MasterEvent;
+
+ /**
+ * Event name
+ *
+ * @var string
+ * @access public
+ */
+ var $Name;
+
+ /**
+ * Pseudo class name
+ *
+ * @var string
+ * @access public
+ */
+ //var $Prefix;
+
+ /**
+ * Special, that is recognized
+ * by class with pseudo class
+ * equals to $Prefix attrbute.
+ *
+ * @var string
+ * @access public
+ */
+ //var $Special;
+
+ /**
+ * Joined prefix and special,
+ * usually taken directly from
+ * tag beeing processes, to use
+ * in recallObject method
+ *
+ * @var string
+ */
+ var $Prefix_Special;
+
+ /**
+ * Do not execute Before hooks
+ * while processing main event
+ *
+ * @var bool
+ * @access public
+ */
+ var $SkipBeforeHooks = false;
+
+ /**
+ * Do not execute After hooks
+ * while processing main event
+ *
+ * @var bool
+ * @access public
+ */
+ var $SkipAfterHooks = false;
+
+ /**
+ * Redirect is allowed after
+ * this event
+ *
+ * @var bool
+ * @access public
+ */
+ var $redirect = true;
+
+ /**
+ * Params passed to redirect on succsessfull event
+ *
+ * @var bool
+ * @access public
+ */
+ var $redirect_params = null;
+
+ /**
+ * php file to redirect to
+ *
+ * @var string
+ * @access public
+ */
+ var $redirect_script = null;
+
+ /**
+ * Event processing result
+ *
+ * @var int
+ * @access public
+ */
+ var $status = erSUCCESS;
+
+ /**
+ * Each event specific only params,
+ * that they use for communication
+ *
+ * @var Array
+ * @access public
+ */
+ var $specificParams = Array();
+
+ /**
+ * Pseudo class used to create object,
+ * in case if one is not already created
+ *
+ * @var string
+ * @access public
+ */
+ var $pseudoClass = '';
+
+ /**
+ * Create event based on params passed
+ *
+ * @param Array $params
+ * @return kEvent
+ * @access public
+ */
+ function kEvent($params=Array(), $specificParams=null)
+ {
+ parent::kBase();
+ if($params && is_array($params))
+ {
+ $prefix = isset($params['prefix']) ? $params['prefix'] : false;
+ $special = isset($params['special']) ? $params['special'] : false;
+ if($prefix) $this->Init($prefix,$special);
+ $this->Name = getArrayValue($params,'name');
+ }
+ elseif ($params && is_string($params)) {
+ if (preg_match('/([^.:]*)[.]{0,1}([^:]*):(.*)/', $params, $regs)) {
+ $prefix = $regs[1];
+ $special = $regs[2];
+ if($prefix) $this->Init($prefix,$special);
+ $this->Name = $regs[3];
+ }
+ else {
+ trigger_error('Invalid event string '.$params.' should be prefix[.special]:OnEvent ', E_USER_ERROR);
+ }
+ }
+ if (isset($specificParams)) $this->specificParams = $specificParams;
+ }
+
+ function setEventParam($name,$value)
+ {
+ $this->specificParams[$name]=$value;
+ }
+
+ function getEventParam($name)
+ {
+ $args = func_get_args();
+ array_unshift($args, $this->specificParams);
+ return call_user_func_array('getArrayValue', $args); // getArrayValue($this->specificParams, $name);
+ }
+
+ function getPrefixSpecial($from_submit=false)
+ {
+ $separator=!$from_submit?'.':'_';
+ $ret=$this->Prefix.$separator.$this->Special;
+ return rtrim($ret,$separator);
+ }
+
+ /**
+ * Set's pseudo class that differs from
+ * the one specified in $Prefix
+ *
+ * @param string $appendix
+ * @access public
+ */
+ function setPseudoClass($appendix)
+ {
+ $this->pseudoClass = $this->Prefix.$appendix;
+ }
+
+ function Init($prefix, $special = '')
+ {
+ $this->Prefix = $prefix;
+ $this->pseudoClass = $prefix; // default value
+ $this->Special = $special;
+ $this->Prefix_Special = rtrim($this->Prefix.'.'.$this->Special,'.');
+ }
+
+ /**
+ * Returns object used in event
+ *
+ * @access public
+ * @return kDBBase
+ */
+ function &getObject($params = Array())
+ {
+ $object =& $this->Application->recallObject($this->Prefix_Special, $this->pseudoClass, $params);
+ return $object;
+ }
+
+ /**
+ * Calls passed event by name in current prefix/special environment
+ * Called event gets this event as MasterEvent,
+ * but its results (status and redirect* properties are copied back to current event)
+ *
+ * @param string $name EventName to call
+ */
+ function CallSubEvent($name)
+ {
+ $child_event = new kEvent();
+ $child_event->MasterEvent =& $this;
+ $child_event->Prefix = $this->Prefix;
+ $child_event->Special = $this->Special;
+ $child_event->Prefix_Special = $this->Prefix_Special;
+ $child_event->redirect = $this->redirect;
+ $child_event->redirect_params = $this->redirect_params;
+ $child_event->redirect_script = $this->redirect_script;
+ $child_event->Name = $name;
+
+ $this->Application->HandleEvent( $child_event );
+
+ $this->status = $child_event->status;
+ $this->redirect = $child_event->redirect;
+ $this->redirect_params = $child_event->redirect_params;
+ $this->redirect_script = $child_event->redirect_script;
+ }
+
+ /**
+ * Set's redirect param for event
+ *
+ * @param string $name
+ * @param string $value
+ * @access public
+ */
+ function SetRedirectParam($name, $value)
+ {
+ $this->redirect_params[$name] = $value;
+ }
+
+ /**
+ * Allows to merge passed redirect params hash with existing ones
+ *
+ * @param Array $params
+ * @access public
+ */
+ function setRedirectParams($params)
+ {
+ $this->redirect_params = array_merge_recursive2($this->redirect_params, $params);
+ }
+
+ /**
+ * Returns Master event name if any
+ *
+ * @return mixed
+ * @access public
+ */
+ function hasMasterEvent()
+ {
+ return is_object($this->MasterEvent) ? $this->MasterEvent->Name : false;
+ }
+
+ /**
+ * Allows to tell if this event was called some how (e.g. subevent, hook) from event requested
+ *
+ * @param string $event_key event key in format [prefix[.special]:]event_name
+ * @return unknown
+ */
+ function hasAncestor($event_key)
+ {
+ $event_manager =& $this->Application->recallObject('EventManager');
+ if (strpos($event_key, ':') === false) {
+ $event_key = $this->getPrefixSpecial().':'.$event_key;
+ }
+
+ return $event_manager->eventRunning($event_key);
+ }
+
+ /**
+ * Returns section for current event
+ *
+ * @return string
+ */
+ function getSection()
+ {
+ $perm_section = $this->getEventParam('PermSection');
+ if ($perm_section) {
+ return $perm_section;
+ }
+
+ // 1. get section by current top_prefix
+ $top_prefix = $this->getEventParam('top_prefix');
+ $section = $this->Application->getUnitOption($top_prefix.'.main', 'PermSection');
+
+ // 2. check if this section has perm_prefix mapping to other prefix
+ $sections_helper =& $this->Application->recallObject('SectionsHelper');
+ /* @var $sections_helper kSectionsHelper */
+
+ $section_data =& $sections_helper->getSectionData($section);
+ if ($section_data && isset($section_data['perm_prefix']) && $section_data['perm_prefix'] != $top_prefix) {
+ $this->setEventParam('top_prefix', $section_data['perm_prefix']);
+ $section = $this->Application->getUnitOption($section_data['perm_prefix'].'.main', 'PermSection');
+ }
+
+ if (!$section) {
+ trigger_error('Permission <b>section</b> not specified for prefix <b>'.$top_prefix.'</b>', E_USER_ERROR);
+ }
+ return $section;
+ }
+
+ }
+
+?>
\ No newline at end of file
Property changes on: branches/unlabeled/unlabeled-1.17.2/core/kernel/utility/event.php
___________________________________________________________________
Added: cvs2svn:cvs-rev
## -0,0 +1 ##
+1.17
\ No newline at end of property
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: branches/unlabeled/unlabeled-1.17.2/core/kernel/languages/phrases_cache.php
===================================================================
--- branches/unlabeled/unlabeled-1.17.2/core/kernel/languages/phrases_cache.php (nonexistent)
+++ branches/unlabeled/unlabeled-1.17.2/core/kernel/languages/phrases_cache.php (revision 7642)
@@ -0,0 +1,228 @@
+<?php
+
+class PhrasesCache extends kBase {
+
+ /**
+ * Connection to database
+ *
+ * @var kDBConnection
+ * @access public
+ */
+ var $Conn;
+
+ var $Phrases = Array();
+ var $Ids = Array();
+ var $OriginalIds = Array(); //for comparing cache
+
+ var $LanguageId = null;
+
+ var $fromTag = false;
+
+ function PhrasesCache()
+ {
+ parent::kBase();
+ $this->Conn =& $this->Application->GetADODBConnection();
+ }
+
+ function Init($prefix, $special = '')
+ {
+ $this->LanguageId = $this->Application->GetVar('m_lang');
+ if (isset($this->Application->Caches['PhraseList'])) {
+ $this->LoadPhrases( $this->Application->Caches['PhraseList'] );
+ }
+ }
+
+ function GetCachedIds()
+ {
+ $query = sprintf("SELECT PhraseList, ConfigVariables FROM %s WHERE Template = %s",
+ TABLE_PREFIX.'PhraseCache',
+ $this->Conn->Qstr(md5($this->Application->GetVar('t').$this->Application->GetVar('m_theme').$this->Application->GetVar('m_lang'))));
+ $res = $this->Conn->GetRow($query);
+
+ if ($res && $res['ConfigVariables']) {
+ $this->Application->OriginalConfigCacheIds = explode(',', $res['ConfigVariables']);
+ $this->Application->ConfigCacheIds = $this->Application->OriginalConfigCacheIds;
+ }
+
+ return ($res === false) ? Array() : explode(',', $res['PhraseList']);
+ }
+
+ function LoadPhrases($ids)
+ {
+ if ( !is_array($ids) || !implode('', $ids) ) return;
+ $query = sprintf("SELECT Translation,UPPER(Phrase) AS Phrase FROM %s WHERE LanguageId = %s AND PhraseId IN (%s)",
+ TABLE_PREFIX.'Phrase',
+ $this->LanguageId,
+ join(',', $ids));
+ $this->Phrases = $this->Conn->GetCol($query,'Phrase');
+ /*foreach($phrases as $phrase => $tanslation)
+ {
+ $this->AddCachedPhrase(strtoupper($phrase), $tanslation);
+ }*/
+ $this->Ids = $ids;
+ $this->OriginalIds = $ids;
+ }
+
+ function AddCachedPhrase($label, $value)
+ {
+ $label = strtoupper($label);
+ $this->Phrases[$label] = $value;
+ }
+
+ function NeedsCacheUpdate()
+ {
+ return is_array($this->Ids) && count($this->Ids) > 0 && $this->Ids != $this->OriginalIds;
+ }
+
+ function UpdateCache()
+ {
+ $update = false;
+ //something changed
+ $update = $update || (is_array($this->Ids) && count($this->Ids) > 0 && $this->Ids != $this->OriginalIds);
+ $update = $update || (count($this->Application->ConfigCacheIds) && $this->Application->ConfigCacheIds != $this->Application->OriginalConfigCacheIds);
+ if ($update) {
+ $query = sprintf("REPLACE %s (PhraseList, CacheDate, Template, ConfigVariables)
+ VALUES (%s, %s, %s, %s)",
+ TABLE_PREFIX.'PhraseCache',
+ $this->Conn->Qstr(join(',', $this->Ids)),
+ adodb_mktime(),
+ $this->Conn->Qstr(md5($this->Application->GetVar('t').$this->Application->GetVar('m_theme').$this->Application->GetVar('m_lang'))),
+ $this->Conn->qstr(implode(',', array_unique($this->Application->ConfigCacheIds))));
+ $this->Conn->Query($query);
+ }
+ }
+
+ function GetPhrase($label)
+ {
+ if (ereg("^!.+!$", $label) > 0)
+ {
+ $label = substr($label, 1, -1); //cut exclamation marks
+ }
+
+ if( strlen($label) == 0 ) return '';
+
+ $original_label = $label;
+ $label = strtoupper($label);
+ if(isset($this->Phrases[$label])) {
+ $translated_label = $this->Phrases[$label];
+ // debug mode is checked directly to improve performance
+ if (defined('DEBUG_MODE') && DEBUG_MODE && constOn('DBG_PHRASES_HIGHLIGHT')) {
+ if (!$this->Application->isDebugMode()) return $translated_label;
+
+ if ($this->Application->IsAdmin()) {
+ $sql = 'SELECT Module
+ FROM '.TABLE_PREFIX.'Phrase
+ WHERE (LanguageId = '.$this->LanguageId.') AND (Phrase = '.$this->Conn->qstr($label).')';
+ $this->Application->Debugger->appendHTML('Phrase: <b>'.$label.'</b>; Module: <b>'.$this->Conn->GetOne($sql).'</b>');
+// $translated_label = $translated_label.' [m: '.$this->Conn->GetOne($sql).'; l: '.$label.']';
+ }
+ else {
+ // highlight text created via translated phrase (used to detect if text on screen is phrase or not)
+ $translated_label = '<span style="border: 1px solid #999999; background-color: #cccccc; color: #999999; ">'.$translated_label.'</span></a> <span style="color: red; background-color:#ffffcc">'.$original_label.'</span>';
+ }
+
+ }
+ return $translated_label;
+ }
+
+ $this->LoadPhraseByLabel($label, $original_label);
+ return $this->GetPhrase($label);
+ }
+
+ function LoadPhraseByLabel($label, $original_label)
+ {
+ $query = sprintf("SELECT PhraseId, Translation FROM %s WHERE LanguageId = %s AND UPPER(Phrase) = UPPER(%s)",
+ TABLE_PREFIX.'Phrase',
+ $this->LanguageId,
+ $this->Conn->qstr($label));
+ $res = $this->Conn->GetRow($query);
+ if ($res === false || count($res) == 0)
+ {
+ $translation = '!'.$label.'!';
+ if($this->Application->isDebugMode() && constOn('DBG_PHRASES')) {
+ list($edit_tpl, $index_file) = $this->Application->IsAdmin() ? Array('regional/phrases_edit', 'index.php') : Array('phrases_edit', 'index.php');
+
+ if ($this->Application->IsAdmin() && $this->Application->ConfigValue('UsePopups')) {
+ // link to popup when using popups (only in admin)
+ $edit_url = 'javascript:translate_phrase(\''.addslashes($original_label).'\', \''.$edit_tpl.'\');';
+ }
+ else {
+ // direct link, when not using popups OR on frontend
+ $edit_url = $this->Application->HREF($edit_tpl,'',Array('m_opener'=>'d','phrases_label'=>$original_label,'phrases_event'=>'OnNew', 'pass'=>'all,phrases'), $index_file );
+ }
+
+ $translation = '<a href="'.$edit_url.'">!'.$label.'!</a>';
+ if($this->fromTag) $translation = $this->escapeTagReserved($translation);
+ }
+ $this->AddCachedPhrase($label, $translation); //add it as already cached, as long as we dont need to cache not found phrase
+ return false;
+ }
+
+ $this->Phrases[$label] = $res['Translation'];
+ array_push($this->Ids, $res['PhraseId']);
+ $this->Ids = array_unique($this->Ids); //just to make sure
+ return true;
+ }
+
+ /**
+ * Sort params by name and then by length
+ *
+ * @param string $a
+ * @param string $b
+ * @return int
+ * @access private
+ */
+ function CmpParams($a, $b)
+ {
+ $a_len = strlen($a);
+ $b_len = strlen($b);
+ if ($a_len == $b_len) return 0;
+ return $a_len > $b_len ? -1 : 1;
+ }
+
+ /**
+ * Replace language tags in exclamation marks found in text
+ *
+ * @param string $text
+ * @param bool $force_escape force escaping, not escaping of resulting string
+ * @return string
+ * @access public
+ */
+ function ReplaceLanguageTags($text,$forse_escaping=null)
+ {
+ $this->fromTag = true;
+ if( isset($forse_escaping) ) $this->fromTag = $forse_escaping;
+ preg_match_all("(!(la|lu)[^!]+!)", $text, $res, PREG_PATTERN_ORDER);
+ $language_tags = $res[0];
+ uasort($language_tags, Array(&$this, 'CmpParams') );
+
+ $values = Array();
+ $i = 0;
+ foreach ($language_tags as $label) {
+ array_push($values, $this->GetPhrase($label) );
+ //array_push($values, $this->Application->Phrase($label) );
+ $language_tags[$i] = '/' . $language_tags[$i] . '/';
+ $i++;
+ }
+ $this->fromTag = false;
+ return preg_replace($language_tags, $values, $text);
+ }
+
+ /**
+ * Escape chars in phrase translation, that could harm parser to process tag
+ *
+ * @param string $text
+ * @return string
+ * @access private
+ */
+ function escapeTagReserved($text)
+ {
+ $reserved = Array('"',"'"); // =
+ $replacement = Array('\"',"\'"); // \=
+ return str_replace($reserved,$replacement,$text);
+ }
+
+}
+
+
+?>
\ No newline at end of file
Property changes on: branches/unlabeled/unlabeled-1.17.2/core/kernel/languages/phrases_cache.php
___________________________________________________________________
Added: cvs2svn:cvs-rev
## -0,0 +1 ##
+1.17
\ No newline at end of property
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: branches/unlabeled/unlabeled-1.17.2/core/units/groups/groups_config.php
===================================================================
--- branches/unlabeled/unlabeled-1.17.2/core/units/groups/groups_config.php (nonexistent)
+++ branches/unlabeled/unlabeled-1.17.2/core/units/groups/groups_config.php (revision 7642)
@@ -0,0 +1,128 @@
+<?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.total_List'), 'format' => "!la_title_Groups! (#g.total_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!" ),
+
+ 'select_group' => Array('prefixes' => Array('g.user_List'), 'format' => "!la_title_Groups! (#g.user_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'),
+ ),
+ ),
+
+ 'UserGroups' => 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'),
+ ),
+ ),
+
+ '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(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'),
+ 'Description' => Array('title' => 'la_col_Description'),
+ ),
+ ),
+ ),
+
+
+ );
+
+?>
\ No newline at end of file
Property changes on: branches/unlabeled/unlabeled-1.17.2/core/units/groups/groups_config.php
___________________________________________________________________
Added: cvs2svn:cvs-rev
## -0,0 +1 ##
+1.17
\ No newline at end of property
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: branches/unlabeled/unlabeled-1.17.2/core/units/general/cat_tag_processor.php
===================================================================
--- branches/unlabeled/unlabeled-1.17.2/core/units/general/cat_tag_processor.php (nonexistent)
+++ branches/unlabeled/unlabeled-1.17.2/core/units/general/cat_tag_processor.php (revision 7642)
@@ -0,0 +1,218 @@
+<?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');
+ /* @var $export_object kCatDBItemExportHelper */
+
+ $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('in-portal/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.17.2/core/units/general/cat_tag_processor.php
___________________________________________________________________
Added: cvs2svn:cvs-rev
## -0,0 +1 ##
+1.17
\ No newline at end of property
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property

Event Timeline