fix oc#47
This commit is contained in:
parent
7019972320
commit
ff9476b3e3
2 changed files with 73 additions and 57 deletions
|
@ -246,14 +246,17 @@ var FileList={
|
|||
},
|
||||
checkName:function(oldName, newName, isNewFile) {
|
||||
if (isNewFile || $('tr').filterAttr('data-file', newName).length > 0) {
|
||||
$('#notification').data('oldName', oldName);
|
||||
$('#notification').data('newName', newName);
|
||||
$('#notification').data('isNewFile', isNewFile);
|
||||
if (isNewFile) {
|
||||
OC.Notification.showHtml(t('files', '{new_name} already exists', {new_name: escapeHTML(newName)})+'<span class="replace">'+t('files', 'replace')+'</span><span class="suggest">'+t('files', 'suggest name')+'</span><span class="cancel">'+t('files', 'cancel')+'</span>');
|
||||
} else {
|
||||
OC.Notification.showHtml(t('files', '{new_name} already exists', {new_name: escapeHTML(newName)})+'<span class="replace">'+t('files', 'replace')+'</span><span class="cancel">'+t('files', 'cancel')+'</span>');
|
||||
}
|
||||
var html;
|
||||
if(isNewFile){
|
||||
html = t('files', '{new_name} already exists', {new_name: escapeHTML(newName)})+'<span class="replace">'+t('files', 'replace')+'</span><span class="suggest">'+t('files', 'suggest name')+'</span> <span class="cancel">'+t('files', 'cancel')+'</span>';
|
||||
}else{
|
||||
html = t('files', '{new_name} already exists', {new_name: escapeHTML(newName)})+'<span class="replace">'+t('files', 'replace')+'</span><span class="cancel">'+t('files', 'cancel')+'</span>';
|
||||
}
|
||||
html = $('<span>' + html + '</span>');
|
||||
html.attr('data-oldName', oldName);
|
||||
html.attr('data-newName', newName);
|
||||
html.attr('data-isNewFile', isNewFile);
|
||||
OC.Notification.showHtml(html);
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
|
@ -291,9 +294,7 @@ var FileList={
|
|||
FileList.lastAction = function() {
|
||||
FileList.finishReplace();
|
||||
};
|
||||
if (isNewFile) {
|
||||
OC.Notification.showHtml(t('files', 'replaced {new_name}', {new_name: newName})+'<span class="undo">'+t('files', 'undo')+'</span>');
|
||||
} else {
|
||||
if (!isNewFile) {
|
||||
OC.Notification.showHtml(t('files', 'replaced {new_name} with {old_name}', {new_name: newName}, {old_name: oldName})+'<span class="undo">'+t('files', 'undo')+'</span>');
|
||||
}
|
||||
},
|
||||
|
@ -376,19 +377,19 @@ $(document).ready(function(){
|
|||
FileList.lastAction = null;
|
||||
OC.Notification.hide();
|
||||
});
|
||||
$('#notification').on('click', '.replace', function() {
|
||||
$('#notification:first-child').on('click', '.replace', function() {
|
||||
OC.Notification.hide(function() {
|
||||
FileList.replace($('#notification').data('oldName'), $('#notification').data('newName'), $('#notification').data('isNewFile'));
|
||||
FileList.replace($('#notification > span').attr('data-oldName'), $('#notification > span').attr('data-newName'), $('#notification > span').attr('data-isNewFile'));
|
||||
});
|
||||
});
|
||||
$('#notification').on('click', '.suggest', function() {
|
||||
$('tr').filterAttr('data-file', $('#notification').data('oldName')).show();
|
||||
$('#notification:first-child').on('click', '.suggest', function() {
|
||||
$('tr').filterAttr('data-file', $('#notification > span').attr('data-oldName')).show();
|
||||
OC.Notification.hide();
|
||||
});
|
||||
$('#notification').on('click', '.cancel', function() {
|
||||
if ($('#notification').data('isNewFile')) {
|
||||
$('#notification:first-child').on('click', '.cancel', function() {
|
||||
if ($('#notification > span').attr('data-isNewFile')) {
|
||||
FileList.deleteCanceled = false;
|
||||
FileList.deleteFiles = [$('#notification').data('oldName')];
|
||||
FileList.deleteFiles = [$('#notification > span').attr('data-oldName')];
|
||||
}
|
||||
});
|
||||
FileList.useUndo=(window.onbeforeunload)?true:false;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/**
|
||||
* Disable console output unless DEBUG mode is enabled.
|
||||
* Add
|
||||
* define('DEBUG', true);
|
||||
* define('DEBUG', true);
|
||||
* To the end of config/config.php to enable debug mode.
|
||||
* The undefined checks fix the broken ie8 console
|
||||
*/
|
||||
|
@ -44,13 +44,13 @@ function t(app,text, vars){
|
|||
}
|
||||
}
|
||||
var _build = function (text, vars) {
|
||||
return text.replace(/{([^{}]*)}/g,
|
||||
function (a, b) {
|
||||
var r = vars[b];
|
||||
return typeof r === 'string' || typeof r === 'number' ? r : a;
|
||||
}
|
||||
);
|
||||
};
|
||||
return text.replace(/{([^{}]*)}/g,
|
||||
function (a, b) {
|
||||
var r = vars[b];
|
||||
return typeof r === 'string' || typeof r === 'number' ? r : a;
|
||||
}
|
||||
);
|
||||
};
|
||||
if( typeof( t.cache[app][text] ) !== 'undefined' ){
|
||||
if(typeof vars === 'object') {
|
||||
return _build(t.cache[app][text], vars);
|
||||
|
@ -274,7 +274,7 @@ var OC={
|
|||
var popup = $('#appsettings_popup');
|
||||
if(popup.length == 0) {
|
||||
$('body').prepend('<div class="popup hidden" id="appsettings_popup"></div>');
|
||||
popup = $('#appsettings_popup');
|
||||
popup = $('#appsettings_popup');
|
||||
popup.addClass(settings.hasClass('topright') ? 'topright' : 'bottomleft');
|
||||
}
|
||||
if(popup.is(':visible')) {
|
||||
|
@ -317,35 +317,50 @@ OC.addStyle.loaded=[];
|
|||
OC.addScript.loaded=[];
|
||||
|
||||
OC.Notification={
|
||||
getDefaultNotificationFunction: null,
|
||||
setDefault: function(callback) {
|
||||
OC.Notification.getDefaultNotificationFunction = callback;
|
||||
},
|
||||
hide: function(callback) {
|
||||
$("#notification").text('');
|
||||
$('#notification').fadeOut('400', function(){
|
||||
if (OC.Notification.isHidden()) {
|
||||
if (OC.Notification.getDefaultNotificationFunction) {
|
||||
OC.Notification.getDefaultNotificationFunction.call();
|
||||
}
|
||||
}
|
||||
if (callback) {
|
||||
callback.call();
|
||||
}
|
||||
});
|
||||
},
|
||||
showHtml: function(html) {
|
||||
var notification = $('#notification');
|
||||
notification.hide();
|
||||
notification.html(html);
|
||||
notification.fadeIn().css("display","inline");
|
||||
},
|
||||
show: function(text) {
|
||||
var notification = $('#notification');
|
||||
notification.hide();
|
||||
notification.text(text);
|
||||
notification.fadeIn().css("display","inline");
|
||||
},
|
||||
queuedNotifications: new Array(),
|
||||
getDefaultNotificationFunction: null,
|
||||
setDefault: function(callback) {
|
||||
OC.Notification.getDefaultNotificationFunction = callback;
|
||||
},
|
||||
hide: function(callback) {
|
||||
$('#notification').fadeOut('400', function(){
|
||||
if (OC.Notification.isHidden()) {
|
||||
if (OC.Notification.getDefaultNotificationFunction) {
|
||||
OC.Notification.getDefaultNotificationFunction.call();
|
||||
}
|
||||
}
|
||||
if (callback) {
|
||||
callback.call();
|
||||
}
|
||||
$('#notification').empty();
|
||||
if(OC.Notification.queuedNotifications.length > 0){
|
||||
OC.Notification.showHtml(OC.Notification.queuedNotifications[0]);
|
||||
OC.Notification.queuedNotifications.shift();
|
||||
}
|
||||
});
|
||||
},
|
||||
showHtml: function(html) {
|
||||
if(($('#notification').filter('span.undo').length == 1) || OC.Notification.isHidden()){
|
||||
$('#notification').html(html);
|
||||
$('#notification').fadeIn().css("display","inline");
|
||||
}else{
|
||||
OC.Notification.queuedNotifications.push(html);
|
||||
}
|
||||
},
|
||||
show: function(text) {
|
||||
if(text == ''){
|
||||
return false;
|
||||
}
|
||||
if(OC.Notification.currentlyShownNotifications < 2){
|
||||
var notification = $('#notification');
|
||||
notification.hide();
|
||||
notification.text(text);
|
||||
notification.fadeIn().css("display","inline");
|
||||
OC.Notification.currentlyShownNotifications++;
|
||||
}else{
|
||||
OC.Notification.queuedNotifications.push($(text).html());
|
||||
}
|
||||
},
|
||||
isHidden: function() {
|
||||
return ($("#notification").text() === '');
|
||||
}
|
||||
|
@ -548,7 +563,7 @@ function replaceSVG(){
|
|||
*/
|
||||
function object(o) {
|
||||
function F() {}
|
||||
F.prototype = o;
|
||||
F.prototype = o;
|
||||
return new F();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue