blob: 07e0640eacfddd41978a8b0254b647ae67595d8b [file] [log] [blame]
<?xml version="1.0" encoding="UTF-8" ?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<library>
<!-- ###################
Class fileExplorer
-->
<class name="fileExplorer" extends="view" >
<attribute name="parentFolderId" value="-2" type="number" />
<attribute name="_selected" value="null" />
<event name="onClose"/>
<handler name="oninit">
canvas.currentFileExplorer = this;
lz.Track.register(this._trashBar._trashIcon, canvas.currentImagesListdraw.currentTrackGroupName);
</handler>
<handler name="onvisible">
if ($debug) Debug.write("fileExplorer::onvisible this._selected ",this._selected);
//This is thrown whenever an uploaded Document has completed
if (this._selected == null) {
this.loadFiles();
} else {
if (this._selected.isFolder) {
this._selected.refresh();
} else {
this.loadFiles();
}
}
</handler>
<method name="selectItem" args="itemRef">
if (this._selected != null) {
this._selected.deselectItem();
}
this._selected = itemRef;
this._selected.selectItem();
//Set parent folder id for next Folder or uploaded file
if (this._selected.fileExplorerItemId == 0) {
if (this._selected.isOwner) {
this.parentFolderId = -2;
} else {
this.parentFolderId = 0;
}
} else {
this.parentFolderId = this._selected.fileExplorerItemId;
}
</method>
<method name="addFile">
<![CDATA[
if ($debug) Debug.write("addFile :: ",this._selected,this.parentFolderId);
if (!canvas.isAllowedToDraw && !canvas.ismoderator) {
new lz.labelerrorPopup(canvas,{errorlabelid:1462});
return;
}
var isOwner = 0;
if (this.parentFolderId == -2) {
isOwner = 1;
} else {
//Check if its a subfolder of a Owners Dir
if (this._selected != null) {
var checkForOwer = this._selected.checkForIsOwner();
if ($debug) Debug.write("checkForOwer ::",checkForOwer);
if (checkForOwer) {
isOwner = 1;
}
}
}
if ($debug) Debug.write("addFile :: ",isOwner);
new lz.uploadWindowExplorer(canvas.main_content._content.inner,{
x:60,uploadmodule:canvas.uploadmoduleimg,
parentFolderId:this.parentFolderId,
isOwner:isOwner,
fileExplorerRef:this,
isOnlyImage:true,
servletName:'file.upload'
});
]]>
</method>
<method name="addFolder">
<![CDATA[
if (!canvas.isAllowedToDraw && !canvas.ismoderator) {
new lz.labelerrorPopup(canvas,{errorlabelid:1462});
return;
}
if (this._selected == null) {
if ($debug) Debug.write("addFolder ::1 ",this._selected);
this._filearea._contentarea.subviews[0].addFolder();
} else {
if (this._selected.isFolder) {
if ($debug) Debug.write("-1 this._selected.isFolder ",this._selected);
this._selected.addFolder();
} else {
if ($debug) Debug.write("-2 !this._selected.isFolder ",this._selected);
this._selected.parent.parent.addFolder();
}
}
]]>
</method>
<method name="loadWmlFile" args="itemObj">
this.selectItem(itemObj);
canvas._drawarea.prepareLoadWMLFile(itemObj);
//canvas._drawarea.loadObjectList(itemObj);
</method>
<method name="loadDocument" args="itemObj">
this.selectItem(itemObj);
this._documentsTabs.setAttribute("height",20);
this._documentsTabs.setAttribute("visibility","visible");
this._documentsTabs.hideAll();
var t = new lz.presentationPreview(this,{
documentObj:itemObj,
refObjList:this
});
//t.sendToBack();
//this._bg1.sendToBack();
//this._bg2.sendToBack();
this._documentsTabs.bringToFront();
return t;
</method>
<method name="playVideo" args="itemObj">
this.selectItem(itemObj);
canvas._drawarea.playVideoSynced(itemObj.fileExplorerItemId,itemObj.fileName,itemObj.flvWidth,itemObj.flvHeight);
</method>
<method name="loadFiles">
<![CDATA[
if (this["getFileExplorerByRoomSelf"]) {
//this.getFileExplorerByRoom.doCall();
var downloadurl = canvas.getUrl()+'services/FileService/getFileExplorerByRoomSelfInternal?'
+'SID='+canvas.sessionId
+'&roomId='+hib.currentroomid;
this.getFileExplorerByRoomSelf.setAttribute("src",downloadurl);
if ($debug) Debug.write("getFileExplorerByRoomSelf doRequest 1 ",downloadurl);
this.getFileExplorerByRoomSelf.doRequest();
}
]]>
</method>
<dataset name="getFileExplorerByRoomSelf" type="http" >
<handler name="ondata" args="d">
<![CDATA[
if ($debug) Debug.write("ondata 1 ",this.src);
if ($debug) Debug.write("ondata 2 ",d);
parent.parseRootItems(parent.parseRootToRoomObject(d));
]]>
</handler>
</dataset>
<method name="parseParentToRoomObject" args="dObj">
<![CDATA[
var filesObject = new Array();
var tFiles = dObj.childNodes[0].childNodes;
if ($debug) Debug.write("parseParentToRoomObject tFiles ",tFiles);
for (var i=0;i<tFiles.length;i++) {
filesObject.push(this.parseToFileObj(tFiles[i].childNodes));
}
return filesObject;
]]>
</method>
<method name="parseRootToRoomObject" args="dObj">
<![CDATA[
var roomObject = new Object();
roomObject.userHome = new Array();
roomObject.roomHome = new Array();
roomObject.userHomeSize = 0;
roomObject.roomHomeSize = 0;
var tFiles = dObj.childNodes[0].childNodes[0].childNodes;
//if ($debug) Debug.write("tFiles ",tFiles);
for (var i=0;i<tFiles.length;i++) {
//if ($debug) Debug.write("nodeName",tFiles[i].nodeName);
if (tFiles[i].nodeName == "userHomeSize") {
if ($debug) Debug.write("roomHomeSize",tFiles[i].childNodes[0].data);
roomObject.userHomeSize = Number(tFiles[i].childNodes[0].data);
} else if (tFiles[i].nodeName == "roomHomeSize") {
if ($debug) Debug.write("roomHomeSize",tFiles[i].childNodes[0].data);
roomObject.roomHomeSize = Number(tFiles[i].childNodes[0].data);
} else if (tFiles[i].nodeName == "roomHome") {
roomObject.roomHome.push(this.parseToFileObj(tFiles[i].childNodes));
} else if (tFiles[i].nodeName == "userHome") {
roomObject.userHome.push(this.parseToFileObj(tFiles[i].childNodes));
}
}
return roomObject;
]]>
</method>
<method name="parseToFileObj" args="dObj">
<![CDATA[
var tFileObj = new Object();
var type = "string";
for (var i=0;i<dObj.length;i++) {
type = "string";
switch (dObj[i].nodeName){
case "externalFileId":
type = "int";
break;
case "fileExplorerItemId":
type = "int";
break;
case "fileSize":
type = "int";
break;
case "flvHeight":
type = "int";
break;
case "flvWidth":
type = "int";
break;
case "insertedBy":
type = "int";
break;
case "isChart":
type = "boolean";
break;
case "isFolder":
type = "boolean";
break;
case "isImage":
type = "boolean";
break;
case "isPresentation":
type = "boolean";
break;
case "isStoredWmlFile":
type = "boolean";
break;
case "isVideo":
type = "boolean";
break;
case "ownerId":
type = "int";
break;
case "parentFileExplorerItemId":
type = "int";
break;
case "room_id":
type = "int";
break;
default:
break;
}
//if ($debug) Debug.write("Obj attr ",dObj[i].nodeName,type);
if (dObj[i].childNodes.length > 0) {
switch (type) {
case "int":
tFileObj[dObj[i].nodeName] = Number(dObj[i].childNodes[0].data);
break;
case "boolean":
tFileObj[dObj[i].nodeName] = (dObj[i].childNodes[0].data == "true") ? true : false;
break;
default:
tFileObj[dObj[i].nodeName] = dObj[i].childNodes[0].data;
break;
}
} else {
tFileObj[dObj[i].nodeName] = null;
}
//if ($debug) Debug.write("Obj attr ",dObj[i].nodeName,tFileObj[dObj[i].nodeName]);
}
return tFileObj;
]]>
</method>
<!--
Parse Items and generate Output
-->
<method name="parseRootItems" args="roomObject">
<![CDATA[
this.clearContent();
var homeSizeInMBytes = Math.round( (roomObject.userHomeSize / 1024 / 1024) * 100) / 100;
this._userSpace._userHomeSize.setAttribute("text","" + homeSizeInMBytes + " MBytes");
var roomHomeSizeInMBytes = Math.round( (roomObject.roomHomeSize / 1024 / 1024) * 100) / 100;
this._userSpace._roomHomeSize.setAttribute("text","" + roomHomeSizeInMBytes + " MBytes");
var homeIcon = new lz.rootFileExplorerItem(this._filearea._contentarea,{
open:true,
fileName:canvas.getLabelName(706),
name:'_home',
isRoot:true,
fileIcon:'file_explorer_folder_home_rsc',
isOwner:true,
refObjListRoot:this
});
homeIcon.content.setAttribute("visibility","visible");
homeIcon.icon_folder_pre.setAttribute("frame",2);
homeIcon._folderIcon.setAttribute("frame",2);
//Home area
for (var i=0; i<roomObject.userHome.length; i++) {
var fileExplorerItem = roomObject.userHome[i];
//if ($debug) Debug.write("fileExplorerItem, ",fileExplorerItem);
if (fileExplorerItem.isFolder) {
new lz.folderFileExplorerItem(homeIcon.content,{
fileExplorerItemId:fileExplorerItem.fileExplorerItemId,
fileName:fileExplorerItem.fileName,
fileIcon:'icon_folder_rsc',
refObjListRoot:this
});
} else if (fileExplorerItem.isImage) {
new lz.imageFileExplorerItem(homeIcon.content,{
isFolder:false,
fileExplorerItemId:fileExplorerItem.fileExplorerItemId,
fileName:fileExplorerItem.fileName,
fileHash:fileExplorerItem.fileHash,
isFolder:false,isImage:true,
fileIcon:'file_explorer_image_rsc',
refObjListRoot:this
});
} else if (fileExplorerItem.isPresentation) {
new lz.documentFileExplorerItem(homeIcon.content,{
isFolder:false,
fileExplorerItemId:fileExplorerItem.fileExplorerItemId,
fileName:fileExplorerItem.fileName,
fileHash:fileExplorerItem.fileHash,
isFolder:false,isPresentation:true,
fileIcon:'file_explorer_document_rsc',
refObjListRoot:this
});
} else if (fileExplorerItem.isVideo) {
new lz.videoFileExplorerItem(homeIcon.content,{
isFolder:false,
isVideo:true,
fileExplorerItemId:fileExplorerItem.fileExplorerItemId,
fileName:fileExplorerItem.fileName,
fileHash:fileExplorerItem.fileHash,
isFolder:false,isImage:true,
fileIcon:'file_explorer_video_rsc',
flvHeight:fileExplorerItem.flvHeight,
flvWidth:fileExplorerItem.flvWidth,
refObjListRoot:this
});
} else if (fileExplorerItem.isStoredWmlFile) {
new lz.wmlFileExplorerItem(homeIcon.content,{
isFolder:false,
fileExplorerItemId:fileExplorerItem.fileExplorerItemId,
fileName:fileExplorerItem.fileName,
fileIcon:'file_explorer_wml_rsc',
isWmlFile: true,
refObjListRoot:this
});
} else if (fileExplorerItem.isChart) {
new lz.wmlFileExplorerItem(homeIcon.content,{
isFolder:false,
fileExplorerItemId:fileExplorerItem.fileExplorerItemId,
fileName:fileExplorerItem.fileName,
fileIcon:'file_explorer_chart_rsc',
isChart:true,
refObjListRoot:this
});
}
}
//Public - Room Area
var roomHome = new lz.rootFileExplorerItem(this._filearea._contentarea,{
open:true,
fileName:canvas.getLabelName(707),
name:'_roomHome',
isRoot:true,
fileIcon:'file_explorer_folder_network_rsc',
refObjListRoot:this
});
roomHome.content.setAttribute("visibility","visible");
roomHome.icon_folder_pre.setAttribute("frame",2);
roomHome._folderIcon.setAttribute("frame",2);
//Public area
for (var i=0; i<roomObject.roomHome.length; i++) {
var fileExplorerItem = roomObject.roomHome[i];
//if ($debug) Debug.write("fileExplorerItem.fileExplorerItemId, ",fileExplorerItem.fileExplorerItemId);
//if ($debug) Debug.write("fileExplorerItem, ",fileExplorerItem);
if (fileExplorerItem.isFolder) {
new lz.folderFileExplorerItem(roomHome.content,{
fileName:fileExplorerItem.fileName,
fileExplorerItemId:fileExplorerItem.fileExplorerItemId,
fileIcon:'icon_folder_rsc',
refObjListRoot:this
});
} else if (fileExplorerItem.isImage) {
new lz.imageFileExplorerItem(roomHome.content,{
isFolder:false,
fileExplorerItemId:fileExplorerItem.fileExplorerItemId,
fileName:fileExplorerItem.fileName,
fileHash:fileExplorerItem.fileHash,
isFolder:false,isImage:true,
fileIcon:'file_explorer_image_rsc',
refObjListRoot:this
});
} else if (fileExplorerItem.isPresentation) {
new lz.documentFileExplorerItem(roomHome.content,{
isFolder:false,
fileExplorerItemId:fileExplorerItem.fileExplorerItemId,
fileName:fileExplorerItem.fileName,
fileHash:fileExplorerItem.fileHash,
isFolder:false,isPresentation:true,
fileIcon:'file_explorer_document_rsc',
refObjListRoot:this
});
} else if (fileExplorerItem.isVideo) {
new lz.videoFileExplorerItem(roomHome.content,{
isFolder:false,
isVideo:true,
fileExplorerItemId:fileExplorerItem.fileExplorerItemId,
fileName:fileExplorerItem.fileName,
fileHash:fileExplorerItem.fileHash,
isFolder:false,isImage:true,
fileIcon:'file_explorer_video_rsc',
flvHeight:fileExplorerItem.flvHeight,
flvWidth:fileExplorerItem.flvWidth,
refObjListRoot:this
});
} else if (fileExplorerItem.isStoredWmlFile) {
new lz.wmlFileExplorerItem(roomHome.content,{
isFolder:false,
fileExplorerItemId:fileExplorerItem.fileExplorerItemId,
fileName:fileExplorerItem.fileName,
fileIcon:'file_explorer_wml_rsc',
isWmlFile: true,
refObjListRoot:this
});
} else if (fileExplorerItem.isChart) {
new lz.wmlFileExplorerItem(roomHome.content,{
isFolder:false,
fileExplorerItemId:fileExplorerItem.fileExplorerItemId,
fileName:fileExplorerItem.fileName,
fileIcon:'file_explorer_chart_rsc',
isChart:true,
refObjListRoot:this
});
}
}
]]>
</method>
<method name="clearContent">
<![CDATA[
for (var eg in this._filearea._contentarea.subviews) {
this._filearea._contentarea.subviews[eg].destroy();
}
]]>
</method>
<!--
Borders
-->
<view name="_border2" x="0" y="${ 33 + parent._documentsTabs.height }" width="$once{ parent.width }"
height="1" bgcolor="$once{ canvas.getThemeColor('secondBorderColor') }" />
<!--
Documents - Tabbar
-->
<documentsTabBar name="_documentsTabs" y="14" width="$once{ parent.width }"
visibility="hidden" />
<!--
File Tree Content Tabbar
-->
<view name="_fileBar" layout="axis:x" x="0" y="${ 14 + parent._documentsTabs.height }">
<baseChooseIconView labelid="702" height="20" width="19" bgcolor="$once{ canvas.getThemeColor('secondBorderColor') }"
resourceN="file_explorer_add_file_rsc">
<handler name="onclick">
if ($debug) Debug.write("Upload File");
parent.parent.addFile();
</handler>
</baseChooseIconView>
<baseChooseIconView labelid="703" height="20" width="19" bgcolor="$once{ canvas.getThemeColor('secondBorderColor') }"
resourceN="file_explorer_add_folder_rsc" >
<handler name="onclick">
if ($debug) Debug.write("Add Folder");
parent.parent.addFolder();
</handler>
</baseChooseIconView>
<baseChooseIconView labelid="704" height="20" width="19" bgcolor="$once{ canvas.getThemeColor('secondBorderColor') }"
resourceN="file_explorer_reload_rsc" >
<handler name="onclick">
if ($debug) Debug.write("Refresh Folder");
parent.parent.loadFiles();
</handler>
</baseChooseIconView>
<view bgcolor="$once{ canvas.getThemeColor('secondBorderColor') }" height="20" width="1" />
</view>
<!--
File Tree Content Trashbar
-->
<view name="_trashBar" layout="axis:x" x="$once{ parent.width - 20 }"
y="${ 14 + parent._documentsTabs.height }">
<baseChooseIconView name="_trashIcon" labelid="705" height="20" width="19"
resourceN="file_explorer_trash_rsc" bgcolor="$once{ canvas.getThemeColor('secondBorderColor') }">
<attribute name="isTrashCan" value="true" type="boolean" />
<handler name="onclick">
if ($debug) Debug.write("Delete Folder and Files");
</handler>
<handler name="onmousetrackover">
//if ($debug) Debug.write("onmousetrackover");
canvas.currentImagesListdraw.currentDragItem.sendOverItem(this);
this.onmouseover.sendEvent();
</handler>
<handler name="onmousetrackout">
//if ($debug) Debug.write("onmousetrackout");
canvas.currentImagesListdraw.currentDragItem.sendOutItem(this);
this.onmouseout.sendEvent();
</handler>
<handler name="onmousetrackup">
if ($debug) Debug.write("onmousetrackup");
this.onmouseout.sendEvent();
</handler>
</baseChooseIconView>
<view bgcolor="0xE0E0E0" height="20" width="1" />
</view>
<!--
File Tree Content
-->
<view name="_filearea" x="1" y="${ 34 + parent._documentsTabs.height }" clip="true"
height="${ parent.height - 35 - parent._documentsTabs.height - parent._userSpace.height }"
width="$once{ parent.width }">
<attribute name="currentTrackGroupName" value="fileExplorer" type="string" />
<attribute name="currentDragItem" value="null" />
<handler name="oninit">
canvas.currentImagesListdraw = this;
</handler>
<view name="_contentarea" layout="axis:y;inset:1" />
<om_vscrollbar name="_scrollbar" />
<om_hscrollbar name="_hscrollbar" />
</view>
<view name="_userSpace" height="40" valign="bottom" width="$once{ parent.width }">
<labelText name="_userHomeSizeLabel" labelid="923" fgcolor="$once{ canvas.getThemeColor('menuTextColor') }" />
<labelText name="_userHomeSize" align="right" fgcolor="$once{ canvas.getThemeColor('menuTextColor') }" />
<labelText name="_roomHomeSizeLabel" labelid="924" y="20" fgcolor="$once{ canvas.getThemeColor('menuTextColor') }" />
<labelText name="_roomHomeSize" align="right" y="20" fgcolor="$once{ canvas.getThemeColor('menuTextColor') }" />
</view>
</class>
</library>