]> source.dussan.org Git - nextcloud-server.git/commitdiff
add information about default expire date to the share dialog
authorBjoern Schiessle <schiessle@owncloud.com>
Fri, 9 May 2014 14:36:20 +0000 (16:36 +0200)
committerBjoern Schiessle <schiessle@owncloud.com>
Tue, 13 May 2014 09:28:25 +0000 (11:28 +0200)
core/css/share.css
core/js/config.php
core/js/share.js

index 4ae3b77757e68fdd5ccfd6bee88728cb54760f7e..ccd1bd65c7334428af4667729b888c44a66432b3 100644 (file)
@@ -11,7 +11,7 @@
        margin-right:112px;
        position:absolute;
        right:0;
-       width:320px;
+       width:380px;
        z-index:500;
        padding:16px;
 }
index 7e23f3e2e41bf686aa94c174047bff2b6424786f..9169cc14a7b77d82ca0b050372af2528922e6296 100644 (file)
@@ -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(),
index 2813570f718d91bbce3a8bcc9def35fd18d4ffe6..2d9de62694b75681e2b5bd0860a4376648f9d674 100644 (file)
@@ -219,7 +219,18 @@ OC.Share={
                                html += '<div id="link">';
                                html += '<input type="checkbox" name="linkCheckbox" id="linkCheckbox" value="1" /><label for="linkCheckbox">'+t('core', 'Share link')+'</label>';
                                html += '<br />';
+
+                               var defaultExpireMessage = '';
+                               if ((itemType === 'folder' || itemType === 'file') && oc_appconfig.core.defaultExpireDateEnabled === 'yes') {
+                                       if (oc_appconfig.core.defaultExpireDateEnforced === 'yes') {
+                                               defaultExpireMessage = t('core', 'The public link will expire no later than {days} days after it is created',  {'days': oc_appconfig.core.defaultExpireDate}) + '<br/>';
+                                       } else {
+                                               defaultExpireMessage = t('core', 'By default the public link will expire after {days} days', {'days': oc_appconfig.core.defaultExpireDate}) + '<br/>';
+                                       }
+                               }
+                               html += '<div id="defaultExpireMessage">'+defaultExpireMessage+'</div>';
                                html += '<input id="linkText" type="text" readonly="readonly" />';
+
                                html += '<input type="checkbox" name="showPassword" id="showPassword" value="1" style="display:none;" /><label for="showPassword" style="display:none;">'+t('core', 'Password protect')+'</label>';
                                html += '<div id="linkPass">';
                                html += '<input id="linkPassText" type="password" placeholder="'+t('core', 'Password')+'" />';
@@ -490,19 +501,20 @@ OC.Share={
                        $('#linkPassText').attr('placeholder', '**********');
                }
                $('#expiration').show();
+               $('#defaultExpireMessage').show();
                $('#emailPrivateLink #email').show();
                $('#emailPrivateLink #emailButton').show();
                $('#allowPublicUploadWrapper').show();
        },
        hideLink:function() {
                $('#linkText').hide('blind');
+               $('#defaultExpireMessage').hide();
                $('#showPassword').hide();
                $('#showPassword+label').hide();
                $('#linkPass').hide();
                $('#emailPrivateLink #email').hide();
                $('#emailPrivateLink #emailButton').hide();
                $('#allowPublicUploadWrapper').hide();
-               $('#expirationDate').hide();
        },
        dirname:function(path) {
                return path.replace(/\\/g,'/').replace(/\/[^\/]*$/, '');