From a0f64cff3dfc675ed5ea641c10be72c842b693d5 Mon Sep 17 00:00:00 2001 From: Ted Trask Date: Fri, 4 Jul 2008 14:54:19 +0000 Subject: Modified lbu to use controllerfunctions, modelfunctions, and common lsp files. Moved basicstatus->status and status->listchanges. git-svn-id: svn://svn.alpinelinux.org/acf/alpine-conf/trunk@1276 ab2d0c66-481e-0410-8bed-d214d4d58bed --- lbu-basicstatus-html.lsp | 28 ------------ lbu-config-html.lsp | 9 ++-- lbu-controller.lua | 113 +++++------------------------------------------ lbu-expert-html.lsp | 37 +--------------- lbu-html.lsp | 17 +------ lbu-listbackups-html.lsp | 2 + lbu-listchanges-html.lsp | 31 +++++++++++++ lbu-model.lua | 48 +++++++++----------- lbu-status-html.lsp | 31 ++++++------- lbu.menu | 2 +- lbu.roles | 2 +- 11 files changed, 86 insertions(+), 234 deletions(-) delete mode 100644 lbu-basicstatus-html.lsp mode change 100644 => 120000 lbu-expert-html.lsp mode change 100644 => 120000 lbu-html.lsp create mode 100644 lbu-listchanges-html.lsp diff --git a/lbu-basicstatus-html.lsp b/lbu-basicstatus-html.lsp deleted file mode 100644 index 6b8a77d..0000000 --- a/lbu-basicstatus-html.lsp +++ /dev/null @@ -1,28 +0,0 @@ - -DEBUGGING

DEBUG INFO: CFE

") -io.write(html.cfe_unpack(view)) -io.write("
") ---]] -?> - -

System Info

-
- -
diff --git a/lbu-config-html.lsp b/lbu-config-html.lsp index 6749785..5072423 100644 --- a/lbu-config-html.lsp +++ b/lbu-config-html.lsp @@ -9,11 +9,10 @@ io.write("") --]] ?> - + +

Config

-DEBUGGING

DEBUG INFO: CFE

") -io.write(html.cfe_unpack(form)) -io.write("
") ---]] -?> - - - -

Configuration

-

File Details

-
- -
- -

File Content

-

") ?>

-

") ?>

-
- -

") ?>

- -
-
diff --git a/lbu-expert-html.lsp b/lbu-expert-html.lsp new file mode 120000 index 0000000..207f324 --- /dev/null +++ b/lbu-expert-html.lsp @@ -0,0 +1 @@ +../expert-html.lsp \ No newline at end of file diff --git a/lbu-html.lsp b/lbu-html.lsp deleted file mode 100644 index 71269f5..0000000 --- a/lbu-html.lsp +++ /dev/null @@ -1,16 +0,0 @@ - -DEBUGGING

DEBUG INFO: CFE

") -io.write(html.cfe_unpack(form)) -io.write("
") ---]] -?> - -

- diff --git a/lbu-html.lsp b/lbu-html.lsp new file mode 120000 index 0000000..4b6b762 --- /dev/null +++ b/lbu-html.lsp @@ -0,0 +1 @@ +../form-html.lsp \ No newline at end of file diff --git a/lbu-listbackups-html.lsp b/lbu-listbackups-html.lsp index cfd6efc..5995c2b 100644 --- a/lbu-listbackups-html.lsp +++ b/lbu-listbackups-html.lsp @@ -9,6 +9,8 @@ io.write("") --]] ?> + +

Backup Archive

diff --git a/lbu-listchanges-html.lsp b/lbu-listchanges-html.lsp new file mode 100644 index 0000000..0cc7f03 --- /dev/null +++ b/lbu-listchanges-html.lsp @@ -0,0 +1,31 @@ + +DEBUGGING

DEBUG INFO: CFE

") +io.write(html.cfe_unpack(view)) +io.write("
") +--]] +?> + + + +

Changes Since Last Commit

+
+
Files changed since last commit
+
+
diff --git a/lbu-model.lua b/lbu-model.lua index 3ae6c87..0ff1b96 100644 --- a/lbu-model.lua +++ b/lbu-model.lua @@ -1,10 +1,10 @@ module (..., package.seeall) -- Load libraries +require("modelfunctions") require("fs") require("format") require("getopts") -require("daemoncontrol") require("validator") -- Set variables @@ -308,13 +308,15 @@ function getincluded () validatefilelist(included) - return included + return cfe({ type="group", value={included = included} }) end function setincluded (included) - validatefilelist(included) - if not included.errtxt then - fs.write_file(includefile, included.value) + validatefilelist(included.value.included) + if not included.value.included.errtxt then + fs.write_file(includefile, included.value.included.value) + else + included.errtxt = "Failed to set included" end return included end @@ -329,44 +331,34 @@ function getexcluded () validatefilelist(excluded) - return excluded + return cfe({ type="group", value={excluded = excluded} }) end function setexcluded (excluded) - validatefilelist(excluded) - if not excluded.errtxt then - fs.write_file(excludefile, excluded.value) + validatefilelist(excluded.value.excluded) + if not excluded.value.excluded.errtxt then + fs.write_file(excludefile, excluded.value.excluded.value) + else + excluded.errtxt = "Failed to set excluded" end return excluded end function get_filedetails() - local filename = cfe({ value=configfile, label="File name" }) - local filecontent = cfe({ type="longtext", label="Config file" }) - local filesize = cfe({ value="0", label="File size" }) - local mtime = cfe({ value="---", label="File date" }) - - if fs.is_file(configfile) then - local filedetails = fs.stat(configfile) - filecontent.value = fs.read_file(configfile) - filesize.value = filedetails.size - mtime.value = filedetails.mtime - - validatefilecontent(filecontent) - else - filename.errtxt = "File not found" - end - - return cfe({ type="group", value={filename=filename, filecontent=filecontent, filesize=filesize, mtime=mtime}, label="Config file details" }) + return modelfunctions.getfiledetails(configfile) end -function set_filecontent (filecontent) +function set_filedetails(filedetails) + local filecontent = filedetails.value.filecontent filecontent.value = format.dostounix(filecontent.value) + filecontent.value = filecontent.value:gsub("\n+$", "") validatefilecontent(filecontent) if not filecontent.errtxt then fs.write_file(configfile, filecontent.value) + else + filedetails.errtxt = "Failed to set config" end - return filecontent + return filedetails end function getcommit() diff --git a/lbu-status-html.lsp b/lbu-status-html.lsp index afe0164..6b8a77d 100644 --- a/lbu-status-html.lsp +++ b/lbu-status-html.lsp @@ -9,23 +9,20 @@ io.write("") --]] ?> -System Info +
+ - -

Changes Since Last Commit

-
-
Files changed since last commit
-
diff --git a/lbu.menu b/lbu.menu index 497821f..21d4114 100644 --- a/lbu.menu +++ b/lbu.menu @@ -1,4 +1,4 @@ #CAT GROUP/DESC TAB ACTION -System 99Local_backups Status status +System 99Local_backups Status listchanges System 99Local_backups Config config System 99Local_backups Expert expert diff --git a/lbu.roles b/lbu.roles index 8aaeb48..bfc7a71 100644 --- a/lbu.roles +++ b/lbu.roles @@ -1,2 +1,2 @@ UPDATE=lbu:config,lbu:commit,lbu:expert,lbu:editincluded,lbu:editexcluded,lbu:listbackups,lbu:selectbackup -ALL=lbu:basicstatus,lbu:status +ALL=lbu:status,lbu:listchanges -- cgit v1.2.3