From ec045b251c5e42ce3762f3aefc0936581fd21030 Mon Sep 17 00:00:00 2001 From: Bjoern Schiessle Date: Fri, 9 May 2014 14:58:33 +0200 Subject: [PATCH 1/5] hide input field if default expire date isn't activated --- settings/css/settings.css | 3 ++- settings/js/admin.js | 8 +++++++ settings/templates/admin.php | 44 ++++++++++++++++++------------------ 3 files changed, 32 insertions(+), 23 deletions(-) diff --git a/settings/css/settings.css b/settings/css/settings.css index 5d8f9a7541c..2056e567b38 100644 --- a/settings/css/settings.css +++ b/settings/css/settings.css @@ -132,7 +132,8 @@ table.grid td.date{ span.securitywarning {color:#C33; font-weight:bold; } span.connectionwarning {color:#933; font-weight:bold; } table.shareAPI td { padding-bottom: 0.8em; } -table.shareAPI input#shareapi_expire_after_n_days {width: 25px;} +table.shareAPI input#shareapiExpireAfterNDays {width: 25px;} +table.shareAPI .indent { padding-left: 2em; } #mail_settings p label:first-child { display: inline-block; diff --git a/settings/js/admin.js b/settings/js/admin.js index c04c0505deb..cd11e68442a 100644 --- a/settings/js/admin.js +++ b/settings/js/admin.js @@ -31,6 +31,14 @@ $(document).ready(function(){ OC.AppConfig.setValue('core', $(this).attr('name'), value); }); + $('#shareapiDefaultExpireDate').change(function() { + $("#setDefaultExpireDate").toggleClass('hidden', !this.checked); + }); + + $('#allowLinks').change(function() { + $("#publicLinkSettings").toggleClass('hidden', !this.checked); + }); + $('#security').change(function(){ $.post(OC.filePath('settings','ajax','setsecurity.php'), { enforceHTTPS: $('#forcessl').val() },function(){} ); }); diff --git a/settings/templates/admin.php b/settings/templates/admin.php index d8a800ca202..4d453b01270 100644 --- a/settings/templates/admin.php +++ b/settings/templates/admin.php @@ -217,15 +217,31 @@ if (!$_['internetconnectionworking']) { />
- t('Allow users to share items to the public with links')); ?> - - - - > + +
id="publicLinkSettings"> + />
- t('Allow users to enable others to upload into their publicly shared folders')); ?> + + /> +
+
> + t( 'Expire after ' )); ?> + ' /> + t( 'days' )); ?> + /> +
+
+ +
+ t('Allow users to share items to the public with links')); ?> + + + @@ -255,22 +271,6 @@ if (!$_['internetconnectionworking']) { - - > - /> -
- t( 'Expire after ' )); ?> - ' /> - t( 'days' )); ?> - /> -
- t('Expire shares by default after N days')); ?> - - - From d56d03e230a20a621113a2b90064f331b3952f1b Mon Sep 17 00:00:00 2001 From: Bjoern Schiessle Date: Fri, 9 May 2014 16:36:20 +0200 Subject: [PATCH 2/5] add information about default expire date to the share dialog --- core/css/share.css | 2 +- core/js/config.php | 15 +++++++++++++++ core/js/share.js | 14 +++++++++++++- 3 files changed, 29 insertions(+), 2 deletions(-) diff --git a/core/css/share.css b/core/css/share.css index 4ae3b77757e..ccd1bd65c73 100644 --- a/core/css/share.css +++ b/core/css/share.css @@ -11,7 +11,7 @@ margin-right:112px; position:absolute; right:0; - width:320px; + width:380px; z-index:500; padding:16px; } diff --git a/core/js/config.php b/core/js/config.php index 7e23f3e2e41..9169cc14a7b 100644 --- a/core/js/config.php +++ b/core/js/config.php @@ -25,6 +25,13 @@ foreach(OC_App::getEnabledApps() as $app) { $apps_paths[$app] = OC_App::getAppWebPath($app); } +$defaultExpireDateEnabled = \OCP\Config::getAppValue('core', 'shareapi_default_expire_date', 'no'); +$defaultExpireDate = $enforceDefaultExpireDate = null; +if ($defaultExpireDateEnabled === 'yes') { + $defaultExpireDate = \OCP\Config::getAppValue('core', 'shareapi_expire_after_n_days', '7'); + $enforceDefaultExpireDate = \OCP\Config::getAppValue('core', 'shareapi_enforce_expire_date', 'no'); +} + $array = array( "oc_debug" => (defined('DEBUG') && DEBUG) ? 'true' : 'false', "oc_isadmin" => OC_User::isAdminUser(OC_User::getUser()) ? 'true' : 'false', @@ -67,6 +74,14 @@ $array = array( 'versionstring' => OC_Util::getVersionString(), ) ), + "oc_appconfig" => json_encode( + array("core" => array( + 'defaultExpireDateEnabled' => $defaultExpireDateEnabled, + 'defaultExpireDate' => $defaultExpireDate, + 'defaultExpireDateEnforced' => $enforceDefaultExpireDate, + ) + ) + ), "oc_defaults" => json_encode( array( 'entity' => $defaults->getEntity(), diff --git a/core/js/share.js b/core/js/share.js index 2813570f718..2d9de62694b 100644 --- a/core/js/share.js +++ b/core/js/share.js @@ -219,7 +219,18 @@ OC.Share={ html += '