summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Müller <thomas.mueller@tmit.eu>2014-02-21 14:01:24 +0100
committerThomas Müller <thomas.mueller@tmit.eu>2014-02-21 14:01:24 +0100
commit27ad69eea586d30153b4b68328e7b938e7912f60 (patch)
tree7f325e50c1fb46a5360f2e5e026b91af97d55ba6
parentf19276f7bc5fa74dff749112fffd350dad662148 (diff)
parent9f0fc30251fbcf0d2a75f91aa8be606e39297fa4 (diff)
downloadnextcloud-server-27ad69eea586d30153b4b68328e7b938e7912f60.tar.gz
nextcloud-server-27ad69eea586d30153b4b68328e7b938e7912f60.zip
Merge branch 'master' into no-css-js-delivery-via-php
-rw-r--r--core/css/mobile.css22
-rw-r--r--core/css/styles.css18
-rw-r--r--core/js/avatar.js9
-rw-r--r--core/js/jquery.avatar.js10
-rw-r--r--core/js/js.js4
-rw-r--r--core/templates/layout.user.php8
-rw-r--r--lib/base.php1
-rw-r--r--lib/private/user.php1
-rw-r--r--lib/private/user/session.php1
-rw-r--r--settings/js/personal.js2
-rw-r--r--tests/lib/connector/sabre/file.php15
-rw-r--r--tests/lib/urlgenerator.php34
12 files changed, 94 insertions, 31 deletions
diff --git a/core/css/mobile.css b/core/css/mobile.css
new file mode 100644
index 00000000000..a63aa902d34
--- /dev/null
+++ b/core/css/mobile.css
@@ -0,0 +1,22 @@
+@media only screen and (max-width: 600px) {
+
+/* compress search box on mobile, expand when focused */
+.searchbox input[type="search"] {
+ width: 15%;
+ -webkit-transition: width 100ms;
+ -moz-transition: width 100ms;
+ -o-transition: width 100ms;
+ transition: width 100ms;
+}
+.searchbox input[type="search"]:focus,
+.searchbox input[type="search"]:active {
+ width: 155px;
+}
+
+/* do not show display name on mobile when profile picture is present */
+#header .avatardiv.avatardiv-shown + #expandDisplayName {
+ display: none;
+}
+
+
+}
diff --git a/core/css/styles.css b/core/css/styles.css
index 22ba60dd2b7..341a507ce37 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;
}
@@ -218,17 +219,19 @@ textarea:disabled {
color: #bbb;
}
-
+/* Searchbox */
.searchbox input[type="search"] {
+ position: relative;
font-size: 1.2em;
- padding: .2em .5em .2em 1.5em;
+ padding-left: 1.5em;
background: #fff url('../img/actions/search.svg') no-repeat .5em center;
border: 0;
- border-radius: 1em;
+ border-radius: 2em;
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=70)"; filter:alpha(opacity=70); opacity: .7;
- margin-top: 10px;
+ margin-top: 6px;
float: right;
}
+
input[type="submit"].enabled {
background: #66f866;
border: 1px solid #5e5;
@@ -719,12 +722,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/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/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 44413f5a2a8..3d897503480 100644
--- a/core/templates/layout.user.php
+++ b/core/templates/layout.user.php
@@ -15,7 +15,7 @@
</title>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
+ <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=0.5, maximum-scale=1.0">
<meta name="apple-itunes-app" content="app-id=543672169">
<link rel="shortcut icon" href="<?php print_unescaped(image_path('', 'favicon.png')); ?>" />
<link rel="apple-touch-icon-precomposed" href="<?php print_unescaped(image_path('', 'favicon-touch.png')); ?>" />
@@ -51,12 +51,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):?>
diff --git a/lib/base.php b/lib/base.php
index b3911094dbf..525d290931f 100644
--- a/lib/base.php
+++ b/lib/base.php
@@ -328,6 +328,7 @@ class OC {
}
OC_Util::addStyle("styles");
+ OC_Util::addStyle("mobile");
OC_Util::addStyle("icons");
OC_Util::addStyle("apps");
OC_Util::addStyle("fixes");
diff --git a/lib/private/user.php b/lib/private/user.php
index 08ead712028..a89b7286c10 100644
--- a/lib/private/user.php
+++ b/lib/private/user.php
@@ -227,6 +227,7 @@ class OC_User {
* Log in a user and regenerate a new session - if the password is ok
*/
public static function login($uid, $password) {
+ session_regenerate_id(true);
return self::getUserSession()->login($uid, $password);
}
diff --git a/lib/private/user/session.php b/lib/private/user/session.php
index cd03b30205f..1740bad5abe 100644
--- a/lib/private/user/session.php
+++ b/lib/private/user/session.php
@@ -157,7 +157,6 @@ class Session implements Emitter, \OCP\IUserSession {
if($user !== false) {
if (!is_null($user)) {
if ($user->isEnabled()) {
- session_regenerate_id(true);
$this->setUser($user);
$this->setLoginName($uid);
$this->manager->emit('\OC\User', 'postLogin', array($user, $password));
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);
diff --git a/tests/lib/connector/sabre/file.php b/tests/lib/connector/sabre/file.php
index 50b8711a90d..c2f0ffa12d4 100644
--- a/tests/lib/connector/sabre/file.php
+++ b/tests/lib/connector/sabre/file.php
@@ -49,21 +49,6 @@ class Test_OC_Connector_Sabre_File extends PHPUnit_Framework_TestCase {
}
/**
- * Test setting name with setName()
- */
- public function testSetName() {
- // setup
- $file = new OC_Connector_Sabre_File('/test.txt');
- $file->fileView = $this->getMock('\OC\Files\View', array('isUpdatable'), array(), '', FALSE);
- $file->fileView->expects($this->any())->method('isUpdatable')->withAnyParameters()->will($this->returnValue(true));
- $etag = $file->put('test data');
- $file->setName('/renamed.txt');
- $this->assertTrue($file->fileView->file_exists('/renamed.txt'));
- // clean up
- $file->delete();
- }
-
- /**
* Test setting name with setName() with invalid chars
* @expectedException Sabre_DAV_Exception_BadRequest
*/
diff --git a/tests/lib/urlgenerator.php b/tests/lib/urlgenerator.php
new file mode 100644
index 00000000000..875a7f06580
--- /dev/null
+++ b/tests/lib/urlgenerator.php
@@ -0,0 +1,34 @@
+<?php
+/**
+ * Copyright (c) 2014 Bjoern Schiessle <schiessle@owncloud.com>
+ * This file is licensed under the Affero General Public License version 3 or
+ * later.
+ * See the COPYING-README file.
+ */
+
+class Test_Urlgenerator extends PHPUnit_Framework_TestCase {
+
+
+ /**
+ * @small
+ * @brief test absolute URL construction
+ * @dataProvider provideURLs
+ */
+ function testGetAbsoluteURL($url, $expectedResult) {
+
+ $urlGenerator = new \OC\URLGenerator(null);
+ $result = $urlGenerator->getAbsoluteURL($url);
+
+ $this->assertEquals($expectedResult, $result);
+ }
+
+ public function provideURLs() {
+ return array(
+ array("index.php", "http://localhost/index.php"),
+ array("/index.php", "http://localhost/index.php"),
+ array("/apps/index.php", "http://localhost/apps/index.php"),
+ array("apps/index.php", "http://localhost/apps/index.php"),
+ );
+ }
+}
+