|
|
|
@ -198,7 +198,7 @@ var OC={ |
|
|
|
linkTo:function(app,file){ |
|
|
|
return OC.filePath(app,'',file); |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
* Creates a relative url for remote use |
|
|
|
* @param {string} service id |
|
|
|
@ -300,7 +300,7 @@ var OC={ |
|
|
|
} |
|
|
|
return link; |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
* Redirect to the target URL, can also be used for downloads. |
|
|
|
* @param {string} targetURL URL to redirect to |
|
|
|
@ -308,10 +308,10 @@ var OC={ |
|
|
|
redirect: function(targetURL) { |
|
|
|
window.location = targetURL; |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
* get the absolute path to an image file |
|
|
|
* if no extension is given for the image, it will automatically decide |
|
|
|
* if no extension is given for the image, it will automatically decide |
|
|
|
* between .png and .svg based on what the browser supports |
|
|
|
* @param {string} app the app id to which the image belongs |
|
|
|
* @param {string} file the name of the image file |
|
|
|
@ -323,9 +323,9 @@ var OC={ |
|
|
|
} |
|
|
|
return OC.filePath(app,'img',file); |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
* Load a script for the server and load it. If the script is already loaded, |
|
|
|
* Load a script for the server and load it. If the script is already loaded, |
|
|
|
* the event handler will be called directly |
|
|
|
* @param {string} app the app id to which the script belongs |
|
|
|
* @param {string} script the filename of the script |
|
|
|
@ -364,21 +364,21 @@ var OC={ |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
* @todo Write the documentation |
|
|
|
*/ |
|
|
|
basename: function(path) { |
|
|
|
return path.replace(/\\/g,'/').replace( /.*\//, '' ); |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
* @todo Write the documentation |
|
|
|
*/ |
|
|
|
dirname: function(path) { |
|
|
|
return path.replace(/\\/g,'/').replace(/\/[^\/]*$/, ''); |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
* Do a search query and display the results |
|
|
|
* @param {string} query the search query |
|
|
|
@ -393,7 +393,7 @@ var OC={ |
|
|
|
} |
|
|
|
}, 500), |
|
|
|
dialogs:OCdialogs, |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
* Parses a URL query string into a JS map |
|
|
|
* @param {string} queryString query string in the format param1=1234¶m2=abcde¶m3=xyz |
|
|
|
@ -604,7 +604,7 @@ OC.msg={ |
|
|
|
startSaving:function(selector){ |
|
|
|
OC.msg.startAction(selector, t('core', 'Saving...')); |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
* @param selector |
|
|
|
* @param data |
|
|
|
@ -613,7 +613,7 @@ OC.msg={ |
|
|
|
finishedSaving:function(selector, data){ |
|
|
|
OC.msg.finishedAction(selector, data); |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
* @param selector |
|
|
|
* @param {string} message Message to display |
|
|
|
@ -627,7 +627,7 @@ OC.msg={ |
|
|
|
.stop(true, true) |
|
|
|
.show(); |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
* @param selector |
|
|
|
* @param data |
|
|
|
@ -636,12 +636,17 @@ OC.msg={ |
|
|
|
finishedAction:function(selector, data){ |
|
|
|
if( data.status === "success" ){ |
|
|
|
$(selector).html( data.data.message ) |
|
|
|
.addClass('success') |
|
|
|
.stop(true, true) |
|
|
|
.delay(3000) |
|
|
|
.fadeOut(900); |
|
|
|
.addClass('success') |
|
|
|
.removeClass('error') |
|
|
|
.stop(true, true) |
|
|
|
.delay(3000) |
|
|
|
.fadeOut(900) |
|
|
|
.show(); |
|
|
|
}else{ |
|
|
|
$(selector).html( data.data.message ).addClass('error'); |
|
|
|
$(selector).html( data.data.message ) |
|
|
|
.addClass('error') |
|
|
|
.removeClass('success') |
|
|
|
.show(); |
|
|
|
} |
|
|
|
} |
|
|
|
}; |
|
|
|
@ -652,7 +657,7 @@ OC.msg={ |
|
|
|
OC.Notification={ |
|
|
|
queuedNotifications: [], |
|
|
|
getDefaultNotificationFunction: null, |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
* @param callback |
|
|
|
* @todo Write documentation |
|
|
|
@ -660,7 +665,7 @@ OC.Notification={ |
|
|
|
setDefault: function(callback) { |
|
|
|
OC.Notification.getDefaultNotificationFunction = callback; |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
* Hides a notification |
|
|
|
* @param callback |
|
|
|
@ -683,7 +688,7 @@ OC.Notification={ |
|
|
|
} |
|
|
|
}); |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
* Shows a notification as HTML without being sanitized before. |
|
|
|
* If you pass unsanitized user input this may lead to a XSS vulnerability. |
|
|
|
@ -699,7 +704,7 @@ OC.Notification={ |
|
|
|
OC.Notification.queuedNotifications.push(html); |
|
|
|
} |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
* Shows a sanitized notification |
|
|
|
* @param {string} text Message to display |
|
|
|
@ -713,9 +718,9 @@ OC.Notification={ |
|
|
|
OC.Notification.queuedNotifications.push($('<div/>').text(text).html()); |
|
|
|
} |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
* Returns whether a notification is hidden. |
|
|
|
* Returns whether a notification is hidden. |
|
|
|
* @return {boolean} |
|
|
|
*/ |
|
|
|
isHidden: function() { |
|
|
|
@ -779,7 +784,7 @@ OC.Breadcrumb={ |
|
|
|
this._push(container, leafname, leaflink); |
|
|
|
} |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
* @todo Write documentation |
|
|
|
* @param {string} name |
|
|
|
@ -809,7 +814,7 @@ OC.Breadcrumb={ |
|
|
|
} |
|
|
|
return crumb; |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
* @todo Write documentation |
|
|
|
*/ |
|
|
|
@ -820,7 +825,7 @@ OC.Breadcrumb={ |
|
|
|
this.container.find('div.crumb').last().remove(); |
|
|
|
this.container.find('div.crumb').last().addClass('last'); |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
* @todo Write documentation |
|
|
|
*/ |
|
|
|
@ -841,7 +846,7 @@ if(typeof localStorage !=='undefined' && localStorage !== null){ |
|
|
|
*/ |
|
|
|
OC.localStorage={ |
|
|
|
namespace:'oc_'+OC.currentUser+'_'+OC.webroot+'_', |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
* Whether the storage contains items |
|
|
|
* @param {string} name |
|
|
|
@ -850,7 +855,7 @@ if(typeof localStorage !=='undefined' && localStorage !== null){ |
|
|
|
hasItem:function(name){ |
|
|
|
return OC.localStorage.getItem(name)!==null; |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
* Add an item to the storage |
|
|
|
* @param {string} name |
|
|
|
@ -859,7 +864,7 @@ if(typeof localStorage !=='undefined' && localStorage !== null){ |
|
|
|
setItem:function(name,item){ |
|
|
|
return localStorage.setItem(OC.localStorage.namespace+name,JSON.stringify(item)); |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
* Removes an item from the storage |
|
|
|
* @param {string} name |
|
|
|
@ -868,7 +873,7 @@ if(typeof localStorage !=='undefined' && localStorage !== null){ |
|
|
|
removeItem:function(name,item){ |
|
|
|
return localStorage.removeItem(OC.localStorage.namespace+name); |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
* Get an item from the storage |
|
|
|
* @param {string} name |
|
|
|
@ -1248,7 +1253,7 @@ function formatDate(timestamp){ |
|
|
|
return OC.Util.formatDate(timestamp); |
|
|
|
} |
|
|
|
|
|
|
|
//
|
|
|
|
//
|
|
|
|
/** |
|
|
|
* Get the value of a URL parameter |
|
|
|
* @link http://stackoverflow.com/questions/1403888/get-url-parameter-with-jquery
|
|
|
|
|