diff options
author | Thomas Müller <thomas.mueller@tmit.eu> | 2014-02-28 14:54:10 +0100 |
---|---|---|
committer | Thomas Müller <thomas.mueller@tmit.eu> | 2014-02-28 14:54:10 +0100 |
commit | 15d1df055b093ecce0c5ae52561dd73584145c7c (patch) | |
tree | 4f2b10bacfa5371e3f2a53122a3165bf94114d01 /core/js | |
parent | 65843e245996c9ecfd167be2b520bb917b32aa7e (diff) | |
parent | dd32091016481b0b6845e03ea87ce419b3cda19e (diff) | |
download | nextcloud-server-15d1df055b093ecce0c5ae52561dd73584145c7c.tar.gz nextcloud-server-15d1df055b093ecce0c5ae52561dd73584145c7c.zip |
Merge branch 'master' into display-share-owner-master
Conflicts:
apps/files_sharing/lib/cache.php
Diffstat (limited to 'core/js')
-rw-r--r-- | core/js/avatar.js | 9 | ||||
-rw-r--r-- | core/js/config.php | 33 | ||||
-rw-r--r-- | core/js/jquery.avatar.js | 10 | ||||
-rw-r--r-- | core/js/js.js | 43 | ||||
-rw-r--r-- | core/js/oc-dialogs.js | 2 | ||||
-rw-r--r-- | core/js/tags.js | 6 | ||||
-rw-r--r-- | core/js/tests/specHelper.js | 1 |
7 files changed, 92 insertions, 12 deletions
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/config.php b/core/js/config.php index b6875fb73f9..7e23f3e2e41 100644 --- a/core/js/config.php +++ b/core/js/config.php @@ -10,12 +10,15 @@ 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'); +// Enable OC_Defaults support +$defaults = new OC_Defaults(); + // Get the config $apps_paths = array(); foreach(OC_App::getEnabledApps() as $app) { @@ -24,6 +27,7 @@ foreach(OC_App::getEnabledApps() as $app) { $array = array( "oc_debug" => (defined('DEBUG') && DEBUG) ? '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')), @@ -57,11 +61,30 @@ $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( + 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() ) ) - ); +); + +// Allow hooks to modify the output values +OC_Hook::emit('\OCP\Config', 'js', array('array' => &$array)); // Echo it foreach ($array as $setting => $value) { 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/core/js/js.js b/core/js/js.js index d4d2583f1e5..21ccee0f1d5 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){ + OC.msg.startAction(selector, t('core', '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, @@ -860,6 +888,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 +901,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); }); @@ -987,6 +1017,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 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); 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); }); } -} +}; 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() { |