Initial Config Theme & File Store Changes

Update theme & remove dynatree requirement
This commit is contained in:
Gary Sharp
2014-04-13 20:19:02 +10:00
parent 41dc002ef8
commit a4f4b7d0b3
34 changed files with 1048 additions and 813 deletions
@@ -2,7 +2,7 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.34011
// Runtime Version:4.0.30319.34014
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
@@ -48,8 +48,8 @@ namespace Disco.Web.Views.InitialConfig
#line 2 "..\..\Views\InitialConfig\FileStore.cshtml"
ViewBag.Title = null;
Html.BundleDeferred("~/Style/jQueryUI/dynatree");
Html.BundleDeferred("~/ClientScripts/Modules/jQueryUI-DynaTree");
Html.BundleDeferred("~/Style/Fancytree");
Html.BundleDeferred("~/ClientScripts/Modules/jQuery-Fancytree");
#line default
@@ -179,6 +179,8 @@ WriteLiteral(" id=\"dialogWait\"");
WriteLiteral(" title=\"Please Wait\"");
WriteLiteral(" class=\"dialog\"");
WriteLiteral(">\r\n <h2><span");
WriteLiteral(" class=\"ajaxLoading\"");
@@ -190,6 +192,8 @@ WriteLiteral(" id=\"dialogCreateDirectory\"");
WriteLiteral(" title=\"Create Directory\"");
WriteLiteral(" class=\"dialog\"");
WriteLiteral(">\r\n <h2>Create Directory</h2>\r\n <input");
WriteLiteral(" type=\"text\"");
@@ -202,130 +206,95 @@ WriteLiteral(" id=\"createDirectoryParent\"");
WriteLiteral(" class=\"code\"");
WriteLiteral("></span></div>\r\n</div>\r\n<script>\r\n (function () {\r\n var fileSystemBranc" +
"hUrl = \'");
WriteLiteral("></span></div>\r\n</div>\r\n<script>\r\n (function () {\r\n var tree = null;\r\n " +
" var $tree = $(\'#treeFilesystem\');\r\n var $dialogCreateDirectory;\r\n " +
" var fileSystemBranchUrl = \'");
#line 51 "..\..\Views\InitialConfig\FileStore.cshtml"
#line 54 "..\..\Views\InitialConfig\FileStore.cshtml"
Write(Url.Action(MVC.InitialConfig.FileStoreBranch()));
#line default
#line hidden
WriteLiteral("\';\r\n var fileSystemInitialBranches = null;\r\n var fileSystemBranchSe" +
"lected = null;\r\n var $treeFilesystem = $(\'#treeFilesystem\');\r\n\r\n v" +
"ar nodeDataLoaded = function (node) {\r\n var addedNodes = [];\r\n " +
" var previousUpdateMode = node.tree.enableUpdate(false);\r\n var de" +
"scriptor = node.data.fileSystemDescriptor;\r\n // Sub Folders\r\n " +
" if (descriptor.SubDirectories) {\r\n var hasSubDirectories = fa" +
"lse;\r\n for (var k in descriptor.SubDirectories) {\r\n " +
" hasSubDirectories = true;\r\n var d = descriptor.SubDirec" +
"tories[k];\r\n var n = node.addChild({ key: d.Path, title: d.Is" +
"New ? d.Name + \' [New]\' : d.Name, tooltip: d.Path, unselectable: !d.Selectable, " +
"addClass: \'directory\', isLazy: true, isFolder: true, fileSystemDescriptor: d });" +
"\r\n addedNodes.push(n);\r\n\r\n if (d.SubDirect" +
"ories) {\r\n nodeDataLoaded(n);\r\n }\r\n " +
" }\r\n if (!hasSubDirectories) {\r\n /" +
"/ Leaf\r\n node.data.isLazy = false;\r\n if (!" +
"fileSystemInitialBranches)\r\n node.render();\r\n " +
" }\r\n }\r\n node.setLazyNodeStatus(DTNodeStatus_Ok);\r\n " +
" node.tree.enableUpdate(previousUpdateMode);\r\n return addedNod" +
"es;\r\n }\r\n var loadNodeData = function (node) {\r\n var de" +
"scriptor = node.data.fileSystemDescriptor;\r\n\r\n if (!descriptor.SubDir" +
"ectories) {\r\n $.ajax({\r\n url: fileSystemBranch" +
"Url,\r\n dataType: \'json\',\r\n data: { Path: d" +
"escriptor.Path },\r\n success: function (data) {\r\n " +
" node.data.fileSystemDescriptor = data;\r\n retur" +
"n nodeDataLoaded(node);\r\n },\r\n error: func" +
"tion () {\r\n alert(\'Unable to access this path: \' + descri" +
"ptor.Path);\r\n node.remove();\r\n }\r\n " +
" })\r\n } else {\r\n return nodeDataLoaded(node" +
");\r\n }\r\n }\r\n var lazyLoadNode = function (node) {\r\n " +
" if (node.data.fileSystemDescriptor) {\r\n node.setLazyNodeS" +
"tatus(DTNodeStatus_Loading);\r\n loadNodeData(node);\r\n }" +
" else {\r\n node.setLazyNodeStatus(DTNodeStatus_Ok);\r\n }" +
"\r\n }\r\n var activeNodeUpdated = function () {\r\n var acti" +
"veNode = $(\"#treeFilesystem\").dynatree(\"getActiveNode\");\r\n\r\n if (acti" +
"veNode !== null) {\r\n fileSystemBranchSelected = activeNode.data.f" +
"ileSystemDescriptor;\r\n } else {\r\n fileSystemBranchSele" +
"cted = null\r\n }\r\n\r\n if (fileSystemBranchSelected !== null)" +
" {\r\n $(\'#locationPath\').text(fileSystemBranchSelected.Path);\r\n " +
" $(\'#createDirectory\').attr(\'disabled\', false);\r\n if " +
"(fileSystemBranchSelected.Selectable) {\r\n $(\'#submitForm\').at" +
"tr(\'disabled\', false);\r\n $(\'#locationPathInvalid\').hide();\r\n " +
" } else {\r\n $(\'#submitForm\').attr(\'disabled\', t" +
"rue);\r\n $(\'#locationPathInvalid\').show();\r\n }\r" +
"\n } else {\r\n $(\'#createDirectory\').attr(\'disabled\', tr" +
"ue);\r\n $(\'#submitForm\').attr(\'disabled\', true);\r\n " +
"$(\'#locationPath\').text(\'<None>\');\r\n $(\'#locationPathInvalid\').sh" +
"ow();\r\n }\r\n }\r\n var scrollToNode = function (node) {\r\n " +
" var $li = $(node.li);\r\n var $treeRoot = $($treeFilesystem." +
"dynatree(\'getRoot\').ul);\r\n var ih = $li.height();\r\n var th" +
" = $treeRoot.height();\r\n var ts = $treeRoot.scrollTop();\r\n " +
" var is = $li.position().top;\r\n if ((ih + is) > th) {\r\n " +
" if (ih > th) {\r\n $treeRoot.animate({ \'scrollTop\': (is + ts)" +
" }, \'fast\');\r\n } else {\r\n $treeRoot.animate({ " +
"\'scrollTop\': (ih + is + ts - th) }, \'fast\');\r\n }\r\n }\r\n" +
" }\r\n var nodeExpanded = function (flag, node) {\r\n if (f" +
"lag)\r\n window.setTimeout(function () { scrollToNode(node); }, 1);" +
"\r\n }\r\n var nodeDeactivated = function () {\r\n activeNode" +
"Updated();\r\n }\r\n var nodeActivated = function (node) {\r\n " +
" activeNodeUpdated();\r\n nodeExpanded(true, node);\r\n }\r\n\r\n " +
" $(function () {\r\n $(\'#dialogWait\').dialog({\r\n auto" +
"Open: false,\r\n draggable: false,\r\n modal: true,\r\n " +
" resizable: false,\r\n width: 400,\r\n h" +
"eight: 150,\r\n closeOnEscape: false\r\n }).closest(\'.ui-d" +
"ialog\').find(\'.ui-dialog-titlebar-close\').hide();\r\n\r\n $(\'#dialogCreat" +
"eDirectory\').dialog({\r\n autoOpen: false,\r\n draggab" +
"le: false,\r\n modal: true,\r\n resizable: false,\r\n " +
" width: 400,\r\n height: 180,\r\n buttons:" +
" {\r\n \'Cancel\': function () {\r\n $(\'#dia" +
"logCreateDirectory\').dialog(\'close\');\r\n },\r\n " +
" \'Create Directory\': function () {\r\n var activeNode = $" +
"(\"#treeFilesystem\").dynatree(\"getActiveNode\");\r\n if (acti" +
"veNode) {\r\n var name = $(\'#createDirectoryName\').val(" +
");\r\n d = {\r\n Name: nam" +
"e,\r\n Path: fileSystemBranchSelected.Path.charAt(f" +
"ileSystemBranchSelected.Path.length - 1) === \'\\\\\' ? fileSystemBranchSelected.Pat" +
"h + name : fileSystemBranchSelected.Path + \'\\\\\' + name,\r\n " +
" IsNew: true,\r\n Selectable: true,\r\n " +
" SubDirectories: {}\r\n }\r\n " +
" activeNode.addChild({ title: d.Name + \' [New]\', tooltip" +
": d.Path, unselectable: !d.Selectable, addClass: \'newDirectory\', isLazy: false, " +
"isFolder: true, fileSystemDescriptor: d }).activate();\r\n " +
"}\r\n $(\'#dialogCreateDirectory\').dialog(\'close\');\r\n " +
" }\r\n }\r\n })\r\n\r\n $(\'#createDirec" +
"tory\').click(function () {\r\n if (fileSystemBranchSelected) {\r\n " +
" $(\'#dialogCreateDirectory\').dialog(\'open\');\r\n " +
" $(\'#createDirectoryName\').val(\'\').focus();\r\n $(\'#createDire" +
"ctoryParent\').text(fileSystemBranchSelected.Path);\r\n }\r\n " +
" return false;\r\n });\r\n\r\n $(\'#submitForm\').closest(\'f" +
"orm\').submit(function () {\r\n if (fileSystemBranchSelected && file" +
"SystemBranchSelected.Selectable) {\r\n if ($(this).valid()) {\r\n" +
" $(\'#dialogWait\').dialog(\'open\');\r\n " +
" $(\'#FileStoreLocation\').val(fileSystemBranchSelected.Path);\r\n " +
" }\r\n return true;\r\n } else {\r\n " +
" alert(\'Invalid FileStore Location\');\r\n return false;\r\n " +
" }\r\n });\r\n\r\n $treeFilesystem.dynatree({ onLa" +
"zyRead: lazyLoadNode, onActivate: nodeActivated, onDeactivate: nodeDeactivated, " +
"onExpand: nodeExpanded });\r\n var rootNode = $treeFilesystem.dynatree(" +
"\'getRoot\');\r\n\r\n var previousUpdateMode = rootNode.tree.enableUpdate(f" +
"alse);\r\n rootNode.data.fileSystemDescriptor = fileSystemInitialBranch" +
"es[0];\r\n loadNodeData(rootNode);\r\n rootNode.tree.enableUpd" +
"ate(previousUpdateMode);\r\n\r\n var initialValue = $(\'#FileStoreLocation" +
"\').val();\r\n if (initialValue) {\r\n var initialNode = ro" +
"otNode.tree.getNodeByKey(initialValue);\r\n if (initialNode)\r\n " +
" initialNode.activate();\r\n }\r\n\r\n fileSystemI" +
"nitialBranches = null;\r\n });\r\n\r\n\r\n fileSystemInitialBranches = [");
WriteLiteral("\';\r\n var rootNodes = processNode(");
#line 247 "..\..\Views\InitialConfig\FileStore.cshtml"
Write(new HtmlString(Json.Encode(Model.DirectoryModel)));
#line 55 "..\..\Views\InitialConfig\FileStore.cshtml"
Write(new HtmlString(Json.Encode(Model.DirectoryModel)));
#line default
#line hidden
WriteLiteral("];\r\n })();\r\n</script>\r\n");
WriteLiteral(").children;\r\n\r\n function processNodes(nodes) {\r\n return $.map(n" +
"odes, processNode);\r\n }\r\n function processNode(node) {\r\n " +
" var children = null;\r\n if (node.SubDirectories) {\r\n " +
"children = $.map(node.SubDirectories, processNode);\r\n }\r\n " +
"return {\r\n title: node.IsNew ? node.Name + \' [New]\' : node.Name,\r" +
"\n key: node.Path,\r\n folder: true,\r\n " +
" expanded: !!children,\r\n unselectable: !node.Selectable,\r\n " +
" tooltip: node.Path,\r\n children: children,\r\n " +
" lazy: !children\r\n };\r\n }\r\n\r\n tree = $tree.fancytree(" +
"{\r\n source: rootNodes,\r\n checkbox: false,\r\n sel" +
"ectMode: 1,\r\n keyboard: false,\r\n lazyload: function (e, da" +
"ta) {\r\n var node = data.node;\r\n data.result = {\r\n " +
" url: fileSystemBranchUrl,\r\n data: { Path: " +
"node.key },\r\n cache: false\r\n }\r\n }," +
"\r\n postProcess: function (e, data) {\r\n data.result = p" +
"rocessNode(data.response).children;\r\n },\r\n activate: funct" +
"ion (e, data) {\r\n var node = data.node;\r\n\r\n if (no" +
"de.unselectable) {\r\n $(\'#submitForm\').prop(\'disabled\', true);" +
"\r\n $(\'#locationPathInvalid\').show();\r\n } else " +
"{\r\n $(\'#submitForm\').prop(\'disabled\', false);\r\n " +
" $(\'#locationPathInvalid\').hide();\r\n }\r\n\r\n $(" +
"\'#createDirectory\').prop(\'disabled\', false);\r\n $(\'#locationPath\')" +
".text(node.key);\r\n\r\n }\r\n }).fancytree(\'getTree\');\r\n\r\n v" +
"ar initalValue = $(\'#FileStoreLocation\').val();\r\n if (initalValue) {\r\n " +
" var initialNode = tree.getNodeByKey(initalValue);\r\n if (init" +
"ialNode) {\r\n initialNode.setActive(true);\r\n }\r\n " +
" }\r\n\r\n $(\'#createDirectory\').click(function () {\r\n if (!$(this" +
").prop(\'disabled\')) {\r\n\r\n // Create Dialog\r\n if (!" +
"$dialogCreateDirectory) {\r\n $(\'#dialogCreateDirectory\').dialo" +
"g({\r\n autoOpen: false,\r\n draggable" +
": false,\r\n modal: true,\r\n resizabl" +
"e: false,\r\n width: 400,\r\n height: " +
"200,\r\n buttons: {\r\n \'Cancel\': " +
"function () {\r\n $(\'#dialogCreateDirectory\').dialo" +
"g(\'close\');\r\n },\r\n \'Create" +
" Directory\': function () {\r\n var dirName = $(\'#cr" +
"eateDirectoryName\').val();\r\n if (!!dirName) {\r\n " +
" var activeNode = tree.getActiveNode();\r\n " +
" if (activeNode) {\r\n " +
" var parentPath = activeNode.key;\r\n " +
" var path = parentPath.charAt(parentPath.length - 1) === \'\\\\\' ? parentPath + d" +
"irName : parentPath + \'\\\\\' + dirName;\r\n n" +
"ode = {\r\n title: dirName + \' [New]\',\r" +
"\n key: path,\r\n " +
" folder: true,\r\n " +
"expanded: false,\r\n unselectable: fals" +
"e,\r\n tooltip: path,\r\n " +
" lazy: false\r\n " +
" }\r\n activeNode.addNode(node).setActive(t" +
"rue);\r\n }\r\n }\r" +
"\n $(\'#dialogCreateDirectory\').dialog(\'close\');\r\n " +
" }\r\n }\r\n })\r" +
"\n }\r\n\r\n var activeNode = tree.getActiveNode();\r\n " +
" if (activeNode) {\r\n $(\'#dialogCreateDirectory\')" +
".dialog(\'open\');\r\n $(\'#createDirectoryName\').val(\'\').focus();" +
"\r\n $(\'#createDirectoryParent\').text(activeNode.key);\r\n " +
" }\r\n\r\n return false;\r\n }\r\n });\r\n\r\n " +
" $(\'#submitForm\').closest(\'form\').submit(function () {\r\n var active" +
"Node = tree.getActiveNode();\r\n if (activeNode && !activeNode.unselect" +
"able) {\r\n $(\'#FileStoreLocation\').val(activeNode.key);\r\n " +
" if ($(this).valid()) {\r\n $(\'#dialogWait\').dialog({\r\n " +
" autoOpen: true,\r\n draggable: false," +
"\r\n modal: true,\r\n resizable: false" +
",\r\n width: 400,\r\n height: 150,\r\n " +
" closeOnEscape: false\r\n }).closest(\'.ui-" +
"dialog\').find(\'.ui-dialog-titlebar-close\').hide();\r\n }\r\n " +
" return true;\r\n } else {\r\n alert(\'Invalid FileSt" +
"ore Location\');\r\n return false;\r\n }\r\n });\r\n " +
"})();\r\n</script>\r\n");
}
}