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');