| <asp:Content ID="Content1" ContentPlaceHolderID="MasterContentPlaceHolder" runat="Server"> |
| |
| <script language="javascript" type="text/javascript"> |
| |
| function OnClientFileOpen(oExplorer, args) { |
| var item = args.get_item(); |
| var fileExtension = item.get_extension(); |
| // File is a image document, do not open a new window |
| args.set_cancel(true); |
| |
| // Tell browser to open file directly |
| var requestImage = "FileSystemHandler.ashx?path=" + item.get_url(); |
| document.location = requestImage; |
| //} |
| } |
| |
| |
| function toolbarClicked(toolbar, args) { |
| debugger |
| var buttonValue = args.get_item().get_value(); |
| if (buttonValue == "Archive") |
| DoPostBack(); |
| } |
| |
| function gridContextMenuClicked(toolbar, args) { |
| debugger |
| var buttonValue = args.get_item().get_value(); |
| //var filename = args._targetElement.childNodes[0].nodeValue; |
| //var test = filename; |
| //var buttontext = args.get_node().get_contextMenu().get_selectedValue(); |
| if (buttonValue == "Archive") { |
| DoPostBack(); |
| } |
| |
| //var filelocation = "Z:\testdmsdocs\SharedDocuments" + filename.get_url(); |
| //document.location = filelocation; |
| |
| |
| |
| } |
| |
| function treeContextMenuClicked(toolbar, args) { |
| debugger |
| var buttonValue = args.get_menuItem().get_value(); |
| if (buttonValue == "custom_Menu") |
| DoPostBack(); |
| } |
| |
| function DoPostBack() { |
| __doPostBack('Archive', 'Archive'); |
| } |
| |
| function attachHandlers(explorer, args) { |
| |
| var toolbar = explorer.get_toolbar(); |
| toolbar.add_buttonClicked(toolbarClicked); |
| //support for tree context menu |
| var tree = explorer.get_tree(); |
| tree.add_contextMenuItemClicked(treeContextMenuClicked); |
| //support for grid context menu |
| var gridContextMenu = explorer.get_gridContextMenu(); |
| gridContextMenu.add_itemClicked(gridContextMenuClicked); |
| } |
| |
| function OnClientDelete(oExplorer, args) { |
| |
| var isRoot = isRootDir(oExplorer.get_tree(), args.get_path()); |
| // Check whether the moved item is a directorty and whether it is the root directory; |
| if (args.get_item().isDirectory() && isRoot) { |
| alert("You cannot delete the root directory"); |
| args.set_cancel(true); |
| } |
| |
| } |
| |
| function OnClientMove(oExplorer, args) { |
| |
| var isRoot = isRootDir(oExplorer.get_tree(), args.get_path()); |
| // Check whether the moved item is a directorty and whether it is the root directory; |
| if (args.get_item().isDirectory() && isRoot) { |
| // Check whether this is a renaming ; |
| if (isRenaming(args.get_newPath())) {// The renaming operation ; |
| alert("You cannot rename the root directory"); |
| args.set_cancel(true); |
| } |
| } |
| } |
| |
| function isRootDir(oTree, path) { |
| var dirForDelete = oTree.findNodeByValue(path); |
| |
| if (dirForDelete != null) { |
| return dirForDelete.get_level() == 0; |
| } |
| // Will occurs only when the "path" parameter is not a valid folder path. |
| else return false |
| } |
| |
| function isRenaming(destPath) { |
| if (destPath.search("/\//") == -1) { |
| return true; |
| } |
| else { |
| return false; |
| } |
| } |
| |
| </script> |
| |
| <style type="text/css"> |
| .test_button span span span span |
| { |
| background-image: none !important; |
| padding-left: 2px !important; |
| border: solid 1px grey; |
| } |
| </style> |
| <table width="100%"> |
| <tr> |
| <td> |
| <%-- <div id="eventConsole" style="height: 470px; width: 300px; overflow: auto; display:none;"> |
| </div>--%> |
| <telerik:RadFileExplorer runat="server" ID="DocumentsRadFileExplorer" Width="734px" |
| Height="400px" VisibleControls="All" EnableCreateNewFolder="true" EnableCopy="true" |
| EnableOpenFile="true" OnClientMove="OnClientMove" OnClientDelete="OnClientDelete" |
| OnClientLoad="attachHandlers" |
| OnClientFileOpen="OnClientFileOpen" |
| ongridpopulated="DocumentsRadFileExplorer_GridPopulated"> |
| <Configuration SearchPatterns="*.*" MaxUploadFileSize="10485760"></Configuration> |
| </telerik:RadFileExplorer> |
| </td> |
| </tr> |
| </table> |
| </asp:Content> |
| |