Page MenuHomeIn-Portal Phabricator

in-portal
No OneTemporary

File Metadata

Created
Fri, Sep 19, 12:42 PM

in-portal

Index: branches/unlabeled/unlabeled-1.8.2/kernel/units/permissions/permissions_tag_processor.php
===================================================================
--- branches/unlabeled/unlabeled-1.8.2/kernel/units/permissions/permissions_tag_processor.php (nonexistent)
+++ branches/unlabeled/unlabeled-1.8.2/kernel/units/permissions/permissions_tag_processor.php (revision 5552)
@@ -0,0 +1,181 @@
+<?php
+
+ class PermissionsTagProcessor extends kDBTagProcessor {
+
+ function HasPermission($params)
+ {
+ $section_name = $params['section_name'];
+
+ $sections_helper =& $this->Application->recallObject('SectionsHelper');
+ $section_data =& $sections_helper->getSectionData($section_name);
+
+ return array_search($params['perm_name'], $section_data['permissions']) !== false;
+ }
+
+ function HasAdvancedPermissions($params)
+ {
+ $section_name = $params['section_name'];
+
+ $sections_helper =& $this->Application->recallObject('SectionsHelper');
+ $section_data =& $sections_helper->getSectionData($section_name);
+
+ $ret = false;
+ foreach ($section_data['permissions'] as $perm_name) {
+ if (preg_match('/^advanced:(.*)/', $perm_name)) {
+ $ret = true;
+ break;
+ }
+ }
+ return $ret;
+ }
+
+ function PermissionValue($params)
+ {
+ $section_name = $params['section_name'];
+
+ $sections_helper =& $this->Application->recallObject('SectionsHelper');
+ $section_data =& $sections_helper->getSectionData($section_name);
+ $perm_name = $params['perm_name'];
+
+ $permissions_helper =& $this->Application->recallObject('PermissionsHelper');
+ if (!$permissions_helper->isOldPermission($section_name, $perm_name)) {
+ $perm_name = $section_name.'.'.$perm_name;
+ }
+
+ return $permissions_helper->getPermissionValue($perm_name);
+ }
+
+ function LoadPermissions($params)
+ {
+ $permissions_helper =& $this->Application->recallObject('PermissionsHelper');
+ $prefix_parts = explode('-', $this->Prefix, 2);
+ $permissions_helper->LoadPermissions($this->Application->GetVar('g_id'), 0, 1);
+ }
+
+ function LevelIndicator($params)
+ {
+ return $params['level'] * $params['multiply'];
+ }
+
+ function PrintPermissions($params)
+ {
+ $category =& $this->Application->recallObject('c');
+
+ $group_id = $this->Application->GetVar('group_id');
+ $prefix = $this->Application->GetVar('item_prefix');
+ $module = $this->Application->findModule('Var', $prefix, 'Name');
+
+ $perm_live_table = $this->Application->getUnitOption('c-perm', 'TableName');
+ $perm_temp_table = $this->Application->GetTempName($perm_live_table);
+
+ $categories = explode('|', substr($category->GetDBField('ParentPath'), 1, -1));
+ if (count($categories) == 1) {
+ // category located in root category ("Home") => then add it to path virtually
+ array_unshift($categories, 0);
+ }
+ $this_cat = array_pop($categories);
+
+ // get permission name + category position in parent path that has value set for that permission
+ $case = 'MAX(CASE c.CategoryId';
+ foreach ($categories as $pos => $cat_id) {
+ $case .= ' WHEN '.$cat_id.' THEN '.$pos;
+ }
+ $case .= ' END) AS InheritedPosition';
+ $sql = 'SELECT '.$case.', p.Permission AS Perm
+ FROM '.TABLE_PREFIX.'Category c
+ LEFT JOIN '.$perm_live_table.' p ON p.CatId = c.CategoryId
+ LEFT JOIN '.TABLE_PREFIX.'PermissionConfig pc ON pc.PermissionName = p.Permission
+ WHERE
+ CategoryId IN ('.implode(',', $categories).') AND
+ ModuleId = "'.$module.'" AND
+ (
+ (p.GroupId = '.$group_id.' AND p.Type = 0)
+ )
+ GROUP BY Perm';
+ $perm_positions = $this->Conn->GetCol($sql, 'Perm');
+
+ $pos_sql = '';
+ foreach ($perm_positions as $perm_name => $category_pos) {
+ $pos_sql .= '(#TABLE_PREFIX#.Permission = "'.$perm_name.'" AND #TABLE_PREFIX#.CatId = '.$categories[$category_pos].') OR ';
+ }
+ $pos_sql = $pos_sql ? preg_replace('/(.*) OR $/', '\\1', $pos_sql) : '0';
+
+ // get all permissions list with iheritence status, inherited category id and permission value
+ $sql = 'SELECT pc.PermissionName,
+ pc.Description,
+ IF (tmp_p.PermissionValue IS NULL AND p.PermissionValue IS NULL,
+ 0,
+ IF (tmp_p.PermissionValue IS NOT NULL, tmp_p.PermissionValue, p.PermissionValue)
+ ) AS Value,
+ IF (tmp_p.CatId IS NOT NULL, tmp_p.CatId, IF(p.CatId IS NOT NULL, p.CatId, 0) ) AS InheritedFrom,
+ IF(tmp_p.CatId = '.$category->GetID().', 0, 1) AS Inherited,
+ IF(p.PermissionValue IS NOT NULL, p.PermissionValue, 0) AS InheritedValue
+ FROM '.TABLE_PREFIX.'PermissionConfig pc
+ LEFT JOIN '.$perm_live_table.' p
+ ON (p.Permission = pc.PermissionName) AND ('.str_replace('#TABLE_PREFIX#', 'p', $pos_sql).') AND (p.GroupId = '.$group_id.')
+ LEFT JOIN '.$perm_temp_table.' tmp_p
+ ON (tmp_p.Permission = pc.PermissionName) AND (tmp_p.CatId = '.$this_cat.') AND (tmp_p.GroupId = '.$group_id.')
+ WHERE ModuleId = "'.$module.'"';
+ $permissions = $this->Conn->Query($sql);
+
+ $ret = '';
+ $block_params = array_merge_recursive2( $this->prepareTagParams($params), Array('name' => $params['render_as']));
+ foreach ($permissions as $perm_record) {
+ $block_params = array_merge_recursive2($block_params, $perm_record);
+ $ret .= $this->Application->ParseBlock($block_params);
+ }
+ return $ret;
+ }
+
+ /**
+ * Print module tab for each module
+ *
+ * @param Array $params
+ * @return string
+ */
+ function PrintTabs($params)
+ {
+ $ret = '';
+ $block_params = $params;
+ foreach ($this->Application->ModuleInfo as $module_name => $module_data) {
+ $params['item_prefix'] = $module_data['Var'];
+ $ret .= $this->Application->ProcessParsedTag('m', 'MyInclude', $params);
+ }
+ return $ret;
+ }
+
+ /**
+ * Returns category name by ID
+ *
+ * @param Array $params
+ */
+ function CategoryPath($params)
+ {
+ $category_id = $params['cat_id'];
+ $category_path = $this->Application->getCache('category_paths', $category_id);
+ if ($category_path === false) {
+ // not chached
+ if ($category_id > 0) {
+ $id_field = $this->Application->getUnitOption('c', 'IDField');
+ $table_name = $this->Application->getUnitOption('c', 'TableName');
+ $sql = 'SELECT CachedNavbar
+ FROM '.$table_name.'
+ WHERE '.$id_field.' = '.$category_id;
+ $category_path = trim($this->CategoryPath( Array('cat_id' => 0) ).'>'.$this->Conn->GetOne($sql), '>');
+ }
+ else {
+ $category_path = $this->Application->Phrase( $this->Application->ConfigValue('Root_Name') );
+ }
+ $this->Application->setCache('category_paths', $category_id, $category_path);
+ }
+ return $category_path;
+ }
+
+ function PermInputName($params)
+ {
+ return $this->Prefix.'['.$this->Application->GetVar('group_id').']['.$this->Application->Parser->GetParam('PermissionName').']['.$params['sub_key'].']';
+ }
+
+ }
+
+?>
\ No newline at end of file
Property changes on: branches/unlabeled/unlabeled-1.8.2/kernel/units/permissions/permissions_tag_processor.php
___________________________________________________________________
Added: cvs2svn:cvs-rev
## -0,0 +1 ##
+1.8
\ No newline at end of property
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: branches/unlabeled/unlabeled-1.8.2/kernel/units/general/helpers/sections_helper.php
===================================================================
--- branches/unlabeled/unlabeled-1.8.2/kernel/units/general/helpers/sections_helper.php (nonexistent)
+++ branches/unlabeled/unlabeled-1.8.2/kernel/units/general/helpers/sections_helper.php (revision 5552)
@@ -0,0 +1,115 @@
+<?php
+
+ /**
+ * Porcesses sections information from configs
+ *
+ */
+ class kSectionsHelper extends kHelper {
+
+ /**
+ * Holds information about all sections
+ *
+ * @var Array
+ */
+ var $Tree = Array();
+
+ /**
+ * Set's prefix and special
+ *
+ * @param string $prefix
+ * @param string $special
+ * @access public
+ */
+ function Init($prefix, $special, $event_params = null)
+ {
+ parent::Init($prefix, $special, $event_params);
+ $this->BuildTree();
+ }
+
+ /**
+ * Builds xml for tree in left frame in admin
+ *
+ * @param Array $params
+ */
+ function BuildTree()
+ {
+ $unit_config_reader = false;
+ $data = $this->Conn->GetRow('SELECT Data, Cached FROM '.TABLE_PREFIX.'Cache WHERE VarName = "sections_parsed"');
+ if ($data) {
+ $this->Tree = unserialize($data['Data']);
+ return ;
+ }
+ $this->Application->UnitConfigReader->includeConfigFiles(MODULES_PATH);
+ $this->Application->UnitConfigReader->AfterConfigRead();
+
+ $this->Tree = Array();
+ if (!$unit_config_reader) {
+ $unit_config_reader =& $this->Application->recallObject('kUnitConfigReader');
+ }
+
+ $prefixes = array_keys($unit_config_reader->configData);
+ foreach ($prefixes as $prefix) {
+ $config =& $unit_config_reader->configData[$prefix];
+ $sections = getArrayValue($config, 'Sections');
+ if (!$sections) continue;
+
+// echo 'Prefix: ['.$prefix.'] has ['.count($sections).'] sections<br />';
+
+ foreach ($sections as $section_name => $section_params) {
+ // we could also skip not allowed sections here in future
+ $section_params['SectionPrefix'] = $prefix;
+ $section_params['url']['m_opener'] = 'r';
+
+ $pass_section = getArrayValue($section_params, 'url', 'pass_section');
+
+ if ($pass_section) {
+ unset($section_params['url']['pass_section']);
+ $section_params['url']['section'] = $section_name;
+ if (!isset($section_params['url']['module'])) {
+ $module_name = $this->Application->findModule('Path', $config['ModuleFolder'].'/', 'Name');
+ $section_params['url']['module'] = $module_name;
+ }
+ }
+
+ if (!isset($section_params['url']['t'])) {
+ $section_params['url']['t'] = 'index';
+ }
+
+ if (!isset($section_params['onclick'])) {
+ $section_params['onclick'] = 'checkEditMode()';
+ }
+
+ $current_data = isset($this->Tree[$section_name]) ? $this->Tree[$section_name] : Array();
+ $this->Tree[$section_name] = array_merge_recursive2($current_data, $section_params);
+
+ $this->Tree[ $section_params['parent'] ]['children'][ "{$section_params['priority']}" ] = $section_name;
+
+ if ($section_params['type'] == stTAB) {
+ // if this is tab, then mark parent section as TabOnly
+ $this->Tree[ $section_params['parent'] ]['tabs_only'] = true;
+ }
+ }
+ }
+
+ $this->Conn->Query('REPLACE '.TABLE_PREFIX.'Cache (VarName, Data, Cached) VALUES ("sections_parsed", '.$this->Conn->qstr(serialize($this->Tree)).', '.adodb_mktime().')');
+ }
+
+ /**
+ * Returns details information about section
+ *
+ * @param string $section_name
+ * @return Array
+ */
+ function &getSectionData($section_name)
+ {
+ if (isset($this->Tree[$section_name])) {
+ $ret =& $this->Tree[$section_name];
+ }
+ else {
+ $ret = Array();
+ }
+ return $ret;
+ }
+ }
+
+?>
\ No newline at end of file
Property changes on: branches/unlabeled/unlabeled-1.8.2/kernel/units/general/helpers/sections_helper.php
___________________________________________________________________
Added: cvs2svn:cvs-rev
## -0,0 +1 ##
+1.8
\ No newline at end of property
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: branches/unlabeled/unlabeled-1.8.2/kernel/units/general/general_config.php
===================================================================
--- branches/unlabeled/unlabeled-1.8.2/kernel/units/general/general_config.php (nonexistent)
+++ branches/unlabeled/unlabeled-1.8.2/kernel/units/general/general_config.php (revision 5552)
@@ -0,0 +1,26 @@
+<?php
+
+$config = Array(
+ 'Prefix' => 'm',
+ 'EventHandlerClass' => Array('class' => 'MainEventHandler', 'file' => 'main_event_handler.php', 'build_event' => 'OnBuild'),
+ /*'TagProcessorClass' => Array('class'=>'kMainTagProcessor','file'=>'','build_event'=>'OnBuild'),*/
+
+ 'QueryString' => Array(
+ 1 => 'cat_id',
+ 2 => 'cat_page',
+ 3 => 'lang',
+ 4 => 'theme',
+ 5 => 'opener',
+ ),
+ 'TitleField' => 'CachedNavbar',
+ 'TitlePhrase' => 'la_Text_Category',
+ 'ItemType' => 1,
+ 'TableName' => TABLE_PREFIX.'Category',
+
+ 'PortalStyleEnv' => true,
+
+ 'PermTabText' => 'In-Portal',
+ 'PermSection' => Array('search' => 'in-portal:configuration_search', 'custom' => 'in-portal:configuration_custom'),
+ );
+
+?>
\ No newline at end of file
Property changes on: branches/unlabeled/unlabeled-1.8.2/kernel/units/general/general_config.php
___________________________________________________________________
Added: cvs2svn:cvs-rev
## -0,0 +1 ##
+1.8
\ No newline at end of property
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: branches/unlabeled/unlabeled-1.8.2/kernel/admin_templates/categories/categories_edit_permissions.tpl
===================================================================
--- branches/unlabeled/unlabeled-1.8.2/kernel/admin_templates/categories/categories_edit_permissions.tpl (nonexistent)
+++ branches/unlabeled/unlabeled-1.8.2/kernel/admin_templates/categories/categories_edit_permissions.tpl (revision 5552)
@@ -0,0 +1,199 @@
+<inp2:m_RequireLogin permissions="CATEGORY.VIEW"/>
+<inp2:m_include t="incs/header" nobody="yes"/>
+
+<body topmargin="0" leftmargin="8" marginheight="0" marginwidth="8" bgcolor="#FFFFFF" onload="$PermManager.Init();">
+<inp2:m_ParseBlock name="section_header" prefix="c" icon="icon46_catalog" module="in-portal" title="la_title_Categories"/>
+
+<inp2:m_include t="categories/categories_tabs"/>
+
+<inp2:m_ParseBlock name="blue_bar" prefix="c" title_preset="categories_permissions" module="in-portal" icon="icon46_catalog"/>
+
+<!-- ToolBar --->
+<table class="toolbar" height="30" cellspacing="0" cellpadding="0" width="100%" border="0">
+<tbody>
+ <tr>
+ <td>
+ <script type="text/javascript" src="incs/ajax.js"></script>
+ <script type="text/javascript" src="incs/catalog.js"></script>
+ <script type="text/javascript">
+ Request.progressText = '<inp2:m_phrase name="la_title_Loading" escape="1"/>';
+
+ Catalog.prototype.Init = function () {
+ var $prefix = this.queryTabRegistry('prefix', this.ActivePrefix, 'prefix');
+ if ($prefix !== this.ActivePrefix && this.TabRegistry.length > 0) {
+ // ActivePrefix not set or has non-existing prefix value
+ this.ActivePrefix = this.TabRegistry[0]['prefix'];
+ }
+ Grids['g'].SelectFirst();
+ }
+
+ Catalog.prototype.go_to_group = function($group_id) {
+ if (!isset($group_id)) {
+ $group_id = 0; // gets current group
+ }
+ else {
+ set_hidden_field('current_group_id', $group_id);
+ }
+
+ this.switchTab(); // refresh current item tab
+ }
+
+ Catalog.prototype.refreshTab = function($prefix, $div_id) {
+ var $group_id = get_hidden_field('current_group_id');
+// alert('refreshTab. GroupID: '+$group_id);
+ var $tab_group_id = document.getElementById($div_id).getAttribute('group_id');
+ if ($group_id != $tab_group_id) {
+ // query tab content only in case if not queried or category don't match
+ var $url = this.URLMask.replace('#ITEM_PREFIX#', $prefix).replace('#GROUP_ID#', $group_id);
+ this.BusyRequest[$prefix] = false;
+
+ Request.makeRequest($url, this.BusyRequest[$prefix], $div_id, this.successCallback, this.errorCallback, $div_id, this);
+ }
+ /*else {
+ alert('refresh disabled = {tab: '+this.ActivePrefix+'; group_id: '+$group_id+'}');
+ }*/
+ }
+
+ // adds information about tab to tab_registry
+ Catalog.prototype.registerTab = function($tab_id) {
+ var $tab = document.getElementById($tab_id + '_div');
+ var $index = this.TabRegistry.length;
+ this.TabRegistry[$index] = new Array();
+ this.TabRegistry[$index]['tab_id'] = $tab_id;
+ this.TabRegistry[$index]['prefix'] = $tab.getAttribute('prefix');
+ this.TabRegistry[$index]['dep_buttons'] = new Array();
+ this.TabRegistry[$index]['index'] = $index;
+ }
+
+ Catalog.prototype.submit_event = function($prefix_special, $event, $t) {
+ var $prev_template = get_hidden_field('t');
+ if (isset($event)) set_hidden_field('events[' + $prefix_special + ']', $event);
+ if (isset($t)) set_hidden_field('t', $t);
+
+ var $tab_id = this.queryTabRegistry('prefix', this.ActivePrefix, 'tab_id');
+ this.submit_kernel_form();
+
+ set_hidden_field('t', $prev_template);
+ }
+
+ var $PermManager = new Catalog('<inp2:m_Link template="categories/permissions_tab" item_prefix="#ITEM_PREFIX#" group_id="#GROUP_ID#" no_amp="1" pass="m,c"/>', 'permmanager_');
+
+ a_toolbar = new ToolBar();
+ a_toolbar.AddButton( new ToolBarButton('select', '<inp2:m_phrase label="la_ToolTip_Save" escape="1"/>', function() {
+ submit_event('c','<inp2:c_SaveEvent/>');
+ }
+ ) );
+ a_toolbar.AddButton( new ToolBarButton('cancel', '<inp2:m_phrase label="la_ToolTip_Cancel" escape="1"/>', function() {
+ submit_event('c','OnCancelEdit');
+ }
+ ) );
+
+ a_toolbar.AddButton( new ToolBarSeparator('sep1') );
+
+ a_toolbar.AddButton( new ToolBarButton('prev', '<inp2:m_phrase label="la_ToolTip_Prev" escape="1"/>', function() {
+ go_to_id('c', '<inp2:c_PrevId/>');
+ }
+ ) );
+ a_toolbar.AddButton( new ToolBarButton('next', '<inp2:m_phrase label="la_ToolTip_Next" escape="1"/>', function() {
+ go_to_id('c', '<inp2:c_NextId/>');
+ }
+ ) );
+
+ function edit(){ }
+
+ a_toolbar.Render();
+
+ <inp2:m_if check="c_IsSingle">
+ a_toolbar.HideButton('prev');
+ a_toolbar.HideButton('next');
+ a_toolbar.HideButton('sep1');
+ <inp2:m_else/>
+ <inp2:m_if check="c_IsLast">
+ a_toolbar.DisableButton('next');
+ </inp2:m_if>
+ <inp2:m_if check="c_IsFirst">
+ a_toolbar.DisableButton('prev');
+ </inp2:m_if>
+ </inp2:m_if>
+ </script>
+ </td>
+ </tr>
+</tbody>
+</table>
+
+<inp2:c_SaveWarning name="grid_save_warning"/>
+<inp2:m_ParseBlock name="grid" PrefixSpecial="g" IdField="GroupId" per_page="-1" grid="Radio" header_block="grid_column_title_no_sorting"/>
+<br />
+<!-- item tabs: begin -->
+<table cellpadding="0" cellspacing="0">
+ <tr>
+ <inp2:m_DefineElement name="item_tab" title="">
+ <td nowrap="nowrap" width="140">
+ <table id="<inp2:m_param name="prefix"/>_tab" cellpadding="0" cellspacing="0" width="100%" class="catalog-tab-unselected" onclick="$PermManager.switchTab('<inp2:m_param name="prefix"/>');">
+ <tr>
+ <td class="catalog-tab-left">
+ <img src="img/spacer.gif" height="22" width="9" />
+ </td>
+ <td class="catalog-tab-middle" width="100%" valign="middle" nowrap="nowrap">
+ <inp2:m_param name="title"/>
+ </td>
+ <td class="catalog-tab-right">
+ <img src="img/spacer.gif" height="22" width="9" />
+ </td>
+ <td style="background-color: #FFFFFF;">
+ <img src="img/spacer.gif" height="1" width="5" />
+ </td>
+ </tr>
+ </table>
+
+ </td>
+ </inp2:m_DefineElement>
+ <inp2:adm_ListCatalogTabs render_as="item_tab" title_property="PermTabText"/>
+ </tr>
+</table>
+<!-- item tabs: end -->
+
+<inp2:c-perm_PrintTabs template="categories/permissions_tab" tab_init="1"/>
+
+<inp2:m_include t="incs/footer"/>
+
+<script type="text/javascript">
+ Grids['g'].OnSelect = function ($id) {
+ $PermManager.go_to_group($id);
+ }
+
+ Grids['g'].OnUnSelect = function ($id) {
+ set_hidden_field('group_id', $id);
+ set_hidden_field('item_prefix', $PermManager.ActivePrefix);
+ $PermManager.submit_event('c', 'OnPreSave', 'categories/permissions_tab');
+ }
+
+ Grids['g'].SelectFirst = function () {
+ for (var $i in this.Items) {
+ this.Items[$i].Select();
+ break;
+ }
+ }
+
+ Grids['g'].RadioMode = true;
+
+ function update_light(perm_name, value)
+ {
+ var $img_base = img_path.replace('#MODULE#', 'kernel');
+ document.getElementById('light_'+perm_name).src = $img_base + 'perm_' + (value ? 'green' : 'red') + '.gif';
+ }
+
+ function inherited_click(perm_name, inherited_value, state, access_cb_id)
+ {
+ if (state) {
+ update_light(perm_name, inherited_value);
+ document.getElementById(access_cb_id).disabled = true;
+ }
+ else {
+ update_light(perm_name, document.getElementById(access_cb_id).checked)
+ document.getElementById(access_cb_id).disabled = false;
+ }
+ }
+</script>
+
+
\ No newline at end of file
Property changes on: branches/unlabeled/unlabeled-1.8.2/kernel/admin_templates/categories/categories_edit_permissions.tpl
___________________________________________________________________
Added: cvs2svn:cvs-rev
## -0,0 +1 ##
+1.8
\ No newline at end of property
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: branches/unlabeled/unlabeled-1.8.2/admin/install/upgrades/inportal_upgrade_v1.2.1.sql
===================================================================
--- branches/unlabeled/unlabeled-1.8.2/admin/install/upgrades/inportal_upgrade_v1.2.1.sql (nonexistent)
+++ branches/unlabeled/unlabeled-1.8.2/admin/install/upgrades/inportal_upgrade_v1.2.1.sql (revision 5552)
@@ -0,0 +1,71 @@
+ALTER TABLE Cache ADD LifeTime INT NOT NULL DEFAULT '-1';
+ALTER TABLE ConfigurationAdmin CHANGE DisplayOrder DisplayOrder DOUBLE NOT NULL DEFAULT '0';
+ALTER TABLE ConfigurationAdmin ADD GroupDisplayOrder DOUBLE NOT NULL AFTER DisplayOrder;
+
+UPDATE ConfigurationAdmin SET DisplayOrder = '10.01', GroupDisplayOrder = 1 WHERE VariableName = 'Category_Sortfield';
+UPDATE ConfigurationAdmin SET DisplayOrder = '10.01', GroupDisplayOrder = 2 WHERE VariableName = 'Category_Sortorder';
+UPDATE ConfigurationAdmin SET DisplayOrder = '10.02', GroupDisplayOrder = 1 WHERE VariableName = 'Category_Sortfield2';
+UPDATE ConfigurationAdmin SET DisplayOrder = '10.02', GroupDisplayOrder = 2 WHERE VariableName = 'Category_Sortorder2';
+UPDATE ConfigurationAdmin SET DisplayOrder = '10.03' WHERE VariableName = 'Perpage_Category';
+UPDATE ConfigurationAdmin SET DisplayOrder = '10.04' WHERE VariableName = 'Perpage_Category_Short';
+UPDATE ConfigurationAdmin SET DisplayOrder = '10.05' WHERE VariableName = 'Category_DaysNew';
+UPDATE ConfigurationAdmin SET DisplayOrder = '10.06' WHERE VariableName = 'Category_ShowPick';
+UPDATE ConfigurationAdmin SET DisplayOrder = '10.07' WHERE VariableName = 'Root_Name';
+UPDATE ConfigurationAdmin SET DisplayOrder = '10.08' WHERE VariableName = 'MaxImportCategoryLevels';
+UPDATE ConfigurationAdmin SET DisplayOrder = '20.01' WHERE VariableName = 'Category_MetaKey';
+UPDATE ConfigurationAdmin SET DisplayOrder = '20.02' WHERE VariableName = 'Category_MetaDesc';
+
+UPDATE ConfigurationAdmin SET DisplayOrder = '10.01' WHERE VariableName = 'User_Allow_New';
+UPDATE ConfigurationAdmin SET DisplayOrder = '10.02' WHERE VariableName = 'Email_As_Login';
+UPDATE ConfigurationAdmin SET DisplayOrder = '10.03' WHERE VariableName = 'Min_UserName';
+UPDATE ConfigurationAdmin SET DisplayOrder = '10.04' WHERE VariableName = 'Min_Password';
+UPDATE ConfigurationAdmin SET DisplayOrder = '10.05' WHERE VariableName = 'Users_AllowReset';
+UPDATE ConfigurationAdmin SET DisplayOrder = '10.06' WHERE VariableName = 'User_Password_Auto';
+UPDATE ConfigurationAdmin SET DisplayOrder = '10.07' WHERE VariableName = 'User_MembershipExpirationReminder';
+UPDATE ConfigurationAdmin SET DisplayOrder = '10.08' WHERE VariableName = 'User_NewGroup';
+UPDATE ConfigurationAdmin SET DisplayOrder = '10.09' WHERE VariableName = 'User_LoggedInGroup';
+UPDATE ConfigurationAdmin SET DisplayOrder = '10.10' WHERE VariableName = 'User_GuestGroup';
+UPDATE ConfigurationAdmin SET DisplayOrder = '10.11' WHERE VariableName = 'User_SubscriberGroup';
+UPDATE ConfigurationAdmin SET DisplayOrder = '10.12' WHERE VariableName = 'RootPass';
+UPDATE ConfigurationAdmin SET DisplayOrder = '10.13' WHERE VariableName = 'RootPassVerify';
+UPDATE ConfigurationAdmin SET DisplayOrder = '20.01' WHERE VariableName = 'User_Votes_Deny';
+UPDATE ConfigurationAdmin SET DisplayOrder = '20.02' WHERE VariableName = 'User_Review_Deny';
+
+UPDATE ConfigurationAdmin SET DisplayOrder = '10.01' WHERE VariableName = 'Site_Path';
+UPDATE ConfigurationAdmin SET DisplayOrder = '10.02' WHERE VariableName = 'Site_Name';
+UPDATE ConfigurationAdmin SET DisplayOrder = '10.03' WHERE VariableName = 'CookieSessions';
+UPDATE ConfigurationAdmin SET DisplayOrder = '10.04' WHERE VariableName = 'SessionCookieName';
+UPDATE ConfigurationAdmin SET DisplayOrder = '10.05' WHERE VariableName = 'SessionTimeout';
+UPDATE ConfigurationAdmin SET DisplayOrder = '10.06' WHERE VariableName = 'SessionReferrerCheck';
+UPDATE ConfigurationAdmin SET DisplayOrder = '10.07' WHERE VariableName = 'SystemTagCache';
+UPDATE ConfigurationAdmin SET DisplayOrder = '10.08' WHERE VariableName = 'SocketBlockingMode';
+UPDATE ConfigurationAdmin SET DisplayOrder = '10.09' WHERE VariableName = 'SSL_URL';
+UPDATE ConfigurationAdmin SET DisplayOrder = '10.10' WHERE VariableName = 'Require_SSL';
+UPDATE ConfigurationAdmin SET DisplayOrder = '10.11' WHERE VariableName = 'Force_HTTP_When_SSL_Not_Required';
+UPDATE ConfigurationAdmin SET DisplayOrder = '10.12' WHERE VariableName = 'UseModRewrite';
+UPDATE ConfigurationAdmin SET DisplayOrder = '10.13' WHERE VariableName = 'UseModRewriteWithSSL';
+UPDATE ConfigurationAdmin SET DisplayOrder = '10.14' WHERE VariableName = 'UseJSRedirect';
+UPDATE ConfigurationAdmin SET DisplayOrder = '10.15' WHERE VariableName = 'UseCronForRegularEvent';
+UPDATE ConfigurationAdmin SET DisplayOrder = '10.16' WHERE VariableName = 'ErrorTemplate';
+UPDATE ConfigurationAdmin SET DisplayOrder = '10.17' WHERE VariableName = 'NoPermissionTemplate';
+UPDATE ConfigurationAdmin SET DisplayOrder = '20.01' WHERE VariableName = 'Config_Server_Time';
+UPDATE ConfigurationAdmin SET DisplayOrder = '20.02' WHERE VariableName = 'Config_Site_Time';
+UPDATE ConfigurationAdmin SET DisplayOrder = '20.03' WHERE VariableName = 'FirstDayOfWeek';
+UPDATE ConfigurationAdmin SET DisplayOrder = '30.01' WHERE VariableName = 'Smtp_Server';
+UPDATE ConfigurationAdmin SET DisplayOrder = '30.02' WHERE VariableName = 'Smtp_Port';
+UPDATE ConfigurationAdmin SET DisplayOrder = '30.03' WHERE VariableName = 'Smtp_Authenticate';
+UPDATE ConfigurationAdmin SET DisplayOrder = '30.04' WHERE VariableName = 'Smtp_User';
+UPDATE ConfigurationAdmin SET DisplayOrder = '30.05' WHERE VariableName = 'Smtp_Pass';
+UPDATE ConfigurationAdmin SET DisplayOrder = '30.06' WHERE VariableName = 'Smtp_DefaultHeaders';
+UPDATE ConfigurationAdmin SET DisplayOrder = '30.07' WHERE VariableName = 'Smtp_AdminMailFrom';
+UPDATE ConfigurationAdmin SET DisplayOrder = '40.01' WHERE VariableName = 'Backup_Path';
+
+ALTER TABLE Category ADD COLUMN l1_Name varchar(255) NOT NULL default '' AFTER Name, ADD INDEX (l1_Name(5)), ADD COLUMN l2_Name varchar(255) NOT NULL default '' AFTER l1_Name, ADD INDEX (l2_Name(5)), ADD COLUMN l3_Name varchar(255) NOT NULL default '' AFTER l2_Name, ADD INDEX (l3_Name(5)), ADD COLUMN l4_Name varchar(255) NOT NULL default '' AFTER l3_Name, ADD INDEX (l4_Name(5)), ADD COLUMN l5_Name varchar(255) NOT NULL default '' AFTER l4_Name, ADD INDEX (l5_Name(5)), ADD COLUMN l1_Description text NOT NULL AFTER Description, ADD INDEX (l1_Description(5)), ADD COLUMN l2_Description text NOT NULL AFTER l1_Description, ADD INDEX (l2_Description(5)), ADD COLUMN l3_Description text NOT NULL AFTER l2_Description, ADD INDEX (l3_Description(5)), ADD COLUMN l4_Description text NOT NULL AFTER l3_Description, ADD INDEX (l4_Description(5)), ADD COLUMN l5_Description text NOT NULL AFTER l4_Description, ADD INDEX (l5_Description(5));
+
+ALTER TABLE Permissions ADD UNIQUE PermIndex (Permission, GroupId, CatId, Type);
+REPLACE INTO Permissions (Permission, GroupId, PermissionValue, Type, CatId) VALUES ('CATEGORY.VIEW', 11, 1, 0, 0);
+
+ALTER TABLE CategoryItems ADD `ItemPrefix` VARCHAR( 50 ) NOT NULL AFTER `PrimaryCat`, ADD `Filename` VARCHAR( 255 ) NOT NULL AFTER `ItemPrefix` ;
+ALTER TABLE CategoryItems ADD INDEX `Filename` ( `Filename` ( 4 ) );
+
+UPDATE Modules SET Version = '1.2.1' WHERE Name = 'In-Portal';
\ No newline at end of file
Property changes on: branches/unlabeled/unlabeled-1.8.2/admin/install/upgrades/inportal_upgrade_v1.2.1.sql
___________________________________________________________________
Added: cvs2svn:cvs-rev
## -0,0 +1 ##
+1.8
\ No newline at end of property
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: branches/unlabeled/unlabeled-1.8.2/core/kernel/utility/debugger/debugger.js
===================================================================
--- branches/unlabeled/unlabeled-1.8.2/core/kernel/utility/debugger/debugger.js (nonexistent)
+++ branches/unlabeled/unlabeled-1.8.2/core/kernel/utility/debugger/debugger.js (revision 5552)
@@ -0,0 +1,272 @@
+function DebugReq() {}
+
+DebugReq.timeout = 5000; //5 seconds
+
+DebugReq.makeRequest = function(p_url, p_busyReq, p_progId, p_successCallBack, p_errorCallBack, p_pass, p_object) {
+ //p_url: the web service url
+ //p_busyReq: is a request for this object currently in progress?
+ //p_progId: element id where progress HTML should be shown
+ //p_successCallBack: callback function for successful response
+ //p_errorCallBack: callback function for erroneous response
+ //p_pass: string of params to pass to callback functions
+ //p_object: object of params to pass to callback functions
+ if (p_busyReq) {
+ return;
+ }
+ var req = DebugReq.getRequest();
+ if (req != null) {
+ p_busyReq = true;
+ DebugReq.showProgress(p_progId);
+ req.onreadystatechange = function() {
+ if (req.readyState == 4) {
+ p_busyReq = false;
+ window.clearTimeout(toId);
+ if (req.status == 200) {
+ p_successCallBack(req,p_pass,p_object);
+ } else {
+ p_errorCallBack(req,p_pass,p_object);
+ }
+ }
+ }
+ req.open('GET', p_url, true);
+ req.setRequestHeader('If-Modified-Since', 'Sat, 1 Jan 2000 00:00:00 GMT');
+ req.send(null);
+ var toId = window.setTimeout( function() {if (p_busyReq) req.abort();}, DebugReq.timeout );
+ }
+}
+
+DebugReq.getRequest = function() {
+ var xmlHttp;
+ try { xmlHttp = new ActiveXObject('MSXML2.XMLHTTP'); return xmlHttp; } catch (e) {}
+ try { xmlHttp = new ActiveXObject('Microsoft.XMLHTTP'); return xmlHttp; } catch (e) {}
+ try { xmlHttp = new XMLHttpRequest(); return xmlHttp; } catch(e) {}
+ return null;
+}
+
+DebugReq.showProgress = function(p_id) {
+ $Debugger.AppendRow(DebugReq.getProgressHtml());
+}
+
+DebugReq.getProgressHtml = function() {
+ return 'Loading ...';
+}
+
+DebugReq.getErrorHtml = function(p_req) {
+ //TODO: implement accepted way to handle request error
+ return "<p>" + "(" + p_req.status + ") " + p_req.statusText + "</p>"
+}
+
+// Debugger
+function Debugger() {
+ this.IsQueried = false;
+ this.IsVisible = false;
+ this.DebuggerDIV = document.getElementById('debug_layer');
+ this.DebuggerTable = document.getElementById('debug_table');
+ this.RowCount = 0;
+ this.busyRequest = false;
+
+// window.$Debugger = this; // this should be uncommented in case if debugger variable is not $Debugger
+ window.onscroll = function(ev) { window.$Debugger.Resize(ev); }
+ window.onresize = function(ev) { window.$Debugger.Resize(ev); }
+ document.onkeydown = function(ev) { window.$Debugger.KeyDown(ev); }
+}
+
+Debugger.prototype.AppendRow = function($html) {
+ this.RowCount++;
+ var $tr = document.createElement('TR');
+ this.DebuggerTable.appendChild($tr);
+ $tr.className = 'debug_row_' + (this.RowCount % 2 ? 'odd' : 'even');
+ $tr.id = 'debug_row_' + this.RowCount;
+ var $td = document.createElement('TD');
+ $td.className = 'debug_cell';
+ $td.innerHTML = $html;
+ $tr.appendChild($td);
+}
+
+Debugger.prototype.RemoveRow = function($row_index) {
+ this.DebuggerTable.deleteRow($row_index);
+ this.RowCount--;
+}
+
+Debugger.prototype.Clear = function() {
+ if (!this.IsQueried) return false;
+
+ this.IsQueried = false;
+ while (this.DebuggerTable.rows.length) {
+ this.RemoveRow(0);
+ }
+}
+
+Debugger.prototype.KeyDown = function($e) {
+ var $KeyCode = this.GetKeyCode($e);
+ if ($KeyCode == 123 || $KeyCode == 27) {// F12 or ESC
+ this.Toggle($KeyCode);
+ this.StopEvent($e);
+ }
+}
+
+Debugger.prototype.OpenDOMViewer = function() {
+ var $value = document.getElementById('dbg_domviewer').value;
+ DOMViewerObj = ($value.indexOf('"') != -1) ? document.getElementById( $value.substring(1,$value.length-1) ) : eval($value);
+ window.open(this.DOMViewerURL);
+ return false;
+}
+
+Debugger.prototype.GetKeyCode = function($e) {
+ $e = ($e) ? $e : event;
+ var target = ($e.target) ? $e.target : $e.scrElement;
+ var charCode = ($e.charCode) ? $e.charCode : (($e.which) ? $e.which : $e.keyCode);
+ return charCode;
+}
+
+Debugger.prototype.StopEvent = function($e) {
+ $e = ($e) ? $e : event;
+ $e.cancelBubble = true;
+ if ($e.stopPropagation) $e.stopPropagation();
+}
+
+Debugger.prototype.Toggle = function($KeyCode) {
+ if(!this.DebuggerDIV) return false;
+ this.IsVisible = this.DebuggerDIV.style.display == 'none' ? false : true;
+ if (!this.IsVisible && $KeyCode == 27) {
+ return false;
+ }
+
+ this.Resize(null);
+ if (!this.IsQueried) {
+ this.Query();
+ }
+
+ this.DebuggerDIV.style.display = this.IsVisible ? 'none' : 'block';
+}
+
+Debugger.prototype.Query = function() {
+ DebugReq.makeRequest(this.DebugURL, this.busyRequest, '', this.successCallback, this.errorCallback, '', this);
+}
+
+Debugger.prototype.successCallback = function(p_req, p_pass, p_object) {
+ var contents = p_req.responseText;
+
+ contents = contents.split(p_object.RowSeparator);
+ if (contents.length == 1) {
+ alert('error: '+p_req.responseText);
+ p_object.IsQueried = true;
+ return ;
+ }
+
+ for (var $i = 0; $i < contents.length - 1; $i++) {
+ p_object.AppendRow(contents[$i]);
+ }
+
+ p_object.Refresh();
+}
+
+Debugger.prototype.errorCallback = function(p_req, p_pass, p_object) {
+ alert('AJAX ERROR: '+DebugReq.getErrorHtml(p_req));
+ p_object.Refresh();
+}
+
+Debugger.prototype.Refresh = function() {
+ // progress mether row
+ this.RemoveRow(0);
+ this.IsQueried = true;
+ this.DebuggerDIV.scrollTop = this.IsFatalError ? 10000000 : 0;
+ this.DebuggerDIV.scrollLeft = 0;
+}
+
+Debugger.prototype.Resize = function($e) {
+ if (!this.DebuggerDIV) return false;
+ var $pageTop = document.all ? document.body.offsetTop + document.body.scrollTop : window.scrollY;
+
+ this.DebuggerDIV.style.top = $pageTop + 'px';
+ this.DebuggerDIV.style.height = GetWindowHeight() + 'px';
+ return true;
+}
+
+function GetWindowHeight() {
+ var currWinHeight;
+ if (window.innerHeight) {//FireFox with correction for status bar at bottom of window
+ currWinHeight = window.innerHeight - 10;
+ } else if (document.documentElement.clientHeight) {//IE 7 with correction for address bar
+ currWinHeight = document.documentElement.clientHeight - 10;
+ } else if (document.body.offsetHeight) {//IE 4+
+ currWinHeight = document.body.offsetHeight - 5 + 15 - 10; // + 10
+ }
+ return currWinHeight;
+}
+
+
+/*function GetWinHeight() {
+ if (window.innerHeight) return window.innerHeight;
+ else if (document.documentElement.clientHeight) return document.documentElement.clientHeight;
+ else if (document.body.offsetHeight) return document.body.offsetHeight;
+ else return _winHeight;
+}*/
+
+Debugger.prototype.SetClipboard = function(copyText) {
+ if (window.clipboardData) {
+ // IE send-to-clipboard method.
+ window.clipboardData.setData('Text', copyText);
+ }
+ else if (window.netscape) {
+ // You have to sign the code to enable this or allow the action in about:config by changing user_pref("signed.applets.codebase_principal_support", true);
+ netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
+
+ // Store support string in an object.
+ var str = Components.classes['@mozilla.org/supports-string;1'].createInstance(Components.interfaces.nsISupportsString);
+ if (!str) {
+ return false;
+ }
+ str.data = copyText;
+
+ // Make transferable.
+ var trans = Components.classes['@mozilla.org/widget/transferable;1'].createInstance(Components.interfaces.nsITransferable);
+ if (!trans) {
+ return false;
+ }
+
+ // Specify what datatypes we want to obtain, which is text in this case.
+ trans.addDataFlavor('text/unicode');
+ trans.setTransferData('text/unicode', str, copyText.length * 2);
+
+ var clipid = Components.interfaces.nsIClipboard;
+ var clip = Components.classes['@mozilla.org/widget/clipboard;1'].getService(clipid);
+ if (!clip) {
+ return false;
+ }
+
+ clip.setData(trans, null, clipid.kGlobalClipboard);
+ }
+}
+
+Debugger.prototype.ShowProps = function($Obj, $Name) {
+ var $ret = '';
+ for ($Prop in $Obj) {
+ $ret += $Name + '.' + $Prop + ' = ' + $Obj[$Prop] + "\n";
+ }
+ return alert($ret);
+}
+
+Debugger.prototype.editFile = function($fileName, $lineNo) {
+ if (!document.all) {
+ alert('Only works in IE');
+ return;
+ }
+
+ if (!this.EditorPath) {
+ alert('Editor path not defined!');
+ return;
+ }
+
+ var $launch_object = new ActiveXObject('LaunchinIE.Launch');
+ var $editor_path = this.EditorPath;
+ $editor_path = $editor_path.replace('%F', $fileName);
+ $editor_path = $editor_path.replace('%L',$lineNo);
+ $launch_object.LaunchApplication($editor_path);
+}
+
+Debugger.prototype.ToggleTraceArgs = function($arguments_layer_id) {
+ var $arguments_layer = document.getElementById($arguments_layer_id);
+ $arguments_layer.style.display = ($arguments_layer.style.display == 'none') ? 'block' : 'none';
+}
+
Property changes on: branches/unlabeled/unlabeled-1.8.2/core/kernel/utility/debugger/debugger.js
___________________________________________________________________
Added: cvs2svn:cvs-rev
## -0,0 +1 ##
+1.8
\ No newline at end of property
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: branches/unlabeled/unlabeled-1.8.2/core/units/permissions/permissions_tag_processor.php
===================================================================
--- branches/unlabeled/unlabeled-1.8.2/core/units/permissions/permissions_tag_processor.php (nonexistent)
+++ branches/unlabeled/unlabeled-1.8.2/core/units/permissions/permissions_tag_processor.php (revision 5552)
@@ -0,0 +1,181 @@
+<?php
+
+ class PermissionsTagProcessor extends kDBTagProcessor {
+
+ function HasPermission($params)
+ {
+ $section_name = $params['section_name'];
+
+ $sections_helper =& $this->Application->recallObject('SectionsHelper');
+ $section_data =& $sections_helper->getSectionData($section_name);
+
+ return array_search($params['perm_name'], $section_data['permissions']) !== false;
+ }
+
+ function HasAdvancedPermissions($params)
+ {
+ $section_name = $params['section_name'];
+
+ $sections_helper =& $this->Application->recallObject('SectionsHelper');
+ $section_data =& $sections_helper->getSectionData($section_name);
+
+ $ret = false;
+ foreach ($section_data['permissions'] as $perm_name) {
+ if (preg_match('/^advanced:(.*)/', $perm_name)) {
+ $ret = true;
+ break;
+ }
+ }
+ return $ret;
+ }
+
+ function PermissionValue($params)
+ {
+ $section_name = $params['section_name'];
+
+ $sections_helper =& $this->Application->recallObject('SectionsHelper');
+ $section_data =& $sections_helper->getSectionData($section_name);
+ $perm_name = $params['perm_name'];
+
+ $permissions_helper =& $this->Application->recallObject('PermissionsHelper');
+ if (!$permissions_helper->isOldPermission($section_name, $perm_name)) {
+ $perm_name = $section_name.'.'.$perm_name;
+ }
+
+ return $permissions_helper->getPermissionValue($perm_name);
+ }
+
+ function LoadPermissions($params)
+ {
+ $permissions_helper =& $this->Application->recallObject('PermissionsHelper');
+ $prefix_parts = explode('-', $this->Prefix, 2);
+ $permissions_helper->LoadPermissions($this->Application->GetVar('g_id'), 0, 1);
+ }
+
+ function LevelIndicator($params)
+ {
+ return $params['level'] * $params['multiply'];
+ }
+
+ function PrintPermissions($params)
+ {
+ $category =& $this->Application->recallObject('c');
+
+ $group_id = $this->Application->GetVar('group_id');
+ $prefix = $this->Application->GetVar('item_prefix');
+ $module = $this->Application->findModule('Var', $prefix, 'Name');
+
+ $perm_live_table = $this->Application->getUnitOption('c-perm', 'TableName');
+ $perm_temp_table = $this->Application->GetTempName($perm_live_table);
+
+ $categories = explode('|', substr($category->GetDBField('ParentPath'), 1, -1));
+ if (count($categories) == 1) {
+ // category located in root category ("Home") => then add it to path virtually
+ array_unshift($categories, 0);
+ }
+ $this_cat = array_pop($categories);
+
+ // get permission name + category position in parent path that has value set for that permission
+ $case = 'MAX(CASE c.CategoryId';
+ foreach ($categories as $pos => $cat_id) {
+ $case .= ' WHEN '.$cat_id.' THEN '.$pos;
+ }
+ $case .= ' END) AS InheritedPosition';
+ $sql = 'SELECT '.$case.', p.Permission AS Perm
+ FROM '.TABLE_PREFIX.'Category c
+ LEFT JOIN '.$perm_live_table.' p ON p.CatId = c.CategoryId
+ LEFT JOIN '.TABLE_PREFIX.'PermissionConfig pc ON pc.PermissionName = p.Permission
+ WHERE
+ CategoryId IN ('.implode(',', $categories).') AND
+ ModuleId = "'.$module.'" AND
+ (
+ (p.GroupId = '.$group_id.' AND p.Type = 0)
+ )
+ GROUP BY Perm';
+ $perm_positions = $this->Conn->GetCol($sql, 'Perm');
+
+ $pos_sql = '';
+ foreach ($perm_positions as $perm_name => $category_pos) {
+ $pos_sql .= '(#TABLE_PREFIX#.Permission = "'.$perm_name.'" AND #TABLE_PREFIX#.CatId = '.$categories[$category_pos].') OR ';
+ }
+ $pos_sql = $pos_sql ? preg_replace('/(.*) OR $/', '\\1', $pos_sql) : '0';
+
+ // get all permissions list with iheritence status, inherited category id and permission value
+ $sql = 'SELECT pc.PermissionName,
+ pc.Description,
+ IF (tmp_p.PermissionValue IS NULL AND p.PermissionValue IS NULL,
+ 0,
+ IF (tmp_p.PermissionValue IS NOT NULL, tmp_p.PermissionValue, p.PermissionValue)
+ ) AS Value,
+ IF (tmp_p.CatId IS NOT NULL, tmp_p.CatId, IF(p.CatId IS NOT NULL, p.CatId, 0) ) AS InheritedFrom,
+ IF(tmp_p.CatId = '.$category->GetID().', 0, 1) AS Inherited,
+ IF(p.PermissionValue IS NOT NULL, p.PermissionValue, 0) AS InheritedValue
+ FROM '.TABLE_PREFIX.'PermissionConfig pc
+ LEFT JOIN '.$perm_live_table.' p
+ ON (p.Permission = pc.PermissionName) AND ('.str_replace('#TABLE_PREFIX#', 'p', $pos_sql).') AND (p.GroupId = '.$group_id.')
+ LEFT JOIN '.$perm_temp_table.' tmp_p
+ ON (tmp_p.Permission = pc.PermissionName) AND (tmp_p.CatId = '.$this_cat.') AND (tmp_p.GroupId = '.$group_id.')
+ WHERE ModuleId = "'.$module.'"';
+ $permissions = $this->Conn->Query($sql);
+
+ $ret = '';
+ $block_params = array_merge_recursive2( $this->prepareTagParams($params), Array('name' => $params['render_as']));
+ foreach ($permissions as $perm_record) {
+ $block_params = array_merge_recursive2($block_params, $perm_record);
+ $ret .= $this->Application->ParseBlock($block_params);
+ }
+ return $ret;
+ }
+
+ /**
+ * Print module tab for each module
+ *
+ * @param Array $params
+ * @return string
+ */
+ function PrintTabs($params)
+ {
+ $ret = '';
+ $block_params = $params;
+ foreach ($this->Application->ModuleInfo as $module_name => $module_data) {
+ $params['item_prefix'] = $module_data['Var'];
+ $ret .= $this->Application->ProcessParsedTag('m', 'MyInclude', $params);
+ }
+ return $ret;
+ }
+
+ /**
+ * Returns category name by ID
+ *
+ * @param Array $params
+ */
+ function CategoryPath($params)
+ {
+ $category_id = $params['cat_id'];
+ $category_path = $this->Application->getCache('category_paths', $category_id);
+ if ($category_path === false) {
+ // not chached
+ if ($category_id > 0) {
+ $id_field = $this->Application->getUnitOption('c', 'IDField');
+ $table_name = $this->Application->getUnitOption('c', 'TableName');
+ $sql = 'SELECT CachedNavbar
+ FROM '.$table_name.'
+ WHERE '.$id_field.' = '.$category_id;
+ $category_path = trim($this->CategoryPath( Array('cat_id' => 0) ).'>'.$this->Conn->GetOne($sql), '>');
+ }
+ else {
+ $category_path = $this->Application->Phrase( $this->Application->ConfigValue('Root_Name') );
+ }
+ $this->Application->setCache('category_paths', $category_id, $category_path);
+ }
+ return $category_path;
+ }
+
+ function PermInputName($params)
+ {
+ return $this->Prefix.'['.$this->Application->GetVar('group_id').']['.$this->Application->Parser->GetParam('PermissionName').']['.$params['sub_key'].']';
+ }
+
+ }
+
+?>
\ No newline at end of file
Property changes on: branches/unlabeled/unlabeled-1.8.2/core/units/permissions/permissions_tag_processor.php
___________________________________________________________________
Added: cvs2svn:cvs-rev
## -0,0 +1 ##
+1.8
\ No newline at end of property
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: branches/unlabeled/unlabeled-1.8.2/core/units/general/helpers/sections_helper.php
===================================================================
--- branches/unlabeled/unlabeled-1.8.2/core/units/general/helpers/sections_helper.php (nonexistent)
+++ branches/unlabeled/unlabeled-1.8.2/core/units/general/helpers/sections_helper.php (revision 5552)
@@ -0,0 +1,115 @@
+<?php
+
+ /**
+ * Porcesses sections information from configs
+ *
+ */
+ class kSectionsHelper extends kHelper {
+
+ /**
+ * Holds information about all sections
+ *
+ * @var Array
+ */
+ var $Tree = Array();
+
+ /**
+ * Set's prefix and special
+ *
+ * @param string $prefix
+ * @param string $special
+ * @access public
+ */
+ function Init($prefix, $special, $event_params = null)
+ {
+ parent::Init($prefix, $special, $event_params);
+ $this->BuildTree();
+ }
+
+ /**
+ * Builds xml for tree in left frame in admin
+ *
+ * @param Array $params
+ */
+ function BuildTree()
+ {
+ $unit_config_reader = false;
+ $data = $this->Conn->GetRow('SELECT Data, Cached FROM '.TABLE_PREFIX.'Cache WHERE VarName = "sections_parsed"');
+ if ($data) {
+ $this->Tree = unserialize($data['Data']);
+ return ;
+ }
+ $this->Application->UnitConfigReader->includeConfigFiles(MODULES_PATH);
+ $this->Application->UnitConfigReader->AfterConfigRead();
+
+ $this->Tree = Array();
+ if (!$unit_config_reader) {
+ $unit_config_reader =& $this->Application->recallObject('kUnitConfigReader');
+ }
+
+ $prefixes = array_keys($unit_config_reader->configData);
+ foreach ($prefixes as $prefix) {
+ $config =& $unit_config_reader->configData[$prefix];
+ $sections = getArrayValue($config, 'Sections');
+ if (!$sections) continue;
+
+// echo 'Prefix: ['.$prefix.'] has ['.count($sections).'] sections<br />';
+
+ foreach ($sections as $section_name => $section_params) {
+ // we could also skip not allowed sections here in future
+ $section_params['SectionPrefix'] = $prefix;
+ $section_params['url']['m_opener'] = 'r';
+
+ $pass_section = getArrayValue($section_params, 'url', 'pass_section');
+
+ if ($pass_section) {
+ unset($section_params['url']['pass_section']);
+ $section_params['url']['section'] = $section_name;
+ if (!isset($section_params['url']['module'])) {
+ $module_name = $this->Application->findModule('Path', $config['ModuleFolder'].'/', 'Name');
+ $section_params['url']['module'] = $module_name;
+ }
+ }
+
+ if (!isset($section_params['url']['t'])) {
+ $section_params['url']['t'] = 'index';
+ }
+
+ if (!isset($section_params['onclick'])) {
+ $section_params['onclick'] = 'checkEditMode()';
+ }
+
+ $current_data = isset($this->Tree[$section_name]) ? $this->Tree[$section_name] : Array();
+ $this->Tree[$section_name] = array_merge_recursive2($current_data, $section_params);
+
+ $this->Tree[ $section_params['parent'] ]['children'][ "{$section_params['priority']}" ] = $section_name;
+
+ if ($section_params['type'] == stTAB) {
+ // if this is tab, then mark parent section as TabOnly
+ $this->Tree[ $section_params['parent'] ]['tabs_only'] = true;
+ }
+ }
+ }
+
+ $this->Conn->Query('REPLACE '.TABLE_PREFIX.'Cache (VarName, Data, Cached) VALUES ("sections_parsed", '.$this->Conn->qstr(serialize($this->Tree)).', '.adodb_mktime().')');
+ }
+
+ /**
+ * Returns details information about section
+ *
+ * @param string $section_name
+ * @return Array
+ */
+ function &getSectionData($section_name)
+ {
+ if (isset($this->Tree[$section_name])) {
+ $ret =& $this->Tree[$section_name];
+ }
+ else {
+ $ret = Array();
+ }
+ return $ret;
+ }
+ }
+
+?>
\ No newline at end of file
Property changes on: branches/unlabeled/unlabeled-1.8.2/core/units/general/helpers/sections_helper.php
___________________________________________________________________
Added: cvs2svn:cvs-rev
## -0,0 +1 ##
+1.8
\ No newline at end of property
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: branches/unlabeled/unlabeled-1.8.2/core/units/general/general_config.php
===================================================================
--- branches/unlabeled/unlabeled-1.8.2/core/units/general/general_config.php (nonexistent)
+++ branches/unlabeled/unlabeled-1.8.2/core/units/general/general_config.php (revision 5552)
@@ -0,0 +1,26 @@
+<?php
+
+$config = Array(
+ 'Prefix' => 'm',
+ 'EventHandlerClass' => Array('class' => 'MainEventHandler', 'file' => 'main_event_handler.php', 'build_event' => 'OnBuild'),
+ /*'TagProcessorClass' => Array('class'=>'kMainTagProcessor','file'=>'','build_event'=>'OnBuild'),*/
+
+ 'QueryString' => Array(
+ 1 => 'cat_id',
+ 2 => 'cat_page',
+ 3 => 'lang',
+ 4 => 'theme',
+ 5 => 'opener',
+ ),
+ 'TitleField' => 'CachedNavbar',
+ 'TitlePhrase' => 'la_Text_Category',
+ 'ItemType' => 1,
+ 'TableName' => TABLE_PREFIX.'Category',
+
+ 'PortalStyleEnv' => true,
+
+ 'PermTabText' => 'In-Portal',
+ 'PermSection' => Array('search' => 'in-portal:configuration_search', 'custom' => 'in-portal:configuration_custom'),
+ );
+
+?>
\ No newline at end of file
Property changes on: branches/unlabeled/unlabeled-1.8.2/core/units/general/general_config.php
___________________________________________________________________
Added: cvs2svn:cvs-rev
## -0,0 +1 ##
+1.8
\ No newline at end of property
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: branches/unlabeled/unlabeled-1.8.2/core/admin_templates/categories/categories_edit_permissions.tpl
===================================================================
--- branches/unlabeled/unlabeled-1.8.2/core/admin_templates/categories/categories_edit_permissions.tpl (nonexistent)
+++ branches/unlabeled/unlabeled-1.8.2/core/admin_templates/categories/categories_edit_permissions.tpl (revision 5552)
@@ -0,0 +1,199 @@
+<inp2:m_RequireLogin permissions="CATEGORY.VIEW"/>
+<inp2:m_include t="incs/header" nobody="yes"/>
+
+<body topmargin="0" leftmargin="8" marginheight="0" marginwidth="8" bgcolor="#FFFFFF" onload="$PermManager.Init();">
+<inp2:m_ParseBlock name="section_header" prefix="c" icon="icon46_catalog" module="in-portal" title="la_title_Categories"/>
+
+<inp2:m_include t="categories/categories_tabs"/>
+
+<inp2:m_ParseBlock name="blue_bar" prefix="c" title_preset="categories_permissions" module="in-portal" icon="icon46_catalog"/>
+
+<!-- ToolBar --->
+<table class="toolbar" height="30" cellspacing="0" cellpadding="0" width="100%" border="0">
+<tbody>
+ <tr>
+ <td>
+ <script type="text/javascript" src="incs/ajax.js"></script>
+ <script type="text/javascript" src="incs/catalog.js"></script>
+ <script type="text/javascript">
+ Request.progressText = '<inp2:m_phrase name="la_title_Loading" escape="1"/>';
+
+ Catalog.prototype.Init = function () {
+ var $prefix = this.queryTabRegistry('prefix', this.ActivePrefix, 'prefix');
+ if ($prefix !== this.ActivePrefix && this.TabRegistry.length > 0) {
+ // ActivePrefix not set or has non-existing prefix value
+ this.ActivePrefix = this.TabRegistry[0]['prefix'];
+ }
+ Grids['g'].SelectFirst();
+ }
+
+ Catalog.prototype.go_to_group = function($group_id) {
+ if (!isset($group_id)) {
+ $group_id = 0; // gets current group
+ }
+ else {
+ set_hidden_field('current_group_id', $group_id);
+ }
+
+ this.switchTab(); // refresh current item tab
+ }
+
+ Catalog.prototype.refreshTab = function($prefix, $div_id) {
+ var $group_id = get_hidden_field('current_group_id');
+// alert('refreshTab. GroupID: '+$group_id);
+ var $tab_group_id = document.getElementById($div_id).getAttribute('group_id');
+ if ($group_id != $tab_group_id) {
+ // query tab content only in case if not queried or category don't match
+ var $url = this.URLMask.replace('#ITEM_PREFIX#', $prefix).replace('#GROUP_ID#', $group_id);
+ this.BusyRequest[$prefix] = false;
+
+ Request.makeRequest($url, this.BusyRequest[$prefix], $div_id, this.successCallback, this.errorCallback, $div_id, this);
+ }
+ /*else {
+ alert('refresh disabled = {tab: '+this.ActivePrefix+'; group_id: '+$group_id+'}');
+ }*/
+ }
+
+ // adds information about tab to tab_registry
+ Catalog.prototype.registerTab = function($tab_id) {
+ var $tab = document.getElementById($tab_id + '_div');
+ var $index = this.TabRegistry.length;
+ this.TabRegistry[$index] = new Array();
+ this.TabRegistry[$index]['tab_id'] = $tab_id;
+ this.TabRegistry[$index]['prefix'] = $tab.getAttribute('prefix');
+ this.TabRegistry[$index]['dep_buttons'] = new Array();
+ this.TabRegistry[$index]['index'] = $index;
+ }
+
+ Catalog.prototype.submit_event = function($prefix_special, $event, $t) {
+ var $prev_template = get_hidden_field('t');
+ if (isset($event)) set_hidden_field('events[' + $prefix_special + ']', $event);
+ if (isset($t)) set_hidden_field('t', $t);
+
+ var $tab_id = this.queryTabRegistry('prefix', this.ActivePrefix, 'tab_id');
+ this.submit_kernel_form();
+
+ set_hidden_field('t', $prev_template);
+ }
+
+ var $PermManager = new Catalog('<inp2:m_Link template="categories/permissions_tab" item_prefix="#ITEM_PREFIX#" group_id="#GROUP_ID#" no_amp="1" pass="m,c"/>', 'permmanager_');
+
+ a_toolbar = new ToolBar();
+ a_toolbar.AddButton( new ToolBarButton('select', '<inp2:m_phrase label="la_ToolTip_Save" escape="1"/>', function() {
+ submit_event('c','<inp2:c_SaveEvent/>');
+ }
+ ) );
+ a_toolbar.AddButton( new ToolBarButton('cancel', '<inp2:m_phrase label="la_ToolTip_Cancel" escape="1"/>', function() {
+ submit_event('c','OnCancelEdit');
+ }
+ ) );
+
+ a_toolbar.AddButton( new ToolBarSeparator('sep1') );
+
+ a_toolbar.AddButton( new ToolBarButton('prev', '<inp2:m_phrase label="la_ToolTip_Prev" escape="1"/>', function() {
+ go_to_id('c', '<inp2:c_PrevId/>');
+ }
+ ) );
+ a_toolbar.AddButton( new ToolBarButton('next', '<inp2:m_phrase label="la_ToolTip_Next" escape="1"/>', function() {
+ go_to_id('c', '<inp2:c_NextId/>');
+ }
+ ) );
+
+ function edit(){ }
+
+ a_toolbar.Render();
+
+ <inp2:m_if check="c_IsSingle">
+ a_toolbar.HideButton('prev');
+ a_toolbar.HideButton('next');
+ a_toolbar.HideButton('sep1');
+ <inp2:m_else/>
+ <inp2:m_if check="c_IsLast">
+ a_toolbar.DisableButton('next');
+ </inp2:m_if>
+ <inp2:m_if check="c_IsFirst">
+ a_toolbar.DisableButton('prev');
+ </inp2:m_if>
+ </inp2:m_if>
+ </script>
+ </td>
+ </tr>
+</tbody>
+</table>
+
+<inp2:c_SaveWarning name="grid_save_warning"/>
+<inp2:m_ParseBlock name="grid" PrefixSpecial="g" IdField="GroupId" per_page="-1" grid="Radio" header_block="grid_column_title_no_sorting"/>
+<br />
+<!-- item tabs: begin -->
+<table cellpadding="0" cellspacing="0">
+ <tr>
+ <inp2:m_DefineElement name="item_tab" title="">
+ <td nowrap="nowrap" width="140">
+ <table id="<inp2:m_param name="prefix"/>_tab" cellpadding="0" cellspacing="0" width="100%" class="catalog-tab-unselected" onclick="$PermManager.switchTab('<inp2:m_param name="prefix"/>');">
+ <tr>
+ <td class="catalog-tab-left">
+ <img src="img/spacer.gif" height="22" width="9" />
+ </td>
+ <td class="catalog-tab-middle" width="100%" valign="middle" nowrap="nowrap">
+ <inp2:m_param name="title"/>
+ </td>
+ <td class="catalog-tab-right">
+ <img src="img/spacer.gif" height="22" width="9" />
+ </td>
+ <td style="background-color: #FFFFFF;">
+ <img src="img/spacer.gif" height="1" width="5" />
+ </td>
+ </tr>
+ </table>
+
+ </td>
+ </inp2:m_DefineElement>
+ <inp2:adm_ListCatalogTabs render_as="item_tab" title_property="PermTabText"/>
+ </tr>
+</table>
+<!-- item tabs: end -->
+
+<inp2:c-perm_PrintTabs template="categories/permissions_tab" tab_init="1"/>
+
+<inp2:m_include t="incs/footer"/>
+
+<script type="text/javascript">
+ Grids['g'].OnSelect = function ($id) {
+ $PermManager.go_to_group($id);
+ }
+
+ Grids['g'].OnUnSelect = function ($id) {
+ set_hidden_field('group_id', $id);
+ set_hidden_field('item_prefix', $PermManager.ActivePrefix);
+ $PermManager.submit_event('c', 'OnPreSave', 'categories/permissions_tab');
+ }
+
+ Grids['g'].SelectFirst = function () {
+ for (var $i in this.Items) {
+ this.Items[$i].Select();
+ break;
+ }
+ }
+
+ Grids['g'].RadioMode = true;
+
+ function update_light(perm_name, value)
+ {
+ var $img_base = img_path.replace('#MODULE#', 'kernel');
+ document.getElementById('light_'+perm_name).src = $img_base + 'perm_' + (value ? 'green' : 'red') + '.gif';
+ }
+
+ function inherited_click(perm_name, inherited_value, state, access_cb_id)
+ {
+ if (state) {
+ update_light(perm_name, inherited_value);
+ document.getElementById(access_cb_id).disabled = true;
+ }
+ else {
+ update_light(perm_name, document.getElementById(access_cb_id).checked)
+ document.getElementById(access_cb_id).disabled = false;
+ }
+ }
+</script>
+
+
\ No newline at end of file
Property changes on: branches/unlabeled/unlabeled-1.8.2/core/admin_templates/categories/categories_edit_permissions.tpl
___________________________________________________________________
Added: cvs2svn:cvs-rev
## -0,0 +1 ##
+1.8
\ No newline at end of property
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property

Event Timeline