-
+
oInfooValue" align="center">
|
-
+
-
+
-
+
-
+
-
+
-
+
@@ -94,7 +94,7 @@
-
+
| ">
" border="0" alt="" title="" />
" class="userslink"> ()
@@ -106,7 +106,7 @@
-
+
@@ -115,19 +115,19 @@
-
+
- ">
+ ">
|
-
+
">
@@ -141,15 +141,14 @@
|
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
+
+
+
+
+
+
+
+
+
+
Index: trunk/core/kernel/db/db_tag_processor.php
===================================================================
diff -u -r6428 -r6583
--- trunk/core/kernel/db/db_tag_processor.php (.../db_tag_processor.php) (revision 6428)
+++ trunk/core/kernel/db/db_tag_processor.php (.../db_tag_processor.php) (revision 6583)
@@ -1587,6 +1587,53 @@
return $ret;
}
+ function ExportStatus($params)
+ {
+ $export_object =& $this->Application->recallObject('CatItemExportHelper');
+
+ $event = new kEvent($this->getPrefixSpecial().':OnDummy');
+
+ $action_method = 'perform'.ucfirst($this->Special);
+ $field_values = $export_object->$action_method($event);
+
+ // finish code is done from JS now
+ if ($field_values['start_from'] == $field_values['total_records'])
+ {
+ if ($this->Special == 'import') {
+ $this->Application->StoreVar('PermCache_UpdateRequired', 1);
+ $this->Application->Redirect('categories/cache_updater', Array('m_opener' => 'r', 'pass' => 'm', 'continue' => 1, 'no_amp' => 1));
+ }
+ elseif ($this->Special == 'export') {
+ $finish_t = $this->Application->RecallVar('export_finish_t');
+ $this->Application->Redirect($finish_t, Array('pass' => 'all'));
+ $this->Application->RemoveVar('export_finish_t');
+ }
+ }
+
+ $export_options = $export_object->loadOptions($event);
+ return $export_options['start_from'] * 100 / $export_options['total_records'];
+ }
+
+ /**
+ * Returns path where exported category items should be saved
+ *
+ * @param Array $params
+ */
+ function ExportPath($params)
+ {
+ $ret = EXPORT_PATH.'/';
+
+ if( getArrayValue($params, 'as_url') )
+ {
+ $ret = str_replace( FULL_PATH.'/', $this->Application->BaseURL(), $ret);
+ }
+
+ $export_options = unserialize($this->Application->RecallVar($this->getPrefixSpecial().'_options'));
+ $ret .= $export_options['ExportFilename'].'.'.($export_options['ExportFormat'] == 1 ? 'csv' : 'xml');
+
+ return $ret;
+ }
+
}
?>
\ No newline at end of file
Index: trunk/core/units/users/users_event_handler.php
===================================================================
diff -u -r6428 -r6583
--- trunk/core/units/users/users_event_handler.php (.../users_event_handler.php) (revision 6428)
+++ trunk/core/units/users/users_event_handler.php (.../users_event_handler.php) (revision 6583)
@@ -641,7 +641,7 @@
function OnSubscribeUser(&$event){
- $object = &$this->Application->recallObject($this->Prefix.'.subscriber', Array('skip_autoload' => true));
+ $object = &$this->Application->recallObject($this->Prefix.'.subscriber', null, Array('skip_autoload' => true));
$user_email = $this->Application->RecallVar('SubscriberEmail');
Index: trunk/kernel/units/users/users_item.php
===================================================================
diff -u -r4758 -r6583
--- trunk/kernel/units/users/users_item.php (.../users_item.php) (revision 4758)
+++ trunk/kernel/units/users/users_item.php (.../users_item.php) (revision 6583)
@@ -2,20 +2,22 @@
class UsersItem extends kDBItem {
var $persistantVars = Array();
-
- function LoadPersistantVars()
+
+ function LoadPersistantVars($id=null)
{
+ $id = $id == -1 ? -1 : $this->GetID();
+ if (!$id) return ;
$sql = 'SELECT VariableValue, VariableName
FROM '.TABLE_PREFIX.'PersistantSessionData
- WHERE PortalUserId = '.$this->GetID();
+ WHERE PortalUserId = '.$id;
$this->persistantVars = $this->Conn->GetCol($sql, 'VariableName');
}
-
+
function setPersistantVar($var_name, $var_value)
{
$this->persistantVars[$var_name] = $var_value;
-
- if ($this->GetID() > 0) {
+
+ if ($this->GetID() > 0 || $this->GetID() == -1) {
$replace_hash = Array( 'PortalUserId' => $this->GetID(),
'VariableName' => $var_name,
'VariableValue' => $var_value
@@ -26,21 +28,21 @@
$this->Application->StoreVar($var_name, $var_value);
}
}
-
+
function getPersistantVar($var_name)
{
return getArrayValue($this->persistantVars, $var_name);
}
-
+
function Load($id, $id_field_name = null)
{
$ret = parent::Load($id, $id_field_name);
- if ($ret) {
- $this->LoadPersistantVars();
+ if ($ret || $id == -1) {
+ $this->LoadPersistantVars($id);
}
return $ret;
}
-
+
/**
* Returns IDs of groups to which user belongs and membership is not expired
*
@@ -61,7 +63,7 @@
return explode(',', $user_groups);
}
}
-
+
/**
* Set's Login from Email if required by configuration settings
*
@@ -70,10 +72,10 @@
{
if( $this->Application->ConfigValue('Email_As_Login') )
{
- $this->SetDBField('Login', $this->GetDBField('Email') );
+ $this->SetDBField('Login', $this->GetDBField('Email') );
}
}
-
+
function SendEmailEvents()
{
switch( $this->GetDBField('Status') )
@@ -82,25 +84,25 @@
$this->Application->EmailEventAdmin('USER.ADD', $this->GetID() );
$this->Application->EmailEventUser('USER.ADD', $this->GetID() );
break;
-
+
case 2:
$this->Application->EmailEventAdmin('USER.ADD.PENDING', $this->GetID() );
$this->Application->EmailEventUser('USER.ADD.PENDING', $this->GetID() );
break;
}
}
-
+
function isSubscriberOnly()
{
$subscribers_group_id = $this->Application->ConfigValue('User_SubscriberGroup');
$sql = 'SELECT PortalUserId
FROM '.TABLE_PREFIX.'UserGroup
- WHERE GroupId = '.$subscribers_group_id.' AND
- PortalUserId = '.$this->GetDBField('PortalUserId').' AND
+ WHERE GroupId = '.$subscribers_group_id.' AND
+ PortalUserId = '.$this->GetDBField('PortalUserId').' AND
PrimaryGroup = 1';
return $this->Conn->GetOne($sql) == $this->GetDBField('PortalUserId');
}
-
+
function Create($force_id=false, $system_create=false)
{
$ret = parent::Create($force_id, $system_create);
@@ -111,8 +113,8 @@
}
return $ret;
}
-
-
+
+
function Update($id=null, $system_update=false)
{
$ret = parent::Update($id, $system_update);
@@ -123,7 +125,7 @@
}
return $ret;
}
-
+
/**
* Deletes the record from databse
*
@@ -137,14 +139,14 @@
$sync_manager =& $this->Application->recallObjectP('UsersSyncronizeManager', null, Array(), 'InPortalSyncronize');
$sync_manager->performAction('deleteUser', $this->FieldValues);
}
-
+
return $ret;
}
-
+
function setName($full_name)
{
$full_name = explode(' ', $full_name);
-
+
if (count($full_name) > 2) {
$last_name = array_pop($full_name);
$first_name = implode(' ', $full_name);
@@ -153,11 +155,11 @@
$last_name = $full_name[1];
$first_name = $full_name[0];
}
-
+
$this->SetDBField('FirstName', $first_name);
$this->SetDBField('LastName', $last_name);
}
-
-
+
+
}
?>
\ No newline at end of file
Index: trunk/kernel/units/email_events/email_events_config.php
===================================================================
diff -u -r3348 -r6583
--- trunk/kernel/units/email_events/email_events_config.php (.../email_events_config.php) (revision 3348)
+++ trunk/kernel/units/email_events/email_events_config.php (.../email_events_config.php) (revision 6583)
@@ -7,23 +7,23 @@
'EventHandlerClass' => Array('class'=>'EmailEventsEventsHandler','file'=>'email_events_event_handler.php','build_event'=>'OnBuild'),
'TagProcessorClass' => Array('class'=>'kDBTagProcessor','file'=>'','build_event'=>'OnBuild'),
'AutoLoad' => true,
-
+
'QueryString' => Array(
1 => 'id',
2 => 'page',
3 => 'event',
),
-
+
'IDField' => 'EventId',
-
+
'StatusField' => Array('Enabled'),
-
+
'TitleField' => 'Event',
-
+
'TitlePresets' => Array(
'email_settings_list' => Array('prefixes' => Array('emailevents.module_List'), 'format' => '!la_title_EmailSettings! (#emailevents.module_recordcount#)'),
),
-
+
'FilterMenu' => Array(
'Groups' => Array(
Array('mode' => 'AND', 'filters' => Array('show_enabled','show_disabled','show_frontonly'), 'type' => WHERE_FILTER),
@@ -34,28 +34,28 @@
'show_frontonly' => Array('label' => 'la_Text_FrontOnly', 'on_sql' => '', 'off_sql' => '%1$s.Enabled != 2' ),
)
),
-
+
'TableName' => TABLE_PREFIX.'Events',
'CalculatedFields' => Array(
'' => Array (
'FromUser' => 'u.Login',
)
),
-
+
'ListSQLs' => Array( ''=>' SELECT %1$s.* %2$s
FROM %1$s
LEFT JOIN '.TABLE_PREFIX.'PortalUser u ON %1$s.FromUserId = u.PortalUserId',
), // key - special, value - list select sql),
-
+
'ItemSQLs' => Array( ''=>'SELECT * FROM %s'),
-
+
'ListSortings' => Array(
'' => Array('Sorting' => Array('Module' => 'asc', 'Description' => 'asc') ),
-
+
'module' => Array('Sorting' => Array('Description' => 'asc') ),
),
-
+
'Fields' => Array(
'EventId' => Array(),
'Event' => Array('type' => 'string','not_null' => '1','default' => ''),
@@ -68,7 +68,7 @@
'VirtualFields' => Array(
'FromUser' => Array(),
),
-
+
'Grids' => Array(
'Default' => Array(
'Icons' => Array('default'=>'icon16_custom.gif'),
@@ -79,9 +79,9 @@
'Type' => Array( 'title'=>'la_col_Type'),
'Enabled' => Array( 'title'=>'la_col_Status'),
),
-
+
),
-
+
'EmailSettings' => Array(
'Icons' => Array('default'=>'icon16_custom.gif'),
'Fields' => Array(
@@ -90,9 +90,13 @@
'Enabled' => Array('title'=>'la_col_Status'),
'FromUser' => Array('title'=>'la_col_FromToUser'),
),
-
+
),
),
);
+ if (defined('DEBUG_MODE') && DEBUG_MODE) {
+ $config['Grids']['EmailSettings']['Fields']['EventId'] = Array('title' => 'la_col_Id');
+ }
+
?>
\ No newline at end of file
Index: trunk/core/admin_templates/incs/custom_blocks.tpl
===================================================================
diff -u -r6093 -r6583
--- trunk/core/admin_templates/incs/custom_blocks.tpl (.../custom_blocks.tpl) (revision 6093)
+++ trunk/core/admin_templates/incs/custom_blocks.tpl (.../custom_blocks.tpl) (revision 6583)
@@ -1,5 +1,5 @@
- " />
+ " />
@@ -73,11 +73,11 @@
|
" >
-
+
|
- |
+ |
@@ -90,6 +90,11 @@
+
+
+
+ |
+
|
Index: trunk/kernel/units/general/helpers/permissions_helper.php
===================================================================
diff -u -r6428 -r6583
--- trunk/kernel/units/general/helpers/permissions_helper.php (.../permissions_helper.php) (revision 6428)
+++ trunk/kernel/units/general/helpers/permissions_helper.php (.../permissions_helper.php) (revision 6583)
@@ -216,6 +216,7 @@
function showDebug($text, $params)
{
+ return ;
$is_ajax = $this->Application->GetVar('ajax') == 'yes' || isset($params['ajax']) || isset($params['tab_init']);
if (!$this->Application->isDebugMode() || $is_ajax) return true;
echo $text.' ';
Index: trunk/kernel/units/relationship/relationship_event_handler.php
===================================================================
diff -u -r6093 -r6583
--- trunk/kernel/units/relationship/relationship_event_handler.php (.../relationship_event_handler.php) (revision 6093)
+++ trunk/kernel/units/relationship/relationship_event_handler.php (.../relationship_event_handler.php) (revision 6583)
@@ -22,7 +22,7 @@
*/
function OnNew(&$event)
{
- parent::OnNew(&$event);
+ parent::OnNew($event);
$object =& $event->getObject();
$table_info = $object->getLinkedInfo();
Index: trunk/core/units/email_messages/email_messages_event_handler.php
===================================================================
diff -u -r1718 -r6583
--- trunk/core/units/email_messages/email_messages_event_handler.php (.../email_messages_event_handler.php) (revision 1718)
+++ trunk/core/units/email_messages/email_messages_event_handler.php (.../email_messages_event_handler.php) (revision 6583)
@@ -1,8 +1,8 @@
getEmailEventId();
$object =& $event->getObject();
-
+
$parent_info = $object->getLinkedInfo();
-
+
$sql = 'SELECT '.$object->IDField.' FROM '.$object->TableName.' WHERE ('.$parent_info['ForeignKey'].' = '.$parent_info['ParentId'].') AND (EventId = '.$email_event_id.')';
-
+
$id = (int)$this->Conn->GetOne($sql);
if(!$id)
{
@@ -25,12 +25,12 @@
}
return $id;
}
-
+
function getEmailEventId()
{
return parent::getPassedID( new kEvent('emailevents:OnDummy') );
}
-
+
/**
* If loading empty item, then set parent id
*
@@ -44,8 +44,7 @@
$event->status = erFATAL;
}
}
-
-
+
/**
* Parse message template (split into header, subject & body)
*
@@ -54,15 +53,15 @@
function OnAfterItemLoad(&$event)
{
$object =& $event->getObject();
-
+
$lines = explode("\n", $object->GetDBField('Template') );
-
+
$headers = Array();
-
+
foreach($lines as $line)
{
if( strlen(trim($line)) == 0 || ($line == '.') ) break;
-
+
$parts = explode(':', $line, 2);
if(strtolower($parts[0]) == 'subject')
{
@@ -74,15 +73,15 @@
}
}
$object->SetDBField('Headers', implode("\n", $headers) );
-
+
$message_body = '';
while( (list($line_id,$line) = each($lines)) )
{
$message_body .= $line;
}
$object->SetDBField('Body', $message_body);
}
-
+
/**
* Merge body+subject+headers into message template
*
@@ -92,7 +91,7 @@
{
$this->parseVirtualFields($event);
}
-
+
/**
* Merge body+subject+headers into message template
*
@@ -102,7 +101,7 @@
{
$this->parseVirtualFields($event);
}
-
+
/**
* Merge body+subject+headers into message template
*
@@ -122,7 +121,7 @@
$object->SetDBField('Template', $ret);
}
}
-
+
/**
* Remove trailing CR/LF chars from string
*
Index: trunk/core/kernel/parser/construct_tags.php
===================================================================
diff -u -r6093 -r6583
--- trunk/core/kernel/parser/construct_tags.php (.../construct_tags.php) (revision 6093)
+++ trunk/core/kernel/parser/construct_tags.php (.../construct_tags.php) (revision 6583)
@@ -39,7 +39,7 @@
function GetLogic()
{
- if ($this->SkipMode != parse) {
+ if ($this->Parser->SkipMode != parse) {
$this->Logic = false;
return;
}
Index: trunk/core/units/general/general_config.php
===================================================================
diff -u -r5272 -r6583
--- trunk/core/units/general/general_config.php (.../general_config.php) (revision 5272)
+++ trunk/core/units/general/general_config.php (.../general_config.php) (revision 6583)
@@ -15,8 +15,10 @@
'TitleField' => 'CachedNavbar',
'TitlePhrase' => 'la_Text_Category',
'ItemType' => 1,
- 'TableName' => TABLE_PREFIX.'Category',
-
+ 'TableName' => TABLE_PREFIX.'Category',
+
+ 'CatalogItem' => true,
+
'PortalStyleEnv' => true,
'PermTabText' => 'In-Portal',
Index: trunk/core/units/custom_fields/custom_fields_config.php
===================================================================
diff -u -r6093 -r6583
--- trunk/core/units/custom_fields/custom_fields_config.php (.../custom_fields_config.php) (revision 6093)
+++ trunk/core/units/custom_fields/custom_fields_config.php (.../custom_fields_config.php) (revision 6583)
@@ -88,6 +88,7 @@
'VirtualFields' => Array(
'Value' => Array('type' => 'string', 'default' => ''),
'OriginalValue' => Array('type' => 'string', 'default' => ''),
+ 'Error' => Array('type' => 'string', 'default' => ''),
),
@@ -108,6 +109,7 @@
'FieldName' => Array( 'title'=>'la_col_FieldName', 'data_block' => 'grid_icon_td'),
'Prompt' => Array( 'title'=>'la_col_Prompt', 'data_block' => 'grid_data_label_ml_td', 'ElementTypeField' => 'ElementType'),
'Value' => Array( 'title'=>'la_col_Value', 'data_block' => 'edit_custom_td'),
+ 'Error' => Array( 'title'=>'la_col_Error', 'data_block' => 'custom_error_td'),
),
),
Index: trunk/kernel/units/general/cat_dbitem.php
===================================================================
diff -u -r6093 -r6583
--- trunk/kernel/units/general/cat_dbitem.php (.../cat_dbitem.php) (revision 6093)
+++ trunk/kernel/units/general/cat_dbitem.php (.../cat_dbitem.php) (revision 6583)
@@ -60,8 +60,9 @@
$ret = parent::Create();
if ($ret) {
+ $primary_category = $this->GetDBField('CategoryId') > 0 ? $this->GetDBField('CategoryId') : $this->Application->GetVar('m_cat_id');
$fields_hash = Array(
- 'CategoryId' => $this->Application->GetVar('m_cat_id'),
+ 'CategoryId' => $primary_category,
'ItemResourceId' => $this->GetField('ResourceId'),
'PrimaryCat' => 1,
'ItemPrefix' => $this->Prefix,
Index: trunk/core/admin_templates/catalog/advanced_view.tpl
===================================================================
diff -u -r6093 -r6583
--- trunk/core/admin_templates/catalog/advanced_view.tpl (.../advanced_view.tpl) (revision 6093)
+++ trunk/core/admin_templates/catalog/advanced_view.tpl (.../advanced_view.tpl) (revision 6583)
@@ -19,60 +19,60 @@
@@ -103,7 +103,7 @@
- |
+
|
@@ -115,4 +115,10 @@
+
+
+
+
\ No newline at end of file
Index: trunk/core/admin_templates/summary/root.tpl
===================================================================
diff -u -r4651 -r6583
--- trunk/core/admin_templates/summary/root.tpl (.../root.tpl) (revision 4651)
+++ trunk/core/admin_templates/summary/root.tpl (.../root.tpl) (revision 6583)
@@ -11,13 +11,13 @@
|
-
+
|
-
+
-
+
oInfooValue" align="center">
|
-
+
-
+
-
+
-
+
-
+
-
+
@@ -94,7 +94,7 @@
-
+
| ">
" border="0" alt="" title="" />
" class="userslink"> ()
@@ -106,7 +106,7 @@
-
+
@@ -115,19 +115,19 @@
-
+
- ">
+ ">
|
-
+
">
@@ -141,15 +141,14 @@
|
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
+
+
+
+
+
+
+
+
+
+
Index: trunk/core/admin_templates/catalog_tab.tpl
===================================================================
diff -u -r6093 -r6583
--- trunk/core/admin_templates/catalog_tab.tpl (.../catalog_tab.tpl) (revision 6093)
+++ trunk/core/admin_templates/catalog_tab.tpl (.../catalog_tab.tpl) (revision 6583)
@@ -2,6 +2,8 @@
+
+
@@ -19,9 +21,9 @@
#separator#
-
+
-
+
| _" width="50%">
radiocheckbox" name="" id="">
@@ -39,7 +41,7 @@
|
-
+
-
+
Index: trunk/kernel/admin_templates/incs/script.js
===================================================================
diff -u -r6428 -r6583
--- trunk/kernel/admin_templates/incs/script.js (.../script.js) (revision 6428)
+++ trunk/kernel/admin_templates/incs/script.js (.../script.js) (revision 6583)
@@ -758,10 +758,10 @@
function string_to_selected($str, $aSelect)
{
var $cur = null;
- for (var $i = 0; i < $aSelect.length; $i++)
+ for (var $i = 0; $i < $aSelect.length; $i++)
{
$cur = $aSelect.options[$i];
- $aSelect.options[$i].selected = $str.match(',' + $cur.value + ',') ? true : false;
+ $aSelect.options[$i].selected = $str.match('\\|' + $cur.value + '\\|') ? true : false;
}
}
Index: trunk/core/units/users/users_item.php
===================================================================
diff -u -r4758 -r6583
--- trunk/core/units/users/users_item.php (.../users_item.php) (revision 4758)
+++ trunk/core/units/users/users_item.php (.../users_item.php) (revision 6583)
@@ -2,20 +2,22 @@
class UsersItem extends kDBItem {
var $persistantVars = Array();
-
- function LoadPersistantVars()
+
+ function LoadPersistantVars($id=null)
{
+ $id = $id == -1 ? -1 : $this->GetID();
+ if (!$id) return ;
$sql = 'SELECT VariableValue, VariableName
FROM '.TABLE_PREFIX.'PersistantSessionData
- WHERE PortalUserId = '.$this->GetID();
+ WHERE PortalUserId = '.$id;
$this->persistantVars = $this->Conn->GetCol($sql, 'VariableName');
}
-
+
function setPersistantVar($var_name, $var_value)
{
$this->persistantVars[$var_name] = $var_value;
-
- if ($this->GetID() > 0) {
+
+ if ($this->GetID() > 0 || $this->GetID() == -1) {
$replace_hash = Array( 'PortalUserId' => $this->GetID(),
'VariableName' => $var_name,
'VariableValue' => $var_value
@@ -26,21 +28,21 @@
$this->Application->StoreVar($var_name, $var_value);
}
}
-
+
function getPersistantVar($var_name)
{
return getArrayValue($this->persistantVars, $var_name);
}
-
+
function Load($id, $id_field_name = null)
{
$ret = parent::Load($id, $id_field_name);
- if ($ret) {
- $this->LoadPersistantVars();
+ if ($ret || $id == -1) {
+ $this->LoadPersistantVars($id);
}
return $ret;
}
-
+
/**
* Returns IDs of groups to which user belongs and membership is not expired
*
@@ -61,7 +63,7 @@
return explode(',', $user_groups);
}
}
-
+
/**
* Set's Login from Email if required by configuration settings
*
@@ -70,10 +72,10 @@
{
if( $this->Application->ConfigValue('Email_As_Login') )
{
- $this->SetDBField('Login', $this->GetDBField('Email') );
+ $this->SetDBField('Login', $this->GetDBField('Email') );
}
}
-
+
function SendEmailEvents()
{
switch( $this->GetDBField('Status') )
@@ -82,25 +84,25 @@
$this->Application->EmailEventAdmin('USER.ADD', $this->GetID() );
$this->Application->EmailEventUser('USER.ADD', $this->GetID() );
break;
-
+
case 2:
$this->Application->EmailEventAdmin('USER.ADD.PENDING', $this->GetID() );
$this->Application->EmailEventUser('USER.ADD.PENDING', $this->GetID() );
break;
}
}
-
+
function isSubscriberOnly()
{
$subscribers_group_id = $this->Application->ConfigValue('User_SubscriberGroup');
$sql = 'SELECT PortalUserId
FROM '.TABLE_PREFIX.'UserGroup
- WHERE GroupId = '.$subscribers_group_id.' AND
- PortalUserId = '.$this->GetDBField('PortalUserId').' AND
+ WHERE GroupId = '.$subscribers_group_id.' AND
+ PortalUserId = '.$this->GetDBField('PortalUserId').' AND
PrimaryGroup = 1';
return $this->Conn->GetOne($sql) == $this->GetDBField('PortalUserId');
}
-
+
function Create($force_id=false, $system_create=false)
{
$ret = parent::Create($force_id, $system_create);
@@ -111,8 +113,8 @@
}
return $ret;
}
-
-
+
+
function Update($id=null, $system_update=false)
{
$ret = parent::Update($id, $system_update);
@@ -123,7 +125,7 @@
}
return $ret;
}
-
+
/**
* Deletes the record from databse
*
@@ -137,14 +139,14 @@
$sync_manager =& $this->Application->recallObjectP('UsersSyncronizeManager', null, Array(), 'InPortalSyncronize');
$sync_manager->performAction('deleteUser', $this->FieldValues);
}
-
+
return $ret;
}
-
+
function setName($full_name)
{
$full_name = explode(' ', $full_name);
-
+
if (count($full_name) > 2) {
$last_name = array_pop($full_name);
$first_name = implode(' ', $full_name);
@@ -153,11 +155,11 @@
$last_name = $full_name[1];
$first_name = $full_name[0];
}
-
+
$this->SetDBField('FirstName', $first_name);
$this->SetDBField('LastName', $last_name);
}
-
-
+
+
}
?>
\ No newline at end of file
Index: trunk/core/units/email_events/email_events_config.php
===================================================================
diff -u -r3348 -r6583
--- trunk/core/units/email_events/email_events_config.php (.../email_events_config.php) (revision 3348)
+++ trunk/core/units/email_events/email_events_config.php (.../email_events_config.php) (revision 6583)
@@ -7,23 +7,23 @@
'EventHandlerClass' => Array('class'=>'EmailEventsEventsHandler','file'=>'email_events_event_handler.php','build_event'=>'OnBuild'),
'TagProcessorClass' => Array('class'=>'kDBTagProcessor','file'=>'','build_event'=>'OnBuild'),
'AutoLoad' => true,
-
+
'QueryString' => Array(
1 => 'id',
2 => 'page',
3 => 'event',
),
-
+
'IDField' => 'EventId',
-
+
'StatusField' => Array('Enabled'),
-
+
'TitleField' => 'Event',
-
+
'TitlePresets' => Array(
'email_settings_list' => Array('prefixes' => Array('emailevents.module_List'), 'format' => '!la_title_EmailSettings! (#emailevents.module_recordcount#)'),
),
-
+
'FilterMenu' => Array(
'Groups' => Array(
Array('mode' => 'AND', 'filters' => Array('show_enabled','show_disabled','show_frontonly'), 'type' => WHERE_FILTER),
@@ -34,28 +34,28 @@
'show_frontonly' => Array('label' => 'la_Text_FrontOnly', 'on_sql' => '', 'off_sql' => '%1$s.Enabled != 2' ),
)
),
-
+
'TableName' => TABLE_PREFIX.'Events',
'CalculatedFields' => Array(
'' => Array (
'FromUser' => 'u.Login',
)
),
-
+
'ListSQLs' => Array( ''=>' SELECT %1$s.* %2$s
FROM %1$s
LEFT JOIN '.TABLE_PREFIX.'PortalUser u ON %1$s.FromUserId = u.PortalUserId',
), // key - special, value - list select sql),
-
+
'ItemSQLs' => Array( ''=>'SELECT * FROM %s'),
-
+
'ListSortings' => Array(
'' => Array('Sorting' => Array('Module' => 'asc', 'Description' => 'asc') ),
-
+
'module' => Array('Sorting' => Array('Description' => 'asc') ),
),
-
+
'Fields' => Array(
'EventId' => Array(),
'Event' => Array('type' => 'string','not_null' => '1','default' => ''),
@@ -68,7 +68,7 @@
'VirtualFields' => Array(
'FromUser' => Array(),
),
-
+
'Grids' => Array(
'Default' => Array(
'Icons' => Array('default'=>'icon16_custom.gif'),
@@ -79,9 +79,9 @@
'Type' => Array( 'title'=>'la_col_Type'),
'Enabled' => Array( 'title'=>'la_col_Status'),
),
-
+
),
-
+
'EmailSettings' => Array(
'Icons' => Array('default'=>'icon16_custom.gif'),
'Fields' => Array(
@@ -90,9 +90,13 @@
'Enabled' => Array('title'=>'la_col_Status'),
'FromUser' => Array('title'=>'la_col_FromToUser'),
),
-
+
),
),
);
+ if (defined('DEBUG_MODE') && DEBUG_MODE) {
+ $config['Grids']['EmailSettings']['Fields']['EventId'] = Array('title' => 'la_col_Id');
+ }
+
?>
\ No newline at end of file
Index: trunk/kernel/admin_templates/catalog.tpl
===================================================================
diff -u -r6093 -r6583
--- trunk/kernel/admin_templates/catalog.tpl (.../catalog.tpl) (revision 6093)
+++ trunk/kernel/admin_templates/catalog.tpl (.../catalog.tpl) (revision 6583)
@@ -21,26 +21,26 @@
Request.progressText = '';
var $is_catalog = true;
var $Catalog = new Catalog('', 'catalog_');
- var a_toolbar = new ToolBar();
-
+ var a_toolbar = new ToolBar();
+
a_toolbar.AddButton( new ToolBarButton('upcat', '', function() {
$Catalog.go_to_cat($Catalog.ParentCategoryID);
}
) );
-
+
a_toolbar.AddButton( new ToolBarButton('homecat', '', function() {
$Catalog.go_to_cat(0);
}
- ) );
-
+ ) );
+
a_toolbar.AddButton( new ToolBarSeparator('sep1') );
-
+
a_toolbar.AddButton( new ToolBarButton('new_cat', '', function() {
std_precreate_item('c', 'categories/categories_edit');
}
- ) );
-
-
+ ) );
+
+
a_toolbar.AddButton( new ToolBarButton('editcat', '', function() {
var $edit_url = '';
var $category_id = get_hidden_field('m_cat_id');
@@ -49,33 +49,33 @@
redirect($redirect_url);
}
) );
-
+
-
-
+
+
a_toolbar.AddButton( new ToolBarButton('edit', '', edit) );
-
+
a_toolbar.AddButton( new ToolBarButton('delete', '',
function() {
var $template = $Catalog.queryTabRegistry('prefix', $Catalog.getCurrentPrefix(), 'view_template');
std_delete_items($Catalog.getCurrentPrefix(), $template, 1);
- } ) );
-
-
+ } ) );
+
+
a_toolbar.AddButton( new ToolBarSeparator('sep2') );
-
+
a_toolbar.AddButton( new ToolBarButton('approve', '', function() {
$Catalog.submit_event(null, 'OnMassApprove');
}
) );
-
+
a_toolbar.AddButton( new ToolBarButton('decline', '', function() {
$Catalog.submit_event(null, 'OnMassDecline');
}
- ) );
-
+ ) );
+
a_toolbar.AddButton( new ToolBarSeparator('sep3') );
-
+
a_toolbar.AddButton( new ToolBarButton('export', '', function() {
var $export_prefixes = new Array('l', 'p');
if (in_array($Catalog.ActivePrefix, $export_prefixes)) {
@@ -86,65 +86,65 @@
}
}
) );
-
+
a_toolbar.AddButton( new ToolBarButton('rebuild_cache', '', function() {
redirect('');
}
) );
-
+
a_toolbar.AddButton( new ToolBarSeparator('sep4') );
-
-
+
+
a_toolbar.AddButton( new ToolBarButton('cut', '', function() {
$Catalog.submit_event(null, 'OnCut');
}
) );
-
+
a_toolbar.AddButton( new ToolBarButton('copy', '', function() {
$Catalog.submit_event(null, 'OnCopy');
}
) );
-
-
+
+
a_toolbar.AddButton( new ToolBarButton('paste', '', function() {
- $Catalog.submit_event('c', 'OnPasteClipboard', null, function($object) {
+ $Catalog.submit_event('c', 'OnPasteClipboard', null, function($object) {
$object.resetTabs(true);
- $object.switchTab();
+ $object.switchTab();
} );
}
) );
-
+
/*a_toolbar.AddButton( new ToolBarButton('clear_clipboard', '', function() {
if (confirm('')) {
- $Catalog.submit_event('c', 'OnClearClipboard', null, function($object) {
+ $Catalog.submit_event('c', 'OnClearClipboard', null, function($object) {
$GridManager.CheckDependencies($object.ActivePrefix);
} );
}
}
) );*/
-
+
a_toolbar.AddButton( new ToolBarSeparator('sep5') );
-
+
a_toolbar.AddButton( new ToolBarButton('move_up', '', function() {
$Catalog.submit_event(null, 'OnMassMoveUp');
}
) );
-
-
+
+
a_toolbar.AddButton( new ToolBarButton('move_down', '', function() {
$Catalog.submit_event(null, 'OnMassMoveDown');
}
) );
-
+
a_toolbar.AddButton( new ToolBarSeparator('sep6') );
-
+
a_toolbar.AddButton( new ToolBarButton('view', '', function() {
show_viewmenu(a_toolbar, 'view');
}
) );
-
- a_toolbar.Render();
-
+
+ a_toolbar.Render();
+
function edit()
{
var $current_prefix = $Catalog.getCurrentPrefix();
@@ -189,7 +189,7 @@
-
+ |
|
@@ -218,10 +218,10 @@
Application->ProcessParsedTag('m', 't', $params);
}
+
+ function TimeFrame($params)
+ {
+ $w = adodb_date('w');
+ $m = adodb_date('m');
+ $y = adodb_date('Y');
+ //FirstDayOfWeek is 0 for Sunday and 1 for Monday
+ $fdow = $this->Application->ConfigValue('FirstDayOfWeek');
+ if ($fdow && $w == 0) $w = 7;
+ $today_start = adodb_mktime(0,0,0,adodb_date('m'),adodb_date('d'),$y);
+ $first_day_of_this_week = $today_start - ($w - $fdow)*86400;
+ $first_day_of_this_month = adodb_mktime(0,0,0,$m,1,$y);
+ $this_quater = ceil($m/3);
+ $this_quater_start = adodb_mktime(0,0,0,$this_quater*3-2,1,$y);
+
+ switch ($params['type']) {
+ case 'last_week_start':
+ $timestamp = $first_day_of_this_week - 86400*7;
+ break;
+ case 'last_week_end':
+ $timestamp = $first_day_of_this_week - 1;
+ break;
+
+ case 'last_month_start':
+ $timestamp = $m == 1 ? adodb_mktime(0,0,0,12,1,$y-1) : adodb_mktime(0,0,0,$m-1,1,$y);
+ break;
+ case 'last_month_end':
+ $timestamp = $first_day_of_this_month = adodb_mktime(0,0,0,$m,1,$y) - 1;
+ break;
+
+ case 'last_quater_start':
+ $timestamp = $this_quater == 1 ? adodb_mktime(0,0,0,10,1,$y-1) : adodb_mktime(0,0,0,($this_quater-1)*3-2,1,$y);
+ break;
+ case 'last_quater_end':
+ $timestamp = $this_quater_start - 1;
+ break;
+
+ case 'last_6_months_start':
+ $timestamp = $m <= 6 ? adodb_mktime(0,0,0,$m+6,1,$y-1) : adodb_mktime(0,0,0,$m-6,1,$y);
+ break;
+
+ case 'last_year_start':
+ $timestamp = adodb_mktime(0,0,0,1,1,$y-1);
+ break;
+ case 'last_year_end':
+ $timestamp = adodb_mktime(23,59,59,12,31,$y-1);
+ break;
+ }
+
+
+ if (isset($params['format'])) {
+ $format = $params['format'];
+ if(preg_match("/_regional_(.*)/", $format, $regs))
+ {
+ $lang =& $this->Application->recallObject('lang.current');
+ $format = $lang->GetDBField($regs[1]);
+ }
+ return adodb_date($format, $timestamp);
+ }
+
+ return $timestamp;
+
+ }
}
?>
\ No newline at end of file
Index: trunk/kernel/admin_templates/incs/grid_blocks.tpl
===================================================================
diff -u -r6428 -r6583
--- trunk/kernel/admin_templates/incs/grid_blocks.tpl (.../grid_blocks.tpl) (revision 6428)
+++ trunk/kernel/admin_templates/incs/grid_blocks.tpl (.../grid_blocks.tpl) (revision 6583)
@@ -175,7 +175,9 @@
- :
+ error">
+
+ *:
,-cdata', '-cdata:cust_', 'popups/translator', , 1);" title="">
Index: trunk/kernel/units/general/my_application.php
===================================================================
diff -u -r5547 -r6583
--- trunk/kernel/units/general/my_application.php (.../my_application.php) (revision 5547)
+++ trunk/kernel/units/general/my_application.php (.../my_application.php) (revision 6583)
@@ -26,20 +26,6 @@
$this->registerClass('kXMLHelper',MODULES_PATH.'/kernel/units/general/xml_helper.php','kXMLHelper');
$this->registerClass('kModulesHelper', MODULES_PATH.'/kernel/units/general/helpers/modules.php', 'ModulesHelper');
-
- /*$this->registerClass('kMultiLanguageHelper',MODULES_PATH.'/kernel/units/general/helpers/multilanguage.php','kMultiLanguageHelper');
- $this->registerClass('kSearchHelper', MODULES_PATH.'/kernel/units/general/helpers/search_helper.php', 'SearchHelper');
- $this->registerClass('kSectionsHelper', MODULES_PATH.'/kernel/units/general/helpers/sections_helper.php', 'SectionsHelper');
- $this->registerClass('kPermissionsHelper', MODULES_PATH.'/kernel/units/general/helpers/permissions_helper.php', 'PermissionsHelper');
-
-
- $this->registerClass('kModRewriteHelper', MODULES_PATH.'/kernel/units/general/helpers/mod_rewrite_helper.php', 'ModRewriteHelper');
- $this->registerClass('kRecursiveHelper', MODULES_PATH.'/kernel/units/general/helpers/recursive_helper.php', 'RecursiveHelper');
- $this->registerClass('kFilenamesHelper', MODULES_PATH.'/kernel/units/general/helpers/filenames_helper.php', 'kFilenamesHelper');
-
- $this->registerClass('kPDFHelper', MODULES_PATH.'/kernel/units/general/helpers/pdf_helper.php', 'kPDFHelper');
- */
-
}
function getUserGroups($user_id)
Index: trunk/admin/install/inportal_data.sql
===================================================================
diff -u -r6428 -r6583
--- trunk/admin/install/inportal_data.sql (.../inportal_data.sql) (revision 6428)
+++ trunk/admin/install/inportal_data.sql (.../inportal_data.sql) (revision 6583)
@@ -239,7 +239,7 @@
INSERT INTO ItemTypes VALUES (1, 'In-Portal', 'c', 'Category', 'Name', 'CreatedById', NULL, NULL, 'la_ItemTab_Categories', 1, 'admin/category/addcategory.php', 'clsCategory', 'Category');
INSERT INTO ItemTypes VALUES (6, 'In-Portal', 'u', 'PortalUser', 'Login', 'PortalUserId', NULL, NULL, '', 0, '', 'clsPortalUser', 'User');
-INSERT INTO Modules (Name, Path, Var, Version, Loaded, LoadOrder, TemplatePath, RootCat, BuildDate) VALUES ('In-Portal', 'kernel/', 'm', '1.3.0', 1, 0, '', 0, '1054738405');
+INSERT INTO Modules (Name, Path, Var, Version, Loaded, LoadOrder, TemplatePath, RootCat, BuildDate) VALUES ('In-Portal', 'kernel/', 'm', '1.3.1', 1, 0, '', 0, '1054738405');
INSERT INTO PermissionConfig (PermissionName, Description, ErrorMessage, ModuleId) VALUES ('CATEGORY.VIEW', 'lu_PermName_Category.View_desc', 'lu_PermName_Category.View_error', 'In-Portal');
INSERT INTO PermissionConfig (PermissionName, Description, ErrorMessage, ModuleId) VALUES ('CATEGORY.ADD', 'lu_PermName_Category.Add_desc', 'lu_PermName_Category.Add_error', 'In-Portal');
Index: trunk/kernel/admin_templates/incs/catalog.js
===================================================================
diff -u -r6093 -r6583
--- trunk/kernel/admin_templates/incs/catalog.js (.../catalog.js) (revision 6093)
+++ trunk/kernel/admin_templates/incs/catalog.js (.../catalog.js) (revision 6583)
@@ -6,7 +6,7 @@
this.ParentCategoryID = 0;
this.OnResponceMethod = null;
this.TabShift = isset($tab_shift) ? $tab_shift : 1; // start from 2nd tab (index starting from 0)
-
+
this.TabRegistry = new Array();
this.ActivePrefix = getCookie(this.CookiePrefix + 'active_prefix');
this.PreviousPrefix = this.ActivePrefix;
@@ -49,13 +49,13 @@
Catalog.prototype.submit_kernel_form = function($tab_id) {
var $prefix = 'dummy';
var $result_div = '';
-
+
if (isset($tab_id)) {
// responce result + progress are required
$prefix = this.queryTabRegistry('tab_id', $tab_id, 'prefix');
$result_div = $tab_id + '_div';
}
-
+
var $kf = document.getElementById($form_name);
Request.params = Request.serializeForm($kf);
@@ -75,11 +75,12 @@
window.location.href = $match_redirect[1];
return false;
}
-
+
$params = $params.split(',');
-
-
+
+
var $js_end = $text.indexOf($object.Separator);
+// alert($text.substring(0, $js_end));
if ($js_end != -1) {
// allow to detect if output is permitted by ajax request parameters
var $request_visible = '$request_visible = ' + ($params[0].length ? 'true' : 'false') + "\n";
@@ -95,12 +96,12 @@
else if ($params[0].length) {
document.getElementById($params[0]).innerHTML = $text;
}
-
+
if (typeof($object.OnResponceMethod) == 'function') {
$object.OnResponceMethod($object);
$object.OnResponceMethod = null;
}
-
+
if (typeof($Debugger) != 'undefined') {
$Debugger.Clear();
}
@@ -115,7 +116,7 @@
if (typeof($OnResponceMethod) == 'function') {
this.OnResponceMethod = $OnResponceMethod;
}
-
+
var $prev_template = get_hidden_field('t');
if (!isset($prefix_special)) $prefix_special = this.getCurrentPrefix();
var $tab_id = this.queryTabRegistry('prefix', $prefix_special, 'tab_id');
@@ -165,7 +166,7 @@
this.setItemCount(this.TabRegistry[$i]['prefix'], '?');
$i++;
}
-
+
if ($reset_content) {
// set category for all tabs to -1 (forces reload next time)
$i = this.TabShift;
@@ -181,7 +182,7 @@
// active prefix is not registred -> cookie left, but not modules installed/enabled at the moment
return false;
}
-
+
if (!isset($prefix)) $prefix = this.ActivePrefix;
if (this.BusyRequest[$prefix]) {
@@ -204,7 +205,7 @@
this.ShowDependentButtons(this.ActivePrefix);
this.setViewMenu(this.ActivePrefix);
setCookie(this.CookiePrefix + 'active_prefix', this.ActivePrefix);
-
+
this.refreshTab($prefix, $div_id, $force);
}
@@ -267,7 +268,7 @@
else {
alert('has form: ['+$tab_id + '_form'+']');
}*/
-
+
var $dep_buttons = this.queryTabRegistry('prefix', $prefix, 'dep_buttons');
var $i = 0;
while ($i < $dep_buttons.length) {
Index: trunk/kernel/include/statitem.php
===================================================================
diff -u -r3282 -r6583
--- trunk/kernel/include/statitem.php (.../statitem.php) (revision 3282)
+++ trunk/kernel/include/statitem.php (.../statitem.php) (revision 6583)
@@ -3,7 +3,7 @@
{
var $GotValue;
var $TagCache = Array(); // parsed tag (in sql queries only) values are cached
-
+
var $CurrentSQL = ''; // sql query being currently processed
var $PostFormatting = false; // apply formatting to sql query results
var $PostFormattingParams = Array(); // post formatting params if any
@@ -14,21 +14,21 @@
$this->id_field = "StatItemId";
$this->NoResourceId = 1;
$this->GotValue = FALSE;
-
+
if($id)
$this->LoadFromDatabase($id);
}
-
-
+
+
function LoadFromDatabase($Id)
{
global $Errors;
-
+
if(!isset($Id))
{
$Errors->AddError("error.AppError",NULL,'Internal error: LoadFromDatabase id',"",get_class($this),"LoadFromDatabase");
return false;
- }
+ }
$sql = sprintf("SELECT * FROM ".$this->tablename." WHERE ".$this->IdField()." = '%s'",$Id);
$result = $this->adodbConnection->Execute($sql);
if ($result === false)
@@ -41,7 +41,7 @@
$this->SetFromArray($data);
return true;
- }
+ }
function ExecuteResetSQL()
{
@@ -53,29 +53,29 @@
function ExecuteValueSQL()
{
global $ADODB_FETCH_MODE;
-
- $ADODB_FETCH_MODE = 3;
+
+ $ADODB_FETCH_MODE = 3;
$this->CurrentSQL = $this->Get("ValueSQL");
-
+
// 1. replace prefix to actual one
$this->CurrentSQL = str_replace("<%prefix%>", GetTablePrefix(), $this->CurrentSQL);
-
- // 2. replace config variable to it's value
- while( ($tag = $this->FindTag()) != false )
- {
- if( !array_key_exists( trim($tag), $this->TagCache ) )
- {
- // unprocessed tag -> parse it to get result
- $this->TagCache[ trim($tag) ] = $this->ProcessTag($tag);
- }
-
- $tagResult = $this->TagCache[ trim($tag) ]; // return result from cache
- $this->CurrentSQL = str_replace('<%'.$tag.'%>', $tagResult, $this->CurrentSQL);
- }
-
+
+ // 2. replace config variable to it's value
+ while( ($tag = $this->FindTag()) != false )
+ {
+ if( !array_key_exists( trim($tag), $this->TagCache ) )
+ {
+ // unprocessed tag -> parse it to get result
+ $this->TagCache[ trim($tag) ] = $this->ProcessTag($tag);
+ }
+
+ $tagResult = $this->TagCache[ trim($tag) ]; // return result from cache
+ $this->CurrentSQL = str_replace('<%'.$tag.'%>', $tagResult, $this->CurrentSQL);
+ }
+
$values = array();
$rs = $this->adodbConnection->Execute($this->CurrentSQL);
- if($rs && !$rs->EOF)
+ if($rs && !$rs->EOF)
{
$value = $rs->fields[0];
if($this->PostFormatting)
@@ -85,7 +85,7 @@
case 'number': // simple-specific postformatting
$value = LangNumber($value, $this->PostFormattingParams['precision']);
break;
-
+
// extended postformatting
case 'COUNT':
$value = $rs->RecordCount();
@@ -96,7 +96,7 @@
while(!$rs->EOF)
{
$field_sum += $rs->fields[ $this->PostFormattingParams['field'] ];
- $rs->MoveNext();
+ $rs->MoveNext();
}
$value = $field_sum;
if($this->PostFormattingParams['format_as'] == 'file') $value = size($value);
@@ -105,7 +105,7 @@
case 'SysFileSize':
$value = size( dir_size($GLOBALS['pathtoroot']) );
break;
-
+
default: // simple-default postformatting
$value = adodb_date($this->PostFormatting, $value);
break;
@@ -115,7 +115,7 @@
}
$this->Set("Value", $value);
}
- $ADODB_FETCH_MODE = 2;
+ $ADODB_FETCH_MODE = 2;
$this->GotValue=TRUE;
}
@@ -132,7 +132,7 @@
}
return false;
}
-
+
function ProcessTag($tag)
{
$db =& $this->adodbConnection;
@@ -151,90 +151,90 @@
$sql = 'SELECT VariableValue FROM '.GetTablePrefix()."ConfigurationValues WHERE VariableName = '%s'";
return $db->GetOne( sprintf($sql, $tag_params['name']) );
break;
-
+
case 'm:post_format':
switch($tag_params['type'])
{
case 'date': $this->PostFormatting = GetDateFormat(); break;
case 'time': $this->PostFormatting = GetTimeFormat(); break;
- case 'currency':
+ case 'currency':
$this->PostFormatting = 'number';
$this->PostFormattingParams['precision'] = $tag_params['precision'];
break;
}
return $tag_params['field'];
break;
-
+
case 'm:custom_action':
$this->PostFormatting = $tag_params['action'];
return ($tag_params['sql'] == 'empty') ? 'SELECT 1' : $tag_params['sql'];
break;
-
+
//m:sql_action sql="SHOW TABLES" action="COUNT" field="*"
case 'm:sql_action':
$this->PostFormatting = $tag_params['action'];
$this->PostFormattingParams = $tag_params;
return $tag_params['sql'];
break;
-
+
case 'link:hit_count':
$type = $tag_params['type'];
$sql = 'SELECT Hits FROM '.GetTablePrefix().'Link ';
if($type == 'top') // by now only top is supported
- {
- $top_links_count = $this->ProcessTag('m:config name="Link_TopCount"'); // 5 - default
+ {
+ $top_links_count = $this->ProcessTag('m:config name="Link_MinPopRating"'); // 5 - default
$sql .= 'ORDER BY Hits DESC LIMIT 0,'.$top_links_count;
-
+
$rs = $db->Execute($sql);
if($rs->RecordCount() > 0)
{
$rs->MoveLast();
- return $rs->fields['Hits'];
+ return $rs->fields['Hits'];
}
else
return 0;
}
break;
-
+
case 'article:hit_count':
$type = $tag_params['type'];
$sql = 'SELECT CachedRating FROM '.GetTablePrefix().'News ';
if($type == 'top') // by now only top is supported
- {
- $top_articles_count = $this->ProcessTag('m:config name="News_VotesToHot"');
- $min_votes = $this->ProcessTag('m:config name="News_MinVotes"');
+ {
+ $top_articles_count = $this->ProcessTag('m:config name="News_MaxHotNumber"');
+ $min_votes = $this->ProcessTag('m:config name="News_MinPopVotes"');
$sql .= 'WHERE CachedVotesQty > '.$min_votes.' ORDER BY CachedRating DESC LIMIT 0,'.$top_articles_count;
-
+
$rs = $db->Execute($sql);
if($rs->RecordCount() > 0)
{
$rs->MoveLast();
- return $rs->fields['CachedRating'];
+ return $rs->fields['CachedRating'];
}
else
return 0;
}
- break;
-
+ break;
+
case 'topic:hit_count':
$type = $tag_params['type'];
$sql = 'SELECT Views FROM '.GetTablePrefix().'Topic ';
if($type == 'top') // by now only top is supported
- {
- $top_posts_count = $this->ProcessTag('m:config name="Topic_PostsToPop"');
+ {
+ $top_posts_count = $this->ProcessTag('m:config name="Topic_MinPopRating"');
$sql .= ' ORDER BY Views DESC LIMIT 0,'.$top_posts_count;
-
+
$rs = $db->Execute($sql);
if($rs->RecordCount() > 0)
{
$rs->MoveLast();
- return $rs->fields['Views'];
+ return $rs->fields['Views'];
}
else
return 0;
}
break;
-
+
case 'modules:get_current':
return $this->Get('Module');
break;
@@ -253,11 +253,11 @@
{
return $this->parsetag($element->name);
}
-
+
function parsetag($tag)
{
if(is_object($tag))
- {
+ {
$tagname = $tag->name;
}
else
@@ -300,7 +300,7 @@
{
// fills list with data
$this->LoadStatItems($where,$orderBy, $use_limit );
-
+
for($i=0; $i < $this->NumItems(); $i++)
{
$s =& $this->GetItemRefByIndex($i);
@@ -314,14 +314,14 @@
for($i=0;$i<$this->NumItems();$i++)
{
$s =& $this->GetItemRefByIndex($i);
- $s->ExecuteValueSQL();
+ $s->ExecuteValueSQL();
}
if($this->debuglevel) echo "LastSQL: ".$s->CurrentSQL.' ';
}
function ExecuteResetSQL()
{
- foreach($this->Items as $s) $s->ExecuteResetSQL();
+ foreach($this->Items as $s) $s->ExecuteResetSQL();
}
function LoadStatItems($where=NULL,$orderBy, $use_limit = false)
@@ -333,10 +333,10 @@
$sql .= " WHERE ".$where;
if(strlen(trim($orderBy)))
$sql .= " ORDER BY ".$orderBy;
-
+
if($use_limit)
$sql .= " ".GetLimitSQL($this->Page,$objConfig->Get($this->PerPageVar));
-
+
if($this->debuglevel) echo "StatGetSQL: $sql ";
$this->Query_Item($sql);
}
Index: trunk/core/units/languages/import_xml.php
===================================================================
diff -u -r5431 -r6583
--- trunk/core/units/languages/import_xml.php (.../import_xml.php) (revision 5431)
+++ trunk/core/units/languages/import_xml.php (.../import_xml.php) (revision 6583)
@@ -157,6 +157,9 @@
$path = implode(' ',$this->path);
//check what path we are in
+ $this->LastLine = xml_get_current_line_number($parser);
+ $this->SecondData = false;
+
switch($path)
{
case 'LANGUAGES LANGUAGE':
@@ -255,7 +258,14 @@
break;
case 'LANGUAGES LANGUAGE EVENTS EVENT':
+ $cur_line = xml_get_current_line_number($parser);
+ if ($cur_line != $this->LastLine) {
+ $this->current_event['Template'] .= str_repeat("\r\n", ($cur_line - $this->LastLine) );
+ $this->LastLine = $cur_line;
+ }
$this->current_event['Template'] .= $line;
+
+ $this->SecondData = true;
break;
}
}
@@ -282,6 +292,7 @@
case 'LANGUAGES LANGUAGE EVENTS EVENT':
if ($this->current_language['Encoding'] == 'plain') {
+ $this->current_event['Template'] = rtrim($this->current_event['Template']);
// nothing to decode!
}
else {
Index: trunk/kernel/units/phrases/phrases_event_handler.php
===================================================================
diff -u -r6093 -r6583
--- trunk/kernel/units/phrases/phrases_event_handler.php (.../phrases_event_handler.php) (revision 6093)
+++ trunk/kernel/units/phrases/phrases_event_handler.php (.../phrases_event_handler.php) (revision 6583)
@@ -3,14 +3,20 @@
class PhrasesEventHandler extends InpDBEventHandler
{
+ /**
+ * Allow to create phrases from front end in debug mode with DBG_PHRASES constant set
+ *
+ * @param kEvent $event
+ */
function CheckPermission(&$event)
{
- if (!$this->Application->IsAdmin() && $event->Name == 'OnCreate' && $this->Application->isDebugMode() && constOn('DBG_PHRASES')) {
- if ($event->Name == 'OnCreate') {
- // allow create phrases from front end in debug mode with DBG_PHRASES
+ if (!$this->Application->IsAdmin() && $this->Application->isDebugMode() && constOn('DBG_PHRASES')) {
+ if ($event->Name == 'OnNew' || $event->Name == 'OnCreate') {
return true;
}
}
+
+ return parent::CheckPermission($event);
}
/**
Index: trunk/kernel/units/categories/categories_config.php
===================================================================
diff -u -r6093 -r6583
--- trunk/kernel/units/categories/categories_config.php (.../categories_config.php) (revision 6093)
+++ trunk/kernel/units/categories/categories_config.php (.../categories_config.php) (revision 6583)
@@ -41,8 +41,8 @@
'pending' => Array(
'icon' => 'icon16_cat_pending.gif',
'label' => 'la_tab_Categories',
- 'js_url' => "set_persistant_var('Category_View', 41, 'advanced_view', '#url#')",
- 'url' => Array('t' => 'advanced_view', 'index_file' => 'advanced_view.php', 'SetTab' => 'category', 'pass' => 'm'),
+ 'js_url' => '#url#',
+ 'url' => Array('t' => 'advanced_view', 'SetTab' => 'c', 'pass' => 'm,c.showall', 'c.showall_event' => 'OnSetFilterPattern', 'c.showall_filters' => 'show_active=0,show_pending=1,show_disabled=0,show_new=1,show_pick=1'),
'status' => STATUS_PENDING,
),
),
Index: trunk/kernel/units/general/helpers/filenames_helper.php
===================================================================
diff -u -r5509 -r6583
--- trunk/kernel/units/general/helpers/filenames_helper.php (.../filenames_helper.php) (revision 5509)
+++ trunk/kernel/units/general/helpers/filenames_helper.php (.../filenames_helper.php) (revision 6583)
@@ -11,7 +11,7 @@
{
$not_allowed = Array( ' ', '\\', '/', ':', '*', '?', '"', '<', '>', '|', '`',
'~', '!', '@', '#', '$', '%', '^', '&', '(', ')', '~',
- '+', '=', '-', '{', '}', ']', '[', "'", ';', '.', ',');
+ '+', '=', '-', '{', '}', ']', '[', "'", ';', '.', ',', "\r", "\n");
$filename = str_replace($not_allowed, '_', $filename);
$filename = preg_replace('/(_+)/', '_', $filename);
Index: trunk/core/units/custom_fields/custom_fields_tag_processor.php
===================================================================
diff -u -r6093 -r6583
--- trunk/core/units/custom_fields/custom_fields_tag_processor.php (.../custom_fields_tag_processor.php) (revision 6093)
+++ trunk/core/units/custom_fields/custom_fields_tag_processor.php (.../custom_fields_tag_processor.php) (revision 6583)
@@ -36,13 +36,6 @@
return $this->Application->ProcessParsedTag($source_prefix, 'InputName', $params);
}
- function CustomError($params)
- {
- $params['name'] = $this->GetMainField($params);
- $source_prefix = $this->Application->Parser->GetParam('SourcePrefix');
- return $this->Application->ProcessParsedTag($source_prefix, 'Error', $params);
- }
-
function setParamValue(&$params, $param_name)
{
// $deep_level if GetParam = 1 used in case if PrintList is called during parsing "grid" block (=> +1 to deep_level)
@@ -103,7 +96,7 @@
if ($display_original) {
$list->SetDBField('OriginalValue', $original_object->GetField('cust_'.$list->GetDBField('FieldName')));
}
- $block_params['field'] = 'cust_'.$list->GetDBField('FieldName');
+ $block_params['field'] = $block_params['virtual_field'] = 'cust_'.$list->GetDBField('FieldName');
$block_params['show_heading'] = ($prev_heading != $list->GetDBField('Heading') ) ? 1 : 0;
}
Index: trunk/core/kernel/parser/template.php
===================================================================
diff -u -r6093 -r6583
--- trunk/core/kernel/parser/template.php (.../template.php) (revision 6093)
+++ trunk/core/kernel/parser/template.php (.../template.php) (revision 6583)
@@ -87,8 +87,18 @@
$conn =& $this->Application->GetADODBConnection();
}
- function LoadTemplate($filename, $title=NULL, $silent=0)
+ /**
+ * Based on template name gets it's location on disk and owner module
+ *
+ * @param string $filename
+ * @return Array 0 - path on disk, 1 - template name
+ */
+ function GetTemplatePaths($filename)
{
+ if (isset($this->Application->ReplacementTemplates[$filename])) {
+ $filename = $this->Application->ReplacementTemplates[$filename];
+ }
+
if (preg_match('#^[\/]{0,1}([^\/]*)\/(.*)#', $filename, $regs)) {
$module_filename = $regs[2];
$first_dir = $regs[1];
@@ -106,28 +116,21 @@
$module_filename = $first_dir.'/'.$module_filename;
}
+ return Array ($path, $module_filename);
+ }
+
+ function LoadTemplate($filename, $title=NULL, $silent=0)
+ {
+ list ($path, $module_filename) = $this->GetTemplatePaths($filename);
+
$template =& new Template($path, $module_filename, $silent);
if (!isset($title)) $title = $filename;
$this->SetTemplate($title, $template);
}
- function GetRealFilename($filename, $base=null) {
- if (preg_match('#^[\/]{0,1}([^\/]*)\/(.*)#', $filename, $regs)) {
- $module_filename = $regs[2];
- $first_dir = $regs[1];
- }
- else {
- $first_dir = '';
- $module_filename = $filename;
- }
-
- if ( $this->Application->IsAdmin() && $this->Application->findModule('Name', $first_dir)) {
- $path = MODULES_PATH.'/'.strtolower($first_dir).'/admin_templates';
- }
- else {
- $path = isset($base) ? $base : $this->BasePath;
- $module_filename = $first_dir.'/'.$module_filename;
- }
+ function GetRealFilename($filename)
+ {
+ list ($path, $module_filename) = $this->GetTemplatePaths($filename);
return $path.'/'.trim($module_filename, '/');
}
@@ -175,8 +178,10 @@
function TemplateExists($filename)
{
- if (!preg_match("/\.tpl$/", $filename)) $filename .= '.tpl';
$real_file = $this->GetRealFilename($filename);
+ if (!preg_match('/\.tpl$/', $real_file)) {
+ $real_file .= '.tpl';
+ }
return file_exists($real_file);
}
Index: trunk/admin/install/upgrades/changelog_1_3_1.txt
===================================================================
diff -u
--- trunk/admin/install/upgrades/changelog_1_3_1.txt (revision 0)
+++ trunk/admin/install/upgrades/changelog_1_3_1.txt (revision 6583)
@@ -0,0 +1,50 @@
+File in-portal/admin/install/inportal_data.sql changed
+File in-portal/admin/install/inportal_schema.sql changed
+File in-portal/admin/install/langpacks/english.lang changed
+File in-portal/admin/install/upgrades/changelog_1_3_1.txt is new; release_1_3_1 revision 1.1.2.1
+File in-portal/admin/install/upgrades/inportal_upgrade_v1.3.1.sql is new; release_1_3_1 revision 1.1.2.1
+File in-portal/kernel/admin_templates/advanced_view.tpl changed
+File in-portal/kernel/admin_templates/catalog.tpl changed
+File in-portal/kernel/admin_templates/catalog_tab.tpl changed
+File in-portal/kernel/admin_templates/incs/catalog.js changed
+File in-portal/kernel/admin_templates/incs/custom_blocks.tpl changed
+File in-portal/kernel/admin_templates/incs/grid_blocks.tpl changed
+File in-portal/kernel/admin_templates/summary/root.tpl changed
+File in-portal/kernel/admin_templates/xml/categories_list.tpl changed
+File in-portal/kernel/include/category.php changed
+File in-portal/kernel/include/statitem.php changed
+File in-portal/kernel/units/admin/admin_tag_processor.php changed
+File in-portal/kernel/units/categories/categories_config.php changed
+File in-portal/kernel/units/custom_fields/custom_fields_config.php changed
+File in-portal/kernel/units/custom_fields/custom_fields_tag_processor.php changed
+File in-portal/kernel/units/email_events/email_events_config.php changed
+File in-portal/kernel/units/email_messages/email_messages_event_handler.php changed
+File in-portal/kernel/units/general/cat_dbitem.php changed
+File in-portal/kernel/units/general/cat_event_handler.php changed
+File in-portal/kernel/units/general/general_config.php changed
+File in-portal/kernel/units/general/my_application.php changed
+File in-portal/kernel/units/languages/import_xml.php changed
+File in-portal/kernel/units/languages/languages_config.php changed
+File in-portal/kernel/units/languages/languages_item.php changed
+File in-portal/kernel/units/phrases/phrases_event_handler.php changed
+File in-portal/kernel/units/relationship/relationship_event_handler.php changed
+File in-portal/kernel/units/users/users_event_handler.php changed
+File kernel4_dev/kernel4/application.php changed
+File kernel4_dev/kernel4/db/db_event_handler.php changed
+File kernel4_dev/kernel4/db/dbitem.php changed
+File kernel4_dev/kernel4/parser/template.php changed
+File kernel4_dev/kernel4/utility/params.php changed
+File kernel4_dev/kernel4/utility/unit_config_reader.php changed
+File kernel4_dev/kernel4/utility/formatters/formatter.php changed
+File kernel4_dev/kernel4/utility/formatters/upload_formatter.php changed
+File cmseditor/editor/dialog/fck_link.html changed
+File cmseditor/editor/dialog/fckblank.html is new; release_1_3_1 revision 1.1
+File cmseditor/editor/filemanager/browser/default/browser.html changed
+File cmseditor/editor/filemanager/browser/default/fckblank.html is new; release_1_3_1 revision 1.1
+File cmseditor/editor/filemanager/browser/default/connectors/php/commands.php changed
+File cmseditor/editor/images/dot.gif is new; release_1_3_1 revision 1.1
+
+
+Changes in phrases and events:
+
+
Index: trunk/kernel/units/general/cat_dbitem_export.php
===================================================================
diff -u -r6093 -r6583
--- trunk/kernel/units/general/cat_dbitem_export.php (.../cat_dbitem_export.php) (revision 6093)
+++ trunk/kernel/units/general/cat_dbitem_export.php (.../cat_dbitem_export.php) (revision 6583)
@@ -364,34 +364,86 @@
function getCustomSQL()
{
$ml_formatter =& $this->Application->recallObject('kMultiLanguage');
-
+
$custom_sql = '';
foreach ($this->customFields as $custom_id => $custom_name) {
$custom_sql .= 'custom_data.'.$ml_formatter->LangFieldName('cust_'.$custom_id).' AS cust_'.$custom_name.', ';
}
-
+
return preg_replace('/(.*), /', '\\1', $custom_sql);
}
-
+
+ function getPlainExportSQL($count_only = false) {
+ if ($count_only && isset($this->exportOptions['ForceCountSQL'])) return $this->exportOptions['ForceCountSQL'];
+ if (!$count_only && isset($this->exportOptions['ForceSelectSQL'])) return $this->exportOptions['ForceSelectSQL'];
+
+ $items_list =& $this->Application->recallObject($this->curItem->Prefix.'.export-items-list', $this->curItem->Prefix.'_List');
+ $items_list->SetPerPage(-1);
+ return $items_list->GetSelectSQL($count_only);
+
+
+ if ($this->exportOptions['export_ids'] === false)
+ {
+ // get links from current category & all it's subcategories
+ $join_clauses = Array();
+
+ $custom_sql = $this->getCustomSQL();
+ if ($custom_sql) {
+ $custom_table = $this->Application->getUnitOption($this->curItem->Prefix.'-cdata', 'TableName');
+ $join_clauses[$custom_table.' custom_data'] = 'custom_data.ResourceId = item_table.ResourceId';
+ }
+
+ $sql = 'SELECT item_table.*'.($custom_sql ? ', '.$custom_sql : '').'
+ FROM '.$this->curItem->TableName.' item_table';
+
+ foreach ($join_clauses as $table_name => $join_expression) {
+ $sql .= ' LEFT JOIN '.$table_name.' ON '.$join_expression;
+ }
+ $sql .= ' WHERE 1';
+
+ $sql .= ' ORDER BY item_table.'.$this->curItem->IDField.' ASC'; // NEW
+ }
+ else {
+ // get only selected links
+ $sql = 'SELECT item_table.*
+ FROM '.$this->curItem->TableName.' item_table
+ WHERE '.$this->curItem->IDField.' IN ('.implode(',', $this->exportOptions['export_ids']).')';
+ }
+
+ if (!$count_only)
+ {
+ $sql .= ' LIMIT '.$this->exportOptions['start_from'].','.EXPORT_STEP;
+ }
+ else {
+ $sql = preg_replace("/^.*SELECT(.*?)FROM(?!_)/is", "SELECT COUNT(*) AS count FROM ", $sql);
+ }
+
+ return $sql;
+ }
+
function getExportSQL($count_only = false)
{
+ if (!$this->Application->getUnitOption($this->curItem->Prefix, 'CatalogItem')) {
+ return $this->GetPlainExportSQL($count_only); // in case this is not a CategoryItem
+ }
+
if ($this->exportOptions['export_ids'] === false)
{
// get links from current category & all it's subcategories
$join_clauses = Array();
-
+
$custom_sql = $this->getCustomSQL();
if ($custom_sql) {
$custom_table = $this->Application->getUnitOption($this->curItem->Prefix.'-cdata', 'TableName');
$join_clauses[$custom_table.' custom_data'] = 'custom_data.ResourceId = item_table.ResourceId';
}
-
+
$join_clauses[TABLE_PREFIX.'CategoryItems ci'] = 'ci.ItemResourceId = item_table.ResourceId';
$join_clauses[TABLE_PREFIX.'Category c'] = 'c.CategoryId = ci.CategoryId';
-
+
$sql = 'SELECT item_table.*, ci.CategoryId'.($custom_sql ? ', '.$custom_sql : '').'
FROM '.$this->curItem->TableName.' item_table';
-
+
foreach ($join_clauses as $table_name => $join_expression) {
$sql .= ' LEFT JOIN '.$table_name.' ON '.$join_expression;
}
@@ -475,7 +527,7 @@
$this->curItem->SetDBFieldsFromHash($record_info);
$this->setCurrentID();
$this->curItem->raiseEvent('OnAfterItemLoad', $this->curItem->GetID() );
-
+
$data_array = Array();
foreach ($this->exportFields as $export_field)
{
@@ -650,7 +702,7 @@
}
$this->curItem->Clear();
$this->customFields = $this->Application->getUnitOption($event->Prefix, 'CustomFields');
-
+
if (isset($record_data)) {
$this->setImportData($record_data);
}
@@ -679,7 +731,7 @@
if (is_null($lang_prefix)) {
$lang_prefix = 'l'.$this->Application->GetVar('m_lang').'_';
}
-
+
foreach ($this->curItem->CategoryPath as $category_index => $category_name) {
if (!$category_name) continue;
$category_key = crc32( implode(':', array_slice($this->curItem->CategoryPath, 0, $category_index + 1) ) );
@@ -766,7 +818,7 @@
else {
$where_clause .= '(item_table.`'.$field_name.'` = '.$this->Conn->qstr($field_value).') AND ';
}
-
+
}
$where_clause = preg_replace('/(.*) AND $/', '\\1', $where_clause);
@@ -777,7 +829,7 @@
$parent_path = $this->getParentPath($category_id);
$where_clause = '(c.ParentPath LIKE "'.$parent_path.'%") AND '.$where_clause;
}
-
+
$cdata_table = $this->Application->getUnitOption($event->Prefix.'-cdata', 'TableName');
$sql = 'SELECT '.$this->curItem->IDField.'
FROM '.$this->curItem->TableName.' item_table
@@ -828,11 +880,11 @@
/*function saveLog($msg)
{
static $first_time = true;
-
+
$fp = fopen(FULL_PATH.'/sqls.log', $first_time ? 'w' : 'a');
fwrite($fp, $msg."\n");
fclose($fp);
-
+
$first_time = false;
}*/
@@ -1069,6 +1121,277 @@
{
return unserialize($this->Application->RecallVar($event->getPrefixSpecial().'_options'));
}
+
+ /**
+ * Sets correct available & export fields
+ *
+ * @param kEvent $event
+ */
+ function prepareExportColumns(&$event)
+ {
+ $object =& $event->getObject( Array('skip_autoload' => true) );
+
+ $available_columns = Array();
+
+ if ($this->Application->getUnitOption($event->Prefix, 'CatalogItem')) {
+ // category field (mixed)
+ $available_columns['__CATEGORY__CategoryPath'] = 'CategoryPath';
+
+ if ($event->Special == 'import') {
+ // category field (separated fields)
+ $max_level = $this->Application->ConfigValue('MaxImportCategoryLevels');
+ $i = 0;
+ while ($i < $max_level) {
+ $available_columns['__CATEGORY__Category'.($i + 1)] = 'Category'.($i + 1);
+ $i++;
+ }
+ }
+ }
+
+ // db fields
+ foreach ($object->Fields as $field_name => $field_options)
+ {
+ if (!$object->SkipField($field_name))
+ {
+ $available_columns[$field_name] = $field_name.(getArrayValue($field_options, 'required') ? '*' : '');
+ }
+ }
+
+ $handler =& $this->Application->recallObject($event->Prefix.'_EventHandler');
+ $available_columns = array_merge_recursive2($available_columns, $handler->getCustomExportColumns($event));
+
+ // custom fields
+ foreach ($object->customFields as $custom_id => $custom_name)
+ {
+ $available_columns['__CUSTOM__'.$custom_name] = $custom_name;
+ }
+
+ // columns already in use
+ $items_info = $this->Application->GetVar( $event->getPrefixSpecial(true) );
+ if ($items_info)
+ {
+ list($item_id, $field_values) = each($items_info);
+ $export_keys = $field_values['ExportColumns'];
+ $export_keys = $export_keys ? explode('|', substr($export_keys, 1, -1) ) : Array();
+ }
+ else {
+ $export_keys = Array();
+ }
+
+ $export_columns = Array();
+ foreach ($export_keys as $field_key)
+ {
+ $field_name = $this->getExportField($field_key);
+ $export_columns[$field_key] = $field_name;
+ unset($available_columns[$field_key]);
+ }
+
+ $options = $object->GetFieldOptions('ExportColumns');
+ $options['options'] = $export_columns;
+ $object->SetFieldOptions('ExportColumns', $options);
+
+ $options = $object->GetFieldOptions('AvailableColumns');
+ $options['options'] = $available_columns;
+ $object->SetFieldOptions('AvailableColumns', $options);
+
+ $this->updateImportFiles($event);
+ $this->PrepareExportPresets($event);
+ }
+
+ function PrepareExportPresets(&$event)
+ {
+ $object =& $event->getObject( Array('skip_autoload' => true) );
+ $options = $object->GetFieldOptions('ExportPresets');
+
+ $user =& $this->Application->recallObject('u');
+ $export_settings = $user->getPersistantVar('export_settings');
+ if (!$export_settings) return ;
+ $export_settings = unserialize($export_settings);
+
+ if (!isset($export_settings[$event->Prefix])) return ;
+
+
+ $export_presets = array(''=>'');
+ foreach ($export_settings[$event->Prefix] as $key => $val) {
+ $export_presets[implode('|', $val['ExportColumns'])] = $key;
+ }
+
+ $options['options'] = $export_presets;
+ $object->SetFieldOptions('ExportPresets', $options);
+ }
+
+ function getExportField($field_key)
+ {
+ $prepends = Array('__CUSTOM__', '__CATEGORY__');
+ foreach ($prepends as $prepend)
+ {
+ if (substr($field_key, 0, strlen($prepend) ) == $prepend)
+ {
+ $field_key = substr($field_key, strlen($prepend), strlen($field_key) );
+ break;
+ }
+ }
+ return $field_key;
+ }
+
+ /**
+ * Updates uploaded files list
+ *
+ * @param kEvent $event
+ */
+ function updateImportFiles(&$event)
+ {
+ if ($event->Special != 'import') {
+ return false;
+ }
+
+ $object =& $event->getObject();
+
+ $import_filenames = Array();
+
+ if ($folder_handle = opendir(EXPORT_PATH)) {
+ while (false !== ($file = readdir($folder_handle))) {
+ if (is_dir(EXPORT_PATH.'/'.$file) || substr($file, 0, 1) == '.' || strtolower($file) == 'cvs' || strtolower($file) == 'dummy' || filesize(EXPORT_PATH.'/'.$file) == 0) continue;
+
+ $file_size = formatSize( filesize(EXPORT_PATH.'/'.$file) );
+ $import_filenames[$file] = $file.' ('.$file_size.')';
+ }
+ closedir($folder_handle);
+ }
+
+ $options = $object->GetFieldOptions('ImportLocalFilename');
+ $options['options'] = $import_filenames;
+ $object->SetFieldOptions('ImportLocalFilename', $options);
+ }
+
+ /**
+ * Returns module folder
+ *
+ * @param kEvent $event
+ * @return string
+ */
+ function getModuleFolder(&$event)
+ {
+ return $this->Application->getUnitOption($event->Prefix, 'ModuleFolder');
+ }
+
+ /**
+ * Export form validation & processing
+ *
+ * @param kEvent $event
+ */
+ function OnExportBegin(&$event)
+ {
+ $items_info = $this->Application->GetVar( $event->getPrefixSpecial(true) );
+ if (!$items_info)
+ {
+ $items_info = unserialize( $this->Application->RecallVar($event->getPrefixSpecial().'_ItemsInfo') );
+ $this->Application->SetVar($event->getPrefixSpecial(true), $items_info);
+ }
+
+ list($item_id, $field_values) = each($items_info);
+
+ $object =& $event->getObject( Array('skip_autoload' => true) );
+ $object->SetFieldsFromHash($field_values);
+ $field_values['ImportFilename'] = $object->GetDBField('ImportFilename'); //if upload formatter has renamed the file during moving !!!
+
+ $object->setID($item_id);
+ $this->setRequiredFields($event);
+
+ $export_object =& $this->Application->recallObject('CatItemExportHelper');
+
+ // save export/import options
+ if ($event->Special == 'export')
+ {
+ $export_ids = $this->Application->RecallVar($event->Prefix.'_export_ids');
+ $export_cats_ids = $this->Application->RecallVar($event->Prefix.'_export_cats_ids');
+
+ // used for multistep export
+ $field_values['export_ids'] = $export_ids ? explode(',', $export_ids) : false;
+ $field_values['export_cats_ids'] = $export_cats_ids ? explode(',', $export_cats_ids) : Array( $this->Application->GetVar('m_cat_id') );
+ }
+
+ $field_values['ExportColumns'] = $field_values['ExportColumns'] ? explode('|', substr($field_values['ExportColumns'], 1, -1) ) : Array();
+ $field_values['start_from'] = 0;
+
+ $this->Application->HandleEvent($nevent, $event->Prefix.':OnBeforeExportBegin', array('options'=>$field_values));
+ $field_values = $nevent->getEventParam('options');
+
+ $export_object->saveOptions($event, $field_values);
+
+ if( $export_object->verifyOptions($event) )
+ {
+ if ($object->GetDBField('ExportSavePreset')) {
+ $name = $object->GetDBField('ExportPresetName');
+ $user =& $this->Application->recallObject('u');
+ $export_settings = $user->getPersistantVar('export_settings');
+ $export_settings = $export_settings ? unserialize($export_settings) : array();
+ $export_settings[$event->Prefix][$name] = $field_values;
+ $user->setPersistantVar('export_settings', serialize($export_settings));
+ }
+
+ $progress_t = $this->Application->RecallVar('export_progress_t');
+ if ($progress_t) {
+ $this->Application->RemoveVar('export_progress_t');
+ }
+ else {
+ $progress_t = $export_object->getModuleFolder($event).'/'.$event->Special.'_progress';
+ }
+ $event->redirect = $progress_t;
+ }
+ else
+ {
+ // make uploaded file local & change source selection
+ $filename = getArrayValue($field_values, 'ImportFilename');
+ if ($filename) {
+ $export_object->updateImportFiles($event);
+ $object->SetDBField('ImportSource', 2);
+ $field_values['ImportSource'] = 2;
+ $object->SetDBField('ImportLocalFilename', $filename);
+ $field_values['ImportLocalFilename'] = $filename;
+ $export_object->saveOptions($event, $field_values);
+ }
+
+ $event->status = erFAIL;
+ $event->redirect = false;
+ }
+ }
+
+ /**
+ * set required fields based on import or export params
+ *
+ * @param kEvent $event
+ */
+ function setRequiredFields(&$event)
+ {
+ $required_fields['common'] = Array('FieldsSeparatedBy', 'LineEndings', 'CategoryFormat');
+
+ $required_fields['export'] = Array('ExportFormat', 'ExportFilename','ExportColumns');
+
+ $object =& $event->getObject();
+ if ($object->GetDBField('ExportSavePreset')) {
+ $required_fields['export'][] = 'ExportPresetName';
+ }
+
+ $required_fields['import'] = Array('FieldTitles', 'ImportSource', 'CheckDuplicatesMethod'); // ImportFilename, ImportLocalFilename
+
+ if ($event->Special == 'import')
+ {
+ $import_source = Array(1 => 'ImportFilename', 2 => 'ImportLocalFilename');
+ $used_field = $import_source[ $object->GetDBField('ImportSource') ];
+
+ $required_fields[$event->Special][] = $used_field;
+ $object->Fields[$used_field]['error_field'] = 'ImportSource';
+
+ if ($object->GetDBField('FieldTitles') == 2) $required_fields[$event->Special][] = 'ExportColumns'; // manual field titles
+ }
+
+ $required_fields = array_merge($required_fields['common'], $required_fields[$event->Special]);
+ foreach ($required_fields as $required_field) {
+ $object->setRequired($required_field, true);
+ }
+ }
+
}
?>
Index: trunk/core/kernel/processors/tag_processor.php
===================================================================
diff -u -r6093 -r6583
--- trunk/core/kernel/processors/tag_processor.php (.../tag_processor.php) (revision 6093)
+++ trunk/core/kernel/processors/tag_processor.php (.../tag_processor.php) (revision 6583)
@@ -49,27 +49,39 @@
$this->Application->Debugger->appendHTML('Processing PreParsed Tag '.$Method.' in '.$this->Prefix);
}
+ $backup_prefix = $this->Prefix;
+ $backup_special = $this->Special;
+
+ // process all possible flags: begin
+ $flags = Array('js_escape', 'result_to_var', 'pass_params');
+ $flag_values = Array();
+
+ foreach ($flags as $flag_name) {
+ $flag_values[$flag_name] = false;
+ if (isset($params[$flag_name])) {
+ $flag_values[$flag_name] = $params[$flag_name];
+ unset($params[$flag_name]);
+ }
+ }
+ // process all possible flags: end
+
// pass_params for non ParseBlock tags :)
- if (isset($params['pass_params']) && $params['pass_params']) {
+ if ($flag_values['pass_params']) {
$params = array_merge_recursive2($this->Application->Parser->Params, $params);
- unset($params['pass_params']);
}
- $backup_prefix = $this->Prefix;
- $backup_special = $this->Special;
-
$ret = $this->$Method($params);
$this->Prefix = $backup_prefix;
$this->Special = $backup_special;
- if (isset($params['js_escape']) && $params['js_escape']) {
+ if ($flag_values['js_escape']) {
$ret = str_replace('\'', ''', $ret);
$ret = addslashes($ret);
$ret = str_replace(Array("\r", "\n"), Array('\r', '\n'), $ret);
}
- if (isset($params['result_to_var'])) {
- $this->Application->Parser->SetParam($params['result_to_var'], $ret);
+ if ($flag_values['result_to_var']) {
+ $this->Application->Parser->SetParam($flag_values['result_to_var'], $ret);
$ret = '';
}
return $ret;
Index: trunk/kernel/units/languages/languages_config.php
===================================================================
diff -u -r5110 -r6583
--- trunk/kernel/units/languages/languages_config.php (.../languages_config.php) (revision 5110)
+++ trunk/kernel/units/languages/languages_config.php (.../languages_config.php) (revision 6583)
@@ -140,7 +140,7 @@
'DateFormat' => Array('type' => 'string','not_null' => '1','default' => '','required'=>1),
'TimeFormat' => Array('type' => 'string','not_null' => '1','default' => '','required'=>1),
'InputDateFormat' => Array('type' => 'string', 'formatter' => 'kOptionsFormatter', 'options' => Array('m/d/Y' => 'm/d/Y'), 'not_null' => '1','default' => 'm/d/Y', 'required' => 1),
- 'InputTimeFormat' => Array('type' => 'string', 'formatter' => 'kOptionsFormatter', 'options' => Array('g:i:s A' => 'g:i:s A'), 'not_null' => '1','default' => 'g:i:s A', 'required' => 1),
+ 'InputTimeFormat' => Array('type' => 'string', 'formatter' => 'kOptionsFormatter', 'options' => Array('g:i:s A' => 'g:i:s A'), 'not_null' => '1','default' => 'g:i:s A', 'required' => 1),
'DecimalPoint' => Array('type' => 'string','not_null' => '1','default' => ''),
'ThousandSep' => Array('type' => 'string','not_null' => '1','default' => ''),
'Charset' => Array('type' => 'string','not_null' => '1','default' => '','required'=>1),
Index: trunk/kernel/units/general/cat_event_handler.php
===================================================================
diff -u -r6428 -r6583
--- trunk/kernel/units/general/cat_event_handler.php (.../cat_event_handler.php) (revision 6428)
+++ trunk/kernel/units/general/cat_event_handler.php (.../cat_event_handler.php) (revision 6583)
@@ -129,6 +129,7 @@
if ($clipboard_data['copy']) {
$temp =& $this->Application->recallObject($event->getPrefixSpecial().'_TempHandler', 'kTempTablesHandler');
+ $this->Application->SetVar('ResetCatBeforeClone', 1);
$temp->CloneItems($event->Prefix, $event->Special, $clipboard_data['copy']);
}
@@ -460,7 +461,8 @@
if ($event->Special == 'export' || $event->Special == 'import')
{
- $this->prepareExportColumns($event);
+ $export_helper =& $this->Application->recallObject('CatItemExportHelper');
+ $export_helper->prepareExportColumns($event);
}
}
@@ -1329,17 +1331,6 @@
/* === RELATED TO IMPORT/EXPORT: BEGIN === */
/**
- * Returns module folder
- *
- * @param kEvent $event
- * @return string
- */
- function getModuleFolder(&$event)
- {
- return $this->Application->getUnitOption($event->Prefix, 'ModuleFolder');
- }
-
- /**
* Shows export dialog
*
* @param kEvent $event
@@ -1366,7 +1357,8 @@
$this->Application->StoreVar($event->Prefix.'_export_ids', $selected_ids ? implode(',', $selected_ids) : '' );
$this->Application->StoreVar($event->Prefix.'_export_cats_ids', $selected_cats_ids);
- $event->redirect = $this->getModuleFolder($event).'/export';
+ $export_helper =& $this->Application->recallObject('CatItemExportHelper');
+ $event->redirect = $export_helper->getModuleFolder($event).'/export';
$redirect_params = Array( 'm_opener' => 'd',
$this->Prefix.'.export_event' => 'OnNew',
@@ -1376,181 +1368,6 @@
}
/**
- * Export form validation & processing
- *
- * @param kEvent $event
- */
- function OnExportBegin(&$event)
- {
- $items_info = $this->Application->GetVar( $event->getPrefixSpecial(true) );
- if (!$items_info)
- {
- $items_info = unserialize( $this->Application->RecallVar($event->getPrefixSpecial().'_ItemsInfo') );
- $this->Application->SetVar($event->getPrefixSpecial(true), $items_info);
- }
-
- list($item_id, $field_values) = each($items_info);
-
- $object =& $event->getObject( Array('skip_autoload' => true) );
- $object->SetFieldsFromHash($field_values);
- $field_values['ImportFilename'] = $object->GetDBField('ImportFilename'); //if upload formatter has renamed the file during moving !!!
-
- $object->setID($item_id);
- $this->setRequiredFields($event);
-
- $export_object =& $this->Application->recallObject('CatItemExportHelper');
-
- // save export/import options
- if ($event->Special == 'export')
- {
- $export_ids = $this->Application->RecallVar($event->Prefix.'_export_ids');
- $export_cats_ids = $this->Application->RecallVar($event->Prefix.'_export_cats_ids');
-
- // used for multistep export
- $field_values['export_ids'] = $export_ids ? explode(',', $export_ids) : false;
- $field_values['export_cats_ids'] = $export_cats_ids ? explode(',', $export_cats_ids) : Array( $this->Application->GetVar('m_cat_id') );
- }
-
- $field_values['ExportColumns'] = $field_values['ExportColumns'] ? explode('|', substr($field_values['ExportColumns'], 1, -1) ) : Array();
- $field_values['start_from'] = 0;
- $export_object->saveOptions($event, $field_values);
-
- if( $export_object->verifyOptions($event) )
- {
- $event->redirect = $this->getModuleFolder($event).'/'.$event->Special.'_progress';
-
- }
- else
- {
- // make uploaded file local & change source selection
- $filename = getArrayValue($field_values, 'ImportFilename');
- if ($filename) {
- $this->updateImportFiles($event);
- $object->SetDBField('ImportSource', 2);
- $field_values['ImportSource'] = 2;
- $object->SetDBField('ImportLocalFilename', $filename);
- $field_values['ImportLocalFilename'] = $filename;
- $export_object->saveOptions($event, $field_values);
- }
-
- $event->status = erFAIL;
- $event->redirect = false;
- }
- }
-
- /**
- * Enter description here...
- *
- * @param kEvent $event
- */
- function OnExportCancel(&$event)
- {
- $this->OnGoBack($event);
- }
-
- /**
- * Sets correct available & export fields
- *
- * @param kEvent $event
- */
- function prepareExportColumns(&$event)
- {
- $object =& $event->getObject( Array('skip_autoload' => true) );
-
- $available_columns = Array();
-
- // category field (mixed)
- $available_columns['__CATEGORY__CategoryPath'] = 'CategoryPath';
-
- if ($event->Special == 'import') {
- // category field (separated fields)
- $max_level = $this->Application->ConfigValue('MaxImportCategoryLevels');
- $i = 0;
- while ($i < $max_level) {
- $available_columns['__CATEGORY__Category'.($i + 1)] = 'Category'.($i + 1);
- $i++;
- }
- }
-
- // db fields
- foreach ($object->Fields as $field_name => $field_options)
- {
- if (!$object->SkipField($field_name))
- {
- $available_columns[$field_name] = $field_name.(getArrayValue($field_options, 'required') ? '*' : '');
- }
- }
-
- $available_columns = array_merge_recursive2($available_columns, $this->getCustomExportColumns($event));
-
- // custom fields
- foreach ($object->customFields as $custom_id => $custom_name)
- {
- $available_columns['__CUSTOM__'.$custom_name] = $custom_name;
- }
-
- // columns already in use
- $items_info = $this->Application->GetVar( $event->getPrefixSpecial(true) );
- if ($items_info)
- {
- list($item_id, $field_values) = each($items_info);
- $export_keys = $field_values['ExportColumns'];
- $export_keys = $export_keys ? explode('|', substr($export_keys, 1, -1) ) : Array();
- }
- else {
- $export_keys = Array();
- }
-
- $export_columns = Array();
- foreach ($export_keys as $field_key)
- {
- $field_name = $this->getExportField($field_key);
- $export_columns[$field_key] = $field_name;
- unset($available_columns[$field_key]);
- }
-
- $options = $object->GetFieldOptions('ExportColumns');
- $options['options'] = $export_columns;
- $object->SetFieldOptions('ExportColumns', $options);
-
- $options = $object->GetFieldOptions('AvailableColumns');
- $options['options'] = $available_columns;
- $object->SetFieldOptions('AvailableColumns', $options);
-
- $this->updateImportFiles($event);
- }
-
- /**
- * Updates uploaded files list
- *
- * @param kEvent $event
- */
- function updateImportFiles(&$event)
- {
- if ($event->Special != 'import') {
- return false;
- }
-
- $object =& $event->getObject();
-
- $import_filenames = Array();
-
- if ($folder_handle = opendir(EXPORT_PATH)) {
- while (false !== ($file = readdir($folder_handle))) {
- if (is_dir(EXPORT_PATH.'/'.$file) || substr($file, 0, 1) == '.' || strtolower($file) == 'cvs' || strtolower($file) == 'dummy' || filesize(EXPORT_PATH.'/'.$file) == 0) continue;
-
- $file_size = formatSize( filesize(EXPORT_PATH.'/'.$file) );
- $import_filenames[$file] = $file.' ('.$file_size.')';
- }
- closedir($folder_handle);
- }
-
- $options = $object->GetFieldOptions('ImportLocalFilename');
- $options['options'] = $import_filenames;
- $object->SetFieldOptions('ImportLocalFilename', $options);
- }
-
- /**
* Returns specific to each item type columns only
*
* @param kEvent $event
@@ -1631,22 +1448,6 @@
return preg_match('#(http|https)://(.*)#', $path);
}
-// ImportLocalFilename
-
- function getExportField($field_key)
- {
- $prepends = Array('__CUSTOM__', '__CATEGORY__');
- foreach ($prepends as $prepend)
- {
- if (substr($field_key, 0, strlen($prepend) ) == $prepend)
- {
- $field_key = substr($field_key, strlen($prepend), strlen($field_key) );
- break;
- }
- }
- return $field_key;
- }
-
/**
* Prepares item for import/export operations
*
@@ -1657,41 +1458,12 @@
parent::OnNew($event);
if ($event->Special != 'import' && $event->Special != 'export') return ;
- $this->setRequiredFields($event);
+ $export_helper =& $this->Application->recallObject('CatItemExportHelper');
+ $export_helper->setRequiredFields($event);
$this->Application->StoreVar('ImportCategory', 0);
}
/**
- * set required fields based on import or export params
- *
- * @param kEvent $event
- */
- function setRequiredFields(&$event)
- {
- $required_fields['common'] = Array('FieldsSeparatedBy', 'LineEndings', 'CategoryFormat');
-
- $required_fields['export'] = Array('ExportFormat', 'ExportFilename','ExportColumns');
- $required_fields['import'] = Array('FieldTitles', 'ImportSource', 'CheckDuplicatesMethod'); // ImportFilename, ImportLocalFilename
-
- $object =& $event->getObject();
- if ($event->Special == 'import')
- {
- $import_source = Array(1 => 'ImportFilename', 2 => 'ImportLocalFilename');
- $used_field = $import_source[ $object->GetDBField('ImportSource') ];
-
- $required_fields[$event->Special][] = $used_field;
- $object->Fields[$used_field]['error_field'] = 'ImportSource';
-
- if ($object->GetDBField('FieldTitles') == 2) $required_fields[$event->Special][] = 'ExportColumns'; // manual field titles
- }
-
- $required_fields = array_merge($required_fields['common'], $required_fields[$event->Special]);
- foreach ($required_fields as $required_field) {
- $object->setRequired($required_field, true);
- }
- }
-
- /**
* Process items selected in item_selector
*
* @param kEvent $event
@@ -1871,6 +1643,21 @@
}
/**
+ * Occures before an item is cloneded
+ * Id of ORIGINAL item is passed as event' 'id' param
+ * Do not call object' Update method in this event, just set needed fields!
+ *
+ * @param kEvent $event
+ */
+ function OnBeforeClone(&$event)
+ {
+ if ($this->Application->GetVar('ResetCatBeforeClone')) {
+ $object =& $event->getObject();
+ $object->SetDBField('CategoryId', null);
+ }
+ }
+
+ /**
* Apply same processing to each item beeing selected in grid
*
* @param kEvent $event
Index: trunk/kernel/units/categories/categories_event_handler.php
===================================================================
diff -u -r6093 -r6583
--- trunk/kernel/units/categories/categories_event_handler.php (.../categories_event_handler.php) (revision 6093)
+++ trunk/kernel/units/categories/categories_event_handler.php (.../categories_event_handler.php) (revision 6583)
@@ -250,12 +250,11 @@
function GetPassedId(&$event)
{
- if ( $this->Application->IsAdmin() ) return parent::getPassedID($event);
-
- $ret = $this->Application->GetVar('m_cat_id');
- if($ret) return $ret;
-
+ if ( $this->Application->IsAdmin() ) {
return parent::getPassedID($event);
+ }
+
+ return $this->Application->GetVar('m_cat_id');
}
/**
Index: trunk/core/admin_templates/catalog/catalog.tpl
===================================================================
diff -u -r6093 -r6583
--- trunk/core/admin_templates/catalog/catalog.tpl (.../catalog.tpl) (revision 6093)
+++ trunk/core/admin_templates/catalog/catalog.tpl (.../catalog.tpl) (revision 6583)
@@ -21,26 +21,26 @@
Request.progressText = '';
var $is_catalog = true;
var $Catalog = new Catalog('', 'catalog_');
- var a_toolbar = new ToolBar();
-
+ var a_toolbar = new ToolBar();
+
a_toolbar.AddButton( new ToolBarButton('upcat', '', function() {
$Catalog.go_to_cat($Catalog.ParentCategoryID);
}
) );
-
+
a_toolbar.AddButton( new ToolBarButton('homecat', '', function() {
$Catalog.go_to_cat(0);
}
- ) );
-
+ ) );
+
a_toolbar.AddButton( new ToolBarSeparator('sep1') );
-
+
a_toolbar.AddButton( new ToolBarButton('new_cat', '', function() {
std_precreate_item('c', 'categories/categories_edit');
}
- ) );
-
-
+ ) );
+
+
a_toolbar.AddButton( new ToolBarButton('editcat', '', function() {
var $edit_url = '';
var $category_id = get_hidden_field('m_cat_id');
@@ -49,33 +49,33 @@
redirect($redirect_url);
}
) );
-
+
-
-
+
+
a_toolbar.AddButton( new ToolBarButton('edit', '', edit) );
-
+
a_toolbar.AddButton( new ToolBarButton('delete', '',
function() {
var $template = $Catalog.queryTabRegistry('prefix', $Catalog.getCurrentPrefix(), 'view_template');
std_delete_items($Catalog.getCurrentPrefix(), $template, 1);
- } ) );
-
-
+ } ) );
+
+
a_toolbar.AddButton( new ToolBarSeparator('sep2') );
-
+
a_toolbar.AddButton( new ToolBarButton('approve', '', function() {
$Catalog.submit_event(null, 'OnMassApprove');
}
) );
-
+
a_toolbar.AddButton( new ToolBarButton('decline', '', function() {
$Catalog.submit_event(null, 'OnMassDecline');
}
- ) );
-
+ ) );
+
a_toolbar.AddButton( new ToolBarSeparator('sep3') );
-
+
a_toolbar.AddButton( new ToolBarButton('export', '', function() {
var $export_prefixes = new Array('l', 'p');
if (in_array($Catalog.ActivePrefix, $export_prefixes)) {
@@ -86,65 +86,65 @@
}
}
) );
-
+
a_toolbar.AddButton( new ToolBarButton('rebuild_cache', '', function() {
redirect('');
}
) );
-
+
a_toolbar.AddButton( new ToolBarSeparator('sep4') );
-
-
+
+
a_toolbar.AddButton( new ToolBarButton('cut', '', function() {
$Catalog.submit_event(null, 'OnCut');
}
) );
-
+
a_toolbar.AddButton( new ToolBarButton('copy', '', function() {
$Catalog.submit_event(null, 'OnCopy');
}
) );
-
-
+
+
a_toolbar.AddButton( new ToolBarButton('paste', '', function() {
- $Catalog.submit_event('c', 'OnPasteClipboard', null, function($object) {
+ $Catalog.submit_event('c', 'OnPasteClipboard', null, function($object) {
$object.resetTabs(true);
- $object.switchTab();
+ $object.switchTab();
} );
}
) );
-
+
/*a_toolbar.AddButton( new ToolBarButton('clear_clipboard', '', function() {
if (confirm('')) {
- $Catalog.submit_event('c', 'OnClearClipboard', null, function($object) {
+ $Catalog.submit_event('c', 'OnClearClipboard', null, function($object) {
$GridManager.CheckDependencies($object.ActivePrefix);
} );
}
}
) );*/
-
+
a_toolbar.AddButton( new ToolBarSeparator('sep5') );
-
+
a_toolbar.AddButton( new ToolBarButton('move_up', '', function() {
$Catalog.submit_event(null, 'OnMassMoveUp');
}
) );
-
-
+
+
a_toolbar.AddButton( new ToolBarButton('move_down', '', function() {
$Catalog.submit_event(null, 'OnMassMoveDown');
}
) );
-
+
a_toolbar.AddButton( new ToolBarSeparator('sep6') );
-
+
a_toolbar.AddButton( new ToolBarButton('view', '', function() {
show_viewmenu(a_toolbar, 'view');
}
) );
-
- a_toolbar.Render();
-
+
+ a_toolbar.Render();
+
function edit()
{
var $current_prefix = $Catalog.getCurrentPrefix();
@@ -189,7 +189,7 @@
|
-
+
@@ -218,10 +218,10 @@
- |
+
-
+
Index: trunk/core/units/general/my_application.php
===================================================================
diff -u -r5547 -r6583
--- trunk/core/units/general/my_application.php (.../my_application.php) (revision 5547)
+++ trunk/core/units/general/my_application.php (.../my_application.php) (revision 6583)
@@ -26,20 +26,6 @@
$this->registerClass('kXMLHelper',MODULES_PATH.'/kernel/units/general/xml_helper.php','kXMLHelper');
$this->registerClass('kModulesHelper', MODULES_PATH.'/kernel/units/general/helpers/modules.php', 'ModulesHelper');
-
- /*$this->registerClass('kMultiLanguageHelper',MODULES_PATH.'/kernel/units/general/helpers/multilanguage.php','kMultiLanguageHelper');
- $this->registerClass('kSearchHelper', MODULES_PATH.'/kernel/units/general/helpers/search_helper.php', 'SearchHelper');
- $this->registerClass('kSectionsHelper', MODULES_PATH.'/kernel/units/general/helpers/sections_helper.php', 'SectionsHelper');
- $this->registerClass('kPermissionsHelper', MODULES_PATH.'/kernel/units/general/helpers/permissions_helper.php', 'PermissionsHelper');
-
-
- $this->registerClass('kModRewriteHelper', MODULES_PATH.'/kernel/units/general/helpers/mod_rewrite_helper.php', 'ModRewriteHelper');
- $this->registerClass('kRecursiveHelper', MODULES_PATH.'/kernel/units/general/helpers/recursive_helper.php', 'RecursiveHelper');
- $this->registerClass('kFilenamesHelper', MODULES_PATH.'/kernel/units/general/helpers/filenames_helper.php', 'kFilenamesHelper');
-
- $this->registerClass('kPDFHelper', MODULES_PATH.'/kernel/units/general/helpers/pdf_helper.php', 'kPDFHelper');
- */
-
}
function getUserGroups($user_id)
Index: trunk/kernel/units/categories/categories_tag_processor.php
===================================================================
diff -u -r6428 -r6583
--- trunk/kernel/units/categories/categories_tag_processor.php (.../categories_tag_processor.php) (revision 6428)
+++ trunk/kernel/units/categories/categories_tag_processor.php (.../categories_tag_processor.php) (revision 6583)
@@ -280,7 +280,13 @@
function IsCurrent($params)
{
- return false;
+ $object =& $this->getObject($params);
+ if ($object->GetID() == $this->Application->GetVar('m_cat_id')) {
+ return true;
+ }
+ else {
+ return false;
+ }
}
/**
Index: trunk/core/kernel/utility/params.php
===================================================================
diff -u -r6093 -r6583
--- trunk/core/kernel/utility/params.php (.../params.php) (revision 6093)
+++ trunk/core/kernel/utility/params.php (.../params.php) (revision 6583)
@@ -19,7 +19,7 @@
{
// $re = preg_quote('([\${}a-zA-Z0-9_.-#\[\]]+)=(["\']{1,1})(.*?)(? $val){
Index: trunk/kernel/units/general/cat_tag_processor.php
===================================================================
diff -u -r6428 -r6583
--- trunk/kernel/units/general/cat_tag_processor.php (.../cat_tag_processor.php) (revision 6428)
+++ trunk/kernel/units/general/cat_tag_processor.php (.../cat_tag_processor.php) (revision 6583)
@@ -63,26 +63,6 @@
return $this->Application->ProcessParsedTag('m', 't', $params);
}
- /**
- * Returns path where exported category items should be saved
- *
- * @param Array $params
- */
- function ExportPath($params)
- {
- $ret = EXPORT_PATH.'/';
-
- if( getArrayValue($params, 'as_url') )
- {
- $ret = str_replace( FULL_PATH.'/', $this->Application->BaseURL(), $ret);
- }
-
- $export_options = unserialize($this->Application->RecallVar($this->getPrefixSpecial().'_options'));
- $ret .= $export_options['ExportFilename'].'.'.($export_options['ExportFormat'] == 1 ? 'csv' : 'xml');
-
- return $ret;
- }
-
function CategoryPath($params)
{
if (!isset($params['cat_id'])) {
Index: trunk/core/units/admin/admin_tag_processor.php
===================================================================
diff -u -r6093 -r6583
--- trunk/core/units/admin/admin_tag_processor.php (.../admin_tag_processor.php) (revision 6093)
+++ trunk/core/units/admin/admin_tag_processor.php (.../admin_tag_processor.php) (revision 6583)
@@ -319,7 +319,7 @@
ksort($section_data['children'], SORT_NUMERIC);
foreach ($section_data['children'] as $priority => $section_name) {
if (!$this->Application->CheckPermission($section_name.'.view', 1)) continue;
-
+
$tab_data =& $sections_helper->getSectionData($section_name);
$block_params['t'] = $tab_data['url']['t'];
$block_params['title'] = $tab_data['label'];
@@ -345,7 +345,8 @@
$block_params = Array('name' => $params['render_as']);
foreach ($this->Application->ModuleInfo as $module_name => $module_info) {
$prefix = $module_info['Var'];
- if (in_array($prefix, $skip_prefixes)) continue;
+
+ if (in_array($prefix, $skip_prefixes) || !$this->Application->getUnitOption($prefix, 'CatalogItem')) continue;
if ($prefix == 'm' && $replace_main) $prefix = 'c';
$label = $this->Application->getUnitOption($prefix, $params['title_property']);
$block_params['title'] = $label;
@@ -376,7 +377,7 @@
return $oFCKeditor->CreateHtml();
}
-
+
/**
* Allows to construct link for opening any type of catalog item selector
*
@@ -390,39 +391,102 @@
$mode = $params['mode'];
unset($params['mode']);
}
-
+
$params['t'] = 'item_selector/item_selector_'.$mode;
-
+
$default_params = Array('no_amp' => 1, 'pass' => 'all,'.$params['prefix']);
unset($params['prefix']);
-
+
$pass_through = Array();
if (isset($params['tabs_dependant'])) { // {yes, no}
$pass_through['td'] = $params['tabs_dependant'];
unset($params['tabs_dependant']);
}
-
+
if (isset($params['selection_mode'])) { // {single, multi}
$pass_through['tm'] = $params['selection_mode'];
unset($params['selection_mode']);
}
-
+
if (isset($params['tab_prefixes'])) { // {all, none, Application->ProcessParsedTag('m', 't', $params);
}
+
+ function TimeFrame($params)
+ {
+ $w = adodb_date('w');
+ $m = adodb_date('m');
+ $y = adodb_date('Y');
+ //FirstDayOfWeek is 0 for Sunday and 1 for Monday
+ $fdow = $this->Application->ConfigValue('FirstDayOfWeek');
+ if ($fdow && $w == 0) $w = 7;
+ $today_start = adodb_mktime(0,0,0,adodb_date('m'),adodb_date('d'),$y);
+ $first_day_of_this_week = $today_start - ($w - $fdow)*86400;
+ $first_day_of_this_month = adodb_mktime(0,0,0,$m,1,$y);
+ $this_quater = ceil($m/3);
+ $this_quater_start = adodb_mktime(0,0,0,$this_quater*3-2,1,$y);
+
+ switch ($params['type']) {
+ case 'last_week_start':
+ $timestamp = $first_day_of_this_week - 86400*7;
+ break;
+ case 'last_week_end':
+ $timestamp = $first_day_of_this_week - 1;
+ break;
+
+ case 'last_month_start':
+ $timestamp = $m == 1 ? adodb_mktime(0,0,0,12,1,$y-1) : adodb_mktime(0,0,0,$m-1,1,$y);
+ break;
+ case 'last_month_end':
+ $timestamp = $first_day_of_this_month = adodb_mktime(0,0,0,$m,1,$y) - 1;
+ break;
+
+ case 'last_quater_start':
+ $timestamp = $this_quater == 1 ? adodb_mktime(0,0,0,10,1,$y-1) : adodb_mktime(0,0,0,($this_quater-1)*3-2,1,$y);
+ break;
+ case 'last_quater_end':
+ $timestamp = $this_quater_start - 1;
+ break;
+
+ case 'last_6_months_start':
+ $timestamp = $m <= 6 ? adodb_mktime(0,0,0,$m+6,1,$y-1) : adodb_mktime(0,0,0,$m-6,1,$y);
+ break;
+
+ case 'last_year_start':
+ $timestamp = adodb_mktime(0,0,0,1,1,$y-1);
+ break;
+ case 'last_year_end':
+ $timestamp = adodb_mktime(23,59,59,12,31,$y-1);
+ break;
+ }
+
+
+ if (isset($params['format'])) {
+ $format = $params['format'];
+ if(preg_match("/_regional_(.*)/", $format, $regs))
+ {
+ $lang =& $this->Application->recallObject('lang.current');
+ $format = $lang->GetDBField($regs[1]);
+ }
+ return adodb_date($format, $timestamp);
+ }
+
+ return $timestamp;
+
+ }
}
?>
\ No newline at end of file
Index: trunk/kernel/include/category.php
===================================================================
diff -u -r6093 -r6583
--- trunk/kernel/include/category.php (.../category.php) (revision 6093)
+++ trunk/kernel/include/category.php (.../category.php) (revision 6583)
@@ -691,17 +691,11 @@
function UpdateACL()
{
- global $objGroups, $objPermCache;
-
- $glist = $objGroups->GetAllGroupList();
-
- $ViewList = $this->Permissions->GetGroupPermList($this,"CATEGORY.VIEW",$glist);
- $perms = $this->Permissions->GetAllViewPermGroups($this,$glist);
- //echo "";print_r($perms); echo "
";
- foreach($perms as $PermName => $l)
- {
- $this->SetViewPerms($PermName,$l,$glist);
- }
+ $q = 'INSERT INTO '.TABLE_PREFIX.'PermCache (CategoryId, PermId, ACL, DACL)
+ SELECT '.$this->UniqueId().', PermId, ACL, DACL
+ FROM '.TABLE_PREFIX.'PermCache
+ WHERE CategoryId = '.$this->Get('ParentId');
+ $this->Conn->Query($q);
}
function Cat_Link()