summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorSteven Barth <steven@midlink.org>2008-05-17 10:00:44 +0000
committerSteven Barth <steven@midlink.org>2008-05-17 10:00:44 +0000
commit6eae1a0103a3d12dee4bc8753efee88af203dff3 (patch)
treebe2c3176005ce796203c500d619e1e3b36136f01
parent357ba22175225ca40cfcffd1f61cc4621ff13dbe (diff)
* Generalized dispatcher handling
-rwxr-xr-xapplications/sgi-haserl/root/www/cgi-bin/ffluci-upload2
-rw-r--r--applications/sgi-haserl/src/sgi/haserl.lua9
-rw-r--r--applications/sgi-webuci/src/sgi/webuci.lua10
-rw-r--r--core/src/dispatcher.lua2
-rw-r--r--core/src/template.lua3
-rw-r--r--modules/admin-core/src/view/admin_system/upgrade.htm2
6 files changed, 24 insertions, 4 deletions
diff --git a/applications/sgi-haserl/root/www/cgi-bin/ffluci-upload b/applications/sgi-haserl/root/www/cgi-bin/ffluci-upload
index 0128c2dd7..c31ddb822 100755
--- a/applications/sgi-haserl/root/www/cgi-bin/ffluci-upload
+++ b/applications/sgi-haserl/root/www/cgi-bin/ffluci-upload
@@ -1,4 +1,4 @@
-#!/usr/bin/haserl --shell=luac --upload-limit=6144
+#!/usr/bin/haserl --shell=luac --upload-limit=16384
-- This is a bit hacky: remove -upload from SCRIPT_NAME
ENV.SCRIPT_NAME = ENV.SCRIPT_NAME:sub(1, #ENV.SCRIPT_NAME - 7)
dofile("ffluci") \ No newline at end of file
diff --git a/applications/sgi-haserl/src/sgi/haserl.lua b/applications/sgi-haserl/src/sgi/haserl.lua
index 0e388391d..f3a6ee613 100644
--- a/applications/sgi-haserl/src/sgi/haserl.lua
+++ b/applications/sgi-haserl/src/sgi/haserl.lua
@@ -29,6 +29,15 @@ require("ffluci.fs")
-- Environment Table
ffluci.http.env = ENV
+-- Returns the main dispatcher URL
+function ffluci.http.dispatcher()
+ return ffluci.http.env.SCRIPT_NAME or ""
+end
+
+-- Returns the upload dispatcher URL
+function ffluci.http.dispatcher_upload()
+ return ffluci.http.dispatcher() .. "-upload"
+end
-- Returns a table of all COOKIE, GET and POST Parameters
function ffluci.http.formvalues()
diff --git a/applications/sgi-webuci/src/sgi/webuci.lua b/applications/sgi-webuci/src/sgi/webuci.lua
index d3d4cd4dc..f05fd2b0d 100644
--- a/applications/sgi-webuci/src/sgi/webuci.lua
+++ b/applications/sgi-webuci/src/sgi/webuci.lua
@@ -31,6 +31,16 @@ ffluci.http.env = webuci.env
local status_set = false
+-- Returns the main dispatcher URL
+function ffluci.http.dispatcher()
+ return ffluci.http.env.SCRIPT_NAME or ""
+end
+
+-- Returns the upload dispatcher URL
+function ffluci.http.dispatcher_upload()
+ -- To be implemented
+end
+
-- Returns a table of all COOKIE, GET and POST Parameters
function ffluci.http.formvalues()
return webuci.vars
diff --git a/core/src/dispatcher.lua b/core/src/dispatcher.lua
index c60e5dcd1..0a66ccd3a 100644
--- a/core/src/dispatcher.lua
+++ b/core/src/dispatcher.lua
@@ -104,7 +104,7 @@ function build_url(category, module, action)
module = module or "index"
action = action or "index"
- local pattern = ffluci.http.env.SCRIPT_NAME .. "/%s/%s/%s"
+ local pattern = ffluci.http.dispatcher() .. "/%s/%s/%s"
return pattern:format(category, module, action)
end
diff --git a/core/src/template.lua b/core/src/template.lua
index e74db7d64..6f4e4adb0 100644
--- a/core/src/template.lua
+++ b/core/src/template.lua
@@ -52,7 +52,8 @@ compiler_enable_bytecode = false
viewns = {
translate = function(...) return require("ffluci.i18n").translate(...) end,
config = function(...) return require("ffluci.model.uci").get(...) or "" end,
- controller = ffluci.http.env.SCRIPT_NAME or "",
+ controller = ffluci.http.dispatcher(),
+ uploadctrl = ffluci.http.dispatcher_upload(),
media = ffluci.config.main.mediaurlbase,
images = ffluci.config.main.imagebase,
write = io.write,
diff --git a/modules/admin-core/src/view/admin_system/upgrade.htm b/modules/admin-core/src/view/admin_system/upgrade.htm
index 598002890..185e03124 100644
--- a/modules/admin-core/src/view/admin_system/upgrade.htm
+++ b/modules/admin-core/src/view/admin_system/upgrade.htm
@@ -5,7 +5,7 @@
Das Format der Firmware ist plattformabhängig.%></p>
<br />
<% if sysupgrade and not ret then %>
-<form method="post" action="<%=controller%>-upload/admin/system/upgrade" enctype="multipart/form-data">
+<form method="post" action="<%=uploadctrl%>/admin/system/upgrade" enctype="multipart/form-data">
<div class="cbi-section-node">
<div class="cbi-value clear">
<div class="cbi-value-title left"><%:fwimage Firmwareimage%></div>