Merge branch 'master' into jshint-globals-oc-t-n

Conflicts:
	.jshintrc
This commit is contained in:
Thomas Müller 2014-04-07 17:10:45 +02:00
commit 78e5410199
9 changed files with 1424 additions and 69 deletions

View File

@ -24,6 +24,7 @@
"afterEach": true,
"sinon": true,
"fakeServer": true,
"_": true,
"OC": true,
"t": true,
"n": true

View File

@ -3,8 +3,8 @@
<span class="what">{what}<!-- If you select both versions, the copied file will have a number added to its name. --></span><br/>
<br/>
<table>
<th><label><input class="allnewfiles" type="checkbox" />New Files<span class="count"></span></label></th>
<th><label><input class="allexistingfiles" type="checkbox" />Already existing files<span class="count"></span></label></th>
<th><label><input class="allnewfiles" type="checkbox" />{allnewfiles}<span class="count"></span></label></th>
<th><label><input class="allexistingfiles" type="checkbox" />{allexistingfiles}<span class="count"></span></label></th>
</table>
<div class="conflicts">
<div class="template">

View File

@ -6,7 +6,8 @@
"jquery-showpassword.js",
"jquery.infieldlabel.js",
"jquery.placeholder.js",
"jquery-tipsy.js"
"jquery-tipsy.js",
"underscore.js"
],
"modules": [
"compatibility.js",

View File

@ -343,7 +343,7 @@ var OCdialogs = {
addConflict(conflicts, original, replacement);
var count = $(dialog_id+ ' .conflict').length;
var title = n('files',
var title = n('core',
'{count} file conflict',
'{count} file conflicts',
count,
@ -358,14 +358,17 @@ var OCdialogs = {
//create dialog
this._fileexistsshown = true;
$.when(this._getFileExistsTemplate()).then(function($tmpl) {
var title = t('files','One file conflict');
var title = t('core','One file conflict');
var $dlg = $tmpl.octemplate({
dialog_name: dialog_name,
title: title,
type: 'fileexists',
why: t('files','Which files do you want to keep?'),
what: t('files','If you select both versions, the copied file will have a number added to its name.')
allnewfiles: t('core','New Files'),
allexistingfiles: t('core','Already existing files'),
why: t('core','Which files do you want to keep?'),
what: t('core','If you select both versions, the copied file will have a number added to its name.')
});
$('body').append($dlg);
@ -430,10 +433,10 @@ var OCdialogs = {
var count = $(dialog_id).find('.conflict .replacement input[type="checkbox"]:checked').length;
if (count === $(dialog_id+ ' .conflict').length) {
$(dialog_id).find('.allnewfiles').prop('checked', true);
$(dialog_id).find('.allnewfiles + .count').text(t('files','(all selected)'));
$(dialog_id).find('.allnewfiles + .count').text(t('core','(all selected)'));
} else if (count > 0) {
$(dialog_id).find('.allnewfiles').prop('checked', false);
$(dialog_id).find('.allnewfiles + .count').text(t('files','({count} selected)',{count:count}));
$(dialog_id).find('.allnewfiles + .count').text(t('core','({count} selected)',{count:count}));
} else {
$(dialog_id).find('.allnewfiles').prop('checked', false);
$(dialog_id).find('.allnewfiles + .count').text('');
@ -443,10 +446,10 @@ var OCdialogs = {
var count = $(dialog_id).find('.conflict .original input[type="checkbox"]:checked').length;
if (count === $(dialog_id+ ' .conflict').length) {
$(dialog_id).find('.allexistingfiles').prop('checked', true);
$(dialog_id).find('.allexistingfiles + .count').text(t('files','(all selected)'));
$(dialog_id).find('.allexistingfiles + .count').text(t('core','(all selected)'));
} else if (count > 0) {
$(dialog_id).find('.allexistingfiles').prop('checked', false);
$(dialog_id).find('.allexistingfiles + .count').text(t('files','({count} selected)',{count:count}));
$(dialog_id).find('.allexistingfiles + .count').text(t('core','({count} selected)',{count:count}));
} else {
$(dialog_id).find('.allexistingfiles').prop('checked', false);
$(dialog_id).find('.allexistingfiles + .count').text('');

1344
core/js/underscore.js Normal file

File diff suppressed because it is too large Load Diff

View File

@ -305,6 +305,7 @@ class OC {
OC_Util::addScript("jquery.placeholder");
OC_Util::addScript("jquery-tipsy");
OC_Util::addScript("compatibility");
OC_Util::addScript("underscore");
OC_Util::addScript("jquery.ocdialog");
OC_Util::addScript("oc-dialogs");
OC_Util::addScript("js");

View File

@ -29,8 +29,8 @@ class OC_Defaults {
$this->defaultEntity = "ownCloud"; /* e.g. company name, used for footers and copyright notices */
$this->defaultName = "ownCloud"; /* short name, used when referring to the software */
$this->defaultTitle = "ownCloud"; /* can be a longer name, for titles */
$this->defaultBaseUrl = "http://owncloud.org";
$this->defaultSyncClientUrl = " http://owncloud.org/sync-clients/";
$this->defaultBaseUrl = "https://owncloud.org";
$this->defaultSyncClientUrl = "https://owncloud.org/sync-clients/";
$this->defaultDocBaseUrl = "http://doc.owncloud.org";
$this->defaultSlogan = $this->l->t("web services under your control");
$this->defaultLogoClaim = "";

View File

@ -5,24 +5,32 @@ try {
require_once 'lib/base.php';
OC::checkMaintenanceMode();
OC::checkSingleUserMode();
if (!isset($_GET['service'])) {
$pathInfo = OC_Request::getPathInfo();
if (!$pathInfo && !isset($_GET['service'])) {
header('HTTP/1.0 404 Not Found');
exit;
} elseif ($_GET['service']) {
$service = $_GET['service'];
} else {
$pathInfo = trim($pathInfo, '/');
list($service) = explode('/', $pathInfo);
}
$file = OCP\CONFIG::getAppValue('core', 'public_' . strip_tags($_GET['service']));
if(is_null($file)) {
$file = OCP\CONFIG::getAppValue('core', 'public_' . strip_tags($service));
if (is_null($file)) {
header('HTTP/1.0 404 Not Found');
exit;
}
$parts=explode('/', $file, 2);
$app=$parts[0];
$parts = explode('/', $file, 2);
$app = $parts[0];
OC_Util::checkAppEnabled($app);
OC_App::loadApp($app);
OC_User::setIncognitoMode(true);
require_once OC_App::getAppPath($app) .'/'. $parts[1];
$baseuri = OC::$WEBROOT . '/public.php/' . $service . '/';
require_once OC_App::getAppPath($app) . '/' . $parts[1];
} catch (Exception $ex) {
//show the user a detailed error page

View File

@ -5,6 +5,36 @@
* See the COPYING-README file.
*/
/* global OC, t */
/**
* The callback will be fired as soon as enter is pressed by the
* user or 1 second after the last data entry
*
* @param callback
*/
jQuery.fn.keyUpDelayedOrEnter = function(callback){
var cb = callback;
var that = this;
this.keyup(_.debounce(function (event) {
// enter is already handled in keypress
if(event.keyCode === 13) {
return;
}
if (that.val() !== '') {
cb();
}
}, 1000));
this.keypress(function () {
if (event.keyCode === 13 && that.val() !== '' ){
event.preventDefault();
cb();
}
});
};
/**
* Post the email address change to the server.
*/
@ -42,13 +72,12 @@ function changeDisplayName(){
}
OC.msg.finishedSaving('#displaynameform .msg', data);
});
return false;
}
}
function updateAvatar (hidedefault) {
$headerdiv = $('#header .avatardiv');
$displaydiv = $('#displayavatar .avatardiv');
var $headerdiv = $('#header .avatardiv');
var $displaydiv = $('#displayavatar .avatardiv');
if(hidedefault) {
$headerdiv.hide();
@ -65,11 +94,12 @@ function updateAvatar (hidedefault) {
}
function showAvatarCropper() {
$cropper = $('#cropper');
var $cropper = $('#cropper');
$cropper.prepend("<img>");
$cropperImage = $('#cropper img');
var $cropperImage = $('#cropper img');
$cropperImage.attr('src', OC.generateUrl('/avatar/tmp')+'?requesttoken='+oc_requesttoken+'#'+Math.floor(Math.random()*1000));
$cropperImage.attr('src',
OC.generateUrl('/avatar/tmp')+'?requesttoken='+oc_requesttoken+'#'+Math.floor(Math.random()*1000));
// Looks weird, but on('load', ...) doesn't work in IE8
$cropperImage.ready(function(){
@ -90,12 +120,12 @@ function showAvatarCropper() {
function sendCropData() {
cleanCropper();
var cropperdata = $('#cropper').data();
var cropperData = $('#cropper').data();
var data = {
x: cropperdata.x,
y: cropperdata.y,
w: cropperdata.w,
h: cropperdata.h
x: cropperData.x,
y: cropperData.y,
w: cropperData.w,
h: cropperData.h
};
$.post(OC.generateUrl('/avatar/cropped'), {crop: data}, avatarResponseHandler);
}
@ -105,7 +135,7 @@ function saveCoords(c) {
}
function cleanCropper() {
$cropper = $('#cropper');
var $cropper = $('#cropper');
$('#displayavatar').show();
$cropper.hide();
$('.jcrop-holder').remove();
@ -114,7 +144,7 @@ function cleanCropper() {
}
function avatarResponseHandler(data) {
$warning = $('#avatar .warning');
var $warning = $('#avatar .warning');
$warning.hide();
if (data.status === "success") {
updateAvatar();
@ -157,41 +187,8 @@ $(document).ready(function(){
});
$('#displayName').keyup(function(){
if ($('#displayName').val() !== '' ){
if(typeof timeout !== 'undefined'){
clearTimeout(timeout);
}
timeout = setTimeout(changeDisplayName, 1000);
}
});
$('#email').keyup(function(event){
if ($('#email').val() !== '' ){
// if this is the enter key changeEmailAddress() is already invoked
// so it doesn't need to be triggered again
if(event.keyCode === 13) {
return;
}
if(typeof timeout !== 'undefined'){
clearTimeout(timeout);
}
timeout = setTimeout(changeEmailAddress, 1000);
}
});
$('#email').keypress(function(event){
// check for enter key and non empty email
if (event.keyCode === 13 && $('#email').val() !== '' ){
event.preventDefault()
// clear timeout of previous keyup event - prevents duplicate changeEmailAddress call
if(typeof timeout !== 'undefined'){
clearTimeout(timeout);
}
changeEmailAddress();
}
});
$('#displayName').keyUpDelayedOrEnter(changeDisplayName);
$('#email').keyUpDelayedOrEnter(changeEmailAddress);
$("#languageinput").change( function(){
// Serialize the data
@ -256,7 +253,7 @@ $(document).ready(function(){
$.ajax({
type: 'DELETE',
url: OC.generateUrl('/avatar/'),
success: function(msg) {
success: function() {
updateAvatar(true);
$('#removeavatar').hide();
}
@ -321,7 +318,7 @@ OC.Encryption.msg={
},
finishedDecrypting:function(selector, data){
if( data.status === "success" ){
$(selector).html( data.data.message )
$(selector).html( data.data.message )
.addClass('success')
.stop(true, true)
.delay(3000);