|
|
|
|
@ -618,60 +618,95 @@ OC.addStyle.loaded=[];
|
|
|
|
|
OC.addScript.loaded=[];
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @todo Write documentation
|
|
|
|
|
* A little class to manage a status field for a "saving" process.
|
|
|
|
|
* It can be used to display a starting message (e.g. "Saving...") and then
|
|
|
|
|
* replace it with a green success message or a red error message.
|
|
|
|
|
*
|
|
|
|
|
* @namespace OC.msg
|
|
|
|
|
*/
|
|
|
|
|
OC.msg={
|
|
|
|
|
OC.msg = {
|
|
|
|
|
/**
|
|
|
|
|
* @param selector
|
|
|
|
|
* @todo Write documentation
|
|
|
|
|
* Displayes a "Saving..." message in the given message placeholder
|
|
|
|
|
*
|
|
|
|
|
* @param {Object} selector Placeholder to display the message in
|
|
|
|
|
*/
|
|
|
|
|
startSaving:function(selector){
|
|
|
|
|
OC.msg.startAction(selector, t('core', 'Saving...'));
|
|
|
|
|
startSaving: function(selector) {
|
|
|
|
|
this.startAction(selector, t('core', 'Saving...'));
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @param selector
|
|
|
|
|
* @param data
|
|
|
|
|
* @todo Write documentation
|
|
|
|
|
* Displayes a custom message in the given message placeholder
|
|
|
|
|
*
|
|
|
|
|
* @param {Object} selector Placeholder to display the message in
|
|
|
|
|
* @param {string} message Plain text message to display (no HTML allowed)
|
|
|
|
|
*/
|
|
|
|
|
finishedSaving:function(selector, data){
|
|
|
|
|
OC.msg.finishedAction(selector, data);
|
|
|
|
|
startAction: function(selector, message) {
|
|
|
|
|
$(selector).text(message)
|
|
|
|
|
.removeClass('success')
|
|
|
|
|
.removeClass('error')
|
|
|
|
|
.stop(true, true)
|
|
|
|
|
.show();
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @param selector
|
|
|
|
|
* @param {string} message Message to display
|
|
|
|
|
* @todo WRite documentation
|
|
|
|
|
* Displayes an success/error message in the given selector
|
|
|
|
|
*
|
|
|
|
|
* @param {Object} selector Placeholder to display the message in
|
|
|
|
|
* @param {Object} response Response of the server
|
|
|
|
|
* @param {Object} response.data Data of the servers response
|
|
|
|
|
* @param {string} response.data.message Plain text message to display (no HTML allowed)
|
|
|
|
|
* @param {string} response.status is being used to decide whether the message
|
|
|
|
|
* is displayed as an error/success
|
|
|
|
|
*/
|
|
|
|
|
startAction:function(selector, message){
|
|
|
|
|
$(selector)
|
|
|
|
|
.html( message )
|
|
|
|
|
.removeClass('success')
|
|
|
|
|
finishedSaving: function(selector, response) {
|
|
|
|
|
this.finishedAction(selector, response);
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Displayes an success/error message in the given selector
|
|
|
|
|
*
|
|
|
|
|
* @param {Object} selector Placeholder to display the message in
|
|
|
|
|
* @param {Object} response Response of the server
|
|
|
|
|
* @param {Object} response.data Data of the servers response
|
|
|
|
|
* @param {string} response.data.message Plain text message to display (no HTML allowed)
|
|
|
|
|
* @param {string} response.status is being used to decide whether the message
|
|
|
|
|
* is displayed as an error/success
|
|
|
|
|
*/
|
|
|
|
|
finishedAction: function(selector, response) {
|
|
|
|
|
if (response.status === "success") {
|
|
|
|
|
this.finishedSuccess(selector, response.data.message);
|
|
|
|
|
} else {
|
|
|
|
|
this.finishedError(selector, response.data.message);
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Displayes an success message in the given selector
|
|
|
|
|
*
|
|
|
|
|
* @param {Object} selector Placeholder to display the message in
|
|
|
|
|
* @param {string} message Plain text success message to display (no HTML allowed)
|
|
|
|
|
*/
|
|
|
|
|
finishedSuccess: function(selector, message) {
|
|
|
|
|
$(selector).text(message)
|
|
|
|
|
.addClass('success')
|
|
|
|
|
.removeClass('error')
|
|
|
|
|
.stop(true, true)
|
|
|
|
|
.delay(3000)
|
|
|
|
|
.fadeOut(900)
|
|
|
|
|
.show();
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @param selector
|
|
|
|
|
* @param data
|
|
|
|
|
* @todo Write documentation
|
|
|
|
|
* Displayes an error message in the given selector
|
|
|
|
|
*
|
|
|
|
|
* @param {Object} selector Placeholder to display the message in
|
|
|
|
|
* @param {string} message Plain text error message to display (no HTML allowed)
|
|
|
|
|
*/
|
|
|
|
|
finishedAction:function(selector, data){
|
|
|
|
|
if( data.status === "success" ){
|
|
|
|
|
$(selector).html( data.data.message )
|
|
|
|
|
.addClass('success')
|
|
|
|
|
.removeClass('error')
|
|
|
|
|
.stop(true, true)
|
|
|
|
|
.delay(3000)
|
|
|
|
|
.fadeOut(900)
|
|
|
|
|
.show();
|
|
|
|
|
}else{
|
|
|
|
|
$(selector).html( data.data.message )
|
|
|
|
|
.addClass('error')
|
|
|
|
|
.removeClass('success')
|
|
|
|
|
.show();
|
|
|
|
|
}
|
|
|
|
|
finishedError: function(selector, message) {
|
|
|
|
|
$(selector).text(message)
|
|
|
|
|
.addClass('error')
|
|
|
|
|
.removeClass('success')
|
|
|
|
|
.show();
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|