diff options
author | Ted Trask <ttrask01@yahoo.com> | 2009-01-10 14:41:21 +0000 |
---|---|---|
committer | Ted Trask <ttrask01@yahoo.com> | 2009-01-10 14:41:21 +0000 |
commit | 7716b7414ada4e16bbdc5385df01077aa028e672 (patch) | |
tree | f61d0cb039806ce775a3f32d4aedd84f4bac2691 | |
parent | f524a6f6edf59eaf6e20043d4e54fe866f7f1357 (diff) | |
download | acf-opennhrp-7716b7414ada4e16bbdc5385df01077aa028e672.tar.bz2 acf-opennhrp-7716b7414ada4e16bbdc5385df01077aa028e672.tar.xz |
Modified opennhrp to ignore comments in config and disable unused fields in editinterface.
git-svn-id: svn://svn.alpinelinux.org/acf/opennhrp/trunk@1674 ab2d0c66-481e-0410-8bed-d214d4d58bed
-rw-r--r-- | opennhrp-editinterface-html.lsp | 15 | ||||
-rw-r--r-- | opennhrp-model.lua | 5 |
2 files changed, 19 insertions, 1 deletions
diff --git a/opennhrp-editinterface-html.lsp b/opennhrp-editinterface-html.lsp index 73af9ab..67898e7 100644 --- a/opennhrp-editinterface-html.lsp +++ b/opennhrp-editinterface-html.lsp @@ -2,6 +2,21 @@ require("viewfunctions") %> +<script type="text/javascript" src="/js/jquery-latest.js"></script> +<script type="text/javascript"> + function enabledisable(){ + if ($("[name='type']").val() == "NHRP Enabled") { + $("[name='map']").attr("disabled", ""); + } else { + $("[name='map']").attr("disabled", "disabled"); + } + } + $(function(){ + $("[name='type']").change(enabledisable); + enabledisable(); + }); +</script> + <H1><%= form.label %></H1> <% form.value.interface.contenteditable = false diff --git a/opennhrp-model.lua b/opennhrp-model.lua index ef9c69a..78338f9 100644 --- a/opennhrp-model.lua +++ b/opennhrp-model.lua @@ -52,7 +52,10 @@ local function parseconfigfile(configfilecontent) local currentinterface local words = {} - for word in configfilecontent:gmatch("%S+") do words[#words + 1] = word end + -- remove comments, and then parse word-by-word + for word in string.gmatch(string.gsub(configfilecontent, "#[^\n]*", ""), "%S+") do + words[#words + 1] = word + end local i=1 while i <= table.maxn(words) do local word = words[i] |