Page MenuHomeIn-Portal Phabricator

in-portal
No OneTemporary

File Metadata

Created
Thu, Jun 26, 5:45 AM

in-portal

This document is not UTF8. It was detected as ISO-8859-1 (Latin 1) and converted to UTF8 for display.
Index: branches/unlabeled/unlabeled-1.2.2/kernel/units/general/helpers/helpers_config.php
===================================================================
--- branches/unlabeled/unlabeled-1.2.2/kernel/units/general/helpers/helpers_config.php (nonexistent)
+++ branches/unlabeled/unlabeled-1.2.2/kernel/units/general/helpers/helpers_config.php (revision 5551)
@@ -0,0 +1,17 @@
+<?php
+
+ $config = Array(
+ 'Prefix' => 'helpers',
+ 'EventHandlerClass' => Array('class' => 'kEventHandler', 'file' => '', 'build_event' => 'OnBuild'),
+
+ 'RegisterClasses' => Array(
+ Array('pseudo'=>'kMultiLanguageHelper','class'=>'kMultiLanguageHelper','file'=>'multilanguage.php','build_event'=>'','require_classes'=>'kHelper'),
+ Array('pseudo'=>'SearchHelper','class'=>'kSearchHelper','file'=>'search_helper.php','build_event'=>'','require_classes'=>'kHelper'),
+ Array('pseudo'=>'SectionsHelper','class'=>'kSectionsHelper','file'=>'sections_helper.php','build_event'=>'','require_classes'=>'kHelper'),
+ Array('pseudo'=>'PermissionsHelper','class'=>'kPermissionsHelper','file'=>'permissions_helper.php','build_event'=>'','require_classes'=>'kHelper'),
+ Array('pseudo'=>'ModulesHelper','class'=>'kModulesHelper','file'=>'modules.php','build_event'=>'','require_classes'=>'kHelper'),
+ Array('pseudo'=>'ModRewriteHelper','class'=>'kModRewriteHelper','file'=>'mod_rewrite_helper.php','build_event'=>'','require_classes'=>'kHelper'),
+ Array('pseudo'=>'RecursiveHelper','class'=>'kRecursiveHelper','file'=>'recursive_helper.php','build_event'=>'','require_classes'=>'kHelper'),
+ Array('pseudo'=>'FilenamesHelper','class'=>'kFilenamesHelper','file'=>'filenames_helper.php','build_event'=>'','require_classes'=>'kHelper'),
+ ),
+ );
\ No newline at end of file
Property changes on: branches/unlabeled/unlabeled-1.2.2/kernel/units/general/helpers/helpers_config.php
___________________________________________________________________
Added: cvs2svn:cvs-rev
## -0,0 +1 ##
+1.2
\ No newline at end of property
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: branches/unlabeled/unlabeled-1.2.2/kernel/units/general/helpers/filenames_helper.php
===================================================================
--- branches/unlabeled/unlabeled-1.2.2/kernel/units/general/helpers/filenames_helper.php (nonexistent)
+++ branches/unlabeled/unlabeled-1.2.2/kernel/units/general/helpers/filenames_helper.php (revision 5551)
@@ -0,0 +1,90 @@
+<?php
+
+class kFilenamesHelper extends kHelper {
+ /**
+ * replace not allowed symbols with "_" chars + remove duplicate "_" chars in result
+ *
+ * @param string $string
+ * @return string
+ */
+ function stripDisallowed($table, $id_field, $item_id, $filename)
+ {
+ $not_allowed = Array( ' ', '\\', '/', ':', '*', '?', '"', '<', '>', '|', '`',
+ '~', '!', '@', '#', '$', '%', '^', '&', '(', ')', '~',
+ '+', '=', '-', '{', '}', ']', '[', "'", ';', '.', ',');
+
+ $filename = str_replace($not_allowed, '_', $filename);
+ $filename = preg_replace('/(_+)/', '_', $filename);
+ $filename = $this->checkAutoFilename($table, $id_field, $item_id, $filename);
+
+ return $filename;
+ }
+
+ function checkAutoFilename($table, $id_field, $item_id, $filename)
+ {
+ if(!$filename) return $filename;
+
+ $item_id = !$item_id ? 0 : $item_id;
+
+ if ($table == TABLE_PREFIX.'CategoryItems') {
+ $item_categories_cur = $this->Conn->GetCol('SELECT CategoryId FROM '.$table.' WHERE ItemResourceId = '.$item_id);
+ $item_categories_live = $this->Application->IsTempTable($table) ? $this->Conn->GetCol('SELECT CategoryId FROM '.$this->Application->GetLiveName($table).' WHERE ItemResourceId = '.$item_id) : array();
+
+ $item_categories = array_unique(array_merge($item_categories_cur, $item_categories_live));
+ if (!$item_categories) {
+ $item_categories = array($this->Application->GetVar('m_cat_id')); // this may happen when creating new item
+ }
+ $cat_filter = ' AND CategoryId IN ('.implode(',', $item_categories).')';
+ }
+ else {
+ $cat_filter = '';
+ }
+
+ // check current table (temp or live)
+ $sql_temp = 'SELECT '.$id_field.' FROM '.$table.' WHERE Filename = '.$this->Conn->qstr($filename).$cat_filter;
+ $found_temp_ids = $this->Conn->GetCol($sql_temp);
+
+ // check live table if current is temp
+ if ( $this->Application->IsTempTable($table) ) {
+ $sql_live = 'SELECT '.$id_field.' FROM '.$this->Application->GetLiveName($table).' WHERE Filename = '.$this->Conn->qstr($filename).$cat_filter;
+ $found_live_ids = $this->Conn->GetCol($sql_live);
+ }
+ else {
+ $found_live_ids = array();
+ }
+
+ $found_item_ids = array_unique( array_merge($found_temp_ids, $found_live_ids) );
+
+ $has_page = preg_match('/(.*)_([\d]+)([a-z]*)$/', $filename, $rets);
+
+ $duplicates_found = (count($found_item_ids) > 1) || ($found_item_ids && $found_item_ids[0] != $item_id);
+ if ($duplicates_found || $has_page) // other category has same filename as ours OR we have filename, that ends with _number
+ {
+ $append = $duplicates_found ? '_a' : '';
+ if($has_page)
+ {
+ $filename = $rets[1].'_'.$rets[2];
+ $append = $rets[3] ? $rets[3] : '_a';
+ }
+
+ // check live & temp table
+ $sql_cur = 'SELECT '.$id_field.' FROM '.$table.' WHERE (Filename = %s) AND ('.$id_field.' != '.$item_id.')'.$cat_filter;
+ $sql_live = $this->Application->IsTempTable($table) ? 'SELECT '.$id_field.' FROM '.$this->Application->GetLiveName($table).' WHERE (Filename = %s) AND ('.$id_field.' != '.$item_id.')'.$cat_filter : false;
+ while ( $this->Conn->GetOne( sprintf($sql_cur, $this->Conn->qstr($filename.$append)) ) > 0 ||
+ ( $sql_live
+ &&
+ ( $this->Conn->GetOne( sprintf($sql_live, $this->Conn->qstr($filename.$append)) ) > 0 )
+ )
+ )
+ {
+ if (substr($append, -1) == 'z') $append .= 'a';
+ $append = substr($append, 0, strlen($append) - 1) . chr( ord( substr($append, -1) ) + 1 );
+ }
+
+ return $filename.$append;
+ }
+
+ return $filename;
+ }
+
+}
\ No newline at end of file
Property changes on: branches/unlabeled/unlabeled-1.2.2/kernel/units/general/helpers/filenames_helper.php
___________________________________________________________________
Added: cvs2svn:cvs-rev
## -0,0 +1 ##
+1.2
\ No newline at end of property
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: branches/unlabeled/unlabeled-1.2.2/kernel/units/general/helpers/recursive_helper.php
===================================================================
--- branches/unlabeled/unlabeled-1.2.2/kernel/units/general/helpers/recursive_helper.php (nonexistent)
+++ branches/unlabeled/unlabeled-1.2.2/kernel/units/general/helpers/recursive_helper.php (revision 5551)
@@ -0,0 +1,37 @@
+<?php
+
+ class kRecursiveHelper extends kHelper {
+
+ function DeleteCategory($category_id)
+ {
+ $id_field = $this->Application->getUnitOption('c', 'IDField');
+ $table_name = $this->Application->getUnitOption('c', 'TableName');
+
+ $sql = 'SELECT '.$id_field.'
+ FROM '.$table_name.'
+ WHERE ParentId = '.$category_id;
+
+ $sub_categories = $this->Conn->GetCol($sql);
+ if ($sub_categories) {
+ foreach ($sub_categories as $sub_category_id) {
+ $this->DeleteCategory($sub_category_id);
+ }
+ }
+
+ // 1. remove category items from this category if it is supplemental (non-primary) category to them
+ $sql = 'DELETE FROM '.TABLE_PREFIX.'CategoryItems
+ WHERE ('.$id_field.' = '.$category_id.') AND (PrimaryCat = 0)';
+ $this->Conn->Query($sql);
+
+ $temp_handler =& $this->Application->recallObject('c_TempHandler', 'kTempTablesHandler');
+
+ // 2. delete items this have this category as primary
+// $temp_handler->DeleteItems($item_prefix, '', $item_ids);
+
+ // 3. delete this category
+ $temp_handler->DeleteItems('c', '', Array($category_id));
+
+ }
+ }
+
+?>
\ No newline at end of file
Property changes on: branches/unlabeled/unlabeled-1.2.2/kernel/units/general/helpers/recursive_helper.php
___________________________________________________________________
Added: cvs2svn:cvs-rev
## -0,0 +1 ##
+1.2
\ No newline at end of property
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: branches/unlabeled/unlabeled-1.2.2/kernel/admin_templates/groups/groups_edit_tabs.tpl
===================================================================
--- branches/unlabeled/unlabeled-1.2.2/kernel/admin_templates/groups/groups_edit_tabs.tpl (nonexistent)
+++ branches/unlabeled/unlabeled-1.2.2/kernel/admin_templates/groups/groups_edit_tabs.tpl (revision 5551)
@@ -0,0 +1,16 @@
+<table cellpadding="0" cellspacing="0" border="0" width="100%">
+<tr>
+ <td align="right" width="100%">
+ <table cellpadding="0" cellspacing="0" border="0" height="23">
+ <tr>
+ <inp2:m_ParseBlock name="tab" title="la_tab_General" t="groups/groups_edit" main_prefix="g"/>
+ <!--<inp2:m_ParseBlock name="tab" title="la_tab_Users" t="groups/groups_edit_users" main_prefix="g"/>-->
+
+ <inp2:m_if check="m_CheckPermission" permissions="in-portal:user_groups.advanced:manage_permissions" system="1">
+ <inp2:m_ParseBlock name="tab" title="la_tab_Permissions" t="groups/groups_edit_permissions" main_prefix="g"/>
+ </inp2:m_if>
+ </tr>
+ </table>
+ </td>
+</tr>
+</table>
\ No newline at end of file
Property changes on: branches/unlabeled/unlabeled-1.2.2/kernel/admin_templates/groups/groups_edit_tabs.tpl
___________________________________________________________________
Added: cvs2svn:cvs-rev
## -0,0 +1 ##
+1.2
\ No newline at end of property
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: branches/unlabeled/unlabeled-1.2.2/kernel/admin_templates/categories/categories_tabs.tpl
===================================================================
--- branches/unlabeled/unlabeled-1.2.2/kernel/admin_templates/categories/categories_tabs.tpl (nonexistent)
+++ branches/unlabeled/unlabeled-1.2.2/kernel/admin_templates/categories/categories_tabs.tpl (revision 5551)
@@ -0,0 +1,29 @@
+<inp2:m_DefineElement name="grid_save_warning">
+<table id="save_warning" width="100%" border="0" cellspacing="0" cellpadding="4" class="table_border_notop" style="display: <inp2:m_if check="m_ParamEquals" name="display" value="1">block<inp2:m_else/>none</inp2:_if>;">
+ <tr>
+ <td valign="top" class="hint_red">
+ <inp2:m_phrase name="la_Warning_Save_Item"/>
+ </td>
+ </tr>
+</table>
+<script type="text/javascript">
+ $edit_mode = <inp2:m_if check="m_ParamEquals" name="display" value="1">true<inp2:m_else />false</inp2:m_if>;
+</script>
+</inp2:m_DefineElement>
+
+<table cellpadding="0" cellspacing="0" border="0" width="100%">
+<tr>
+ <td align="right" width="100%">
+ <table cellpadding="0" cellspacing="0" border="0" height="23">
+ <tr>
+ <inp2:m_ParseBlock name="tab" title="la_tab_General" t="categories/categories_edit" main_prefix="c"/>
+ <inp2:m_ParseBlock name="tab" title="la_tab_Properties" t="categories/categories_edit_properties" main_prefix="c"/>
+ <inp2:m_ParseBlock name="tab" title="la_tab_Relations" t="categories/categories_edit_relations" main_prefix="c"/>
+ <inp2:m_ParseBlock name="tab" title="la_tab_Images" t="categories/categories_edit_images" main_prefix="c"/>
+ <inp2:m_ParseBlock name="tab" title="la_tab_Permissions" t="categories/categories_edit_permissions" main_prefix="c"/>
+ <inp2:m_ParseBlock name="tab" title="la_tab_Custom" t="categories/categories_edit_custom" main_prefix="c"/>
+ </tr>
+ </table>
+ </td>
+</tr>
+</table>
\ No newline at end of file
Property changes on: branches/unlabeled/unlabeled-1.2.2/kernel/admin_templates/categories/categories_tabs.tpl
___________________________________________________________________
Added: cvs2svn:cvs-rev
## -0,0 +1 ##
+1.2
\ No newline at end of property
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: branches/unlabeled/unlabeled-1.2.2/kernel/admin_templates/categories/categories_edit.tpl
===================================================================
--- branches/unlabeled/unlabeled-1.2.2/kernel/admin_templates/categories/categories_edit.tpl (nonexistent)
+++ branches/unlabeled/unlabeled-1.2.2/kernel/admin_templates/categories/categories_edit.tpl (revision 5551)
@@ -0,0 +1,93 @@
+<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="reflect_filename();">
+
+<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_edit" 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">
+ 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','OnCancel');
+ }
+ ) );
+
+ 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/>');
+ }
+ ) );
+
+ 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"/>
+<table width="100%" border="0" cellspacing="0" cellpadding="4" class="tableborder">
+ <inp2:m_ParseBlock name="subsection" title="!la_section_Category!"/>
+ <inp2:m_ParseBlock name="inp_id_label" prefix="c" field="CategoryId" title="!la_fld_CategoryId!"/>
+ <inp2:m_ParseBlock name="inp_edit_box_ml" prefix="c" field="Name" title="!la_fld_Name!" size="30"/>
+ <inp2:m_ParseBlock name="inp_edit_textarea_ml" prefix="c" field="Description" title="!la_fld_Description!" rows="5" cols="60"/>
+ <inp2:m_ParseBlock name="inp_edit_checkbox" prefix="c" field="AutomaticFilename" title="!la_fld_CategoryAutomaticFilename!" onchange="reflect_filename()"/>
+ <inp2:m_ParseBlock name="inp_edit_box" prefix="c" field="Filename" title="!la_fld_CategoryFilename!" size="63"/>
+ <inp2:m_ParseBlock name="inp_edit_box" prefix="c" field="CategoryTemplate" title="!la_fld_CategoryTemplate!" size="40"/>
+ <inp2:m_ParseBlock name="inp_edit_box" prefix="c" field="ItemTemplate" title="!la_fld_ItemTemplate!" size="40"/>
+
+ <inp2:m_ParseBlock name="subsection" title="!la_section_Properties!"/>
+ <inp2:m_ParseBlock name="inp_edit_radio" prefix="c" field="Status" title="!la_fld_Status!" use_phrases="1"/>
+ <inp2:m_ParseBlock name="inp_edit_radio" prefix="c" field="NewItem" title="!la_fld_New!" use_phrases="1"/>
+ <inp2:m_ParseBlock name="inp_edit_checkbox" prefix="c" field="EditorsPick" title="!la_fld_EditorsPick!"/>
+ <inp2:m_ParseBlock name="inp_edit_box" prefix="c" field="Priority" title="!la_fld_Priority!" size="4"/>
+ <inp2:m_ParseBlock name="inp_edit_date_time" prefix="c" field="CreatedOn" title="!la_fld_CreatedOn!"/>
+ <inp2:m_ParseBlock name="inp_edit_box" prefix="c" field="MetaKeywords" title="!la_fld_MetaKeywords!" size="30"/>
+ <inp2:m_ParseBlock name="inp_edit_textarea" prefix="c" field="MetaDescription" title="!la_fld_MetaDescription!" rows="2" cols="60"/>
+
+ <!-- custom fields: begin -->
+ <inp2:m_include t="incs/custom_blocks"/>
+ <inp2:cf.general_PrintList render_as="cv_row_block" SourcePrefix="c" value_field="Value" per_page="-1" grid="Default" />
+ <!-- custom fields: end -->
+</table>
+
+<script type="text/javascript">
+ function reflect_filename()
+ {
+ var $checked = document.getElementById('_cb_<inp2:c_InputName field="AutomaticFilename"/>').checked;
+ document.getElementById('<inp2:c_InputName field="Filename"/>').readOnly = $checked;
+ }
+</script>
+
+<inp2:m_include t="incs/footer"/>
\ No newline at end of file
Property changes on: branches/unlabeled/unlabeled-1.2.2/kernel/admin_templates/categories/categories_edit.tpl
___________________________________________________________________
Added: cvs2svn:cvs-rev
## -0,0 +1 ##
+1.2
\ No newline at end of property
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: branches/unlabeled/unlabeled-1.2.2/kernel/admin/include/help/editcategory_items.txt
===================================================================
--- branches/unlabeled/unlabeled-1.2.2/kernel/admin/include/help/editcategory_items.txt (nonexistent)
+++ branches/unlabeled/unlabeled-1.2.2/kernel/admin/include/help/editcategory_items.txt (revision 5551)
@@ -0,0 +1,14 @@
+This tab controls module-specific category properties. The contents of the tab depends on the modules installed.<br/>
+In-newz module adds the following properties:
+RSS Feed Properties:
+<ul>
+<li>Source URL – this fields controls the RSS source URL used for populating current category with articles. The field also accepts multiple RSS source URLs separated by commas.
+<li>Update Interval – the time interval used for parsing the RSS source and populating the category with articles.
+</ul>
+RSS Feed Articles Expiration
+<ul>
+<li>Default Expiration – the default expiration time of articles imported through RSS into the category.
+<li>Expiration Check Interval – the time interval controlling the frequency of checking the expired articles for the purpose of deleting it (see Delete Expired checkbox below)
+<li>Delete Expired – the checkbox controls whether expired articles should be completely deleted from the system, or simply marked as archived (expired).
+</ul>
+As of the current version, In-link, In-commerce and In-bulletin modules do not have any category-level properties.
Property changes on: branches/unlabeled/unlabeled-1.2.2/kernel/admin/include/help/editcategory_items.txt
___________________________________________________________________
Added: cvs2svn:cvs-rev
## -0,0 +1 ##
+1.2
\ No newline at end of property
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: branches/unlabeled/unlabeled-1.2.2/core/units/general/helpers/helpers_config.php
===================================================================
--- branches/unlabeled/unlabeled-1.2.2/core/units/general/helpers/helpers_config.php (nonexistent)
+++ branches/unlabeled/unlabeled-1.2.2/core/units/general/helpers/helpers_config.php (revision 5551)
@@ -0,0 +1,17 @@
+<?php
+
+ $config = Array(
+ 'Prefix' => 'helpers',
+ 'EventHandlerClass' => Array('class' => 'kEventHandler', 'file' => '', 'build_event' => 'OnBuild'),
+
+ 'RegisterClasses' => Array(
+ Array('pseudo'=>'kMultiLanguageHelper','class'=>'kMultiLanguageHelper','file'=>'multilanguage.php','build_event'=>'','require_classes'=>'kHelper'),
+ Array('pseudo'=>'SearchHelper','class'=>'kSearchHelper','file'=>'search_helper.php','build_event'=>'','require_classes'=>'kHelper'),
+ Array('pseudo'=>'SectionsHelper','class'=>'kSectionsHelper','file'=>'sections_helper.php','build_event'=>'','require_classes'=>'kHelper'),
+ Array('pseudo'=>'PermissionsHelper','class'=>'kPermissionsHelper','file'=>'permissions_helper.php','build_event'=>'','require_classes'=>'kHelper'),
+ Array('pseudo'=>'ModulesHelper','class'=>'kModulesHelper','file'=>'modules.php','build_event'=>'','require_classes'=>'kHelper'),
+ Array('pseudo'=>'ModRewriteHelper','class'=>'kModRewriteHelper','file'=>'mod_rewrite_helper.php','build_event'=>'','require_classes'=>'kHelper'),
+ Array('pseudo'=>'RecursiveHelper','class'=>'kRecursiveHelper','file'=>'recursive_helper.php','build_event'=>'','require_classes'=>'kHelper'),
+ Array('pseudo'=>'FilenamesHelper','class'=>'kFilenamesHelper','file'=>'filenames_helper.php','build_event'=>'','require_classes'=>'kHelper'),
+ ),
+ );
\ No newline at end of file
Property changes on: branches/unlabeled/unlabeled-1.2.2/core/units/general/helpers/helpers_config.php
___________________________________________________________________
Added: cvs2svn:cvs-rev
## -0,0 +1 ##
+1.2
\ No newline at end of property
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: branches/unlabeled/unlabeled-1.2.2/core/units/general/helpers/filenames_helper.php
===================================================================
--- branches/unlabeled/unlabeled-1.2.2/core/units/general/helpers/filenames_helper.php (nonexistent)
+++ branches/unlabeled/unlabeled-1.2.2/core/units/general/helpers/filenames_helper.php (revision 5551)
@@ -0,0 +1,90 @@
+<?php
+
+class kFilenamesHelper extends kHelper {
+ /**
+ * replace not allowed symbols with "_" chars + remove duplicate "_" chars in result
+ *
+ * @param string $string
+ * @return string
+ */
+ function stripDisallowed($table, $id_field, $item_id, $filename)
+ {
+ $not_allowed = Array( ' ', '\\', '/', ':', '*', '?', '"', '<', '>', '|', '`',
+ '~', '!', '@', '#', '$', '%', '^', '&', '(', ')', '~',
+ '+', '=', '-', '{', '}', ']', '[', "'", ';', '.', ',');
+
+ $filename = str_replace($not_allowed, '_', $filename);
+ $filename = preg_replace('/(_+)/', '_', $filename);
+ $filename = $this->checkAutoFilename($table, $id_field, $item_id, $filename);
+
+ return $filename;
+ }
+
+ function checkAutoFilename($table, $id_field, $item_id, $filename)
+ {
+ if(!$filename) return $filename;
+
+ $item_id = !$item_id ? 0 : $item_id;
+
+ if ($table == TABLE_PREFIX.'CategoryItems') {
+ $item_categories_cur = $this->Conn->GetCol('SELECT CategoryId FROM '.$table.' WHERE ItemResourceId = '.$item_id);
+ $item_categories_live = $this->Application->IsTempTable($table) ? $this->Conn->GetCol('SELECT CategoryId FROM '.$this->Application->GetLiveName($table).' WHERE ItemResourceId = '.$item_id) : array();
+
+ $item_categories = array_unique(array_merge($item_categories_cur, $item_categories_live));
+ if (!$item_categories) {
+ $item_categories = array($this->Application->GetVar('m_cat_id')); // this may happen when creating new item
+ }
+ $cat_filter = ' AND CategoryId IN ('.implode(',', $item_categories).')';
+ }
+ else {
+ $cat_filter = '';
+ }
+
+ // check current table (temp or live)
+ $sql_temp = 'SELECT '.$id_field.' FROM '.$table.' WHERE Filename = '.$this->Conn->qstr($filename).$cat_filter;
+ $found_temp_ids = $this->Conn->GetCol($sql_temp);
+
+ // check live table if current is temp
+ if ( $this->Application->IsTempTable($table) ) {
+ $sql_live = 'SELECT '.$id_field.' FROM '.$this->Application->GetLiveName($table).' WHERE Filename = '.$this->Conn->qstr($filename).$cat_filter;
+ $found_live_ids = $this->Conn->GetCol($sql_live);
+ }
+ else {
+ $found_live_ids = array();
+ }
+
+ $found_item_ids = array_unique( array_merge($found_temp_ids, $found_live_ids) );
+
+ $has_page = preg_match('/(.*)_([\d]+)([a-z]*)$/', $filename, $rets);
+
+ $duplicates_found = (count($found_item_ids) > 1) || ($found_item_ids && $found_item_ids[0] != $item_id);
+ if ($duplicates_found || $has_page) // other category has same filename as ours OR we have filename, that ends with _number
+ {
+ $append = $duplicates_found ? '_a' : '';
+ if($has_page)
+ {
+ $filename = $rets[1].'_'.$rets[2];
+ $append = $rets[3] ? $rets[3] : '_a';
+ }
+
+ // check live & temp table
+ $sql_cur = 'SELECT '.$id_field.' FROM '.$table.' WHERE (Filename = %s) AND ('.$id_field.' != '.$item_id.')'.$cat_filter;
+ $sql_live = $this->Application->IsTempTable($table) ? 'SELECT '.$id_field.' FROM '.$this->Application->GetLiveName($table).' WHERE (Filename = %s) AND ('.$id_field.' != '.$item_id.')'.$cat_filter : false;
+ while ( $this->Conn->GetOne( sprintf($sql_cur, $this->Conn->qstr($filename.$append)) ) > 0 ||
+ ( $sql_live
+ &&
+ ( $this->Conn->GetOne( sprintf($sql_live, $this->Conn->qstr($filename.$append)) ) > 0 )
+ )
+ )
+ {
+ if (substr($append, -1) == 'z') $append .= 'a';
+ $append = substr($append, 0, strlen($append) - 1) . chr( ord( substr($append, -1) ) + 1 );
+ }
+
+ return $filename.$append;
+ }
+
+ return $filename;
+ }
+
+}
\ No newline at end of file
Property changes on: branches/unlabeled/unlabeled-1.2.2/core/units/general/helpers/filenames_helper.php
___________________________________________________________________
Added: cvs2svn:cvs-rev
## -0,0 +1 ##
+1.2
\ No newline at end of property
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: branches/unlabeled/unlabeled-1.2.2/core/units/general/helpers/recursive_helper.php
===================================================================
--- branches/unlabeled/unlabeled-1.2.2/core/units/general/helpers/recursive_helper.php (nonexistent)
+++ branches/unlabeled/unlabeled-1.2.2/core/units/general/helpers/recursive_helper.php (revision 5551)
@@ -0,0 +1,37 @@
+<?php
+
+ class kRecursiveHelper extends kHelper {
+
+ function DeleteCategory($category_id)
+ {
+ $id_field = $this->Application->getUnitOption('c', 'IDField');
+ $table_name = $this->Application->getUnitOption('c', 'TableName');
+
+ $sql = 'SELECT '.$id_field.'
+ FROM '.$table_name.'
+ WHERE ParentId = '.$category_id;
+
+ $sub_categories = $this->Conn->GetCol($sql);
+ if ($sub_categories) {
+ foreach ($sub_categories as $sub_category_id) {
+ $this->DeleteCategory($sub_category_id);
+ }
+ }
+
+ // 1. remove category items from this category if it is supplemental (non-primary) category to them
+ $sql = 'DELETE FROM '.TABLE_PREFIX.'CategoryItems
+ WHERE ('.$id_field.' = '.$category_id.') AND (PrimaryCat = 0)';
+ $this->Conn->Query($sql);
+
+ $temp_handler =& $this->Application->recallObject('c_TempHandler', 'kTempTablesHandler');
+
+ // 2. delete items this have this category as primary
+// $temp_handler->DeleteItems($item_prefix, '', $item_ids);
+
+ // 3. delete this category
+ $temp_handler->DeleteItems('c', '', Array($category_id));
+
+ }
+ }
+
+?>
\ No newline at end of file
Property changes on: branches/unlabeled/unlabeled-1.2.2/core/units/general/helpers/recursive_helper.php
___________________________________________________________________
Added: cvs2svn:cvs-rev
## -0,0 +1 ##
+1.2
\ No newline at end of property
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: branches/unlabeled/unlabeled-1.2.2/core/admin_templates/groups/groups_edit_tabs.tpl
===================================================================
--- branches/unlabeled/unlabeled-1.2.2/core/admin_templates/groups/groups_edit_tabs.tpl (nonexistent)
+++ branches/unlabeled/unlabeled-1.2.2/core/admin_templates/groups/groups_edit_tabs.tpl (revision 5551)
@@ -0,0 +1,16 @@
+<table cellpadding="0" cellspacing="0" border="0" width="100%">
+<tr>
+ <td align="right" width="100%">
+ <table cellpadding="0" cellspacing="0" border="0" height="23">
+ <tr>
+ <inp2:m_ParseBlock name="tab" title="la_tab_General" t="groups/groups_edit" main_prefix="g"/>
+ <!--<inp2:m_ParseBlock name="tab" title="la_tab_Users" t="groups/groups_edit_users" main_prefix="g"/>-->
+
+ <inp2:m_if check="m_CheckPermission" permissions="in-portal:user_groups.advanced:manage_permissions" system="1">
+ <inp2:m_ParseBlock name="tab" title="la_tab_Permissions" t="groups/groups_edit_permissions" main_prefix="g"/>
+ </inp2:m_if>
+ </tr>
+ </table>
+ </td>
+</tr>
+</table>
\ No newline at end of file
Property changes on: branches/unlabeled/unlabeled-1.2.2/core/admin_templates/groups/groups_edit_tabs.tpl
___________________________________________________________________
Added: cvs2svn:cvs-rev
## -0,0 +1 ##
+1.2
\ No newline at end of property
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: branches/unlabeled/unlabeled-1.2.2/core/admin_templates/categories/categories_edit.tpl
===================================================================
--- branches/unlabeled/unlabeled-1.2.2/core/admin_templates/categories/categories_edit.tpl (nonexistent)
+++ branches/unlabeled/unlabeled-1.2.2/core/admin_templates/categories/categories_edit.tpl (revision 5551)
@@ -0,0 +1,93 @@
+<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="reflect_filename();">
+
+<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_edit" 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">
+ 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','OnCancel');
+ }
+ ) );
+
+ 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/>');
+ }
+ ) );
+
+ 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"/>
+<table width="100%" border="0" cellspacing="0" cellpadding="4" class="tableborder">
+ <inp2:m_ParseBlock name="subsection" title="!la_section_Category!"/>
+ <inp2:m_ParseBlock name="inp_id_label" prefix="c" field="CategoryId" title="!la_fld_CategoryId!"/>
+ <inp2:m_ParseBlock name="inp_edit_box_ml" prefix="c" field="Name" title="!la_fld_Name!" size="30"/>
+ <inp2:m_ParseBlock name="inp_edit_textarea_ml" prefix="c" field="Description" title="!la_fld_Description!" rows="5" cols="60"/>
+ <inp2:m_ParseBlock name="inp_edit_checkbox" prefix="c" field="AutomaticFilename" title="!la_fld_CategoryAutomaticFilename!" onchange="reflect_filename()"/>
+ <inp2:m_ParseBlock name="inp_edit_box" prefix="c" field="Filename" title="!la_fld_CategoryFilename!" size="63"/>
+ <inp2:m_ParseBlock name="inp_edit_box" prefix="c" field="CategoryTemplate" title="!la_fld_CategoryTemplate!" size="40"/>
+ <inp2:m_ParseBlock name="inp_edit_box" prefix="c" field="ItemTemplate" title="!la_fld_ItemTemplate!" size="40"/>
+
+ <inp2:m_ParseBlock name="subsection" title="!la_section_Properties!"/>
+ <inp2:m_ParseBlock name="inp_edit_radio" prefix="c" field="Status" title="!la_fld_Status!" use_phrases="1"/>
+ <inp2:m_ParseBlock name="inp_edit_radio" prefix="c" field="NewItem" title="!la_fld_New!" use_phrases="1"/>
+ <inp2:m_ParseBlock name="inp_edit_checkbox" prefix="c" field="EditorsPick" title="!la_fld_EditorsPick!"/>
+ <inp2:m_ParseBlock name="inp_edit_box" prefix="c" field="Priority" title="!la_fld_Priority!" size="4"/>
+ <inp2:m_ParseBlock name="inp_edit_date_time" prefix="c" field="CreatedOn" title="!la_fld_CreatedOn!"/>
+ <inp2:m_ParseBlock name="inp_edit_box" prefix="c" field="MetaKeywords" title="!la_fld_MetaKeywords!" size="30"/>
+ <inp2:m_ParseBlock name="inp_edit_textarea" prefix="c" field="MetaDescription" title="!la_fld_MetaDescription!" rows="2" cols="60"/>
+
+ <!-- custom fields: begin -->
+ <inp2:m_include t="incs/custom_blocks"/>
+ <inp2:cf.general_PrintList render_as="cv_row_block" SourcePrefix="c" value_field="Value" per_page="-1" grid="Default" />
+ <!-- custom fields: end -->
+</table>
+
+<script type="text/javascript">
+ function reflect_filename()
+ {
+ var $checked = document.getElementById('_cb_<inp2:c_InputName field="AutomaticFilename"/>').checked;
+ document.getElementById('<inp2:c_InputName field="Filename"/>').readOnly = $checked;
+ }
+</script>
+
+<inp2:m_include t="incs/footer"/>
\ No newline at end of file
Property changes on: branches/unlabeled/unlabeled-1.2.2/core/admin_templates/categories/categories_edit.tpl
___________________________________________________________________
Added: cvs2svn:cvs-rev
## -0,0 +1 ##
+1.2
\ No newline at end of property
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: branches/unlabeled/unlabeled-1.2.2/core/admin_templates/categories/categories_tabs.tpl
===================================================================
--- branches/unlabeled/unlabeled-1.2.2/core/admin_templates/categories/categories_tabs.tpl (nonexistent)
+++ branches/unlabeled/unlabeled-1.2.2/core/admin_templates/categories/categories_tabs.tpl (revision 5551)
@@ -0,0 +1,29 @@
+<inp2:m_DefineElement name="grid_save_warning">
+<table id="save_warning" width="100%" border="0" cellspacing="0" cellpadding="4" class="table_border_notop" style="display: <inp2:m_if check="m_ParamEquals" name="display" value="1">block<inp2:m_else/>none</inp2:_if>;">
+ <tr>
+ <td valign="top" class="hint_red">
+ <inp2:m_phrase name="la_Warning_Save_Item"/>
+ </td>
+ </tr>
+</table>
+<script type="text/javascript">
+ $edit_mode = <inp2:m_if check="m_ParamEquals" name="display" value="1">true<inp2:m_else />false</inp2:m_if>;
+</script>
+</inp2:m_DefineElement>
+
+<table cellpadding="0" cellspacing="0" border="0" width="100%">
+<tr>
+ <td align="right" width="100%">
+ <table cellpadding="0" cellspacing="0" border="0" height="23">
+ <tr>
+ <inp2:m_ParseBlock name="tab" title="la_tab_General" t="categories/categories_edit" main_prefix="c"/>
+ <inp2:m_ParseBlock name="tab" title="la_tab_Properties" t="categories/categories_edit_properties" main_prefix="c"/>
+ <inp2:m_ParseBlock name="tab" title="la_tab_Relations" t="categories/categories_edit_relations" main_prefix="c"/>
+ <inp2:m_ParseBlock name="tab" title="la_tab_Images" t="categories/categories_edit_images" main_prefix="c"/>
+ <inp2:m_ParseBlock name="tab" title="la_tab_Permissions" t="categories/categories_edit_permissions" main_prefix="c"/>
+ <inp2:m_ParseBlock name="tab" title="la_tab_Custom" t="categories/categories_edit_custom" main_prefix="c"/>
+ </tr>
+ </table>
+ </td>
+</tr>
+</table>
\ No newline at end of file
Property changes on: branches/unlabeled/unlabeled-1.2.2/core/admin_templates/categories/categories_tabs.tpl
___________________________________________________________________
Added: cvs2svn:cvs-rev
## -0,0 +1 ##
+1.2
\ No newline at end of property
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property

Event Timeline