summaryrefslogtreecommitdiffstats
path: root/kamailio-controller.lua
diff options
context:
space:
mode:
authorZach LeBar <zach@zachlebar.com>2012-08-18 20:02:36 +0000
committerZach LeBar <zach@zachlebar.com>2012-08-18 20:02:36 +0000
commitbb6fd68db726c6b4d1a12e82a741d4248b0c70de (patch)
tree10797e2010478358ff146afdb237cbc9266459bc /kamailio-controller.lua
downloadacf-kamailio-bb6fd68db726c6b4d1a12e82a741d4248b0c70de.tar.bz2
acf-kamailio-bb6fd68db726c6b4d1a12e82a741d4248b0c70de.tar.xz
Further tweaks to support PostgreSQL 'schemas' and a hack to allow DISTributary Phone System Tool: 'ASHP' to submit NULL values into integer columns. The ability to add NULL values should be implemented in the near future.
Diffstat (limited to 'kamailio-controller.lua')
-rw-r--r--kamailio-controller.lua83
1 files changed, 83 insertions, 0 deletions
diff --git a/kamailio-controller.lua b/kamailio-controller.lua
new file mode 100644
index 0000000..7a98ae3
--- /dev/null
+++ b/kamailio-controller.lua
@@ -0,0 +1,83 @@
+module(..., package.seeall)
+
+-- Load libraries
+require("controllerfunctions")
+
+default_action = "status"
+
+function status(self)
+ return self.model.getstatus()
+end
+
+function startstop(self)
+ return controllerfunctions.handle_startstop(self, self.model.startstop_service, self.clientdata)
+end
+
+function listfiles(self)
+ return self.model.list_files()
+end
+
+function edit(self)
+ return controllerfunctions.handle_form(self, function() return self.model.get_filedetails(self.clientdata.filename) end, self.model.update_filedetails, self.clientdata, "Save", "Edit File", "File Saved")
+end
+
+function listusers(self)
+ return self.model.list_users()
+end
+
+function createuser(self)
+ return controllerfunctions.handle_form(self, self.model.get_new_user, self.model.create_new_user, self.clientdata, "Create", "Create New User")
+end
+
+function deleteuser(self)
+ return self:redirect_to_referrer(self.model.delete_user(self.clientdata.username))
+end
+
+function updateuser(self)
+ return controllerfunctions.handle_form(self, function() return self.model.get_user(self.clientdata.username) end, self.model.update_user, self.clientdata, "Update", "Update User")
+end
+
+function listtables(self)
+ return self.model.list_tables()
+end
+
+function viewtable(self)
+ local req_table
+ if self.clientdata.schema then
+ req_table = self.clientdata.schema.."."..self.clientdata.table
+ else
+ req_table = self.clientdata.table
+ end
+ return self.model.list_table_entries(req_table)
+end
+
+function deletetableentry(self)
+ return self:redirect_to_referrer(self.model.delete_table_entry(self.clientdata.table, self.clientdata.id))
+end
+
+function updatetableentry(self)
+ return controllerfunctions.handle_form(self, function() return self.model.get_table_entry(self.clientdata.table, self.clientdata.id) end, self.model.update_table_entry, self.clientdata, "Update", "Update Table Entry", "Entry updated")
+end
+
+function createtableentry(self)
+ local req_table
+ if self.clientdata.schema then
+ req_table = self.clientdata.schema.."."..self.clientdata.table
+ else
+ req_table = self.clientdata.table
+ end
+ return controllerfunctions.handle_form(self, function() return self.model.get_table_entry(req_table) end, self.model.create_table_entry, self.clientdata, "Create", "Create New Table Entry", "Entry created")
+end
+
+function createdatabase(self)
+ return self:redirect_to_referrer(self.model.create_database())
+end
+
+function reloadplan(self)
+ return self:redirect_to_referrer(self.model.reloadplan())
+end
+
+
+searchdatabase = function( self )
+ return self.model.search_database(self.clientdata.id, self.clientdata.value, self.clientdata.comparison)
+end