+ \r
+ collectionListToMenu : function(command, checkSelection){\r
+ command.setEnabled(false);\r
+ command.clearMenus();\r
+ var collectionList = this.getCollectionList();\r
+ if(!collectionList) return;\r
+ var submenus = [];\r
+ for(var key in collectionList){\r
+ if(this.getCollectionId() && key == this.getCollectionId()) continue;\r
+ submenus.push({\r
+ "label":collectionList[key], \r
+ "icon":"resource/slc/folder.png", \r
+ "commandId":key\r
+ });\r
+ } \r
+ submenus.push({"label":"New...", "icon":"resource/slc/folder-new.png", "commandId":"slc.client.create"});\r
+ command.setMenu(submenus);\r
+ if(checkSelection){\r
+ var viewSelection = this.getView().getViewSelection();\r
+ if(viewSelection.getCount()) command.setEnabled(true);\r
+ }else{\r
+ command.setEnabled(true);\r
+ }\r
+ },\r
+ \r
+ copySelectionToCollection:function(collectionId, selectionType){\r
+ if(collectionId == "slc.client.create"){\r
+ var modal = new org.argeo.ria.components.Modal("Create collection", "resource/slc/folder-new.png");\r
+ modal.makePromptForm("Enter the new collection name", function(value){\r
+ if(value == ""){\r
+ alert("Please enter a name for the new collection!");\r
+ return false;\r
+ }\r
+ else {\r
+ // Create the collection now, then recall the callback with the new name. \r
+ this.copySelectionToCollection(value, selectionType);\r
+ return true;\r
+ }\r
+ }, this);\r
+ modal.attachAndShow();\r
+ }else{ \r
+ this.debug("Copying "+selectionType+" to collection " + collectionId);\r
+ }\r
+ },\r
+ \r