Index: branches/unlabeled/unlabeled-1.24.2/kernel/admin_templates/catalog.tpl =================================================================== diff -u -r6514 -r6582 --- branches/unlabeled/unlabeled-1.24.2/kernel/admin_templates/catalog.tpl (.../catalog.tpl) (revision 6514) +++ branches/unlabeled/unlabeled-1.24.2/kernel/admin_templates/catalog.tpl (.../catalog.tpl) (revision 6582) @@ -21,7 +21,7 @@ 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); Index: branches/unlabeled/unlabeled-1.46.2/kernel/admin_templates/incs/form_blocks.tpl =================================================================== diff -u -r6444 -r6582 --- branches/unlabeled/unlabeled-1.46.2/kernel/admin_templates/incs/form_blocks.tpl (.../form_blocks.tpl) (revision 6444) +++ branches/unlabeled/unlabeled-1.46.2/kernel/admin_templates/incs/form_blocks.tpl (.../form_blocks.tpl) (revision 6582) @@ -297,7 +297,7 @@ " name="" value=""> - " type="checkbox" id="_cb_" name="_cb_" class="" onchange="update_checkbox(this, document.getElementById(''));"> + " type="checkbox" id="_cb_" name="_cb_" class="" onchange="update_checkbox(this, document.getElementById(''));" onclick="">   Index: branches/unlabeled/unlabeled-1.42.2/kernel/admin_templates/incs/script.js =================================================================== diff -u -r6442 -r6582 --- branches/unlabeled/unlabeled-1.42.2/kernel/admin_templates/incs/script.js (.../script.js) (revision 6442) +++ branches/unlabeled/unlabeled-1.42.2/kernel/admin_templates/incs/script.js (.../script.js) (revision 6582) @@ -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: branches/unlabeled/unlabeled-1.16.2/kernel/admin_templates/incs/ajax.js =================================================================== diff -u -r6106 -r6582 --- branches/unlabeled/unlabeled-1.16.2/kernel/admin_templates/incs/ajax.js (.../ajax.js) (revision 6106) +++ branches/unlabeled/unlabeled-1.16.2/kernel/admin_templates/incs/ajax.js (.../ajax.js) (revision 6582) @@ -14,7 +14,7 @@ //p_errorCallBack: callback function for erroneous response //p_pass: string of params to pass to callback functions //p_object: object of params to pass to callback functions - + if (p_busyReq) return; var req = Request.getRequest(); if (req != null) { @@ -34,15 +34,15 @@ } var $ajax_mark = (p_url.indexOf('?') ? '&' : '?') + 'ajax=yes'; req.open(Request.method, p_url + $ajax_mark, true); - + if (Request.method == 'POST') { Request.headers['Content-type'] = 'application/x-www-form-urlencoded'; Request.headers['referer'] = p_url; } else { Request.headers['If-Modified-Since'] = 'Sat, 1 Jan 2000 00:00:00 GMT'; } - + Request.sendHeaders(req); if (Request.method == 'POST') { req.send(Request.params); @@ -51,7 +51,7 @@ else { req.send(null); } - + var toId = window.setTimeout( function() {if (p_busyReq) req.abort();}, Request.timeout ); } } @@ -74,7 +74,7 @@ Request.showProgress = function(p_id) { if (p_id != '') { Request.setOpacity(20, p_id); - + if (!document.getElementById(p_id + '_progress')) { document.body.appendChild(Request.getProgressObject(p_id)); } @@ -100,7 +100,7 @@ object.opacity = (opacity / 100); object.MozOpacity = (opacity / 100); object.KhtmlOpacity = (opacity / 100); - object.filter = "alpha(opacity=" + opacity + ")"; + object.filter = "alpha(opacity=" + opacity + ")"; } Request.getProgressHtml = function() { @@ -110,15 +110,15 @@ Request.getProgressObject = function($id) { var $div = document.createElement('DIV'); var $parent_div = document.getElementById($id); - + $div.id = $id + '_progress'; - + $div.style.width = $parent_div.clientWidth + 'px'; $div.style.height = '150px'; // default height if div is empty (first ajax request for div) - $div.style.left = getRealLeft($parent_div) + 'px'; + $div.style.left = getRealLeft($parent_div) + 'px'; $div.style.top = getRealTop($parent_div) + 'px'; $div.style.position = 'absolute'; - + /*$div.style.border = '1px solid green'; $div.style.backgroundColor = '#FF0000';*/ @@ -135,41 +135,41 @@ if (typeof(theform) == 'string') { theform = document.getElementById(theform); } - + var els = theform.elements; var len = els.length; var queryString = ''; - - Request.addField = function(name, value) { + + Request.addField = function(name, value) { if (queryString.length > 0) queryString += '&'; queryString += encodeURIComponent(name) + '=' + encodeURIComponent(value); }; - + for (var i = 0; i= 0) { Request.addField(el.name, el.options[el.selectedIndex].value); } break; - + case 'select-multiple': for (var j = 0; j < el.options.length; j++) { if (!el.options[j].selected) continue; Request.addField(el.name, el.options[j].value); } break; - + case 'checkbox': case 'radio': if (!el.checked) continue; @@ -218,7 +218,7 @@ window.location.href = $match_redirect[1]; return false; } - + if ($object.showProgress($responce)) { $object.Query(); } @@ -230,12 +230,12 @@ AjaxProgressBar.prototype.FormatTime = function ($seconds) { $seconds = parseInt($seconds); - + var $minutes = Math.floor($seconds / 60); if ($minutes < 10) $minutes = '0' + $minutes; $seconds = $seconds % 60; if ($seconds < 10) $seconds = '0' + $seconds; - + return $minutes + ':' + $seconds; } @@ -244,13 +244,13 @@ var $now = this.GetMicroTime(); this.ProgressTime[this.ProgressTime.length] = $now - this.LastResponceTime; this.LastResponceTime = $now; - + var $display_progress = parseInt(this.ProgressPercent); this.GetWindow().document.title = $display_progress + '% - ' + this.WindowTitle; document.getElementById('progress_display[percents_completed]').innerHTML = $display_progress + '%'; document.getElementById('progress_display[elapsed_time]').innerHTML = this.FormatTime( Math.sum(this.ProgressTime) ); document.getElementById('progress_display[Estimated_time]').innerHTML = this.FormatTime( this.GetEstimatedTime() ); - + document.getElementById('progress_bar[done]').style.width = $display_progress + '%'; document.getElementById('progress_bar[left]').style.width = (100 - $display_progress) + '%'; return $percent < 100 ? true : false; Index: branches/unlabeled/unlabeled-1.11.2/core/units/users/users_item.php =================================================================== diff -u -r5303 -r6582 --- branches/unlabeled/unlabeled-1.11.2/core/units/users/users_item.php (.../users_item.php) (revision 5303) +++ branches/unlabeled/unlabeled-1.11.2/core/units/users/users_item.php (.../users_item.php) (revision 6582) @@ -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: branches/unlabeled/unlabeled-1.75.2/core/kernel/db/db_event_handler.php =================================================================== diff -u -r6575 -r6582 --- branches/unlabeled/unlabeled-1.75.2/core/kernel/db/db_event_handler.php (.../db_event_handler.php) (revision 6575) +++ branches/unlabeled/unlabeled-1.75.2/core/kernel/db/db_event_handler.php (.../db_event_handler.php) (revision 6582) @@ -1976,6 +1976,37 @@ } + function OnDeleteExportPreset(&$event) + { + $object =& $event->GetObject(); + + $items_info = $this->Application->GetVar( $event->getPrefixSpecial(true) ); + if($items_info) + { + list($id,$field_values) = each($items_info); + $preset_key = $field_values['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 ; + + $to_delete = ''; + $export_presets = array(''=>''); + foreach ($export_settings[$event->Prefix] as $key => $val) { + if (implode('|', $val['ExportColumns']) == $preset_key) { + $to_delete = $key; + break; + } + } + if ($to_delete) { + unset($export_settings[$event->Prefix][$to_delete]); + $user->setPersistantVar('export_settings', serialize($export_settings)); + } + } + } + } Index: branches/unlabeled/unlabeled-1.21.2/kernel/units/general/cat_dbitem_export.php =================================================================== diff -u -r6575 -r6582 --- branches/unlabeled/unlabeled-1.21.2/kernel/units/general/cat_dbitem_export.php (.../cat_dbitem_export.php) (revision 6575) +++ branches/unlabeled/unlabeled-1.21.2/kernel/units/general/cat_dbitem_export.php (.../cat_dbitem_export.php) (revision 6582) @@ -384,8 +384,6 @@ if ($this->exportOptions['export_ids'] === false) { - - // get links from current category & all it's subcategories $join_clauses = Array(); @@ -1197,8 +1195,31 @@ $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__'); @@ -1300,6 +1321,15 @@ 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'); @@ -1337,9 +1367,14 @@ $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 ($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'); Index: branches/unlabeled/unlabeled-1.11.2/kernel/units/users/users_item.php =================================================================== diff -u -r5303 -r6582 --- branches/unlabeled/unlabeled-1.11.2/kernel/units/users/users_item.php (.../users_item.php) (revision 5303) +++ branches/unlabeled/unlabeled-1.11.2/kernel/units/users/users_item.php (.../users_item.php) (revision 6582) @@ -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: branches/unlabeled/unlabeled-1.24.2/core/admin_templates/catalog/catalog.tpl =================================================================== diff -u -r6514 -r6582 --- branches/unlabeled/unlabeled-1.24.2/core/admin_templates/catalog/catalog.tpl (.../catalog.tpl) (revision 6514) +++ branches/unlabeled/unlabeled-1.24.2/core/admin_templates/catalog/catalog.tpl (.../catalog.tpl) (revision 6582) @@ -21,7 +21,7 @@ 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); Index: branches/unlabeled/unlabeled-1.21.2/core/units/general/cat_dbitem_export.php =================================================================== diff -u -r6575 -r6582 --- branches/unlabeled/unlabeled-1.21.2/core/units/general/cat_dbitem_export.php (.../cat_dbitem_export.php) (revision 6575) +++ branches/unlabeled/unlabeled-1.21.2/core/units/general/cat_dbitem_export.php (.../cat_dbitem_export.php) (revision 6582) @@ -384,8 +384,6 @@ if ($this->exportOptions['export_ids'] === false) { - - // get links from current category & all it's subcategories $join_clauses = Array(); @@ -1197,8 +1195,31 @@ $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__'); @@ -1300,6 +1321,15 @@ 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'); @@ -1337,9 +1367,14 @@ $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 ($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');