Index: branches/unlabeled/unlabeled-1.79.4/core/kernel/db/db_event_handler.php
===================================================================
diff -u -r7043 -r7072
--- branches/unlabeled/unlabeled-1.79.4/core/kernel/db/db_event_handler.php (.../db_event_handler.php) (revision 7043)
+++ branches/unlabeled/unlabeled-1.79.4/core/kernel/db/db_event_handler.php (.../db_event_handler.php) (revision 7072)
@@ -1144,8 +1144,11 @@
function isNewItemCreate(&$event)
{
$event->setEventParam('raise_warnings', 0);
- $item_id = $this->getPassedID($event);
- return ($item_id == '') ? true : false;
+ $object =& $event->getObject();
+ return !$object->IsLoaded();
+
+// $item_id = $this->getPassedID($event);
+// return ($item_id == '') ? true : false;
}
/**
@@ -1255,6 +1258,7 @@
$temp->PrepareEdit();
$object->setID(0);
+ $this->Application->SetVar($event->getPrefixSpecial().'_id',0);
$event->redirect=false;
}
@@ -1572,6 +1576,8 @@
{
$event->SetRedirectParam('opener', 'u');
+
+
/*return ;
// 2. substitute opener
@@ -1889,7 +1895,11 @@
$export_helper =& $this->Application->recallObject('CatItemExportHelper');
$event->redirect = $export_t ? $export_t : $export_helper->getModuleFolder($event).'/export';
- $redirect_params = Array( 'm_opener' => 'd',
+ list($index_file, $env) = explode('|', $this->Application->RecallVar('last_template'));
+ $finish_url = $this->Application->BaseURL('/admin').$index_file.'?'.ENV_VAR_NAME.'='.$env;
+ $this->Application->StoreVar('export_finish_url', $finish_url);
+
+ $redirect_params = Array(
$this->Prefix.'.export_event' => 'OnNew',
'pass' => 'all,'.$this->Prefix.'.export');
Index: branches/unlabeled/unlabeled-1.27.2/core/units/admin/admin_tag_processor.php
===================================================================
diff -u -r7071 -r7072
--- branches/unlabeled/unlabeled-1.27.2/core/units/admin/admin_tag_processor.php (.../admin_tag_processor.php) (revision 7071)
+++ branches/unlabeled/unlabeled-1.27.2/core/units/admin/admin_tag_processor.php (.../admin_tag_processor.php) (revision 7072)
@@ -554,6 +554,8 @@
*/
function SetPopupSize($params)
{
+ if (!$this->UsePopups($params)) return ;
+
$width = $params['width'];
$height = $params['height'];
Index: branches/unlabeled/unlabeled-1.2.4/core/kernel/utility/formatters/formatter.php
===================================================================
diff -u -r6585 -r7072
--- branches/unlabeled/unlabeled-1.2.4/core/kernel/utility/formatters/formatter.php (.../formatter.php) (revision 6585)
+++ branches/unlabeled/unlabeled-1.2.4/core/kernel/utility/formatters/formatter.php (.../formatter.php) (revision 7072)
@@ -153,7 +153,7 @@
function GetSample($field, &$options, &$object)
{
-
+ if (isset($options['sample_value'])) return $options['sample_value'];
}
}
\ No newline at end of file
Index: branches/unlabeled/unlabeled-1.21.4/core/kernel/db/dblist.php
===================================================================
diff -u -r7037 -r7072
--- branches/unlabeled/unlabeled-1.21.4/core/kernel/db/dblist.php (.../dblist.php) (revision 7037)
+++ branches/unlabeled/unlabeled-1.21.4/core/kernel/db/dblist.php (.../dblist.php) (revision 7072)
@@ -379,6 +379,18 @@
return $this->Totals[$field.'_'.$total_function];
}
+ function GetFormattedTotal($field, $total_function)
+ {
+ $val = $this->getTotal($field, $total_function);
+ $options = $this->GetFieldOptions($field);
+ $res = $val;
+ if (isset($options['formatter'])) {
+ $formatter =& $this->Application->recallObject($options['formatter']);
+ $res = $formatter->Format($val, $field, $this );
+ }
+ return $res;
+ }
+
/**
* Builds full select query except for LIMIT clause
*
Index: branches/unlabeled/unlabeled-1.14.4/core/kernel/parser/tags.php
===================================================================
diff -u -r6715 -r7072
--- branches/unlabeled/unlabeled-1.14.4/core/kernel/parser/tags.php (.../tags.php) (revision 6715)
+++ branches/unlabeled/unlabeled-1.14.4/core/kernel/parser/tags.php (.../tags.php) (revision 7072)
@@ -290,7 +290,7 @@
}
else
{
- trigger_error('can\'t process tag '.$this->Tag,E_USER_WARNING);
+ trigger_error('can\'t process tag '.$this->Tag.' in '.$this->Prefix,E_USER_WARNING);
}
}
@@ -388,7 +388,7 @@
else {
// use original prefix_special found in templates (parameter names in form $ParamName found in it will not be replaced with values)
list ($prefix, $tag) = explode(':', $splited[0], 2); //$prefix = $this->getPrefixSpecial();
-
+
if (isset($this->NamedParams['_ignore_missing_'])) {
if (!$this->Application->prefixRegistred($prefix)) return array();
}
Index: branches/unlabeled/unlabeled-1.63.4/core/kernel/utility/unit_config_reader.php
===================================================================
diff -u -r6891 -r7072
--- branches/unlabeled/unlabeled-1.63.4/core/kernel/utility/unit_config_reader.php (.../unit_config_reader.php) (revision 6891)
+++ branches/unlabeled/unlabeled-1.63.4/core/kernel/utility/unit_config_reader.php (.../unit_config_reader.php) (revision 7072)
@@ -213,7 +213,7 @@
$this->postProcessConfig($prefix, 'AggregateConfigs', 'sub_prefix');
$clones = $this->postProcessConfig($prefix, 'Clones', 'prefix');
}
-
+
asort($prioritized_configs);
foreach ($prioritized_configs as $prefix => $priority) {
$this->parseConfig($prefix);
Index: branches/unlabeled/unlabeled-1.33.16/core/kernel/event_handler.php
===================================================================
diff -u -r6125 -r7072
--- branches/unlabeled/unlabeled-1.33.16/core/kernel/event_handler.php (.../event_handler.php) (revision 6125)
+++ branches/unlabeled/unlabeled-1.33.16/core/kernel/event_handler.php (.../event_handler.php) (revision 7072)
@@ -123,6 +123,10 @@
*/
function OnGoBack(&$event)
{
+ $url = $this->Application->RecallVar('export_finish_url');
+ if ($url) {
+ $this->Application->Redirect('external:'.$url);
+ }
$event->SetRedirectParam('opener', 'u');
}
Index: branches/unlabeled/unlabeled-1.26.8/core/kernel/parser/template_parser.php
===================================================================
diff -u -r6826 -r7072
--- branches/unlabeled/unlabeled-1.26.8/core/kernel/parser/template_parser.php (.../template_parser.php) (revision 6826)
+++ branches/unlabeled/unlabeled-1.26.8/core/kernel/parser/template_parser.php (.../template_parser.php) (revision 7072)
@@ -639,7 +639,9 @@
else
$BlockParser->SetParams($params);
$this->Application->Parser =& $BlockParser;
- if (!isset($params['name'])) trigger_error('***Error: Block name not passed to ParseBlock', E_USER_ERROR);
+ if (!isset($params['name'])) {
+ trigger_error('***Error: Block name not passed to ParseBlock', E_USER_ERROR);
+ }
$templates_cache =& $this->Application->recallObject('TemplatesCache');
$template_name = $as_template ? $params['name'] : $templates_cache->GetTemplateFileName($params['name']) . '-block:'.$params['name'];
Index: branches/unlabeled/unlabeled-1.32.2/core/units/users/users_config.php
===================================================================
diff -u -r6918 -r7072
--- branches/unlabeled/unlabeled-1.32.2/core/units/users/users_config.php (.../users_config.php) (revision 6918)
+++ branches/unlabeled/unlabeled-1.32.2/core/units/users/users_config.php (.../users_config.php) (revision 7072)
@@ -131,7 +131,7 @@
'FirstName' => Array('type' => 'string','default' => ''),
'LastName' => Array('type' => 'string','default' => ''),
'Company' => Array('type' => 'string','not_null' => '1','default' => ''),
- 'Email' => Array('type' => 'string', 'formatter'=>'kFormatter', 'regexp'=>'/^[_a-zA-Z0-9-\.]+@[a-zA-Z0-9-\.]+\.[a-z]{2,4}$/', 'unique'=>Array('Email'), 'not_null' => '1', 'required'=>1, 'default' => '', 'error_msgs' => Array('invalid_format'=>'!la_invalid_email!', 'unique'=>'!lu_email_already_exist!') ),
+ 'Email' => Array('type' => 'string', 'formatter'=>'kFormatter', 'regexp'=>'/^[_a-zA-Z0-9-\.]+@[a-zA-Z0-9-\.]+\.[a-z]{2,4}$/', 'sample_value' => 'email@domain.com', 'unique'=>Array('Email'), 'not_null' => '1', 'required'=>1, 'default' => '', 'error_msgs' => Array('invalid_format'=>'!la_invalid_email!', 'unique'=>'!lu_email_already_exist!') ),
'CreatedOn' => Array('type'=>'int', 'formatter' => 'kDateFormatter', 'default' => '#NOW#', 'not_null' => '1' ),
'Phone' => Array('type' => 'string','default' => ''),
'Fax' => Array('type' => 'string','not_null' => '1','default' => ''),
Index: branches/unlabeled/unlabeled-1.68.4/core/kernel/db/db_tag_processor.php
===================================================================
diff -u -r7068 -r7072
--- branches/unlabeled/unlabeled-1.68.4/core/kernel/db/db_tag_processor.php (.../db_tag_processor.php) (revision 7068)
+++ branches/unlabeled/unlabeled-1.68.4/core/kernel/db/db_tag_processor.php (.../db_tag_processor.php) (revision 7072)
@@ -131,7 +131,7 @@
$picker_helper =& $this->Application->RecallObject('ColumnPickerHelper');
/* @var $picker_helper kColumnPickerHelper */
- $picker_helper->ApplyPicker($this->getPrefixSpecial(), $grid_config);
+// $picker_helper->ApplyPicker($this->getPrefixSpecial(), $grid_config);
$std_params['pass_params']='true';
$std_params['PrefixSpecial']=$this->getPrefixSpecial();
@@ -350,6 +350,7 @@
{
$this->Application->SetVar( $this->getPrefixSpecial().'_id', $list->GetDBField($id_field) ); // for edit/delete links using GET
$this->Application->SetVar( $this->Prefix.'_id', $list->GetDBField($id_field) );
+ $block_params['is_last'] = ($i == $list->SelectedCount-1);
if ($cache_mod_rw) {
$this->Application->setCache('filenames', $this->Prefix.'_'.$list->GetDBField($id_field), $list->GetDBField('Filename'));
@@ -1660,7 +1661,7 @@
$field_values = $export_object->$action_method($event);
// finish code is done from JS now
- if ($field_values['start_from'] == $field_values['total_records'])
+ if ($field_values['start_from'] >= $field_values['total_records'])
{
if ($this->Special == 'import') {
$this->Application->StoreVar('PermCache_UpdateRequired', 1);
@@ -1701,7 +1702,7 @@
{
$list =& $this->GetList($params);
- return $list->getTotal($this->SelectParam($params, 'field,name'), $params['function']);
+ return $list->GetFormattedTotal($this->SelectParam($params, 'field,name'), $params['function']);
}
Index: branches/unlabeled/unlabeled-1.18.4/core/kernel/parser/template.php
===================================================================
diff -u -r6826 -r7072
--- branches/unlabeled/unlabeled-1.18.4/core/kernel/parser/template.php (.../template.php) (revision 6826)
+++ branches/unlabeled/unlabeled-1.18.4/core/kernel/parser/template.php (.../template.php) (revision 7072)
@@ -108,7 +108,18 @@
$module_filename = $filename;
}
- if ( $this->Application->IsAdmin() && $this->Application->findModule('Name', $first_dir)) {
+ // !preg_match for backward compatability with full-path plugins
+ if ($this->Application->IsAdmin() && $first_dir == 'plugins' && !preg_match('/admin_templates/', $module_filename)) {
+ if (preg_match('#^[\/]{0,1}([^\/]*)\/(.*)#', $module_filename, $regs)) {;
+ $path = MODULES_PATH.'/'.strtolower($first_dir).'/'.$regs[1].'/admin_templates';
+ $module_filename = $regs[2];
+ }
+ else {
+ $first_dir = '';
+ $module_filename = $filename;
+ }
+ }
+ elseif ( $this->Application->IsAdmin() && $this->Application->findModule('Name', $first_dir)) {
if ($first_dir == 'in-portal') {
$first_dir = 'kernel';
}
Index: branches/unlabeled/unlabeled-1.22.2/core/units/general/cat_dbitem_export.php
===================================================================
diff -u -r6688 -r7072
--- branches/unlabeled/unlabeled-1.22.2/core/units/general/cat_dbitem_export.php (.../cat_dbitem_export.php) (revision 6688)
+++ branches/unlabeled/unlabeled-1.22.2/core/units/general/cat_dbitem_export.php (.../cat_dbitem_export.php) (revision 7072)
@@ -1,6 +1,7 @@
SetDBField($field_name, isset($sample_value) && $sample_value ? $sample_value : 'no value');
+ $object->SetField($field_name, isset($sample_value) && $sample_value ? $sample_value : 'no value');
}
+ $object->UpdateFormattersSubFields();
if ($set_status && $has_empty) {
$object->SetDBField('Status', 0);
@@ -374,49 +376,35 @@
}
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'];
+ if ($count_only && isset($this->exportOptions['ForceCountSQL'])) {
+ $sql = $this->exportOptions['ForceCountSQL'];
+ }
+ elseif (!$count_only && isset($this->exportOptions['ForceSelectSQL'])) {
+ $sql = $this->exportOptions['ForceSelectSQL'];
+ }
+ else {
+ $items_list =& $this->Application->recallObject($this->curItem->Prefix.'.export-items-list', $this->curItem->Prefix.'_List');
+ $items_list->SetPerPage(-1);
- $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';
+ if ($options['export_ids'] != '') {
+ $items_list->AddFilter('export_ids', $items_list->TableName.'.'.$items_list->IDField.' IN ('.implode(',',$options['export_ids']).')');
}
- $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;
+ if ($count_only) {
+ $sql = $items_list->getCountSQL( $items_list->GetSelectSQL(true,false) );
}
- $sql .= ' WHERE 1';
-
- $sql .= ' ORDER BY item_table.'.$this->curItem->IDField.' ASC'; // NEW
+ else {
+ $sql = $items_list->GetSelectSQL();
+ }
}
- 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);
- }
+// else {
+// $sql = preg_replace("/^.*SELECT(.*?)FROM(?!_)/is", "SELECT COUNT(*) AS count FROM ", $sql);
+// }
return $sql;
}
@@ -617,7 +605,8 @@
$this->dummyCategory =& $this->Application->recallObject('c.-tmpitem', 'c', Array('skip_autoload' => true));
fseek($this->filePointer, $this->exportOptions['start_from']);
- while (($bytes_imported < IMPORT_CHUNK) && !feof($this->filePointer)) {
+ $items_processed = 0;
+ while (($bytes_imported < IMPORT_CHUNK && $items_processed < IMPORT_STEP) && !feof($this->filePointer)) {
$data = $this->readRecord();
if ($data) {
if ($this->exportOptions['ReplaceDuplicates']) {
@@ -628,6 +617,7 @@
$this->processCurrentItem($event, $data);
}
$bytes_imported = ftell($this->filePointer) - $this->exportOptions['start_from'];
+ $items_processed++;
}
$this->closeFile();
@@ -860,6 +850,7 @@
// $sql_start = getmicrotime();
if (!$this->curItem->$save_method()) {
+ $this->Application->SetVar('m_cat_id', $backup_category_id);
return false;
}
// $sql_end = getmicrotime();
@@ -961,7 +952,7 @@
}
elseif (substr($field, 0, 11) == '__VIRTUAL__') {
$field = substr($field, 11);
- return $this->curItem->GetField($field);
+ $ret = $this->curItem->GetField($field);
}
else
{
Index: branches/unlabeled/unlabeled-1.68.2/core/units/general/cat_event_handler.php
===================================================================
diff -u -r6878 -r7072
--- branches/unlabeled/unlabeled-1.68.2/core/units/general/cat_event_handler.php (.../cat_event_handler.php) (revision 6878)
+++ branches/unlabeled/unlabeled-1.68.2/core/units/general/cat_event_handler.php (.../cat_event_handler.php) (revision 7072)
@@ -1483,7 +1483,7 @@
if ($dst_field == 'ImportCategory') {
// Tools -> Import -> Item Import -> Select Import Category
$this->Application->StoreVar('ImportCategory', $selected_ids['c']);
- $this->Application->StoreVar($event->getPrefixSpecial().'_ForceNotValid', 1); // not to loose import/export values on form refresh
+// $this->Application->StoreVar($event->getPrefixSpecial().'_ForceNotValid', 1); // not to loose import/export values on form refresh
$this->Application->SetVar($event->getPrefixSpecial().'_id', 0);
$this->Application->SetVar($event->getPrefixSpecial().'_event', 'OnExportBegin');
@@ -1604,7 +1604,7 @@
// 5. substitute id of item being cloned with clone id
$this->Application->SetVar($event->getPrefixSpecial().'_id', $cloned_ids[0]);
-
+
$selected_ids = $this->getSelectedIDs($event, true);
$selected_ids[ array_search($object->GetID(), $selected_ids) ] = $cloned_ids[0];
$this->StoreSelectedIDs($event, $selected_ids);