mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Ajax picker improvements and fixes, support for mimetype restriction list in the Ajax File picker.
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@7751 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -66,6 +66,9 @@ var AlfPicker = new Class(
|
||||
/* initial display style of the outer div */
|
||||
initialDisplayStyle: null,
|
||||
|
||||
/* addition service request attributes if any */
|
||||
requestAttributes: null,
|
||||
|
||||
initialize: function(id, varName, service, formClientId, singleSelect)
|
||||
{
|
||||
this.id = id;
|
||||
@@ -95,6 +98,11 @@ var AlfPicker = new Class(
|
||||
this.preselected = Json.evaluate(jsonString);
|
||||
},
|
||||
|
||||
setRequestAttributes: function(attrs)
|
||||
{
|
||||
this.requestAttributes = attrs;
|
||||
},
|
||||
|
||||
showSelector: function()
|
||||
{
|
||||
// init selector state
|
||||
@@ -135,7 +143,11 @@ var AlfPicker = new Class(
|
||||
this.hidePanels();
|
||||
// pop the parent off - peek for the grandparent
|
||||
var parent = this.stack.pop();
|
||||
var grandParent = this.stack[this.stack.length-1];
|
||||
var grandParent = null;
|
||||
if (this.stack.length != 0)
|
||||
{
|
||||
grandParent = this.stack[this.stack.length-1];
|
||||
}
|
||||
this.getChildData(grandParent != null ? grandParent.id : null, this.populateChildren, parent.scrollpos);
|
||||
},
|
||||
|
||||
@@ -344,7 +356,7 @@ var AlfPicker = new Class(
|
||||
else
|
||||
{
|
||||
upLink.setStyle("display", "block");
|
||||
upLink.setProperty("href", "javascript:" + picker.varName + ".upClicked('" + picker.parent.id + "');");
|
||||
upLink.setProperty("href", "javascript:" + picker.varName + ".upClicked();");
|
||||
}
|
||||
|
||||
// show what the parent next to the breadcrumb drop-down
|
||||
@@ -472,7 +484,9 @@ var AlfPicker = new Class(
|
||||
var picker = this;
|
||||
|
||||
// execute ajax service call to retrieve list of child nodes as JSON response
|
||||
new Ajax(getContextPath() + "/ajax/invoke/" + this.service + "?parent=" + (parent!=null ? parent : ""),
|
||||
new Ajax(getContextPath() + "/ajax/invoke/" + this.service +
|
||||
"?parent=" + (parent!=null ? parent : "") +
|
||||
(this.requestAttributes!=null ? ("&" + this.requestAttributes) : ""),
|
||||
{
|
||||
method: 'get',
|
||||
async: false,
|
||||
@@ -489,6 +503,15 @@ var AlfPicker = new Class(
|
||||
$(picker.id + '-results-list').setStyle('visibility', 'visible');
|
||||
$(picker.id + '-ajax-wait').setStyle('display', 'none');
|
||||
}
|
||||
else
|
||||
{
|
||||
// display results list again and hide ajax wait panel
|
||||
$(picker.id + '-results-list').setStyle('visibility', 'visible');
|
||||
$(picker.id + '-ajax-wait').setStyle('display', 'none');
|
||||
|
||||
// display the error
|
||||
alert(r);
|
||||
}
|
||||
},
|
||||
onFailure: function (r)
|
||||
{
|
||||
@@ -498,6 +521,13 @@ var AlfPicker = new Class(
|
||||
|
||||
sortByName: function(a, b)
|
||||
{
|
||||
return ((a.name < b.name) ? -1 : ((a.name > b.name) ? 1 : 0));
|
||||
if (a.selectable == b.selectable)
|
||||
{
|
||||
return ((a.name < b.name) ? -1 : ((a.name > b.name) ? 1 : 0));
|
||||
}
|
||||
else
|
||||
{
|
||||
return (a.selectable == false) ? -1 : 1;
|
||||
}
|
||||
}
|
||||
});
|
Reference in New Issue
Block a user