From 01dee35ebe1f3ab0e8a7f986015a9fa43a80b061 Mon Sep 17 00:00:00 2001 From: Guillaume AMAT Date: Thu, 13 Feb 2014 10:47:03 +0100 Subject: Adds OC_Defaults values in javascript config --- core/js/config.php | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'core/js') diff --git a/core/js/config.php b/core/js/config.php index 517ea1615a8..7ec0904ec3d 100644 --- a/core/js/config.php +++ b/core/js/config.php @@ -16,6 +16,9 @@ header("Expires: Sat, 26 Jul 1997 05:00:00 GMT"); // Enable l10n support $l = OC_L10N::get('core'); +// Enable OC_Defaults support +$defaults = new OC_Defaults(); + // Get the config $apps_paths = array(); foreach(OC_App::getEnabledApps() as $app) { @@ -60,6 +63,20 @@ $array = array( 'session_lifetime' => \OCP\Config::getSystemValue('session_lifetime', 60 * 60 * 24), 'session_keepalive' => \OCP\Config::getSystemValue('session_keepalive', true) ) + ), + "oc_defaults" => json_encode( + array( + 'entity' => $defaults->getEntity(), + 'name' => $defaults->getName(), + 'title' => $defaults->getTitle(), + 'baseUrl' => $defaults->getBaseUrl(), + 'syncClientUrl' => $defaults->getSyncClientUrl(), + 'docBaseUrl' => $defaults->getDocBaseUrl(), + 'slogan' => $defaults->getSlogan(), + 'logoClaim' => $defaults->getLogoClaim(), + 'shortFooter' => $defaults->getShortFooter(), + 'longFooter' => $defaults->getLongFooter() + ) ) ); -- cgit v1.2.3 From fdb0d2067ff66017a3cae76f1da7b18e94dc5364 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Wed, 19 Feb 2014 10:20:52 +0100 Subject: Remove duplicated definition and move OC.msg to js/js.js Fix issue #7166 --- apps/files_encryption/js/settings-admin.js | 22 ---------------------- core/js/js.js | 28 ++++++++++++++++++++++++++++ settings/js/admin.js | 22 ---------------------- settings/js/personal.js | 22 ---------------------- 4 files changed, 28 insertions(+), 66 deletions(-) (limited to 'core/js') diff --git a/apps/files_encryption/js/settings-admin.js b/apps/files_encryption/js/settings-admin.js index c2140a6f1eb..785d02002fa 100644 --- a/apps/files_encryption/js/settings-admin.js +++ b/apps/files_encryption/js/settings-admin.js @@ -7,28 +7,6 @@ * See the COPYING-README file. */ -OC.msg={ - startSaving:function(selector){ - $(selector) - .html( t('settings', 'Saving...') ) - .removeClass('success') - .removeClass('error') - .stop(true, true) - .show(); - }, - finishedSaving:function(selector, data){ - if( data.status === "success" ){ - $(selector).html( data.data.message ) - .addClass('success') - .stop(true, true) - .delay(3000) - .fadeOut(900); - }else{ - $(selector).html( data.data.message ).addClass('error'); - } - } -}; - $(document).ready(function(){ // Trigger ajax on recoveryAdmin status change var enabledStatus = $('#adminEnableRecovery').val(); diff --git a/core/js/js.js b/core/js/js.js index cb177712a3a..ac79f13a6d1 100644 --- a/core/js/js.js +++ b/core/js/js.js @@ -467,6 +467,34 @@ OC.search.lastResults={}; OC.addStyle.loaded=[]; OC.addScript.loaded=[]; +OC.msg={ + startSaving:function(selector, message){ + OC.msg.startAction(selector, t('settings', 'Saving...')); + }, + finishedSaving:function(selector, data){ + OC.msg.finishedAction(selector, data); + }, + startAction:function(selector, message){ + $(selector) + .html( message ) + .removeClass('success') + .removeClass('error') + .stop(true, true) + .show(); + }, + finishedAction:function(selector, data){ + if( data.status === "success" ){ + $(selector).html( data.data.message ) + .addClass('success') + .stop(true, true) + .delay(3000) + .fadeOut(900); + }else{ + $(selector).html( data.data.message ).addClass('error'); + } + } +}; + OC.Notification={ queuedNotifications: [], getDefaultNotificationFunction: null, diff --git a/settings/js/admin.js b/settings/js/admin.js index f39f53d413a..923e267513e 100644 --- a/settings/js/admin.js +++ b/settings/js/admin.js @@ -51,25 +51,3 @@ $(document).ready(function(){ }); }); }); - -OC.msg={ - startSaving:function(selector){ - $(selector) - .html( t('settings', 'Saving...') ) - .removeClass('success') - .removeClass('error') - .stop(true, true) - .show(); - }, - finishedSaving:function(selector, data){ - if( data.status === "success" ){ - $(selector).html( data.data.message ) - .addClass('success') - .stop(true, true) - .delay(3000) - .fadeOut(900); - }else{ - $(selector).html( data.data.message ).addClass('error'); - } - } -}; diff --git a/settings/js/personal.js b/settings/js/personal.js index 3b876467756..cff149db55b 100644 --- a/settings/js/personal.js +++ b/settings/js/personal.js @@ -313,25 +313,3 @@ OC.Encryption.msg={ } } }; - -OC.msg={ - startSaving:function(selector){ - $(selector) - .html( t('settings', 'Saving...') ) - .removeClass('success') - .removeClass('error') - .stop(true, true) - .show(); - }, - finishedSaving:function(selector, data){ - if( data.status === "success" ){ - $(selector).html( data.data.message ) - .addClass('success') - .stop(true, true) - .delay(3000) - .fadeOut(900); - }else{ - $(selector).html( data.data.message ).addClass('error'); - } - } -}; -- cgit v1.2.3 From 16262e3fd2c00475cc3b43a2684a45cc8ae70829 Mon Sep 17 00:00:00 2001 From: Lukas Reschke Date: Wed, 19 Feb 2014 17:56:12 +0100 Subject: Move isadmin to template and rename it to oc_isadmin --- core/js/js.js | 1 + core/templates/layout.user.php | 2 +- settings/js/isadmin.php | 20 -------------------- settings/js/users.js | 4 ++-- settings/routes.php | 2 -- settings/templates/users.php | 2 -- 6 files changed, 4 insertions(+), 27 deletions(-) delete mode 100644 settings/js/isadmin.php (limited to 'core/js') diff --git a/core/js/js.js b/core/js/js.js index d4d2583f1e5..3b3e0e99455 100644 --- a/core/js/js.js +++ b/core/js/js.js @@ -10,6 +10,7 @@ var oc_webroot; var oc_current_user = document.getElementsByTagName('head')[0].getAttribute('data-user'); var oc_requesttoken = document.getElementsByTagName('head')[0].getAttribute('data-requesttoken'); +var oc_isadmin = document.getElementsByTagName('head')[0].getAttribute('data-isAdmin'); window.oc_config = window.oc_config || {}; diff --git a/core/templates/layout.user.php b/core/templates/layout.user.php index bc1c700402e..d46f97852cc 100644 --- a/core/templates/layout.user.php +++ b/core/templates/layout.user.php @@ -6,7 +6,7 @@ - + <?php p(!empty($_['application'])?$_['application'].' - ':''); diff --git a/settings/js/isadmin.php b/settings/js/isadmin.php deleted file mode 100644 index 13a8ba1d312..00000000000 --- a/settings/js/isadmin.php +++ /dev/null @@ -1,20 +0,0 @@ -<?php -/** - * Copyright (c) 2013 Lukas Reschke <lukas@statuscode.ch> - * This file is licensed under the Affero General Public License version 3 or - * later. - * See the COPYING-README file. - */ - -// Set the content type to Javascript -header("Content-type: text/javascript"); - -// Disallow caching -header("Cache-Control: no-cache, must-revalidate"); -header("Expires: Sat, 26 Jul 1997 05:00:00 GMT"); - -if (OC_User::isAdminUser(OC_User::getUser())) { - echo("var isadmin = true;"); -} else { - echo("var isadmin = false;"); -} diff --git a/settings/js/users.js b/settings/js/users.js index 6886db668b5..9872fb27e61 100644 --- a/settings/js/users.js +++ b/settings/js/users.js @@ -248,7 +248,7 @@ var UserList = { if (user === OC.currentUser && group === 'admin') { return false; } - if (!isadmin && checked.length === 1 && checked[0] === group) { + if (!oc_isadmin && checked.length === 1 && checked[0] === group) { return false; } $.post( @@ -280,7 +280,7 @@ var UserList = { }); }; var label; - if (isadmin) { + if (oc_isadmin) { label = t('settings', 'add group'); } else { label = null; diff --git a/settings/routes.php b/settings/routes.php index 60f9d8e1001..895a9f5ccea 100644 --- a/settings/routes.php +++ b/settings/routes.php @@ -72,5 +72,3 @@ $this->create('settings_ajax_setloglevel', '/settings/ajax/setloglevel.php') ->actionInclude('settings/ajax/setloglevel.php'); $this->create('settings_ajax_setsecurity', '/settings/ajax/setsecurity.php') ->actionInclude('settings/ajax/setsecurity.php'); -$this->create('isadmin', '/settings/js/isadmin.js') - ->actionInclude('settings/js/isadmin.php'); diff --git a/settings/templates/users.php b/settings/templates/users.php index aabda0fac2f..937b40611b0 100644 --- a/settings/templates/users.php +++ b/settings/templates/users.php @@ -14,8 +14,6 @@ unset($items['admin']); $_['subadmingroups'] = array_flip($items); ?> -<script type="text/javascript" src="<?php print_unescaped(OC_Helper::linkToRoute('isadmin'));?>"></script> - <div id="controls"> <form id="newuser" autocomplete="off"> <input id="newusername" type="text" placeholder="<?php p($l->t('Login Name'))?>" /> <input -- cgit v1.2.3 From b61f0f11c5aa03240d3c18f02a1c790bd43522c0 Mon Sep 17 00:00:00 2001 From: Lukas Reschke <lukas@statuscode.ch> Date: Thu, 20 Feb 2014 10:26:05 +0100 Subject: Move oc_isadmin to the config JS script --- core/js/config.php | 1 + core/js/js.js | 1 - core/templates/layout.user.php | 2 +- 3 files changed, 2 insertions(+), 2 deletions(-) (limited to 'core/js') diff --git a/core/js/config.php b/core/js/config.php index b6875fb73f9..6185be523e7 100644 --- a/core/js/config.php +++ b/core/js/config.php @@ -24,6 +24,7 @@ foreach(OC_App::getEnabledApps() as $app) { $array = array( "oc_debug" => (defined('DEBUG') && DEBUG) ? 'true' : 'false', + "ox_isadmin" => p(OC_User::isAdminUser(OC_User::getUser()) ? 'true' : 'false'); "oc_webroot" => "\"".OC::$WEBROOT."\"", "oc_appswebroots" => str_replace('\\/', '/', json_encode($apps_paths)), // Ugly unescape slashes waiting for better solution "datepickerFormatDate" => json_encode($l->l('jsdate', 'jsdate')), diff --git a/core/js/js.js b/core/js/js.js index 3b3e0e99455..d4d2583f1e5 100644 --- a/core/js/js.js +++ b/core/js/js.js @@ -10,7 +10,6 @@ var oc_webroot; var oc_current_user = document.getElementsByTagName('head')[0].getAttribute('data-user'); var oc_requesttoken = document.getElementsByTagName('head')[0].getAttribute('data-requesttoken'); -var oc_isadmin = document.getElementsByTagName('head')[0].getAttribute('data-isAdmin'); window.oc_config = window.oc_config || {}; diff --git a/core/templates/layout.user.php b/core/templates/layout.user.php index d46f97852cc..bc1c700402e 100644 --- a/core/templates/layout.user.php +++ b/core/templates/layout.user.php @@ -6,7 +6,7 @@ <!--[if gt IE 9]><html class="ng-csp ie"><![endif]--> <!--[if !IE]><!--><html class="ng-csp"><!--<![endif]--> - <head data-isAdmin="<?php p(OC_User::isAdminUser(OC_User::getUser()) ? 'true' : 'false'); ?>" data-user="<?php p($_['user_uid']); ?>" data-requesttoken="<?php p($_['requesttoken']); ?>"> + <head data-user="<?php p($_['user_uid']); ?>" data-requesttoken="<?php p($_['requesttoken']); ?>"> <title> <?php p(!empty($_['application'])?$_['application'].' - ':''); -- cgit v1.2.3 From ba7a79372a1e7f29f8f9de015fcc8500b6fed8dc Mon Sep 17 00:00:00 2001 From: Lukas Reschke <lukas@statuscode.ch> Date: Thu, 20 Feb 2014 10:28:11 +0100 Subject: Variable value is expected and not an echoed output --- core/js/config.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'core/js') diff --git a/core/js/config.php b/core/js/config.php index 6185be523e7..a9fd9d01098 100644 --- a/core/js/config.php +++ b/core/js/config.php @@ -24,7 +24,7 @@ foreach(OC_App::getEnabledApps() as $app) { $array = array( "oc_debug" => (defined('DEBUG') && DEBUG) ? 'true' : 'false', - "ox_isadmin" => p(OC_User::isAdminUser(OC_User::getUser()) ? 'true' : 'false'); + "ox_isadmin" => OC_User::isAdminUser(OC_User::getUser()) ? 'true' : 'false', "oc_webroot" => "\"".OC::$WEBROOT."\"", "oc_appswebroots" => str_replace('\\/', '/', json_encode($apps_paths)), // Ugly unescape slashes waiting for better solution "datepickerFormatDate" => json_encode($l->l('jsdate', 'jsdate')), -- cgit v1.2.3 From 3ce77a35e5eeb22b580e243e50a2daeba761d7fc Mon Sep 17 00:00:00 2001 From: Thomas Müller <thomas.mueller@tmit.eu> Date: Thu, 20 Feb 2014 10:42:54 +0100 Subject: fixing js syntax error --- core/js/tags.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'core/js') diff --git a/core/js/tags.js b/core/js/tags.js index 16dd3d4bf97..bc6d7b4e071 100644 --- a/core/js/tags.js +++ b/core/js/tags.js @@ -25,11 +25,11 @@ OC.Tags= { }); self.deleteButton = { text: t('core', 'Delete'), - click: function() {self._deleteTags(self, type, self._selectedIds())}, + click: function() {self._deleteTags(self, type, self._selectedIds())} }; self.addButton = { text: t('core', 'Add'), - click: function() {self._addTag(self, type, self.$taginput.val())}, + click: function() {self._addTag(self, type, self.$taginput.val())} }; self._fillTagList(type, self.$taglist); @@ -349,5 +349,5 @@ OC.Tags= { console.warn(response); }); } -} +}; -- cgit v1.2.3 From 169f4cf7ff26932ec1e07bfc3676f22c06859db7 Mon Sep 17 00:00:00 2001 From: Lukas Reschke <lukas@statuscode.ch> Date: Thu, 20 Feb 2014 12:51:15 +0100 Subject: Fix typo --- core/js/config.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'core/js') diff --git a/core/js/config.php b/core/js/config.php index a9fd9d01098..139c3b6d485 100644 --- a/core/js/config.php +++ b/core/js/config.php @@ -24,7 +24,7 @@ foreach(OC_App::getEnabledApps() as $app) { $array = array( "oc_debug" => (defined('DEBUG') && DEBUG) ? 'true' : 'false', - "ox_isadmin" => OC_User::isAdminUser(OC_User::getUser()) ? 'true' : 'false', + "oc_isadmin" => OC_User::isAdminUser(OC_User::getUser()) ? 'true' : 'false', "oc_webroot" => "\"".OC::$WEBROOT."\"", "oc_appswebroots" => str_replace('\\/', '/', json_encode($apps_paths)), // Ugly unescape slashes waiting for better solution "datepickerFormatDate" => json_encode($l->l('jsdate', 'jsdate')), -- cgit v1.2.3 From 92d57cb5a7de41e576c9cbd3fae70e9802561187 Mon Sep 17 00:00:00 2001 From: Jan-Christoph Borchardt <hey@jancborchardt.net> Date: Thu, 20 Feb 2014 13:36:52 +0100 Subject: move avatar into clickable area of user menu --- core/css/styles.css | 8 ++++---- core/js/js.js | 4 +++- core/templates/layout.user.php | 6 +++--- 3 files changed, 10 insertions(+), 8 deletions(-) (limited to 'core/js') diff --git a/core/css/styles.css b/core/css/styles.css index c17d0a9bc07..1c80a3ea160 100644 --- a/core/css/styles.css +++ b/core/css/styles.css @@ -37,11 +37,12 @@ body { background:#fefefe; font:normal .8em/1.6em "Helvetica Neue",Helvetica,Ari .header-right { float:right; vertical-align:middle; padding:0.5em; } .header-right > * { vertical-align:middle; } +/* Profile picture in header */ #header .avatardiv { float: left; display: inline-block; + margin-right: 5px; } - #header .avatardiv img { opacity: 1; } @@ -708,12 +709,11 @@ label.infield { cursor:text !important; top:1.05em; left:.85em; } /* USER MENU */ #settings { float: right; - margin-top: 7px; - margin-left: 10px; color: #bbb; } #expand { - padding: 15px 15px 15px 5px; + display: block; + padding: 7px 12px 6px 7px; cursor: pointer; font-weight: bold; } diff --git a/core/js/js.js b/core/js/js.js index d4d2583f1e5..59d48806418 100644 --- a/core/js/js.js +++ b/core/js/js.js @@ -860,6 +860,7 @@ function initCore() { // checkShowCredentials(); // $('input#user, input#password').keyup(checkShowCredentials); + // user menu $('#settings #expand').keydown(function(event) { if (event.which === 13 || event.which === 32) { $('#expand').click() @@ -872,7 +873,8 @@ function initCore() { $('#settings #expanddiv').click(function(event){ event.stopPropagation(); }); - $(document).click(function(){//hide the settings menu when clicking outside it + //hide the user menu when clicking outside it + $(document).click(function(){ $('#settings #expanddiv').slideUp(200); }); diff --git a/core/templates/layout.user.php b/core/templates/layout.user.php index bc1c700402e..8b9e1e0f4fe 100644 --- a/core/templates/layout.user.php +++ b/core/templates/layout.user.php @@ -50,12 +50,12 @@ <div id="logo-claim" style="display:none;"><?php p($theme->getLogoClaim()); ?></div> <div id="settings" class="svg"> <span id="expand" tabindex="0" role="link"> + <?php if ($_['enableAvatars']): ?> + <div class="avatardiv"></div> + <?php endif; ?> <span id="expandDisplayName"><?php p(trim($_['user_displayname']) != '' ? $_['user_displayname'] : $_['user_uid']) ?></span> <img class="svg" alt="" src="<?php print_unescaped(image_path('', 'actions/caret.svg')); ?>" /> </span> - <?php if ($_['enableAvatars']): ?> - <div class="avatardiv"></div> - <?php endif; ?> <div id="expanddiv"> <ul> <?php foreach($_['settingsnavigation'] as $entry):?> -- cgit v1.2.3 From 20b740f8e4674ab16f44127bc809a35b8db24910 Mon Sep 17 00:00:00 2001 From: Jan-Christoph Borchardt <hey@jancborchardt.net> Date: Thu, 20 Feb 2014 13:37:23 +0100 Subject: do not show display name on mobile when profile picture is present --- core/css/mobile.css | 6 ++++++ core/js/avatar.js | 9 ++++++++- core/js/jquery.avatar.js | 10 +++++++++- settings/js/personal.js | 2 ++ 4 files changed, 25 insertions(+), 2 deletions(-) (limited to 'core/js') diff --git a/core/css/mobile.css b/core/css/mobile.css index a4cca6f37f6..65c756aa91a 100644 --- a/core/css/mobile.css +++ b/core/css/mobile.css @@ -17,4 +17,10 @@ transition: width 100ms; } +/* do not show display name on mobile when profile picture is present */ +#header .avatardiv.avatardiv-shown + #expandDisplayName { + display: none; +} + + } diff --git a/core/js/avatar.js b/core/js/avatar.js index c54c4068768..67d6b9b7b95 100644 --- a/core/js/avatar.js +++ b/core/js/avatar.js @@ -1,6 +1,13 @@ $(document).ready(function(){ if (OC.currentUser) { - $('#header .avatardiv').avatar(OC.currentUser, 32, undefined, true); + var callback = function() { + // do not show display name on mobile when profile picture is present + if($('#header .avatardiv').children().length > 0) { + $('#header .avatardiv').addClass('avatardiv-shown'); + } + }; + + $('#header .avatardiv').avatar(OC.currentUser, 32, undefined, true, callback); // Personal settings $('#avatar .avatardiv').avatar(OC.currentUser, 128); } diff --git a/core/js/jquery.avatar.js b/core/js/jquery.avatar.js index 6012eccfad6..02a40c088b4 100644 --- a/core/js/jquery.avatar.js +++ b/core/js/jquery.avatar.js @@ -39,10 +39,15 @@ * This will behave like the first example, but it will hide the avatardiv, if * it will display the default placeholder. undefined is the ie8fix from * example 4 and can be either true, or false/undefined, to be ignored. + * + * 6. $('.avatardiv').avatar('jdoe', 128, undefined, true, callback); + * This will behave like the above example, but it will call the function + * defined in callback after the avatar is placed into the DOM. + * */ (function ($) { - $.fn.avatar = function(user, size, ie8fix, hidedefault) { + $.fn.avatar = function(user, size, ie8fix, hidedefault, callback) { if (typeof(size) === 'undefined') { if (this.height() > 0) { size = this.height(); @@ -91,6 +96,9 @@ $div.html('<img src="'+url+'">'); } } + if(typeof callback === 'function') { + callback(); + } }); }); }; diff --git a/settings/js/personal.js b/settings/js/personal.js index ef261b50bbc..5944272067b 100644 --- a/settings/js/personal.js +++ b/settings/js/personal.js @@ -52,9 +52,11 @@ function updateAvatar (hidedefault) { if(hidedefault) { $headerdiv.hide(); + $('#header .avatardiv').removeClass('avatardiv-shown'); } else { $headerdiv.css({'background-color': ''}); $headerdiv.avatar(OC.currentUser, 32, true); + $('#header .avatardiv').addClass('avatardiv-shown'); } $displaydiv.css({'background-color': ''}); $displaydiv.avatar(OC.currentUser, 128, true); -- cgit v1.2.3 From daf28225b7da283763ec84930608e154f49dee46 Mon Sep 17 00:00:00 2001 From: Robin Appelman <icewind@owncloud.com> Date: Thu, 20 Feb 2014 18:42:59 +0100 Subject: fix viewport size on windows phone --- core/js/js.js | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'core/js') diff --git a/core/js/js.js b/core/js/js.js index d4d2583f1e5..c7024430aa7 100644 --- a/core/js/js.js +++ b/core/js/js.js @@ -987,6 +987,17 @@ OC.set=function(name, value) { context[tail]=value; }; +// fix device width on windows phone +(function() { + if ("-ms-user-select" in document.documentElement.style && navigator.userAgent.match(/IEMobile\/10\.0/)) { + var msViewportStyle = document.createElement("style"); + msViewportStyle.appendChild( + document.createTextNode("@-ms-viewport{width:auto!important}") + ); + document.getElementsByTagName("head")[0].appendChild(msViewportStyle); + } +})(); + /** * select a range in an input field * @link http://stackoverflow.com/questions/499126/jquery-set-cursor-position-in-text-area -- cgit v1.2.3 From 58be2eb955b8c23a8698bdbb7bae8077eb402ee3 Mon Sep 17 00:00:00 2001 From: ringmaster <epithet@gmail.com> Date: Thu, 20 Feb 2014 18:13:27 -0500 Subject: Allow apps to add/modify config js output via hook. --- core/js/config.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'core/js') diff --git a/core/js/config.php b/core/js/config.php index 139c3b6d485..edb9ccfd0fb 100644 --- a/core/js/config.php +++ b/core/js/config.php @@ -10,8 +10,8 @@ header("Content-type: text/javascript"); // Disallow caching -header("Cache-Control: no-cache, must-revalidate"); -header("Expires: Sat, 26 Jul 1997 05:00:00 GMT"); +header("Cache-Control: no-cache, must-revalidate"); +header("Expires: Sat, 26 Jul 1997 05:00:00 GMT"); // Enable l10n support $l = OC_L10N::get('core'); @@ -62,7 +62,10 @@ $array = array( 'session_keepalive' => \OCP\Config::getSystemValue('session_keepalive', true) ) ) - ); +); + +// Allow hooks to modify the output values +OC_Hook::emit('\OCP\Config', 'js', array('array' => &$array)); // Echo it foreach ($array as $setting => $value) { -- cgit v1.2.3 From d9e333c0da352eea6731f66e7c89f63edd837426 Mon Sep 17 00:00:00 2001 From: Jörn Friedrich Dreyer <jfd@butonic.de> Date: Fri, 21 Feb 2014 11:18:23 +0100 Subject: use directory from original instead of current dir --- core/js/oc-dialogs.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'core/js') diff --git a/core/js/oc-dialogs.js b/core/js/oc-dialogs.js index f4e3ec01447..d1bcb4659b8 100644 --- a/core/js/oc-dialogs.js +++ b/core/js/oc-dialogs.js @@ -293,7 +293,7 @@ var OCdialogs = { conflict.find('.replacement .size').text(humanFileSize(replacement.size)); conflict.find('.replacement .mtime').text(formatDate(replacement.lastModifiedDate)); } - var path = getPathForPreview(original.name); + var path = original.directory + '/' +original.name; Files.lazyLoadPreview(path, original.mime, function(previewpath){ conflict.find('.original .icon').css('background-image','url('+previewpath+')'); }, 96, 96, original.etag); -- cgit v1.2.3 From 80c61d480cfe0964707a9044738526a853c1211f Mon Sep 17 00:00:00 2001 From: Vincent Petry <pvince81@owncloud.com> Date: Mon, 24 Feb 2014 09:45:02 +0100 Subject: Added oc_defaults stub in specHelper.js This is needed for JS Unit tests to run properly as they are expecting the new "oc_default" map to exist. --- core/js/tests/specHelper.js | 1 + 1 file changed, 1 insertion(+) (limited to 'core/js') diff --git a/core/js/tests/specHelper.js b/core/js/tests/specHelper.js index 1848d08354e..b1193240580 100644 --- a/core/js/tests/specHelper.js +++ b/core/js/tests/specHelper.js @@ -63,6 +63,7 @@ window.oc_config = { session_lifetime: 600 * 1000, session_keepalive: false }; +window.oc_defaults = {}; // global setup for all tests (function setupTests() { -- cgit v1.2.3 From cb14b1c58dbfc605352193020cdbf19da797bb69 Mon Sep 17 00:00:00 2001 From: Joas Schilling <nickvergessen@gmx.de> Date: Wed, 26 Feb 2014 11:40:41 +0100 Subject: Add owncloud version to JS scope Fix #5361 --- core/js/config.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'core/js') diff --git a/core/js/config.php b/core/js/config.php index c606ef35056..7e23f3e2e41 100644 --- a/core/js/config.php +++ b/core/js/config.php @@ -61,8 +61,10 @@ $array = array( "firstDay" => json_encode($l->l('firstday', 'firstday')) , "oc_config" => json_encode( array( - 'session_lifetime' => \OCP\Config::getSystemValue('session_lifetime', ini_get('session.gc_maxlifetime')), - 'session_keepalive' => \OCP\Config::getSystemValue('session_keepalive', true) + 'session_lifetime' => \OCP\Config::getSystemValue('session_lifetime', ini_get('session.gc_maxlifetime')), + 'session_keepalive' => \OCP\Config::getSystemValue('session_keepalive', true), + 'version' => implode('.', OC_Util::getVersion()), + 'versionstring' => OC_Util::getVersionString(), ) ), "oc_defaults" => json_encode( -- cgit v1.2.3 From 9847912257de1910f99879caac8ea925fb85caed Mon Sep 17 00:00:00 2001 From: Joas Schilling <nickvergessen@gmx.de> Date: Wed, 26 Feb 2014 13:10:46 +0100 Subject: Remove unused variables, add doc blocks and break lines Fix #7166 --- core/js/js.js | 4 ++-- settings/admin/controller.php | 18 ++++++++++++++---- settings/js/admin.js | 2 +- settings/templates/admin.php | 29 ++++++++++++++++++++--------- 4 files changed, 37 insertions(+), 16 deletions(-) (limited to 'core/js') diff --git a/core/js/js.js b/core/js/js.js index ac79f13a6d1..88b70723dd1 100644 --- a/core/js/js.js +++ b/core/js/js.js @@ -468,8 +468,8 @@ OC.addStyle.loaded=[]; OC.addScript.loaded=[]; OC.msg={ - startSaving:function(selector, message){ - OC.msg.startAction(selector, t('settings', 'Saving...')); + startSaving:function(selector){ + OC.msg.startAction(selector, t('core', 'Saving...')); }, finishedSaving:function(selector, data){ OC.msg.finishedAction(selector, data); diff --git a/settings/admin/controller.php b/settings/admin/controller.php index 9bbcd356580..a075d774361 100644 --- a/settings/admin/controller.php +++ b/settings/admin/controller.php @@ -20,7 +20,10 @@ namespace OC\Settings\Admin; class Controller { - public static function setMailSettings($args) { + /** + * Set mail settings + */ + public static function setMailSettings() { \OC_Util::checkAdminUser(); \OCP\JSON::callCheck(); @@ -70,14 +73,21 @@ class Controller { \OC_JSON::success(array("data" => array( "message" => $l->t("Saved") ))); } + /** + * Get the field name to use it in error messages + * + * @param $setting string + * @param $l \OC_L10N + * @return string + */ public static function getFieldname($setting, $l) { switch ($setting) { case 'mail_smtpmode': - return $l->t( 'SMTP mode' ); + return $l->t( 'Send mode' ); case 'mail_smtpsecure': - return $l->t( 'Secure SMTP' ); + return $l->t( 'Encryption' ); case 'mail_smtpauthtype': - return $l->t( 'Authentification method for SMTP' ); + return $l->t( 'Authentification method' ); } } } diff --git a/settings/js/admin.js b/settings/js/admin.js index e2bc125b8f5..5ea6a5af2df 100644 --- a/settings/js/admin.js +++ b/settings/js/admin.js @@ -44,7 +44,7 @@ $(document).ready(function(){ }); $('#mail_smtpmode').change(function() { - if ($(this).val() != 'smtp') { + if ($(this).val() !== 'smtp') { $('#setting_smtpauth').addClass('hidden'); $('#setting_smtphost').addClass('hidden'); $('#mail_smtpsecure_label').addClass('hidden'); diff --git a/settings/templates/admin.php b/settings/templates/admin.php index 377c05eb4b9..139a9dd076c 100644 --- a/settings/templates/admin.php +++ b/settings/templates/admin.php @@ -288,8 +288,12 @@ if (!$_['internetconnectionworking']) { <?php endforeach;?> </select> - <label id="mail_smtpsecure_label" for="mail_smtpsecure"<?php if ($_['mail_smtpmode'] != 'smtp') print_unescaped(' class="hidden"'); ?>><?php p($l->t( 'Encryption' )); ?></label> - <select name="mail_smtpsecure" id="mail_smtpsecure"<?php if ($_['mail_smtpmode'] != 'smtp') print_unescaped(' class="hidden"'); ?>> + <label id="mail_smtpsecure_label" for="mail_smtpsecure" + <?php if ($_['mail_smtpmode'] != 'smtp') print_unescaped(' class="hidden"'); ?>> + <?php p($l->t( 'Encryption' )); ?> + </label> + <select name="mail_smtpsecure" id="mail_smtpsecure" + <?php if ($_['mail_smtpmode'] != 'smtp') print_unescaped(' class="hidden"'); ?>> <?php foreach ($mail_smtpsecure as $secure => $name): $selected = ''; if ($secure == $_['mail_smtpsecure']): @@ -302,9 +306,11 @@ if (!$_['internetconnectionworking']) { <p> <label for="mail_from_address"><?php p($l->t( 'From address' )); ?></label> - <input type="text" name='mail_from_address' id="mail_from_address" placeholder="<?php p('owncloud')?>" value='<?php p($_['mail_from_address']) ?>' /> + <input type="text" name='mail_from_address' id="mail_from_address" placeholder="<?php p('mail')?>" + value='<?php p($_['mail_from_address']) ?>' /> @ - <input type="text" name='mail_domain' id="mail_domain" placeholder="<?php p('example.com')?>" value='<?php p($_['mail_domain']) ?>' /> + <input type="text" name='mail_domain' id="mail_domain" placeholder="<?php p('example.com')?>" + value='<?php p($_['mail_domain']) ?>' /> </p> <p id="setting_smtpauth" <?php if ($_['mail_smtpmode'] != 'smtp') print_unescaped(' class="hidden"'); ?>> @@ -319,21 +325,26 @@ if (!$_['internetconnectionworking']) { <?php endforeach;?> </select> - <input type="checkbox" name="mail_smtpauth" id="mail_smtpauth" value="1" <?php if ($_['mail_smtpauth']) print_unescaped('checked="checked"'); ?> /> + <input type="checkbox" name="mail_smtpauth" id="mail_smtpauth" value="1" + <?php if ($_['mail_smtpauth']) print_unescaped('checked="checked"'); ?> /> <label for="mail_smtpauth"><?php p($l->t( 'Authentication required' )); ?></label> </p> <p id="setting_smtphost" <?php if ($_['mail_smtpmode'] != 'smtp') print_unescaped(' class="hidden"'); ?>> <label for="mail_smtphost"><?php p($l->t( 'Server address' )); ?></label> - <input type="text" name='mail_smtphost' id="mail_smtphost" placeholder="<?php p('smtp.example.com')?>" value='<?php p($_['mail_smtphost']) ?>' /> + <input type="text" name='mail_smtphost' id="mail_smtphost" placeholder="<?php p('smtp.example.com')?>" + value='<?php p($_['mail_smtphost']) ?>' /> : - <input type="text" name='mail_smtpport' id="mail_smtpport" placeholder="<?php p($l->t('Port'))?>" value='<?php p($_['mail_smtpport']) ?>' /> + <input type="text" name='mail_smtpport' id="mail_smtpport" placeholder="<?php p($l->t('Port'))?>" + value='<?php p($_['mail_smtpport']) ?>' /> </p> <p id="mail_credentials" <?php if (!$_['mail_smtpauth'] || $_['mail_smtpmode'] != 'smtp') print_unescaped(' class="hidden"'); ?>> <label for="mail_smtpname"><?php p($l->t( 'Credentials' )); ?></label> - <input type="text" name='mail_smtpname' id="mail_smtpname" placeholder="<?php p($l->t('SMTP Username'))?>" value='<?php p($_['mail_smtpname']) ?>' /> - <input type="password" name='mail_smtppassword' id="mail_smtppassword" placeholder="<?php p($l->t('SMTP Password'))?>" value='<?php p($_['mail_smtppassword']) ?>' /> + <input type="text" name='mail_smtpname' id="mail_smtpname" placeholder="<?php p($l->t('SMTP Username'))?>" + value='<?php p($_['mail_smtpname']) ?>' /> + <input type="password" name='mail_smtppassword' id="mail_smtppassword" + placeholder="<?php p($l->t('SMTP Password'))?>" value='<?php p($_['mail_smtppassword']) ?>' /> </p> </fieldset> -- cgit v1.2.3