mirror of
https://github.com/pierre42100/ComunicWeb
synced 2024-12-24 01:48:50 +00:00
Added a live notice to check the availability of a virtual directory for a group.
This commit is contained in:
parent
a8e686d59b
commit
5cfee77bb2
@ -109,6 +109,23 @@ ComunicWeb.components.groups.interface = {
|
||||
ComunicWeb.common.api.makeAPIrequest(apiURI, settings, true, callback);
|
||||
},
|
||||
|
||||
/**
|
||||
* Check the availability of a virtual directory for a group
|
||||
*
|
||||
* @param {String} directory The directory to check
|
||||
* @param {Number} groupID The ID of the group to check
|
||||
* @param {Function} callback
|
||||
*/
|
||||
checkVirtualDirectory: function(directory, groupID, callback){
|
||||
//Perform the request over the API
|
||||
var apiURI = "groups/checkVirtualDirectory";
|
||||
var params = {
|
||||
groupID: groupID,
|
||||
directory: directory
|
||||
};
|
||||
ComunicWeb.common.api.makeAPIrequest(apiURI, params, true, callback);
|
||||
},
|
||||
|
||||
/**
|
||||
* Upload a new group logo
|
||||
*
|
||||
|
@ -130,6 +130,37 @@ ComunicWeb.pages.groups.pages.settings = {
|
||||
value: settings.virtual_directory == "null" ? "" : settings.virtual_directory,
|
||||
});
|
||||
|
||||
//Check message target
|
||||
var checkVirtualDirectoryTarget = createElem2({
|
||||
appendTo: formContainer,
|
||||
type: "small"
|
||||
});
|
||||
|
||||
virtualDirectory.onkeyup = function(){
|
||||
|
||||
checkVirtualDirectoryTarget.innerHTML = "Checking availability...";
|
||||
|
||||
//Get the directory to check
|
||||
var directory = virtualDirectory.value;
|
||||
|
||||
//Check if the directory is empty
|
||||
if(directory == ""){
|
||||
checkVirtualDirectoryTarget.innerHTML = "";
|
||||
return;
|
||||
}
|
||||
|
||||
//Perform a request on the API
|
||||
ComunicWeb.components.groups.interface.checkVirtualDirectory(directory, settings.id, function(callback){
|
||||
|
||||
//Check if the directory is available or not
|
||||
checkVirtualDirectoryTarget.innerHTML =
|
||||
callback.error
|
||||
? "<invalidDirectory>This directory is not available!</invalidDirectory>"
|
||||
: "This directory seems to be available!";
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
//Group visibility
|
||||
var visibilityForm = createElem2({
|
||||
|
Loading…
Reference in New Issue
Block a user