From 602abbdf57454e72395141094397ef66f3aaad99 Mon Sep 17 00:00:00 2001 From: Ted Trask Date: Mon, 13 Sep 2010 08:26:10 +0000 Subject: Split fullname into firstname and lastname fields. --- template-processdirectoryxml-xml.lsp | 2 +- vmail-editusersettings-html.lsp | 4 ++-- vmail-listmessages-html.lsp | 2 +- vmail-listusers-html.lsp | 6 ++++-- vmail-model.lua | 16 ++++++++-------- 5 files changed, 16 insertions(+), 14 deletions(-) diff --git a/template-processdirectoryxml-xml.lsp b/template-processdirectoryxml-xml.lsp index b8f9719..0d1fd02 100644 --- a/template-processdirectoryxml-xml.lsp +++ b/template-processdirectoryxml-xml.lsp @@ -15,7 +15,7 @@ Content-Type: Content Type: text/xml <% - local ignore = {username=true, fullname=true, domain=true, ["vm-password-confirm"]=true } + local ignore = {username=true, firstname=true, lastname=true, domain=true, ["vm-password-confirm"]=true } for name,val in pairs(viewtable.value) do if not ignore[name] then %> diff --git a/vmail-editusersettings-html.lsp b/vmail-editusersettings-html.lsp index 4efe709..d8acbc6 100644 --- a/vmail-editusersettings-html.lsp +++ b/vmail-editusersettings-html.lsp @@ -2,7 +2,7 @@ require("viewfunctions") %> -

Settings for <%= html.html_escape(form.value.fullname.value) %> (<%= html.html_escape(form.value.username.value) %>)

+

Settings for <%= html.html_escape(form.value.firstname.value) %> <%= html.html_escape(form.value.lastname.value) %> (<%= html.html_escape(form.value.username.value) %>)

<% form.action = page_info.script .. page_info.prefix .. page_info.controller .. "/" .. page_info.action if page_info.action ~= "createuser" then @@ -10,6 +10,6 @@ require("viewfunctions") end form.value["vm-password"].type = "password" form.value["vm-password-confirm"].type = "password" - local order = {"username", "fullname", "vm-password", "vm-password-confirm", "vm-mailto", "vm-email-all-messages", "vm-attach-file", "vm-keep-local-after-email", "vm-notify-mailto", "vm-notify-email-all-messages"} + local order = {"username", "firstname", "lastname", "vm-password", "vm-password-confirm", "vm-mailto", "vm-email-all-messages", "vm-attach-file", "vm-keep-local-after-email", "vm-notify-mailto", "vm-notify-email-all-messages"} displayform(form, order) %> diff --git a/vmail-listmessages-html.lsp b/vmail-listmessages-html.lsp index 78687d1..837232c 100644 --- a/vmail-listmessages-html.lsp +++ b/vmail-listmessages-html.lsp @@ -8,7 +8,7 @@ if viewlibrary.check_permission("listusers") and (viewlibrary.check_permission(" useroptions = {} for i,u in ipairs(users.value) do if u.username ~= session.userinfo.userid then - useroptions[#useroptions+1] = '' + useroptions[#useroptions+1] = '' end end useroptions = table.concat(useroptions) diff --git a/vmail-listusers-html.lsp b/vmail-listusers-html.lsp index 3445ae2..0124385 100644 --- a/vmail-listusers-html.lsp +++ b/vmail-listusers-html.lsp @@ -17,7 +17,8 @@ require("viewfunctions") Action Extension - Full Name + First Name + Last Name <% for k,v in ipairs( view.value ) do %> @@ -31,7 +32,8 @@ require("viewfunctions") <% end %> <%= html.html_escape(v.username) %> - <%= html.html_escape(v.fullname) %> + <%= html.html_escape(v.firstname) %> + <%= html.html_escape(v.lastname) %> <% end %> diff --git a/vmail-model.lua b/vmail-model.lua index 3ae8b6b..a9eeb59 100644 --- a/vmail-model.lua +++ b/vmail-model.lua @@ -32,7 +32,8 @@ local voicemail_values_creation_script = { local voicemail_params_creation_script = { "CREATE TABLE voicemail_params (name VARCHAR(255) primary key, type VARCHAR(255), label VARCHAR(255), descr VARCHAR(255), value VARCHAR(255))", "INSERT INTO voicemail_params VALUES('username', 'text', 'Extension', '', '')", - "INSERT INTO voicemail_params VALUES('fullname', 'text', 'Full User Name', '', '')", + "INSERT INTO voicemail_params VALUES('firstname', 'text', 'User First Name', '', '')", + "INSERT INTO voicemail_params VALUES('lastname', 'text', 'User Last Name', '', '')", "INSERT INTO voicemail_params VALUES('vm-password', 'text', 'Voicemail Password', '', '')", "INSERT INTO voicemail_params VALUES('vm-password-confirm', 'text', 'Enter again to confirm', '', '')", "INSERT INTO voicemail_params VALUES('vm-mailto', 'text', 'Email Address', 'Email a notification, including audio file if enabled', '')", @@ -546,15 +547,14 @@ list_users = function() if string.find(u.username, "^tempuser") then table.remove(users, i) else - local sql = "SELECT value FROM voicemail_values"..generatewhereclause(u.username).." and name='fullname'" + local sql = "SELECT * FROM voicemail_values"..generatewhereclause(u.username).." and (name='firstname' or name='lastname')" local cur = con:execute(sql) - if cur then - local row = cur:fetch ({}, "a") - if row and row.value then - u.fullname = row.value - end - cur:close() + local row = cur:fetch ({}, "a") + while row do + u[row.name] = row.value + row = cur:fetch (row, "a") end + cur:close() end end if connected then databasedisconnect() end -- cgit v1.2.3