Index: openacs-4/packages/ajax-filestorage-ui/ajax-filestorage-ui.info
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/ajax-filestorage-ui/ajax-filestorage-ui.info,v
diff -u -r1.7 -r1.8
--- openacs-4/packages/ajax-filestorage-ui/ajax-filestorage-ui.info	12 Apr 2008 10:10:58 -0000	1.7
+++ openacs-4/packages/ajax-filestorage-ui/ajax-filestorage-ui.info	27 Dec 2008 06:27:24 -0000	1.8
@@ -1,20 +1,20 @@
 <?xml version="1.0"?>
 <!-- Generated by the OpenACS Package Manager -->
 
-<package key="ajax-filestorage-ui" url="http://openacs.org/repository/apm/packages/ajax-filestorage-ui" type="apm_application">
+<package key="ajax-filestorage-ui" url="http://openacs.org/repository/apm/packages/ajax-filestorage-ui" type="apm_service">
     <package-name>Ajax File Storage UI</package-name>
     <pretty-plural>Ajax File Storage UIs</pretty-plural>
     <initial-install-p>f</initial-install-p>
-    <singleton-p>f</singleton-p>
+    <singleton-p>t</singleton-p>
     <auto-mount>ajaxfs</auto-mount>
 
-    <version name="1.0" url="http://openacs.org/repository/download/apm/ajax-filestorage-ui-1.0.apm">
+    <version name="1.01" url="http://openacs.org/repository/download/apm/ajax-filestorage-ui-1.01.apm">
         <owner url="mailto:ham@solutiongrove.com">Hamilton Chua</owner>
         <release-date>2007-11-25</release-date>
         <vendor url="http://www.solutiongrove.com">Solutiongrove</vendor>
         <maturity>3</maturity>
 
-        <provides url="ajax-filestorage-ui" version="1.0"/>
+        <provides url="ajax-filestorage-ui" version="1.01"/>
         <requires url="ajaxhelper" version="0.8d"/>
         <requires url="file-storage" version="5.1.5d3"/>
         <requires url="categories" version="1.1"/>
Index: openacs-4/packages/ajax-filestorage-ui/lib/ajaxfs-include.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/ajax-filestorage-ui/lib/ajaxfs-include.adp,v
diff -u -r1.10 -r1.11
--- openacs-4/packages/ajax-filestorage-ui/lib/ajaxfs-include.adp	26 Aug 2008 20:36:42 -0000	1.10
+++ openacs-4/packages/ajax-filestorage-ui/lib/ajaxfs-include.adp	27 Dec 2008 06:27:24 -0000	1.11
@@ -3,13 +3,18 @@
     <if @theme@ not nil>
         <link rel="stylesheet" type="text/css" href="/resources/ajaxhelper/ext2/resources/css/xtheme-@theme@.css">
     </if>
-    <link rel="stylesheet" type="text/css" href="http://yui.yahooapis.com/2.5.1/build/autocomplete/assets/skins/sam/autocomplete.css" />
+    <link rel="stylesheet" type="text/css" href="http://yui.yahooapis.com/2.6.0/build/autocomplete/assets/skins/sam/autocomplete.css" />
     <link rel="stylesheet" type="text/css" href="/resources/ajax-filestorage-ui/ajaxfs.css">
-    <script type="text/javascript" src="http://yui.yahooapis.com/2.5.1/build/utilities/utilities.js"></script>
-    <script type="text/javascript" src="http://yui.yahooapis.com/2.5.1/build/autocomplete/autocomplete-min.js"></script>
+    <script type="text/javascript" src="http://yui.yahooapis.com/2.6.0/build/utilities/utilities.js"></script>
+    <script type="text/javascript" src="http://yui.yahooapis.com/2.6.0/build/datasource/datasource-min.js"></script> 
+    <script type="text/javascript" src="http://yui.yahooapis.com/2.6.0/build/autocomplete/autocomplete-min.js"></script>
     <script type="text/javascript" src="/resources/ajaxhelper/ext2/adapter/yui/ext-yui-adapter.js"></script>
     <script type="text/javascript" src="/resources/ajaxhelper/ext2/ext-all.js"></script>
     <script type="text/javascript" src="/resources/ajax-filestorage-ui/swfupload/swfupload.js"></script>
+    <script type="text/javascript" src="/resources/ajax-filestorage-ui/swfupload/swfupload.queue.js"></script>
+    <script type="text/javascript" src="/resources/ajax-filestorage-ui/swfupload/fileprogress.js"></script>
+    <script type="text/javascript" src="/resources/ajax-filestorage-ui/utils.js"></script>
+
     <if @debug@ eq 1>
         <script type="text/javascript" src="/resources/ajax-filestorage-ui/ajaxfs.js"></script>
     </if>
Index: openacs-4/packages/ajax-filestorage-ui/lib/ajaxfs-include.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/ajax-filestorage-ui/lib/ajaxfs-include.tcl,v
diff -u -r1.9 -r1.10
--- openacs-4/packages/ajax-filestorage-ui/lib/ajaxfs-include.tcl	26 Aug 2008 20:36:42 -0000	1.9
+++ openacs-4/packages/ajax-filestorage-ui/lib/ajaxfs-include.tcl	27 Dec 2008 06:27:24 -0000	1.10
@@ -49,17 +49,21 @@
     set template_head_p 1
     template::head::add_css -order 500 -href "/resources/ajaxhelper/ext2/resources/css/ext-all.css"
     template::head::add_css -order 501 -href "/resources/ajaxhelper/ext2/resources/css/xtheme-${theme}.css"
-    template::head::add_css -order 502 -href "http://yui.yahooapis.com/2.5.1/build/autocomplete/assets/skins/sam/autocomplete.css"
+    template::head::add_css -order 502 -href "http://yui.yahooapis.com/2.6.0/build/autocomplete/assets/skins/sam/autocomplete.css"
     template::head::add_css -order 503 -href "/resources/ajax-filestorage-ui/ajaxfs.css"
-    template::head::add_javascript -order 101 -src "http://yui.yahooapis.com/2.5.1/build/utilities/utilities.js"
-    template::head::add_javascript -order 102 -src "http://yui.yahooapis.com/2.5.1/build/autocomplete/autocomplete-min.js"
-    template::head::add_javascript -order 103 -src "/resources/ajaxhelper/ext2/adapter/yui/ext-yui-adapter.js"
-    template::head::add_javascript -order 104 -src "/resources/ajaxhelper/ext2/ext-all.js"
-    template::head::add_javascript -order 105 -src "/resources/ajax-filestorage-ui/swfupload/swfupload.js"
+    template::head::add_javascript -order 101 -src "http://yui.yahooapis.com/2.6.0/build/utilities/utilities.js"
+    template::head::add_javascript -order 102 -src "http://yui.yahooapis.com/2.6.0/build/datasource/datasource-min.js"
+    template::head::add_javascript -order 103 -src "http://yui.yahooapis.com/2.6.0/build/autocomplete/autocomplete-min.js"
+    template::head::add_javascript -order 104 -src "/resources/ajaxhelper/ext2/adapter/yui/ext-yui-adapter.js"
+    template::head::add_javascript -order 105 -src "/resources/ajaxhelper/ext2/ext-all.js"
+    template::head::add_javascript -order 106 -src "/resources/ajax-filestorage-ui/swfupload/swfupload.js"
+    template::head::add_javascript -order 107 -src "/resources/ajax-filestorage-ui/swfupload/swfupload.queue.js"
+    template::head::add_javascript -order 108 -src "/resources/ajax-filestorage-ui/swfupload/fileprogress.js"
+    template::head::add_javascript -order 109 -src "/resources/ajax-filestorage-ui/utils.js"
     if { $debug } {
-        template::head::add_javascript -order 106 -src "/resources/ajax-filestorage-ui/ajaxfs.js"
+        template::head::add_javascript -order 110 -src "/resources/ajax-filestorage-ui/ajaxfs.js"
     } else {
-        template::head::add_javascript -order 106 -src "/resources/ajax-filestorage-ui/ajaxfs-min.js"
+        template::head::add_javascript -order 110 -src "/resources/ajax-filestorage-ui/ajaxfs-min.js"
     }
 }
 
@@ -98,9 +102,9 @@
         lappend options "pathToFolder: new Array([ajaxfs::generate_path -folder_id $folder_id])"
     }
 
-    # if { [exists_and_not_null public] || [permission::permission_p -no_login -no_cache -party_id [db_string "get_public" "select object_id from acs_magic_objects where name ='the_public'"] -object_id $package_id -privilege "read"] } {
-    lappend options "ispublic:true"
-    # }
+    if { [exists_and_not_null public] || [permission::permission_p -no_login -no_cache -party_id [db_string "get_public" "select object_id from acs_magic_objects where name ='the_public'"] -object_id $package_id -privilege "read"] } {
+        lappend options "ispublic:true"
+    }
 
     # notification type id
     set notif_type_id [notification::type::get_type_id -short_name fs_fs_notif]
Index: openacs-4/packages/ajax-filestorage-ui/www/resources/ajaxfs-min.js
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/ajax-filestorage-ui/www/resources/ajaxfs-min.js,v
diff -u -r1.15 -r1.16
--- openacs-4/packages/ajax-filestorage-ui/www/resources/ajaxfs-min.js	13 Dec 2008 14:16:35 -0000	1.15
+++ openacs-4/packages/ajax-filestorage-ui/www/resources/ajaxfs-min.js	27 Dec 2008 06:27:24 -0000	1.16
@@ -1,1342 +1 @@
-Ext.namespace("ajaxfs");
-Ext.BLANK_IMAGE_URL="/resources/ajaxhelper/ext2/resources/images/default/s.gif";
-ajaxfs=function(_1){
-this.xmlhttpurl="/ajaxfs/xmlhttp/";
-this.create_url_p=true;
-this.share_folders_p=true;
-this.config=null;
-this.layout=null;
-this.te=null;
-this.currentfolder=null;
-this.currenttag=null;
-this.msgbox=Ext.MessageBox;
-this.upldWindow=null;
-this.tagWindow=null;
-this.createurlWindow=null;
-this.sharefolderWindow=null;
-this.revisionsWindow=null;
-this.contextmenu=null;
-this.swfu=null;
-this.target_folder_id=null;
-this.communityCombo=null;
-this.initObj=function(){
-if(typeof (Ext.DomHelper)!="undefined"){
-if(_1){
-this.config=_1;
-if(this.config.xmlhttpurl){
-this.xmlhttpurl=this.config.xmlhttpurl;
-}
-if(this.config.create_url==0){
-this.create_url_p=false;
-}
-if(this.config.share_folders==0){
-this.share_folders_p=false;
-}
-if(this.config.views_p==0){
-this.views_p=false;
-}else{
-this.views_p=true;
-}
-if(!this.config.ispublic){
-Ext.Ajax.on("requestcomplete",this.isSessionExpired,this);
-}
-}
-Ext.QuickTips.init();
-this.initLayout();
-}
-};
-Ext.onReady(this.initObj,this,true);
-};
-ajaxfs.prototype={isSessionExpired:function(_2,_3,_4){
-if(readCookie("ad_user_login")==null){
-Ext.get(document.body).mask(acs_lang_text.sessionexpired||"Your session has expired. You need to login again. <br>You will be redirected to a login page shortly");
-var _5="";
-if(this.currentfolder!=null){
-var _5="?folder_id="+this.currentfolder;
-}
-window.location="/register/?return_url="+this.config.package_url+_5;
-}
-},asyncExpand:function(x){
-var _7=this.layout.findById("treepanel");
-var _8=_7.getNodeById(this.config.initOpenFolder);
-if(!_8){
-var x=x+1;
-var _9=this.config.pathToFolder[x];
-var _a=_7.getNodeById(_9);
-_a.on("expand",this.asyncExpand.createDelegate(this,[x]),this,{single:true});
-_a.expand(true);
-}else{
-_8.select();
-_8.fireEvent("click",_8);
-}
-},selectInitFolder:function(){
-var _b=this.layout.findById("treepanel");
-if(this.config.initOpenFolder){
-var _c=_b.getNodeById(this.config.initOpenFolder);
-if(_c){
-_c.expand();
-_c.fireEvent("click",_c);
-}else{
-var x=1;
-var _e=_b.getNodeById(this.config.pathToFolder[x]);
-_e.on("expand",this.asyncExpand.createDelegate(this,[x]),this,{single:true});
-_e.expand(true);
-}
-}else{
-_b.fireEvent("click",_b.getRootNode());
-}
-},initLayout:function(){
-var _f=[this.createLeft(),this.createRight()];
-if(this.config!=null&&this.config.layoutdiv){
-this.layout=new Ext.Panel({id:"fs-ui",layout:"border",applyTo:this.config.layoutdiv,tbar:this.createToolbar(),items:_f});
-}else{
-this.layout=new Ext.Viewport({id:"fs-ui",layout:"border",tbar:this.createToolbar(),items:_f});
-}
-},createToolsMenu:function(){
-var _10=new Ext.menu.Menu({id:"toolsmenu",shadow:false,items:[new Ext.menu.Item({id:"mnOpen",text:acs_lang_text.open||"Open",icon:"/resources/ajaxhelper/icons/page_white.png"}),new Ext.menu.Item({id:"mnTag",text:acs_lang_text.tag||"Tag",icon:"/resources/ajaxhelper/icons/tag_blue.png"}),new Ext.menu.Item({id:"mnView",text:acs_lang_text.views||"Views",icon:"/resources/ajaxhelper/icons/camera.png"}),new Ext.menu.Item({id:"mnRename",text:acs_lang_text.rename||"Rename",icon:"/resources/ajaxhelper/icons/page_edit.png"}),new Ext.menu.Item({id:"mnCopyLink",text:acs_lang_text.linkaddress||"Copy Link Address",icon:"/resources/ajaxhelper/icons/page_copy.png"}),new Ext.menu.Item({id:"mnPerms",text:acs_lang_text.permissions||"Permissions",icon:"/resources/ajaxhelper/icons/group_key.png"}),new Ext.menu.Item({id:"mnProp",text:acs_lang_text.properties||"Properties",icon:"/resources/ajaxhelper/icons/page_edit.png"}),new Ext.menu.Item({id:"mnArch",text:acs_lang_text.download_archive||"Download archive",icon:"/resources/ajaxhelper/icons/arrow_down.png"}),new Ext.menu.Item({id:"mnShare",text:acs_lang_text.sharefolder||"Share Folder",icon:"/resources/ajaxhelper/icons/group_link.png"}),new Ext.menu.Item({id:"mnNotif",text:acs_lang_text.request_notification||"Request Notification",icon:"/resources/ajaxhelper/icons/email.png"})]});
-_10.on("beforeshow",function(){
-var _11=this.layout.findById("filepanel");
-var _12=this.layout.findById("treepanel");
-if(_11.getSelectionModel().getCount()==0){
-for(var x=0;x<_10.items.items.length;x++){
-_10.items.items[x].enable();
-}
-_10.items.items[0].setText(acs_lang_text.open||"Open");
-_10.items.items[0].disable();
-_10.items.items[1].disable();
-_10.items.items[6].disable();
-_10.items.items[8].disable();
-Ext.Ajax.request({url:this.xmlhttpurl+"notif_p",success:function(o){
-if(parseInt(o.responseText)){
-_10.items.items[9].setText(acs_lang_text.unsubscribe_notification||"Unsubscribe");
-}else{
-_10.items.items[9].setText(acs_lang_text.request_notification||"Request Notification");
-}
-},failure:function(_15){
-_10.items.items[9].setText(acs_lang_text.request_notification||"Request Notification");
-},params:{object_id:_12.getSelectionModel().getSelectedNode().attributes["id"]}});
-_10.items.items[9].enable();
-if(!this.views_p){
-_10.items.items[2].disable();
-}
-}else{
-if(_11.getSelectionModel().getCount()==1){
-var _16=_11.getSelectionModel().getSelections();
-for(var x=0;x<_10.items.items.length;x++){
-_10.items.items[x].enable();
-}
-_10.items.items[9].setText(acs_lang_text.request_notification||"Request Notification");
-switch(_16[0].get("type")){
-case "folder":
-_10.items.items[0].setText(acs_lang_text.open||"Open");
-_10.items.items[1].disable();
-_10.items.items[6].disable();
-Ext.Ajax.request({url:this.xmlhttpurl+"notif_p",success:function(o){
-if(parseInt(o.responseText)){
-_10.items.items[9].setText(acs_lang_text.unsubscribe_notification||"Unsubscribe");
-}else{
-_10.items.items[9].setText(acs_lang_text.request_notification||"Request Notification");
-}
-},failure:function(_18){
-_10.items.items[9].setText(acs_lang_text.request_notification||"Request Notification");
-},params:{object_id:_12.getSelectionModel().getSelectedNode().attributes["id"]}});
-_10.items.items[9].enable();
-break;
-case "symlink":
-_10.items.items[0].setText(acs_lang_text.open||"Open");
-_10.items.items[1].disable();
-_10.items.items[3].disable();
-_10.items.items[6].disable();
-_10.items.items[9].disable();
-break;
-case "url":
-_10.items.items[0].setText(acs_lang_text.open||"Open");
-_10.items.items[6].disable();
-_10.items.items[7].disable();
-_10.items.items[8].disable();
-_10.items.items[9].disable();
-break;
-default:
-_10.items.items[0].setText(acs_lang_text.download||"Download");
-_10.items.items[7].disable();
-_10.items.items[8].disable();
-_10.items.items[9].disable();
-break;
-}
-if(!this.share_folders_p){
-_10.items.items[8].disable();
-}
-if(!this.views_p){
-_10.items.items[2].disable();
-}
-}else{
-for(var x=0;x<_10.items.items.length;x++){
-_10.items.items[x].disable();
-}
-}
-}
-},this);
-_10.on("itemclick",function(_19,e){
-var _1b=this.layout.findById("filepanel");
-if(_1b.getSelectionModel().getCount()==1){
-var _1c=_1b;
-var _1d=_1c.getSelectionModel().getSelected().get("id");
-for(var x=0;x<_1c.store.data.items.length;x++){
-if(_1c.store.data.items[x].id==_1d){
-var i=x;
-break;
-}
-}
-}else{
-var _1c=this.layout.findById("treepanel");
-var _1d=_1c.getSelectionModel().getSelectedNode().attributes["id"];
-var i=_1d;
-}
-switch(_19.getId()){
-case "mnOpen":
-this.openItem(_1c,i);
-break;
-case "mnTag":
-this.tagFsitem(_1c,i);
-break;
-case "mnView":
-this.redirectViews(_1c,i);
-break;
-case "mnRename":
-this.renameItem(_1c,i);
-break;
-case "mnCopyLink":
-this.copyLink(_1c,i);
-break;
-case "mnPerms":
-this.redirectPerms(_1c,i);
-break;
-case "mnProp":
-this.showRevisions(_1c,i);
-break;
-case "mnArch":
-this.downloadArchive(_1d);
-break;
-case "mnShare":
-this.showShareOptions(_1c,i);
-break;
-case "mnNotif":
-this.redirectNotifs(_1c,i);
-break;
-}
-},this);
-var _20={text:"Tools",iconCls:"toolsmenu",menu:_10};
-return _20;
-},createToolbar:function(){
-var _21=this.config.treerootnode;
-var _22=[];
-if(_21.attributes["write_p"]=="t"){
-var _22=[" ",{text:acs_lang_text.newfolder||"New Folder",tooltip:acs_lang_text.newfolder||"New Folder",icon:"/resources/ajaxhelper/icons/folder_add.png",cls:"x-btn-text-icon",handler:this.addFolder.createDelegate(this)},{text:acs_lang_text.uploadfile||"Upload Files",tooltip:acs_lang_text.uploadfile||"Upload Files",icon:"/resources/ajaxhelper/icons/page_add.png",cls:"x-btn-text-icon",handler:this.addFile.createDelegate(this)}];
-if(this.create_url_p){
-_22.push({text:acs_lang_text.createurl||"Create Url",tooltip:acs_lang_text.createurl||"Create Url",icon:"/resources/ajaxhelper/icons/page_link.png",cls:"x-btn-text-icon",handler:this.addUrl.createDelegate(this)});
-}
-_22.push({text:acs_lang_text.deletefs||"Delete",tooltip:acs_lang_text.deletefs||"Delete",icon:"/resources/ajaxhelper/icons/delete.png",cls:"x-btn-text-icon",handler:this.delItem.createDelegate(this)});
-_22.push(this.createToolsMenu());
-_22.push("->");
-}
-_22.push({tooltip:"This may take a few minutes if you have a lot of files",text:acs_lang_text.download_archive||"Download Archive",icon:"/resources/ajaxhelper/icons/arrow_down.png",cls:"x-btn-text-icon",handler:this.downloadArchive.createDelegate(this,[_21.id],false)});
-return _22;
-},createLeft:function(){
-var _23=new Ext.Panel({id:"leftpanel",region:"west",collapsible:true,titlebar:true,title:" ",layout:"accordion",split:true,width:300,items:[this.createTreePanel(),this.createTagPanel()]});
-return _23;
-},createTreePanel:function(){
-var _24=new Ext.tree.AsyncTreeNode({text:this.config.treerootnode.text,draggable:false,id:this.config.treerootnode.id,singeClickExpand:true,expanded:true,attributes:this.config.treerootnode.attributes});
-var _25=new Ext.tree.TreeLoader({dataUrl:this.xmlhttpurl+"load-treenodes",baseParams:{package_id:this.config.package_id}});
-var _26=new Ext.tree.TreePanel({id:"treepanel",title:"Folders",autoScroll:true,animate:true,enableDrag:false,enableDrop:true,loadMask:true,loader:_25,root:_24,ddAppendOnly:true,containerScroll:true,dropConfig:{dropAllowed:true,ddGroup:"fileDD",onNodeOver:function(_27,_28,e,_2a){
-if(_27.node.id==_27.node.ownerTree.getSelectionModel().getSelectedNode().id){
-return false;
-}
-if(_28.dragData.selections){
-for(var x=0;x<_28.dragData.selections.length;x++){
-if(_27.node.id==_28.dragData.selections[x].data.id){
-return false;
-}
-}
-}
-return true;
-},onNodeDrop:function(_2c,_2d,e,_2f){
-var _30=this.layout.findById("filepanel");
-var _31=_2c.node.id;
-var _32=[];
-for(var x=0;x<_2f.selections.length;x++){
-_32[x]=_2f.selections[x].data.id;
-}
-var _34=acs_lang_text.an_error_occurred||"An error occurred";
-var _35=acs_lang_text.reverted||"Your changes have been reverted";
-var _36=function(_37){
-var _38=Ext.decode(_37.responseText);
-if(_38.success){
-var dm=_30.store;
-var _3a=_30.getSelectionModel().getSelections();
-var _3b=false;
-for(var x=0;x<_3a.length;x++){
-dm.remove(_3a[x]);
-if(_3a[x].data.type=="folder"){
-_3b=true;
-if(_2c.node.ownerTree.getNodeById(_3a[x].data.id)){
-var _3d=_2c.node.ownerTree.getNodeById(_3a[x].data.id).parentNode;
-_3d.loaded=false;
-_3d.removeChild(_2c.node.ownerTree.getNodeById(_3a[x].data.id));
-}
-}
-}
-if(_3b){
-var _3e=_2c.node.ownerTree.getRootNode();
-if(_3e.id==_2c.node.id){
-_3e.fireEvent("click",_3e);
-}
-_2c.node.loaded=false;
-_2c.node.expand();
-}
-}else{
-Ext.Msg.alert(acs_lang_text.error||"Error",_34+"<br>"+_35);
-}
-};
-Ext.Ajax.request({url:this.xmlhttpurl+"move-fsitem",success:_36,failure:function(_3f){
-var _40=Ext.decode(_3f.responseText);
-var msg="";
-if(_40.error){
-msg=_40.error;
-}
-Ext.Msg.alert(acs_lang_text.error||"Error",_34+"<br>"+msg+"<br>"+_35);
-},params:{folder_target_id:_31,file_ids:_32}});
-return true;
-}.createDelegate(this)}});
-this.enableTreeFolderRename(_26);
-_24.on("expand",this.selectInitFolder,this,{single:true});
-_26.on("click",this.loadFoldercontents,this);
-return _26;
-},enableTreeFolderRename:function(_42){
-this.te=new Ext.tree.TreeEditor(_42,{allowBlank:false,blankText:acs_lang_text.folder_name_required||"A folder name is required",ignoreNoChange:true});
-this.te.on("beforestartedit",function(_43,el,_45){
-if(_43.editNode.attributes.attributes.write_p=="t"){
-return true;
-}else{
-Ext.Msg.alert(acs_lang_text.permission_denied||"Permission Denied",acs_lang_text.permission_denied||"Sorry, you do not have permission to rename this folder");
-return false;
-}
-},this,true);
-this.te.on("beforecomplete",function(_46,_47,_48){
-var _49=_46.editNode.parentNode;
-if(_49){
-var _4a=_49.childNodes;
-for(x=0;x<_4a.length;x++){
-if(_4a[x].text==_47&&_4a[x].id!=_46.editNode.id){
-Ext.Msg.alert(acs_lang_text.duplicate_name||"Duplicate Name",acs_lang_text.duplicate_name_error||"Please enter a different name. The name you entered is already being used.");
-return false;
-}
-}
-}
-return true;
-},this,true);
-this.te.on("complete",function(_4b,_4c,_4d){
-var _4e=acs_lang_text.an_error_occurred||"An error occurred";
-var _4f=acs_lang_text.reverted||"Your changes have been reverted";
-Ext.Ajax.request({url:this.xmlhttpurl+"rename-fsitem",success:function(_50){
-var _51=Ext.decode(_50.responseText);
-if(!_51.success){
-Ext.Msg.alert(acs_lang_text.error||"Error",_4e+": <br><br><font color='red'>"+_51.error+"</font><br><br>"+_4f);
-_4b.editNode.setText(_4d);
-}
-},failure:function(){
-Ext.Msg.alert(acs_lang_text.error||"Error",_4e+"<br>"+_4f);
-_4b.editNode.setText(_4d);
-},params:{newname:_4c,object_id:_4b.editNode.id,type:"folder"}});
-},this,true);
-},createTagPanel:function(){
-var _52=new Ext.Panel({id:"tagcloudpanel",title:"Tags",frame:false,loadMask:true,autoScroll:true,autoLoad:{url:this.xmlhttpurl+"get-tagcloud",params:{package_id:this.config.package_id}}});
-var _53=function(){
-var _54=this;
-var _55=_54.currenttag;
-_52.body.on("click",function(obj,el){
-if(el.tagName=="A"){
-if(_55!=null){
-Ext.get(_55).setStyle("font-weight","normal");
-}
-Ext.get(el).setStyle("font-weight","bold");
-_55=el.id;
-this.loadTaggedFiles(el.id);
-}
-},this);
-};
-_52.on("render",_53,this);
-return _52;
-},loadTaggedFiles:function(_58){
-this.layout.findById("treepanel").getSelectionModel().clearSelections();
-var id=_58.substring(3,_58.length);
-this.layout.findById("filepanel").store.baseParams["tag_id"]=id;
-this.layout.findById("filepanel").store.load();
-this.layout.findById("filepanel").store.baseParams["tag_id"]="";
-},createRight:function(){
-var _5a=function(_5b,p,_5d){
-p.attr="ext:qtip='"+_5d.get("qtip")+"'";
-return _5b;
-};
-var _5e=[{header:"",width:30,sortable:true,dataIndex:"icon"},{header:acs_lang_text.filename||"Filename",id:"filename",sortable:true,dataIndex:"title",renderer:_5a},{header:acs_lang_text.size||"Size",sortable:true,dataIndex:"size"},{header:acs_lang_text.lastmodified||"Last Modified",sortable:true,dataIndex:"lastmodified"}];
-var _5f=new Ext.data.JsonReader({totalProperty:"total",root:"foldercontents",id:"id"},[{name:"id",type:"int"},{name:"qtip"},{name:"icon"},{name:"title"},{name:"filename"},{name:"type"},{name:"tags"},{name:"url"},{name:"linkurl"},{name:"write_p"},{name:"symlink_id"},{name:"size"},{name:"lastmodified"}]);
-var _60=new Ext.data.HttpProxy({url:this.xmlhttpurl+"get-foldercontents"});
-var _61=new Ext.grid.ColumnModel(_5e);
-var _62=new Ext.data.Store({proxy:_60,reader:_5f,remoteSort:true});
-var _63=new Ext.grid.GridPanel({store:_62,cm:_61,id:"filepanel",ddGroup:"fileDD",region:"center",split:true,autoScroll:true,autoExpandColumn:"filename",collapsible:true,enableDragDrop:true,width:250,loadMask:true,frame:false,viewConfig:{forceFit:false,enableRowBody:true,showPreview:true,getRowClass:function(_64,_65,p,ds){
-var xf=Ext.util.Format;
-if(_64.data.tags!=""){
-p.body="<div id='tagscontainer"+_64.data.id+"' style='padding-left:35px;color:blue'>Tags: "+xf.ellipsis(xf.stripTags(_64.data.tags),200)+"</div>";
-}else{
-p.body="<div id='tagscontainer"+_64.data.id+"' style='padding-left:35px;color:blue'></div>";
-}
-return "x-grid3-row-expanded";
-}}});
-_63.on("rowdblclick",this.openItem,this,true);
-_63.on("rowcontextmenu",this.showRowContext,this,true);
-return _63;
-},showRowContext:function(_69,i,e){
-e.stopEvent();
-var _6c=this.layout.findById("treepanel");
-var _6d=this.config.treerootnode;
-var dm=_69.store;
-var _6f=dm.getAt(i);
-var _70=_6f.get("type");
-var _71=_6f.get("id");
-var _72;
-switch(_70){
-case "folder":
-_72="Open";
-break;
-case "url":
-_72="Open";
-break;
-default:
-_72="Download";
-break;
-}
-this.contextmenu=new Ext.menu.Menu({id:"rightclickmenu",items:[new Ext.menu.Item({text:_72,icon:"/resources/ajaxhelper/icons/page_white.png",handler:this.openItem.createDelegate(this,[_69,i,e],false)}),new Ext.menu.Item({text:"Tag",icon:"/resources/ajaxhelper/icons/tag_blue.png",handler:this.tagFsitem.createDelegate(this,[_69,i,e],false)}),new Ext.menu.Item({text:"Views",icon:"/resources/ajaxhelper/icons/camera.png",handler:this.redirectViews.createDelegate(this,[_69,i,e],false)}),new Ext.menu.Item({text:acs_lang_text.deletefs||"Delete",icon:"/resources/ajaxhelper/icons/delete.png",handler:this.delItem.createDelegate(this,[_69,i,e],false)}),new Ext.menu.Item({text:acs_lang_text.rename||"Rename",icon:"/resources/ajaxhelper/icons/page_edit.png",handler:this.renameItem.createDelegate(this,[_69,i,e],false)}),new Ext.menu.Item({text:acs_lang_text.linkaddress||"Copy Link Address",icon:"/resources/ajaxhelper/icons/page_copy.png",handler:this.copyLink.createDelegate(this,[_69,i,e],false)}),new Ext.menu.Item({text:acs_lang_text.permissions||"Permissions",icon:"/resources/ajaxhelper/icons/group_key.png",handler:this.redirectPerms.createDelegate(this,[_69,i,e],false)}),new Ext.menu.Item({text:acs_lang_text.properties||"Properties",icon:"/resources/ajaxhelper/icons/page_edit.png",handler:this.showRevisions.createDelegate(this,[_69,i,e],false)}),new Ext.menu.Item({text:acs_lang_text.download_archive||"Download archive",icon:"/resources/ajaxhelper/icons/arrow_down.png",handler:this.downloadArchive.createDelegate(this,[_71],false)}),new Ext.menu.Item({text:acs_lang_text.sharefolder||"Share Folder",icon:"/resources/ajaxhelper/icons/group_link.png",handler:this.showShareOptions.createDelegate(this,[_69,i,e],false)})]});
-if(_69.getSelectionModel().getCount()>1){
-this.contextmenu.items.items[0].hide();
-this.contextmenu.items.items[1].hide();
-this.contextmenu.items.items[2].hide();
-this.contextmenu.items.items[3].show();
-this.contextmenu.items.items[4].hide();
-this.contextmenu.items.items[5].hide();
-this.contextmenu.items.items[6].hide();
-this.contextmenu.items.items[7].hide();
-this.contextmenu.items.items[8].hide();
-this.contextmenu.items.items[9].hide();
-}else{
-this.contextmenu.items.items[0].show();
-this.contextmenu.items.items[2].show();
-this.contextmenu.items.items[3].show();
-this.contextmenu.items.items[4].show();
-this.contextmenu.items.items[5].show();
-this.contextmenu.items.items[6].show();
-switch(_70){
-case "folder":
-this.contextmenu.items.items[1].hide();
-this.contextmenu.items.items[7].hide();
-this.contextmenu.items.items[8].show();
-if(_6c.getNodeById(_71).attributes.attributes.type=="symlink"){
-this.contextmenu.items.items[9].hide();
-}else{
-this.contextmenu.items.items[9].show();
-}
-break;
-case "url":
-this.contextmenu.items.items[1].show();
-this.contextmenu.items.items[7].hide();
-this.contextmenu.items.items[8].hide();
-this.contextmenu.items.items[9].hide();
-break;
-case "symlink":
-this.contextmenu.items.items[4].hide();
-this.contextmenu.items.items[9].hide();
-break;
-default:
-this.contextmenu.items.items[1].show();
-this.contextmenu.items.items[7].show();
-this.contextmenu.items.items[8].hide();
-this.contextmenu.items.items[9].hide();
-}
-}
-if(!this.share_folders_p){
-this.contextmenu.items.items[9].hide();
-}
-if(!this.views_p){
-this.contextmenu.items.items[2].hide();
-}
-if(_6d.attributes["write_p"]=="f"){
-this.contextmenu.items.items[1].hide();
-this.contextmenu.items.items[3].hide();
-this.contextmenu.items.items[6].hide();
-this.contextmenu.items.items[7].hide();
-this.contextmenu.items.items[9].hide();
-}
-var _73=e.getXY();
-this.contextmenu.rowid=i;
-this.contextmenu.showAt([_73[0],_73[1]]);
-},loadFoldercontents:function(_74,e){
-this.currentfolder=_74.id;
-var _76=this.layout.findById("filepanel");
-_76.store.baseParams["folder_id"]=_74.id;
-_76.store.baseParams["package_id"]=this.config.package_id;
-if(_74.loading){
-_74.on("expand",function(){
-this.store.load();
-},_76,{single:true});
-}else{
-_76.store.load();
-}
-},openItem:function(_77,i,e){
-var _7a=this.layout.findById("treepanel");
-var dm=_77.store;
-var _7c=dm.getAt(i);
-if(_7c.get("type")=="folder"||_7c.get("type")=="symlink"){
-var _7d=_7a.getNodeById(_7c.get("id"));
-if(!_7d.parentNode.isExpanded()){
-_7d.parentNode.expand();
-}
-_7d.fireEvent("click",_7d);
-_7d.expand();
-}else{
-window.open(_7c.get("url"));
-window.focus();
-}
-},delItem:function(_7e,i,e){
-var _81=acs_lang_text.confirm_delete||"Are you sure you want to delete ";
-var _82=acs_lang_text.foldercontains||"This folder contains";
-var _83=this.layout.findById("treepanel");
-if(_7e.id=="filepanel"){
-var _84=_7e;
-if(_84.getSelectionModel().getCount()<=1){
-_84.getSelectionModel().selectRow(i);
-}
-}else{
-var _84=this.layout.findById("filepanel");
-}
-var _85=_84.getSelectionModel().getSelections();
-var _86=true;
-if(_85.length>0){
-_86=false;
-if(_85.length==1){
-var _87=_85[0].get("title");
-if(_85[0].get("type")==="folder"){
-var msg=_82+" <b>"+_85[0].get("size")+"</b>.<br>";
-}else{
-var msg="";
-}
-var msg=msg+_81+" <b>"+_87+"</b> ?";
-if(_85[0].get("type")==="symlink"){
-var _89=_85[0].get("symlink_id");
-}else{
-var _89=_85[0].get("id");
-}
-}else{
-var msg=_81+": <br><br>";
-var _89=[];
-for(var x=0;x<_85.length;x++){
-msg=msg+"<b>"+_85[x].get("title")+"</b> ";
-if(_85[x].get("type")==="folder"){
-msg=msg+"("+_85[x].get("size")+")";
-}
-msg=msg+"<br>";
-if(_85[x].get("type")==="symlink"){
-_89[x]=_85[x].get("symlink_id");
-}else{
-_89[x]=_85[x].get("id");
-}
-}
-}
-var _8b={object_id:_89};
-}else{
-_86=true;
-var _8c=_83.getSelectionModel().getSelectedNode();
-var _89=_8c.attributes["id"];
-var _8d=_8c.attributes.attributes["type"];
-var _8e=_8c.attributes.attributes["symlink_id"];
-var _8f=_83.getRootNode();
-if(_8d=="symlink"){
-var _8b={object_id:_8e};
-}else{
-var _8b={object_id:_89};
-}
-if(_8c.attributes["id"]==_8f.attributes["id"]){
-Ext.Msg.alert(acs_lang_text.alert||"Alert",acs_lang_text.cant_del_root||"The root folder can not be deleted.");
-return;
-}else{
-if(typeof (_8c.attributes.attributes["size"])=="undefined"){
-var msg="";
-}else{
-var msg=_82+" <b>"+_8c.attributes.attributes["size"]+"</b>.<br>";
-}
-msg=msg+_81+" <b>"+_8c.attributes["text"]+"</b>?";
-}
-}
-var _90=function(_91){
-if(_91==="yes"){
-Ext.Ajax.request({url:this.xmlhttpurl+"delete-fsitem",success:function(_92){
-var _93=Ext.decode(_92.responseText);
-if(_93.success){
-if(_86){
-var _94=_83.getSelectionModel().getSelectedNode();
-var _95=_94.parentNode;
-_95.fireEvent("click",_95);
-_95.removeChild(_94);
-}else{
-for(var x=0;x<_85.length;x++){
-_84.store.remove(_85[x]);
-var _97=_85[x].get("id");
-var _94=_83.getNodeById(_97);
-if(_94){
-_94.parentNode.fireEvent("click",_94.parentNode);
-_94.parentNode.removeChild(_94);
-}
-}
-}
-}else{
-Ext.Msg.alert(acs_lang_text.error||"Error","Sorry, we encountered an error.");
-}
-},failure:function(){
-Ext.Msg.alert(acs_lang_text.error||"Error",error_msg_txt+"<br><br><font color='red'>"+resultObj.error+"</font>");
-},params:_8b});
-}
-};
-Ext.MessageBox.confirm(acs_lang_text.confirm||"Confirm",msg,_90,this);
-},addFolder:function(){
-var te=this.te;
-var _99=this.layout.findById("treepanel");
-var _9a=_99.getSelectionModel().getSelectedNode();
-_9a.expand();
-var _9b=acs_lang_text.new_folder_error||"Sorry, there was an error trying to create your new folder.";
-Ext.Ajax.request({url:this.xmlhttpurl+"add-blankfolder",success:function(_9c){
-var _9d=Ext.decode(_9c.responseText);
-if(_9d.success){
-var _9e=_9a.appendChild(new Ext.tree.TreeNode({text:_9d.pretty_folder_name,id:_9d.id,iconCls:"folder",singleClickExpand:true,attributes:{write_p:"t"}}));
-_99.getSelectionModel().select(_9e);
-_9e.loaded=true;
-_9e.fireEvent("click",_9e);
-setTimeout(function(){
-te.editNode=_9e;
-te.startEdit(_9e.ui.textNode);
-},10);
-}else{
-Ext.Msg.alert(acs_lang_text.error||"Error",_9b+"<br><br><font color='red'>"+_9d.error+"</font>");
-}
-},failure:function(_9f){
-var _a0=Ext.decode(_9f.responseText);
-Ext.Msg.alert(acs_lang_text.error||"Error",_9b+"<br><br><font color='red'>"+_a0.error+"</font>");
-},params:{folder_id:_9a.attributes["id"]}});
-},createSwfObj:function(){
-var _a1=this;
-var _a2=_a1.layout.findById("treepanel");
-var _a3=_a1.currentfolder;
-if(this.swfu==null){
-var _a4=String(this.config.package_id);
-var _a5=String(this.config.user_id);
-var _a6=String(this.currentfolder);
-var _a7=String(this.config.max_file_size);
-var _a8=function(_a9,_aa){
-try{
-var _ab=Math.ceil((_aa/_a9.size)*100);
-var _ac=new FileProgress(_a9,this.getSetting("progress_target"));
-_ac.SetProgress(_ab);
-_ac.SetStatus(acs_lang_text.uploading||"Uploading...");
-}
-catch(ex){
-this.debugMessage(ex);
-}
-};
-var _ad=function(_ae){
-try{
-var _af=new FileProgress(_ae,this.getSetting("progress_target"));
-_af.SetCancelled();
-_af.SetStatus(acs_lang_text.uploadcancel||"Cancelled (This item will be removed shortly)");
-_af.ToggleCancel(false);
-}
-catch(ex){
-this.debugMessage(ex);
-}
-};
-var _b0=function(_b1){
-try{
-var _b2=new FileProgress(_b1,this.getSetting("progress_target"));
-_b2.SetComplete();
-_b2.SetStatus(acs_lang_text.complete||"Complete.");
-_b2.ToggleCancel(false);
-}
-catch(ex){
-this.debugMessage(ex);
-}
-};
-var _b3=function(_b4){
-var _b5=_a2.getNodeById(_a1.currentfolder);
-_b5.fireEvent("click",_b5);
-};
-var _b6=function(_b7,_b8,_b9){
-try{
-if(_b7==SWFUpload.ERROR_CODE_QUEUE_LIMIT_EXCEEDED){
-Ext.Msg.alert(acs_lang_text.alert||"Alert","You have attempted to queue too many files.\n"+(_b9==0?"You have reached the upload limit.":"You may select "+(_b9>1?"up to "+_b9+" files.":"one file.")));
-return;
-}
-var _ba=new FileProgress(_b8,this.getSetting("progress_target"));
-_ba.SetError();
-_ba.ToggleCancel(false);
-switch(_b7){
-case SWFUpload.ERROR_CODE_HTTP_ERROR:
-_ba.SetStatus("Upload Error");
-this.debugMessage("Error Code: HTTP Error, File name: "+file.name+", Message: "+_b9);
-break;
-case SWFUpload.ERROR_CODE_MISSING_UPLOAD_TARGET:
-_ba.SetStatus("Configuration Error");
-this.debugMessage("Error Code: No backend file, File name: "+file.name+", Message: "+_b9);
-break;
-case SWFUpload.ERROR_CODE_UPLOAD_FAILED:
-_ba.SetStatus("Upload Failed.");
-this.debugMessage("Error Code: Upload Failed, File name: "+file.name+", File size: "+file.size+", Message: "+_b9);
-break;
-case SWFUpload.ERROR_CODE_IO_ERROR:
-_ba.SetStatus("Server (IO) Error");
-this.debugMessage("Error Code: IO Error, File name: "+file.name+", Message: "+_b9);
-break;
-case SWFUpload.ERROR_CODE_SECURITY_ERROR:
-_ba.SetStatus("Security Error");
-this.debugMessage("Error Code: Security Error, File name: "+file.name+", Message: "+_b9);
-break;
-case SWFUpload.ERROR_CODE_FILE_EXCEEDS_SIZE_LIMIT:
-_ba.SetStatus("File is too big.");
-this.debugMessage("Error Code: File too big, File name: "+file.name+", File size: "+file.size+", Message: "+_b9);
-break;
-case SWFUpload.ERROR_CODE_ZERO_BYTE_FILE:
-_ba.SetStatus("Cannot upload Zero Byte files.");
-this.debugMessage("Error Code: Zero byte file, File name: "+file.name+", File size: "+file.size+", Message: "+_b9);
-break;
-case SWFUpload.ERROR_CODE_UPLOAD_LIMIT_EXCEEDED:
-_ba.SetStatus("Upload limit exceeded.");
-this.debugMessage("Error Code: Upload Limit Exceeded, File name: "+file.name+", File size: "+file.size+", Message: "+_b9);
-break;
-default:
-_ba.SetStatus("Unhandled Error");
-this.debugMessage("Error Code: "+_b7+", File name: "+file.name+", File size: "+file.size+", Message: "+_b9);
-break;
-}
-}
-catch(ex){
-this.debugMessage(ex);
-}
-};
-var _bb=function(_bc){
-var _bd=acs_lang_text.for_upload_to||"for upload to";
-var _be=acs_lang_text.zip_extracted||"Zip File (Will be extracted after upload)";
-try{
-var _bf=_a1.currentfolder;
-var _c0=_a2.getNodeById(_bf).text;
-var _c1=new FileProgress(_bc,this.getSetting("progress_target"));
-_c1.SetStatus(_bd+" <b>"+_c0+"</b><br>Title: <input type='text' onblur=\"fsInstance.swfu.removeFileParam('"+_bc.id+"','filetitle');fsInstance.swfu.addFileParam('"+_bc.id+"','filetitle',this.value)\">(optional)<br><input type='checkbox' id='zip"+_bc.id+"' onclick=\"if(document.getElementById('zip"+_bc.id+"').checked) { fsInstance.swfu.addFileParam('"+_bc.id+"','unpack_p','1') } else { fsInstance.swfu.removeFileParam('"+_bc.id+"','unpack_p') }\"> "+_be);
-_c1.ToggleCancel(true,this);
-this.addFileParam(_bc.id,"folder_id",_bf);
-}
-catch(ex){
-this.debugMessage(ex);
-}
-};
-this.swfu=new SWFUpload({debug:false,upload_target_url:this.xmlhttpurl+"add-file-flash",upload_params:{user_id:_a5,package_id:_a4},file_types:"*.*",file_size_limit:_a7,file_queue_limit:0,file_upload_limit:10,begin_upload_on_queue:false,file_queued_handler:_bb,file_progress_handler:_a8,file_cancelled_handler:_ad,file_complete_handler:_b0,queue_complete_handler:_b3,error_handler:_b6,flash_url:"/resources/ajax-filestorage-ui/swfupload/swfupload.swf"});
-}
-},addFile:function(){
-if(this.upldWindow==null){
-if(!this.config.multi_file_upload||checkFlashVersion()<9||checkFlashVersion()==10||Ext.isLinux){
-var _c2=acs_lang_text.file_to_upload||"File to upload";
-var _c3=acs_lang_text.file_title||"Title";
-var _c4=acs_lang_text.file_description||"Description";
-var _c5=acs_lang_text.multiple_files||"Multiple Files";
-var _c6=acs_lang_text.multiple_files_msg||"This is a ZIPfile containing multiple files.";
-var _c7=true;
-var _c8=acs_lang_text.uploadfile||"Upload a File";
-var _c9=new Ext.Panel({id:"form_addfile",align:"left",frame:true,html:"<form id=\"newfileform\" method=\"post\" enctype=\"multipart/form-data\"><input type=\"hidden\" name=\"package_id\" value=\""+this.config.package_id+"\"><input type=\"hidden\" name=\"folder_id\" value=\""+this.currentfolder+"\"><p>"+_c2+"<br /><input type=\"file\" name=\"upload_file\" id=\"upload_file\"></p><br><p>"+_c3+"<br /><input type=\"text\" name=\"filetitle\" id=\"filetitle\"></p><br><p>"+_c4+" :<br /><textarea name=\"filedescription\" id=\"filedescription\"></textarea></p><p>"+_c5+" :<br /><br /><input type=\"checkbox\" name=\"unpack_p\" value=\"t\" id=\"unpack_p\" /> "+_c6+"</p></form>"});
-var _ca=[{text:acs_lang_text.upload||"Upload",handler:this.uploadOneFile.createDelegate(this),icon:"/resources/ajaxhelper/icons/arrow_up.png",cls:"x-btn-text-icon"},{text:acs_lang_text.close||"Close",handler:function(){
-this.upldWindow.hide();
-}.createDelegate(this),icon:"/resources/ajaxhelper/icons/cross.png",cls:"x-btn-text-icon"}];
-}else{
-this.createSwfObj();
-var _cb=acs_lang_text.upload_intro||"Click <b>Browse</b> to select a file to upload to the selected folder on the tree.";
-var _c7=false;
-var _c8="Upload Files";
-var _c9=new Ext.Panel({id:"form_multi_addfile",autoScroll:true,frame:true,html:"<div id=\"upldMsg\">"+_cb+"<hr></div><div class=\"flash\" id=\"fsuploadprogress\"></div>"});
-_c9.on("render",function(){
-this.swfu.addSetting("progress_target","fsuploadprogress");
-},this);
-var _ca=[{text:"Browse",handler:this.swfu.browse.createDelegate(this.swfu),icon:"/resources/ajaxhelper/icons/page_add.png",cls:"x-btn-text-icon"},{text:"Upload",handler:this.swfu.startUpload.createDelegate(this.swfu,[null,this],false),icon:"/resources/ajaxhelper/icons/arrow_up.png",cls:"x-btn-text-icon"},{text:"Hide",handler:function(){
-this.upldWindow.hide();
-}.createDelegate(this),icon:"/resources/ajaxhelper/icons/cross.png",cls:"x-btn-text-icon"}];
-}
-this.upldWindow=new Ext.Window({id:"upload-win",layout:"fit",width:400,height:300,title:_c8,closeAction:"hide",modal:_c7,plain:true,resizable:false,items:_c9,buttons:_ca});
-}else{
-if(!this.config.multi_file_upload||checkFlashVersion()<9||checkFlashVersion()==10||Ext.isLinux){
-document.getElementById("newfileform").reset();
-document.getElementById("newfileform").folder_id.value=this.currentfolder;
-}
-}
-this.upldWindow.show();
-},uploadOneFile:function(){
-if(Ext.get("upload_file").getValue()!=""&&Ext.get("filetitle").getValue()!=""){
-var _cc=this.layout.findById("treepanel");
-var _cd={success:function(){
-},upload:function(){
-_cc.getSelectionModel().getSelectedNode().loaded=false;
-_cc.getSelectionModel().getSelectedNode().fireEvent("click",_cc.getSelectionModel().getSelectedNode());
-this.upldWindow.body.unmask();
-this.upldWindow.hide();
-},failure:function(){
-Ext.Msg.alert(acs_lang_text.error||"Error",acs_lang_text.upload_failed||"Upload failed, please try again later.");
-},scope:this};
-var _ce=acs_lang_text.loading||"One moment. This may take a while depending on how large your upload is.";
-this.upldWindow.body.mask("<img src='/resources/ajaxhelper/images/indicator.gif'><br>"+_ce);
-YAHOO.util.Connect.setForm("newfileform",true,true);
-var _cf=YAHOO.util.Connect.asyncRequest("POST",this.xmlhttpurl+"add-file",_cd);
-}else{
-Ext.Msg.alert(acs_lang_text.alert||"Alert",acs_lang_text.file_required||"<b>Title</b> and <b>File to upload</b> are required.");
-}
-},addUrl:function(){
-if(this.createurlWindow==null){
-this.createurlWindow=new Ext.Window({id:"createurl-win",layout:"fit",width:400,height:180,title:"Create URL",closeAction:"hide",modal:true,plain:true,resizable:false,items:new Ext.FormPanel({id:"form_create_url",align:"left",autoScroll:true,closable:true,layout:"form",defaults:{width:230},frame:true,buttonAlign:"left",items:[{xtype:"textfield",fieldLabel:"Title",allowBlank:false,name:"fstitle",tabIndex:1},{xtype:"textfield",fieldLabel:"URL",allowBlank:false,name:"fsurl",tabIndex:2,validator:isURL},{xtype:"textfield",fieldLabel:"Description",name:"fsdescription",tabIndex:3}]}),buttons:[{text:"Submit",handler:function(){
-this.createurlWindow.findById("form_create_url").getForm().submit({url:this.xmlhttpurl+"add-url",waitMsg:"One moment ....",params:{package_id:this.config.package_id,folder_id:this.currentfolder},reset:true,scope:this,success:function(_d0,_d1){
-if(_d1.result){
-var _d2=this.layout.findById("treepanel");
-_d2.getSelectionModel().getSelectedNode().fireEvent("click",_d2.getSelectionModel().getSelectedNode());
-this.createurlWindow.hide();
-}else{
-Ext.MessageBox.alert("Error","Sorry an error occured.<br>"+_d1.result.error);
-}
-},failure:function(_d3,_d4){
-if(_d4.result){
-Ext.MessageBox.alert("Error",_d4.result.error);
-}
-}});
-}.createDelegate(this),icon:"/resources/ajaxhelper/icons/disk.png",cls:"x-btn-text-icon"},{text:"Close",handler:function(){
-this.createurlWindow.hide();
-}.createDelegate(this),icon:"/resources/ajaxhelper/icons/cross.png",cls:"x-btn-text-icon"}]});
-}
-this.createurlWindow.show();
-},renameItem:function(_d5,i,e){
-if(_d5.id=="treepanel"){
-var _d8=_d5.getSelectionModel().getSelectedNode();
-this.te.triggerEdit(_d8);
-}else{
-var _d9=_d5;
-var _da=this.layout.findById("treepanel");
-var _d8=_d9.store.getAt(i);
-var _db=_d8.get("url");
-var _dc=_d8.get("type");
-var _dd=_d8.get("id");
-var _de=_d8.get("filename");
-var _df=function(_e0){
-var _e1=acs_lang_text.an_error_occurred||"An error occurred";
-var _e2=acs_lang_text.reverted||"Your changes have been reverted";
-var _e3=Ext.decode(_e0.responseText);
-if(!_e3.success){
-Ext.Msg.alert(acs_lang_text.error||"Error",_e1+": <br><br><font color='red'>"+_e3.error+"</font><br><br>"+_e2);
-}else{
-if(_dc=="folder"){
-_da.getNodeById(_dd).setText(_e3.newname);
-}
-if(_dc!="folder"&&_de===" "){
-_de=_d8.get("title");
-_d8.set("filename",_de);
-}
-_d8.set("title",_e3.newname);
-_d8.commit();
-}
-};
-var _e4=function(btn,_e6){
-if(btn=="ok"){
-if(_e6!=""){
-if(_e6.length>100){
-Ext.Msg.alert(acs_lang_text.alert||"Alert",acs_lang_text.limitto100||"Please limit your name to 100 characters or less.");
-return false;
-}else{
-Ext.Ajax.request({url:this.xmlhttpurl+"edit-name",success:_df,failure:function(_e7){
-var _e8=Ext.decode(_e7.responseText);
-Ext.Msg.alert(acs_lang_text.error||"Error",error_msg_txt+"<br><br><font color='red'>"+_e8.error+"</font>");
-},params:{newname:_e6,object_id:_dd,type:_dc,url:_db}});
-}
-}else{
-Ext.Msg.alert(acs_lang_text.alert||"Alert",acs_lang_text.enter_new_name||"Please enter a new name.");
-return false;
-}
-}
-};
-Ext.Msg.show({title:acs_lang_text.rename||"Rename",prompt:true,msg:acs_lang_text.enter_new_name||"Please enter a new name for ... ",value:_d8.get("title"),buttons:Ext.Msg.OKCANCEL,fn:_e4.createDelegate(this)});
-var _e9=YAHOO.util.Dom.getElementsByClassName("ext-mb-input","input");
-_e9[0].select();
-}
-},tagFsitem:function(_ea,i,e){
-var _ed=_ea;
-var _ee=_ed.store.getAt(i);
-var _ef=_ee.get("id");
-var _f0=_ee.get("tags");
-var _f1=this.config.package_id;
-var _f2=this.layout.findById("tagcloudpanel");
-var _f3=this.xmlhttpurl;
-var _f4=this.tagWindow;
-var _f5=function(){
-Ext.Ajax.request({url:this.xmlhttpurl+"add-tag",success:function(){
-_ee.data.tags=Ext.get("fstags").getValue();
-_ee.commit();
-_f2.load({url:_f3+"get-tagcloud",params:{package_id:_f1}});
-_f4.hide();
-},failure:function(_f6){
-Ext.Msg.alert(acs_lang_text.error||"Error","Sorry, we encountered an error.");
-},params:{object_id:_ee.id,package_id:_f1,tags:Ext.get("fstags").getValue()}});
-};
-if(_f4==null){
-var _f7=new Ext.Panel({id:"form_addtag",autoScroll:true,frame:true,html:"<div style='text-align:left' class='yui-skin-sam'><p>Enter or edit one or more tags. Use commas (,) to separate the tags:<br ><br><div class='yui-ac'><input type='text' name='fstags' id='fstags' size='60' autocomplete='off' value='"+_f0+"'><div id='oAutoCompContainer1' class='yui-ac-container'></div></div>"});
-var _f8=[{text:"Ok",icon:"/resources/ajaxhelper/icons/disk.png",cls:"x-btn-text-icon",handler:_f5.createDelegate(this)},{text:"Cancel",icon:"/resources/ajaxhelper/icons/cross.png",cls:"x-btn-text-icon",handler:function(){
-_f4.hide();
-}.createDelegate(this)}];
-_f4=new Ext.Window({id:"tag-win",layout:"fit",width:450,height:300,title:"Tags",closeAction:"hide",modal:true,plain:true,autoScroll:false,resizable:false,items:_f7,buttons:_f8});
-}
-_f4.show();
-this.initTagAutoComplete();
-},initTagAutoComplete:function(){
-var _f9=new YAHOO.widget.DS_JSArray(oAutoCompArr);
-if(document.getElementById("fstags")){
-var _fa=new YAHOO.widget.AutoComplete("fstags","oAutoCompContainer1",_f9);
-_fa.animHoriz=false;
-_fa.animVert=false;
-_fa.queryDelay=0;
-_fa.maxResultsDisplayed=10;
-_fa.useIFrame=true;
-_fa.delimChar=",";
-_fa.allowBrowserAutocomplete=false;
-_fa.typeAhead=true;
-_fa.formatResult=function(_fb,_fc){
-var _fd=_fb[0];
-return _fd;
-};
-}
-},downloadArchive:function(_fe){
-if(_fe){
-top.location.href=this.config.package_url+"download-archive/?object_id="+_fe;
-}
-},showShareOptions:function(_ff,i,e){
-var _102=_ff;
-var node=_102.store.getAt(i);
-var _104=node.get("id");
-var _105=node.get("title");
-var _106=this.layout.findById("treepanel");
-var _107=this.config.package_id;
-var _108=this.xmlhttpurl;
-var _109=this.sharefolderWindow;
-var _10a=function(){
-var _10b=_106.getSelectionModel().getSelectedNode();
-_10b.loaded=false;
-_10b.collapse();
-_10b.fireEvent("click",_10b);
-_10b.expand();
-_109.hide();
-};
-var _10c=function(){
-var _10d=this.communityCombo.getValue();
-Ext.Ajax.request({url:this.xmlhttpurl+"share-folder",success:_10a,failure:function(_10e){
-Ext.Msg.alert("Error","Sorry, we encountered an error. Please try again later.");
-},params:{target_folder_id:_10d,folder_id:_104}});
-};
-if(_109==null){
-var _10f=new Ext.data.JsonStore({url:_108+"list-communities",root:"communities",fields:["target_folder_id","instance_name"]});
-this.communityCombo=new Ext.form.ComboBox({id:"communities_list",store:_10f,displayField:"instance_name",typeAhead:true,fieldLabel:"Community",triggerAction:"all",emptyText:"Select a community",hiddenName:"target_folder_id",valueField:"target_folder_id",forceSelection:true,handleHeight:80,selectOnFocus:true});
-var _110=new Ext.form.FormPanel({id:"sharefolderform",title:"Select the community where you wish to share the <b>"+_105+"</b> folder with.",frame:true,items:this.communityCombo});
-var _111=[{text:"Ok",icon:"/resources/ajaxhelper/icons/disk.png",cls:"x-btn-text-icon",handler:_10c.createDelegate(this)},{text:"Cancel",icon:"/resources/ajaxhelper/icons/cross.png",cls:"x-btn-text-icon",handler:function(){
-_109.hide();
-}.createDelegate(this)}];
-_109=new Ext.Window({id:"share-win",layout:"fit",width:380,height:200,title:"Share Folder",closeAction:"hide",modal:true,plain:true,autoScroll:false,resizable:false,items:_110,buttons:_111});
-this.sharefolderWindow=_109;
-}else{
-this.sharefolderWindow.findById("sharefolderform").setTitle("Select the community where you wish to share the <b>"+_105+"</b> folder with.");
-this.communityCombo.reset();
-}
-_109.show();
-},redirectViews:function(_112,i,e){
-if(_112.id=="filepanel"){
-var _115=_112;
-var node=_115.store.getAt(i);
-var _117=node.get("id");
-}else{
-var _117=i;
-}
-window.open(window.location.protocol+"//"+window.location.hostname+"/o/"+_117+"/info");
-window.focus();
-},redirectPerms:function(_118,i,e){
-if(_118.id=="filepanel"){
-var _11b=_118;
-var node=_11b.store.getAt(i);
-var _11d=node.get("id");
-}else{
-var _11d=i;
-}
-var _11e=window.open(window.location.protocol+"//"+window.location.hostname+":"+window.location.port+this.config.package_url+"permissions?object_id="+_11d+"&return_url="+window.location.pathname+"?package_id="+this.config.package_id+"&folder_id="+this.currentfolder);
-_11e.focus();
-},redirectNotifs:function(_11f,i,e){
-if(_11f.id=="filepanel"){
-var _122=_11f;
-var node=_122.store.getAt(i);
-var _124=node.get("id");
-var _125=node.get("title");
-}else{
-var _126=_11f;
-var node=_126.getSelectionModel().getSelectedNode();
-var _124=node.attributes["id"];
-var _125=node.text;
-}
-window.location.href=this.xmlhttpurl+"notif-toggle?pretty_name="+_125+"&object_id="+_124+"&return_url="+this.config.package_url+"?folder_id="+this.currentfolder;
-},redirectProperties:function(grid,i,e){
-var _12a=grid;
-var node=_12a.store.getAt(i);
-var _12c=node.get("id");
-var _12d=window.open(window.location.protocol+"//"+window.location.hostname+":"+window.location.port+this.config.package_url+"file?file_id="+_12c);
-_12d.focus();
-},showRevisions:function(grid,i,e){
-var _131=grid;
-var node=_131.store.getAt(i);
-_131.getSelectionModel().selectRow(i);
-var _133=node.get("id");
-var _134=node.get("filename");
-var _135=this.revisionsWindow;
-if(_135==null){
-_135=new Ext.Window({id:"rev-win",layout:"fit",width:550,height:300,closeAction:"hide",modal:true,plain:true,items:new Ext.TabPanel({id:"rev-tabs",items:[this.createRevGrid(),this.newRevForm()]})});
-this.revisionsWindow=_135;
-}
-_135.setTitle(_134+" - "+acs_lang_text.properties||"Properties");
-var _136=_135.findById("revisionspanel");
-var _137=_135.findById("rev-tabs");
-var _138=_135.findById("rev-form");
-var _139=this.config.package_id;
-_136.store.on("load",function(){
-this.getSelectionModel().selectFirstRow();
-},_136);
-_136.on("activate",function(){
-this.store.baseParams["file_id"]=_133;
-this.store.baseParams["package_id"]=_139;
-this.store.load();
-},_136);
-_135.on("beforehide",function(){
-this.activate(1);
-},_137);
-_135.on("show",function(){
-this.activate(0);
-},_137);
-_135.show();
-},createRevGrid:function(){
-var cols=[{header:"",width:30,sortable:false,dataIndex:"icon"},{header:"Title",width:180,sortable:false,dataIndex:"title"},{header:"Author",sortable:false,dataIndex:"author"},{header:"Size",sortable:false,dataIndex:"size"},{header:"Last Modified",sortable:false,dataIndex:"lastmodified"}];
-var _13b=new Ext.data.JsonReader({totalProperty:"total",root:"revisions",id:"revision_id"},[{name:"revision_id",type:"int"},{name:"icon"},{name:"title"},{name:"author"},{name:"type"},{name:"size"},{name:"url"},{name:"lastmodified"}]);
-var _13c=new Ext.data.HttpProxy({url:this.xmlhttpurl+"get-filerevisions"});
-var _13d=new Ext.grid.ColumnModel(cols);
-var _13e=new Ext.data.Store({proxy:_13c,reader:_13b});
-var _13f=[{text:"Download",tooltip:"Download this revision",icon:"/resources/ajaxhelper/icons/arrow_down.png",cls:"x-btn-text-icon",handler:function(){
-var grid=this.revisionsWindow.findById("revisionspanel");
-var _141=grid.getSelectionModel().getSelected();
-window.open(_141.get("url"));
-window.focus();
-}.createDelegate(this)},{text:"Delete",tooltip:"Delete this revision",icon:"/resources/ajaxhelper/icons/delete.png",cls:"x-btn-text-icon",handler:function(){
-var grid=this.revisionsWindow.findById("revisionspanel");
-var sm=grid.getSelectionModel();
-var _144=sm.getSelected();
-var _145=_144.get("revision_id");
-var _146=_144.get("title");
-var _147=this.xmlhttpurl;
-if(grid.store.getCount()==1){
-Ext.Msg.alert("Warning","Sorry, you can not delete the only revision for this file. You can delete the file instead");
-}else{
-Ext.Msg.confirm("Delete","Are you sure you want to delete this version of "+_146+" ? This action can not be reversed.",function(btn){
-if(btn=="yes"){
-Ext.Ajax.request({url:_147+"delete-fileversion",params:{version_id:_145},success:function(o){
-sm.selectPrevious();
-grid.store.remove(_144);
-},failure:function(){
-Ext.Msg.alert("Delete Error","Sorry an error occurred. Please try again later.");
-}});
-}
-});
-}
-}.createDelegate(this)}];
-var _14a=new Ext.grid.GridPanel({store:_13e,cm:_13d,sm:new Ext.grid.RowSelectionModel({singleSelect:true}),id:"revisionspanel",title:"Revisions",loadMask:true,tbar:_13f});
-return _14a;
-},newRevForm:function(){
-var msg1="Please choose a file to upload";
-var _14c=new Ext.Panel({id:"rev-form",align:"left",frame:true,title:"New Revision",html:"<form id=\"newrevfileform\" name=\"newrevfileform\" method=\"post\" enctype=\"multipart/form-data\"><input type=\"hidden\" name=\"package_id\" value=\""+this.config.package_id+"\"><input type=\"hidden\" name=\"file_id\" id=\"rev_file_id\" value=\"\"><input type=\"hidden\" name=\"title\" id=\"rev_file_title\" value=\"\"><p>"+msg1+"<br /><br /><input type=\"file\" name=\"upload_file\" size='35' id=\"rev_upload_file\"></p></form>",buttons:[{text:"Upload New Revision",handler:function(_14d){
-if(Ext.get("rev_upload_file").dom.value==""){
-Ext.Msg.alert("Warning","Please choose a file to upload");
-}else{
-var grid=this.layout.findById("filepanel");
-var _14f=grid.getSelectionModel().getSelected();
-Ext.get("rev_file_id").dom.value=_14f.get("id");
-Ext.get("rev_file_title").dom.value=_14f.get("title");
-var _150={success:function(){
-},upload:function(){
-this.revisionsWindow.findById("rev-tabs").activate(0);
-Ext.get("newrevfileform").dom.reset();
-this.revisionsWindow.findById("rev-form").body.unmask();
-_14d.enable();
-},failure:function(){
-Ext.Msg.alert(acs_lang_text.error||"Error",acs_lang_text.upload_failed||"Upload failed, please try again later.");
-this.revisionsWindow.findById("rev-form").body.unmask();
-_14d.enable();
-},scope:this};
-this.revisionsWindow.findById("rev-form").body.mask("<center><img src='/resources/ajaxhelper/images/indicator.gif'><br>Uploading new revision. Please wait</center>");
-_14d.disable();
-YAHOO.util.Connect.setForm("newrevfileform",true,true);
-var cObj=YAHOO.util.Connect.asyncRequest("POST",this.xmlhttpurl+"add-filerevision",_150);
-}
-}.createDelegate(this),icon:"/resources/ajaxhelper/icons/arrow_up.png",cls:"x-btn-text-icon"}]});
-return _14c;
-},copyLink:function(_152,i,e){
-if(_152.id=="treepanel"){
-var _155=window.location.protocol+"//"+window.location.hostname+":"+window.location.port+this.config.package_url+"?package_id="+this.config.package_id+"&folder_id="+i;
-}else{
-var _156=_152;
-var node=_156.store.getAt(i);
-var _158=node.get("type");
-if(_158==="folder"){
-var _155=window.location.protocol+"//"+window.location.hostname+":"+window.location.port+this.config.package_url+"?package_id="+this.config.package_id+"&folder_id="+node.get("id");
-}else{
-if(_158==="url"){
-var _155=node.get("url");
-}else{
-var _155=window.location.protocol+"//"+window.location.hostname+node.get("url");
-}
-}
-}
-if(Ext.isIE){
-window.clipboardData.setData("text",_155);
-}else{
-var _159=Ext.Msg.show({title:acs_lang_text.linkaddress||"Copy Link Address",prompt:true,msg:acs_lang_text.copyhighlighted||"Copy the highlighted text to your clipboard.",value:_155,buttons:Ext.Msg.OK});
-var _15a=YAHOO.util.Dom.getElementsByClassName("ext-mb-input","input");
-_15a[0].select();
-}
-}};
-function readCookie(name){
-var ca=document.cookie.split(";");
-var _15d=name+"=";
-for(var i=0;i<ca.length;i++){
-var c=ca[i];
-while(c.charAt(0)==" "){
-c=c.substring(1,c.length);
-}
-if(c.indexOf(_15d)==0){
-return c.substring(_15d.length,c.length);
-}
-}
-return null;
-}
-function createCookie(name,_161,days){
-if(days){
-var date=new Date();
-date.setTime(date.getTime()+(days*24*60*60*1000));
-var _164="; expires="+date.toGMTString();
-}else{
-var _164="";
-}
-document.cookie=name+"="+_161+_164+"; path=/";
-}
-function readQs(q){
-var _166=window.location.search.substring(1);
-var _167=_166.split("&");
-for(var i=0;i<_167.length;i++){
-var pos=_167[i].indexOf("=");
-if(pos>0){
-var key=_167[i].substring(0,pos);
-var val=_167[i].substring(pos+1);
-if(key==q){
-return val;
-}
-}
-}
-return null;
-}
-function checkFlashVersion(){
-var x;
-var _16d;
-if(navigator.plugins&&navigator.mimeTypes.length){
-x=navigator.plugins["Shockwave Flash"];
-if(x&&x.description){
-x=x.description;
-}
-}else{
-if(Ext.isIE){
-try{
-x=new ActiveXObject("ShockwaveFlash.ShockwaveFlash");
-x=x.GetVariable("$version");
-}
-catch(e){
-}
-}
-}
-pluginVersion=(typeof (x)=="string")?parseInt(x.match(/\d+/)[0]):0;
-return pluginVersion;
-}
-function isURL(_16e){
-if(_16e.indexOf(" ")!=-1){
-return false;
-}else{
-if(_16e.indexOf("http://")==-1){
-return false;
-}else{
-if(_16e=="http://"){
-return false;
-}else{
-if(_16e.indexOf("http://")>0){
-return false;
-}
-}
-}
-}
-_16e=_16e.substring(7,_16e.length);
-if(_16e.indexOf(".")==-1){
-return false;
-}else{
-if(_16e.indexOf(".")==0){
-return false;
-}else{
-if(_16e.charAt(_16e.length-1)=="."){
-return false;
-}
-}
-}
-if(_16e.indexOf("/")!=-1){
-_16e=_16e.substring(0,_16e.indexOf("/"));
-if(_16e.charAt(_16e.length-1)=="."){
-return false;
-}
-}
-if(_16e.indexOf(":")!=-1){
-if(_16e.indexOf(":")==(_16e.length-1)){
-return false;
-}else{
-if(_16e.charAt(_16e.indexOf(":")+1)=="."){
-return false;
-}
-}
-_16e=_16e.substring(0,_16e.indexOf(":"));
-if(_16e.charAt(_16e.length-1)=="."){
-return false;
-}
-}
-return true;
-}
-function FileProgress(_16f,_170){
-this.file_progress_id=_16f.id;
-this.opacity=100;
-this.height=0;
-this.fileProgressWrapper=document.getElementById(this.file_progress_id);
-if(!this.fileProgressWrapper){
-this.fileProgressWrapper=document.createElement("div");
-this.fileProgressWrapper.className="progressWrapper";
-this.fileProgressWrapper.id=this.file_progress_id;
-this.fileProgressElement=document.createElement("div");
-this.fileProgressElement.className="progressContainer";
-var _171=document.createElement("a");
-_171.className="progressCancel";
-_171.href="#";
-_171.style.visibility="hidden";
-_171.appendChild(document.createTextNode(" "));
-var _172=document.createElement("div");
-_172.className="progressName";
-_172.appendChild(document.createTextNode(_16f.name));
-var _173=document.createElement("div");
-_173.className="progressBarInProgress";
-var _174=document.createElement("div");
-_174.className="progressBarStatus";
-_174.innerHTML="&nbsp;";
-this.fileProgressElement.appendChild(_171);
-this.fileProgressElement.appendChild(_172);
-this.fileProgressElement.appendChild(_174);
-this.fileProgressElement.appendChild(_173);
-this.fileProgressWrapper.appendChild(this.fileProgressElement);
-document.getElementById(_170).appendChild(this.fileProgressWrapper);
-}else{
-this.fileProgressElement=this.fileProgressWrapper.firstChild;
-}
-this.height=this.fileProgressWrapper.offsetHeight;
-}
-FileProgress.prototype.SetProgress=function(_175){
-this.fileProgressElement.className="progressContainer green";
-this.fileProgressElement.childNodes[3].className="progressBarInProgress";
-this.fileProgressElement.childNodes[3].style.width=_175+"%";
-};
-FileProgress.prototype.SetComplete=function(){
-this.fileProgressElement.className="progressContainer blue";
-this.fileProgressElement.childNodes[3].className="progressBarComplete";
-this.fileProgressElement.childNodes[3].style.width="";
-var _176=this;
-setTimeout(function(){
-_176.Disappear();
-},10000);
-};
-FileProgress.prototype.SetError=function(){
-this.fileProgressElement.className="progressContainer red";
-this.fileProgressElement.childNodes[3].className="progressBarError";
-this.fileProgressElement.childNodes[3].style.width="";
-var _177=this;
-setTimeout(function(){
-_177.Disappear();
-},5000);
-};
-FileProgress.prototype.SetCancelled=function(){
-this.fileProgressElement.className="progressContainer";
-this.fileProgressElement.childNodes[3].className="progressBarError";
-this.fileProgressElement.childNodes[3].style.width="";
-var _178=this;
-setTimeout(function(){
-_178.Disappear();
-},2000);
-};
-FileProgress.prototype.SetStatus=function(_179){
-this.fileProgressElement.childNodes[2].innerHTML=_179;
-};
-FileProgress.prototype.ToggleCancel=function(show,_17b){
-this.fileProgressElement.childNodes[0].style.visibility=show?"visible":"hidden";
-if(_17b){
-var _17c=this.file_progress_id;
-this.fileProgressElement.childNodes[0].onclick=function(){
-_17b.cancelUpload(_17c);
-return false;
-};
-}
-};
-FileProgress.prototype.Disappear=function(){
-var _17d=15;
-var _17e=4;
-var rate=30;
-if(this.opacity>0){
-this.opacity-=_17d;
-if(this.opacity<0){
-this.opacity=0;
-}
-if(this.fileProgressWrapper.filters){
-try{
-this.fileProgressWrapper.filters.item("DXImageTransform.Microsoft.Alpha").opacity=this.opacity;
-}
-catch(e){
-this.fileProgressWrapper.style.filter="progid:DXImageTransform.Microsoft.Alpha(opacity="+this.opacity+")";
-}
-}else{
-this.fileProgressWrapper.style.opacity=this.opacity/100;
-}
-}
-if(this.height>0){
-this.height-=_17e;
-if(this.height<0){
-this.height=0;
-}
-this.fileProgressWrapper.style.height=this.height+"px";
-}
-if(this.height>0||this.opacity>0){
-var _180=this;
-setTimeout(function(){
-_180.Disappear();
-},rate);
-}else{
-this.fileProgressWrapper.style.display="none";
-}
-};
-
+Ext.namespace("fsCore");Ext.namespace("ajaxfs");Ext.BLANK_IMAGE_URL="/resources/ajaxhelper/ext2/resources/images/default/s.gif";fsCore=function(b,a){this.package_id=b;this.xmlhttpurl=a};fsCore.prototype={createTreeLoader:function(){var a=new Ext.tree.TreeLoader({dataUrl:this.xmlhttpurl+"load-treenodes",baseParams:{package_id:this.package_id}});return a},createFilePanelProxy:function(){var a=new Ext.data.HttpProxy({url:this.xmlhttpurl+"get-foldercontents"});return a},formSubmit:function(e,g,b,d,f,h,c,i){switch(e){case"createurl":var a=this.xmlhttpurl+"add-url";break}if(a){g.submit({url:a,waitMsg:b,params:d,scope:i,success:h,failure:c})}},doAction:function(g,a,e,b,h,f){switch(g){case"checknotif":var d=this.xmlhttpurl+"notif_p";break;case"addfolder":var d=this.xmlhttpurl+"add-blankfolder";break;case"delete":var d=this.xmlhttpurl+"delete-fsitem";break;case"delete-revision":var d=this.xmlhttpurl+"delete-fileversion";break;case"move":var d=this.xmlhttpurl+"move-fsitem";break;case"rename":var d=this.xmlhttpurl+"rename-fsitem";break;case"tag":var d=this.xmlhttpurl+"add-tag";break;case"sharefolder":var d=this.xmlhttpurl+"share-folder";break}if(d){var c={url:d,success:a,failure:e,params:h};if(b){c.callback=b}if(a){c.success=a}if(e){c.failure=e}if(f){c.scope=f}Ext.Ajax.request(c)}}};ajaxfs=function(a){this.config=null;this.xmlhttpurl="/ajaxfs/xmlhttp/";this.create_url_p=true;this.share_folders_p=true;this.layout=null;this.te=null;this.currentfolder=null;this.currenttag=null;this.msgbox=Ext.MessageBox;this.upldWindow=null;this.tagWindow=null;this.createurlWindow=null;this.sharefolderWindow=null;this.revisionsWindow=null;this.contextmenu=null;this.swfu=null;this.target_folder_id=null;this.communityCombo=null;this.initObj=function(){if(typeof(Ext.DomHelper)!="undefined"){if(a){this.config=a;if(this.config.xmlhttpurl){this.xmlhttpurl=this.config.xmlhttpurl}if(this.config.create_url==0){this.create_url_p=false}if(this.config.share_folders==0){this.share_folders_p=false}if(this.config.views_p==0){this.views_p=false}else{this.views_p=true}if(!this.config.ispublic){Ext.Ajax.on("requestcomplete",this.isSessionExpired,this)}this.fsCore=new fsCore(this.config.package_id,this.xmlhttpurl);Ext.QuickTips.init();this.initLayout()}}};Ext.onReady(this.initObj,this,true)};ajaxfs.prototype={isSessionExpired:function(c,a,b){if(readCookie("ad_user_login")==null){Ext.get(document.body).mask(acs_lang_text.sessionexpired||"Your session has expired. You need to login again. <br>You will be redirected to a login page shortly");var d="";if(this.currentfolder!=null){var d="?folder_id="+this.currentfolder}window.location="/register/?return_url="+this.config.package_url+d}},asyncExpand:function(b){var a=this.layout.findById("treepanel");var e=a.getNodeById(this.config.initOpenFolder);if(!e){var b=b+1;var c=this.config.pathToFolder[b];var d=a.getNodeById(c);d.on("expand",this.asyncExpand.createDelegate(this,[b]),this,{single:true});d.expand(true)}else{e.select();e.fireEvent("click",e)}},selectInitFolder:function(){var b=this.layout.findById("treepanel");if(this.config.initOpenFolder){var d=b.getNodeById(this.config.initOpenFolder);if(d){d.expand();d.fireEvent("click",d)}else{var a=1;var c=b.getNodeById(this.config.pathToFolder[a]);c.on("expand",this.asyncExpand.createDelegate(this,[a]),this,{single:true});c.expand(true)}}else{b.fireEvent("click",b.getRootNode())}},initLayout:function(){var a=[this.createLeft(),this.createRight()];if(this.config!=null&&this.config.layoutdiv){this.layout=new Ext.Panel({id:"fs-ui",layout:"border",applyTo:this.config.layoutdiv,tbar:this.createToolbar(),items:a})}else{this.layout=new Ext.Viewport({id:"fs-ui",layout:"border",tbar:this.createToolbar(),items:a})}},createToolsMenu:function(){var a=function(){var j=this.layout.findById("filepanel");var f=this.layout.findById("treepanel");if(j.getSelectionModel().getCount()==0){for(var e=0;e<d.items.items.length;e++){d.items.items[e].enable()}Ext.getCmp("mnOpen").setText(acs_lang_text.open||"Open");Ext.getCmp("mnOpen").disable();Ext.getCmp("mnTag").disable();Ext.getCmp("mnProp").disable();Ext.getCmp("mnArch").disable();Ext.getCmp("mnShare").disable();var i=function(k){if(parseInt(k.responseText)){Ext.getCmp("mnNotif").setText(acs_lang_text.unsubscribe_notification||"Unsubscribe")}else{Ext.getCmp("mnNotif").setText(acs_lang_text.request_notification||"Request Notification")}};var g=function(k){Ext.getCmp("mnNotif").setText(acs_lang_text.request_notification||"Request Notification")};this.fsCore.doAction("checknotif",i,g,null,{object_id:f.getSelectionModel().getSelectedNode().attributes.id});Ext.getCmp("mnNotif").enable()}else{if(j.getSelectionModel().getCount()==1){var h=j.getSelectionModel().getSelections();for(var e=0;e<d.items.items.length;e++){d.items.items[e].enable()}Ext.getCmp("mnNotif").setText(acs_lang_text.request_notification||"Request Notification");switch(h[0].get("type")){case"folder":Ext.getCmp("mnOpen").setText(acs_lang_text.open||"Open");Ext.getCmp("mnTag").disable();Ext.getCmp("mnPerms").disable();var i=function(k){if(parseInt(k.responseText)){Ext.getCmp("mnNotif").setText(acs_lang_text.unsubscribe_notification||"Unsubscribe")}else{Ext.getCmp("mnNotif").setText(acs_lang_text.request_notification||"Request Notification")}};var g=function(k){Ext.getCmp("mnNotif").setText(acs_lang_text.request_notification||"Request Notification")};this.fsCore.doAction("checknotif",i,g,null,{object_id:f.getSelectionModel().getSelectedNode().attributes.id});Ext.getCmp("mnNotif").enable();break;case"symlink":Ext.getCmp("mnOpen").setText(acs_lang_text.open||"Open");Ext.getCmp("mnTag").disable();Ext.getCmp("mnRename").disable();Ext.getCmp("mnProp").disable();Ext.getCmp("mnNotif").disable();break;case"url":Ext.getCmp("mnOpen").setText(acs_lang_text.open||"Open");Ext.getCmp("mnProp").disable();Ext.getCmp("mnArch").disable();Ext.getCmp("mnShare").disable();Ext.getCmp("mnNotif").disable();break;default:Ext.getCmp("mnOpen").setText(acs_lang_text.download||"Download");Ext.getCmp("mnArch").disable();Ext.getCmp("mnShare").disable();Ext.getCmp("mnNotif").disable();break}if(!this.share_folders_p){Ext.getCmp("mnShare").disable()}}else{for(var e=0;e<d.items.items.length;e++){d.items.items[e].disable()}}}if(!this.views_p){Ext.getCmp("mnView").disable()}};var c=function(k,l){var m=this.layout.findById("filepanel");if(m.getSelectionModel().getCount()==1){var g=this.layout.findById("filepanel");var h=g.getSelectionModel().getSelected().get("id");for(var f=0;f<g.store.data.items.length;f++){if(g.store.data.items[f].id==h){var j=f;break}}}else{var g=this.layout.findById("treepanel");var h=g.getSelectionModel().getSelectedNode().attributes.id;var j=h}switch(k.getId()){case"mnOpen":this.openItem(g,j);break;case"mnTag":this.tagFsitem(g,j);break;case"mnView":this.redirectViews(g,j);break;case"mnRename":this.renameItem(g,j);break;case"mnCopyLink":this.copyLink(g,j);break;case"mnPerms":this.redirectPerms(g,j);break;case"mnProp":this.showRevisions(g,j);break;case"mnArch":this.downloadArchive(h);break;case"mnShare":this.showShareOptions(g,j);break;case"mnNotif":this.redirectNotifs(g,j);break}};var d=new Ext.menu.Menu({id:"toolsmenu",shadow:false,items:[new Ext.menu.Item({id:"mnOpen",text:acs_lang_text.open||"Open",icon:"/resources/ajaxhelper/icons/page_white.png"}),new Ext.menu.Item({id:"mnTag",text:acs_lang_text.tag||"Tag",icon:"/resources/ajaxhelper/icons/tag_blue.png"}),new Ext.menu.Item({id:"mnView",text:acs_lang_text.views||"Views",icon:"/resources/ajaxhelper/icons/camera.png"}),new Ext.menu.Item({id:"mnRename",text:acs_lang_text.rename||"Rename",icon:"/resources/ajaxhelper/icons/page_edit.png"}),new Ext.menu.Item({id:"mnCopyLink",text:acs_lang_text.linkaddress||"Copy Link Address",icon:"/resources/ajaxhelper/icons/page_copy.png"}),new Ext.menu.Item({id:"mnPerms",text:acs_lang_text.permissions||"Permissions",icon:"/resources/ajaxhelper/icons/group_key.png"}),new Ext.menu.Item({id:"mnProp",text:acs_lang_text.properties||"Properties",icon:"/resources/ajaxhelper/icons/page_edit.png"}),new Ext.menu.Item({id:"mnArch",text:acs_lang_text.download_archive||"Download archive",icon:"/resources/ajaxhelper/icons/arrow_down.png"}),new Ext.menu.Item({id:"mnShare",text:acs_lang_text.sharefolder||"Share Folder",icon:"/resources/ajaxhelper/icons/group_link.png"}),new Ext.menu.Item({id:"mnNotif",text:acs_lang_text.request_notification||"Request Notification",icon:"/resources/ajaxhelper/icons/email.png"})],listeners:{beforeshow:{scope:this,fn:a},itemclick:{scope:this,fn:c}}});var b={text:"Tools",iconCls:"toolsmenu",menu:d};return b},createToolbar:function(){var a=this.config.treerootnode;var b=[];if(a.attributes.write_p=="t"){var b=[" ",{text:acs_lang_text.newfolder||"New Folder",tooltip:acs_lang_text.newfolder||"New Folder",icon:"/resources/ajaxhelper/icons/folder_add.png",cls:"x-btn-text-icon",scope:this,handler:this.addFolder},{id:"btnUploadFile",text:acs_lang_text.uploadfile||"Upload Files",tooltip:acs_lang_text.uploadfile||"Upload Files",icon:"/resources/ajaxhelper/icons/page_add.png",cls:"x-btn-text-icon",scope:this,handler:this.addFile}];if(this.create_url_p){b.push({text:acs_lang_text.createurl||"Create Url",tooltip:acs_lang_text.createurl||"Create Url",icon:"/resources/ajaxhelper/icons/page_link.png",cls:"x-btn-text-icon",scope:this,handler:this.addUrl})}b.push({text:acs_lang_text.deletefs||"Delete",tooltip:acs_lang_text.deletefs||"Delete",icon:"/resources/ajaxhelper/icons/delete.png",cls:"x-btn-text-icon",scope:this,handler:this.delItem});b.push(this.createToolsMenu());b.push("->")}b.push({tooltip:"This may take a few minutes if you have a lot of files",text:acs_lang_text.download_archive||"Download Archive",icon:"/resources/ajaxhelper/icons/arrow_down.png",cls:"x-btn-text-icon",scope:this,handler:function(){this.downloadArchive.(a.id)}});return b},createLeft:function(){var a=new Ext.Panel({id:"leftpanel",region:"west",collapsible:true,collapseMode:"mini",titlebar:false,layout:"accordion",split:true,width:300,items:[this.createTreePanel(),this.createTagPanel()]});return a},createTreePanel:function(){var c=new Ext.tree.AsyncTreeNode({text:this.config.treerootnode.text,draggable:false,id:this.config.treerootnode.id,singeClickExpand:true,expanded:true,attributes:this.config.treerootnode.attributes});var b=this.fsCore.createTreeLoader();var a=new Ext.tree.TreePanel({id:"treepanel",title:"Folders",autoScroll:true,animate:true,enableDrag:false,enableDrop:true,loadMask:true,loader:b,root:c,ddAppendOnly:true,containerScroll:true,dropConfig:{dropAllowed:true,ddGroup:"fileDD",onNodeOver:function(i,g,h,f){if(i.node.id==i.node.ownerTree.getSelectionModel().getSelectedNode().id){return false}if(g.dragData.selections){for(var d=0;d<g.dragData.selections.length;d++){if(i.node.id==g.dragData.selections[d].data.id){return false}}}return"x-dd-drop-ok"},onNodeDrop:function(i,d,l,j){var p=this.layout.findById("filepanel");var h=i.node.id;var g=[];for(var n=0;n<j.selections.length;n++){g[n]=j.selections[n].data.id}var m=acs_lang_text.an_error_occurred||"An error occurred";var o=acs_lang_text.reverted||"Your changes have been reverted";var k=function(r){var s=Ext.decode(r.responseText);if(s.success){var q=p.store;var w=p.getSelectionModel().getSelections();var t=false;for(var e=0;e<w.length;e++){q.remove(w[e]);if(w[e].data.type=="folder"){t=true;if(i.node.ownerTree.getNodeById(w[e].data.id)){var v=i.node.ownerTree.getNodeById(w[e].data.id).parentNode;v.loaded=false;v.removeChild(i.node.ownerTree.getNodeById(w[e].data.id))}}}if(t){var u=i.node.ownerTree.getRootNode();if(u.id==i.node.id){u.fireEvent("click",u)}i.node.loaded=false;i.node.expand()}}else{Ext.Msg.alert(acs_lang_text.error||"Error",m+"<br>"+o)}};var f=function(e){var q=Ext.decode(e.responseText);var r="";if(q.error){r=q.error}Ext.Msg.alert(acs_lang_text.error||"Error",m+"<br>"+r+"<br>"+o)};this.fsCore.doAction("move",k,f,null,{folder_target_id:h,file_ids:g});return true}.createDelegate(this)}});this.enableTreeFolderRename(a);c.on("expand",this.selectInitFolder,this,{single:true});a.on("click",this.loadFoldercontents,this);return a},enableTreeFolderRename:function(a){this.te=new Ext.tree.TreeEditor(a,{allowBlank:false,blankText:acs_lang_text.folder_name_required||"A folder name is required",ignoreNoChange:true});this.te.on("beforestartedit",function(c,b,d){if(c.editNode.attributes.attributes.write_p=="t"){return true}else{Ext.Msg.alert(acs_lang_text.permission_denied||"Permission Denied",acs_lang_text.permission_denied||"Sorry, you do not have permission to rename this folder");return false}},this,true);this.te.on("beforecomplete",function(e,f,d){var c=e.editNode.parentNode;if(c){var b=c.childNodes;for(x=0;x<b.length;x++){if(b[x].text==f&&b[x].id!=e.editNode.id){Ext.Msg.alert(acs_lang_text.duplicate_name||"Duplicate Name",acs_lang_text.duplicate_name_error||"Please enter a different name. The name you entered is already being used.");return false}}}return true},this,true);this.te.on("complete",function(e,g,d){var f=acs_lang_text.an_error_occurred||"An error occurred";var c=acs_lang_text.reverted||"Your changes have been reverted";var h=function(i){var j=Ext.decode(i.responseText);if(!j.success){Ext.Msg.alert(acs_lang_text.error||"Error",f+": <br><br><font color='red'>"+j.error+"</font><br><br>"+c);e.editNode.setText(d)}};var b=function(){Ext.Msg.alert(acs_lang_text.error||"Error",f+"<br>"+c);e.editNode.setText(d)};this.fsCore.doAction("rename",h,b,null,{newname:g,object_id:e.editNode.id,type:"folder"})},this,true)},createTagPanel:function(){var a=new Ext.Panel({id:"tagcloudpanel",title:"Tags",frame:false,loadMask:true,autoScroll:true,autoLoad:{url:this.xmlhttpurl+"get-tagcloud",params:{package_id:this.config.package_id}}});var b=function(){var c=this;var d=c.currenttag;a.body.on("click",function(f,e){if(e.tagName=="A"){if(d!=null){Ext.get(d).setStyle("font-weight","normal")}Ext.get(e).setStyle("font-weight","bold");d=e.id;this.loadTaggedFiles(e.id)}},this)};a.on("render",b,this);return a},loadTaggedFiles:function(a){this.layout.findById("treepanel").getSelectionModel().clearSelections();var b=a.substring(3,a.length);this.layout.findById("filepanel").store.baseParams.tag_id=b;this.layout.findById("filepanel").store.load();this.layout.findById("filepanel").store.baseParams.tag_id=""},createRight:function(){var g=function(i,j,h){j.attr="ext:qtip='"+h.get("qtip")+"'";return i};var e=[{header:"",width:30,sortable:true,dataIndex:"icon"},{header:acs_lang_text.filename||"Filename",id:"filename",sortable:true,dataIndex:"title",renderer:g},{header:acs_lang_text.size||"Size",sortable:true,dataIndex:"size"},{header:acs_lang_text.lastmodified||"Last Modified",sortable:true,dataIndex:"lastmodified"}];var a=new Ext.data.JsonReader({totalProperty:"total",root:"foldercontents",id:"id"},[{name:"id",type:"int"},{name:"qtip"},{name:"icon"},{name:"title"},{name:"filename"},{name:"type"},{name:"tags"},{name:"url"},{name:"linkurl"},{name:"write_p"},{name:"symlink_id"},{name:"size"},{name:"lastmodified"}]);var d=this.fsCore.createFilePanelProxy();var b=new Ext.grid.ColumnModel(e);var c=new Ext.data.Store({proxy:d,reader:a,remoteSort:true});var f=new Ext.grid.GridPanel({store:c,cm:b,id:"filepanel",ddGroup:"fileDD",region:"center",split:true,autoScroll:true,autoExpandColumn:"filename",enableDragDrop:true,width:250,loadMask:true,frame:false,viewConfig:{forceFit:false,enableRowBody:true,showPreview:true,deferEmptyText:true,emptyText:"This folder is empty",getRowClass:function(h,l,k,j){var i=Ext.util.Format;if(h.data.tags!=""){k.body="<div id='tagscontainer"+h.data.id+"' style='padding-left:35px;color:blue'>Tags: "+i.ellipsis(i.stripTags(h.data.tags),200)+"</div>"}else{k.body="<div id='tagscontainer"+h.data.id+"' style='padding-left:35px;color:blue'></div>"}return"x-grid3-row-expanded"}}});f.on("rowdblclick",this.openItem,this,true);f.on("rowcontextmenu",this.showRowContext,this,true);return f},showRowContext:function(a,d,h){h.stopEvent();var j=this.layout.findById("treepanel");var m=this.config.treerootnode;var f=a.store;var g=f.getAt(d);var k=g.get("type");var b=g.get("id");var c;switch(k){case"folder":c="Open";break;case"url":c="Open";break;default:c="Download";break}this.contextmenu=new Ext.menu.Menu({id:"rightclickmenu",items:[new Ext.menu.Item({text:c,icon:"/resources/ajaxhelper/icons/page_white.png",scope:this,handler:function(){this.openItem(a,d,h)}}),new Ext.menu.Item({text:"Tag",icon:"/resources/ajaxhelper/icons/tag_blue.png",scope:this,handler:function(){this.tagFsitem(a,d,h)}}),new Ext.menu.Item({text:"Views",icon:"/resources/ajaxhelper/icons/camera.png",scope:this,handler:function(){this.redirectViews(a,d,h)}}),new Ext.menu.Item({text:acs_lang_text.deletefs||"Delete",icon:"/resources/ajaxhelper/icons/delete.png",scope:this,handler:function(){this.delItem(a,d,h)}}),new Ext.menu.Item({text:acs_lang_text.rename||"Rename",icon:"/resources/ajaxhelper/icons/page_edit.png",scope:this,handler:function(){this.renameItem(a,d,h)}}),new Ext.menu.Item({text:acs_lang_text.linkaddress||"Copy Link Address",icon:"/resources/ajaxhelper/icons/page_copy.png",scope:this,handler:function(){this.copyLink(a,d,h)}}),new Ext.menu.Item({text:acs_lang_text.permissions||"Permissions",icon:"/resources/ajaxhelper/icons/group_key.png",scope:this,handler:function(){this.redirectPerms(a,d,h)}}),new Ext.menu.Item({text:acs_lang_text.properties||"Properties",icon:"/resources/ajaxhelper/icons/page_edit.png",scope:this,handler:function(){this.showRevisions(a,d,h)}}),new Ext.menu.Item({text:acs_lang_text.download_archive||"Download archive",icon:"/resources/ajaxhelper/icons/arrow_down.png",scope:this,handler:function(){this.downloadArchive(b)}}),new Ext.menu.Item({text:acs_lang_text.sharefolder||"Share Folder",icon:"/resources/ajaxhelper/icons/group_link.png",scope:this,handler:function(){this.showShareOptions(a,d,h)}})]});if(a.getSelectionModel().getCount()>1){this.contextmenu.items.items[0].hide();this.contextmenu.items.items[1].hide();this.contextmenu.items.items[2].hide();this.contextmenu.items.items[3].show();this.contextmenu.items.items[4].hide();this.contextmenu.items.items[5].hide();this.contextmenu.items.items[6].hide();this.contextmenu.items.items[7].hide();this.contextmenu.items.items[8].hide();this.contextmenu.items.items[9].hide()}else{this.contextmenu.items.items[0].show();this.contextmenu.items.items[2].show();this.contextmenu.items.items[3].show();this.contextmenu.items.items[4].show();this.contextmenu.items.items[5].show();this.contextmenu.items.items[6].show();switch(k){case"folder":this.contextmenu.items.items[1].hide();this.contextmenu.items.items[7].hide();this.contextmenu.items.items[8].show();if(j.getNodeById(b).attributes.attributes.type=="symlink"){this.contextmenu.items.items[9].hide()}else{this.contextmenu.items.items[9].show()}break;case"url":this.contextmenu.items.items[1].show();this.contextmenu.items.items[7].hide();this.contextmenu.items.items[8].hide();this.contextmenu.items.items[9].hide();break;case"symlink":this.contextmenu.items.items[4].hide();this.contextmenu.items.items[9].hide();break;default:this.contextmenu.items.items[1].show();this.contextmenu.items.items[7].show();this.contextmenu.items.items[8].hide();this.contextmenu.items.items[9].hide()}}if(!this.share_folders_p){this.contextmenu.items.items[9].hide()}if(!this.views_p){this.contextmenu.items.items[2].hide()}if(m.attributes.write_p=="f"){this.contextmenu.items.items[1].hide();this.contextmenu.items.items[3].hide();this.contextmenu.items.items[6].hide();this.contextmenu.items.items[7].hide();this.contextmenu.items.items[9].hide()}var l=h.getXY();this.contextmenu.rowid=d;this.contextmenu.showAt([l[0],l[1]])},loadFoldercontents:function(a,b){this.currentfolder=a.id;var c=this.layout.findById("filepanel");c.store.baseParams.folder_id=a.id;c.store.baseParams.package_id=this.config.package_id;if(a.loading){a.on("expand",function(){this.store.load()},c,{single:true})}else{c.store.load()}},openItem:function(f,d,h){var a=this.layout.findById("treepanel");var c=f.store;var b=c.getAt(d);if(b.get("type")=="folder"||b.get("type")=="symlink"){var g=a.getNodeById(b.get("id"));if(!g.parentNode.isExpanded()){g.parentNode.expand()}g.fireEvent("click",g);g.expand()}else{window.open(b.get("url"));window.focus()}},delItem:function(b,r,u){var d=acs_lang_text.confirm_delete||"Are you sure you want to delete ";var h=acs_lang_text.foldercontains||"This folder contains";var l=this.layout.findById("treepanel");if(b.id=="filepanel"){var s=b;if(s.getSelectionModel().getCount()<=1){s.getSelectionModel().selectRow(r)}}else{var s=this.layout.findById("filepanel")}var o=s.getSelectionModel().getSelections();var n=true;if(o.length>0){n=false;if(o.length==1){var v=o[0].get("title");if(o[0].get("type")==="folder"){var f=h+" <b>"+o[0].get("size")+"</b>.<br>"}else{var f=""}var f=f+d+" <b>"+v+"</b> ?";if(o[0].get("type")==="symlink"){var t=o[0].get("symlink_id")}else{var t=o[0].get("id")}}else{var f=d+": <br><br>";var t=[];for(var j=0;j<o.length;j++){f=f+"<b>"+o[j].get("title")+"</b> ";if(o[j].get("type")==="folder"){f=f+"("+o[j].get("size")+")"}f=f+"<br>";if(o[j].get("type")==="symlink"){t[j]=o[j].get("symlink_id")}else{t[j]=o[j].get("id")}}}var w={object_id:t}}else{n=true;var p=l.getSelectionModel().getSelectedNode();var t=p.attributes.id;var c=p.attributes.attributes.type;var a=p.attributes.attributes.symlink_id;var q=l.getRootNode();if(c=="symlink"){var w={object_id:a}}else{var w={object_id:t}}if(p.attributes.id==q.attributes.id){Ext.Msg.alert(acs_lang_text.alert||"Alert",acs_lang_text.cant_del_root||"The root folder can not be deleted.");return}else{if(typeof(p.attributes.attributes.size)=="undefined"){var f=""}else{var f=h+" <b>"+p.attributes.attributes.size+"</b>.<br>"}f=f+d+" <b>"+p.attributes.text+"</b>?"}}var g=function(i){var A=Ext.decode(i.responseText);if(A.success){if(n){var B=l.getSelectionModel().getSelectedNode();var y=B.parentnode;y.fireEevent("click",y);y.removeChild(B)}else{for(var e=0;e<o.length;e++){s.store.remove(o[e]);var z=o[e].get("id");var B=l.getNodeById(z);if(B){B.parentnode.fireEevent("click",B.parentnode);B.parentnode.removeChild(B)}}}}else{ext.msg.alert(acs_lang_text.error||"error","sorry, we encountered an error.")}};var k=function(){Ext.Msg.alert(acs_lang_text.error||"Error",error_msg_txt+"<br><br><font color='red'>"+resultObj.error+"</font>")};var m=function(e){if(e==="yes"){this.fsCore.doAction("delete",g,k,null,w)}};Ext.MessageBox.confirm(acs_lang_text.confirm||"Confirm",f,m,this)},addFolder:function(){var e=this.te;var a=this.layout.findById("treepanel");var c=a.getSelectionModel().getSelectedNode();c.expand();var f=acs_lang_text.new_folder_error||"Sorry, there was an error trying to create your new folder.";var d=function(g){var h=Ext.decode(g.responseText);if(h.success){var i=c.appendChild(new Ext.tree.TreeNode({text:h.pretty_folder_name,id:h.id,iconCls:"folder",singleClickExpand:true,attributes:{write_p:"t",size:"",type:"folder",symlink_id:""}}));a.getSelectionModel().select(i);i.loaded=true;i.fireEvent("click",i);setTimeout(function(){e.editNode=i;e.startEdit(i.ui.textNode)},10)}else{Ext.Msg.alert(acs_lang_text.error||"Error",f+"<br><br><font color='red'>"+h.error+"</font>")}};var b=function(g){var h=Ext.decode(g.responseText);Ext.Msg.alert(acs_lang_text.error||"Error",f+"<br><br><font color='red'>"+h.error+"</font>")};this.fsCore.doAction("addfolder",d,b,null,{folder_id:c.attributes.id})},createSwfObj:function(){var i=this.layout.findById("treepanel");var d=this.currentfolder;if(this.swfu==null){var a=this;var h=String(this.config.package_id);var p=String(this.config.user_id);var k=String(this.currentfolder);var c=String(this.config.max_file_size);var e="fsuploadprogress";var o=function(w){var v=acs_lang_text.for_upload_to||"for upload to";var s=acs_lang_text.zip_extracted||"Zip File (Will be extracted after upload)";try{var y=a.currentfolder;var r=i.getNodeById(y).text;var t=new FileProgress(w,e);t.SetStatus(v+" <b>"+r+"</b><br>Title: <input type='text' onblur=\"fsInstance.swfu.removeFileParam('"+w.id+"','filetitle');fsInstance.swfu.addFileParam('"+w.id+"','filetitle',this.value)\">(optional)<br><input type='checkbox' id='zip"+w.id+"' onclick=\"if(document.getElementById('zip"+w.id+"').checked) { fsInstance.swfu.addFileParam('"+w.id+"','unpack_p','1') } else { fsInstance.swfu.removeFileParam('"+w.id+"','unpack_p') }\"> "+s);t.ToggleCancel(true,this);this.addFileParam(w.id,"folder_id",y)}catch(u){Ext.Msg.alert(acs_lang_text.error||"Error",u)}};var m=function(){};var n=function(t,v,u){console.log("file queue error");try{if(v===SWFUpload.QUEUE_ERROR.QUEUE_LIMIT_EXCEEDED){alert("You have attempted to queue too many files.\n"+(u===0?"You have reached the upload limit.":"You may select "+(u>1?"up to "+u+" files.":"one file.")));return}var r=new FileProgress(t,e);r.setError();r.toggleCancel(false);switch(v){case SWFUpload.QUEUE_ERROR.FILE_EXCEEDS_SIZE_LIMIT:r.setStatus("File is too big.");Ext.Msg.alert(acs_lang_text.error||"Error","Error Code: File too big, File name: "+t.name+", File size: "+t.size+", Message: "+u);break;case SWFUpload.QUEUE_ERROR.ZERO_BYTE_FILE:r.setStatus("Cannot upload Zero Byte files.");Ext.Msg.alert(acs_lang_text.error||"Error","Error Code: Zero byte file, File name: "+t.name+", File size: "+t.size+", Message: "+u);break;case SWFUpload.QUEUE_ERROR.INVALID_FILETYPE:r.setStatus("Invalid File Type.");Ext.Msg.alert(acs_lang_text.error||"Error","Error Code: Invalid File Type, File name: "+t.name+", File size: "+t.size+", Message: "+u);break;case SWFUpload.QUEUE_ERROR.QUEUE_LIMIT_EXCEEDED:Ext.Msg.alert(acs_lang_text.error||"Error","You have selected too many files.  "+(u>1?"You may only add "+u+" more files":"You cannot add any more files."));break;default:if(t!==null){r.setStatus("Unhandled Error")}Ext.Msg.alert(acs_lang_text.error||"Error","Error Code: "+v+", File name: "+t.name+", File size: "+t.size+", Message: "+u);break}}catch(s){Ext.Msg.alert(acs_lang_text.error||"Error",s)}};var l=function(){};var b=function(w){console.log("upload start");var v=acs_lang_text.for_upload_to||"for upload to";var s=acs_lang_text.zip_extracted||"Zip File (Will be extracted after upload)";try{var y=a.currentfolder;var r=i.getNodeById(y).text;var t=new FileProgress(w,e);t.SetStatus(v+" "+r+"b><br>Title: <input type='text' onblur=\"fsInstance.swfu.removeFileParam('"+w.id+"','filetitle');fsInstance.swfu.addFileParam('"+w.id+"','filetitle',this.value)\">(optional)<br><input type='checkbox' id='zip"+w.id+"' onclick=\"if(document.getElementById('zip"+w.id+"').checked) { fsInstance.swfu.addFileParam('"+w.id+"','unpack_p','1') } else { fsInstance.swfu.removeFileParam('"+w.id+"','unpack_p') }\"> "+s);t.ToggleCancel(true,this);this.addFileParam(w.id,"folder_id",y)}catch(u){Ext.Msg.alert(acs_lang_text.error||"Error",u)}};var g=function(w,v,u){console.log("upload progress");try{var t=Math.ceil((v/u)*100);var r=new FileProgress(w,e);r.SetProgress(t);r.SetStatus(acs_lang_text.uploading||"Uploading...")}catch(s){Ext.Msg.alert(acs_lang_text.error||"Error",s)}};var f=function(){console.log("upload queue complete");var r=i.getNodeById(a.currentfolder);r.fireEvent("click",r)};var q=function(t,v,u){console.log("upload error");try{var r=new FileProgress(t,e);r.setError();r.ToggleCancel(false);switch(v){case SWFUpload.UPLOAD_ERROR.HTTP_ERROR:r.setStatus("Upload Error: "+u);Ext.Msg.alert(acs_lang_text.error||"Error","Error Code: HTTP Error, File name: "+t.name+", Message: "+u);break;case SWFUpload.UPLOAD_ERROR.MISSING_UPLOAD_URL:r.setStatus("Configuration Error");Ext.Msg.alert(acs_lang_text.error||"Error","Error Code: No backend file, File name: "+t.name+", Message: "+u);break;case SWFUpload.UPLOAD_ERROR.UPLOAD_FAILED:r.setStatus("Upload Failed.");Ext.Msg.alert(acs_lang_text.error||"Error","Error Code: Upload Failed, File name: "+t.name+", File size: "+t.size+", Message: "+u);break;case SWFUpload.UPLOAD_ERROR.IO_ERROR:r.setStatus("Server (IO) Error");Ext.Msg.alert(acs_lang_text.error||"Error","Error Code: IO Error, File name: "+t.name+", Message: "+u);break;case SWFUpload.UPLOAD_ERROR.SECURITY_ERROR:r.setStatus("Security Error");Ext.Msg.alert(acs_lang_text.error||"Error","Error Code: Security Error, File name: "+t.name+", Message: "+u);break;case SWFUpload.UPLOAD_ERROR.UPLOAD_LIMIT_EXCEEDED:r.setStatus("Upload limit exceeded.");Ext.Msg.alert(acs_lang_text.error||"Error","Error Code: Upload Limit Exceeded, File name: "+t.name+", File size: "+t.size+", Message: "+u);break;case SWFUpload.UPLOAD_ERROR.SPECIFIED_FILE_ID_NOT_FOUND:r.setStatus("File not found.");Ext.Msg.alert(acs_lang_text.error||"Error","Error Code: The file was not found, File name: "+t.name+", File size: "+t.size+", Message: "+u);break;case SWFUpload.UPLOAD_ERROR.FILE_VALIDATION_FAILED:r.setStatus("Failed Validation.  Upload skipped.");Ext.Msg.alert(acs_lang_text.error||"Error","Error Code: File Validation Failed, File name: "+t.name+", File size: "+t.size+", Message: "+u);break;case SWFUpload.UPLOAD_ERROR.FILE_CANCELLED:r.setStatus("Cancelled");r.setCancelled();break;case SWFUpload.UPLOAD_ERROR.UPLOAD_STOPPED:r.setStatus("Stopped");break;default:r.setStatus("Unhandled Error: "+error_code);Ext.Msg.alert(acs_lang_text.error||"Error","Error Code: "+v+", File name: "+t.name+", File size: "+t.size+", Message: "+u);break}}catch(s){Ext.Msg.alert(acs_lang_text.error||"Error",s)}};var j=function(u,s){console.log("upload success");try{var r=new FileProgress(u,e);r.SetComplete();r.SetStatus(acs_lang_text.complete||"Complete.");r.ToggleCancel(false)}catch(t){Ext.Msg.alert(acs_lang_text.error||"Error",t)}};this.swfu=new SWFUpload({debug:false,post_params:{user_id:p,package_id:h},file_types:"*.*",button_placeholder_id:"btnSwfUpload",button_text:"&nbsp;<b>BROWSE</b>",button_width:61,button_height:16,file_dialog_start_handler:m,file_queued_handler:o,file_queue_error_handler:n,file_dialog_complete_handler:l,upload_start_handler:b,upload_progress_handler:g,upload_error_handler:q,upload_success_handler:j,queue_complete_handler:f,upload_url:this.xmlhttpurl+"add-file-flash",flash_url:"/resources/ajax-filestorage-ui/swfupload2/swfupload.swf"})}},addFile:function(){var f=null;if(this.upldWindow==null){if(!this.config.multi_file_upload||checkFlashVersion()<9||Ext.isLinux){f="single";var i=acs_lang_text.file_to_upload||"File to upload";var h=acs_lang_text.file_title||"Title";var g=acs_lang_text.file_description||"Description";var e=acs_lang_text.multiple_files||"Multiple Files";var d=acs_lang_text.multiple_files_msg||"This is a ZIPfile containing multiple files.";var k=true;var j=acs_lang_text.uploadfile||"Upload a File";var c=new Ext.Panel({id:"form_addfile",align:"left",frame:true,html:'<form id="newfileform" method="post" enctype="multipart/form-data"><input type="hidden" name="package_id" value="'+this.config.package_id+'"><input type="hidden" name="folder_id" value="'+this.currentfolder+'"><p>'+i+'<br /><input type="file" name="upload_file" id="upload_file"></p><br><p>'+h+'<br /><input type="text" name="filetitle" id="filetitle"></p><br><p>'+g+' :<br /><textarea name="filedescription" id="filedescription"></textarea></p><p>'+e+' :<br /><br /><input type="checkbox" name="unpack_p" value="t" id="unpack_p" /> '+d+"</p></form>"});var a=[{text:acs_lang_text.upload||"Upload",scope:this,handler:this.uploadOneFile,icon:"/resources/ajaxhelper/icons/arrow_up.png",cls:"x-btn-text-icon"},{text:acs_lang_text.close||"Close",scope:this,handler:function(){this.upldWindow.hide()},icon:"/resources/ajaxhelper/icons/cross.png",cls:"x-btn-text-icon"}]}else{f="multiple";var b=acs_lang_text.upload_intro||"Click <b>Upload</b> to select a file to upload to the selected folder on the tree.";var k=false;var j="Upload Files";var c=new Ext.Panel({id:"form_multi_addfile",autoScroll:true,frame:true,html:'<div id="upldMsg">'+b+'<hr></div><div class="flash" id="fsuploadprogress"></div>'});var a=['<span id="btnSwfUpload"></span>',{text:acs_lang_text.upload||"Upload",scope:this,handler:function(){this.swfu.startUpload()},icon:"/resources/ajaxhelper/icons/arrow_up.png",cls:"x-btn-text-icon"},{text:"Hide",scope:this,handler:function(){this.upldWindow.hide()},icon:"/resources/ajaxhelper/icons/cross.png",cls:"x-btn-text-icon"}]}this.upldWindow=new Ext.Window({id:"upload-win",layout:"fit",width:400,height:300,title:j,closeAction:"hide",modal:k,plain:true,resizable:false,items:c,buttons:a});if(f=="multiple"){this.upldWindow.on("show",function(){this.createSwfObj()},this,{single:true})}}else{if(!this.config.multi_file_upload||checkFlashVersion()<9||Ext.isLinux){document.getElementById("newfileform").reset();document.getElementById("newfileform").folder_id.value=this.currentfolder}}this.upldWindow.show("btnUploadFile")},uploadOneFile:function(){if(Ext.get("upload_file").getValue()!=""&&Ext.get("filetitle").getValue()!=""){var a=this.layout.findById("treepanel");var d={success:function(){},upload:function(){a.getSelectionModel().getSelectedNode().loaded=false;a.getSelectionModel().getSelectedNode().fireEvent("click",a.getSelectionModel().getSelectedNode());this.upldWindow.body.unmask();this.upldWindow.hide()},failure:function(){Ext.Msg.alert(acs_lang_text.error||"Error",acs_lang_text.upload_failed||"Upload failed, please try again later.")},scope:this};var c=acs_lang_text.loading||"One moment. This may take a while depending on how large your upload is.";this.upldWindow.body.mask("<img src='/resources/ajaxhelper/images/indicator.gif'><br>"+c);YAHOO.util.Connect.setForm("newfileform",true,true);var b=YAHOO.util.Connect.asyncRequest("POST",this.xmlhttpurl+"add-file",d)}else{Ext.Msg.alert(acs_lang_text.alert||"Alert",acs_lang_text.file_required||"<b>Title</b> and <b>File to upload</b> are required.")}},addUrl:function(){if(this.createurlWindow==null){this.createurlWindow=new Ext.Window({id:"createurl-win",layout:"fit",width:400,height:180,title:"Create URL",closeAction:"hide",modal:true,plain:true,resizable:false,items:new Ext.FormPanel({id:"form_create_url",align:"left",autoScroll:true,closable:true,layout:"form",defaults:{width:230},frame:true,buttonAlign:"left",items:[{xtype:"textfield",fieldLabel:"Title",allowBlank:false,name:"fstitle",tabIndex:1},{xtype:"textfield",fieldLabel:"URL",allowBlank:false,name:"fsurl",tabIndex:2,validator:isURL,value:"http://"},{xtype:"textfield",fieldLabel:"Description",name:"fsdescription",tabIndex:3}]}),buttons:[{text:"Submit",scope:this,handler:function(){var b=this.createurlWindow.findById("form_create_url").getForm();if(b.isValid()){var c=function(e,f){if(f.result){var d=this.layout.findById("treepanel");d.getSelectionModel().getSelectedNode().fireEvent("click",d.getSelectionModel().getSelectedNode());this.createurlWindow.hide()}else{Ext.MessageBox.alert("Error","Sorry an error occured.<br>"+f.result.error)}};var a=function(d,e){if(e.result){Ext.MessageBox.alert("Error",e.result.error)}};this.fsCore.formSubmit("createurl",b,"One moment ....",{package_id:this.config.package_id,folder_id:this.currentfolder},true,c,a,this)}},icon:"/resources/ajaxhelper/icons/disk.png",cls:"x-btn-text-icon"},{text:"Close",scope:this,handler:function(){this.createurlWindow.hide()},icon:"/resources/ajaxhelper/icons/cross.png",cls:"x-btn-text-icon"}]})}this.createurlWindow.show()},renameItem:function(b,h,j){if(b.id=="treepanel"){var g=b.getSelectionModel().getSelectedNode();this.te.triggerEdit(g)}else{var n=b;var l=this.layout.findById("treepanel");var g=n.store.getAt(h);var k=g.get("url");var a=g.get("type");var c=g.get("id");var m=g.get("filename");var d=function(e){var q=acs_lang_text.an_error_occurred||"An error occurred";var p=acs_lang_text.reverted||"Your changes have been reverted";var i=Ext.decode(e.responseText);if(!i.success){Ext.Msg.alert(acs_lang_text.error||"Error",q+": <br><br><font color='red'>"+i.error+"</font><br><br>"+p)}else{if(a=="folder"){l.getNodeById(c).setText(i.newname)}if(a!="folder"&&m===" "){m=g.get("title");g.set("filename",m)}g.set("title",i.newname);g.commit()}};var o=function(i,p){if(i=="ok"){if(p!=""){if(p.length>100){Ext.Msg.alert(acs_lang_text.alert||"Alert",acs_lang_text.limitto100||"Please limit your name to 100 characters or less.");return false}else{var e=function(q){var r=Ext.decode(q.responseText);Ext.Msg.alert(acs_lang_text.error||"Error",error_msg_txt+"<br><br><font color='red'>"+r.error+"</font>")};this.fsCore.doAction("rename",d,e,null,{newname:p,object_id:c,type:a,url:k})}}else{Ext.Msg.alert(acs_lang_text.alert||"Alert",acs_lang_text.enter_new_name||"Please enter a new name.");return false}}};Ext.Msg.show({title:acs_lang_text.rename||"Rename",prompt:true,msg:acs_lang_text.enter_new_name||"Please enter a new name for ... ",value:g.get("title"),buttons:Ext.Msg.OKCANCEL,scope:this,fn:o});var f=YAHOO.util.Dom.getElementsByClassName("ext-mb-input","input");f[0].select()}},tagFsitem:function(a,h,m){var r=a;var c=r.store.getAt(h);var p=c.get("id");var g=c.get("tags");var l=this.config.package_id;var o=this.layout.findById("tagcloudpanel");var n=this.xmlhttpurl;var f=this.tagWindow;var q=function(){c.data.tags=Ext.get("fstags").getValue();c.commit();o.load({url:n+"get-tagcloud",params:{package_id:l}});f.hide()};var b=function(e){Ext.Msg.alert(acs_lang_text.error||"Error","Sorry, we encountered an error.")};var k=function(){this.fsCore.doAction("tag",q,b,null,{object_id:c.id,package_id:l,tags:Ext.get("fstags").getValue()})};if(f==null){var d=new Ext.Panel({id:"form_addtag",autoScroll:true,frame:true,html:"<div style='text-align:left;width:330px' class='yui-skin-sam'><p>Enter or edit one or more tags. Use commas (,) to separate the tags:<br ><br><div class='yui-ac'><input type='text' name='fstags' id='fstags' size='60' autocomplete='off' value='"+g+"'><div id='oAutoCompContainer1' class='yui-ac-container'></div></div>"});var j=[{text:"Ok",icon:"/resources/ajaxhelper/icons/disk.png",cls:"x-btn-text-icon",scope:this,handler:k},{text:"Cancel",icon:"/resources/ajaxhelper/icons/cross.png",cls:"x-btn-text-icon",scope:this,handler:function(){this.tagWindow.hide()}}];this.tagWindow=new Ext.Window({id:"tag-win",layout:"fit",width:450,height:200,title:"Tags",closeAction:"hide",modal:true,plain:true,autoScroll:false,resizable:false,items:d,buttons:j})}this.tagWindow.show("undefined",function(){Ext.get("fstags").dom.value=g;this.initTagAutoComplete()},this)},initTagAutoComplete:function(){var a=new YAHOO.util.LocalDataSource(oAutoCompArr);if(document.getElementById("fstags")){var b=new YAHOO.widget.AutoComplete("fstags","oAutoCompContainer1",a);b.animHoriz=false;b.animVert=false;b.queryDelay=0;b.maxResultsDisplayed=10;b.useIFrame=true;b.delimChar=",";b.allowBrowserAutocomplete=false;b.typeAhead=true;b.useShadow=true;b.prehighlightClassName="yui-ac-prehighlight";b.formatResult=function(c,e){var d=c[0];return d}}},downloadArchive:function(a){if(a){top.location.href=this.config.package_url+"download-archive/?object_id="+a}},showShareOptions:function(a,h,l){var s=a;var f=s.store.getAt(h);var r=f.get("id");var g=f.get("title");var m=this.layout.findById("treepanel");var k=this.config.package_id;var q=this.xmlhttpurl;var p=this.sharefolderWindow;var j=function(){var e=m.getSelectionModel().getSelectedNode();e.loaded=false;e.collapse();e.fireEvent("click",e);e.expand();p.hide()};var c=function(e){Ext.Msg.alert("Error","Sorry, we encountered an error. Please try again later.")};var b=function(){var e=this.communityCombo.getValue();this.fsCore.doAction("sharefolder",j,c,null,{target_folder_id:e,folder_id:r})};if(p==null){var o=new Ext.data.JsonStore({url:q+"list-communities",root:"communities",fields:["target_folder_id","instance_name"]});this.communityCombo=new Ext.form.ComboBox({id:"communities_list",store:o,displayField:"instance_name",typeAhead:true,fieldLabel:"Community",triggerAction:"all",emptyText:"Select a community",hiddenName:"target_folder_id",valueField:"target_folder_id",forceSelection:true,handleHeight:80,selectOnFocus:true});var d=new Ext.form.FormPanel({id:"sharefolderform",title:"Select the community where you wish to share the <b>"+g+"</b> folder with.",frame:true,items:this.communityCombo});var n=[{text:"Ok",icon:"/resources/ajaxhelper/icons/disk.png",cls:"x-btn-text-icon",scope:this,handler:b},{text:"Cancel",icon:"/resources/ajaxhelper/icons/cross.png",cls:"x-btn-text-icon",scope:this,handler:function(){p.hide()}}];p=new Ext.Window({id:"share-win",layout:"fit",width:380,height:200,title:"Share Folder",closeAction:"hide",modal:true,plain:true,autoScroll:false,resizable:false,items:d,buttons:n});this.sharefolderWindow=p}else{this.sharefolderWindow.findById("sharefolderform").setTitle("Select the community where you wish to share the <b>"+g+"</b> folder with.");this.communityCombo.reset()}p.show()},redirectViews:function(a,b,f){if(a.id=="filepanel"){var g=a;var c=g.store.getAt(b);var d=c.get("id")}else{var d=b}window.open(window.location.protocol+"//"+window.location.hostname+"/o/"+d+"/info");window.focus()},redirectPerms:function(a,b,f){if(a.id=="filepanel"){var h=a;var c=h.store.getAt(b);var d=c.get("id")}else{var d=b}var g=window.open(window.location.protocol+"//"+window.location.hostname+":"+window.location.port+this.config.package_url+"permissions?object_id="+d+"&return_url="+window.location.pathname+"?package_id="+this.config.package_id+"&folder_id="+this.currentfolder);g.focus()},redirectNotifs:function(b,d,h){if(b.id=="filepanel"){var j=b;var f=j.store.getAt(d);var g=f.get("id");var c=f.get("title")}else{var a=b;var f=a.getSelectionModel().getSelectedNode();var g=f.attributes.id;var c=f.text}window.location.href=this.xmlhttpurl+"notif-toggle?pretty_name="+c+"&object_id="+g+"&return_url="+this.config.package_url+"?folder_id="+this.currentfolder},redirectProperties:function(b,a,f){var h=b;var c=h.store.getAt(a);var d=c.get("id");var g=window.open(window.location.protocol+"//"+window.location.hostname+":"+window.location.port+this.config.package_url+"file?file_id="+d);g.focus()},showRevisions:function(a,d,j){var n=a;var b=n.store.getAt(d);n.getSelectionModel().selectRow(d);var l=b.get("id");var c=b.get("filename");var m=this.revisionsWindow;if(m==null){m=new Ext.Window({id:"rev-win",layout:"fit",width:550,height:300,closeAction:"hide",modal:true,plain:true,items:new Ext.TabPanel({id:"rev-tabs",items:[this.createRevGrid(),this.newRevForm()]})});this.revisionsWindow=m}m.setTitle(c+" - "+acs_lang_text.properties||"Properties");var h=m.findById("revisionspanel");var g=m.findById("rev-tabs");var k=m.findById("rev-form");var f=this.config.package_id;h.store.on("load",function(){this.getSelectionModel().selectFirstRow()},h);h.on("activate",function(){this.store.baseParams.file_id=l;this.store.baseParams.package_id=f;this.store.load()},h);m.on("beforehide",function(){this.activate(1)},g);m.on("show",function(){this.activate(0)},g);m.show()},createRevGrid:function(){var f=[{header:"",width:30,sortable:false,dataIndex:"icon"},{header:"Title",width:180,sortable:false,dataIndex:"title"},{header:"Author",sortable:false,dataIndex:"author"},{header:"Size",sortable:false,dataIndex:"size"},{header:"Last Modified",sortable:false,dataIndex:"lastmodified"}];var a=new Ext.data.JsonReader({totalProperty:"total",root:"revisions",id:"revision_id"},[{name:"revision_id",type:"int"},{name:"icon"},{name:"title"},{name:"author"},{name:"type"},{name:"size"},{name:"url"},{name:"lastmodified"}]);var d=new Ext.data.HttpProxy({url:this.xmlhttpurl+"get-filerevisions"});var b=new Ext.grid.ColumnModel(f);var c=new Ext.data.Store({proxy:d,reader:a});var e=[{text:"Download",tooltip:"Download this revision",icon:"/resources/ajaxhelper/icons/arrow_down.png",cls:"x-btn-text-icon",scope:this,handler:function(){var i=this.revisionsWindow.findById("revisionspanel");var h=i.getSelectionModel().getSelected();window.open(h.get("url"));window.focus()}},{text:"Delete",tooltip:"Delete this revision",icon:"/resources/ajaxhelper/icons/delete.png",cls:"x-btn-text-icon",scope:this,handler:function(){var i=this.revisionsWindow.findById("revisionspanel");var l=i.getSelectionModel();var h=l.getSelected();var j=h.get("revision_id");var k=h.get("title");if(i.store.getCount()==1){Ext.Msg.alert("Warning","Sorry, you can not delete the only revision for this file. You can delete the file instead")}else{Ext.Msg.confirm("Delete","Are you sure you want to delete this version of "+k+" ? This action can not be reversed.",function(n){if(n=="yes"){var o=function(p){l.selectPrevious();i.store.remove(h)};var m=function(){Ext.Msg.alert("Delete Error","Sorry an error occurred. Please try again later.")};this.fsCore.doAction("delete-revision",o,m,null,{version_id:j})}})}}}];var g=new Ext.grid.GridPanel({store:c,cm:b,sm:new Ext.grid.RowSelectionModel({singleSelect:true}),id:"revisionspanel",title:"Revisions",loadMask:true,tbar:e});return g},newRevForm:function(){var b="Please choose a file to upload";var a=new Ext.Panel({id:"rev-form",align:"left",frame:true,title:"New Revision",html:'<form id="newrevfileform" name="newrevfileform" method="post" enctype="multipart/form-data"><input type="hidden" name="package_id" value="'+this.config.package_id+'"><input type="hidden" name="file_id" id="rev_file_id" value=""><input type="hidden" name="title" id="rev_file_title" value=""><p>'+b+'<br /><br /><input type="file" name="upload_file" size=\'35\' id="rev_upload_file"></p></form>',buttons:[{text:"Upload New Revision",handler:function(e){if(Ext.get("rev_upload_file").dom.value==""){Ext.Msg.alert("Warning","Please choose a file to upload")}else{var d=this.layout.findById("filepanel");var f=d.getSelectionModel().getSelected();Ext.get("rev_file_id").dom.value=f.get("id");Ext.get("rev_file_title").dom.value=f.get("title");var g={success:function(){},upload:function(){this.revisionsWindow.findById("rev-tabs").activate(0);Ext.get("newrevfileform").dom.reset();this.revisionsWindow.findById("rev-form").body.unmask();e.enable()},failure:function(){Ext.Msg.alert(acs_lang_text.error||"Error",acs_lang_text.upload_failed||"Upload failed, please try again later.");this.revisionsWindow.findById("rev-form").body.unmask();e.enable()},scope:this};this.revisionsWindow.findById("rev-form").body.mask("<center><img src='/resources/ajaxhelper/images/indicator.gif'><br>Uploading new revision. Please wait</center>");e.disable();YAHOO.util.Connect.setForm("newrevfileform",true,true);var c=YAHOO.util.Connect.asyncRequest("POST",this.xmlhttpurl+"add-filerevision",g)}}.createDelegate(this),icon:"/resources/ajaxhelper/icons/arrow_up.png",cls:"x-btn-text-icon"}]});return a},copyLink:function(b,j,k){if(b.id=="treepanel"){if(window.location.port!=""){var d=":"+window.location.port}else{var d=""}var c=window.location.protocol+"//"+window.location.hostname+d+this.config.package_url+"?package_id="+this.config.package_id+"&folder_id="+j}else{var l=b;var g=l.store.getAt(j);var a=g.get("type");if(a==="folder"){var c=window.location.protocol+"//"+window.location.hostname+":"+window.location.port+this.config.package_url+"?package_id="+this.config.package_id+"&folder_id="+g.get("id")}else{if(a==="url"){var c=g.get("url")}else{var c=window.location.protocol+"//"+window.location.hostname+g.get("url")}}}if(Ext.isIE){window.clipboardData.setData("text",c)}else{var h=Ext.Msg.show({title:acs_lang_text.linkaddress||"Copy Link Address",prompt:true,msg:acs_lang_text.copyhighlighted||"Copy the highlighted text to your clipboard.",value:c,buttons:Ext.Msg.OK});var f=YAHOO.util.Dom.getElementsByClassName("ext-mb-input","input");f[0].select()}}};
\ No newline at end of file
Index: openacs-4/packages/ajax-filestorage-ui/www/resources/ajaxfs.css
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/ajax-filestorage-ui/www/resources/ajaxfs.css,v
diff -u -r1.5 -r1.6
--- openacs-4/packages/ajax-filestorage-ui/www/resources/ajaxfs.css	13 Dec 2007 05:33:42 -0000	1.5
+++ openacs-4/packages/ajax-filestorage-ui/www/resources/ajaxfs.css	27 Dec 2008 06:27:24 -0000	1.6
@@ -59,14 +59,12 @@
 a.progressCancel,
 a.progressCancel:link,
 a.progressCancel:active,
-a.progressCancel:visited,
-a.progressCancel:hover {
+a.progressCancel:visited {
     font-size: 0px;
     display: block;
     height: 20px;
     width: 20px;
-    background-image: url(/resources/ajaxhelper/icons/delete.png);
-    background-repeat: no-repeat;
+    background: transparent url(/resources/ajaxhelper/icons/delete.png) no-repeat;
     float: right;
 }
 
@@ -77,4 +75,4 @@
 
 .x-combo-list-inner { text-align: left }
 .x-menu-list-item { text-align: left; font-weight:normal }
-.toolsmenu {background-image:url(/resources/ajaxhelper/icons/wrench_orange.png) !important;}
\ No newline at end of file
+.toolsmenu {background-image:url(/resources/ajaxhelper/icons/wrench_orange.png) !important;}
Index: openacs-4/packages/ajax-filestorage-ui/www/resources/ajaxfs.js
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/ajax-filestorage-ui/www/resources/ajaxfs.js,v
diff -u -r1.18 -r1.19
--- openacs-4/packages/ajax-filestorage-ui/www/resources/ajaxfs.js	13 Dec 2008 14:16:35 -0000	1.18
+++ openacs-4/packages/ajax-filestorage-ui/www/resources/ajaxfs.js	27 Dec 2008 06:27:24 -0000	1.19
@@ -5,16 +5,120 @@
 
 */
 
-/********** AJAXFS Class ***********/
-
+Ext.namespace('fsCore');
 Ext.namespace('ajaxfs');
 Ext.BLANK_IMAGE_URL = '/resources/ajaxhelper/ext2/resources/images/default/s.gif';
 
+/******** File Storage Core Functions ***********/
+
+fsCore = function(package_id,xmlhttpurl) {
+
+    this.package_id=package_id;
+    this.xmlhttpurl=xmlhttpurl;
+
+}
+
+fsCore.prototype = {
+
+    // the tree loader used to fill up the folder panel
+
+    createTreeLoader : function() {
+        var treeloader = new Ext.tree.TreeLoader({ 
+            dataUrl:this.xmlhttpurl+'load-treenodes',
+            baseParams: { package_id:this.package_id }
+        })
+        return treeloader
+    },
+
+    // the httpproxy that fetches the content of a folder
+    
+    createFilePanelProxy : function() {
+        var proxy = new Ext.data.HttpProxy( {
+            url : this.xmlhttpurl+ 'get-foldercontents'
+        } )
+        return proxy
+    },
+
+    // do a form submit for a given action
+    formSubmit : function(action, extform, waitmsg, params, reset, success, failure, scope) {
+
+        switch(action) {
+            case 'createurl':
+                var url = this.xmlhttpurl+"add-url"
+            break;
+        }
+
+        if (url) {
+            extform.submit({
+                url:url,
+                waitMsg:waitmsg,
+                params:params,
+                scope:scope,
+                success:success,
+                failure:failure
+            })
+        }
+    },
+
+    // executes the action thru an ajax call
+
+    doAction : function(action,successFn, failureFn, callbackFn, paramsObj, scope) {
+
+        switch(action) {
+            case 'checknotif':
+                var url = this.xmlhttpurl+"notif_p";
+            break;
+            case 'addfolder':
+                var url = this.xmlhttpurl+"add-blankfolder";
+            break;
+            case 'delete':
+                var url = this.xmlhttpurl+"delete-fsitem";
+            break;
+            case 'delete-revision':
+                var url = this.xmlhttpurl+"delete-fileversion"
+            break;
+            case 'move':
+                var url = this.xmlhttpurl+"move-fsitem";
+            break;
+            case 'rename':
+                var url = this.xmlhttpurl+"rename-fsitem";
+            break;
+            case 'tag':
+                var url = this.xmlhttpurl+"add-tag";
+            break;
+            case 'sharefolder':
+                var url = this.xmlhttpurl+"share-folder";
+            break;
+        }
+
+        if(url) {
+
+            var config = {
+                url:url,
+                success: successFn,
+                failure: failureFn,
+                params: paramsObj
+            }
+    
+            if(callbackFn) { config.callback = callbackFn }
+            if(successFn) { config.success = successFn }
+            if(failureFn) { config.failure = failureFn }
+            if(scope) { config.scope = scope }
+    
+            Ext.Ajax.request(config)
+
+        }
+
+    }
+
+}
+
+/********** AJAXFS Class *************************/
+
 ajaxfs = function(configObj) {
 
-    // ******** properties *********
+    // ******** configObj ***********
 
-    //  ** configObj **
     // ajaxFs expects a config object that may have the following properites
     // - configObj.package_id : the package_id of the current ajaxFs Instance
     // - configObj.initOpenFolder : if this value is not null, it should contain the folder id to open when object is instantiated
@@ -23,8 +127,12 @@
     // - configObj.createUrl : do we show the createurl button in the toolbar
     // - configObj.sharefolders : do we implement folder sharing
 
-    // ** properties **
+    // ******** properties *********
 
+    // holds an object with configruation settings for this instance
+    //  of ajaxfs, this variable is set only if configObj exists and is passed
+    this.config = null;
+
     // url of xmlhttp files from ajaxfs, defaults to /ajaxfs/xmlhttp
     this.xmlhttpurl = '/ajaxfs/xmlhttp/';
 
@@ -34,14 +142,10 @@
     // do we support folder sharing
     this.share_folders_p = true;
 
-    // holds an object with configruation settings for this instance
-    //  of ajaxfs, this variable is set only if configObj exists and is passed
-    this.config = null;
-
     // holds a reference to the layout for the center page
     this.layout = null;
     
-    // reference to the tree edito for the treepanel
+    // reference to the tree editor for the treepanel
     this.te = null;
 
     // holds the id of the currently selected node in the tree
@@ -91,7 +195,7 @@
         if (typeof(Ext.DomHelper) != "undefined") {
 
             // ExtJs is loaded
-            // check for config
+            // process configObj
             if (configObj) { 
 
                 this.config = configObj;
@@ -114,14 +218,17 @@
                 if(!this.config.ispublic) {
                     Ext.Ajax.on("requestcomplete", this.isSessionExpired, this);
                 }
-                
-            }
 
-            // initialize tooltips
-            Ext.QuickTips.init();
+                // instantiate the core object that allows us to work with the back-end
+                this.fsCore = new fsCore(this.config.package_id,this.xmlhttpurl);
+    
+                // initialize tooltips
+                Ext.QuickTips.init();
+    
+                // setup the layout and panels
+                this.initLayout();
 
-            // setup the layout and panels
-            this.initLayout();
+            }
 
         }
 
@@ -220,105 +327,50 @@
     // create a tools menu that has the same items as the context menu
     createToolsMenu : function() {
 
-        var menu = new Ext.menu.Menu({
-            id: 'toolsmenu',
-            shadow:false,
-            items: [
-            new Ext.menu.Item({
-                id:'mnOpen',
-                text: acs_lang_text.open || 'Open',
-                icon: '/resources/ajaxhelper/icons/page_white.png'
-            }),
-            new Ext.menu.Item({
-                id:'mnTag',
-                text: acs_lang_text.tag || 'Tag',
-                icon: '/resources/ajaxhelper/icons/tag_blue.png'
-            }),
-            new Ext.menu.Item({
-                id:'mnView',
-                text: acs_lang_text.views || 'Views',
-                icon: '/resources/ajaxhelper/icons/camera.png'
-            }),
-            new Ext.menu.Item({
-                id:'mnRename',
-                text: acs_lang_text.rename || 'Rename',
-                icon: '/resources/ajaxhelper/icons/page_edit.png'
-            }),
-            new Ext.menu.Item({
-                id:'mnCopyLink',
-                text: acs_lang_text.linkaddress || 'Copy Link Address',
-                icon: '/resources/ajaxhelper/icons/page_copy.png'
-            }), 
-            new Ext.menu.Item({
-                id:'mnPerms',
-                text: acs_lang_text.permissions || 'Permissions',
-                icon: '/resources/ajaxhelper/icons/group_key.png'
-            }), 
-            new Ext.menu.Item({
-                id:'mnProp',
-                text: acs_lang_text.properties || 'Properties',
-                icon: '/resources/ajaxhelper/icons/page_edit.png'
-            }), 
-            new Ext.menu.Item({
-                id:'mnArch',
-                text: acs_lang_text.download_archive || 'Download archive',
-                icon: '/resources/ajaxhelper/icons/arrow_down.png'
-            }),
-            new Ext.menu.Item({
-                id:'mnShare',
-                text: acs_lang_text.sharefolder || 'Share Folder',
-                icon: '/resources/ajaxhelper/icons/group_link.png'
-            }),
-            new Ext.menu.Item({
-                id:'mnNotif',
-                text: acs_lang_text.request_notification || 'Request Notification',
-                icon: '/resources/ajaxhelper/icons/email.png'
-            })
-            ]
-        });
+        var beforeshow = function() {
 
-        menu.on("beforeshow",function() {
-
             var gridpanel = this.layout.findById('filepanel');
             var treepanel = this.layout.findById('treepanel');
 
+            // allow use of this tool on the treepanel folders
+            // we want it to work on the tree if there are no files selected
+
             if (gridpanel.getSelectionModel().getCount() == 0) {
 
-                // no file from the grid has been selected
-                // allow use of this tool on the treepanel folders
+                // start by enabling all the tools menu items
 
                 for(var x=0; x<menu.items.items.length;x++) {
                     menu.items.items[x].enable();
                 }
 
-                menu.items.items[0].setText(acs_lang_text.open || 'Open');
-                menu.items.items[0].disable();
-                menu.items.items[1].disable();
-                menu.items.items[6].disable();
-                menu.items.items[8].disable();
+                // selectively disable
 
+                Ext.getCmp('mnOpen').setText(acs_lang_text.open || 'Open');
+                Ext.getCmp('mnOpen').disable();
+                Ext.getCmp('mnTag').disable();
+                Ext.getCmp('mnProp').disable();
+                Ext.getCmp('mnArch').disable();
+                Ext.getCmp('mnShare').disable();
+
                 //check if the user is subscribed to this folder
-                Ext.Ajax.request({
-                    url:this.xmlhttpurl+"notif_p",
-                    success: function(o) {
-                        if(parseInt(o.responseText)) {
-                            menu.items.items[9].setText(acs_lang_text.unsubscribe_notification || 'Unsubscribe');
-                        } else {
-                            menu.items.items[9].setText(acs_lang_text.request_notification || 'Request Notification');
-                        }
-                    }, failure: function(response) {
-                        // presume user is not subscribed
-                        menu.items.items[9].setText(acs_lang_text.request_notification || 'Request Notification');
-                    }, params: { object_id:treepanel.getSelectionModel().getSelectedNode().attributes["id"] }
-                });
 
-                menu.items.items[9].enable();
+                var success = function(o) {
+                    if(parseInt(o.responseText)) {
+                        Ext.getCmp('mnNotif').setText(acs_lang_text.unsubscribe_notification || 'Unsubscribe');
+                    } else {
+                        Ext.getCmp('mnNotif').setText(acs_lang_text.request_notification || 'Request Notification');
+                    }
+                } 
 
-                // always disable views if views package is not installed
-                if(!this.views_p) {
-                    menu.items.items[2].disable();
+                var failure = function(response) {
+                    // presume user is not subscribed
+                    Ext.getCmp('mnNotif').setText(acs_lang_text.request_notification || 'Request Notification');
                 }
 
+                this.fsCore.doAction('checknotif',success, failure, null,{ object_id:treepanel.getSelectionModel().getSelectedNode().attributes["id"] });
+
+                Ext.getCmp('mnNotif').enable();
+
             } else {
 
                 if (gridpanel.getSelectionModel().getCount() == 1) {
@@ -329,61 +381,59 @@
                         menu.items.items[x].enable();
                     }
 
-                    menu.items.items[9].setText(acs_lang_text.request_notification || 'Request Notification');
+                    Ext.getCmp('mnNotif').setText(acs_lang_text.request_notification || 'Request Notification');
 
                     switch (selectedRow[0].get("type"))  {
                         case "folder":
-                            menu.items.items[0].setText(acs_lang_text.open || 'Open');
-                            menu.items.items[1].disable();
-                            menu.items.items[6].disable();
-                            //check if the user is subscribed to this folder
-                            Ext.Ajax.request({
-                                url:this.xmlhttpurl+"notif_p",
-                                success: function(o) {
-                                    if(parseInt(o.responseText)) {
-                                        menu.items.items[9].setText(acs_lang_text.unsubscribe_notification ||'Unsubscribe');
-                                    } else {
-                                        menu.items.items[9].setText(acs_lang_text.request_notification ||'Request Notification');
-                                    }
-                                }, failure: function(response) {
-                                    // presume user is not subscribed
-                                    menu.items.items[9].setText(acs_lang_text.request_notification || 'Request Notification');
-                                }, params: { object_id:treepanel.getSelectionModel().getSelectedNode().attributes["id"] }
-                            });
-                            menu.items.items[9].enable();
+
+                            Ext.getCmp('mnOpen').setText(acs_lang_text.open || 'Open');
+                            Ext.getCmp('mnTag').disable();
+                            Ext.getCmp('mnPerms').disable();
+
+                            var success = function(o) {
+                                if(parseInt(o.responseText)) {
+                                    Ext.getCmp('mnNotif').setText(acs_lang_text.unsubscribe_notification ||'Unsubscribe');
+                                } else {
+                                    Ext.getCmp('mnNotif').setText(acs_lang_text.request_notification ||'Request Notification');
+                                }
+                            }
+
+                            var failure = function(response) {
+                                // presume user is not subscribed
+                                Ext.getCmp('mnNotif').setText(acs_lang_text.request_notification || 'Request Notification');
+                            }
+
+                            this.fsCore.doAction('checknotif',success, failure, null,{ object_id:treepanel.getSelectionModel().getSelectedNode().attributes["id"] });
+                            Ext.getCmp('mnNotif').enable();
+
                             break;
                         case "symlink":
-                            menu.items.items[0].setText(acs_lang_text.open || 'Open');
-                            menu.items.items[1].disable();
-                            menu.items.items[3].disable();
-                            menu.items.items[6].disable();
-                            menu.items.items[9].disable();
+                            Ext.getCmp('mnOpen').setText(acs_lang_text.open || 'Open');
+                            Ext.getCmp('mnTag').disable();
+                            Ext.getCmp('mnRename').disable();
+                            Ext.getCmp('mnProp').disable();
+                            Ext.getCmp('mnNotif').disable();
                             break;
                         case "url" :
-                            menu.items.items[0].setText(acs_lang_text.open || 'Open');
-                            menu.items.items[6].disable();
-                            menu.items.items[7].disable();
-                            menu.items.items[8].disable();
-                            menu.items.items[9].disable();
+                            Ext.getCmp('mnOpen').setText(acs_lang_text.open || 'Open');
+                            Ext.getCmp('mnProp').disable();
+                            Ext.getCmp('mnArch').disable();
+                            Ext.getCmp('mnShare').disable();
+                            Ext.getCmp('mnNotif').disable();
                             break;
                         default :
-                            menu.items.items[0].setText(acs_lang_text.download || 'Download');
-                            menu.items.items[7].disable();
-                            menu.items.items[8].disable();
-                            menu.items.items[9].disable();
+                            Ext.getCmp('mnOpen').setText(acs_lang_text.download || 'Download');
+                            Ext.getCmp('mnArch').disable();
+                            Ext.getCmp('mnShare').disable();
+                            Ext.getCmp('mnNotif').disable();
                             break;
                     }
     
                     // always disable if shared folders are not supported
                     if(!this.share_folders_p) {
-                        menu.items.items[8].disable();
+                        Ext.getCmp('mnShare').disable();
                     }
     
-                    // always disable views if views package is not installed
-                    if(!this.views_p) {
-                        menu.items.items[2].disable();
-                    }
-    
                 } else {
     
                     for(var x=0; x<menu.items.items.length;x++) {
@@ -394,16 +444,22 @@
 
             }
 
-        },this);
+            // always disable views if views package is not installed
 
-        menu.on("itemclick",function(item,e) {
+            if(!this.views_p) {
+                Ext.getCmp('mnView').disable();
+            }
 
+        }
+
+        var itemclick = function(item,e) {
+
             var gridpanel = this.layout.findById('filepanel');
 
             if(gridpanel.getSelectionModel().getCount() == 1) {
 
                 // panel is the filegrid
-                var panel = gridpanel;
+                var panel = this.layout.findById('filepanel');
                 var recordid = panel.getSelectionModel().getSelected().get("id");
     
                 for (var x=0; x<panel.store.data.items.length; x++) {
@@ -453,8 +509,33 @@
                     break;
             }
 
-        },this);
+        }
 
+        var menu = new Ext.menu.Menu({
+            id: 'toolsmenu',
+            shadow:false,
+            items: [
+                new Ext.menu.Item({ id:'mnOpen',text: acs_lang_text.open || 'Open',icon: '/resources/ajaxhelper/icons/page_white.png'}),
+                new Ext.menu.Item({ id:'mnTag', text: acs_lang_text.tag || 'Tag', icon: '/resources/ajaxhelper/icons/tag_blue.png' }),
+                new Ext.menu.Item({ id:'mnView', text: acs_lang_text.views || 'Views', icon: '/resources/ajaxhelper/icons/camera.png' }),
+                new Ext.menu.Item({ id:'mnRename', text: acs_lang_text.rename || 'Rename', icon: '/resources/ajaxhelper/icons/page_edit.png' }), 
+                new Ext.menu.Item({ id:'mnCopyLink', text: acs_lang_text.linkaddress || 'Copy Link Address', icon: '/resources/ajaxhelper/icons/page_copy.png' }), 
+                new Ext.menu.Item({ id:'mnPerms', text: acs_lang_text.permissions || 'Permissions', icon: '/resources/ajaxhelper/icons/group_key.png' }), 
+                new Ext.menu.Item({ id:'mnProp', text: acs_lang_text.properties || 'Properties', icon: '/resources/ajaxhelper/icons/page_edit.png' }), 
+                new Ext.menu.Item({ id:'mnArch', text: acs_lang_text.download_archive || 'Download archive', icon: '/resources/ajaxhelper/icons/arrow_down.png' }),
+                new Ext.menu.Item({ id:'mnShare', text: acs_lang_text.sharefolder || 'Share Folder', icon: '/resources/ajaxhelper/icons/group_link.png' }),
+                new Ext.menu.Item({ id:'mnNotif', text: acs_lang_text.request_notification || 'Request Notification', icon: '/resources/ajaxhelper/icons/email.png' }) ],
+            listeners:{
+                'beforeshow':{
+                    scope:this,
+                    fn:beforeshow
+                }, 'itemclick':{
+                    scope:this,
+                    fn:itemclick
+                }
+            }
+        })
+
         var tbutton = {
             text:'Tools',
             iconCls:'toolsmenu',
@@ -472,17 +553,17 @@
         if(rootnode.attributes["write_p"] == 't') {
             var toolbar = [
                 ' ',
-                {text: acs_lang_text.newfolder || 'New Folder', tooltip: acs_lang_text.newfolder || 'New Folder', icon: '/resources/ajaxhelper/icons/folder_add.png', cls : 'x-btn-text-icon', handler: this.addFolder.createDelegate(this)},
-                {text: acs_lang_text.uploadfile || 'Upload Files', tooltip: acs_lang_text.uploadfile || 'Upload Files', icon: '/resources/ajaxhelper/icons/page_add.png', cls : 'x-btn-text-icon', handler: this.addFile.createDelegate(this)}
+                {text: acs_lang_text.newfolder || 'New Folder', tooltip: acs_lang_text.newfolder || 'New Folder', icon: '/resources/ajaxhelper/icons/folder_add.png', cls : 'x-btn-text-icon', scope:this,handler: this.addFolder},
+                {id:'btnUploadFile', text: acs_lang_text.uploadfile || 'Upload Files', tooltip: acs_lang_text.uploadfile || 'Upload Files', icon: '/resources/ajaxhelper/icons/page_add.png', cls : 'x-btn-text-icon', scope:this, handler: this.addFile}
             ];
             if(this.create_url_p) {
-                toolbar.push({text: acs_lang_text.createurl || 'Create Url',tooltip: acs_lang_text.createurl || 'Create Url', icon: '/resources/ajaxhelper/icons/page_link.png', cls : 'x-btn-text-icon', handler: this.addUrl.createDelegate(this)});
+                toolbar.push({text: acs_lang_text.createurl || 'Create Url',tooltip: acs_lang_text.createurl || 'Create Url', icon: '/resources/ajaxhelper/icons/page_link.png', cls : 'x-btn-text-icon', scope:this, handler: this.addUrl});
             }
-            toolbar.push({text: acs_lang_text.deletefs || 'Delete', tooltip: acs_lang_text.deletefs || 'Delete', icon: '/resources/ajaxhelper/icons/delete.png', cls : 'x-btn-text-icon', handler: this.delItem.createDelegate(this)});
+            toolbar.push({text: acs_lang_text.deletefs || 'Delete', tooltip: acs_lang_text.deletefs || 'Delete', icon: '/resources/ajaxhelper/icons/delete.png', cls : 'x-btn-text-icon', scope:this, handler: this.delItem });
             toolbar.push(this.createToolsMenu());
             toolbar.push('->');
         }
-        toolbar.push({tooltip: 'This may take a few minutes if you have a lot of files', text: acs_lang_text.download_archive || 'Download Archive', icon: '/resources/ajaxhelper/icons/arrow_down.png', cls : 'x-btn-text-icon', handler: this.downloadArchive.createDelegate(this,[rootnode.id],false)});
+        toolbar.push({tooltip: 'This may take a few minutes if you have a lot of files', text: acs_lang_text.download_archive || 'Download Archive', icon: '/resources/ajaxhelper/icons/arrow_down.png', cls : 'x-btn-text-icon', scope:this, handler: function() { this.downloadArchive.(rootnode.id) } });
         return toolbar;
     },
 
@@ -493,8 +574,8 @@
             id:'leftpanel',
             region:'west',
             collapsible:true,
-            titlebar:true,
-            title:' ',
+            collapseMode: 'mini',
+            titlebar:false,
             layout:'accordion',
             split:true,
             width:300,
@@ -518,10 +599,7 @@
             attributes: this.config.treerootnode.attributes
         });
 
-        var loader = new Ext.tree.TreeLoader({ 
-            dataUrl:this.xmlhttpurl+'load-treenodes',
-            baseParams: { package_id:this.config.package_id }
-        });
+        var loader = this.fsCore.createTreeLoader();
 
         var treepanel = new Ext.tree.TreePanel({
             id:'treepanel',
@@ -557,7 +635,7 @@
                             }
                         }
                     }
-                    return true;
+                    return "x-dd-drop-ok";
 
                 }, onNodeDrop : function(treenode,source,e,data) {
 
@@ -609,18 +687,17 @@
                             Ext.Msg.alert(acs_lang_text.error || "Error",err_msg_txt+"<br>"+err_msg_txt2);
                         }
                     }
-            
-                    Ext.Ajax.request({
-                        url:this.xmlhttpurl+"move-fsitem",
-                        success: moveSuccess, failure: function(response) {
-                            var resultObj = Ext.decode(response.responseText);
-                            var msg = "";
-                            if(resultObj.error) { msg = resultObj.error }
-                            // ajax failed, revert value
-                            Ext.Msg.alert(acs_lang_text.error || "Error",err_msg_txt+"<br>"+msg+"<br>"+err_msg_txt2);
-                        }, params: { folder_target_id:folder_target_id,file_ids:file_ids }
-                    });
 
+                    var failure=function(response) {
+                        var resultObj = Ext.decode(response.responseText);
+                        var msg = "";
+                        if(resultObj.error) { msg = resultObj.error }
+                        // ajax failed, revert value
+                        Ext.Msg.alert(acs_lang_text.error || "Error",err_msg_txt+"<br>"+msg+"<br>"+err_msg_txt2);
+                    }
+
+                    this.fsCore.doAction('move',moveSuccess, failure, null,{ folder_target_id:folder_target_id,file_ids:file_ids });
+
                     return true;
 
                 }.createDelegate(this)
@@ -685,21 +762,22 @@
             var err_msg_txt = acs_lang_text.an_error_occurred || "An error occurred";
             var err_msg_txt2 = acs_lang_text.reverted || "Your changes have been reverted";
 
-            Ext.Ajax.request({
-                url:this.xmlhttpurl+"rename-fsitem",
-                success: function(response) {
-                    var resultObj = Ext.decode(response.responseText);
-                    if (!resultObj.success) {
-                        Ext.Msg.alert(acs_lang_text.error || "Error",err_msg_txt+": <br><br><font color='red'>"+resultObj.error+"</font><br><br>"+err_msg_txt2);
-                        node.editNode.setText(oldval);
-                    }
-                }, failure: function() {
-                    // ajax failed, revert value
-                    Ext.Msg.alert(acs_lang_text.error || "Error",err_msg_txt+"<br>"+err_msg_txt2);
+            var success = function(response) {
+                var resultObj = Ext.decode(response.responseText);
+                if (!resultObj.success) {
+                    Ext.Msg.alert(acs_lang_text.error || "Error",err_msg_txt+": <br><br><font color='red'>"+resultObj.error+"</font><br><br>"+err_msg_txt2);
                     node.editNode.setText(oldval);
-                }, params: { newname:newval, object_id:node.editNode.id, type:"folder" }
-            });
-                
+                }
+            }
+
+            var failure = function() {
+                // ajax failed, revert value
+                Ext.Msg.alert(acs_lang_text.error || "Error",err_msg_txt+"<br>"+err_msg_txt2);
+                node.editNode.setText(oldval);
+            }
+
+            this.fsCore.doAction('rename',success, failure, null,{ newname:newval, object_id:node.editNode.id, type:"folder" });
+
         }, this, true);
 
     },
@@ -780,12 +858,8 @@
                     {name:'size'},
                     {name:'lastmodified'}] );
 
+        var proxy = this.fsCore.createFilePanelProxy();
 
-        var proxy = new Ext.data.HttpProxy( {
-                        url : this.xmlhttpurl+ 'get-foldercontents'
-                    } );
-
-
         var colModel = new Ext.grid.ColumnModel(cols);
 
         var dataModel = new Ext.data.Store({proxy: proxy, reader: reader, remoteSort: true});
@@ -799,7 +873,6 @@
             split:true,
             autoScroll:true,
             autoExpandColumn:'filename',
-            collapsible:true,
             enableDragDrop:true,
             width:250,
             loadMask:true,
@@ -808,6 +881,8 @@
                 forceFit: false,
                 enableRowBody:true,
                 showPreview:true,
+                deferEmptyText: true,
+                emptyText: 'This folder is empty',
                 getRowClass: function(record,rowIndex,p,ds) {
                     var xf = Ext.util.Format;
                     if (record.data.tags!= "") {
@@ -861,52 +936,82 @@
             new Ext.menu.Item({
                 text: openitem_txt,
                 icon: '/resources/ajaxhelper/icons/page_white.png',
-                handler: this.openItem.createDelegate(this,[grid, i, e],false)
+                scope:this,
+                handler: function() {
+                    this.openItem(grid, i, e)
+                }
             }),
             new Ext.menu.Item({
                 text: 'Tag',
                 icon: '/resources/ajaxhelper/icons/tag_blue.png',
-                handler: this.tagFsitem.createDelegate(this,[grid, i, e],false)
+                scope:this,
+                handler: function() {
+                    this.tagFsitem(grid, i, e)
+                }
             }),
             new Ext.menu.Item({
                 text: 'Views',
                 icon: '/resources/ajaxhelper/icons/camera.png',
-                handler: this.redirectViews.createDelegate(this,[grid, i, e],false)
+                scope:this,
+                handler: function() {
+                    this.redirectViews(grid, i, e)
+                }
             }),
             new Ext.menu.Item({
                 text: acs_lang_text.deletefs || 'Delete',
                 icon: '/resources/ajaxhelper/icons/delete.png',
-                handler: this.delItem.createDelegate(this,[grid,i,e],false)
+                scope:this,
+                handler: function() {
+                    this.delItem(grid,i,e)
+                }
             }),
             new Ext.menu.Item({
                 text: acs_lang_text.rename || 'Rename',
                 icon: '/resources/ajaxhelper/icons/page_edit.png',
-                handler: this.renameItem.createDelegate(this,[grid,i,e],false)
+                scope:this,
+                handler: function() {
+                    this.renameItem(grid,i,e)
+                }
             }),
             new Ext.menu.Item({
                 text: acs_lang_text.linkaddress || 'Copy Link Address',
                 icon: '/resources/ajaxhelper/icons/page_copy.png',
-                handler: this.copyLink.createDelegate(this,[grid,i,e],false)
+                scope:this,
+                handler: function() {
+                    this.copyLink(grid,i,e)
+                }
             }), 
             new Ext.menu.Item({
                 text: acs_lang_text.permissions || 'Permissions',
                 icon: '/resources/ajaxhelper/icons/group_key.png',
-                handler: this.redirectPerms.createDelegate(this,[grid, i, e],false)
+                scope:this,
+                handler: function() {
+                    this.redirectPerms(grid,i,e)
+                }
             }), 
             new Ext.menu.Item({
                 text: acs_lang_text.properties || 'Properties',
                 icon: '/resources/ajaxhelper/icons/page_edit.png',
-                handler: this.showRevisions.createDelegate(this,[grid, i, e],false)
+                scope:this,
+                handler: function() {
+                    this.showRevisions(grid,i,e)
+                }
             }), 
             new Ext.menu.Item({
                 text: acs_lang_text.download_archive || 'Download archive',
                 icon: '/resources/ajaxhelper/icons/arrow_down.png',
-                handler: this.downloadArchive.createDelegate(this,[recordid],false)
+                scope:this,
+                handler: function() {
+                    this.downloadArchive(recordid)
+                }
             }),
             new Ext.menu.Item({
                 text: acs_lang_text.sharefolder || 'Share Folder',
                 icon: '/resources/ajaxhelper/icons/group_link.png',
-                handler: this.showShareOptions.createDelegate(this,[grid, i, e],false)
+                scope:this,
+                handler: function() {
+                    this.showShareOptions(grid,i,e)
+                }
             })  ]
         });
 
@@ -1119,39 +1224,40 @@
             }
 
         }
-    
+
+        var success = function(response) {
+            var resultobj = Ext.decode(response.responseText);
+            if(resultobj.success) {
+                if(delfromtree) {
+                    var selectednode = treepanel.getSelectionModel().getSelectedNode();
+                    var parentnode = selectednode.parentnode;
+                    parentnode.fireEevent("click",parentnode);
+                    parentnode.removeChild(selectednode);
+                } else {
+                    for(var x=0; x<selectedRows.length; x++) {
+                        // hide the node from the json view
+                        filepanel.store.remove(selectedRows[x]);
+                        // if it's a node on the tree, remove it
+                        var treenodeid = selectedRows[x].get("id");
+                        var selectednode = treepanel.getNodeById(treenodeid);
+                        if (selectednode) {
+                            selectednode.parentnode.fireEevent("click",selectednode.parentnode);
+                            selectednode.parentnode.removeChild(selectednode);
+                        }
+                    }
+                }
+            } else {
+                ext.msg.alert(acs_lang_text.error || "error","sorry, we encountered an error.");
+            }
+        }
+
+        var failure = function() {
+            Ext.Msg.alert(acs_lang_text.error || "Error",error_msg_txt + "<br><br><font color='red'>"+resultObj.error+"</font>");
+        }
+
         var doDelete = function(choice) {
             if (choice === "yes") {
-                Ext.Ajax.request({
-                    url:this.xmlhttpurl+"delete-fsitem",
-                    success: function(response) {
-                        var resultObj = Ext.decode(response.responseText);
-                        if(resultObj.success) {
-                            if(delfromtree) {
-                                var selectednode = treepanel.getSelectionModel().getSelectedNode();
-                                var parentnode = selectednode.parentNode;
-                                parentnode.fireEvent("click",parentnode);
-                                parentnode.removeChild(selectednode);
-                            } else {
-                                for(var x=0; x<selectedRows.length; x++) {
-                                    // hide the node from the json view
-                                    filepanel.store.remove(selectedRows[x]);
-                                    // if it's a node on the tree, remove it
-                                    var treenodeid = selectedRows[x].get("id");
-                                    var selectednode = treepanel.getNodeById(treenodeid);
-                                    if (selectednode) {
-                                        selectednode.parentNode.fireEvent("click",selectednode.parentNode);
-                                        selectednode.parentNode.removeChild(selectednode);
-                                    }
-                                }
-                            }
-                        } else {
-                            Ext.Msg.alert(acs_lang_text.error || "Error","Sorry, we encountered an error.");
-                        }
-                    }, failure: function() {
-                        Ext.Msg.alert(acs_lang_text.error || "Error",error_msg_txt + "<br><br><font color='red'>"+resultObj.error+"</font>");
-                    }, params: params
-                });
+                this.fsCore.doAction('delete',success, failure, null,params);
             }
         }
 
@@ -1168,179 +1274,254 @@
         var tree = this.layout.findById('treepanel');
         var currentTreeNode = tree.getSelectionModel().getSelectedNode();
         currentTreeNode.expand();
+
+        // error message if this action fails
         var error_msg_txt = acs_lang_text.new_folder_error || "Sorry, there was an error trying to create your new folder.";
-        
-        Ext.Ajax.request({
-            url:this.xmlhttpurl+"add-blankfolder",
-            success: function(response) {
-                var resultObj = Ext.decode(response.responseText);
-                if (resultObj.success) {
-                    // create a new blank node on the currently selected one
-                    var newnode = currentTreeNode.appendChild(new Ext.tree.TreeNode({text:resultObj.pretty_folder_name,id:resultObj.id,iconCls:"folder",singleClickExpand:true,attributes:{write_p:'t'}}));
-                    tree.getSelectionModel().select(newnode);
-                    newnode.loaded=true;
-                    newnode.fireEvent("click",newnode);
-                    setTimeout(function(){
-                        te.editNode = newnode;
-                        te.startEdit(newnode.ui.textNode);
-                    }, 10);
-                } else {
-                    Ext.Msg.alert(acs_lang_text.error || "Error",error_msg_txt + "<br><br><font color='red'>"+resultObj.error+"</font>");
-                }
-            }, failure: function(response) {
-                var resultObj = Ext.decode(response.responseText);
+
+        // success function
+        var success = function(response) {
+            var resultObj = Ext.decode(response.responseText);
+            if (resultObj.success) {
+                // create a new blank node on the currently selected one
+                var newnode = currentTreeNode.appendChild(new Ext.tree.TreeNode({text:resultObj.pretty_folder_name,id:resultObj.id,iconCls:"folder",singleClickExpand:true,attributes:{write_p:'t',size:'',type:'folder',symlink_id:''}}));
+                tree.getSelectionModel().select(newnode);
+                newnode.loaded=true;
+                newnode.fireEvent("click",newnode);
+                setTimeout(function(){
+                    te.editNode = newnode;
+                    te.startEdit(newnode.ui.textNode);
+                }, 10);
+            } else {
                 Ext.Msg.alert(acs_lang_text.error || "Error",error_msg_txt + "<br><br><font color='red'>"+resultObj.error+"</font>");
-            }, params: { folder_id: currentTreeNode.attributes["id"] }
-        });
+            }
+        }
 
+        // failure function
+        var failure = function(response) {
+            var resultObj = Ext.decode(response.responseText);
+            Ext.Msg.alert(acs_lang_text.error || "Error",error_msg_txt + "<br><br><font color='red'>"+resultObj.error+"</font>");
+        }
+
+        // execute the ajax
+        this.fsCore.doAction('addfolder',success, failure, null,{ folder_id: currentTreeNode.attributes["id"] });
+
     },
 
     createSwfObj : function() {
 
-        var ajaxfsobj = this;
-        var treepanel = ajaxfsobj.layout.findById('treepanel');
-        var currentfolder = ajaxfsobj.currentfolder;
+        var treepanel = this.layout.findById('treepanel');
+        var currentfolder = this.currentfolder;
 
         if(this.swfu == null) {
 
+            var ajaxfsobj = this;
             var package_id = String(this.config.package_id);
             var user_id = String(this.config.user_id);
             var folder_id = String(this.currentfolder);
             var max_file_size = String(this.config.max_file_size);
 
-            var uploadProgress = function (fileObj, bytesLoaded) {
-                try {
-                    var percent = Math.ceil((bytesLoaded / fileObj.size) * 100)
-                    var progress = new FileProgress(fileObj, this.getSetting("progress_target"));
-                    progress.SetProgress(percent);
-                    progress.SetStatus(acs_lang_text.uploading || "Uploading...");
-                } catch (ex) { this.debugMessage(ex); }
-            }
+            var progress_target = 'fsuploadprogress';
 
-            var uploadCancel = function(fileObj) {
+            var fileQueued = function(fileObj) {
+                var upload_txt = acs_lang_text.for_upload_to || "for upload to";
+                var zip_txt = acs_lang_text.zip_extracted || "Zip File (Will be extracted after upload)";
                 try {
-                    var progress = new FileProgress(fileObj, this.getSetting("progress_target"));
-                    progress.SetCancelled();
-                    progress.SetStatus(acs_lang_text.uploadcancel || "Cancelled (This item will be removed shortly)");
-                    progress.ToggleCancel(false);
-            
+                    var folderid = ajaxfsobj.currentfolder;
+                    var foldername = treepanel.getNodeById(folderid).text;
+                    var progress = new FileProgress(fileObj, progress_target);
+                    progress.SetStatus( upload_txt + " <b>"+foldername+"</b><br>Title: <input type='text' onblur=\"fsInstance.swfu.removeFileParam('"+fileObj.id+"','filetitle');fsInstance.swfu.addFileParam('"+fileObj.id+"','filetitle',this.value)\">(optional)<br><input type='checkbox' id='zip"+fileObj.id+"' onclick=\"if(document.getElementById('zip"+fileObj.id+"').checked) { fsInstance.swfu.addFileParam('"+fileObj.id+"','unpack_p','1') } else { fsInstance.swfu.removeFileParam('"+fileObj.id+"','unpack_p') }\"> "+ zip_txt);
+                    progress.ToggleCancel(true, this);
+                    this.addFileParam(fileObj.id, "folder_id", folderid);
+                } catch (ex) { 
+                    Ext.Msg.alert(acs_lang_text.error || "Error",ex);
                 }
-                catch (ex) { this.debugMessage(ex) }
             }
 
-            var uploadComplete = function(fileObj) {
-                try {
-                    var progress = new FileProgress(fileObj, this.getSetting("progress_target"));
-                    progress.SetComplete();
-                    progress.SetStatus(acs_lang_text.complete || "Complete.");
-                    progress.ToggleCancel(false);
-            
-                } catch (ex) { this.debugMessage(ex); }
+            var fileDialogStart = function() {
+                // console.log('file dialog start')
             }
 
-            var uploadQueueComplete = function(fileidx) {
-                var currentTreeNode = treepanel.getNodeById(ajaxfsobj.currentfolder);
-                currentTreeNode.fireEvent("click",currentTreeNode);
-            }
-
-            var uploadError = function(error_code, fileObj, message) {
+            var fileQueueError = function(file, errorCode, message) {
+                console.log('file queue error')
                 try {
-                    if (error_code == SWFUpload.ERROR_CODE_QUEUE_LIMIT_EXCEEDED) {
-                        Ext.Msg.alert(acs_lang_text.alert || "Alert","You have attempted to queue too many files.\n" + (message == 0 ? "You have reached the upload limit." : "You may select " + (message > 1 ? "up to " + message + " files." : "one file.")));
+                    if (errorCode === SWFUpload.QUEUE_ERROR.QUEUE_LIMIT_EXCEEDED) {
+                        alert("You have attempted to queue too many files.\n" + (message === 0 ? "You have reached the upload limit." : "You may select " + (message > 1 ? "up to " + message + " files." : "one file.")));
                         return;
                     }
             
-                    var progress = new FileProgress(fileObj, this.getSetting("progress_target"));
-                    progress.SetError();
-                    progress.ToggleCancel(false);
+                    var progress = new FileProgress(file, progress_target);
+                    progress.setError();
+                    progress.toggleCancel(false);
             
-                    switch(error_code) {
-                        case SWFUpload.ERROR_CODE_HTTP_ERROR:
-                            progress.SetStatus("Upload Error");
-                            this.debugMessage("Error Code: HTTP Error, File name: " + file.name + ", Message: " + message);
-                            break;
-                        case SWFUpload.ERROR_CODE_MISSING_UPLOAD_TARGET:
-                            progress.SetStatus("Configuration Error");
-                            this.debugMessage("Error Code: No backend file, File name: " + file.name + ", Message: " + message);
-                            break;
-                        case SWFUpload.ERROR_CODE_UPLOAD_FAILED:
-                            progress.SetStatus("Upload Failed.");
-                            this.debugMessage("Error Code: Upload Failed, File name: " + file.name + ", File size: " + file.size + ", Message: " + message);
-                            break;
-                        case SWFUpload.ERROR_CODE_IO_ERROR:
-                            progress.SetStatus("Server (IO) Error");
-                            this.debugMessage("Error Code: IO Error, File name: " + file.name + ", Message: " + message);
-                            break;
-                        case SWFUpload.ERROR_CODE_SECURITY_ERROR:
-                            progress.SetStatus("Security Error");
-                            this.debugMessage("Error Code: Security Error, File name: " + file.name + ", Message: " + message);
-                            break;
-                        case SWFUpload.ERROR_CODE_FILE_EXCEEDS_SIZE_LIMIT:
-                            progress.SetStatus("File is too big.");
-                            this.debugMessage("Error Code: File too big, File name: " + file.name + ", File size: " + file.size + ", Message: " + message);
-                            break;
-                        case SWFUpload.ERROR_CODE_ZERO_BYTE_FILE:
-                            progress.SetStatus("Cannot upload Zero Byte files.");
-                            this.debugMessage("Error Code: Zero byte file, File name: " + file.name + ", File size: " + file.size + ", Message: " + message);
-                            break;
-                        case SWFUpload.ERROR_CODE_UPLOAD_LIMIT_EXCEEDED:
-                            progress.SetStatus("Upload limit exceeded.");
-                            this.debugMessage("Error Code: Upload Limit Exceeded, File name: " + file.name + ", File size: " + file.size + ", Message: " + message);
-                            break;
-                        default:
-                            progress.SetStatus("Unhandled Error");
-                            this.debugMessage("Error Code: " + error_code + ", File name: " + file.name + ", File size: " + file.size + ", Message: " + message);
-                            break;
+                    switch (errorCode) {
+                    case SWFUpload.QUEUE_ERROR.FILE_EXCEEDS_SIZE_LIMIT:
+                        progress.setStatus("File is too big.");
+                        Ext.Msg.alert(acs_lang_text.error || "Error","Error Code: File too big, File name: " + file.name + ", File size: " + file.size + ", Message: " + message);
+                        break;
+                    case SWFUpload.QUEUE_ERROR.ZERO_BYTE_FILE:
+                        progress.setStatus("Cannot upload Zero Byte files.");
+                        Ext.Msg.alert(acs_lang_text.error || "Error","Error Code: Zero byte file, File name: " + file.name + ", File size: " + file.size + ", Message: " + message);
+                        break;
+                    case SWFUpload.QUEUE_ERROR.INVALID_FILETYPE:
+                        progress.setStatus("Invalid File Type.");
+                        Ext.Msg.alert(acs_lang_text.error || "Error","Error Code: Invalid File Type, File name: " + file.name + ", File size: " + file.size + ", Message: " + message);
+                        break;
+                    case SWFUpload.QUEUE_ERROR.QUEUE_LIMIT_EXCEEDED:
+                        Ext.Msg.alert(acs_lang_text.error || "Error","You have selected too many files.  " +  (message > 1 ? "You may only add " +  message + " more files" : "You cannot add any more files."));
+                        break;
+                    default:
+                        if (file !== null) {
+                            progress.setStatus("Unhandled Error");
+                        }
+                        Ext.Msg.alert(acs_lang_text.error || "Error","Error Code: " + errorCode + ", File name: " + file.name + ", File size: " + file.size + ", Message: " + message);
+                        break;
                     }
-                } catch (ex) {
-                    this.debugMessage(ex);
+                } catch (ex) { 
+                    Ext.Msg.alert(acs_lang_text.error || "Error",ex);
                 }
             }
 
+            var fileDialogComplete = function() {
+                // console.log('file dialog complete')
+            }
+
             var uploadStart = function (fileObj) {
+                console.log('upload start')
                 var upload_txt = acs_lang_text.for_upload_to || "for upload to";
                 var zip_txt = acs_lang_text.zip_extracted || "Zip File (Will be extracted after upload)";
                 try {
                     var folderid = ajaxfsobj.currentfolder;
                     var foldername = treepanel.getNodeById(folderid).text;
-                    var progress = new FileProgress(fileObj, this.getSetting("progress_target"));
-                    progress.SetStatus( upload_txt + " <b>"+foldername+"</b><br>Title: <input type='text' onblur=\"fsInstance.swfu.removeFileParam('"+fileObj.id+"','filetitle');fsInstance.swfu.addFileParam('"+fileObj.id+"','filetitle',this.value)\">(optional)<br><input type='checkbox' id='zip"+fileObj.id+"' onclick=\"if(document.getElementById('zip"+fileObj.id+"').checked) { fsInstance.swfu.addFileParam('"+fileObj.id+"','unpack_p','1') } else { fsInstance.swfu.removeFileParam('"+fileObj.id+"','unpack_p') }\"> "+ zip_txt);
+                    var progress = new FileProgress(fileObj, progress_target);
+                    progress.SetStatus( upload_txt + " "+foldername+"b><br>Title: <input type='text' onblur=\"fsInstance.swfu.removeFileParam('"+fileObj.id+"','filetitle');fsInstance.swfu.addFileParam('"+fileObj.id+"','filetitle',this.value)\">(optional)<br><input type='checkbox' id='zip"+fileObj.id+"' onclick=\"if(document.getElementById('zip"+fileObj.id+"').checked) { fsInstance.swfu.addFileParam('"+fileObj.id+"','unpack_p','1') } else { fsInstance.swfu.removeFileParam('"+fileObj.id+"','unpack_p') }\"> "+ zip_txt);
                     progress.ToggleCancel(true, this);
                     this.addFileParam(fileObj.id, "folder_id", folderid);
-                } catch (ex) { this.debugMessage(ex); }
+                } catch (ex) { 
+                    Ext.Msg.alert(acs_lang_text.error || "Error",ex);
+                }
             }
 
-            // FIXME (SECURITY): we are getting the user_id from the config,
-            //  since we're using flash there's the current session is not used when the upload is done
-            //  we can't trust the config because malicious javascript might try to insert a different user_id
+            var uploadProgress = function (fileObj, bytesLoaded, bytesTotal) {
+                console.log('upload progress')
+                try {
+                    var percent = Math.ceil((bytesLoaded / bytesTotal) * 100);
+                    var progress = new FileProgress(fileObj, progress_target);
+                    progress.SetProgress(percent);
+                    progress.SetStatus(acs_lang_text.uploading || "Uploading...");
+                } catch (ex) { 
+                    Ext.Msg.alert(acs_lang_text.error || "Error",ex);
+                }
+            }
+
+            var uploadQueueComplete = function() {
+                console.log('upload queue complete')
+                var currentTreeNode = treepanel.getNodeById(ajaxfsobj.currentfolder);
+                currentTreeNode.fireEvent("click",currentTreeNode);
+            }
+
+            var uploadError = function(file, errorCode, message) {
+                console.log('upload error')
+                try {
+                    var progress = new FileProgress(file, progress_target);
+                    progress.setError();
+                    progress.ToggleCancel(false);
+            
+                    switch (errorCode) {
+                    case SWFUpload.UPLOAD_ERROR.HTTP_ERROR:
+                        progress.setStatus("Upload Error: " + message);
+                        Ext.Msg.alert(acs_lang_text.error || "Error","Error Code: HTTP Error, File name: " + file.name + ", Message: " + message);
+                        break;
+                    case SWFUpload.UPLOAD_ERROR.MISSING_UPLOAD_URL:
+                        progress.setStatus("Configuration Error");
+                        Ext.Msg.alert(acs_lang_text.error || "Error","Error Code: No backend file, File name: " + file.name + ", Message: " + message);
+                        break;
+                    case SWFUpload.UPLOAD_ERROR.UPLOAD_FAILED:
+                        progress.setStatus("Upload Failed.");
+                        Ext.Msg.alert(acs_lang_text.error || "Error","Error Code: Upload Failed, File name: " + file.name + ", File size: " + file.size + ", Message: " + message);
+                        break;
+                    case SWFUpload.UPLOAD_ERROR.IO_ERROR:
+                        progress.setStatus("Server (IO) Error");
+                        Ext.Msg.alert(acs_lang_text.error || "Error","Error Code: IO Error, File name: " + file.name + ", Message: " + message);
+                        break;
+                    case SWFUpload.UPLOAD_ERROR.SECURITY_ERROR:
+                        progress.setStatus("Security Error");
+                        Ext.Msg.alert(acs_lang_text.error || "Error","Error Code: Security Error, File name: " + file.name + ", Message: " + message);
+                        break;
+                    case SWFUpload.UPLOAD_ERROR.UPLOAD_LIMIT_EXCEEDED:
+                        progress.setStatus("Upload limit exceeded.");
+                        Ext.Msg.alert(acs_lang_text.error || "Error","Error Code: Upload Limit Exceeded, File name: " + file.name + ", File size: " + file.size + ", Message: " + message);
+                        break;
+                    case SWFUpload.UPLOAD_ERROR.SPECIFIED_FILE_ID_NOT_FOUND:
+                        progress.setStatus("File not found.");
+                        Ext.Msg.alert(acs_lang_text.error || "Error","Error Code: The file was not found, File name: " + file.name + ", File size: " + file.size + ", Message: " + message);
+                        break;
+                    case SWFUpload.UPLOAD_ERROR.FILE_VALIDATION_FAILED:
+                        progress.setStatus("Failed Validation.  Upload skipped.");
+                        Ext.Msg.alert(acs_lang_text.error || "Error","Error Code: File Validation Failed, File name: " + file.name + ", File size: " + file.size + ", Message: " + message);
+                        break;
+                    case SWFUpload.UPLOAD_ERROR.FILE_CANCELLED:
+                        progress.setStatus("Cancelled");
+                        progress.setCancelled();
+                        break;
+                    case SWFUpload.UPLOAD_ERROR.UPLOAD_STOPPED:
+                        progress.setStatus("Stopped");
+                        break;
+                    default:
+                        progress.setStatus("Unhandled Error: " + error_code);
+                        Ext.Msg.alert(acs_lang_text.error || "Error","Error Code: " + errorCode + ", File name: " + file.name + ", File size: " + file.size + ", Message: " + message);
+                        break;
+                    }
+                } catch (ex) { 
+                    Ext.Msg.alert(acs_lang_text.error || "Error",ex);
+                }
+            }
+
+            var uploadSuccess = function(fileObj,serverData) {
+                console.log('upload success')
+                try {
+                    var progress = new FileProgress(fileObj, progress_target);
+                    progress.SetComplete();
+                    progress.SetStatus(acs_lang_text.complete || "Complete.");
+                    progress.ToggleCancel(false);
+                } catch (ex) { 
+                    Ext.Msg.alert(acs_lang_text.error || "Error",ex);
+                }
+            }
+
             this.swfu = new SWFUpload({
                 debug: false,
-                upload_target_url: this.xmlhttpurl + "add-file-flash",
-                upload_params: {user_id:user_id,package_id:package_id},
+                post_params: {user_id:user_id,package_id:package_id},
                 file_types : "*.*",
-                file_size_limit : max_file_size,
-                file_queue_limit : 0,
-                file_upload_limit : 10,
-                begin_upload_on_queue: false,
-                file_queued_handler : uploadStart,
-                file_progress_handler : uploadProgress,
-                file_cancelled_handler : uploadCancel,
-                file_complete_handler : uploadComplete,
+                button_placeholder_id:"btnSwfUpload",
+                button_text:'&nbsp;<b>BROWSE</b>',
+                button_width: 61,
+                button_height: 16,
+                file_dialog_start_handler : fileDialogStart,
+                file_queued_handler : fileQueued,
+                file_queue_error_handler : fileQueueError,
+                file_dialog_complete_handler : fileDialogComplete,
+                upload_start_handler : uploadStart,
+                upload_progress_handler : uploadProgress,
+                upload_error_handler : uploadError,
+                upload_success_handler : uploadSuccess,
                 queue_complete_handler : uploadQueueComplete,
-                error_handler : uploadError,
-                flash_url : "/resources/ajax-filestorage-ui/swfupload/swfupload.swf"
+                upload_url: this.xmlhttpurl + "add-file-flash",
+                flash_url : "/resources/ajax-filestorage-ui/swfupload2/swfupload.swf"
             });
 
         }
     },
 
     addFile : function() {
 
+        var mode = null;
+
         if(this.upldWindow == null) {
 
-            if (!this.config.multi_file_upload || checkFlashVersion() < 9 || checkFlashVersion() == 10 || Ext.isLinux) {
+            if (!this.config.multi_file_upload || checkFlashVersion() < 9 || Ext.isLinux) {
 
                 /*** Single File Upload *******/
+                mode = 'single';
 
                 var msg1=acs_lang_text.file_to_upload || "File to upload";
                 var msg2=acs_lang_text.file_title || "Title";
@@ -1355,28 +1536,29 @@
                     align:'left',
                     frame:true,
                     html: "<form id=\"newfileform\" method=\"post\" enctype=\"multipart/form-data\"><input type=\"hidden\" name=\"package_id\" value=\""+this.config.package_id+"\"><input type=\"hidden\" name=\"folder_id\" value=\""+this.currentfolder+"\"><p>"+msg1+"<br /><input type=\"file\" name=\"upload_file\" id=\"upload_file\"></p><br><p>"+msg2+"<br /><input type=\"text\" name=\"filetitle\" id=\"filetitle\"></p><br><p>"+msg3+" :<br /><textarea name=\"filedescription\" id=\"filedescription\"></textarea></p><p>"+msg4+" :<br /><br /><input type=\"checkbox\" name=\"unpack_p\" value=\"t\" id=\"unpack_p\" /> "+msg5+"</p></form>"
-                });
+                })
+
                 var uploadBtns = [{
                         text: acs_lang_text.upload || 'Upload',
-                        handler: this.uploadOneFile.createDelegate(this),
+                        scope:this,
+                        handler: this.uploadOneFile,
                         icon:"/resources/ajaxhelper/icons/arrow_up.png",
                         cls:"x-btn-text-icon"
                     },{
                         text: acs_lang_text.close || 'Close',
+                        scope:this,
                         handler: function(){
                             this.upldWindow.hide();
-                        }.createDelegate(this),
-                        icon:"/resources/ajaxhelper/icons/cross.png",
+                        }, icon:"/resources/ajaxhelper/icons/cross.png",
                         cls:"x-btn-text-icon"
                 }]
 
             } else {
 
                 /*** Multi File Upload *******/
+                mode='multiple';
 
-                this.createSwfObj();
-
-                var msg_txt = acs_lang_text.upload_intro || "Click <b>Browse</b> to select a file to upload to the selected folder on the tree.";
+                var msg_txt = acs_lang_text.upload_intro || "Click <b>Upload</b> to select a file to upload to the selected folder on the tree.";
                 var modal = false;
                 var title = "Upload Files";
 
@@ -1387,28 +1569,28 @@
                     html: "<div id=\"upldMsg\">"+msg_txt+"<hr></div><div class=\"flash\" id=\"fsuploadprogress\"></div>"
                 });
 
-                uploadBody.on("render",function() {
-                    this.swfu.addSetting("progress_target", "fsuploadprogress");
-                },this);
-
-                var uploadBtns = [{
-                        text:'Browse',
-                        handler:this.swfu.browse.createDelegate(this.swfu),
-                        icon:"/resources/ajaxhelper/icons/page_add.png",
-                        cls:"x-btn-text-icon"
-                    },{
-                        text: 'Upload',
-                        handler:this.swfu.startUpload.createDelegate(this.swfu,[null,this],false),
+                var uploadBtns = [
+                    '<span id=\"btnSwfUpload\"></span>',
+                    {
+                        text: acs_lang_text.upload || 'Upload',
+                        scope:this,
+                        handler: function() {
+                            this.swfu.startUpload()
+                        },
                         icon:"/resources/ajaxhelper/icons/arrow_up.png",
                         cls:"x-btn-text-icon"
-                    },{
+                    }, {
                         text: 'Hide',
+                        scope:this,
                         handler: function(){
                             this.upldWindow.hide();
-                        }.createDelegate(this),
+                        },
                         icon:"/resources/ajaxhelper/icons/cross.png",
                         cls:"x-btn-text-icon"
-                }]
+                    }
+                ]
+
+
             }
 
             this.upldWindow = new Ext.Window({
@@ -1425,14 +1607,20 @@
                 buttons: uploadBtns
             });
 
+            if(mode=='multiple') {
+                this.upldWindow.on('show',function() {
+                    this.createSwfObj()
+                },this,{single:true})
+            }
+
         } else {
-            if (!this.config.multi_file_upload || checkFlashVersion() < 9 || checkFlashVersion() == 10 || Ext.isLinux) {
+            if (!this.config.multi_file_upload || checkFlashVersion() < 9 || Ext.isLinux) {
                 document.getElementById('newfileform').reset();
                 document.getElementById('newfileform').folder_id.value = this.currentfolder;
             }
         }
 
-        this.upldWindow.show();
+        this.upldWindow.show('btnUploadFile');
     },
 
     uploadOneFile : function() {
@@ -1493,40 +1681,46 @@
                     buttonAlign:'left',
                     items: [
                         {xtype:'textfield',fieldLabel: 'Title',allowBlank:false,name:'fstitle',tabIndex:1},
-                        {xtype:'textfield',fieldLabel: 'URL',allowBlank:false,name:'fsurl',tabIndex:2,validator:isURL},
+                        {xtype:'textfield',fieldLabel: 'URL',allowBlank:false,name:'fsurl',tabIndex:2,validator:isURL,value:'http://'},
                         {xtype:'textfield',fieldLabel: 'Description',name:'fsdescription',tabIndex:3}
                     ]
                 }), buttons:  [{
                         text:'Submit',
+                        scope:this,
                         handler: function() {
-                            this.createurlWindow.findById('form_create_url').getForm().submit( {
-                                url:this.xmlhttpurl+"add-url",
-                                waitMsg:'One moment ....',
-                                params: {package_id:this.config.package_id,folder_id:this.currentfolder},
-                                reset: true,
-                                scope: this,
-                                success: function(form,action) {
+
+                            var createurlform = this.createurlWindow.findById('form_create_url').getForm();
+
+                            if(createurlform.isValid()) {
+
+                                var success = function(form,action) {
                                     if(action.result) {
                                         var treepanel = this.layout.findById('treepanel');
                                         treepanel.getSelectionModel().getSelectedNode().fireEvent("click",treepanel.getSelectionModel().getSelectedNode());
                                         this.createurlWindow.hide();
                                     } else {
                                         Ext.MessageBox.alert('Error','Sorry an error occured.<br>'+action.result.error);
                                     }
-                                }, failure: function(form,action) {
+                                }
+
+                                var failure = function(form,action) {
                                     if(action.result) {
                                         Ext.MessageBox.alert('Error',action.result.error);
                                     }
                                 }
-                            } )
-                        }.createDelegate(this),
+
+                                this.fsCore.formSubmit('createurl', createurlform, 'One moment ....', {package_id:this.config.package_id,folder_id:this.currentfolder}, true, success, failure, this)
+
+                            }
+                        },
                         icon:"/resources/ajaxhelper/icons/disk.png",
                         cls:"x-btn-text-icon"
                     },{
                         text: 'Close',
+                        scope:this,
                         handler: function(){
                             this.createurlWindow.hide();
-                        }.createDelegate(this),
+                        },
                         icon:"/resources/ajaxhelper/icons/cross.png",
                         cls:"x-btn-text-icon"
                 }]
@@ -1588,14 +1782,12 @@
     
                         } else {
     
-                            Ext.Ajax.request({
-                                url:this.xmlhttpurl+"edit-name",
-                                success: successRename,
-                                failure: function(response) {
-                                    var resultObj = Ext.decode(response.responseText);
-                                    Ext.Msg.alert(acs_lang_text.error || "Error",error_msg_txt + "<br><br><font color='red'>"+resultObj.error+"</font>");
-                                }, params: { newname:text,object_id:nodeid,type:nodetype,url:nodeurl}
-                            });
+                            var failure = function(response) {
+                                var resultObj = Ext.decode(response.responseText);
+                                Ext.Msg.alert(acs_lang_text.error || "Error",error_msg_txt + "<br><br><font color='red'>"+resultObj.error+"</font>");
+                            } 
+
+                            this.fsCore.doAction('rename',successRename, failure, null, { newname:text,object_id:nodeid,type:nodetype,url:nodeurl });
     
                         }
     
@@ -1615,7 +1807,8 @@
                 msg: acs_lang_text.enter_new_name || 'Please enter a new name for ... ',
                 value: node.get("title"),
                 buttons: Ext.Msg.OKCANCEL,
-                fn: handleRename.createDelegate(this)
+                scope:this,
+                fn: handleRename
             });
     
             var prompt_text_el = YAHOO.util.Dom.getElementsByClassName('ext-mb-input', 'input'); 
@@ -1638,50 +1831,53 @@
         var xmlhttpurl = this.xmlhttpurl;
         var tagWindow = this.tagWindow;
 
+        var success = function() {
+            node.data.tags = Ext.get('fstags').getValue();
+            node.commit();
+            tagcloudpanel.load({url:xmlhttpurl+'get-tagcloud',params:{package_id:package_id}});
+            tagWindow.hide();
+        }
+
+        var failure = function(response) {
+            Ext.Msg.alert(acs_lang_text.error || "Error","Sorry, we encountered an error.");
+        }
+
         var savetags = function() {
 
-            Ext.Ajax.request({
-                url:this.xmlhttpurl+"add-tag",
-                success: function() {
-                    node.data.tags = Ext.get('fstags').getValue();
-                    node.commit();
-                    tagcloudpanel.load({url:xmlhttpurl+'get-tagcloud',params:{package_id:package_id}});
-                    tagWindow.hide();
-                }, failure: function(response) {
-                    Ext.Msg.alert(acs_lang_text.error || "Error","Sorry, we encountered an error.");
-                }, params: { object_id:node.id,package_id:package_id,tags:Ext.get('fstags').getValue()}
-            });
+            this.fsCore.doAction('tag',success, failure, null,{ object_id:node.id,package_id:package_id,tags:Ext.get('fstags').getValue()});
 
-         };
+        }
 
         if(tagWindow == null) {
 
             var tagformBody = new Ext.Panel({
                 id:'form_addtag',
                 autoScroll:true,
                 frame:true,
-                html: "<div style='text-align:left' class='yui-skin-sam'><p>Enter or edit one or more tags. Use commas (,) to separate the tags:<br ><br><div class='yui-ac'><input type='text' name='fstags' id='fstags' size='60' autocomplete='off' value='"+taglist+"'><div id='oAutoCompContainer1' class='yui-ac-container'></div></div>"
+                html: "<div style='text-align:left;width:330px' class='yui-skin-sam'><p>Enter or edit one or more tags. Use commas (,) to separate the tags:<br ><br><div class='yui-ac'><input type='text' name='fstags' id='fstags' size='60' autocomplete='off' value='"+taglist+"'><div id='oAutoCompContainer1' class='yui-ac-container'></div></div>"
             });
     
             var tagBtns = [{
                     text: 'Ok',
                     icon:"/resources/ajaxhelper/icons/disk.png",
                     cls:"x-btn-text-icon",
-                    handler:savetags.createDelegate(this)
+                    scope:this,
+                    handler:savetags
                 },{
                     text: 'Cancel',
                     icon:"/resources/ajaxhelper/icons/cross.png",
                     cls:"x-btn-text-icon",
-                    handler: function(){
-                        tagWindow.hide();
-                    }.createDelegate(this)
+                    scope:this,
+                    handler: function() { 
+                        this.tagWindow.hide() 
+                    }
             }];
 
-            tagWindow = new Ext.Window({
+            this.tagWindow = new Ext.Window({
                 id:'tag-win',
                 layout:'fit',
                 width:450,
-                height:300,
+                height:200,
                 title:"Tags",
                 closeAction:'hide',
                 modal:true,
@@ -1694,12 +1890,14 @@
 
         }
 
-        tagWindow.show();
-        this.initTagAutoComplete();
+        this.tagWindow.show('undefined',function() {
+            Ext.get('fstags').dom.value=taglist;
+            this.initTagAutoComplete()
+        },this);
     },
 
     initTagAutoComplete : function() {
-        var oAutoComp1DS = new YAHOO.widget.DS_JSArray(oAutoCompArr);
+        var oAutoComp1DS = new YAHOO.util.LocalDataSource(oAutoCompArr);
         if(document.getElementById("fstags")) {
             var oAutoComp1 = new YAHOO.widget.AutoComplete('fstags','oAutoCompContainer1', oAutoComp1DS);
             oAutoComp1.animHoriz=false;
@@ -1710,6 +1908,8 @@
             oAutoComp1.delimChar=",";
             oAutoComp1.allowBrowserAutocomplete=false;
             oAutoComp1.typeAhead=true;
+            oAutoComp1.useShadow=true;
+            oAutoComp1.prehighlightClassName='yui-ac-prehighlight';
             oAutoComp1.formatResult=function(oResultItem, sQuery) { 
                 var sMarkup=oResultItem[0]; 
                 return sMarkup;
@@ -1744,16 +1944,15 @@
             shareWindow.hide();
         }
 
+        var failure = function(response) {
+            Ext.Msg.alert("Error","Sorry, we encountered an error. Please try again later.");
+        } 
+
         var sharefolder = function() {
+
             var target_folder_id = this.communityCombo.getValue();
 
-            Ext.Ajax.request({
-                url:this.xmlhttpurl+"share-folder",
-                success: sharesuccess,
-                failure: function(response) {
-                    Ext.Msg.alert("Error","Sorry, we encountered an error. Please try again later.");
-                }, params: {target_folder_id:target_folder_id,folder_id:object_id}
-            });
+            this.fsCore.doAction('sharefolder',sharesuccess, failure, null,{target_folder_id:target_folder_id,folder_id:object_id});
 
         }
 
@@ -1791,14 +1990,14 @@
                     text: 'Ok',
                     icon:"/resources/ajaxhelper/icons/disk.png",
                     cls:"x-btn-text-icon",
-                    handler:sharefolder.createDelegate(this)
+                    scope:this,
+                    handler:sharefolder
                 },{
                     text: 'Cancel',
                     icon:"/resources/ajaxhelper/icons/cross.png",
                     cls:"x-btn-text-icon",
-                    handler: function(){
-                        shareWindow.hide();
-                    }.createDelegate(this)
+                    scope:this,
+                    handler: function(){shareWindow.hide()}
             }];
 
             shareWindow = new Ext.Window({
@@ -1987,47 +2186,46 @@
 
         var toolbar = [
             {
-             text:"Download",
-             tooltip:"Download this revision",
-             icon:"/resources/ajaxhelper/icons/arrow_down.png",
-             cls:"x-btn-text-icon",
-             handler: function() {
-                var grid = this.revisionsWindow.findById("revisionspanel");
-                var record = grid.getSelectionModel().getSelected();
-                window.open(record.get("url"));
-                window.focus();
-             }.createDelegate(this)
+                text:"Download",
+                tooltip:"Download this revision",
+                icon:"/resources/ajaxhelper/icons/arrow_down.png",
+                cls:"x-btn-text-icon",
+                scope:this,
+                handler: function() {
+                    var grid = this.revisionsWindow.findById("revisionspanel");
+                    var record = grid.getSelectionModel().getSelected();
+                    window.open(record.get("url"));
+                    window.focus();
+                }
             }, {
-             text:"Delete",
-             tooltip:"Delete this revision",
-             icon:"/resources/ajaxhelper/icons/delete.png",
-             cls:"x-btn-text-icon",
-             handler: function() { 
-                var grid = this.revisionsWindow.findById("revisionspanel");
-                var sm = grid.getSelectionModel();
-                var record = sm.getSelected();
-                var version_id = record.get("revision_id");
-                var fstitle = record.get("title");
-                var xmlhttpurl = this.xmlhttpurl;
-                if(grid.store.getCount()==1) {
-                    Ext.Msg.alert("Warning","Sorry, you can not delete the only revision for this file. You can delete the file instead");
-                } else {
-                    Ext.Msg.confirm('Delete','Are you sure you want to delete this version of '+fstitle+' ? This action can not be reversed.',function(btn) {
-                        if(btn=="yes") {
-                            Ext.Ajax.request({
-                                url:xmlhttpurl+'delete-fileversion',
-                                params:{version_id:version_id},
-                                success:function(o) {
+                text:"Delete",
+                tooltip:"Delete this revision",
+                icon:"/resources/ajaxhelper/icons/delete.png",
+                cls:"x-btn-text-icon",
+                scope:this,
+                handler: function() { 
+                    var grid = this.revisionsWindow.findById("revisionspanel");
+                    var sm = grid.getSelectionModel();
+                    var record = sm.getSelected();
+                    var version_id = record.get("revision_id");
+                    var fstitle = record.get("title");
+                    if(grid.store.getCount()==1) {
+                        Ext.Msg.alert("Warning","Sorry, you can not delete the only revision for this file. You can delete the file instead");
+                    } else {
+                        Ext.Msg.confirm('Delete','Are you sure you want to delete this version of '+fstitle+' ? This action can not be reversed.',function(btn) {
+                            if(btn=="yes") {
+                                var success = function(o) {
                                     sm.selectPrevious();
                                     grid.store.remove(record);
-                                }, failure:function() {
+                                }
+                                var failure = function() {
                                     Ext.Msg.alert('Delete Error','Sorry an error occurred. Please try again later.')
                                 }
-                            })
-                        }
-                    })
+                                this.fsCore.doAction('delete-revision',success, failure, null,{version_id:version_id});
+                            }
+                        })
+                    }
                 }
-             }.createDelegate(this)
             }
         ];
 
@@ -2103,7 +2301,8 @@
 
         if(panel.id == "treepanel") {
 
-            var copytext = window.location.protocol+"//"+window.location.hostname+":"+window.location.port+this.config.package_url+"?package_id="+this.config.package_id+"&folder_id="+i;
+            if(window.location.port!="") { var port = ":"+window.location.port } else { var port = "" }
+            var copytext = window.location.protocol+"//"+window.location.hostname+port+this.config.package_url+"?package_id="+this.config.package_id+"&folder_id="+i;
 
         } else {
 
@@ -2135,238 +2334,4 @@
         }
     }
 
-}
-
-/********** UTILS *********************/
-
-/* readCookie
-read value of a cookie */
-function readCookie(name) {
-    var ca = document.cookie.split(';');
-    var nameEQ = name + "=";
-    for(var i=0; i < ca.length; i++) {
-        var c = ca[i];
-        while (c.charAt(0)==' ') { c = c.substring(1, c.length) }
-        if (c.indexOf(nameEQ) == 0) { return c.substring(nameEQ.length, c.length) }
-    }
-    return null;
-}
-
-/* createCookie
-used to maintain state, e.g. when login expires */
-function createCookie(name, value, days){
-    if (days) {
-        var date = new Date();
-        date.setTime(date.getTime()+(days*24*60*60*1000));
-        var expires = "; expires="+date.toGMTString();
-    } else { var expires = "" }
-    document.cookie = name+"="+value+expires+"; path=/";
-}
-
-/* read query string
-read the value of a querystring */
-function readQs(q) {
-    var query = window.location.search.substring(1);
-    var parms = query.split('&');
-    for (var i=0; i<parms.length; i++) {
-        var pos = parms[i].indexOf('=');
-        if (pos > 0) {
-            var key = parms[i].substring(0,pos);
-            var val = parms[i].substring(pos+1);
-            if (key == q) {
-                return val;
-            }
-        }
-    }
-    return null;
-}
-
-/* check Flash Version */
-function checkFlashVersion() {
-
-    var x;
-    var pluginversion;
-
-    if(navigator.plugins && navigator.mimeTypes.length){
-        x = navigator.plugins["Shockwave Flash"];
-        if(x && x.description) x = x.description;
-    } else if (Ext.isIE){
-        try {
-            x = new ActiveXObject("ShockwaveFlash.ShockwaveFlash");
-            x = x.GetVariable("$version");
-        } catch(e){}
-    }
-
-    pluginVersion = (typeof(x) == 'string') ? parseInt(x.match(/\d+/)[0]) : 0;
-
-    return pluginVersion;
-}
-
-// check if the string argument is a url
-function isURL(argvalue) {
-
-  if (argvalue.indexOf(" ") != -1)
-    return false;
-  else if (argvalue.indexOf("http://") == -1)
-    return false;
-  else if (argvalue == "http://")
-    return false;
-  else if (argvalue.indexOf("http://") > 0)
-    return false;
-
-  argvalue = argvalue.substring(7, argvalue.length);
-  if (argvalue.indexOf(".") == -1)
-    return false;
-  else if (argvalue.indexOf(".") == 0)
-    return false;
-  else if (argvalue.charAt(argvalue.length - 1) == ".")
-    return false;
-
-  if (argvalue.indexOf("/") != -1) {
-    argvalue = argvalue.substring(0, argvalue.indexOf("/"));
-    if (argvalue.charAt(argvalue.length - 1) == ".")
-      return false;
-  }
-
-  if (argvalue.indexOf(":") != -1) {
-    if (argvalue.indexOf(":") == (argvalue.length - 1))
-      return false;
-    else if (argvalue.charAt(argvalue.indexOf(":") + 1) == ".")
-      return false;
-    argvalue = argvalue.substring(0, argvalue.indexOf(":"));
-    if (argvalue.charAt(argvalue.length - 1) == ".")
-      return false;
-  }
-
-  return true;
-
-}
-
-
-/********** FLASH UPLOAD *********/
-
-
-function FileProgress(fileObj, target_id) {
-    this.file_progress_id = fileObj.id;
-
-    this.opacity = 100;
-    this.height = 0;
-
-    this.fileProgressWrapper = document.getElementById(this.file_progress_id);
-    if (!this.fileProgressWrapper) {
-        this.fileProgressWrapper = document.createElement("div");
-        this.fileProgressWrapper.className = "progressWrapper";
-        this.fileProgressWrapper.id = this.file_progress_id;
-
-        this.fileProgressElement = document.createElement("div");
-        this.fileProgressElement.className = "progressContainer";
-
-        var progressCancel = document.createElement("a");
-        progressCancel.className = "progressCancel";
-        progressCancel.href = "#";
-        progressCancel.style.visibility = "hidden";
-        progressCancel.appendChild(document.createTextNode(" "));
-
-        var progressText = document.createElement("div");
-        progressText.className = "progressName";
-        progressText.appendChild(document.createTextNode(fileObj.name));
-
-        var progressBar = document.createElement("div");
-        progressBar.className = "progressBarInProgress";
-
-        var progressStatus = document.createElement("div");
-        progressStatus.className = "progressBarStatus";
-        progressStatus.innerHTML = "&nbsp;";
-
-        this.fileProgressElement.appendChild(progressCancel);
-        this.fileProgressElement.appendChild(progressText);
-        this.fileProgressElement.appendChild(progressStatus);
-        this.fileProgressElement.appendChild(progressBar);
-
-        this.fileProgressWrapper.appendChild(this.fileProgressElement);
-
-        document.getElementById(target_id).appendChild(this.fileProgressWrapper);
-    } else {
-        this.fileProgressElement = this.fileProgressWrapper.firstChild;
-    }
-
-    this.height = this.fileProgressWrapper.offsetHeight;
-
-}
-FileProgress.prototype.SetProgress = function(percentage) {
-    this.fileProgressElement.className = "progressContainer green";
-    this.fileProgressElement.childNodes[3].className = "progressBarInProgress";
-    this.fileProgressElement.childNodes[3].style.width = percentage + "%";
-}
-FileProgress.prototype.SetComplete = function() {
-    this.fileProgressElement.className = "progressContainer blue";
-    this.fileProgressElement.childNodes[3].className = "progressBarComplete";
-    this.fileProgressElement.childNodes[3].style.width = "";
-
-    var oSelf = this;
-    setTimeout(function() { oSelf.Disappear(); }, 10000);
-}
-FileProgress.prototype.SetError = function() {
-    this.fileProgressElement.className = "progressContainer red";
-    this.fileProgressElement.childNodes[3].className = "progressBarError";
-    this.fileProgressElement.childNodes[3].style.width = "";
-
-    var oSelf = this;
-    setTimeout(function() { oSelf.Disappear(); }, 5000);
-}
-FileProgress.prototype.SetCancelled = function() {
-    this.fileProgressElement.className = "progressContainer";
-    this.fileProgressElement.childNodes[3].className = "progressBarError";
-    this.fileProgressElement.childNodes[3].style.width = "";
-
-    var oSelf = this;
-    setTimeout(function() { oSelf.Disappear(); }, 2000);
-}
-FileProgress.prototype.SetStatus = function(status) {
-    this.fileProgressElement.childNodes[2].innerHTML = status;
-}
-
-FileProgress.prototype.ToggleCancel = function(show, upload_obj) {
-    this.fileProgressElement.childNodes[0].style.visibility = show ? "visible" : "hidden";
-    if (upload_obj) {
-        var file_id = this.file_progress_id;
-        this.fileProgressElement.childNodes[0].onclick = function() { upload_obj.cancelUpload(file_id); return false; };
-    }
-}
-
-FileProgress.prototype.Disappear = function() {
-
-    var reduce_opacity_by = 15;
-    var reduce_height_by = 4;
-    var rate = 30;  // 15 fps
-
-    if (this.opacity > 0) {
-        this.opacity -= reduce_opacity_by;
-        if (this.opacity < 0) this.opacity = 0;
-
-        if (this.fileProgressWrapper.filters) {
-            try {
-                this.fileProgressWrapper.filters.item("DXImageTransform.Microsoft.Alpha").opacity = this.opacity;
-            } catch (e) {
-                // If it is not set initially, the browser will throw an error.  This will set it if it is not set yet.
-                this.fileProgressWrapper.style.filter = 'progid:DXImageTransform.Microsoft.Alpha(opacity=' + this.opacity + ')';
-            }
-        } else {
-            this.fileProgressWrapper.style.opacity = this.opacity / 100;
-        }
-    }
-
-    if (this.height > 0) {
-        this.height -= reduce_height_by;
-        if (this.height < 0) this.height = 0;
-
-        this.fileProgressWrapper.style.height = this.height + "px";
-    }
-
-    if (this.height > 0 || this.opacity > 0) {
-        var oSelf = this;
-        setTimeout(function() { oSelf.Disappear(); }, rate);
-    } else {
-        this.fileProgressWrapper.style.display = "none";
-    }
-}
+}
\ No newline at end of file
Index: openacs-4/packages/ajax-filestorage-ui/www/resources/utils.js
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/ajax-filestorage-ui/www/resources/utils.js,v
diff -u
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/ajax-filestorage-ui/www/resources/utils.js	27 Dec 2008 06:27:25 -0000	1.1
@@ -0,0 +1,104 @@
+/********** UTILS *********************/
+
+/* readCookie
+read value of a cookie */
+function readCookie(name) {
+    var ca = document.cookie.split(';');
+    var nameEQ = name + "=";
+    for(var i=0; i < ca.length; i++) {
+        var c = ca[i];
+        while (c.charAt(0)==' ') { c = c.substring(1, c.length) }
+        if (c.indexOf(nameEQ) == 0) { return c.substring(nameEQ.length, c.length) }
+    }
+    return null;
+}
+
+/* createCookie
+used to maintain state, e.g. when login expires */
+function createCookie(name, value, days){
+    if (days) {
+        var date = new Date();
+        date.setTime(date.getTime()+(days*24*60*60*1000));
+        var expires = "; expires="+date.toGMTString();
+    } else { var expires = "" }
+    document.cookie = name+"="+value+expires+"; path=/";
+}
+
+/* read query string
+read the value of a querystring */
+function readQs(q) {
+    var query = window.location.search.substring(1);
+    var parms = query.split('&');
+    for (var i=0; i<parms.length; i++) {
+        var pos = parms[i].indexOf('=');
+        if (pos > 0) {
+            var key = parms[i].substring(0,pos);
+            var val = parms[i].substring(pos+1);
+            if (key == q) {
+                return val;
+            }
+        }
+    }
+    return null;
+}
+
+/* check Flash Version */
+function checkFlashVersion() {
+
+    var x;
+    var pluginversion;
+
+    if(navigator.plugins && navigator.mimeTypes.length){
+        x = navigator.plugins["Shockwave Flash"];
+        if(x && x.description) x = x.description;
+    } else if (Ext.isIE){
+        try {
+            x = new ActiveXObject("ShockwaveFlash.ShockwaveFlash");
+            x = x.GetVariable("$version");
+        } catch(e){}
+    }
+
+    pluginVersion = (typeof(x) == 'string') ? parseInt(x.match(/\d+/)[0]) : 0;
+
+    return pluginVersion;
+}
+
+// check if the string argument is a url
+function isURL(argvalue) {
+
+  if (argvalue.indexOf(" ") != -1)
+    return false;
+  else if (argvalue.indexOf("http://") == -1)
+    return false;
+  else if (argvalue == "http://")
+    return false;
+  else if (argvalue.indexOf("http://") > 0)
+    return false;
+
+  argvalue = argvalue.substring(7, argvalue.length);
+  if (argvalue.indexOf(".") == -1)
+    return false;
+  else if (argvalue.indexOf(".") == 0)
+    return false;
+  else if (argvalue.charAt(argvalue.length - 1) == ".")
+    return false;
+
+  if (argvalue.indexOf("/") != -1) {
+    argvalue = argvalue.substring(0, argvalue.indexOf("/"));
+    if (argvalue.charAt(argvalue.length - 1) == ".")
+      return false;
+  }
+
+  if (argvalue.indexOf(":") != -1) {
+    if (argvalue.indexOf(":") == (argvalue.length - 1))
+      return false;
+    else if (argvalue.charAt(argvalue.indexOf(":") + 1) == ".")
+      return false;
+    argvalue = argvalue.substring(0, argvalue.indexOf(":"));
+    if (argvalue.charAt(argvalue.length - 1) == ".")
+      return false;
+  }
+
+  return true;
+
+}
\ No newline at end of file
Index: openacs-4/packages/ajax-filestorage-ui/www/resources/swfupload/fileprogress.js
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/ajax-filestorage-ui/www/resources/swfupload/fileprogress.js,v
diff -u
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/ajax-filestorage-ui/www/resources/swfupload/fileprogress.js	27 Dec 2008 06:27:25 -0000	1.1
@@ -0,0 +1,130 @@
+function FileProgress(fileObj, target_id) {
+    this.file_progress_id = fileObj.id;
+
+    this.opacity = 100;
+    this.height = 0;
+
+    this.fileProgressWrapper = document.getElementById(this.file_progress_id);
+    if (!this.fileProgressWrapper) {
+        this.fileProgressWrapper = document.createElement("div");
+        this.fileProgressWrapper.className = "progressWrapper";
+        this.fileProgressWrapper.id = this.file_progress_id;
+
+        this.fileProgressElement = document.createElement("div");
+        this.fileProgressElement.className = "progressContainer";
+
+        var progressCancel = document.createElement("a");
+        progressCancel.className = "progressCancel";
+        progressCancel.href = "#";
+        progressCancel.style.visibility = "hidden";
+        progressCancel.appendChild(document.createTextNode(" "));
+
+        var progressText = document.createElement("div");
+        progressText.className = "progressName";
+        progressText.appendChild(document.createTextNode(fileObj.name));
+
+        var progressBar = document.createElement("div");
+        progressBar.className = "progressBarInProgress";
+
+        var progressStatus = document.createElement("div");
+        progressStatus.className = "progressBarStatus";
+        progressStatus.innerHTML = "&nbsp;";
+
+        this.fileProgressElement.appendChild(progressCancel);
+        this.fileProgressElement.appendChild(progressText);
+        this.fileProgressElement.appendChild(progressStatus);
+        this.fileProgressElement.appendChild(progressBar);
+
+        this.fileProgressWrapper.appendChild(this.fileProgressElement);
+
+        document.getElementById(target_id).appendChild(this.fileProgressWrapper);
+    } else {
+        this.fileProgressElement = this.fileProgressWrapper.firstChild;
+    }
+
+    this.height = this.fileProgressWrapper.offsetHeight;
+
+}
+FileProgress.prototype.SetProgress = function(percentage) {
+    this.fileProgressElement.className = "progressContainer green";
+    this.fileProgressElement.childNodes[3].className = "progressBarInProgress";
+    this.fileProgressElement.childNodes[3].style.width = percentage + "%";
+}
+FileProgress.prototype.SetComplete = function() {
+    this.fileProgressElement.className = "progressContainer blue";
+    this.fileProgressElement.childNodes[3].className = "progressBarComplete";
+    this.fileProgressElement.childNodes[3].style.width = "";
+
+    var oSelf = this;
+    setTimeout(function() { oSelf.Disappear(); }, 10000);
+}
+FileProgress.prototype.SetError = function() {
+    this.fileProgressElement.className = "progressContainer red";
+    this.fileProgressElement.childNodes[3].className = "progressBarError";
+    this.fileProgressElement.childNodes[3].style.width = "";
+    var oSelf = this;
+    setTimeout(function() { oSelf.Disappear(); }, 5000);
+}
+FileProgress.prototype.SetCancelled = function() {
+    this.fileProgressElement.className = "progressContainer";
+    this.fileProgressElement.childNodes[3].className = "progressBarError";
+    this.fileProgressElement.childNodes[3].style.width = "";
+
+    var oSelf = this;
+    setTimeout(function() { oSelf.Disappear(); }, 2000);
+}
+FileProgress.prototype.SetStatus = function(status) {
+    this.fileProgressElement.childNodes[2].innerHTML = status;
+}
+FileProgress.prototype.ToggleCancel = function(show, upload_obj) {
+    this.fileProgressElement.childNodes[0].style.visibility = show ? "visible" : "hidden";
+    if (upload_obj) {
+        var file_id = this.file_progress_id;
+        var oSelf = this;
+        this.fileProgressElement.childNodes[0].onclick = function() {
+            upload_obj.cancelUpload(file_id,false);
+            oSelf.SetCancelled();
+            oSelf.SetStatus(acs_lang_text.uploadcancel || "Cancelled (This item will be removed shortly)");
+            oSelf.ToggleCancel(false);
+            return false; 
+        };
+    }
+}
+FileProgress.prototype.Disappear = function() {
+
+    var reduce_opacity_by = 15;
+    var reduce_height_by = 4;
+    var rate = 30;  // 15 fps
+
+    if (this.opacity > 0) {
+        this.opacity -= reduce_opacity_by;
+        if (this.opacity < 0) this.opacity = 0;
+
+        if (this.fileProgressWrapper.filters) {
+            try {
+                this.fileProgressWrapper.filters.item("DXImageTransform.Microsoft.Alpha").opacity = this.opacity;
+            } catch (e) {
+                // If it is not set initially, the browser will throw an error.  This will set it if it is not set yet.
+                this.fileProgressWrapper.style.filter = 'progid:DXImageTransform.Microsoft.Alpha(opacity=' + this.opacity + ')';
+            }
+        } else {
+            this.fileProgressWrapper.style.opacity = this.opacity / 100;
+        }
+    }
+
+    if (this.height > 0) {
+        this.height -= reduce_height_by;
+        if (this.height < 0) this.height = 0;
+
+        this.fileProgressWrapper.style.height = this.height + "px";
+    }
+
+    if (this.height > 0 || this.opacity > 0) {
+        var oSelf = this;
+        setTimeout(function() { oSelf.Disappear(); }, rate);
+    } else {
+        this.fileProgressWrapper.style.display = "none";
+    }
+}
+
+
Index: openacs-4/packages/ajax-filestorage-ui/www/resources/swfupload/handlers.js
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/ajax-filestorage-ui/www/resources/swfupload/handlers.js,v
diff -u
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/ajax-filestorage-ui/www/resources/swfupload/handlers.js	27 Dec 2008 06:27:25 -0000	1.1
@@ -0,0 +1,202 @@
+
+/* This is an example of how to cancel all the files queued up.  It's made somewhat generic.  Just pass your SWFUpload
+object in to this method and it loops through cancelling the uploads. */
+function cancelQueue(instance) {
+	document.getElementById(instance.customSettings.cancelButtonId).disabled = true;
+	instance.stopUpload();
+	var stats;
+	
+	do {
+		stats = instance.getStats();
+		instance.cancelUpload();
+	} while (stats.files_queued !== 0);
+	
+}
+
+/* **********************
+   Event Handlers
+   These are my custom event handlers to make my
+   web application behave the way I went when SWFUpload
+   completes different tasks.  These aren't part of the SWFUpload
+   package.  They are part of my application.  Without these none
+   of the actions SWFUpload makes will show up in my application.
+   ********************** */
+function fileDialogStart() {
+	/* I don't need to do anything here */
+}
+function fileQueued(file) {
+	try {
+		// You might include code here that prevents the form from being submitted while the upload is in
+		// progress.  Then you'll want to put code in the Queue Complete handler to "unblock" the form
+		var progress = new FileProgress(file, this.customSettings.progressTarget);
+		progress.setStatus("Pending...");
+		progress.toggleCancel(true, this);
+
+	} catch (ex) {
+		this.debug(ex);
+	}
+
+}
+
+function fileQueueError(file, errorCode, message) {
+	try {
+		if (errorCode === SWFUpload.QUEUE_ERROR.QUEUE_LIMIT_EXCEEDED) {
+			alert("You have attempted to queue too many files.\n" + (message === 0 ? "You have reached the upload limit." : "You may select " + (message > 1 ? "up to " + message + " files." : "one file.")));
+			return;
+		}
+
+		var progress = new FileProgress(file, this.customSettings.progressTarget);
+		progress.setError();
+		progress.toggleCancel(false);
+
+		switch (errorCode) {
+		case SWFUpload.QUEUE_ERROR.FILE_EXCEEDS_SIZE_LIMIT:
+			progress.setStatus("File is too big.");
+			this.debug("Error Code: File too big, File name: " + file.name + ", File size: " + file.size + ", Message: " + message);
+			break;
+		case SWFUpload.QUEUE_ERROR.ZERO_BYTE_FILE:
+			progress.setStatus("Cannot upload Zero Byte files.");
+			this.debug("Error Code: Zero byte file, File name: " + file.name + ", File size: " + file.size + ", Message: " + message);
+			break;
+		case SWFUpload.QUEUE_ERROR.INVALID_FILETYPE:
+			progress.setStatus("Invalid File Type.");
+			this.debug("Error Code: Invalid File Type, File name: " + file.name + ", File size: " + file.size + ", Message: " + message);
+			break;
+		case SWFUpload.QUEUE_ERROR.QUEUE_LIMIT_EXCEEDED:
+			alert("You have selected too many files.  " +  (message > 1 ? "You may only add " +  message + " more files" : "You cannot add any more files."));
+			break;
+		default:
+			if (file !== null) {
+				progress.setStatus("Unhandled Error");
+			}
+			this.debug("Error Code: " + errorCode + ", File name: " + file.name + ", File size: " + file.size + ", Message: " + message);
+			break;
+		}
+	} catch (ex) {
+        this.debug(ex);
+    }
+}
+
+function fileDialogComplete(numFilesSelected, numFilesQueued) {
+	try {
+		if (this.getStats().files_queued > 0) {
+			document.getElementById(this.customSettings.cancelButtonId).disabled = false;
+		}
+		
+		/* I want auto start and I can do that here */
+		this.startUpload();
+	} catch (ex)  {
+        this.debug(ex);
+	}
+}
+
+function uploadStart(file) {
+	try {
+		/* I don't want to do any file validation or anything,  I'll just update the UI and return true to indicate that the upload should start */
+		var progress = new FileProgress(file, this.customSettings.progressTarget);
+		progress.setStatus("Uploading...");
+		progress.toggleCancel(true, this);
+	}
+	catch (ex) {
+	}
+	
+	return true;
+}
+
+function uploadProgress(file, bytesLoaded, bytesTotal) {
+
+	try {
+		var percent = Math.ceil((bytesLoaded / bytesTotal) * 100);
+
+		var progress = new FileProgress(file, this.customSettings.progressTarget);
+		progress.setProgress(percent);
+		progress.setStatus("Uploading...");
+	} catch (ex) {
+		this.debug(ex);
+	}
+}
+
+function uploadSuccess(file, serverData) {
+	try {
+		var progress = new FileProgress(file, this.customSettings.progressTarget);
+		progress.setComplete();
+		progress.setStatus("Complete.");
+		progress.toggleCancel(false);
+
+	} catch (ex) {
+		this.debug(ex);
+	}
+}
+
+function uploadComplete(file) {
+	try {
+		/*  I want the next upload to continue automatically so I'll call startUpload here */
+		if (this.getStats().files_queued === 0) {
+			document.getElementById(this.customSettings.cancelButtonId).disabled = true;
+		} else {	
+			this.startUpload();
+		}
+	} catch (ex) {
+		this.debug(ex);
+	}
+
+}
+
+function uploadError(file, errorCode, message) {
+	try {
+		var progress = new FileProgress(file, this.customSettings.progressTarget);
+		progress.setError();
+		progress.toggleCancel(false);
+
+		switch (errorCode) {
+		case SWFUpload.UPLOAD_ERROR.HTTP_ERROR:
+			progress.setStatus("Upload Error: " + message);
+			this.debug("Error Code: HTTP Error, File name: " + file.name + ", Message: " + message);
+			break;
+		case SWFUpload.UPLOAD_ERROR.MISSING_UPLOAD_URL:
+			progress.setStatus("Configuration Error");
+			this.debug("Error Code: No backend file, File name: " + file.name + ", Message: " + message);
+			break;
+		case SWFUpload.UPLOAD_ERROR.UPLOAD_FAILED:
+			progress.setStatus("Upload Failed.");
+			this.debug("Error Code: Upload Failed, File name: " + file.name + ", File size: " + file.size + ", Message: " + message);
+			break;
+		case SWFUpload.UPLOAD_ERROR.IO_ERROR:
+			progress.setStatus("Server (IO) Error");
+			this.debug("Error Code: IO Error, File name: " + file.name + ", Message: " + message);
+			break;
+		case SWFUpload.UPLOAD_ERROR.SECURITY_ERROR:
+			progress.setStatus("Security Error");
+			this.debug("Error Code: Security Error, File name: " + file.name + ", Message: " + message);
+			break;
+		case SWFUpload.UPLOAD_ERROR.UPLOAD_LIMIT_EXCEEDED:
+			progress.setStatus("Upload limit exceeded.");
+			this.debug("Error Code: Upload Limit Exceeded, File name: " + file.name + ", File size: " + file.size + ", Message: " + message);
+			break;
+		case SWFUpload.UPLOAD_ERROR.SPECIFIED_FILE_ID_NOT_FOUND:
+			progress.setStatus("File not found.");
+			this.debug("Error Code: The file was not found, File name: " + file.name + ", File size: " + file.size + ", Message: " + message);
+			break;
+		case SWFUpload.UPLOAD_ERROR.FILE_VALIDATION_FAILED:
+			progress.setStatus("Failed Validation.  Upload skipped.");
+			this.debug("Error Code: File Validation Failed, File name: " + file.name + ", File size: " + file.size + ", Message: " + message);
+			break;
+		case SWFUpload.UPLOAD_ERROR.FILE_CANCELLED:
+			if (this.getStats().files_queued === 0) {
+				document.getElementById(this.customSettings.cancelButtonId).disabled = true;
+			}
+			progress.setStatus("Cancelled");
+			progress.setCancelled();
+			break;
+		case SWFUpload.UPLOAD_ERROR.UPLOAD_STOPPED:
+			progress.setStatus("Stopped");
+			break;
+		default:
+			progress.setStatus("Unhandled Error: " + error_code);
+			this.debug("Error Code: " + errorCode + ", File name: " + file.name + ", File size: " + file.size + ", Message: " + message);
+			break;
+		}
+	} catch (ex) {
+        this.debug(ex);
+    }
+}
\ No newline at end of file
Index: openacs-4/packages/ajax-filestorage-ui/www/resources/swfupload/license.txt
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/ajax-filestorage-ui/www/resources/swfupload/license.txt,v
diff -u -r1.1 -r1.2
--- openacs-4/packages/ajax-filestorage-ui/www/resources/swfupload/license.txt	8 Sep 2007 14:32:56 -0000	1.1
+++ openacs-4/packages/ajax-filestorage-ui/www/resources/swfupload/license.txt	27 Dec 2008 06:27:25 -0000	1.2
@@ -1,7 +1,12 @@
 /**
- * mmSWFUpload 1.0: Flash upload dialog - http://profandesign.se/swfupload/
+ * SWFUpload: http://www.swfupload.org, http://swfupload.googlecode.com
  *
+ * mmSWFUpload 1.0: Flash upload dialog - http://profandesign.se/swfupload/,  http://www.vinterwebb.se/
+ *
  * SWFUpload is (c) 2006-2007 Lars Huring, Olov Nilz�n and Mammon Media and is released under the MIT License:
  * http://www.opensource.org/licenses/mit-license.php
  *
+ * SWFUpload 2 is (c) 2007-2008 Jake Roberts and is released under the MIT License:
+ * http://www.opensource.org/licenses/mit-license.php
+ *
  */
\ No newline at end of file
Index: openacs-4/packages/ajax-filestorage-ui/www/resources/swfupload/swfupload.js
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/ajax-filestorage-ui/www/resources/swfupload/swfupload.js,v
diff -u -r1.1 -r1.2
--- openacs-4/packages/ajax-filestorage-ui/www/resources/swfupload/swfupload.js	8 Sep 2007 14:32:56 -0000	1.1
+++ openacs-4/packages/ajax-filestorage-ui/www/resources/swfupload/swfupload.js	27 Dec 2008 06:27:25 -0000	1.2
@@ -1,660 +1,945 @@
 /**
- * SWFUpload 0.8.3 Revision 5.2 by Jacob Roberts, April 2007, linebyline.blogspot.com
- * -------- -------- -------- -------- -------- -------- -------- --------
- * SWFUpload is (c) 2006 Lars Huring and Mammon Media and is released under the MIT License:
+ * SWFUpload: http://www.swfupload.org, http://swfupload.googlecode.com
+ *
+ * mmSWFUpload 1.0: Flash upload dialog - http://profandesign.se/swfupload/,  http://www.vinterwebb.se/
+ *
+ * SWFUpload is (c) 2006-2007 Lars Huring, Olov Nilz�n and Mammon Media and is released under the MIT License:
  * http://www.opensource.org/licenses/mit-license.php
  *
- * See Changelog.txt for version history
+ * SWFUpload 2 is (c) 2007-2008 Jake Roberts and is released under the MIT License:
+ * http://www.opensource.org/licenses/mit-license.php
+ *
  */
 
-/* *********** */
-/* Constructor */
-/* *********** */
 
-var SWFUpload = function (init_settings) {
-    // Remove background flicker in IE (read this: http://misterpixel.blogspot.com/2006/09/forensic-analysis-of-ie6.html)
-    // This doesn't have anything to do with SWFUpload but can help your UI behave better
-    try {
-        document.execCommand('BackgroundImageCache', false, true);
-    } catch (ex) {
-        this.debugMessage(ex);
-    }
+/* ******************* */
+/* Constructor & Init  */
+/* ******************* */
+var SWFUpload;
 
+if (SWFUpload == undefined) {
+	SWFUpload = function (settings) {
+		this.initSWFUpload(settings);
+	};
+}
 
-    try {
-        this.settings = {};
-        this.movieName = "SWFUpload_" + SWFUpload.movieCount++;
-        this.movieElement = null;
+SWFUpload.prototype.initSWFUpload = function (settings) {
+	try {
+		this.customSettings = {};	// A container where developers can place their own settings associated with this instance.
+		this.settings = settings;
+		this.eventQueue = [];
+		this.movieName = "SWFUpload_" + SWFUpload.movieCount++;
+		this.movieElement = null;
 
-        // Setup global control tracking
-        SWFUpload.instances[this.movieName] = this;
 
-        // Load the settings.  Load the Flash movie.
-        this.initSettings(init_settings);
-        this.loadFlash();
+		// Setup global control tracking
+		SWFUpload.instances[this.movieName] = this;
 
-        if (this.debug_enabled)  {
-            this.displayDebugInfo();
-        }
-
-    } catch (ex) {
-        this.debugMessage(ex);
-    }
+		// Load the settings.  Load the Flash movie.
+		this.initSettings();
+		this.loadFlash();
+		this.displayDebugInfo();
+	} catch (ex) {
+		delete SWFUpload.instances[this.movieName];
+		throw ex;
+	}
 };
 
 /* *************** */
-/* Static thingies */
+/* Static Members  */
 /* *************** */
 SWFUpload.instances = {};
 SWFUpload.movieCount = 0;
-SWFUpload.ERROR_CODE_HTTP_ERROR               = -10;
-SWFUpload.ERROR_CODE_MISSING_UPLOAD_TARGET    = -20;
-SWFUpload.ERROR_CODE_IO_ERROR                 = -30;
-SWFUpload.ERROR_CODE_SECURITY_ERROR           = -40;
-SWFUpload.ERROR_CODE_FILE_EXCEEDS_SIZE_LIMIT  = -50;
-SWFUpload.ERROR_CODE_ZERO_BYTE_FILE           = -60;
-SWFUpload.ERROR_CODE_UPLOAD_LIMIT_EXCEEDED    = -70;
-SWFUpload.ERROR_CODE_UPLOAD_FAILED            = -80;
-SWFUpload.ERROR_CODE_QUEUE_LIMIT_EXCEEDED     = -90;
-SWFUpload.ERROR_CODE_SPECIFIED_FILE_NOT_FOUND = -100;
+SWFUpload.version = "2.2.0 Beta 3";
+SWFUpload.QUEUE_ERROR = {
+	QUEUE_LIMIT_EXCEEDED	  		: -100,
+	FILE_EXCEEDS_SIZE_LIMIT  		: -110,
+	ZERO_BYTE_FILE			  		: -120,
+	INVALID_FILETYPE		  		: -130
+};
+SWFUpload.UPLOAD_ERROR = {
+	HTTP_ERROR				  		: -200,
+	MISSING_UPLOAD_URL	      		: -210,
+	IO_ERROR				  		: -220,
+	SECURITY_ERROR			  		: -230,
+	UPLOAD_LIMIT_EXCEEDED	  		: -240,
+	UPLOAD_FAILED			  		: -250,
+	SPECIFIED_FILE_ID_NOT_FOUND		: -260,
+	FILE_VALIDATION_FAILED	  		: -270,
+	FILE_CANCELLED			  		: -280,
+	UPLOAD_STOPPED					: -290
+};
+SWFUpload.FILE_STATUS = {
+	QUEUED		 : -1,
+	IN_PROGRESS	 : -2,
+	ERROR		 : -3,
+	COMPLETE	 : -4,
+	CANCELLED	 : -5
+};
+SWFUpload.BUTTON_ACTION = {
+	SELECT_FILE  : -100,
+	SELECT_FILES : -110,
+	START_UPLOAD : -120
+};
+SWFUpload.CURSOR = {
+	ARROW : -1,
+	HAND : -2
+};
+SWFUpload.WINDOW_MODE = {
+	WINDOW : "window",
+	TRANSPARENT : "transparent",
+	OPAQUE : "opaque"
+};
 
-/* ***************** */
-/* Instance Thingies */
-/* ***************** */
-// init is a private method that ensures that all the object settings are set, getting a default value if one was not assigned.
+/* ******************** */
+/* Instance Members  */
+/* ******************** */
 
-SWFUpload.prototype.initSettings = function (init_settings) {
+// Private: initSettings ensures that all the
+// settings are set, getting a default value if one was not assigned.
+SWFUpload.prototype.initSettings = function () {
+	this.ensureDefault = function (settingName, defaultValue) {
+		this.settings[settingName] = (this.settings[settingName] == undefined) ? defaultValue : this.settings[settingName];
+	};
+	
+	// Upload backend settings
+	this.ensureDefault("upload_url", "");
+	this.ensureDefault("file_post_name", "Filedata");
+	this.ensureDefault("post_params", {});
+	this.ensureDefault("use_query_string", false);
+	this.ensureDefault("requeue_on_error", false);
+	this.ensureDefault("http_success", []);
+	
+	// File Settings
+	this.ensureDefault("file_types", "*.*");
+	this.ensureDefault("file_types_description", "All Files");
+	this.ensureDefault("file_size_limit", 0);	// Default zero means "unlimited"
+	this.ensureDefault("file_upload_limit", 0);
+	this.ensureDefault("file_queue_limit", 0);
 
-    this.addSetting("control_id", this.movieName, "");
+	// Flash Settings
+	this.ensureDefault("flash_url", "swfupload.swf");
+	this.ensureDefault("prevent_swf_caching", true);
+	
+	// Button Settings
+	this.ensureDefault("button_image_url", "");
+	this.ensureDefault("button_width", 1);
+	this.ensureDefault("button_height", 1);
+	this.ensureDefault("button_text", "");
+	this.ensureDefault("button_text_style", "color: #000000; font-size: 16pt;");
+	this.ensureDefault("button_text_top_padding", 0);
+	this.ensureDefault("button_text_left_padding", 0);
+	this.ensureDefault("button_action", SWFUpload.BUTTON_ACTION.SELECT_FILES);
+	this.ensureDefault("button_disabled", false);
+	this.ensureDefault("button_placeholder_id", null);
+	this.ensureDefault("button_cursor", SWFUpload.CURSOR.ARROW);
+	this.ensureDefault("button_window_mode", SWFUpload.WINDOW_MODE.WINDOW);
+	
+	// Debug Settings
+	this.ensureDefault("debug", false);
+	this.settings.debug_enabled = this.settings.debug;	// Here to maintain v2 API
+	
+	// Event Handlers
+	this.settings.return_upload_start_handler = this.returnUploadStart;
+	this.ensureDefault("swfupload_loaded_handler", null);
+	this.ensureDefault("file_dialog_start_handler", null);
+	this.ensureDefault("file_queued_handler", null);
+	this.ensureDefault("file_queue_error_handler", null);
+	this.ensureDefault("file_dialog_complete_handler", null);
+	
+	this.ensureDefault("upload_start_handler", null);
+	this.ensureDefault("upload_progress_handler", null);
+	this.ensureDefault("upload_error_handler", null);
+	this.ensureDefault("upload_success_handler", null);
+	this.ensureDefault("upload_complete_handler", null);
+	
+	this.ensureDefault("debug_handler", this.debugMessage);
 
-    // UI setting
-    this.addSetting("ui_function",           init_settings.ui_function,           null);
-    this.addSetting("ui_container_id",       init_settings.ui_container_id,       "");
-    this.addSetting("degraded_container_id", init_settings.degraded_container_id, "");
+	this.ensureDefault("custom_settings", {});
 
-    // Upload backend settings
-    this.addSetting("upload_target_url", init_settings.upload_target_url, "");
-    this.addSetting("upload_cookies",    init_settings.upload_cookies,    []);
-    this.addSetting("upload_params",     init_settings.upload_params,     {});
+	// Other settings
+	this.customSettings = this.settings.custom_settings;
+	
+	// Update the flash url if needed
+	if (this.settings.prevent_swf_caching) {
+		this.settings.flash_url = this.settings.flash_url + "?swfuploadrnd=" + Math.floor(Math.random() * 999999999);
+	}
+	
+	delete this.ensureDefault;
+};
 
-    // Upload settings
-    this.addSetting("begin_upload_on_queue",  init_settings.begin_upload_on_queue,  true);
-    this.addSetting("file_types",             init_settings.file_types,             "*.gif;*.jpg;*.png");
-    this.addSetting("file_types_description", init_settings.file_types_description, "Common Web Image Formats (gif, jpg, png)");
-    this.addSetting("file_size_limit",        init_settings.file_size_limit,        "1024");
-    this.addSetting("file_upload_limit",      init_settings.file_upload_limit,      "0");
-    this.addSetting("file_queue_limit",       init_settings.file_queue_limit,       "0");
+SWFUpload.prototype.loadFlash = function () {
+	if (this.settings.button_placeholder_id !== "") {
+		this.replaceWithFlash();
+	} else {
+		this.appendFlash();
+	}
+};
 
-    // Flash Settings
-    this.addSetting("flash_url",          init_settings.flash_url,          "swfupload.swf");
-    this.addSetting("flash_container_id", init_settings.flash_container_id, "");
-    this.addSetting("flash_width",        init_settings.flash_width,        "1px");
-    this.addSetting("flash_height",       init_settings.flash_height,       "1px");
-    this.addSetting("flash_color",        init_settings.flash_color,        "#FFFFFF");
+// Private: appendFlash gets the HTML tag for the Flash
+// It then appends the flash to the body
+SWFUpload.prototype.appendFlash = function () {
+	var targetElement, container;
 
-    // Debug Settings
-    this.addSetting("debug_enabled", init_settings.debug,  false);
-    this.debug_enabled = this.getSetting("debug_enabled");
+	// Make sure an element with the ID we are going to use doesn't already exist
+	if (document.getElementById(this.movieName) !== null) {
+		throw "ID " + this.movieName + " is already in use. The Flash Object could not be added";
+	}
 
-    // Event Handlers
-    this.flashReady      = this.retrieveSetting(init_settings.flash_ready_handler,      this.flashReady);
-    this.dialogCancelled = this.retrieveSetting(init_settings.dialog_cancelled_handler, this.dialogCancelled);
-    this.fileQueued      = this.retrieveSetting(init_settings.file_queued_handler,      this.fileQueued);
-    this.fileProgress    = this.retrieveSetting(init_settings.file_progress_handler,    this.fileProgress);
-    this.fileCancelled   = this.retrieveSetting(init_settings.file_cancelled_handler,   this.fileCancelled);
-    this.fileComplete    = this.retrieveSetting(init_settings.file_complete_handler,    this.fileComplete);
-    this.queueStopped    = this.retrieveSetting(init_settings.queue_stopped_handler,    this.queueStopped);
-    this.queueComplete   = this.retrieveSetting(init_settings.queue_complete_handler,   this.queueComplete);
-    this.error           = this.retrieveSetting(init_settings.error_handler,            this.error);
-    this.debug           = this.retrieveSetting(init_settings.debug_handler,            this.debug);
-};
+	// Get the body tag where we will be adding the flash movie
+	targetElement = document.getElementsByTagName("body")[0];
 
-// loadFlash is a private method that generates the HTML tag for the Flash
-// It then adds the flash to the "target" or to the body and stores a
-// reference to the flash element in "movieElement".
-SWFUpload.prototype.loadFlash = function () {
-    var html, container, target_element, flash_container_id;
-    html = this.getFlashHTML();
+	if (targetElement == undefined) {
+		throw "Could not find the 'body' element.";
+	}
 
-    // Build the DOM nodes to hold the flash;
-    container = document.createElement("div");
-    container.style.width = this.getSetting("flash_width");
-    container.style.height = this.getSetting("flash_height");
+	// Append the container and load the flash
+	container = document.createElement("div");
+	container.style.width = "1px";
+	container.style.height = "1px";
+	container.style.overflow = "hidden";
 
-    flash_container_id = this.getSetting("flash_container_id");
-    if (flash_container_id !== "") {
-        target_element = document.getElementById(flash_container_id);
-    }
-    // If the target wasn't found use the "BODY" element
-    if (typeof(target_element) === "undefined" || target_element === null) {
-        target_element = document.getElementsByTagName("body")[0];
-    }
-    // If all else fails then give up
-    if (typeof(target_element) === "undefined" || target_element === null) {
-        this.debugMessage("Could not find an element to add the Flash too. Failed to find element for \"flash_container_id\" or the BODY element.");
-        return false;
-    }
+	targetElement.appendChild(container);
+	container.innerHTML = this.getFlashHTML();	// Using innerHTML is non-standard but the only sensible way to dynamically add Flash in IE (and maybe other browsers)
 
-    target_element.appendChild(container);
+	// Fix IE Flash/Form bug
+	if (window[this.movieName] == undefined) {
+		window[this.movieName] = this.getMovieElement();
+	}
+	
+	
+};
 
-    container.innerHTML = html;
+// Private: replaceWithFlash replaces the button_placeholder element with the flash movie.
+SWFUpload.prototype.replaceWithFlash = function () {
+	var targetElement, tempParent;
 
-    this.movieElement = document.getElementById(this.movieName);    // Save a reference to the flash node so we can make calls to it.
+	// Make sure an element with the ID we are going to use doesn't already exist
+	if (document.getElementById(this.movieName) !== null) {
+		throw "ID " + this.movieName + " is already in use. The Flash Object could not be added";
+	}
 
-    // Fix IEs "Flash can't callback when in a form" issue (http://www.extremefx.com.ar/blog/fixing-flash-external-interface-inside-form-on-internet-explorer)
-    if (typeof(window[this.movieName]) === "undefined" || window[this.moveName] !== this.movieElement) {
-        window[this.movieName] = this.movieElement;
-    }
+	// Get the element where we will be placing the flash movie
+	targetElement = document.getElementById(this.settings.button_placeholder_id);
+
+	if (targetElement == undefined) {
+		throw "Could not find the placeholder element.";
+	}
+
+	// Append the container and load the flash
+	tempParent = document.createElement("div");
+	tempParent.innerHTML = this.getFlashHTML();	// Using innerHTML is non-standard but the only sensible way to dynamically add Flash in IE (and maybe other browsers)
+	targetElement.parentNode.replaceChild(tempParent.firstChild, targetElement);
+
+	// Fix IE Flash/Form bug
+	if (window[this.movieName] == undefined) {
+		window[this.movieName] = this.getMovieElement();
+	}
+	
 };
 
-// Generates the embed/object tags needed to embed the flash in to the document
+// Private: getFlashHTML generates the object tag needed to embed the flash in to the document
 SWFUpload.prototype.getFlashHTML = function () {
-    var html = "";
+	// Flash Satay object syntax: http://www.alistapart.com/articles/flashsatay
+	return ['<object id="', this.movieName, '" type="application/x-shockwave-flash" data="', this.settings.flash_url, '" width="', this.settings.button_width, '" height="', this.settings.button_height, '" class="swfupload">',
+				'<param name="wmode" value="', this.settings.button_window_mode , '" />',
+				'<param name="movie" value="', this.settings.flash_url, '" />',
+				'<param name="quality" value="high" />',
+				'<param name="menu" value="false" />',
+				'<param name="allowScriptAccess" value="always" />',
+				'<param name="flashvars" value="' + this.getFlashVars() + '" />',
+				'</object>'].join("");
+};
 
-    // Create Mozilla Embed HTML
-    if (navigator.plugins && navigator.mimeTypes && navigator.mimeTypes.length) {
-        // Build the basic embed html
-        html = '<embed type="application/x-shockwave-flash" src="' + this.getSetting("flash_url") + '" width="' + this.getSetting("flash_width") + '" height="' + this.getSetting("flash_height") + '"';
-        html += ' id="' + this.movieName + '" name="' + this.movieName + '" ';
-        html += 'bgcolor="' + this.getSetting("flash_color") + '" quality="high" menu="false" flashvars="';
+// Private: getFlashVars builds the parameter string that will be passed
+// to flash in the flashvars param.
+SWFUpload.prototype.getFlashVars = function () {
+	// Build a string from the post param object
+	var paramString = this.buildParamString();
+	var httpSuccessString = this.settings.http_success.join(",");
+	
+	// Build the parameter string
+	return ["movieName=", encodeURIComponent(this.movieName),
+			"&amp;uploadURL=", encodeURIComponent(this.settings.upload_url),
+			"&amp;useQueryString=", encodeURIComponent(this.settings.use_query_string),
+			"&amp;requeueOnError=", encodeURIComponent(this.settings.requeue_on_error),
+			"&amp;httpSuccess=", encodeURIComponent(httpSuccessString),
+			"&amp;params=", encodeURIComponent(paramString),
+			"&amp;filePostName=", encodeURIComponent(this.settings.file_post_name),
+			"&amp;fileTypes=", encodeURIComponent(this.settings.file_types),
+			"&amp;fileTypesDescription=", encodeURIComponent(this.settings.file_types_description),
+			"&amp;fileSizeLimit=", encodeURIComponent(this.settings.file_size_limit),
+			"&amp;fileUploadLimit=", encodeURIComponent(this.settings.file_upload_limit),
+			"&amp;fileQueueLimit=", encodeURIComponent(this.settings.file_queue_limit),
+			"&amp;debugEnabled=", encodeURIComponent(this.settings.debug_enabled),
+			"&amp;buttonImageURL=", encodeURIComponent(this.settings.button_image_url),
+			"&amp;buttonWidth=", encodeURIComponent(this.settings.button_width),
+			"&amp;buttonHeight=", encodeURIComponent(this.settings.button_height),
+			"&amp;buttonText=", encodeURIComponent(this.settings.button_text),
+			"&amp;buttonTextTopPadding=", encodeURIComponent(this.settings.button_text_top_padding),
+			"&amp;buttonTextLeftPadding=", encodeURIComponent(this.settings.button_text_left_padding),
+			"&amp;buttonTextStyle=", encodeURIComponent(this.settings.button_text_style),
+			"&amp;buttonAction=", encodeURIComponent(this.settings.button_action),
+			"&amp;buttonDisabled=", encodeURIComponent(this.settings.button_disabled),
+			"&amp;buttonCursor=", encodeURIComponent(this.settings.button_cursor)
+		].join("");
+};
 
-        html += this.getFlashVars();
+// Public: getMovieElement retrieves the DOM reference to the Flash element added by SWFUpload
+// The element is cached after the first lookup
+SWFUpload.prototype.getMovieElement = function () {
+	if (this.movieElement == undefined) {
+		this.movieElement = document.getElementById(this.movieName);
+	}
 
-        html += '" />';
+	if (this.movieElement === null) {
+		throw "Could not find Flash element";
+	}
+	
+	return this.movieElement;
+};
 
-    // Create IE Object HTML
-    } else {
+// Private: buildParamString takes the name/value pairs in the post_params setting object
+// and joins them up in to a string formatted "name=value&amp;name=value"
+SWFUpload.prototype.buildParamString = function () {
+	var postParams = this.settings.post_params; 
+	var paramStringPairs = [];
 
-        // Build the basic Object tag
-        html = '<object id="' + this.movieName + '" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="' + this.getSetting("flash_width") + '" height="' + this.getSetting("flash_height") + '">';
-        html += '<param name="movie" value="' + this.getSetting("flash_url") + '">';
+	if (typeof(postParams) === "object") {
+		for (var name in postParams) {
+			if (postParams.hasOwnProperty(name)) {
+				paramStringPairs.push(encodeURIComponent(name.toString()) + "=" + encodeURIComponent(postParams[name].toString()));
+			}
+		}
+	}
 
-        html += '<param name="bgcolor" value="' + this.getSetting("flash_color") + '" />';
-        html += '<param name="quality" value="high" />';
-        html += '<param name="menu" value="false" />';
+	return paramStringPairs.join("&amp;");
+};
 
-        html += '<param name="flashvars" value="';
+// Public: Used to remove a SWFUpload instance from the page. This method strives to remove
+// all references to the SWF, and other objects so memory is properly freed.
+// Returns true if everything was destroyed. Returns a false if a failure occurs leaving SWFUpload in an inconsistant state.
+// Credits: Major improvements provided by steffen
+SWFUpload.prototype.destroy = function () {
+	try {
+		// Make sure Flash is done before we try to remove it
+		this.cancelUpload(null, false);
+		
+		// Remove the SWFUpload DOM nodes
+		var movieElement = null;
+		movieElement = this.getMovieElement();
+		
+		if (movieElement) {
+			// Loop through all the movie's properties and remove all function references (DOM/JS IE 6/7 memory leak workaround)
+			for (var i in movieElement) {
+				try {
+					if (typeof(movieElement[i]) === "function") {
+						movieElement[i] = null;
+					}
+				} catch (ex1) {}
+			}
 
-        html += this.getFlashVars();
+			// Remove the Movie Element from the page
+			try {
+				movieElement.parentNode.removeChild(movieElement);
+			} catch (ex) {}
+		}
+		
+		
+		// Remove IE form fix reference
+		window[this.movieName] = null;
 
-        html += '" /></object>';
-    }
+		// Destroy other references
+		SWFUpload.instances[this.movieName] = null;
+		delete SWFUpload.instances[this.movieName];
 
-    return html;
+		this.movieElement = null;
+		this.settings = null;
+		this.customSettings = null;
+		this.eventQueue = null;
+		this.movieName = null;
+		
+		
+		return true;
+	} catch (ex1) {
+		return false;
+	}
 };
 
-// This private method builds the parameter string that will be passed
-// to flash.
-SWFUpload.prototype.getFlashVars = function () {
-    // Add the cookies to the backend string
-    var upload_target_url = this.getSetting("upload_target_url");
-    var query_string = this.buildQueryString();
+// Public: displayDebugInfo prints out settings and configuration
+// information about this SWFUpload instance.
+// This function (and any references to it) can be deleted when placing
+// SWFUpload in production.
+SWFUpload.prototype.displayDebugInfo = function () {
+	this.debug(
+		[
+			"---SWFUpload Instance Info---\n",
+			"Version: ", SWFUpload.version, "\n",
+			"Movie Name: ", this.movieName, "\n",
+			"Settings:\n",
+			"\t", "upload_url:               ", this.settings.upload_url, "\n",
+			"\t", "flash_url:                ", this.settings.flash_url, "\n",
+			"\t", "use_query_string:         ", this.settings.use_query_string.toString(), "\n",
+			"\t", "requeue_on_error:         ", this.settings.requeue_on_error.toString(), "\n",
+			"\t", "http_success:             ", this.settings.http_success.join(", "), "\n",
+			"\t", "file_post_name:           ", this.settings.file_post_name, "\n",
+			"\t", "post_params:              ", this.settings.post_params.toString(), "\n",
+			"\t", "file_types:               ", this.settings.file_types, "\n",
+			"\t", "file_types_description:   ", this.settings.file_types_description, "\n",
+			"\t", "file_size_limit:          ", this.settings.file_size_limit, "\n",
+			"\t", "file_upload_limit:        ", this.settings.file_upload_limit, "\n",
+			"\t", "file_queue_limit:         ", this.settings.file_queue_limit, "\n",
+			"\t", "debug:                    ", this.settings.debug.toString(), "\n",
 
-    // Build the parameter string
-    var html = "";
-    html += "controlID=" + encodeURIComponent(this.getSetting("control_id"));
-    html += "&uploadTargetURL=" + encodeURIComponent(upload_target_url);
-    html += "&uploadQueryString=" + encodeURIComponent(query_string);
-    html += "&beginUploadOnQueue=" + encodeURIComponent(this.getSetting("begin_upload_on_queue"));
-    html += "&fileTypes=" + encodeURIComponent(this.getSetting("file_types"));
-    html += "&fileTypesDescription=" + encodeURIComponent(this.getSetting("file_types_description"));
-    html += "&fileSizeLimit=" + encodeURIComponent(this.getSetting("file_size_limit"));
-    html += "&fileUploadLimit=" + encodeURIComponent(this.getSetting("file_upload_limit"));
-    html += "&fileQueueLimit=" + encodeURIComponent(this.getSetting("file_queue_limit"));
-    html += "&debugEnabled=" + encodeURIComponent(this.getSetting("debug_enabled"));
+			"\t", "prevent_swf_caching:      ", this.settings.prevent_swf_caching.toString(), "\n",
 
-    return html;
+			"\t", "button_placeholder_id:    ", this.settings.button_placeholder_id.toString(), "\n",
+			"\t", "button_image_url:         ", this.settings.button_image_url.toString(), "\n",
+			"\t", "button_width:             ", this.settings.button_width.toString(), "\n",
+			"\t", "button_height:            ", this.settings.button_height.toString(), "\n",
+			"\t", "button_text:              ", this.settings.button_text.toString(), "\n",
+			"\t", "button_text_style:        ", this.settings.button_text_style.toString(), "\n",
+			"\t", "button_text_top_padding:  ", this.settings.button_text_top_padding.toString(), "\n",
+			"\t", "button_text_left_padding: ", this.settings.button_text_left_padding.toString(), "\n",
+			"\t", "button_action:            ", this.settings.button_action.toString(), "\n",
+			"\t", "button_disabled:          ", this.settings.button_disabled.toString(), "\n",
+
+			"\t", "custom_settings:          ", this.settings.custom_settings.toString(), "\n",
+			"Event Handlers:\n",
+			"\t", "swfupload_loaded_handler assigned:  ", (typeof this.settings.swfupload_loaded_handler === "function").toString(), "\n",
+			"\t", "file_dialog_start_handler assigned: ", (typeof this.settings.file_dialog_start_handler === "function").toString(), "\n",
+			"\t", "file_queued_handler assigned:       ", (typeof this.settings.file_queued_handler === "function").toString(), "\n",
+			"\t", "file_queue_error_handler assigned:  ", (typeof this.settings.file_queue_error_handler === "function").toString(), "\n",
+			"\t", "upload_start_handler assigned:      ", (typeof this.settings.upload_start_handler === "function").toString(), "\n",
+			"\t", "upload_progress_handler assigned:   ", (typeof this.settings.upload_progress_handler === "function").toString(), "\n",
+			"\t", "upload_error_handler assigned:      ", (typeof this.settings.upload_error_handler === "function").toString(), "\n",
+			"\t", "upload_success_handler assigned:    ", (typeof this.settings.upload_success_handler === "function").toString(), "\n",
+			"\t", "upload_complete_handler assigned:   ", (typeof this.settings.upload_complete_handler === "function").toString(), "\n",
+			"\t", "debug_handler assigned:             ", (typeof this.settings.debug_handler === "function").toString(), "\n"
+		].join("")
+	);
 };
 
-SWFUpload.prototype.buildQueryString = function () {
-    var upload_cookies = this.getSetting("upload_cookies");
-    var upload_params = this.getSetting("upload_params");
-    var query_string_pairs = [];
-    var i, value, name;
+/* Note: addSetting and getSetting are no longer used by SWFUpload but are included
+	the maintain v2 API compatibility
+*/
+// Public: (Deprecated) addSetting adds a setting value. If the value given is undefined or null then the default_value is used.
+SWFUpload.prototype.addSetting = function (name, value, default_value) {
+    if (value == undefined) {
+        return (this.settings[name] = default_value);
+    } else {
+        return (this.settings[name] = value);
+	}
+};
 
-    // Retrieve the cookies
-    if (typeof(upload_cookies) === "object" && typeof(upload_cookies.length) === "number") {
-        for (i = 0; i < upload_cookies.length; i++) {
-            if (typeof(upload_cookies[i]) === "string" && upload_cookies[i] !== "") {
-                value = this.getCookie(upload_cookies[i]);
-                if (value !== "") {
-                    query_string_pairs.push(encodeURIComponent(upload_cookies[i]) + "=" + encodeURIComponent(value));
-                }
-            }
-        }
-    }
-    // Retrieve the user defined parameters
-    if (typeof(upload_params) === "object") {
-        for (name in upload_params) {
-            if (upload_params.hasOwnProperty(name)) {
-                if (typeof(upload_params[name]) === "string" /*&& upload_params[name] != ""*/) {
-                    query_string_pairs.push(encodeURIComponent(name) + "=" + encodeURIComponent(upload_params[name]));
-                }
-            }
-        }
-    }
+// Public: (Deprecated) getSetting gets a setting. Returns an empty string if the setting was not found.
+SWFUpload.prototype.getSetting = function (name) {
+    if (this.settings[name] != undefined) {
+        return this.settings[name];
+	}
 
-    return query_string_pairs.join("&");
+    return "";
 };
 
-// This private method "loads" the UI.  If a target was specified then it is assumed that "display: none" was set and
-// it does a "display: block" so the UI is shown.  Then if a degraded_target is specified it hides it by setting "display: none"
-// If you want SWFUpload to do something else then provide a "ui_function" setting and that will be called instead.
-SWFUpload.prototype.showUI = function () {
-    var ui_container_id, ui_target, degraded_container_id, degraded_target;
-    try {
-        ui_container_id = this.getSetting("ui_container_id");
 
-        if (ui_container_id !== "") {
-            ui_target = document.getElementById(ui_container_id);
-            if (ui_target !== null) {
-                ui_target.style.display = "block";
 
-                // Now that the UI has been taken care of hide the degraded UI
-                degraded_container_id = this.getSetting("degraded_container_id");
-                if (degraded_container_id !== "") {
-                    degraded_target = document.getElementById(degraded_container_id);
-                    if (degraded_target !== null) {
-                        degraded_target.style.display = "none";
-                    }
-                }
-            }
-        }
+// Private: callFlash handles function calls made to the Flash element.
+// Calls are made with a setTimeout for some functions to work around
+// bugs in the ExternalInterface library.
+SWFUpload.prototype.callFlash = function (functionName, argumentArray) {
+	argumentArray = argumentArray || [];
+	
+	var movieElement = this.getMovieElement();
+	var returnValue, returnString;
 
-    } catch (ex) {
-        this.debugMessage(ex);
-    }
+	// Flash's method if calling ExternalInterface methods (code adapted from MooTools).
+	try {
+		returnString = movieElement.CallFunction('<invoke name="' + functionName + '" returntype="javascript">' + __flash__argumentsToXML(argumentArray, 0) + '</invoke>');
+		returnValue = eval(returnString);
+	} catch (ex) {
+		throw "Call to " + functionName + " failed";
+	}
+	
+	// Unescape file post param values
+	if (returnValue != undefined && typeof returnValue.post === "object") {
+		returnValue = this.unescapeFilePostParams(returnValue);
+	}
+
+	return returnValue;
 };
 
-// Saves a setting.  If the value given is undefined or null then the default_value is used.
-SWFUpload.prototype.addSetting = function (name, value, default_value) {
-    if (typeof(value) === "undefined" || value === null) {
-        this.settings[name] = default_value;
-    } else {
-        this.settings[name] = value;
-    }
 
-    return this.settings[name];
+/* *****************************
+	-- Flash control methods --
+	Your UI should use these
+	to operate SWFUpload
+   ***************************** */
+
+// WARNING: this function does not work in Flash Player 10
+// Public: selectFile causes a File Selection Dialog window to appear.  This
+// dialog only allows 1 file to be selected.
+SWFUpload.prototype.selectFile = function () {
+	this.callFlash("SelectFile");
 };
 
-// Gets a setting.  Returns null if it wasn't found.
-SWFUpload.prototype.getSetting = function (name) {
-    if (typeof(this.settings[name]) === "undefined") {
-        return "";
-    } else {
-        return this.settings[name];
-    }
+// WARNING: this function does not work in Flash Player 10
+// Public: selectFiles causes a File Selection Dialog window to appear/ This
+// dialog allows the user to select any number of files
+// Flash Bug Warning: Flash limits the number of selectable files based on the combined length of the file names.
+// If the selection name length is too long the dialog will fail in an unpredictable manner.  There is no work-around
+// for this bug.
+SWFUpload.prototype.selectFiles = function () {
+	this.callFlash("SelectFiles");
 };
 
-// Gets a setting, if the setting is undefined then return the default value
-// This does not affect or use the interal setting object.
-SWFUpload.prototype.retrieveSetting = function (value, default_value) {
-    if (typeof(value) === "undefined" || value === null) {
-        return default_value;
-    } else {
-        return value;
-    }
+
+// Public: startUpload starts uploading the first file in the queue unless
+// the optional parameter 'fileID' specifies the ID 
+SWFUpload.prototype.startUpload = function (fileID) {
+	this.callFlash("StartUpload", [fileID]);
 };
 
+// Public: cancelUpload cancels any queued file.  The fileID parameter may be the file ID or index.
+// If you do not specify a fileID the current uploading file or first file in the queue is cancelled.
+// If you do not want the uploadError event to trigger you can specify false for the triggerErrorEvent parameter.
+SWFUpload.prototype.cancelUpload = function (fileID, triggerErrorEvent) {
+	if (triggerErrorEvent !== false) {
+		triggerErrorEvent = true;
+	}
+	this.callFlash("CancelUpload", [fileID, triggerErrorEvent]);
+};
 
-// This method is used when debugging is enabled.
-// It loops through all the settings and displays
-// them in the debug Console.
-SWFUpload.prototype.displayDebugInfo = function () {
-    var key, debug_message = "";
+// Public: stopUpload stops the current upload and requeues the file at the beginning of the queue.
+// If nothing is currently uploading then nothing happens.
+SWFUpload.prototype.stopUpload = function () {
+	this.callFlash("StopUpload");
+};
 
-    debug_message += "----- DEBUG OUTPUT ----\nID: " + this.movieElement.id + "\n";
+/* ************************
+ * Settings methods
+ *   These methods change the SWFUpload settings.
+ *   SWFUpload settings should not be changed directly on the settings object
+ *   since many of the settings need to be passed to Flash in order to take
+ *   effect.
+ * *********************** */
 
-    // It's bad to use the for..in with an associative array, but oh well
-    for (key in this.settings) {
-        if (this.settings.hasOwnProperty(key)) {
-            debug_message += key + ": " + this.settings[key] + "\n";
-        }
-    }
+// Public: getStats gets the file statistics object.
+SWFUpload.prototype.getStats = function () {
+	return this.callFlash("GetStats");
+};
 
-    debug_message += "----- DEBUG OUTPUT END ----\n";
-    debug_message += "\n";
+// Public: setStats changes the SWFUpload statistics.  You shouldn't need to 
+// change the statistics but you can.  Changing the statistics does not
+// affect SWFUpload accept for the successful_uploads count which is used
+// by the upload_limit setting to determine how many files the user may upload.
+SWFUpload.prototype.setStats = function (statsObject) {
+	this.callFlash("SetStats", [statsObject]);
+};
 
-    this.debugMessage(debug_message);
+// Public: getFile retrieves a File object by ID or Index.  If the file is
+// not found then 'null' is returned.
+SWFUpload.prototype.getFile = function (fileID) {
+	if (typeof(fileID) === "number") {
+		return this.callFlash("GetFileByIndex", [fileID]);
+	} else {
+		return this.callFlash("GetFile", [fileID]);
+	}
 };
 
-// Sets the UploadTargetURL. To commit the change you must call UpdateUploadStrings.
-SWFUpload.prototype.setUploadTargetURL = function (url) {
-    if (typeof(url) === "string") {
-        return this.addSetting("upload_target_url", url, "");
-    } else {
-        return false;
-    }
+// Public: addFileParam sets a name/value pair that will be posted with the
+// file specified by the Files ID.  If the name already exists then the
+// exiting value will be overwritten.
+SWFUpload.prototype.addFileParam = function (fileID, name, value) {
+	return this.callFlash("AddFileParam", [fileID, name, value]);
 };
-// Sets the upload_cookies array. To commit the change you must call UpdateUploadStrings.
-SWFUpload.prototype.setUploadCookies = function (cookie_name_array) {
-    if (typeof(cookie_name_array) === "object" && typeof(cookie_name_array.length) === "number") {
-        return this.addSetting("upload_cookies", cookie_name_array, []);
-    } else {
-        return false;
-    }
+
+// Public: removeFileParam removes a previously set (by addFileParam) name/value
+// pair from the specified file.
+SWFUpload.prototype.removeFileParam = function (fileID, name) {
+	this.callFlash("RemoveFileParam", [fileID, name]);
 };
-// Sets the upload params object. To commit the change you must call UpdateUploadStrings.
-SWFUpload.prototype.setUploadParams = function (param_object) {
-    if (typeof(param_object) === "object") {
-        return this.addSetting("upload_params", param_object, []);
-    } else {
-        return false;
-    }
+
+// Public: setUploadUrl changes the upload_url setting.
+SWFUpload.prototype.setUploadURL = function (url) {
+	this.settings.upload_url = url.toString();
+	this.callFlash("SetUploadURL", [url]);
 };
 
-/* *****************************
-    -- Flash control methods --
-    Your UI should use these
-    to operate SWFUpload
-   ***************************** */
+// Public: setPostParams changes the post_params setting
+SWFUpload.prototype.setPostParams = function (paramsObject) {
+	this.settings.post_params = paramsObject;
+	this.callFlash("SetPostParams", [paramsObject]);
+};
 
-SWFUpload.prototype.browse = function () {
-    if (typeof(this.movieElement) !== "undefined" && typeof(this.movieElement.Browse) === "function") {
-        try {
-            this.movieElement.Browse();
-        }
-        catch (ex) {
-            this.debugMessage("Could not call browse: " + ex);
-        }
-    } else {
-        this.debugMessage("Could not find Flash element");
-    }
+// Public: addPostParam adds post name/value pair.  Each name can have only one value.
+SWFUpload.prototype.addPostParam = function (name, value) {
+	this.settings.post_params[name] = value;
+	this.callFlash("SetPostParams", [this.settings.post_params]);
+};
 
+// Public: removePostParam deletes post name/value pair.
+SWFUpload.prototype.removePostParam = function (name) {
+	delete this.settings.post_params[name];
+	this.callFlash("SetPostParams", [this.settings.post_params]);
 };
 
-// Begins the uploads (if begin_upload_on_queue is disabled)
-// The file_id is optional.  If specified only that file will be uploaded.  If not specified SWFUpload will
-// begin to process the queue.
-SWFUpload.prototype.startUpload = function (file_id) {
-    if (typeof(this.movieElement) !== "undefined" && typeof(this.movieElement.StartUpload) === "function") {
-        try {
-            this.movieElement.StartUpload(file_id);
-        }
-        catch (ex) {
-            this.debugMessage("Could not call StartUpload: " + ex);
-        }
-    } else {
-        this.debugMessage("Could not find Flash element");
-    }
+// Public: setFileTypes changes the file_types setting and the file_types_description setting
+SWFUpload.prototype.setFileTypes = function (types, description) {
+	this.settings.file_types = types;
+	this.settings.file_types_description = description;
+	this.callFlash("SetFileTypes", [types, description]);
+};
 
+// Public: setFileSizeLimit changes the file_size_limit setting
+SWFUpload.prototype.setFileSizeLimit = function (fileSizeLimit) {
+	this.settings.file_size_limit = fileSizeLimit;
+	this.callFlash("SetFileSizeLimit", [fileSizeLimit]);
 };
 
-// Cancels the current uploading item.  If no item is uploading then nothing happens.
-SWFUpload.prototype.cancelUpload = function (file_id) {
-    if (typeof(this.movieElement) !== "undefined" && typeof(this.movieElement.CancelUpload) === "function") {
-        try {
-            this.movieElement.CancelUpload(file_id);
-        }
-        catch (ex) {
-            this.debugMessage("Could not call CancelUpload");
-        }
-    } else {
-        this.debugMessage("Could not find Flash element");
-    }
+// Public: setFileUploadLimit changes the file_upload_limit setting
+SWFUpload.prototype.setFileUploadLimit = function (fileUploadLimit) {
+	this.settings.file_upload_limit = fileUploadLimit;
+	this.callFlash("SetFileUploadLimit", [fileUploadLimit]);
+};
 
+// Public: setFileQueueLimit changes the file_queue_limit setting
+SWFUpload.prototype.setFileQueueLimit = function (fileQueueLimit) {
+	this.settings.file_queue_limit = fileQueueLimit;
+	this.callFlash("SetFileQueueLimit", [fileQueueLimit]);
 };
 
-// Cancels all the files in the queue.  Including any current uploads.
-SWFUpload.prototype.cancelQueue = function () {
-    if (typeof(this.movieElement) !== "undefined" && typeof(this.movieElement.CancelQueue) === "function") {
-        try {
-            this.movieElement.CancelQueue();
-        }
-        catch (ex) {
-            this.debugMessage("Could not call CancelQueue");
-        }
-    } else {
-        this.debugMessage("Could not find Flash element");
-    }
+// Public: setFilePostName changes the file_post_name setting
+SWFUpload.prototype.setFilePostName = function (filePostName) {
+	this.settings.file_post_name = filePostName;
+	this.callFlash("SetFilePostName", [filePostName]);
+};
 
+// Public: setUseQueryString changes the use_query_string setting
+SWFUpload.prototype.setUseQueryString = function (useQueryString) {
+	this.settings.use_query_string = useQueryString;
+	this.callFlash("SetUseQueryString", [useQueryString]);
 };
 
-// Stops the current upload.  The file is re-queued.  If nothing is currently uploading then nothing happens.
-SWFUpload.prototype.stopUpload = function () {
-    if (typeof(this.movieElement) !== "undefined" && typeof(this.movieElement.StopUpload) === "function") {
-        try {
-            this.movieElement.StopUpload();
-        }
-        catch (ex) {
-            this.debugMessage("Could not call StopUpload");
-        }
-    } else {
-        this.debugMessage("Could not find Flash element");
-    }
+// Public: setRequeueOnError changes the requeue_on_error setting
+SWFUpload.prototype.setRequeueOnError = function (requeueOnError) {
+	this.settings.requeue_on_error = requeueOnError;
+	this.callFlash("SetRequeueOnError", [requeueOnError]);
+};
 
+// Public: setHTTPSuccess changes the http_success setting
+SWFUpload.prototype.setHTTPSuccess = function (http_status_codes) {
+	if (typeof http_status_codes === "string") {
+		http_status_codes = http_status_codes.replace(" ", "").split(",");
+	}
+	
+	this.settings.http_success = http_status_codes;
+	this.callFlash("SetHTTPSuccess", [http_status_codes]);
 };
 
-// Updates the upload url strings in the Flash Movie
-// This must be called in order for calls to SetUploadTargetURL, SetUploadCookies, and SetUploadQueryString to take effect.
-SWFUpload.prototype.updateUploadStrings = function () {
-    if (typeof(this.movieElement) !== "undefined" && typeof(this.movieElement.SetUploadStrings) === "function") {
-        try {
-            this.movieElement.SetUploadStrings(this.getSetting("upload_target_url"), this.buildQueryString());
-        }
-        catch (ex) {
-            this.debugMessage("Could not call SetUploadStrings");
-        }
-    } else {
-        this.debugMessage("Could not find Flash element");
-    }
 
+// Public: setDebugEnabled changes the debug_enabled setting
+SWFUpload.prototype.setDebugEnabled = function (debugEnabled) {
+	this.settings.debug_enabled = debugEnabled;
+	this.callFlash("SetDebugEnabled", [debugEnabled]);
 };
 
-SWFUpload.prototype.addFileParam = function (file_id, name, value) {
-    if (typeof(this.movieElement) !== "undefined" && typeof(this.movieElement.AddFileParam) === "function") {
-        try {
-            return this.movieElement.AddFileParam(file_id, encodeURIComponent(name), encodeURIComponent(value));
-        }
-        catch (ex) {
-            this.debugMessage("Could not call addFileParam");
-        }
-    } else {
-        this.debugMessage("Could not find Flash element");
-    }
+// Public: setButtonImageURL loads a button image sprite
+SWFUpload.prototype.setButtonImageURL = function (buttonImageURL) {
+	if (buttonImageURL == undefined) {
+		buttonImageURL = "";
+	}
+	
+	this.settings.button_image_url = buttonImageURL;
+	this.callFlash("SetButtonImageURL", [buttonImageURL]);
 };
 
-SWFUpload.prototype.removeFileParam = function (file_id, name) {
-    if (typeof(this.movieElement) !== "undefined" && typeof(this.movieElement.RemoveFileParam) === "function") {
-        try {
-            return this.movieElement.RemoveFileParam(file_id, encodeURIComponent(name));
-        }
-        catch (ex) {
-            this.debugMessage("Could not call addFileParam");
-        }
-    } else {
-        this.debugMessage("Could not find Flash element");
-    }
+// Public: setButtonDimensions resizes the Flash Movie and button
+SWFUpload.prototype.setButtonDimensions = function (width, height) {
+	this.settings.button_width = width;
+	this.settings.button_height = height;
+	
+	var movie = this.getMovieElement();
+	if (movie != undefined) {
+		movie.style.width = width + "px";
+		movie.style.height = height + "px";
+	}
+	
+	this.callFlash("SetButtonDimensions", [width, height]);
+};
+// Public: setButtonText Changes the text overlaid on the button
+SWFUpload.prototype.setButtonText = function (html) {
+	this.settings.button_text = html;
+	this.callFlash("SetButtonText", [html]);
+};
+// Public: setButtonTextPadding changes the top and left padding of the text overlay
+SWFUpload.prototype.setButtonTextPadding = function (left, top) {
+	this.settings.button_text_top_padding = top;
+	this.settings.button_text_left_padding = left;
+	this.callFlash("SetButtonTextPadding", [left, top]);
+};
 
+// Public: setButtonTextStyle changes the CSS used to style the HTML/Text overlaid on the button
+SWFUpload.prototype.setButtonTextStyle = function (css) {
+	this.settings.button_text_style = css;
+	this.callFlash("SetButtonTextStyle", [css]);
 };
+// Public: setButtonDisabled disables/enables the button
+SWFUpload.prototype.setButtonDisabled = function (isDisabled) {
+	this.settings.button_disabled = isDisabled;
+	this.callFlash("SetButtonDisabled", [isDisabled]);
+};
+// Public: setButtonAction sets the action that occurs when the button is clicked
+SWFUpload.prototype.setButtonAction = function (buttonAction) {
+	this.settings.button_action = buttonAction;
+	this.callFlash("SetButtonAction", [buttonAction]);
+};
 
+// Public: setButtonCursor changes the mouse cursor displayed when hovering over the button
+SWFUpload.prototype.setButtonCursor = function (cursor) {
+	this.settings.button_cursor = cursor;
+	this.callFlash("SetButtonCursor", [cursor]);
+};
+
 /* *******************************
-    Default Event Handlers
+	Flash Event Interfaces
+	These functions are used by Flash to trigger the various
+	events.
+	
+	All these functions a Private.
+	
+	Because the ExternalInterface library is buggy the event calls
+	are added to a queue and the queue then executed by a setTimeout.
+	This ensures that events are executed in a determinate order and that
+	the ExternalInterface bugs are avoided.
 ******************************* */
-// This is the callback method that the Flash movie will call when it has been loaded and is ready to go.
-// Calling this or showUI "manually" bypass the Flash Detection built in to SWFUpload.
-// FlashReady should not generally be overwritten. Use a ui_function setting if you want to control the UI loading after the flash has loaded.
+
+SWFUpload.prototype.queueEvent = function (handlerName, argumentArray) {
+	// Warning: Don't call this.debug inside here or you'll create an infinite loop
+	
+	if (argumentArray == undefined) {
+		argumentArray = [];
+	} else if (!(argumentArray instanceof Array)) {
+		argumentArray = [argumentArray];
+	}
+	
+	var self = this;
+	if (typeof this.settings[handlerName] === "function") {
+		// Queue the event
+		this.eventQueue.push(function () {
+			this.settings[handlerName].apply(this, argumentArray);
+		});
+		
+		// Execute the next queued event
+		setTimeout(function () {
+			self.executeNextEvent();
+		}, 0);
+		
+	} else if (this.settings[handlerName] !== null) {
+		throw "Event handler " + handlerName + " is unknown or is not a function";
+	}
+};
+
+// Private: Causes the next event in the queue to be executed.  Since events are queued using a setTimeout
+// we must queue them in order to garentee that they are executed in order.
+SWFUpload.prototype.executeNextEvent = function () {
+	// Warning: Don't call this.debug inside here or you'll create an infinite loop
+
+	var  f = this.eventQueue ? this.eventQueue.shift() : null;
+	if (typeof(f) === "function") {
+		f.apply(this);
+	}
+};
+
+// Private: unescapeFileParams is part of a workaround for a flash bug where objects passed through ExternalInterface cannot have
+// properties that contain characters that are not valid for JavaScript identifiers. To work around this
+// the Flash Component escapes the parameter names and we must unescape again before passing them along.
+SWFUpload.prototype.unescapeFilePostParams = function (file) {
+	var reg = /[$]([0-9a-f]{4})/i;
+	var unescapedPost = {};
+	var uk;
+
+	if (file != undefined) {
+		for (var k in file.post) {
+			if (file.post.hasOwnProperty(k)) {
+				uk = k;
+				var match;
+				while ((match = reg.exec(uk)) !== null) {
+					uk = uk.replace(match[0], String.fromCharCode(parseInt("0x" + match[1], 16)));
+				}
+				unescapedPost[uk] = file.post[k];
+			}
+		}
+
+		file.post = unescapedPost;
+	}
+
+	return file;
+};
+
 SWFUpload.prototype.flashReady = function () {
-    var ui_function;
-    try {
-        this.debugMessage("Flash called back and is ready.");
+	// Check that the movie element is loaded correctly with its ExternalInterface methods defined
+	var movieElement = this.getMovieElement();
 
-        ui_function = this.getSetting("ui_function");
-        if (typeof(ui_function) === "function") {
-            ui_function.apply(this);
-        } else {
-            this.showUI();
-        }
-    } catch (ex) {
-        this.debugMessage(ex);
-    }
+	// Pro-actively unhook all the Flash functions
+	if (typeof(movieElement.CallFunction) === "unknown") { // We only want to do this in IE
+		this.debug("Removing Flash functions hooks (this should only run in IE and should prevent memory leaks)");
+		for (var key in movieElement) {
+			try {
+				if (typeof(movieElement[key]) === "function") {
+					movieElement[key] = null;
+				}
+			} catch (ex) {
+			}
+		}
+	}
+	
+	this.queueEvent("swfupload_loaded_handler");
 };
 
-// Called when the user cancels the File browser window.
-SWFUpload.prototype.dialogCancelled = function () {
-    this.debugMessage("browse Dialog Cancelled.");
+
+/* This is a chance to do something before the browse window opens */
+SWFUpload.prototype.fileDialogStart = function () {
+	this.queueEvent("file_dialog_start_handler");
 };
 
-// Called once for file the user selects
+
+/* Called when a file is successfully added to the queue. */
 SWFUpload.prototype.fileQueued = function (file) {
-    this.debugMessage("File Queued: " + file.id);
+	file = this.unescapeFilePostParams(file);
+	this.queueEvent("file_queued_handler", file);
 };
 
-// Called during upload as the file progresses
-SWFUpload.prototype.fileProgress = function (file, bytes_complete) {
-    this.debugMessage("File Progress: " + file.id + ", Bytes: " + bytes_complete);
+
+/* Handle errors that occur when an attempt to queue a file fails. */
+SWFUpload.prototype.fileQueueError = function (file, errorCode, message) {
+	file = this.unescapeFilePostParams(file);
+	this.queueEvent("file_queue_error_handler", [file, errorCode, message]);
 };
 
-// Called after a file is cancelled
-SWFUpload.prototype.fileCancelled = function (file) {
-    this.debugMessage("File Cancelled: " + file.id);
+/* Called after the file dialog has closed and the selected files have been queued.
+	You could call startUpload here if you want the queued files to begin uploading immediately. */
+SWFUpload.prototype.fileDialogComplete = function (numFilesSelected, numFilesQueued) {
+	this.queueEvent("file_dialog_complete_handler", [numFilesSelected, numFilesQueued]);
 };
 
-// Called when a file upload has completed
-SWFUpload.prototype.fileComplete = function (file) {
-    this.debugMessage("File Complete: " + file.id);
+SWFUpload.prototype.uploadStart = function (file) {
+	file = this.unescapeFilePostParams(file);
+	this.queueEvent("return_upload_start_handler", file);
 };
 
-// Called when at least 1 file has been uploaded and there are no files remaining in the queue.
-SWFUpload.prototype.queueComplete = function (file_upload_count) {
-    this.debugMessage("Queue Complete. Files Uploaded:" + file_upload_count);
+SWFUpload.prototype.returnUploadStart = function (file) {
+	var returnValue;
+	if (typeof this.settings.upload_start_handler === "function") {
+		file = this.unescapeFilePostParams(file);
+		returnValue = this.settings.upload_start_handler.call(this, file);
+	} else if (this.settings.upload_start_handler != undefined) {
+		throw "upload_start_handler must be a function";
+	}
+
+	// Convert undefined to true so if nothing is returned from the upload_start_handler it is
+	// interpretted as 'true'.
+	if (returnValue === undefined) {
+		returnValue = true;
+	}
+	
+	returnValue = !!returnValue;
+	
+	this.callFlash("ReturnUploadStart", [returnValue]);
 };
 
-// Called when the upload is stopped.
-SWFUpload.prototype.queueStopped = function (file) {
-    this.debugMessage("Queue Stopped. File Stopped:" + file.id);
+
+
+SWFUpload.prototype.uploadProgress = function (file, bytesComplete, bytesTotal) {
+	file = this.unescapeFilePostParams(file);
+	this.queueEvent("upload_progress_handler", [file, bytesComplete, bytesTotal]);
 };
 
-// Called by SWFUpload JavaScript and Flash flash functions when debug is enabled
-SWFUpload.prototype.debug = function (message) {
-    this.debugMessage(message);
+SWFUpload.prototype.uploadError = function (file, errorCode, message) {
+	file = this.unescapeFilePostParams(file);
+	this.queueEvent("upload_error_handler", [file, errorCode, message]);
 };
 
-// Called when an error occurs. Use errcode to determine which error occurred.
-SWFUpload.prototype.error = function (errcode, file, msg) {
-    try {
-        switch (errcode) {
-        case SWFUpload.ERROR_CODE_HTTP_ERROR:
-            this.debugMessage("Error Code: HTTP Error, File name: " + file.name + ", Message: " + msg);
-            break;
-        case SWFUpload.ERROR_CODE_MISSING_UPLOAD_TARGET:
-            this.debugMessage("Error Code: No backend file, File name: " + file.name + ", Message: " + msg);
-            break;
-        case SWFUpload.ERROR_CODE_IO_ERROR:
-            this.debugMessage("Error Code: IO Error, File name: " + file.name + ", Message: " + msg);
-            break;
-        case SWFUpload.ERROR_CODE_SECURITY_ERROR:
-            this.debugMessage("Error Code: Security Error, File name: " + file.name + ", Message: " + msg);
-            break;
-        case SWFUpload.ERROR_CODE_FILE_EXCEEDS_SIZE_LIMIT:
-            this.debugMessage("Error Code: File too big, File name: " + file.name + ", File size: " + file.size + ", Message: " + msg);
-            break;
-        case SWFUpload.ERROR_CODE_ZERO_BYTE_FILE:
-            this.debugMessage("Error Code: Zero Byte File, File name: " + file.name + ", File size: " + file.size + ", Message: " + msg);
-            break;
-        case SWFUpload.ERROR_CODE_UPLOAD_LIMIT_EXCEEDED:
-            this.debugMessage("Error Code: Upload limit reached, File name: " + file.name + ", File size: " + file.size + ", Message: " + msg);
-            break;
-        case SWFUpload.ERROR_CODE_QUEUE_LIMIT_EXCEEDED:
-            this.debugMessage("Error Code: Upload limit reached, File name: " + file.name + ", File size: " + file.size + ", Message: " + msg);
-            break;
-        case SWFUpload.ERROR_CODE_UPLOAD_FAILED:
-            this.debugMessage("Error Code: Upload Initialization exception, File name: " + file.name + ", File size: " + file.size + ", Message: " + msg);
-            break;
-        case SWFUpload.ERROR_CODE_SPECIFIED_FILE_NOT_FOUND:
-            this.debugMessage("Error Code: File ID specified for upload was not found, Message: " + msg);
-            break;
-        default:
-            this.debugMessage("Error Code: Unhandled error occured. Errorcode: " + errcode);
-        }
-    } catch (ex) {
-        this.debugMessage(ex);
-    }
+SWFUpload.prototype.uploadSuccess = function (file, serverData) {
+	file = this.unescapeFilePostParams(file);
+	this.queueEvent("upload_success_handler", [file, serverData]);
 };
 
-/* **********************************
-    Utility Functions
-   ********************************** */
-// Gets a cookie (http://www.w3schools.com/js/js_cookies.asp)
-SWFUpload.prototype.getCookie = function (cookie_name) {
-    var cookie_start, cookie_end;
-    try {
-        if (document.cookie.length > 0 && cookie_name !== "")
-        {
-            cookie_start = document.cookie.indexOf(cookie_name + "=");
-            if (cookie_start !== -1)
-            {
-                cookie_start = cookie_start + cookie_name.length + 1;
-                cookie_end = document.cookie.indexOf(";", cookie_start);
-                if (cookie_end === -1) {
-                    cookie_end = document.cookie.length;
-                }
+SWFUpload.prototype.uploadComplete = function (file) {
+	file = this.unescapeFilePostParams(file);
+	this.queueEvent("upload_complete_handler", file);
+};
 
-                return unescape(document.cookie.substring(cookie_start, cookie_end));
-            }
-        }
-    } catch (ex) {
-        this.debugMessage(ex);
-    }
-
-    return "";
+/* Called by SWFUpload JavaScript and Flash functions when debug is enabled. By default it writes messages to the
+   internal debug console.  You can override this event and have messages written where you want. */
+SWFUpload.prototype.debug = function (message) {
+	this.queueEvent("debug_handler", message);
 };
 
+
 /* **********************************
-    Debug Console
-    The debug console is a self contained, in page location
-    for debug message to be sent.  The Debug Console adds
-    itself to the body if necessary.
+	Debug Console
+	The debug console is a self contained, in page location
+	for debug message to be sent.  The Debug Console adds
+	itself to the body if necessary.
 
-    The console is automatically scrolled as messages appear.
-   ********************************** */
+	The console is automatically scrolled as messages appear.
+	
+	If you are using your own debug handler or when you deploy to production and
+	have debug disabled you can remove these functions to reduce the file size
+	and complexity.
+********************************** */
+   
+// Private: debugMessage is the default debug_handler.  If you want to print debug messages
+// call the debug() function.  When overriding the function your own function should
+// check to see if the debug setting is true before outputting debug information.
 SWFUpload.prototype.debugMessage = function (message) {
-    var exception_message, exception_values;
+	if (this.settings.debug) {
+		var exceptionMessage, exceptionValues = [];
 
-    if (this.debug_enabled) {
-        if (typeof(message) === "object" && typeof(message.name) === "string" && typeof(message.message) === "string") {
-            exception_message = "";
-            exception_values = [];
-            for (var key in message) {
-                exception_values.push(key + ": " + message[key]);
-            }
-            exception_message = exception_values.join("\n");
-            exception_values = exception_message.split("\n");
-            exception_message = "EXCEPTION: " + exception_values.join("\nEXCEPTION: ");
-            SWFUpload.Console.writeLine(exception_message);
-        } else {
-            SWFUpload.Console.writeLine(message);
-        }
-    }
+		// Check for an exception object and print it nicely
+		if (typeof message === "object" && typeof message.name === "string" && typeof message.message === "string") {
+			for (var key in message) {
+				if (message.hasOwnProperty(key)) {
+					exceptionValues.push(key + ": " + message[key]);
+				}
+			}
+			exceptionMessage = exceptionValues.join("\n") || "";
+			exceptionValues = exceptionMessage.split("\n");
+			exceptionMessage = "EXCEPTION: " + exceptionValues.join("\nEXCEPTION: ");
+			SWFUpload.Console.writeLine(exceptionMessage);
+		} else {
+			SWFUpload.Console.writeLine(message);
+		}
+	}
 };
 
 SWFUpload.Console = {};
 SWFUpload.Console.writeLine = function (message) {
-    var console, documentForm;
+	var console, documentForm;
 
-    try {
-        console = document.getElementById("SWFUpload_Console");
+	try {
+		console = document.getElementById("SWFUpload_Console");
 
-        if (!console) {
-            documentForm = document.createElement("form");
-            document.getElementsByTagName("body")[0].appendChild(documentForm);
+		if (!console) {
+			documentForm = document.createElement("form");
+			document.getElementsByTagName("body")[0].appendChild(documentForm);
 
-            console = document.createElement("textarea");
-            console.id = "SWFUpload_Console";
-            console.style.fontFamily = "monospace";
-            console.setAttribute("wrap", "off");
-            console.wrap = "off";
-            console.style.overflow = "auto";
-            console.style.width = "700px";
-            console.style.height = "350px";
-            console.style.margin = "5px";
-            documentForm.appendChild(console);
-        }
+			console = document.createElement("textarea");
+			console.id = "SWFUpload_Console";
+			console.style.fontFamily = "monospace";
+			console.setAttribute("wrap", "off");
+			console.wrap = "off";
+			console.style.overflow = "auto";
+			console.style.width = "700px";
+			console.style.height = "350px";
+			console.style.margin = "5px";
+			documentForm.appendChild(console);
+		}
 
-        console.value += message + "\n";
+		console.value += message + "\n";
 
-        console.scrollTop = console.scrollHeight - console.clientHeight;
-    } catch (ex) {
-        alert("Exception: " + ex.name + " Message: " + ex.message);
-    }
+		console.scrollTop = console.scrollHeight - console.clientHeight;
+	} catch (ex) {
+		alert("Exception: " + ex.name + " Message: " + ex.message);
+	}
 };
Index: openacs-4/packages/ajax-filestorage-ui/www/resources/swfupload/swfupload.queue.js
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/ajax-filestorage-ui/www/resources/swfupload/swfupload.queue.js,v
diff -u
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/ajax-filestorage-ui/www/resources/swfupload/swfupload.queue.js	27 Dec 2008 06:27:25 -0000	1.1
@@ -0,0 +1,93 @@
+/*
+	Queue Plug-in
+	
+	Features:
+		*Adds a cancelQueue() method for cancelling the entire queue.
+		*All queued files are uploaded when startUpload() is called.
+		*If false is returned from uploadComplete then the queue upload is stopped.
+		 If false is not returned (strict comparison) then the queue upload is continued.
+		*Adds a QueueComplete event that is fired when all the queued files have finished uploading.
+		 Set the event handler with the queue_complete_handler setting.
+		
+	*/
+
+var SWFUpload;
+if (typeof(SWFUpload) === "function") {
+	SWFUpload.queue = {};
+	
+	SWFUpload.prototype.initSettings = (function (oldInitSettings) {
+		return function () {
+			if (typeof(oldInitSettings) === "function") {
+				oldInitSettings.call(this);
+			}
+			
+			this.customSettings.queue_cancelled_flag = false;
+			this.customSettings.queue_upload_count = 0;
+			
+			this.settings.user_upload_complete_handler = this.settings.upload_complete_handler;
+			this.settings.user_upload_start_handler = this.settings.upload_start_handler;
+			this.settings.upload_complete_handler = SWFUpload.queue.uploadCompleteHandler;
+			this.settings.upload_start_handler = SWFUpload.queue.uploadStartHandler;
+			
+			this.settings.queue_complete_handler = this.settings.queue_complete_handler || null;
+		};
+	})(SWFUpload.prototype.initSettings);
+
+	SWFUpload.prototype.startUpload = function (fileID) {
+		this.customSettings.queue_cancelled_flag = false;
+		this.callFlash("StartUpload", [fileID]);
+	};
+
+	SWFUpload.prototype.cancelQueue = function () {
+		this.customSettings.queue_cancelled_flag = true;
+		this.stopUpload();
+		
+		var stats = this.getStats();
+		while (stats.files_queued > 0) {
+			this.cancelUpload();
+			stats = this.getStats();
+		}
+	};
+	
+	SWFUpload.queue.uploadStartHandler = function (file) {
+		var returnValue;
+		if (typeof(this.customSettings.user_upload_start_handler) === "function") {
+			returnValue = this.customSettings.user_upload_start_handler.call(this, file);
+		}
+		
+		// To prevent upload a real "FALSE" value must be returned, otherwise default to a real "TRUE" value.
+		returnValue = (returnValue === false) ? false : true;
+		
+		this.customSettings.queue_cancelled_flag = !returnValue;
+
+		return returnValue;
+	};
+	
+	SWFUpload.queue.uploadCompleteHandler = function (file) {
+		var user_upload_complete_handler = this.settings.user_upload_complete_handler;
+		var continueUpload;
+		
+		if (file.filestatus === SWFUpload.FILE_STATUS.COMPLETE) {
+			this.customSettings.queue_upload_count++;
+		}
+
+		if (typeof(user_upload_complete_handler) === "function") {
+			continueUpload = (user_upload_complete_handler.call(this, file) === false) ? false : true;
+		} else {
+			continueUpload = true;
+		}
+		
+		if (continueUpload) {
+			var stats = this.getStats();
+			if (stats.files_queued > 0 && this.customSettings.queue_cancelled_flag === false) {
+				this.startUpload();
+			} else if (this.customSettings.queue_cancelled_flag === false) {
+				this.queueEvent("queue_complete_handler", [this.customSettings.queue_upload_count]);
+				this.customSettings.queue_upload_count = 0;
+			} else {
+				this.customSettings.queue_cancelled_flag = false;
+				this.customSettings.queue_upload_count = 0;
+			}
+		}
+	};
+}
\ No newline at end of file
Index: openacs-4/packages/ajax-filestorage-ui/www/resources/swfupload/swfupload.swf
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/ajax-filestorage-ui/www/resources/swfupload/swfupload.swf,v
diff -u -r1.1 -r1.2
Binary files differ
Index: openacs-4/packages/ajax-filestorage-ui/www/xmlhttp/add-file-flash.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/ajax-filestorage-ui/www/xmlhttp/add-file-flash.tcl,v
diff -u -r1.2 -r1.3
--- openacs-4/packages/ajax-filestorage-ui/www/xmlhttp/add-file-flash.tcl	19 Dec 2007 15:17:40 -0000	1.2
+++ openacs-4/packages/ajax-filestorage-ui/www/xmlhttp/add-file-flash.tcl	27 Dec 2008 06:27:25 -0000	1.3
@@ -5,31 +5,40 @@
 } {
     Filedata:trim,notnull
     Filedata.tmpfile:tmpfile
+    {folder_id ""}
+    {user_id ""}
+    {package_id ""}
+    {filetitle ""}
+    {filedescription ""}
+    {unpack_p ""}
 }
 
-set query [ns_conn query]
-set query_set [ns_parsequery $query]
+# set query [ns_conn query]
+# set query_set [ns_parsequery $query]
+# set folder_id [ns_set get $query_set "folder_id"]
 
-set folder_id [ns_set get $query_set "folder_id"]
+ns_log notice "FOLDER_ID : $folder_id ************"
+ns_log notice "USER_ID CONN : [ad_conn user_id] *******"
+
 if ![fs_folder_p $folder_id] {
     ns_return 500 "text/html" "[_ file-storage.lt_The_specified_parent_]"
     ad_script_abort
 }
 
-set package_id [ns_set get $query_set "package_id"]
-set user_id [ns_set get $query_set "user_id"]
-set filetitle [ns_set get $query_set "filetitle"]
-set filedescription [ns_set get $query_set "filedescription"]
-set unpack_p [ns_set get $query_set "unpack_p"]
+# set package_id [ns_set get $query_set "package_id"]
+# set user_id [ns_set get $query_set "user_id"]
+# set filetitle [ns_set get $query_set "filetitle"]
+# set filedescription [ns_set get $query_set "filedescription"]
+# set unpack_p [ns_set get $query_set "unpack_p"]
 
-ns_log notice "HAM : UPLOADING FILE : $folder_id : $Filedata : $Filedata.tmpfile : $package_id : $user_id***"
+ns_log notice "HAM : RECEIVING FILE : $folder_id : $Filedata : $Filedata.tmpfile : $package_id : $user_id***"
 
 # Get the ip
 set creation_ip [ad_conn peeraddr]
 
 set action ""
 
-set result ""
+set result "OK"
 
 # Check for write permission on this folder
 # ad_require_permission $folder_id write
@@ -117,10 +126,10 @@
 
 
 } on_error {
-
+    ns_log notice "ERROR $errmsg **************"
     ns_return 500 "text/html" $errmsg
     ad_script_abort
-
 }
 
-ad_return_template "add-file"
+# ad_return_template "add-file"
+ns_return 200 "text/html" $result
Index: openacs-4/packages/ajax-filestorage-ui/www/xmlhttp/rename-fsitem.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/ajax-filestorage-ui/www/xmlhttp/rename-fsitem.tcl,v
diff -u -r1.1 -r1.2
--- openacs-4/packages/ajax-filestorage-ui/www/xmlhttp/rename-fsitem.tcl	26 Nov 2007 12:52:46 -0000	1.1
+++ openacs-4/packages/ajax-filestorage-ui/www/xmlhttp/rename-fsitem.tcl	27 Dec 2008 06:27:25 -0000	1.2
@@ -9,11 +9,11 @@
     newname
     object_id
     type
-    url:optional
+    {url ""}
 }
 
-# make sure user is logged in
-set user_id [auth::require_login]
+set user_id [ad_conn user_id]
+set result "{\"success\":true,\"newname\":\"$newname\",\"type\":\"$type\",\"url\":\"$url\"}"
 
 # check permissions on parent folder
 # see if the user has write
@@ -22,12 +22,10 @@
         -object_id $object_id \
         -privilege "write"] } {
 
-    ns_return 500 "text/html" "You do not have permission to rename."
+    ns_return 500 "text/html" "{\"success\":false,\"error\":\"You do not have permission to rename.\"}"
     ad_script_abort
 }
 
-set result "{\"success\":true }"
-
 # change the name of the give object_id
 if { [exists_and_not_null newname] } {
     # determine if this is a folder or file
@@ -42,7 +40,9 @@
             db_dml dbqd.file-storage.www.file-edit-2.edit_title {}
         }
     } on_error {
-        ns_return 500 "text/html"  "{\"success\":false,\"error\":\"$errmsg\"}"
+        ns_return 500 "text/html" "{\"success\":false,\"error\":\"$errmsg\"}"
         ad_script_abort
     }
+} else {
+    set result "{\"success\":false,\"error\":\"You must provide a new name\"}"
 }
\ No newline at end of file