diff options
25 files changed, 61 insertions, 61 deletions
diff --git a/cgi-bin/provisioning.cgi b/cgi-bin/provisioning.cgi index 20f08e1..8926652 100755 --- a/cgi-bin/provisioning.cgi +++ b/cgi-bin/provisioning.cgi @@ -48,7 +48,7 @@ function http_code (code) -- redirect to same file with empty mac io.stdout:write("Location: " .. string.gsub(path_info, "%x%x%x%x%x%x%x%x%x%x%x%x", "000000000000") .. "\n") io.stdout:write("Content-Type: \n\n") - io.stdout:write("<a href=\"".. string.gsub(path_info, "%x%x%x%x%x%x%x%x%x%x%x%x", "000000000000") .."\">New Link</a>") + io.stdout:write("<a href=\"".. string.gsub(path_info, "%x%x%x%x%x%x%x%x%x%x%x%x", "000000000000") .."\">New Link</a>") elseif code == 404 then io.stdout:write("Status: 404 Not Found\n") io.stdout:write("Content-Type: \n\n") @@ -97,7 +97,7 @@ if ( request_method == "GET" ) then end -- don't even bother for files that don't contain a MAC - if mac == nil then + if mac == nil then http_code(404) log:close() os.exit() @@ -191,5 +191,5 @@ elseif ( request_method == "PUT" ) then http_code(400) end end -log:close() +log:close() %> diff --git a/config/lighttpd.sample.conf b/config/lighttpd.sample.conf index 23dbe0d..f1b605b 100644 --- a/config/lighttpd.sample.conf +++ b/config/lighttpd.sample.conf @@ -71,7 +71,7 @@ server.follow-symlink = "enable" # event handler (defaults to "poll") # see performance.txt -# +# # for >= linux-2.4 # server.event-handler = "linux-rtsig" # for >= linux-2.6 @@ -290,7 +290,7 @@ url.access-deny = ("~", ".inc") # don't forget to add index.cml to server.indexfiles # cml.extension = ".cml" # cml.memcache-hosts = ( "127.0.0.1:11211" ) -# }}} +# }}} # {{{ mod_webdav # see webdav.txt diff --git a/config/templates/ciscoata-template.lua b/config/templates/ciscoata-template.lua index dae131c..323185d 100644 --- a/config/templates/ciscoata-template.lua +++ b/config/templates/ciscoata-template.lua @@ -123,14 +123,14 @@ if tz then -- ["+05.5"] = {0}, -- Bombay, Calcutta, Madras, New Delhi "+05.5 1 0" 0 ["+06"] = {7}, -- Bangladesh, Russia "+06 1 7" 0 ["+07"] = {7}, -- Thailand, Russia "+07 1 7" 0 - ["+08"] = {4, 7, 0, 0}, -- Australia Western "+08 1 4" 0 + ["+08"] = {4, 7, 0, 0}, -- Australia Western "+08 1 4" 0 -- Russia "+08 2 7" ? -- China, Hong Kong "+08 3 0" 0 -- Singapore, Taiwan "+08 4 0" 0 ["+09"] = {0}, -- Japan, Korea "+09 1 0" 0 -- ["+09.5"] = {10}, -- South Australia "+09.5 1 10" CST-9:30CST,M10.1.0,M4.1.0/3 ["+10"] = {7, 4}, -- Guam, Russia "+10 1 7" 0 - -- Australia "+10 2 4" + -- Australia "+10 2 4" ["+11"] = {0}, -- Soloman Islands "+11 1 0" 0 ["+12"] = {0, 4, 0}, -- Fiji "+12 1 0" ? -- New Zealand "+12 2 4" NZST-12NZDT,M9.5.0,M4.1.0/3 @@ -173,7 +173,7 @@ if tz then else -- Just don't set it end - + if tz.dst then xml_elem("Auto_Adjust_Clock", true, "na") else diff --git a/config/templates/linksysata-template.lua b/config/templates/linksysata-template.lua index d05d512..b2fb038 100644 --- a/config/templates/linksysata-template.lua +++ b/config/templates/linksysata-template.lua @@ -114,7 +114,7 @@ if tz then return date.."/"..time end - + if tz.dst then xml_elem("Daylight_Saving_Time_Enable", "Yes", "na") xml_elem("Daylight_Saving_Time_Rule", "start="..dstrule(tz.dst.start)..";end="..dstrule(tz.dst.stop)..";save=1", "na") diff --git a/config/templates/polycom-template.lua b/config/templates/polycom-template.lua index 3869e3e..6a874ff 100644 --- a/config/templates/polycom-template.lua +++ b/config/templates/polycom-template.lua @@ -69,7 +69,7 @@ device.set="1" <% local values = ... %> -<% +<% local function xml_attr (t, v) if v ~= nil then -- Check for -0, which is invalid for Polycom but fine for Lua @@ -77,7 +77,7 @@ local function xml_attr (t, v) -- v could be a string, boolean, or a number io.write(table.concat(t, '.') .. '="' .. tostring(v) .. '"\n') end -end +end %> <% @@ -141,7 +141,7 @@ if tz then local function dstrule ( pos ) local dstprefix = 'tcpIpApp.sntp.daylightSavings' local t = tz.dst[pos] - + -- Handle explicit hour for DST change -- (Polycom doesn't implement explicit min or sec) -- (Polycom DST implementation assumes DST change is 1 hour) @@ -164,7 +164,7 @@ if tz then -- POSIX weekday is between 0 (Sun) and 6 (Sat) -- Polycom dayOfWeek is 1=Sun, 7=Sat xml_attr({ dstprefix, pos, 'dayOfWeek' }, tonumber(t.weekday) + 1) - + -- POSIX week from 1 to 5, where 1st,2nd..4th, and 5=last if t.week == '5' then xml_attr({ dstprefix, pos, 'dayOfWeek.lastInMonth' }, true) @@ -176,7 +176,7 @@ if tz then end end - + if tz.dst then xml_attr({'tcpIpApp.sntp.daylightSavings.enable'}, true) diff --git a/config/templates/snom-template.lua b/config/templates/snom-template.lua index 635ce3e..19c529e 100644 --- a/config/templates/snom-template.lua +++ b/config/templates/snom-template.lua @@ -128,7 +128,7 @@ if tz then return date..' '..time end - + if tz.dst then xml_elem('dst', '3600 '..dstrule(tz.dst.start)..' '..dstrule(tz.dst.stop), 'R') else diff --git a/provisioning-bulkcreatedevices-html.lsp b/provisioning-bulkcreatedevices-html.lsp index ca32f07..0f0e45f 100644 --- a/provisioning-bulkcreatedevices-html.lsp +++ b/provisioning-bulkcreatedevices-html.lsp @@ -1,4 +1,4 @@ -<% local form, viewlibrary, page_info, session = ... +<% local form, viewlibrary, page_info, session = ... htmlviewfunctions = require("htmlviewfunctions") html = require("acf.html") %> diff --git a/provisioning-dumpdatabase-html.lsp b/provisioning-dumpdatabase-html.lsp index c7ed7d4..f3ffa23 100644 --- a/provisioning-dumpdatabase-html.lsp +++ b/provisioning-dumpdatabase-html.lsp @@ -1,4 +1,4 @@ -<% local form, viewlibrary, page_info = ... +<% local form, viewlibrary, page_info = ... htmlviewfunctions = require("htmlviewfunctions") html = require("acf.html") %> diff --git a/provisioning-editdevice-html.lsp b/provisioning-editdevice-html.lsp index f06d196..fe375aa 100644 --- a/provisioning-editdevice-html.lsp +++ b/provisioning-editdevice-html.lsp @@ -1,4 +1,4 @@ -<% local form, viewlibrary, page_info, session = ... +<% local form, viewlibrary, page_info, session = ... htmlviewfunctions = require("htmlviewfunctions") html = require("acf.html") %> diff --git a/provisioning-editdeviceparams-html.lsp b/provisioning-editdeviceparams-html.lsp index 9c1cea8..9229264 100644 --- a/provisioning-editdeviceparams-html.lsp +++ b/provisioning-editdeviceparams-html.lsp @@ -1,4 +1,4 @@ -<% local form, viewlibrary, page_info, session = ... +<% local form, viewlibrary, page_info, session = ... htmlviewfunctions = require("htmlviewfunctions") html = require("acf.html") %> @@ -73,7 +73,7 @@ end currentsection = id.substr(8); currentnumber = 0; } - + if ((currentsection == previoussection) && (currentnumber != previousnumber) && (0 == $(this).find(".defaultoverride").length) && (0 == $(this).find(".groupdefaultoverride").length) && ($(this).children().first().text().match(currentnumber))) { $(this).toggle(); $('<a href="javascript:;" class="'+id+'"><img src="<%= html.html_escape(page_info.wwwprefix..page_info.staticdir) %>tango/16x16/actions/list-add.png"> Add '+$(this).children().first().text()+'</a>').insertAfter($(this)).click(showsection); @@ -86,7 +86,7 @@ end previoussection = currentsection; previousnumber = currentnumber; }); - + } $(document).ready(function() { diff --git a/provisioning-editparam-html.lsp b/provisioning-editparam-html.lsp index 700ebd0..b154766 100644 --- a/provisioning-editparam-html.lsp +++ b/provisioning-editparam-html.lsp @@ -1,4 +1,4 @@ -<% local form, viewlibrary, page_info, session = ... +<% local form, viewlibrary, page_info, session = ... htmlviewfunctions = require("htmlviewfunctions") html = require("acf.html") %> diff --git a/provisioning-edittemplate-html.lsp b/provisioning-edittemplate-html.lsp index aee98f1..0ef5bc2 100644 --- a/provisioning-edittemplate-html.lsp +++ b/provisioning-edittemplate-html.lsp @@ -5,7 +5,7 @@ <% local header_level = htmlviewfunctions.displaysectionstart(form, page_info) %> <% htmlviewfunctions.displayformstart(form, page_info) %> <% local header_level2 = htmlviewfunctions.displaysectionstart(cfe({label="Template Details"}), page_info, htmlviewfunctions.incrementheader(header_level)) %> -<% +<% if page_info.action == "edittemplate" then form.value.filename.readonly = "true" end diff --git a/provisioning-getclassvalues-html.lsp b/provisioning-getclassvalues-html.lsp index 2d19d7a..c883793 100644 --- a/provisioning-getclassvalues-html.lsp +++ b/provisioning-getclassvalues-html.lsp @@ -1,4 +1,4 @@ -<% local form, viewlibrary, page_info = ... +<% local form, viewlibrary, page_info = ... htmlviewfunctions = require("htmlviewfunctions") html = require("acf.html") %> diff --git a/provisioning-listclasses-html.lsp b/provisioning-listclasses-html.lsp index 4770954..f72e10e 100644 --- a/provisioning-listclasses-html.lsp +++ b/provisioning-listclasses-html.lsp @@ -1,4 +1,4 @@ -<% local view, viewlibrary, page_info, session = ... +<% local view, viewlibrary, page_info, session = ... htmlviewfunctions = require("htmlviewfunctions") html = require("acf.html") %> @@ -40,7 +40,7 @@ html = require("acf.html") <th>Class Group</th> <th>Label</th> <th>Sequence</th> - </tr> + </tr> </thead><tbody> <% local class_id = cfe({ type="hidden", value="" }) %> <% local redir = cfe({ type="hidden", value=page_info.orig_action }) %> diff --git a/provisioning-listclassgroups-html.lsp b/provisioning-listclassgroups-html.lsp index 3ba750f..2d5dab4 100644 --- a/provisioning-listclassgroups-html.lsp +++ b/provisioning-listclassgroups-html.lsp @@ -1,4 +1,4 @@ -<% local view, viewlibrary, page_info, session = ... +<% local view, viewlibrary, page_info, session = ... htmlviewfunctions = require("htmlviewfunctions") html = require("acf.html") %> @@ -32,7 +32,7 @@ html = require("acf.html") <th>Name</th> <th>Label</th> <th>Sequence</th> - </tr> + </tr> </thead><tbody> <% local class_group_id = cfe({ type="hidden", value="" }) %> <% local redir = cfe({ type="hidden", value=page_info.orig_action }) %> diff --git a/provisioning-listdevices-html.lsp b/provisioning-listdevices-html.lsp index 79c2b32..2c12e99 100644 --- a/provisioning-listdevices-html.lsp +++ b/provisioning-listdevices-html.lsp @@ -1,4 +1,4 @@ -<% local view, viewlibrary, page_info, session = ... +<% local view, viewlibrary, page_info, session = ... htmlviewfunctions = require("htmlviewfunctions") html = require("acf.html") %> @@ -66,10 +66,10 @@ end $("#list").tablesorter({headers: {0:{sorter: false}}, widgets: ['zebra', 'filter', 'pager'], widgetOptions: { // Filtering is handled by the server filter_serversideFiltering: true, - + // We can put the page number and size here, filtering and sorting handled by pager_customAjaxUrl pager_ajaxUrl : '<%= html.html_escape(page_info.script .. page_info.orig_action) %>?viewtype=json&page={page+1}&pagesize={size}', - + // Modify the url after all processing has been applied to handle filtering and sorting pager_customAjaxUrl: function(table, url) { var columns = ["action", "<%= table.concat(columns, '", "') %>"]; @@ -88,7 +88,7 @@ end } return url; }, - + // process ajax so that the following information is returned: // [ total_rows (number), rows (array of arrays), headers (array; optional) ] pager_ajaxProcessing: function(data){ @@ -125,7 +125,7 @@ end <% for i,g in ipairs(view.value.groups.value) do %> <th><%= html.html_escape(g.label) %></th> <% end %> - </tr> + </tr> </thead><tbody> </tbody> </table> diff --git a/provisioning-listfiles-html.lsp b/provisioning-listfiles-html.lsp index e92e43f..88a37f9 100644 --- a/provisioning-listfiles-html.lsp +++ b/provisioning-listfiles-html.lsp @@ -1,4 +1,4 @@ -<% local view, viewlibrary, page_info, session = ... +<% local view, viewlibrary, page_info, session = ... htmlviewfunctions = require("htmlviewfunctions") html = require("acf.html") %> diff --git a/provisioning-listgroups-html.lsp b/provisioning-listgroups-html.lsp index b6435af..418828b 100644 --- a/provisioning-listgroups-html.lsp +++ b/provisioning-listgroups-html.lsp @@ -1,4 +1,4 @@ -<% local view, viewlibrary, page_info, session = ... +<% local view, viewlibrary, page_info, session = ... htmlviewfunctions = require("htmlviewfunctions") html = require("acf.html") %> @@ -32,7 +32,7 @@ html = require("acf.html") <th>Name</th> <th>Label</th> <th>Sequence</th> - </tr> + </tr> </thead><tbody> <% local group_id = cfe({ type="hidden", value="" }) %> <% local redir = cfe({ type="hidden", value=page_info.orig_action }) %> diff --git a/provisioning-listparams-html.lsp b/provisioning-listparams-html.lsp index 177b30c..4a6fc02 100644 --- a/provisioning-listparams-html.lsp +++ b/provisioning-listparams-html.lsp @@ -1,4 +1,4 @@ -<% local view, viewlibrary, page_info, session = ... +<% local view, viewlibrary, page_info, session = ... htmlviewfunctions = require("htmlviewfunctions") html = require("acf.html") %> @@ -33,7 +33,7 @@ html = require("acf.html") <th>Label</th> <th>Default</th> <th>Sequence</th> - </tr> + </tr> </thead><tbody> <% local param_id = cfe({ type="hidden", value="" }) %> <% local redir = cfe({ type="hidden", value=page_info.orig_action }) %> diff --git a/provisioning-listrequests-html.lsp b/provisioning-listrequests-html.lsp index 9ddd3c0..54c4e42 100644 --- a/provisioning-listrequests-html.lsp +++ b/provisioning-listrequests-html.lsp @@ -1,4 +1,4 @@ -<% local view, viewlibrary, page_info, session = ... +<% local view, viewlibrary, page_info, session = ... htmlviewfunctions = require("htmlviewfunctions") html = require("acf.html") %> @@ -26,7 +26,7 @@ html = require("acf.html") window.location.assign("<%= html.html_escape(page_info.script..page_info.prefix..page_info.controller) %>/searchdevices"); <% end - + -- Since we're including a submission of createdevicefromrequest, we need to overcome the automatic redirect if session.createdevicefromrequestresult and not session.createdevicefromrequestresult.errtxt then local tmp = session.createdevicefromrequestresult @@ -74,10 +74,10 @@ html = require("acf.html") $("#list").tablesorter({headers: {1:{sorter:'digit'}, 3:{sorter:'ipAddress'}}, widgets: ['zebra', 'filter', 'pager'], widgetOptions: { // Filtering is handled by the server filter_serversideFiltering: true, - + // We can put the page number and size here, filtering and sorting handled by pager_customAjaxUrl pager_ajaxUrl : '<%= html.html_escape(page_info.script .. page_info.orig_action) %>?viewtype=json&page={page+1}&pagesize={size}', - + // Modify the url after all processing has been applied to handle filtering and sorting pager_customAjaxUrl: function(table, url) { var columns = ["action", "date", "mac", "ip", "agent", "device_id"]; @@ -96,7 +96,7 @@ html = require("acf.html") } return url; }, - + // process ajax so that the following information is returned: // [ total_rows (number), rows (array of arrays), headers (array; optional) ] pager_ajaxProcessing: function(data){ @@ -137,7 +137,7 @@ html = require("acf.html") <th>IP Address</th> <th>User Agent</th> <th>Device ID</th> - </tr> + </tr> </thead><tbody> </tbody> </table> diff --git a/provisioning-listtemplates-html.lsp b/provisioning-listtemplates-html.lsp index 47226d7..6bcab02 100644 --- a/provisioning-listtemplates-html.lsp +++ b/provisioning-listtemplates-html.lsp @@ -1,4 +1,4 @@ -<% local view, viewlibrary, page_info, session = ... +<% local view, viewlibrary, page_info, session = ... htmlviewfunctions = require("htmlviewfunctions") html = require("acf.html") %> @@ -34,7 +34,7 @@ html = require("acf.html") <th>Sequence</th> <th>File Size</th> <th>Last Modified</th> - </tr> + </tr> </thead><tbody> <% local filename = cfe({ type="hidden", value="" }) %> <% local redir = cfe({ type="hidden", value=page_info.orig_action }) %> diff --git a/provisioning-model.lua b/provisioning-model.lua index 943267e..1b5dd54 100644 --- a/provisioning-model.lua +++ b/provisioning-model.lua @@ -68,7 +68,7 @@ local createdatabase = function() table.insert(result, errtxt) table.insert(result, cmdresult) end - + -- Create the database local cmd = "CREATE DATABASE "..DatabaseName.." WITH OWNER "..DatabaseUser cmdresult, errtxt = modelfunctions.run_executable({"psql", "-U", "postgres", "-c", cmd}, true) @@ -83,11 +83,11 @@ local createdatabase = function() return table.concat(result, "\n") end - + -- Delete the database and roles local deletedatabase = function() local result = {} - + local cmd = "DROP DATABASE "..DatabaseName local cmdresult, errtxt = modelfunctions.run_executable({"psql", "-U", "postgres", "-c", cmd}, true) table.insert(result, errtxt) @@ -474,7 +474,7 @@ local set_device_params = function(params, editable) end end end - + local tmp = saved_device_params[params.value.device_id.value] local p = params if not editable then @@ -1183,7 +1183,7 @@ mymodule.update_group = function(self, group, action, create) success = false group.value.name.errtxt = "Cannot be blank" -- Group name cannot be device_id, name, or label or will mess up get_device_params - elseif group.value.name.value == "device_id" or group.value.name.value == "name" or group.value.name.value == "label" then + elseif group.value.name.value == "device_id" or group.value.name.value == "name" or group.value.name.value == "label" then success = false group.value.name.errtxt = "Illegal name" elseif string.find(group.value.name.value, "%W") then @@ -1722,7 +1722,7 @@ mymodule.delete_device = function(self, delreq) else if not saved_device_params[device_id] then get_device_params(device_id) end if not saved_devices[device_id] then get_device(device_id) end - + sql = "DELETE FROM provisioning_values WHERE device_id='"..provdb.escape(device_id).."'" runsqlcommand(sql) sql = "DELETE FROM devices_to_classes WHERE device_id='"..provdb.escape(device_id).."'" @@ -1776,7 +1776,7 @@ mymodule.get_class_values = function(self, retval) retval.errtxt = nil retval.value.label = cfe({ value=tmp[1].label or "", label="Label", seq=3}) retval.value.values = cfe({type="structure", value={}, label="Parameter Values"}) - + local sql = "SELECT g.name AS group, p.name, p.type, CASE WHEN g2p.value IS NOT NULL THEN g2p.value ELSE p.value END AS value ".. "FROM (provisioning_classes t JOIN classes_to_param_groups t2g USING(class_id) JOIN provisioning_groups g USING(group_id) ".. "JOIN param_groups_to_params g2p USING(group_id) JOIN provisioning_params p USING(param_id)) ".. @@ -2170,7 +2170,7 @@ function mymodule.put_file(self, clientdata) local mac = clientdata.mac local data = clientdata.data local retval = cfe({ label="PUT Data" }) - + -- Error if there's no mac if not mac or mac == "" then retval.errtxt = "No MAC Address" @@ -2179,7 +2179,7 @@ function mymodule.put_file(self, clientdata) local res, err = pcall(function() connected = databaseconnect() - + -- Now, let's see if this device exists local search = mymodule.get_search_options() search.value.id.value = "device.mac" @@ -2237,7 +2237,7 @@ mymodule.list_requests = function(self, clientdata) local res, err = pcall(function() connected = databaseconnect(true) - + local filter = {} columns.data = nil -- Cannot regex filter based on date because of the timestamp type for c,f in pairs(retval.value.filter.value) do @@ -2369,7 +2369,7 @@ mymodule.create_from_request = function(self, request) handlesqlexception(connected, err) request.errtxt = err end - + if not success and not request.errtxt then request.errtxt = "Failed to create device" end diff --git a/provisioning-searchbyextension-html.lsp b/provisioning-searchbyextension-html.lsp index d7217b7..f20ac71 100644 --- a/provisioning-searchbyextension-html.lsp +++ b/provisioning-searchbyextension-html.lsp @@ -1,4 +1,4 @@ -<% local form, viewlibrary, page_info, session = ... +<% local form, viewlibrary, page_info, session = ... htmlviewfunctions = require("htmlviewfunctions") html = require("acf.html") %> diff --git a/provisioning-searchbymac-html.lsp b/provisioning-searchbymac-html.lsp index 45a771d..2800d8b 100644 --- a/provisioning-searchbymac-html.lsp +++ b/provisioning-searchbymac-html.lsp @@ -1,4 +1,4 @@ -<% local form, viewlibrary, page_info, session = ... +<% local form, viewlibrary, page_info, session = ... htmlviewfunctions = require("htmlviewfunctions") html = require("acf.html") %> diff --git a/provisioning-searchdevices-html.lsp b/provisioning-searchdevices-html.lsp index 332a817..291ef3f 100644 --- a/provisioning-searchdevices-html.lsp +++ b/provisioning-searchdevices-html.lsp @@ -1,4 +1,4 @@ -<% local form, viewlibrary, page_info, session = ... +<% local form, viewlibrary, page_info, session = ... htmlviewfunctions = require("htmlviewfunctions") html = require("acf.html") %> @@ -70,7 +70,7 @@ elseif form.value.result then <% for i,n in ipairs(display) do %> <th><%= html.html_escape(string.gsub(n, "^.", string.upper)) %> <% end %> - </tr> + </tr> </thead><tbody> <% local device_id = cfe({ type="hidden", value="" }) %> <% local redir = cfe({ type="hidden", value=page_info.orig_action }) %> |