summaryrefslogtreecommitdiffstats
path: root/provisioning-controller.lua
diff options
context:
space:
mode:
Diffstat (limited to 'provisioning-controller.lua')
-rw-r--r--provisioning-controller.lua46
1 files changed, 22 insertions, 24 deletions
diff --git a/provisioning-controller.lua b/provisioning-controller.lua
index faa46ee..aa37d46 100644
--- a/provisioning-controller.lua
+++ b/provisioning-controller.lua
@@ -1,7 +1,5 @@
module (..., package.seeall)
-require("controllerfunctions")
-
default_action = "listdevices"
listtemplates = function( self )
@@ -9,11 +7,11 @@ listtemplates = function( self )
end
edittemplate = function( self )
- return controllerfunctions.handle_form(self, function() return self.model.get_template(self.clientdata.filename) end, self.model.update_template, self.clientdata, "Save", "Edit Template", "Template Saved")
+ return self.handle_form(self, function() return self.model.get_template(self.clientdata.filename) end, self.model.update_template, self.clientdata, "Save", "Edit Template", "Template Saved")
end
createtemplate = function( self )
- return controllerfunctions.handle_form(self, function() return self.model.get_template(self.clientdata.filename) end, self.model.create_template, self.clientdata, "Create", "Create Template", "Template Created")
+ return self.handle_form(self, function() return self.model.get_template(self.clientdata.filename) end, self.model.create_template, self.clientdata, "Create", "Create Template", "Template Created")
end
deletetemplate = function( self )
@@ -25,11 +23,11 @@ listclassgroups = function( self )
end
editclassgroup = function( self )
- return controllerfunctions.handle_form(self, function() return self.model.get_class_group(self.clientdata.class_group_id) end, self.model.update_class_group, self.clientdata, "Save", "Edit Class Group", "Class Group Saved")
+ return self.handle_form(self, function() return self.model.get_class_group(self.clientdata.class_group_id) end, self.model.update_class_group, self.clientdata, "Save", "Edit Class Group", "Class Group Saved")
end
createclassgroup = function( self )
- return controllerfunctions.handle_form(self, self.model.get_class_group, self.model.create_class_group, self.clientdata, "Create", "Create Class Group", "Parameter Class Created")
+ return self.handle_form(self, self.model.get_class_group, self.model.create_class_group, self.clientdata, "Create", "Create Class Group", "Parameter Class Created")
end
deleteclassgroup = function( self )
@@ -41,11 +39,11 @@ listclasses = function( self )
end
editclass = function( self )
- return controllerfunctions.handle_form(self, function() return self.model.get_class(self.clientdata.class_id) end, self.model.update_class, self.clientdata, "Save", "Edit Class", "Class Saved")
+ return self.handle_form(self, function() return self.model.get_class(self.clientdata.class_id) end, self.model.update_class, self.clientdata, "Save", "Edit Class", "Class Saved")
end
createclass = function( self )
- return controllerfunctions.handle_form(self, self.model.get_class, self.model.create_class, self.clientdata, "Create", "Create Class", "Class Created")
+ return self.handle_form(self, self.model.get_class, self.model.create_class, self.clientdata, "Create", "Create Class", "Class Created")
end
deleteclass = function( self )
@@ -53,7 +51,7 @@ deleteclass = function( self )
end
getclassvalues = function( self )
- return controllerfunctions.handle_form(self, function() return self.model.get_class_options(self.clientdata.class_id) end, self.model.get_class_values, self.clientdata, "Fetch", "Get Device Values")
+ return self.handle_form(self, function() return self.model.get_class_options(self.clientdata.class_id) end, self.model.get_class_values, self.clientdata, "Fetch", "Get Device Values")
end
listgroups = function( self )
@@ -61,11 +59,11 @@ listgroups = function( self )
end
editgroup = function( self )
- return controllerfunctions.handle_form(self, function() return self.model.get_group(self.clientdata.group_id) end, self.model.update_group, self.clientdata, "Save", "Edit Parameter Group", "Parameter Group Saved")
+ return self.handle_form(self, function() return self.model.get_group(self.clientdata.group_id) end, self.model.update_group, self.clientdata, "Save", "Edit Parameter Group", "Parameter Group Saved")
end
creategroup = function( self )
- return controllerfunctions.handle_form(self, self.model.get_group, self.model.create_group, self.clientdata, "Create", "Create Parameter Group", "Parameter Group Created")
+ return self.handle_form(self, self.model.get_group, self.model.create_group, self.clientdata, "Create", "Create Parameter Group", "Parameter Group Created")
end
deletegroup = function( self )
@@ -77,11 +75,11 @@ listparams = function( self )
end
editparam = function( self )
- return controllerfunctions.handle_form(self, function() return self.model.get_param(self.clientdata.param_id) end, self.model.update_param, self.clientdata, "Save", "Edit Parameter", "Parameter Saved")
+ return self.handle_form(self, function() return self.model.get_param(self.clientdata.param_id) end, self.model.update_param, self.clientdata, "Save", "Edit Parameter", "Parameter Saved")
end
createparam = function( self )
- return controllerfunctions.handle_form(self, self.model.get_param, self.model.create_param, self.clientdata, "Create", "Create Parameter", "Parameter Created")
+ return self.handle_form(self, self.model.get_param, self.model.create_param, self.clientdata, "Create", "Create Parameter", "Parameter Created")
end
deleteparam = function( self )
@@ -93,11 +91,11 @@ listdevices = function( self )
end
editdevice = function( self )
- return controllerfunctions.handle_form(self, function() return self.model.get_device(self.clientdata.device_id) end, self.model.update_device, self.clientdata, "Save", "Edit Device", "Device Saved")
+ return self.handle_form(self, function() return self.model.get_device(self.clientdata.device_id) end, self.model.update_device, self.clientdata, "Save", "Edit Device", "Device Saved")
end
createdevice = function( self )
- local retval = controllerfunctions.handle_form(self, self.model.get_device, self.model.create_device, self.clientdata, "Create", "Create Device", "Device Created")
+ local retval = self.handle_form(self, self.model.get_device, self.model.create_device, self.clientdata, "Create", "Create Device", "Device Created")
if retval.value.device_id.value ~= "" and not retval.errtxt then
-- Successfully created a device, redirect to edit it
self:redirect("editdevice?device_id="..retval.value.device_id.value.."&redir=".. (self.clientdata.redir or "listdevices"))
@@ -106,7 +104,7 @@ createdevice = function( self )
end
duplicatedevice = function( self )
- return controllerfunctions.handle_form(self, function() return self.model.get_device(self.clientdata.device_id) end, self.model.create_device, self.clientdata, "Duplicate", "Duplicate Device", "Duplicate Device Created")
+ return self.handle_form(self, function() return self.model.get_device(self.clientdata.device_id) end, self.model.create_device, self.clientdata, "Duplicate", "Duplicate Device", "Duplicate Device Created")
end
deletedevice = function( self )
@@ -114,23 +112,23 @@ deletedevice = function( self )
end
editdeviceparams = function( self )
- return controllerfunctions.handle_form(self, function() return self.model.get_editable_device_params(self.clientdata.device_id) end, self.model.set_editable_device_params, self.clientdata, "Save", "Edit Device Parameters", "Device Parameters Saved")
+ return self.handle_form(self, function() return self.model.get_editable_device_params(self.clientdata.device_id) end, self.model.set_editable_device_params, self.clientdata, "Save", "Edit Device Parameters", "Device Parameters Saved")
end
overridedeviceparams = function( self )
- return controllerfunctions.handle_form(self, function() return self.model.get_device_params(self.clientdata.device_id) end, self.model.set_device_params, self.clientdata, "Save", "Override Device Parameters", "Device Parameters Saved")
+ return self.handle_form(self, function() return self.model.get_device_params(self.clientdata.device_id) end, self.model.set_device_params, self.clientdata, "Save", "Override Device Parameters", "Device Parameters Saved")
end
getdevicevalues = function( self )
- return controllerfunctions.handle_form(self, self.model.get_search_options, self.model.fetch_device_values, self.clientdata, "Search", "Get Device Values")
+ return self.handle_form(self, self.model.get_search_options, self.model.fetch_device_values, self.clientdata, "Search", "Get Device Values")
end
searchdevices = function( self )
- return controllerfunctions.handle_form(self, self.model.get_search_options, self.model.search_device_values, self.clientdata, "Search", "Search Device Parameters")
+ return self.handle_form(self, self.model.get_search_options, self.model.search_device_values, self.clientdata, "Search", "Search Device Parameters")
end
editoptions = function( self )
- return controllerfunctions.handle_form(self, function() return self.model.get_param_options(self.clientdata.param_id) end, self.model.set_param_options, self.clientdata, "Save", "Edit Parameter Options", "Parameter Options Saved")
+ return self.handle_form(self, function() return self.model.get_param_options(self.clientdata.param_id) end, self.model.set_param_options, self.clientdata, "Save", "Edit Parameter Options", "Parameter Options Saved")
end
listfiles = function( self )
@@ -138,11 +136,11 @@ listfiles = function( self )
end
editfile = function( self )
- return controllerfunctions.handle_form(self, function() return self.model.get_filedetails(self.clientdata.filename) end, self.model.update_filedetails, self.clientdata, "Save", "Edit Script File", "Script File Saved")
+ return self.handle_form(self, function() return self.model.get_filedetails(self.clientdata.filename) end, self.model.update_filedetails, self.clientdata, "Save", "Edit Script File", "Script File Saved")
end
dumpdatabase = function( self )
- return controllerfunctions.handle_form(self, self.model.get_database, self.model.dump_database, self.clientdata, "Submit", "Dump Provisioning Database")
+ return self.handle_form(self, self.model.get_database, self.model.dump_database, self.clientdata, "Submit", "Dump Provisioning Database")
end
getfile = function( self )
@@ -162,7 +160,7 @@ deleterequest = function( self )
end
createdevicefromrequest = function( self )
- local retval = controllerfunctions.handle_form(self, self.model.get_request, self.model.create_from_request, self.clientdata, "Create", "Create Device", "Device Created")
+ local retval = self.handle_form(self, self.model.get_request, self.model.create_from_request, self.clientdata, "Create", "Create Device", "Device Created")
if retval.value.device_id and retval.value.device_id.value ~= "" and not retval.errtxt then
-- Successfully created a device, redirect to edit it
self:redirect("editdevice?device_id="..retval.value.device_id.value.."&redir=".. (self.clientdata.redir or "listdevices"))