Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F15391988
D18957.id45456.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
4 KB
Referenced Files
None
Subscribers
None
D18957.id45456.diff
View Options
diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php
--- a/src/__phutil_library_map__.php
+++ b/src/__phutil_library_map__.php
@@ -2852,6 +2852,7 @@
'PhabricatorExportEngineExtension' => 'infrastructure/export/engine/PhabricatorExportEngineExtension.php',
'PhabricatorExportField' => 'infrastructure/export/field/PhabricatorExportField.php',
'PhabricatorExportFormat' => 'infrastructure/export/field/PhabricatorExportFormat.php',
+ 'PhabricatorExportFormatSetting' => 'infrastructure/export/engine/PhabricatorExportFormatSetting.php',
'PhabricatorExtendedPolicyInterface' => 'applications/policy/interface/PhabricatorExtendedPolicyInterface.php',
'PhabricatorExtendingPhabricatorConfigOptions' => 'applications/config/option/PhabricatorExtendingPhabricatorConfigOptions.php',
'PhabricatorExtensionsSetupCheck' => 'applications/config/check/PhabricatorExtensionsSetupCheck.php',
@@ -8288,6 +8289,7 @@
'PhabricatorExportEngineExtension' => 'Phobject',
'PhabricatorExportField' => 'Phobject',
'PhabricatorExportFormat' => 'Phobject',
+ 'PhabricatorExportFormatSetting' => 'PhabricatorInternalSetting',
'PhabricatorExtendingPhabricatorConfigOptions' => 'PhabricatorApplicationConfigOptions',
'PhabricatorExtensionsSetupCheck' => 'PhabricatorSetupCheck',
'PhabricatorExternalAccount' => array(
diff --git a/src/applications/search/controller/PhabricatorApplicationSearchController.php b/src/applications/search/controller/PhabricatorApplicationSearchController.php
--- a/src/applications/search/controller/PhabricatorApplicationSearchController.php
+++ b/src/applications/search/controller/PhabricatorApplicationSearchController.php
@@ -421,6 +421,13 @@
$formats = PhabricatorExportFormat::getAllEnabledExportFormats();
$format_options = mpull($formats, 'getExportFormatName');
+ // Try to default to the format the user used last time. If you just
+ // exported to Excel, you probably want to export to Excel again.
+ $format_key = $this->readExportFormatPreference();
+ if (!isset($formats[$format_key])) {
+ $format_key = head_key($format_options);
+ }
+
$errors = array();
$e_format = null;
@@ -434,6 +441,8 @@
}
if (!$errors) {
+ $this->writeExportFormatPreference($format_key);
+
$query = $engine->buildQueryFromSavedQuery($saved_query);
// NOTE: We aren't reading the pager from the request. Exports always
@@ -497,6 +506,7 @@
->setName('format')
->setLabel(pht('Format'))
->setError($e_format)
+ ->setValue($format_key)
->setOptions($format_options));
return $this->newDialog()
@@ -912,4 +922,32 @@
return true;
}
+ private function readExportFormatPreference() {
+ $viewer = $this->getViewer();
+ $export_key = PhabricatorPolicyFavoritesSetting::SETTINGKEY;
+ return $viewer->getUserSetting($export_key);
+ }
+
+ private function writeExportFormatPreference($value) {
+ $viewer = $this->getViewer();
+ $request = $this->getRequest();
+
+ if (!$viewer->isLoggedIn()) {
+ return;
+ }
+
+ $export_key = PhabricatorPolicyFavoritesSetting::SETTINGKEY;
+ $preferences = PhabricatorUserPreferences::loadUserPreferences($viewer);
+
+ $editor = id(new PhabricatorUserPreferencesEditor())
+ ->setActor($viewer)
+ ->setContentSourceFromRequest($request)
+ ->setContinueOnNoEffect(true)
+ ->setContinueOnMissingFields(true);
+
+ $xactions = array();
+ $xactions[] = $preferences->newTransaction($export_key, $value);
+ $editor->applyTransactions($preferences, $xactions);
+ }
+
}
diff --git a/src/infrastructure/export/engine/PhabricatorExportFormatSetting.php b/src/infrastructure/export/engine/PhabricatorExportFormatSetting.php
new file mode 100644
--- /dev/null
+++ b/src/infrastructure/export/engine/PhabricatorExportFormatSetting.php
@@ -0,0 +1,16 @@
+<?php
+
+final class PhabricatorExportFormatSetting
+ extends PhabricatorInternalSetting {
+
+ const SETTINGKEY = 'export.format';
+
+ public function getSettingName() {
+ return pht('Export Format');
+ }
+
+ public function getSettingDefaultValue() {
+ return null;
+ }
+
+}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Mar 16, 12:43 PM (6 d, 10 h ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7707053
Default Alt Text
D18957.id45456.diff (4 KB)
Attached To
Mode
D18957: Make the data export format selector remember your last setting
Attached
Detach File
Event Timeline
Log In to Comment