From 664f7e41674c2ab50fff296f6d3daf3eba829046 Mon Sep 17 00:00:00 2001 From: Zach LeBar Date: Thu, 29 Mar 2012 13:39:34 +0000 Subject: Fixing acf-asterisk to work with changes made to acf-core. Removing the use of controllerfunctions.lua and using the new 'handle_form()' found in acf_www-controller.lua. Also using 'handle_form()' in place of 'redirect_to_referrer()'. --- asterisk-controller.lua | 6 ++---- asterisk-model.lua | 12 ++++++++---- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/asterisk-controller.lua b/asterisk-controller.lua index 25994a3..404a141 100644 --- a/asterisk-controller.lua +++ b/asterisk-controller.lua @@ -2,8 +2,6 @@ module (..., package.seeall) -require("controllerfunctions") - default_action = "status" status = function( self ) @@ -11,7 +9,7 @@ status = function( self ) end startstop = function( self ) - return controllerfunctions.handle_startstop(self, self.model.startstop_service, self.clientdata) + return self.handle_form(self, self.model.get_startstop, self.model.startstop_service, self.clientdata) end listfiles = function( self ) @@ -19,5 +17,5 @@ listfiles = function( self ) end edit = function( self ) - return controllerfunctions.handle_form(self, function() return self.model.get_file(self.clientdata.filename) end, self.model.update_file, self.clientdata, "Save", "Edit File", "File Saved") + return self.handle_form(self, self.model.get_file, self.model.update_file, self.clientdata, "Save", "Edit File", "File Saved") end diff --git a/asterisk-model.lua b/asterisk-model.lua index 38c6a89..afc6a7b 100644 --- a/asterisk-model.lua +++ b/asterisk-model.lua @@ -28,12 +28,16 @@ get_status = function() return modelfunctions.getstatus(processname, packagename, "Asterisk Status") end -function startstop_service(action) - return modelfunctions.startstop_service(processname, action, {"Start", "Stop", "Restart", "Reload"}) +function get_startstop(clientdata) + return modelfunctions.get_startstop(processname) end -get_file = function(filename) - return modelfunctions.getfiledetails(filename, is_valid_filename) +function startstop_service(startstop, action) + return modelfunctions.startstop_service(startstop, action) +end + +get_file = function(clientdata) + return modelfunctions.getfiledetails(clientdata.filename, is_valid_filename) end update_file = function(filedetails) -- cgit v1.2.3