2 ================================================================================
4 ================================================================================
5 Copyright (C) 2017 AT&T Intellectual Property
6 ================================================================================
7 Licensed under the Apache License, Version 2.0 (the "License");
8 you may not use this file except in compliance with the License.
9 You may obtain a copy of the License at
11 http://www.apache.org/licenses/LICENSE-2.0
13 Unless required by applicable law or agreed to in writing, software
14 distributed under the License is distributed on an "AS IS" BASIS,
15 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 See the License for the specific language governing permissions and
17 limitations under the License.
18 ================================================================================
20 <%@page import="org.openecomp.portalsdk.analytics.system.AppUtils" %>
23 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
25 <jsp:include page="header.jsp" flush="true" />
27 <meta http-equiv="content-type" content="text/html;charset=iso-8859-1">
28 <title>Folder tree with Drag and Drop capabilities</title>
30 var imgFolder = '<%=AppUtils.getImgFolderURL()%>';
32 <script type="text/javascript" src="<%= AppUtils.getBaseFolderURL() %>js/tree/ajax.js"></script>
33 <script type="text/javascript" src="<%= AppUtils.getBaseFolderURL() %>js/tree/context-menu.js"></script>
34 <script type="text/javascript" src="<%= AppUtils.getBaseFolderURL() %>js/tree/drag-drop-folder-tree.js">
36 /************************************************************************************************************
37 (C) www.dhtmlgoodies.com, July 2006
42 This is a script from www.dhtmlgoodies.com. You will find this and a lot of other scripts at our website.
45 You are free to use this script as long as the copyright message is kept intact.
47 For more detailed license information, see http://www.dhtmlgoodies.com/index.html?page=termsOfUse
54 ************************************************************************************************************/
56 <link rel="stylesheet" type="text/css" href="<%= AppUtils.getBaseFolderURL() %>css/raptor.css">
57 <link rel="stylesheet" type="text/css" href="<%= AppUtils.getBaseFolderURL() %>css/tree/drag-drop-folder-tree.css">
58 <link rel="stylesheet" type="text/css" href="<%= AppUtils.getBaseFolderURL() %>css/tree/context-menu.css">
60 <style type="text/css">
61 /* CSS for the demo */
66 <script type="text/javascript">
67 //--------------------------------
69 //--------------------------------
70 var ajaxObjects = new Array();
72 // Use something like this if you want to save data by Ajax.
75 saveString = treeObj.getNodeOrders();
77 var ajaxIndex = ajaxObjects.length;
78 ajaxObjects[ajaxIndex] = new sack();
81 ajaxObjects[ajaxIndex].requestFile = url; // Specifying which file to get
82 ajaxObjects[ajaxIndex].onCompletion = function() { saveComplete(ajaxIndex); } ; // Specify function that will be executed after file has been found
83 ajaxObjects[ajaxIndex].runAJAX(url); // Execute AJAX function
86 function saveComplete(index)
88 alert(ajaxObjects[index].response);
92 // Call this function if you want to save it by a form.
93 function saveMyTree_byForm()
95 document.myForm.elements['saveString'].value = treeObj.getNodeOrders();
96 document.myForm.elements['task'].value = 'save';
97 document.myForm.submit();
100 function cancelMyTree_byForm(){
101 document.myForm.elements['task'].value = '';
102 document.myForm.submit();
105 function deleteMyTree_byForm()
107 document.myForm.elements['task'].value = 'delete';
108 document.myForm.submit();
111 function addMyTree_byForm()
113 document.myForm.elements['task'].value = 'new';
114 document.myForm.submit();
119 var id = JSTreeObj.selectedItem.parentNode.id.replace(/[^0-9]/gi,'');
121 //document.myForm.action='<%=AppUtils.getReportExecuteActionURL()%>'+JSTreeObj.selectedItem;
122 document.myForm.action='dispatcher?action=raptor&r_action=report.run&c_master=' + id + '&PAGE_ID=HOME&refresh=Y';
124 document.myForm.submit();
127 function editReport()
129 var id = JSTreeObj.selectedItem.parentNode.id.replace(/[^0-9]/gi,'');
131 document.myForm.action='dispatcher?action=raptor&r_action=report.edit&c_master=' + id + '&PAGE_ID=HOME&refresh=Y';
132 document.myForm.submit();
135 function expandTree(){
136 document.getElementById('expandedTree').style.display='block';
137 document.getElementById('expandedTreeHeader').style.display='block';
138 document.getElementById('collapsedTree').style.display='none';
140 function collapseTree(){
141 document.getElementById('expandedTree').style.display='none';
142 document.getElementById('expandedTreeHeader').style.display='none';
143 document.getElementById('collapsedTree').style.display='block';
149 <form name="reportForm" method="post">
150 <table width="94%" border="0" cellspacing="1" align="center">
152 <div id="collapsedTree" style="position:absoulte;top:0;width:100%;height:25px;display:none;">
153 <table width="94%" border="0" cellspacing="1" align="left">
155 <td class=rtabletext align=left>
156 <img border="0" src="<%= AppUtils.getImgFolderURL() %>tree/dhtmlgoodies_plus.gif" onClick="javascript:expandTree()" alt='Show Folder Tree'>
166 <div id="expandedTreeHeader" style="position:absoulte;top:0;width:100%;height:25px;display:block;">
167 <table width="94%" border="0" cellspacing="1" align="left">
169 <td class=rtabletext >
170 <img border="0" src="<%= AppUtils.getImgFolderURL() %>tree/dhtmlgoodies_minus.gif" onClick="javascript:collapseTree()" alt='Hide Folder Tree'>
172 <!--<input type='button' class=rsmallbutton id='createFolder' value='Create Folder' onclick='javascript:JSTreeObj.addItem(JSTreeObj.selectedItem, JSTreeObj.selectedItem);'/>
173 <input type='button' class=rsmallbutton id='createFolder' value='Run' onclick='javascript:JSTreeObj.addItem(JSTreeObj.selectedItem, JSTreeObj.selectedItem);'/>
174 <input type='button' class=rsmallbutton id='createFolder' value='Edit' onclick='javascript:JSTreeObj.addItem(JSTreeObj.selectedItem, JSTreeObj.selectedItem);'/>-->
175 <a href="#" onclick='javascript:JSTreeObj.addItem(JSTreeObj.selectedItem, JSTreeObj.selectedItem);'>Create Folder</a> |
176 <a href="#" onclick='javascript:JSTreeObj.deleteItem(JSTreeObj.selectedItem, JSTreeObj.selectedItem);'>Delete Fodler</a> |
177 <a href="#" onclick='javascript:runReport();'>Run Report</a> |
178 <a href="#" onclick='javascript:editReport();'>Edit Report</a>
186 <div id="expandedTree" style="position:absoulte;top:0;width:100%;height:160px;display:block">
191 <div id="scrollableTable" class="scrollableTable" style="position:absoulte;top:0;width:100%;height:150px;display:block">
192 <table width="94%" border="0" cellspacing="1" align="center">
195 <%=request.getAttribute("folderList")%>
201 <td width="50%" valign="bottom">
203 <tr><td width="100%" class=rtabletext >
204 <a href="#" onclick="treeObj.collapseAll()">Collapse all</a> |
205 <a href="#" onclick="treeObj.expandAll()">Expand all</a>
207 <tr><td width="100%">
208 <input type="button" class=rsmallbutton onclick="saveMyTree_byForm()" value="Save">
209 <input type="button" class=rsmallbutton onclick="cancelMyTree_byForm()" value="Cancel">
221 <div class="scrollableTable" style="width:100%;height:400px;">
222 <iframe id="reportFrame" name="reportFrame" width="100%" height="100%">
229 <script type="text/javascript">
230 treeObj = new JSDragDropTree();
231 treeObj.setTreeId('reportFolderTree');
232 treeObj.setMaximumDepth(7);
233 treeObj.setMessageMaximumDepthReached('Maximum depth reached'); // If you want to show a message when maximum depth is reached, i.e. on drop.
239 <!-- Form - if you want to save it by form submission and not Ajax -->
240 <form name="myForm" action="tree" method="post">
241 <input type="hidden" name="saveString">
242 <input type="hidden" name="task">
243 <input type="hidden" name="newName">
244 <input type="hidden" name="deleteIds">