Page Menu
Home
In-Portal Phabricator
Search
Configure Global Search
Log In
Files
F1092987
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
Mon, Aug 11, 8:10 AM
Size
31 KB
Mime Type
text/x-diff
Expires
Wed, Aug 13, 8:10 AM (2 h, 58 m)
Engine
blob
Format
Raw Data
Handle
707932
Attached To
rINP In-Portal
in-portal
View Options
Index: trunk/themes/default2007/platform/my_account/my_account.tpl
===================================================================
--- trunk/themes/default2007/platform/my_account/my_account.tpl (revision 8477)
+++ trunk/themes/default2007/platform/my_account/my_account.tpl (revision 8478)
@@ -1,24 +1,26 @@
<inp2:m_DefineElement name="sidebar">
<inp2:m_RenderElements
elements="
platform/elements/side_boxes/login,
"
design="blue_box"/>
</inp2:m_DefineElement>
<inp2:m_DefineElement name="content">
+ <inp2:m_include template="platform/designs/navigation_bar" titles="lu_title_MyAccount" templates="platform/my_account/my_account"/>
+
<!-- my account -->
<inp2:m_DefineElement name="my_account_content">
<inp2:m_DefineElement name="header">
<inp2:m_phrase name="lu_title_MyAccount"/>
</inp2:m_DefineElement>
<inp2:m_RenderElement name="header" strip_nl="2" result_to_var="header"/>
my account big
</inp2:m_DefineElement>
<inp2:m_RenderElement name="my_account_content" design="content_box"/>
<!-- // my account -->
</inp2:m_DefineElement>
<inp2:m_include template="platform/designs/default_design" pass_params="1"/>
\ No newline at end of file
Property changes on: trunk/themes/default2007/platform/my_account/my_account.tpl
___________________________________________________________________
Modified: cvs2svn:cvs-rev
## -1 +1 ##
-1.1
\ No newline at end of property
+1.2
\ No newline at end of property
Index: trunk/themes/default2007/platform/my_account/my_profile.tpl
===================================================================
--- trunk/themes/default2007/platform/my_account/my_profile.tpl (revision 8477)
+++ trunk/themes/default2007/platform/my_account/my_profile.tpl (revision 8478)
@@ -1,58 +1,60 @@
<inp2:m_DefineElement name="sidebar">
<inp2:m_RenderElements
elements="
platform/elements/side_boxes/login,
"
design="blue_box"/>
</inp2:m_DefineElement>
<inp2:m_DefineElement name="content">
+ <inp2:m_include template="platform/designs/navigation_bar" titles="lu_title_MyAccount,lu_title_MyProfile" templates="platform/my_account/my_account,platform/my_account/my_profile"/>
+
<!-- my profile -->
<inp2:m_DefineElement name="users_content">
<inp2:m_DefineElement name="header">
<inp2:m_phrase name="lu_title_MyProfile"/>
</inp2:m_DefineElement>
<inp2:m_RenderElement name="header" strip_nl="2" result_to_var="header"/>
<inp2:m_if check="u_HasError" field="any">
<span class="error"><inp2:m_phrase name="lu_AProblemInForm"/></span><br />
</inp2:m_if>
<span class="error">*</span> <inp2:m_phrase name="lu_IndicatesRequired"/><br />
<form method="post" action="<inp2:m_FormAction/>">
<table class="form-data">
<inp2:m_RenderElement name="inp_edit_box" prefix="u" field="Login" title="lu_fld_Login"/>
<inp2:m_if check="m_ConfigEquals" name="User_Password_Auto" value="0">
<inp2:m_RenderElement name="inp_edit_password" prefix="u" field="Password" title="lu_fld_Password"/>
<inp2:m_RenderElement name="inp_edit_password" prefix="u" field="VerifyPassword" title="lu_fld_VerifyPassword"/>
</inp2:m_if>
<inp2:m_RenderElement name="inp_edit_box" prefix="u" field="FirstName" title="lu_fld_FirstName"/>
<inp2:m_RenderElement name="inp_edit_box" prefix="u" field="LastName" title="lu_fld_LastName"/>
<inp2:m_RenderElement name="inp_edit_box" prefix="u" field="Company" title="lu_fld_Company"/>
<inp2:m_RenderElement name="inp_edit_box" prefix="u" field="Phone" title="lu_fld_Phone"/>
<inp2:m_RenderElement name="inp_edit_box" prefix="u" field="Fax" title="lu_fld_Fax"/>
<inp2:m_RenderElement name="inp_edit_box" prefix="u" field="Email" title="lu_fld_Email"/>
<inp2:m_RenderElement name="inp_edit_date" prefix="u" field="dob" title="lu_fld_BirthDate"/>
<inp2:m_RenderElement name="inp_edit_box" prefix="u" field="Street" title="lu_fld_AddressLine1"/>
<inp2:m_RenderElement name="inp_edit_box" prefix="u" field="Street2" title="lu_fld_AddressLine2"/>
<inp2:m_RenderElement name="inp_edit_box" prefix="u" field="City" title="lu_fld_City"/>
<inp2:m_RenderElement name="inp_edit_box" prefix="u" field="State" title="lu_fld_State"/>
<inp2:m_RenderElement name="inp_edit_box" prefix="u" field="Zip" title="lu_fld_Zip"/>
<inp2:m_RenderElement name="inp_edit_options" prefix="u" field="Country" title="lu_fld_Country"/>
<tr>
<td colspan="3" valign="bottom" height="35">
<input class="button" type="submit" name="events[u][OnUpdate]" value="<inp2:m_Phrase label="lu_btn_Update"/>"/>
</td>
</tr>
</table>
</form>
</inp2:m_DefineElement>
<inp2:m_RenderElement name="users_content" design="content_box"/>
<!-- // my profile -->
</inp2:m_DefineElement>
<inp2:m_include template="platform/designs/default_design" pass_params="1"/>
\ No newline at end of file
Property changes on: trunk/themes/default2007/platform/my_account/my_profile.tpl
___________________________________________________________________
Modified: cvs2svn:cvs-rev
## -1 +1 ##
-1.3
\ No newline at end of property
+1.4
\ No newline at end of property
Index: trunk/themes/default2007/platform/designs/navigation_bar.tpl
===================================================================
--- trunk/themes/default2007/platform/designs/navigation_bar.tpl (revision 8477)
+++ trunk/themes/default2007/platform/designs/navigation_bar.tpl (revision 8478)
@@ -1,21 +1,35 @@
<inp2:m_DefineElement name="root_category">
- <a href="<inp2:c_CategoryLink template="index" />"><inp2:c_RootCategoryName/></a>
-</inp2:m_DefineElement>
-
-<inp2:m_DefineElement name="module_root_category">
- <inp2:m_param name="separator"/>
- <a href="<inp2:c_CategoryLink template="index" />"><inp2:m_param name="cat_name"/></a>
+ [Home Icon] <a href="<inp2:c_CategoryLink template="__default__" />"><inp2:m_RootCategoryName/></a>
</inp2:m_DefineElement>
<inp2:m_DefineElement name="category_link">
- <inp2:m_param name="separator"/>
+ <inp2:m_param name="separator"/>
<a href="<inp2:c_CategoryLink template="__default__" />"><inp2:m_param name="cat_name"/></a>
</inp2:m_DefineElement>
+<inp2:m_DefineElement name="template_link">
+ <inp2:m_param name="separator"/>
+ <a href="<inp2:m_Link template="$template" m_cat_id="0"/>"><inp2:m_phrase name="$title"/></a>
+</inp2:m_DefineElement>
+
<inp2:m_DefineElement name="current_category">
<inp2:m_param name="separator"/>
<span> <inp2:m_param name="cat_name"/></span>
</inp2:m_DefineElement>
+<inp2:m_DefineElement name="current_template">
+ <inp2:m_param name="separator"/>
+ <span> <inp2:m_phrase name="$title"/></span>
+</inp2:m_DefineElement>
-<inp2:c_CategoryPath separator=">" render_as="category_link" current_render_as="current_category" module_root_render_as="module_root_category" root_cat_render_as="root_category" />
\ No newline at end of file
+<table style="width: 100%;">
+ <tr>
+ <td style="background-color: #0FFFFF">
+ <inp2:m_if check="m_Param" name="titles">
+ <inp2:c_NavigationBar separator=">" render_as="template_link" current_render_as="current_template" root_cat_render_as="root_category" titles="$titles" templates="$templates"/>
+ <inp2:m_else/>
+ <inp2:c_CategoryPath separator=">" render_as="category_link" current_render_as="current_category" root_cat_render_as="root_category" />
+ </inp2:m_if>
+ </td>
+ </tr>
+</table>
\ No newline at end of file
Property changes on: trunk/themes/default2007/platform/designs/navigation_bar.tpl
___________________________________________________________________
Modified: cvs2svn:cvs-rev
## -1 +1 ##
-1.1
\ No newline at end of property
+1.2
\ No newline at end of property
Index: trunk/core/units/categories/categories_tag_processor.php
===================================================================
--- trunk/core/units/categories/categories_tag_processor.php (revision 8477)
+++ trunk/core/units/categories/categories_tag_processor.php (revision 8478)
@@ -1,572 +1,609 @@
<?php
class CategoriesTagProcessor extends kDBTagProcessor {
function SubCatCount($params)
{
$object =& $this->getObject($params);
if (isset($params['today']) && $params['today']) {
$sql = 'SELECT COUNT(*)
FROM '.$object->TableName.'
WHERE (ParentPath LIKE "'.$object->GetDBField('ParentPath').'%") AND (CreatedOn > '.(adodb_mktime() - 86400).')';
return $this->Conn->GetOne($sql) - 1;
}
return $object->GetDBField('CachedDescendantCatsQty');
}
function IsNew($params)
{
$object =& $this->Application->recallObject($this->getPrefixSpecial(), $this->Prefix, $params);
$ret = $object->GetDBField('IsNew') ? 1 : 0;
return $ret;
}
function IsPick($params)
{
$object =& $this->Application->recallObject($this->getPrefixSpecial(), $this->Prefix, $params);
$ret = $object->GetDBField('EditorsPick') ? 1 : 0;
return $ret;
}
function ItemIcon($params)
{
// only for categories, not structure
if ($this->Prefix != 'c') {
return parent::ItemIcon($params);
}
$object =& $this->Application->recallObject($this->getPrefixSpecial(), $this->Prefix, $params);
$status = $object->GetDBField('Status');
if($status == 1)
{
$ret = $object->GetDBField('IsNew') ? 'icon16_cat_new.gif' : 'icon16_cat.gif';
}
else
{
$ret = $status ? 'icon16_cat_pending.gif' : 'icon16_cat_disabled.gif';
}
return $ret;
}
function ItemCount($params)
{
$cat_object =& $this->getObject($params);
$ci_table = $this->Application->getUnitOption('l-ci', 'TableName');
$sql = ' SELECT COUNT(*)
FROM '.$cat_object->TableName.' c
LEFT JOIN '.$ci_table.' ci
ON c.CategoryId=ci.CategoryId
WHERE c.ParentPath LIKE "'.$cat_object->GetDBField('ParentPath').'%"
AND NOT (ci.CategoryId IS NULL)';
return $this->Conn->GetOne($sql);
}
function ListCategories($params)
{
return $this->PrintList2($params);
}
function RootCategoryName($params)
{
return $this->Application->ProcessParsedTag('m', 'RootCategoryName', $params);
}
function CheckModuleRoot($params)
{
$module_name = getArrayValue($params, 'module') ? $params['module'] : 'In-Commerce';
$module_root_cat = $this->Application->findModule('Name', $module_name, 'RootCat');
$additional_cats = $this->SelectParam($params, 'add_cats');
if ($additional_cats) {
$additional_cats = explode(',', $additional_cats);
}
else {
$additional_cats = array();
}
if ($this->Application->GetVar('m_cat_id') == $module_root_cat || in_array($this->Application->GetVar('m_cat_id'), $additional_cats)) {
$home_template = getArrayValue($params, 'home_template');
if (!$home_template) return;
$this->Application->Redirect($home_template, Array('pass'=>'all'));
};
}
function CategoryPath($params)
{
$module_name = getArrayValue($params, 'module') ? $params['module'] : 'In-Commerce';
$module_category_id = $this->Application->findModule('Name', $module_name, 'RootCat');
$module_item_id = $this->Application->GetVar($this->Application->findModule('Name', $module_name, 'Var').'_id');
$block_params['separator'] = $params['separator'];
if (!isset($params['cat_id'])) {
$params['cat_id'] = getArrayValue($params, 'cat_id') ? $params['cat_id'] : $this->Application->GetVar('m_cat_id');
}
if ($params['cat_id'] == 0) {
$block_params['current'] = 1;
$block_params['cat_id'] = 0;
$block_params['cat_name'] = $this->Application->ProcessParsedTag('m', 'RootCategoryName', $params);
$block_params['name'] = $this->SelectParam($params, 'root_cat_render_as,block_root_cat,rootcatblock,render_as');
return $this->Application->ParseBlock($block_params);
}
else {
$ml_formatter =& $this->Application->recallObject('kMultiLanguage');
$navbar_field = $ml_formatter->LangFieldName('CachedNavBar');
$id_field = $this->Application->getUnitOption($this->Prefix, 'IDField');
$table_name = $this->Application->getUnitOption($this->Prefix, 'TableName');
$sql = 'SELECT '.$navbar_field.', ParentPath
FROM '.$table_name.'
WHERE '.$id_field.' = '.$params['cat_id'];
$category_data = $this->Conn->GetRow($sql);
$ret = '';
if ($category_data) {
$category_names = explode('&|&', $category_data[$navbar_field]);
$category_ids = explode('|', substr($category_data['ParentPath'], 1, -1));
// add "Home" category at beginning of path
array_unshift($category_names, $this->Application->ProcessParsedTag('m', 'RootCategoryName', $params));
array_unshift($category_ids, 0);
foreach ($category_ids as $category_pos => $category_id) {
$block_params['cat_id'] = $category_id;
$block_params['cat_name'] = $category_names[$category_pos];
$block_params['current'] = ($params['cat_id'] == $category_id) && !$module_item_id ? 1 : 0;
$block_params['is_module_root'] = $category_id == $module_category_id ? 1 : 0;
$block_params['name'] = $this->SelectParam($params, 'render_as,block');
// which block to parse as current ?
if ($category_id == 0) {
$block_params['name'] = $this->SelectParam($params, 'root_cat_render_as,block_root_cat,rootcatblock,render_as,block');
}
if ($block_params['is_module_root'] == 1) { // module root
$block_params['name'] = $this->SelectParam($params, 'module_root_render_as,block_module_root,rootmoduleblock,render_as,block');
}
if ($block_params['current'] == 1) { // current cat (label)
$block_params['name'] = $this->SelectParam($params, 'current_render_as,block_current,currentblock,render_as,block');
}
$this->Application->SetVar($this->Prefix.'_id', $category_id);
$ret .= $this->Application->ParseBlock($block_params, 1);
}
}
return $ret;
}
}
+ function NavigationBar($params)
+ {
+ $titles = explode(',', $params['titles']);
+ $templates = explode(',', $params['templates']);
+
+ array_unshift($titles, $this->Application->ProcessParsedTag('m', 'RootCategoryName', $params));
+ array_unshift($templates, '');
+
+ $block_params = $this->prepareTagParams($params);
+ $current_template = $this->Application->GetVar('t');
+
+ $ret = '';
+ foreach ($templates as $template_index => $template) {
+ $block_params['current'] = ($template == $current_template);
+ $block_params['title'] = $titles[$template_index];
+ $block_params['template'] = $template;
+
+ switch ($template) {
+ case '':
+ $block_params['name'] = $params['root_cat_render_as'];
+ break;
+
+ case $current_template:
+ $block_params['name'] = $params['current_render_as'];
+ break;
+
+ default:
+ $block_params['name'] = $params['render_as'];
+ break;
+ }
+
+ $ret .= $this->Application->ParseBlock($block_params);
+ }
+
+ return $ret;
+ }
+
function CurrentCategoryName($params)
{
$cat_object =& $this->Application->recallObject($this->getPrefixSpecial(), $this->Prefix.'_List');
$sql = 'SELECT '.$this->getTitleField().'
FROM '.$cat_object->TableName.'
WHERE CategoryId = '.$this->Application->GetVar('m_cat_id');
return $this->Conn->GetOne($sql);
}
function getTitleField()
{
$ml_formatter =& $this->Application->recallObject('kMultiLanguage');
return $ml_formatter->LangFieldName('Name');
}
function CategoryLink($params)
{
$params = array_merge(Array('pass' => 'm'), $params);
$cat_id = getArrayValue($params, 'cat_id');
if ($cat_id === false) {
$cat_id = $this->Application->GetVar($this->getPrefixSpecial().'_id');
}
if ("$cat_id" == 'Root') {
$params['m_cat_id'] = $this->Application->findModule('Name', $params['module'], 'RootCat');
unset($params['module']);
}
else {
$params['m_cat_id'] = $cat_id;
}
unset($params['cat_id']);
$params['pass_category'] = 1;
return $this->Application->ProcessParsedTag('m', 't', $params);
}
function CategoryList($params)
{
//$object =& $this->Application->recallObject( $this->getPrefixSpecial() , $this->Prefix.'_List', $params );
$object =& $this->GetList($params);
if ($object->RecordsCount == 0)
{
if (isset($params['block_no_cats'])) {
$params['name'] = $params['block_no_cats'];
return $this->Application->ParseBlock($params);
}
else {
return '';
}
}
if (isset($params['block'])) {
return $this->PrintList($params);
}
else {
$params['block'] = $params['block_main'];
if (isset($params['block_row_start'])) {
$params['row_start_block'] = $params['block_row_start'];
}
if (isset($params['block_row_end'])) {
$params['row_end_block'] = $params['block_row_end'];
}
return $this->PrintList2($params);
}
}
function Meta($params)
{
$name = getArrayValue($params, 'name');
$object =& $this->Application->recallObject($this->Prefix.'.-item');
$field = $object->GetField('Meta'.$name);
if ($field) return $field;
switch ($name) {
case 'Description':
$conf = 'Category_MetaDesc';
break;
case 'Keywords':
$conf = 'Category_MetaKey';
break;
}
return $this->Application->ConfigValue($conf);
}
function BuildListSpecial($params)
{
if ( isset($params['parent_cat_id']) ) {
$parent_cat_id = $params['parent_cat_id'];
}
else {
$parent_cat_id = $this->Application->GetVar($this->Prefix.'_id');
if (!$parent_cat_id) {
$parent_cat_id = $this->Application->GetVar('m_cat_id');
}
if (!$parent_cat_id) {
$parent_cat_id = 0;
}
}
$types = $this->SelectParam($params, 'types');
$except = $this->SelectParam($params, 'except');
$no_special = isset($params['no_special']) && $params['no_special'];
if ($no_special) return $this->Special;
if ($types.$except.$parent_cat_id == '') {
return parent::BuildListSpecial($params);
}
$special = crc32($types.$except.$parent_cat_id);
return $special;
}
function IsCurrent($params)
{
$object =& $this->getObject($params);
if ($object->GetID() == $this->Application->GetVar('m_cat_id')) {
return true;
}
else {
return false;
}
}
/**
* Substitutes category in last template base on current category
* This is required becasue when you navigate catalog using AJAX, last_template is not updated
* but when you open item edit from catalog last_template is used to build opener_stack
* So, if we don't substitute m_cat_id in last_template, after saving item we'll get redirected
* to the first category we've opened, not the one we navigated to using AJAX
*
* @param Array $params
*/
function UpdateLastTemplate($params)
{
$category_id = $this->Application->GetVar('m_cat_id');
$wid = $this->Application->GetVar('m_wid');
list($index_file, $env) = explode('|', $this->Application->RecallVar(rtrim('last_template_'.$wid, '_')), 2);
$this->Application->SetVar(ENV_VAR_NAME, str_replace('%5C', '\\', $env));
$this->Application->HttpQuery->processQueryString();
// update required fields
$this->Application->SetVar('m_cat_id', $category_id);
$this->Application->Session->SaveLastTemplate($params['template']);
}
function GetParentCategory($params)
{
$parent_id = 0;
$id_field = $this->Application->getUnitOption($this->Prefix, 'IDField');
$table = $this->Application->getUnitOption($this->Prefix,'TableName');
$cat_id = $this->Application->GetVar('m_cat_id');
if ($cat_id > 0) {
$sql = 'SELECT ParentId
FROM '.$table.'
WHERE '.$id_field.' = '.$cat_id;
$parent_id = $this->Conn->GetOne($sql);
}
return $parent_id;
}
function InitCacheUpdater($params)
{
safeDefine('CACHE_PERM_CHUNK_SIZE', 30);
$continue = $this->Application->GetVar('continue');
$total_cats = (int) $this->Conn->GetOne('SELECT COUNT(*) FROM '.TABLE_PREFIX.'Category');
if ($continue === false && $total_cats > CACHE_PERM_CHUNK_SIZE) {
// first step, if category count > CACHE_PERM_CHUNK_SIZE, then ask for cache update
return true;
}
if ($continue === false) {
// if we don't have to ask, then assume user selected "Yes" in permcache update dialog
$continue = 1;
}
$updater =& $this->Application->recallObject('kPermCacheUpdater', null, Array('continue' => $continue));
if ($continue === '0') { // No in dialog
$updater->clearData();
$this->Application->Redirect($params['destination_template']);
}
$ret = false; // don't ask for update
if ($continue == 1) { // Initial run
$updater->setData();
}
if ($continue == 2) { // Continuing
// called from AJAX request => returns percent
$needs_more = true;
while ($needs_more && $updater->iteration <= CACHE_PERM_CHUNK_SIZE) {
// until proceeeded in this step category count exceeds category per step limit
$needs_more = $updater->DoTheJob();
}
if ($needs_more) {
// still some categories are left for next step
$updater->setData();
}
else {
// all done -> redirect
$updater->clearData();
$this->Application->RemoveVar('PermCache_UpdateRequired');
$this->Application->Redirect($params['destination_template']);
}
$ret = $updater->getDonePercent();
}
return $ret;
}
/**
* Parses warning block, but with style="display: none;". Used during permissions saving from AJAX
*
* @param Array $params
* @return string
*/
function SaveWarning($params)
{
if ($this->Prefix != 'c') {
// don't use this method for other prefixes then Category, that use this tag processor
parent::SaveWarning($params);
return ;
}
$main_prefix = getArrayValue($params, 'main_prefix');
if ($main_prefix && $main_prefix != '$main_prefix') {
$top_prefix = $main_prefix;
}
else {
$top_prefix = $this->Application->GetTopmostPrefix($this->Prefix);
}
$temp_tables = substr($this->Application->GetVar($top_prefix.'_mode'), 0, 1) == 't';
$modified = $this->Application->RecallVar($top_prefix.'_modified');
if (!$temp_tables) {
$this->Application->RemoveVar($top_prefix.'_modified');
return '';
}
$block_name = $this->SelectParam($params, 'render_as,name');
if ($block_name) {
$block_params = $this->prepareTagParams($params);
$block_params['name'] = $block_name;
$block_params['edit_mode'] = $temp_tables ? 1 : 0;
$block_params['display'] = $temp_tables && $modified ? 1 : 0;
return $this->Application->ParseBlock($block_params);
}
else {
return $temp_tables && $modified ? 1 : 0;
}
return ;
}
/**
* Allows to detect if this prefix has something in clipboard
*
* @param Array $params
* @return bool
*/
function HasClipboard($params)
{
$clipboard = $this->Application->RecallVar('clipboard');
if ($clipboard) {
$clipboard = unserialize($clipboard);
foreach ($clipboard as $prefix => $clipboard_data) {
foreach ($clipboard_data as $mode => $ids) {
if (count($ids)) return 1;
}
}
}
return 0;
}
/**
* Allows to detect if root category being edited
*
* @param Array $params
*/
function IsRootCategory($params)
{
$object =& $this->getObject($params);
return $object->IsRoot();
}
function CatalogItemCount($params)
{
$object =& $this->GetList($params);
if (!$object->Counted) {
$object->CountRecs();
}
return $object->NoFilterCount != $object->RecordsCount ? $object->RecordsCount.' / '.$object->NoFilterCount : $object->RecordsCount;
}
/**
* Print grid pagination using
* block names specified
*
* @param Array $params
* @return string
* @access public
*/
function PrintPages($params)
{
if ($this->Application->Parser->GetParam('no_special')) {
$params['no_special'] = $this->Application->Parser->GetParam('no_special');
}
return parent::PrintPages($params);
}
function InitCatalog($params)
{
$tab_prefixes = $this->Application->GetVar('tp'); // {all, <prefixes_list>, none}
if ($tab_prefixes === false) $tab_prefixes = 'all';
$skip_prefixes = isset($params['skip_prefixes']) && $params['skip_prefixes'] ? explode(',', $params['skip_prefixes']) : Array();
// get all prefixes available
$prefixes = Array();
foreach ($this->Application->ModuleInfo as $module_name => $module_data) {
if ($module_data['Var'] == 'm') continue;
$prefixes[] = $module_data['Var'];
}
if ($tab_prefixes == 'none') {
$skip_prefixes = array_unique(array_merge($skip_prefixes, $prefixes));
}
elseif ($tab_prefixes != 'all') {
// prefix list here
$tab_prefixes = explode(',', $tab_prefixes); // list of prefixes that should stay
$skip_prefixes = array_unique(array_merge($skip_prefixes, array_diff($prefixes, $tab_prefixes)));
}
$params['name'] = $params['render_as'];
$params['skip_prefixes'] = implode(',', $skip_prefixes);
return $this->Application->ParseBlock($params, 1);
}
function IsActive($params)
{
$cat_id = isset($params['cat_id']) && $params['cat_id'] ? $params['cat_id'] : false;
if ($cat_id === false) {
// category not supplied -> get current from PrintList
$cat_id = $this->Application->GetVar($this->getPrefixSpecial().'_id');
$current_cat =& $this->getObject($params);
}
else {
if ("$cat_id" == 'Root') {
$cat_id = $this->Application->findModule('Name', $params['module'], 'RootCat');
}
$current_cat =& $this->Application->recallObject($this->Prefix.'.-c'.$cat_id, $this->Prefix, Array ('skip_autoload' => true));
$current_cat->Load($cat_id);
}
$current_path = $current_cat->GetDBField('ParentPath');
static $parent_path = null;
if (!isset($parent_path)) {
$parent_path = $this->Conn->GetOne('SELECT ParentPath FROM '.TABLE_PREFIX.'Category WHERE CategoryId = '.$this->Application->GetVar('m_cat_id'));
}
return strpos($parent_path, $current_path) !== false;
}
/**
* Checks if user have one of required permissions
*
* @param Array $params
* @return bool
*/
function HasPermission($params)
{
$perm_helper =& $this->Application->recallObject('PermissionsHelper');
/* @var $perm_helper kPermissionsHelper */
$params['raise_warnings'] = 0;
$object =& $this->getObject($params);
/* @var $object kDBItem */
$params['cat_id'] = $object->isLoaded() ? $object->GetDBField('ParentPath') : $this->Application->GetVar('m_cat_id');
return $perm_helper->TagPermissionCheck($params, $this->getPrefixSpecial().'_HasPermission');
}
function PerPageSelected($params)
{
$list =& $this->GetList($params);
return $list->PerPage == $params['per_page'] ? $params['selected'] : '';
}
/**
* Prepares name for field with event in it (used only on front-end)
*
* @param Array $params
* @return string
*/
function SubmitName($params)
{
return 'events['.$this->Prefix.']['.$params['event'].']';
}
}
?>
\ No newline at end of file
Property changes on: trunk/core/units/categories/categories_tag_processor.php
___________________________________________________________________
Modified: cvs2svn:cvs-rev
## -1 +1 ##
-1.40
\ No newline at end of property
+1.41
\ No newline at end of property
Index: trunk/core/units/general/main_event_handler.php
===================================================================
--- trunk/core/units/general/main_event_handler.php (revision 8477)
+++ trunk/core/units/general/main_event_handler.php (revision 8478)
@@ -1,134 +1,139 @@
<?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']) {
$category_filename = $this->Application->getFilename('c', $processed_params['m_cat_id']);
$t = isset($url_params['t']) && $url_params['t'] ? $url_params['t'] : false;
// category name doesn't match template name -> Proj-CMS/In-Edit tricks
if (!preg_match('/Content\/'.preg_quote($t, '/').'/i', $category_filename)) {
$ret .= $category_filename.'/';
}
$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']) : '';
+ if ((strtolower($template) == '__default__') && ($processed_params['m_cat_id'] == 0)) {
+ // for "Home" category set template to index when not set
+ $template = 'index';
+ }
+
// 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: trunk/core/units/general/main_event_handler.php
___________________________________________________________________
Modified: cvs2svn:cvs-rev
## -1 +1 ##
-1.16
\ No newline at end of property
+1.17
\ No newline at end of property
Event Timeline
Log In to Comment