Merge pull request #7485 from owncloud/scrutinizer_fix_1_kondou
Scrutinizer cleanup
This commit is contained in:
commit
5add56b6ca
16 changed files with 166 additions and 79 deletions
|
@ -7,7 +7,9 @@ $(document).ready(function(){
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
$('#header .avatardiv').avatar(OC.currentUser, 32, undefined, true, callback);
|
$('#header .avatardiv').avatar(
|
||||||
|
OC.currentUser, 32, undefined, true, callback
|
||||||
|
);
|
||||||
// Personal settings
|
// Personal settings
|
||||||
$('#avatar .avatardiv').avatar(OC.currentUser, 128);
|
$('#avatar .avatardiv').avatar(OC.currentUser, 128);
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,8 +42,9 @@ if (!Array.prototype.filter) {
|
||||||
for (var i = 0; i < len; i++) {
|
for (var i = 0; i < len; i++) {
|
||||||
if (i in this) {
|
if (i in this) {
|
||||||
var val = this[i]; // in case fun mutates this
|
var val = this[i]; // in case fun mutates this
|
||||||
if (fun.call(thisp, val, i, this))
|
if (fun.call(thisp, val, i, this)) {
|
||||||
res.push(val);
|
res.push(val);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return res;
|
return res;
|
||||||
|
|
|
@ -20,10 +20,12 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Wrapper for server side events (http://en.wikipedia.org/wiki/Server-sent_events)
|
* Wrapper for server side events
|
||||||
|
* (http://en.wikipedia.org/wiki/Server-sent_events)
|
||||||
* includes a fallback for older browsers and IE
|
* includes a fallback for older browsers and IE
|
||||||
*
|
*
|
||||||
* Use server side events with caution, too many open requests can hang the server
|
* use server side events with caution, too many open requests can hang the
|
||||||
|
* server
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -43,7 +45,7 @@ OC.EventSource=function(src,data){
|
||||||
dataStr+='requesttoken='+oc_requesttoken;
|
dataStr+='requesttoken='+oc_requesttoken;
|
||||||
if(!this.useFallBack && typeof EventSource !='undefined'){
|
if(!this.useFallBack && typeof EventSource !='undefined'){
|
||||||
var joinChar = '&';
|
var joinChar = '&';
|
||||||
if(src.indexOf('?') == -1) {
|
if(src.indexOf('?') === -1) {
|
||||||
joinChar = '?';
|
joinChar = '?';
|
||||||
}
|
}
|
||||||
this.source=new EventSource(src+joinChar+dataStr);
|
this.source=new EventSource(src+joinChar+dataStr);
|
||||||
|
@ -60,13 +62,13 @@ OC.EventSource=function(src,data){
|
||||||
this.iframe.hide();
|
this.iframe.hide();
|
||||||
|
|
||||||
var joinChar = '&';
|
var joinChar = '&';
|
||||||
if(src.indexOf('?') == -1) {
|
if(src.indexOf('?') === -1) {
|
||||||
joinChar = '?';
|
joinChar = '?';
|
||||||
}
|
}
|
||||||
this.iframe.attr('src',src+joinChar+'fallback=true&fallback_id='+OC.EventSource.iframeCount+'&'+dataStr);
|
this.iframe.attr('src',src+joinChar+'fallback=true&fallback_id='+OC.EventSource.iframeCount+'&'+dataStr);
|
||||||
$('body').append(this.iframe);
|
$('body').append(this.iframe);
|
||||||
this.useFallBack=true;
|
this.useFallBack=true;
|
||||||
OC.EventSource.iframeCount++
|
OC.EventSource.iframeCount++;
|
||||||
}
|
}
|
||||||
//add close listener
|
//add close listener
|
||||||
this.listen('__internal__',function(data){
|
this.listen('__internal__',function(data){
|
||||||
|
|
|
@ -35,11 +35,18 @@
|
||||||
});
|
});
|
||||||
|
|
||||||
$(document).on('keydown keyup', function(event) {
|
$(document).on('keydown keyup', function(event) {
|
||||||
if(event.target !== self.$dialog.get(0) && self.$dialog.find($(event.target)).length === 0) {
|
if (
|
||||||
|
event.target !== self.$dialog.get(0) &&
|
||||||
|
self.$dialog.find($(event.target)).length === 0
|
||||||
|
) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// Escape
|
// Escape
|
||||||
if(event.keyCode === 27 && event.type === 'keydown' && self.options.closeOnEscape) {
|
if (
|
||||||
|
event.keyCode === 27 &&
|
||||||
|
event.type === 'keydown' &&
|
||||||
|
self.options.closeOnEscape
|
||||||
|
) {
|
||||||
event.stopImmediatePropagation();
|
event.stopImmediatePropagation();
|
||||||
self.close();
|
self.close();
|
||||||
return false;
|
return false;
|
||||||
|
@ -52,7 +59,10 @@
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
// If no button is selected we trigger the primary
|
// If no button is selected we trigger the primary
|
||||||
if(self.$buttonrow && self.$buttonrow.find($(event.target)).length === 0) {
|
if (
|
||||||
|
self.$buttonrow &&
|
||||||
|
self.$buttonrow.find($(event.target)).length === 0
|
||||||
|
) {
|
||||||
var $button = self.$buttonrow.find('button.primary');
|
var $button = self.$buttonrow.find('button.primary');
|
||||||
if($button) {
|
if($button) {
|
||||||
$button.trigger('click');
|
$button.trigger('click');
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/**
|
/**
|
||||||
* Disable console output unless DEBUG mode is enabled.
|
* Disable console output unless DEBUG mode is enabled.
|
||||||
* Add
|
* Add
|
||||||
* define('DEBUG', true);
|
* define('DEBUG', true);
|
||||||
* To the end of config/config.php to enable debug mode.
|
* To the end of config/config.php to enable debug mode.
|
||||||
* The undefined checks fix the broken ie8 console
|
* The undefined checks fix the broken ie8 console
|
||||||
*/
|
*/
|
||||||
|
@ -23,7 +23,10 @@ if (typeof oc_webroot === "undefined") {
|
||||||
oc_webroot = oc_webroot.substr(0, oc_webroot.lastIndexOf('/'));
|
oc_webroot = oc_webroot.substr(0, oc_webroot.lastIndexOf('/'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (oc_debug !== true || typeof console === "undefined" || typeof console.log === "undefined") {
|
if (
|
||||||
|
oc_debug !== true || typeof console === "undefined" ||
|
||||||
|
typeof console.log === "undefined"
|
||||||
|
) {
|
||||||
if (!window.console) {
|
if (!window.console) {
|
||||||
window.console = {};
|
window.console = {};
|
||||||
}
|
}
|
||||||
|
@ -37,7 +40,8 @@ if (oc_debug !== true || typeof console === "undefined" || typeof console.log ==
|
||||||
function initL10N(app) {
|
function initL10N(app) {
|
||||||
if (!( t.cache[app] )) {
|
if (!( t.cache[app] )) {
|
||||||
$.ajax(OC.filePath('core', 'ajax', 'translations.php'), {
|
$.ajax(OC.filePath('core', 'ajax', 'translations.php'), {
|
||||||
async: false,//todo a proper solution for this without sync ajax calls
|
// TODO a proper solution for this without sync ajax calls
|
||||||
|
async: false,
|
||||||
data: {'app': app},
|
data: {'app': app},
|
||||||
type: 'POST',
|
type: 'POST',
|
||||||
success: function (jsondata) {
|
success: function (jsondata) {
|
||||||
|
@ -75,8 +79,8 @@ function initL10N(app) {
|
||||||
/* We used to use eval, but it seems IE has issues with it.
|
/* We used to use eval, but it seems IE has issues with it.
|
||||||
* We now use "new Function", though it carries a slightly
|
* We now use "new Function", though it carries a slightly
|
||||||
* bigger performance hit.
|
* bigger performance hit.
|
||||||
var code = 'function (n) { var plural; var nplurals; '+pf+' return { "nplural" : nplurals, "plural" : (plural === true ? 1 : plural ? plural : 0) }; };';
|
var code = 'function (n) { var plural; var nplurals; '+pf+' return { "nplural" : nplurals, "plural" : (plural === true ? 1 : plural ? plural : 0) }; };';
|
||||||
Gettext._locale_data[domain].head.plural_func = eval("("+code+")");
|
Gettext._locale_data[domain].head.plural_func = eval("("+code+")");
|
||||||
*/
|
*/
|
||||||
var code = 'var plural; var nplurals; '+pf+' return { "nplural" : nplurals, "plural" : (plural === true ? 1 : plural ? plural : 0) };';
|
var code = 'var plural; var nplurals; '+pf+' return { "nplural" : nplurals, "plural" : (plural === true ? 1 : plural ? plural : 0) };';
|
||||||
t.plural_function[app] = new Function("n", code);
|
t.plural_function[app] = new Function("n", code);
|
||||||
|
|
|
@ -46,7 +46,7 @@ ListView.prototype={
|
||||||
$.each(this.hoverElement,function(index,collumn){
|
$.each(this.hoverElement,function(index,collumn){
|
||||||
$.each(collumn,function(index,element){
|
$.each(collumn,function(index,element){
|
||||||
var html='<a href="#" title="'+element.title+'" class="hoverElement"/>';
|
var html='<a href="#" title="'+element.title+'" class="hoverElement"/>';
|
||||||
var element=$(html);
|
element = $(html);
|
||||||
element.append($('<img src="'+element.icon+'"/>'));
|
element.append($('<img src="'+element.icon+'"/>'));
|
||||||
element.click(element.callback);
|
element.click(element.callback);
|
||||||
tr.children('td.'+collumn).append(element);
|
tr.children('td.'+collumn).append(element);
|
||||||
|
@ -59,9 +59,9 @@ ListView.prototype={
|
||||||
hoverHandelerOut:function(tr){
|
hoverHandelerOut:function(tr){
|
||||||
tr.find('*.hoverElement').remove();
|
tr.find('*.hoverElement').remove();
|
||||||
},
|
},
|
||||||
addHoverElement:function(collumn,icon,title,callback){
|
addHoverElement:function(column,icon,title,callback){
|
||||||
if(!this.hoverElements[collumn]){
|
if(!this.hoverElements[column]){
|
||||||
this.hoverElements[collumn]=[];
|
this.hoverElements[column] = [];
|
||||||
}
|
}
|
||||||
this.hoverElements[row].push({icon:icon,callback:callback,title:title});
|
this.hoverElements[row].push({icon:icon,callback:callback,title:title});
|
||||||
},
|
},
|
||||||
|
|
|
@ -1,14 +1,19 @@
|
||||||
/**
|
/**
|
||||||
* @param 'createCallback' A function to be called when a new entry is created. Two arguments are supplied to this function:
|
* @param 'createCallback' A function to be called when a new entry is created.
|
||||||
* The select element used and the value of the option. If the function returns false addition will be cancelled. If it returns
|
* Two arguments are supplied to this function:
|
||||||
* anything else it will be used as the value of the newly added option.
|
* The select element used and the value of the option. If the function
|
||||||
|
* returns false addition will be cancelled. If it returns
|
||||||
|
* anything else it will be used as the value of the newly added option.
|
||||||
* @param 'createText' The placeholder text for the create action.
|
* @param 'createText' The placeholder text for the create action.
|
||||||
* @param 'title' The title to show if no options are selected.
|
* @param 'title' The title to show if no options are selected.
|
||||||
* @param 'checked' An array containing values for options that should be checked. Any options which are already selected will be added to this array.
|
* @param 'checked' An array containing values for options that should be
|
||||||
|
* checked. Any options which are already selected will be added to this array.
|
||||||
* @param 'labels' The corresponding labels to show for the checked items.
|
* @param 'labels' The corresponding labels to show for the checked items.
|
||||||
* @param 'oncheck' Callback function which will be called when a checkbox/radiobutton is selected. If the function returns false the input will be unchecked.
|
* @param 'oncheck' Callback function which will be called when a
|
||||||
|
* checkbox/radiobutton is selected. If the function returns false the input will be unchecked.
|
||||||
* @param 'onuncheck' @see 'oncheck'.
|
* @param 'onuncheck' @see 'oncheck'.
|
||||||
* @param 'singleSelect' If true radiobuttons will be used instead of checkboxes.
|
* @param 'singleSelect' If true radiobuttons will be used instead of
|
||||||
|
* checkboxes.
|
||||||
*/
|
*/
|
||||||
(function( $ ){
|
(function( $ ){
|
||||||
var multiSelectId=-1;
|
var multiSelectId=-1;
|
||||||
|
@ -32,12 +37,18 @@
|
||||||
$.extend(settings,options);
|
$.extend(settings,options);
|
||||||
$.each(this.children(),function(i,option) {
|
$.each(this.children(),function(i,option) {
|
||||||
// If the option is selected, but not in the checked array, add it.
|
// If the option is selected, but not in the checked array, add it.
|
||||||
if($(option).attr('selected') && settings.checked.indexOf($(option).val()) === -1) {
|
if (
|
||||||
|
$(option).attr('selected') &&
|
||||||
|
settings.checked.indexOf($(option).val()) === -1
|
||||||
|
) {
|
||||||
settings.checked.push($(option).val());
|
settings.checked.push($(option).val());
|
||||||
settings.labels.push($(option).text().trim());
|
settings.labels.push($(option).text().trim());
|
||||||
}
|
}
|
||||||
// If the option is in the checked array but not selected, select it.
|
// If the option is in the checked array but not selected, select it.
|
||||||
else if(settings.checked.indexOf($(option).val()) !== -1 && !$(option).attr('selected')) {
|
else if (
|
||||||
|
settings.checked.indexOf($(option).val()) !== -1 &&
|
||||||
|
!$(option).attr('selected')
|
||||||
|
) {
|
||||||
$(option).attr('selected', 'selected');
|
$(option).attr('selected', 'selected');
|
||||||
settings.labels.push($(option).text().trim());
|
settings.labels.push($(option).text().trim());
|
||||||
}
|
}
|
||||||
|
@ -104,7 +115,7 @@
|
||||||
var label=$('<label/>');
|
var label=$('<label/>');
|
||||||
label.attr('for',id);
|
label.attr('for',id);
|
||||||
label.text(element.text() || item);
|
label.text(element.text() || item);
|
||||||
if(settings.checked.indexOf(item)!=-1 || checked) {
|
if(settings.checked.indexOf(item) !== -1 || checked) {
|
||||||
input.attr('checked', true);
|
input.attr('checked', true);
|
||||||
}
|
}
|
||||||
if(checked){
|
if(checked){
|
||||||
|
@ -151,10 +162,13 @@
|
||||||
settings.labels.splice(index,1);
|
settings.labels.splice(index,1);
|
||||||
}
|
}
|
||||||
var oldWidth=button.width();
|
var oldWidth=button.width();
|
||||||
button.children('span').first().text(settings.labels.length > 0
|
button.children('span').first().text(settings.labels.length > 0
|
||||||
? settings.labels.join(', ')
|
? settings.labels.join(', ')
|
||||||
: settings.title);
|
: settings.title);
|
||||||
var newOuterWidth=Math.max((button.outerWidth()-2),settings.minOuterWidth)+'px';
|
var newOuterWidth = Math.max(
|
||||||
|
(button.outerWidth() - 2),
|
||||||
|
settings.minOuterWidth
|
||||||
|
) + 'px';
|
||||||
var newWidth=Math.max(button.width(),settings.minWidth);
|
var newWidth=Math.max(button.width(),settings.minWidth);
|
||||||
var pos=button.position();
|
var pos=button.position();
|
||||||
button.css('width',oldWidth);
|
button.css('width',oldWidth);
|
||||||
|
@ -184,7 +198,7 @@
|
||||||
input.css('width',button.innerWidth());
|
input.css('width',button.innerWidth());
|
||||||
button.parent().data('preventHide',true);
|
button.parent().data('preventHide',true);
|
||||||
input.keypress(function(event) {
|
input.keypress(function(event) {
|
||||||
if(event.keyCode == 13) {
|
if(event.keyCode === 13) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
var value = $(this).val();
|
var value = $(this).val();
|
||||||
|
@ -222,7 +236,7 @@
|
||||||
select.append(option);
|
select.append(option);
|
||||||
li.prev().children('input').prop('checked', true).trigger('change');
|
li.prev().children('input').prop('checked', true).trigger('change');
|
||||||
button.parent().data('preventHide',false);
|
button.parent().data('preventHide',false);
|
||||||
button.children('span').first().text(settings.labels.length > 0
|
button.children('span').first().text(settings.labels.length > 0
|
||||||
? settings.labels.join(', ')
|
? settings.labels.join(', ')
|
||||||
: settings.title);
|
: settings.title);
|
||||||
if(self.menuDirection === 'up') {
|
if(self.menuDirection === 'up') {
|
||||||
|
@ -265,9 +279,9 @@
|
||||||
}
|
}
|
||||||
list.append(list.find('li.creator'));
|
list.append(list.find('li.creator'));
|
||||||
var pos=button.position();
|
var pos=button.position();
|
||||||
if(($(document).height() > (button.offset().top+button.outerHeight() + list.children().length * button.height())
|
if(($(document).height() > (button.offset().top + button.outerHeight() + list.children().length * button.height()) &&
|
||||||
&& $(document).height() - button.offset().top > (button.offset().top+button.outerHeight() + list.children().length * button.height()))
|
$(document).height() - button.offset().top > (button.offset().top+button.outerHeight() + list.children().length * button.height())) ||
|
||||||
|| $(document).height()/2 > button.offset().top
|
$(document).height() / 2 > button.offset().top
|
||||||
) {
|
) {
|
||||||
list.css({
|
list.css({
|
||||||
top:pos.top+button.outerHeight()-5,
|
top:pos.top+button.outerHeight()-5,
|
||||||
|
|
|
@ -38,7 +38,14 @@ var OCdialogs = {
|
||||||
* @param modal make the dialog modal
|
* @param modal make the dialog modal
|
||||||
*/
|
*/
|
||||||
alert:function(text, title, callback, modal) {
|
alert:function(text, title, callback, modal) {
|
||||||
this.message(text, title, 'alert', OCdialogs.OK_BUTTON, callback, modal);
|
this.message(
|
||||||
|
text,
|
||||||
|
title,
|
||||||
|
'alert',
|
||||||
|
OCdialogs.OK_BUTTON,
|
||||||
|
callback,
|
||||||
|
modal
|
||||||
|
);
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
* displays info dialog
|
* displays info dialog
|
||||||
|
@ -59,7 +66,14 @@ var OCdialogs = {
|
||||||
* @param modal make the dialog modal
|
* @param modal make the dialog modal
|
||||||
*/
|
*/
|
||||||
confirm:function(text, title, callback, modal) {
|
confirm:function(text, title, callback, modal) {
|
||||||
this.message(text, title, 'notice', OCdialogs.YES_NO_BUTTONS, callback, modal);
|
this.message(
|
||||||
|
text,
|
||||||
|
title,
|
||||||
|
'notice',
|
||||||
|
OCdialogs.YES_NO_BUTTONS,
|
||||||
|
callback,
|
||||||
|
modal
|
||||||
|
);
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
* displays prompt dialog
|
* displays prompt dialog
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
/**
|
/**
|
||||||
* jQuery plugin for micro templates
|
* jQuery plugin for micro templates
|
||||||
*
|
*
|
||||||
* Strings are automatically escaped, but that can be disabled by setting escapeFunction to null.
|
* Strings are automatically escaped, but that can be disabled by setting
|
||||||
|
* escapeFunction to null.
|
||||||
*
|
*
|
||||||
* Usage examples:
|
* Usage examples:
|
||||||
*
|
*
|
||||||
|
@ -11,13 +12,15 @@
|
||||||
* var htmlStr = '<p>Welcome back {user}</p>';
|
* var htmlStr = '<p>Welcome back {user}</p>';
|
||||||
* $(htmlStr).octemplate({user: 'John Q. Public'}, {escapeFunction: null});
|
* $(htmlStr).octemplate({user: 'John Q. Public'}, {escapeFunction: null});
|
||||||
*
|
*
|
||||||
* Be aware that the target string must be wrapped in an HTML element for the plugin to work. The following won't work:
|
* Be aware that the target string must be wrapped in an HTML element for the
|
||||||
|
* plugin to work. The following won't work:
|
||||||
*
|
*
|
||||||
* var textStr = 'Welcome back {user}';
|
* var textStr = 'Welcome back {user}';
|
||||||
* $(textStr).octemplate({user: 'John Q. Public'});
|
* $(textStr).octemplate({user: 'John Q. Public'});
|
||||||
*
|
*
|
||||||
* For anything larger than one-liners, you can use a simple $.get() ajax request to get the template,
|
* For anything larger than one-liners, you can use a simple $.get() ajax
|
||||||
* or you can embed them it the page using the text/template type:
|
* request to get the template, or you can embed them it the page using the
|
||||||
|
* text/template type:
|
||||||
*
|
*
|
||||||
* <script id="contactListItemTemplate" type="text/template">
|
* <script id="contactListItemTemplate" type="text/template">
|
||||||
* <tr class="contact" data-id="{id}">
|
* <tr class="contact" data-id="{id}">
|
||||||
|
|
|
@ -72,7 +72,10 @@ $(document).ready(function() {
|
||||||
$('input[type="radio"]').first().click();
|
$('input[type="radio"]').first().click();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (currentDbType === 'sqlite' || (dbtypes.sqlite && currentDbType === undefined)){
|
if (
|
||||||
|
currentDbType === 'sqlite' ||
|
||||||
|
(dbtypes.sqlite && currentDbType === undefined)
|
||||||
|
){
|
||||||
$('#datadirContent').hide(250);
|
$('#datadirContent').hide(250);
|
||||||
$('#databaseBackend').hide(250);
|
$('#databaseBackend').hide(250);
|
||||||
$('#databaseField').hide(250);
|
$('#databaseField').hide(250);
|
||||||
|
|
|
@ -7,24 +7,31 @@ OC.Share={
|
||||||
statuses:{},
|
statuses:{},
|
||||||
droppedDown:false,
|
droppedDown:false,
|
||||||
/**
|
/**
|
||||||
* Loads ALL share statuses from server, stores them in OC.Share.statuses then
|
* Loads ALL share statuses from server, stores them in
|
||||||
* calls OC.Share.updateIcons() to update the files "Share" icon to "Shared"
|
* OC.Share.statuses then calls OC.Share.updateIcons() to update the
|
||||||
* according to their share status and share type.
|
* files "Share" icon to "Shared" according to their share status and
|
||||||
|
* share type.
|
||||||
*
|
*
|
||||||
* @param itemType item type
|
* @param itemType item type
|
||||||
* @param fileList file list instance, defaults to OCA.Files.App.fileList
|
* @param fileList file list instance, defaults to OCA.Files.App.fileList
|
||||||
*/
|
*/
|
||||||
loadIcons:function(itemType, fileList) {
|
loadIcons:function(itemType, fileList) {
|
||||||
// Load all share icons
|
// Load all share icons
|
||||||
$.get(OC.filePath('core', 'ajax', 'share.php'), { fetch: 'getItemsSharedStatuses', itemType: itemType }, function(result) {
|
$.get(
|
||||||
if (result && result.status === 'success') {
|
OC.filePath('core', 'ajax', 'share.php'),
|
||||||
OC.Share.statuses = {};
|
{
|
||||||
$.each(result.data, function(item, data) {
|
fetch: 'getItemsSharedStatuses',
|
||||||
OC.Share.statuses[item] = data;
|
itemType: itemType
|
||||||
});
|
}, function(result) {
|
||||||
OC.Share.updateIcons(itemType, fileList);
|
if (result && result.status === 'success') {
|
||||||
|
OC.Share.statuses = {};
|
||||||
|
$.each(result.data, function(item, data) {
|
||||||
|
OC.Share.statuses[item] = data;
|
||||||
|
});
|
||||||
|
OC.Share.updateIcons(itemType, fileList);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
);
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
* Updates the files' "Share" icons according to the known
|
* Updates the files' "Share" icons according to the known
|
||||||
|
@ -202,19 +209,20 @@ OC.Share={
|
||||||
itemSourceName: itemSourceName,
|
itemSourceName: itemSourceName,
|
||||||
expirationDate: expirationDate
|
expirationDate: expirationDate
|
||||||
}, function (result) {
|
}, function (result) {
|
||||||
if (result && result.status === 'success') {
|
if (result && result.status === 'success') {
|
||||||
if (callback) {
|
if (callback) {
|
||||||
callback(result.data);
|
callback(result.data);
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
if (result.data && result.data.message) {
|
|
||||||
var msg = result.data.message;
|
|
||||||
} else {
|
} else {
|
||||||
var msg = t('core', 'Error');
|
if (result.data && result.data.message) {
|
||||||
|
var msg = result.data.message;
|
||||||
|
} else {
|
||||||
|
var msg = t('core', 'Error');
|
||||||
|
}
|
||||||
|
OC.dialogs.alert(msg, t('core', 'Error while sharing'));
|
||||||
}
|
}
|
||||||
OC.dialogs.alert(msg, t('core', 'Error while sharing'));
|
|
||||||
}
|
}
|
||||||
});
|
);
|
||||||
},
|
},
|
||||||
unshare:function(itemType, itemSource, shareType, shareWith, callback) {
|
unshare:function(itemType, itemSource, shareType, shareWith, callback) {
|
||||||
$.post(OC.filePath('core', 'ajax', 'share.php'), { action: 'unshare', itemType: itemType, itemSource: itemSource, shareType: shareType, shareWith: shareWith }, function(result) {
|
$.post(OC.filePath('core', 'ajax', 'share.php'), { action: 'unshare', itemType: itemType, itemSource: itemSource, shareType: shareType, shareWith: shareWith }, function(result) {
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
$.fn.singleSelect = function () {
|
$.fn.singleSelect = function () {
|
||||||
return this.each(function (i, select) {
|
return this.each(function (i, select) {
|
||||||
var input = $('<input/>'),
|
var input = $('<input/>'),
|
||||||
inputTooltip = $(select).attr('data-inputtitle');
|
inputTooltip = $(select).attr('data-inputtitle');
|
||||||
if (inputTooltip){
|
if (inputTooltip){
|
||||||
input.attr('title', inputTooltip);
|
input.attr('title', inputTooltip);
|
||||||
}
|
}
|
||||||
|
@ -84,5 +84,5 @@
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
};
|
||||||
})(jQuery);
|
})(jQuery);
|
||||||
|
|
|
@ -1,7 +1,13 @@
|
||||||
OC.Tags= {
|
OC.Tags= {
|
||||||
edit:function(type, cb) {
|
edit:function(type, cb) {
|
||||||
if(!type && !this.type) {
|
if(!type && !this.type) {
|
||||||
throw { name: 'MissingParameter', message: t('core', 'The object type is not specified.') };
|
throw {
|
||||||
|
name: 'MissingParameter',
|
||||||
|
message: t(
|
||||||
|
'core',
|
||||||
|
'The object type is not specified.'
|
||||||
|
)
|
||||||
|
};
|
||||||
}
|
}
|
||||||
type = type ? type : this.type;
|
type = type ? type : this.type;
|
||||||
var self = this;
|
var self = this;
|
||||||
|
@ -25,11 +31,23 @@ OC.Tags= {
|
||||||
});
|
});
|
||||||
self.deleteButton = {
|
self.deleteButton = {
|
||||||
text: t('core', 'Delete'),
|
text: t('core', 'Delete'),
|
||||||
click: function() {self._deleteTags(self, type, self._selectedIds())}
|
click: function() {
|
||||||
|
self._deleteTags(
|
||||||
|
self,
|
||||||
|
type,
|
||||||
|
self._selectedIds()
|
||||||
|
);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
self.addButton = {
|
self.addButton = {
|
||||||
text: t('core', 'Add'),
|
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);
|
self._fillTagList(type, self.$taglist);
|
||||||
|
@ -184,7 +202,10 @@ OC.Tags= {
|
||||||
type = type ? type : this.type;
|
type = type ? type : this.type;
|
||||||
var defer = $.Deferred(),
|
var defer = $.Deferred(),
|
||||||
self = this,
|
self = this,
|
||||||
url = OC.generateUrl('/tags/{type}/favorite/{id}/', {type: type, id: id});
|
url = OC.generateUrl(
|
||||||
|
'/tags/{type}/favorite/{id}/',
|
||||||
|
{type: type, id: id}
|
||||||
|
);
|
||||||
$.post(url, function(response) {
|
$.post(url, function(response) {
|
||||||
if(response.status === 'success') {
|
if(response.status === 'success') {
|
||||||
defer.resolve(response);
|
defer.resolve(response);
|
||||||
|
@ -208,7 +229,10 @@ OC.Tags= {
|
||||||
type = type ? type : this.type;
|
type = type ? type : this.type;
|
||||||
var defer = $.Deferred(),
|
var defer = $.Deferred(),
|
||||||
self = this,
|
self = this,
|
||||||
url = OC.generateUrl('/tags/{type}/unfavorite/{id}/', {type: type, id: id});
|
url = OC.generateUrl(
|
||||||
|
'/tags/{type}/unfavorite/{id}/',
|
||||||
|
{type: type, id: id}
|
||||||
|
);
|
||||||
$.post(url, function(response) {
|
$.post(url, function(response) {
|
||||||
if(response.status === 'success') {
|
if(response.status === 'success') {
|
||||||
defer.resolve();
|
defer.resolve();
|
||||||
|
|
|
@ -89,7 +89,8 @@ window.oc_defaults = {};
|
||||||
"Content-Type": "application/json"
|
"Content-Type": "application/json"
|
||||||
},
|
},
|
||||||
'{"data": [], "plural_form": "nplurals=2; plural=(n != 1);"}'
|
'{"data": [], "plural_form": "nplurals=2; plural=(n != 1);"}'
|
||||||
]);
|
]
|
||||||
|
);
|
||||||
|
|
||||||
// make it globally available, so that other tests can define
|
// make it globally available, so that other tests can define
|
||||||
// custom responses
|
// custom responses
|
||||||
|
|
|
@ -193,24 +193,24 @@ describe('Core base tests', function() {
|
||||||
unicode: '汉字'
|
unicode: '汉字'
|
||||||
})).toEqual('unicode=%E6%B1%89%E5%AD%97');
|
})).toEqual('unicode=%E6%B1%89%E5%AD%97');
|
||||||
expect(OC.buildQueryString({
|
expect(OC.buildQueryString({
|
||||||
b: 'spaace value',
|
b: 'spaace value',
|
||||||
'space key': 'normalvalue',
|
'space key': 'normalvalue',
|
||||||
'slash/this': 'amp&ersand'
|
'slash/this': 'amp&ersand'
|
||||||
})).toEqual('b=spaace%20value&space%20key=normalvalue&slash%2Fthis=amp%26ersand');
|
})).toEqual('b=spaace%20value&space%20key=normalvalue&slash%2Fthis=amp%26ersand');
|
||||||
});
|
});
|
||||||
it('Encodes data types and empty values', function() {
|
it('Encodes data types and empty values', function() {
|
||||||
expect(OC.buildQueryString({
|
expect(OC.buildQueryString({
|
||||||
'keywithemptystring': '',
|
'keywithemptystring': '',
|
||||||
'keywithnull': null,
|
'keywithnull': null,
|
||||||
'keywithundefined': null,
|
'keywithundefined': null,
|
||||||
something: 'else'
|
something: 'else'
|
||||||
})).toEqual('keywithemptystring=&keywithnull&keywithundefined&something=else');
|
})).toEqual('keywithemptystring=&keywithnull&keywithundefined&something=else');
|
||||||
expect(OC.buildQueryString({
|
expect(OC.buildQueryString({
|
||||||
'booleanfalse': false,
|
'booleanfalse': false,
|
||||||
'booleantrue': true
|
'booleantrue': true
|
||||||
})).toEqual('booleanfalse=false&booleantrue=true');
|
})).toEqual('booleanfalse=false&booleantrue=true');
|
||||||
expect(OC.buildQueryString({
|
expect(OC.buildQueryString({
|
||||||
'number': 123
|
'number': 123
|
||||||
})).toEqual('number=123');
|
})).toEqual('number=123');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -7,4 +7,5 @@ $(document).ready(function () {
|
||||||
if ($loginForm.length) {
|
if ($loginForm.length) {
|
||||||
$loginForm.find('input#submit').prop('disabled', false);
|
$loginForm.find('input#submit').prop('disabled', false);
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
|
);
|
||||||
|
|
Loading…
Reference in a new issue