From 93a98dd13be5127871ff78d85e8199f2df77e9c2 Mon Sep 17 00:00:00 2001 From: Steven Barth Date: Mon, 10 Mar 2008 08:53:14 +0000 Subject: [PATCH] Moved examples out of source directory Added a first draft design Cleaned up Makefile Prepared for module development --- Makefile | 17 ++- contrib/index.cgi | 2 +- contrib/media/cascade.css | 138 ++++++++++++++++++ contrib/media/logo.png | Bin 0 -> 4002 bytes contrib/package/ffluci/Makefile | 2 + .../ffluci/controller/admin/index.lua | 0 .../controller/public/example-action.lua | 0 .../controller/public/example-simpleview.lua | 0 .../ffluci/controller/public/index.lua | 0 .../ffluci/view/example-simpleview/foo.htm | 0 .../ffluci/view/example-simpleview/index.htm | 0 {src => examples}/ffluci/view/hello.htm | 0 src/ffluci/template.lua | 4 +- src/ffluci/view/footer.htm | 6 +- src/ffluci/view/header.htm | 59 +++++++- src/ffluci/view/menu.htm | 25 ---- 16 files changed, 213 insertions(+), 40 deletions(-) create mode 100644 contrib/media/cascade.css create mode 100644 contrib/media/logo.png rename {src => examples}/ffluci/controller/admin/index.lua (100%) rename {src => examples}/ffluci/controller/public/example-action.lua (100%) rename {src => examples}/ffluci/controller/public/example-simpleview.lua (100%) rename {src => examples}/ffluci/controller/public/index.lua (100%) rename {src => examples}/ffluci/view/example-simpleview/foo.htm (100%) rename {src => examples}/ffluci/view/example-simpleview/index.htm (100%) rename {src => examples}/ffluci/view/hello.htm (100%) delete mode 100644 src/ffluci/view/menu.htm diff --git a/Makefile b/Makefile index 38b7981ec..2d732ff08 100644 --- a/Makefile +++ b/Makefile @@ -12,16 +12,25 @@ DIRECTORIES = dist/ffluci/model dist/ffluci/controller/public dist/ffluci/contro INFILES = $(CFILES:%=src/%) OUTFILE = ffluci/init.lua +.PHONY: all dist-compile dist-source examples-compile examples-source dist examples compile source clean + all: compile -dist-compile: compile examples -dist-source: source examples +dist-compile: compile dist +dist-source: source dist -examples: +examples-compile: compile examples +examples-source: source examples + + +dist: cp src/ffluci/controller/public/* dist/ffluci/controller/public/ cp src/ffluci/controller/admin/* dist/ffluci/controller/admin/ cp src/ffluci/i18n/* dist/ffluci/i18n/ cp src/ffluci/view/* dist/ffluci/view/ -R + +examples: + cp examples/* dist/ -R compile: mkdir -p $(DIRECTORIES) @@ -34,7 +43,5 @@ source: for i in $(CFILES); do cp src/$$i dist/$$i; done for i in $(FILES); do cp src/$$i dist/$$i; done - -.PHONY: clean clean: rm dist -rf diff --git a/contrib/index.cgi b/contrib/index.cgi index 429b4c3b0..31705ccf2 100755 --- a/contrib/index.cgi +++ b/contrib/index.cgi @@ -1,3 +1,3 @@ #!/usr/bin/haserl --shell=luac print("Status: 302 Found") -print("Location: /cgi-bin/ffluci\n") +print("Location: ffluci\n") diff --git a/contrib/media/cascade.css b/contrib/media/cascade.css new file mode 100644 index 000000000..143b93ba2 --- /dev/null +++ b/contrib/media/cascade.css @@ -0,0 +1,138 @@ +body { + font-family: Verdana, Arial, sans-serif; + background-color: #aaaaaa; +} + +#header { + padding: 0.2em; + height: 4.5em; + background-color: #262626; +} + +#columns { + border-left: 10.1em solid #262626; + border-right: 10.1em solid #262626; + display: block; + background-color: white; + padding: 0.1em; +} + +#columnswrapper { + display: block; + margin-left: -10em; + margin-right: -10em; +} + +#content { + margin-left: 10em; + margin-right: 10em; + display: block; + position: relative; + padding: 2px; +} + +.headerlogo { + height: 4em; + padding: 5px; +} + +.headerlogo img { + height: 100%; +} + +.headertitle { + font-size: 2.4em; + color: gray; + letter-spacing: 0.5em; + text-transform: lowercase; +} + +.separator { + padding-left: 0.25em; + font-weight: bold; + font-size: 0.8em; + line-height: 1.4em; +} + +.whitetext { + color: white; +} + +.yellowtext { + color: #ffcb05; +} + +.magentatext { + color: #dc0065; +} + +.inheritcolor { + color: inherit; +} + +.smalltext { + font-size: 0.8em; +} + +.yellow { + background-color: #ffcb05; +} + +.magenta { + background-color: #dc0065; +} + +.nodeco { + text-decoration: none; +} + +.redhover:hover { + color: red; +} + +.bold { + font-weight: bold; +} + +.sidebar { + position: relative; + padding: 0.25em; + color: gray; + width: 9em; + font-weight: bold; +} + +.separator a, .sidebar a { + color: inherit; + text-decoration: inherit; +} + +.separator a:hover, .sidebar a:hover { + color: red; +} + +.sidebar div { + padding-bottom: 0.5em; +} + +.sidebar ul { + font-size: 0.8em; + color: white; + list-style-type: none; + padding-left: 1em; + margin-top: 0%; +} + +.left { + float: left; + text-align: left; +} + +.right { + float: right; + text-align: right; +} + +.clear { + clear: both; +} diff --git a/contrib/media/logo.png b/contrib/media/logo.png new file mode 100644 index 0000000000000000000000000000000000000000..d4c5dd9a3fc2c7e6c280ad7cff218eee8607a264 GIT binary patch literal 4002 zcmV;T4_)wyP)E40&9Rz zGp-fDtG4fb)1Cau&L-TzaR&mYh1an_P6wxI02Tqy0t;;4tLqvLw_&FcZs53mfyuyl zptKtvp+FTd7pSy-Z&O!HxH@1MdOX*}nIDM<>|fgc~^SVBlfk=uS?x1rQ*&lk@x+@JrkGR<(EF4kg^camNCW z0lT+j*n7Zpz(;Je2G#&;F~Z#sD8yJ0g}@-pW;n1N&-fDfsqK6J-HtIkj&K9Vy#crt zBam!J0)GeQ1M_X)ThYPiIlx%pblUcoGys!q-<#9cXKZ)j29BE#%m&VBg;argz>T)= zt?XhRjs|YW*vzfrUf`;>Y=r|EKX94td&yM8s=*V7Bpa<~5b_mn zS>3PygCiGB-P#rW)Y=pB**$-<3O4|&wNb~FET8#N8o&7%^Ke|u6khi|T zxfr|juo#kOfzxf@YhtRl)ICduhXkG|u)dqT|I$al>ki)P23@*uLtgSRREMj`_>yIn zuch&wk8vi3#ti?9?R%p$8?EkOGz%^wUa-}`xlMuxzBvg6q*VMl4!vKoRcot znlkqs;2IHYY)=aopk$f%xQd*Q=)ELp%G|F~c0-7wHW>BHX}n_Xn3+fX zy;o8tTw1)W@~=I?UldA~RsN?ScS=&8T3LF@A!%K+FSo2EllRo5{t4y5;$@Zp(L=n&qPW_-5#e=9lFu-Hd=5bP+Fu(pZt$th^K8rZmrbys#bUu}Y_ZrPl?02mOw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pnjONOls#|jXC}DS_e!2v+=M)f8zE30SPdqmS-GahyVZp07*qo IM6N<$g0fW6u>b%7 literal 0 HcmV?d00001 diff --git a/contrib/package/ffluci/Makefile b/contrib/package/ffluci/Makefile index 12e811d2c..dab80be37 100644 --- a/contrib/package/ffluci/Makefile +++ b/contrib/package/ffluci/Makefile @@ -34,7 +34,9 @@ endef define Package/ffluci/install $(INSTALL_DIR) $(1)/usr/lib/lua $(INSTALL_DIR) $(1)/www/cgi-bin + $(INSTALL_DIR) $(1)/www/ffluci $(CP) $(PKG_BUILD_DIR)/dist/* $(1)/usr/lib/lua/ -R + $(CP) $(PKG_BUILD_DIR)/contrib/media $(1)/www/ffluci/ -R $(INSTALL_BIN) $(PKG_BUILD_DIR)/contrib/ffluci $(1)/www/cgi-bin $(INSTALL_BIN) $(PKG_BUILD_DIR)/contrib/index.cgi $(1)/www/cgi-bin $(CP) -a ./ipkg/ffluci.postinst $(1)/CONTROL/postinst diff --git a/src/ffluci/controller/admin/index.lua b/examples/ffluci/controller/admin/index.lua similarity index 100% rename from src/ffluci/controller/admin/index.lua rename to examples/ffluci/controller/admin/index.lua diff --git a/src/ffluci/controller/public/example-action.lua b/examples/ffluci/controller/public/example-action.lua similarity index 100% rename from src/ffluci/controller/public/example-action.lua rename to examples/ffluci/controller/public/example-action.lua diff --git a/src/ffluci/controller/public/example-simpleview.lua b/examples/ffluci/controller/public/example-simpleview.lua similarity index 100% rename from src/ffluci/controller/public/example-simpleview.lua rename to examples/ffluci/controller/public/example-simpleview.lua diff --git a/src/ffluci/controller/public/index.lua b/examples/ffluci/controller/public/index.lua similarity index 100% rename from src/ffluci/controller/public/index.lua rename to examples/ffluci/controller/public/index.lua diff --git a/src/ffluci/view/example-simpleview/foo.htm b/examples/ffluci/view/example-simpleview/foo.htm similarity index 100% rename from src/ffluci/view/example-simpleview/foo.htm rename to examples/ffluci/view/example-simpleview/foo.htm diff --git a/src/ffluci/view/example-simpleview/index.htm b/examples/ffluci/view/example-simpleview/index.htm similarity index 100% rename from src/ffluci/view/example-simpleview/index.htm rename to examples/ffluci/view/example-simpleview/index.htm diff --git a/src/ffluci/view/hello.htm b/examples/ffluci/view/hello.htm similarity index 100% rename from src/ffluci/view/hello.htm rename to examples/ffluci/view/hello.htm diff --git a/src/ffluci/template.lua b/src/ffluci/template.lua index 8c7f07f94..3d6457169 100644 --- a/src/ffluci/template.lua +++ b/src/ffluci/template.lua @@ -39,7 +39,7 @@ viewdir = ffluci.fs.dirname(ffluci.util.__file__()) .. "view/" -- memory: Always compile, do not save compiled files, ignore precompiled -- always: Same as "memory" but also saves compiled files -- smart: Compile on demand, save compiled files, update precompiled -compiler_mode = "smart" +compiler_mode = "memory" -- This applies to compiler modes "always" and "smart" @@ -186,4 +186,4 @@ function render(name, scope) -- Now finally render the thing return view() -end \ No newline at end of file +end diff --git a/src/ffluci/view/footer.htm b/src/ffluci/view/footer.htm index 17c7245b6..c43cbb7e4 100644 --- a/src/ffluci/view/footer.htm +++ b/src/ffluci/view/footer.htm @@ -1,3 +1,7 @@ - + +
+ + +
FFLuCI 0.1 - Freifunk Lua Configuration Interface
\ No newline at end of file diff --git a/src/ffluci/view/header.htm b/src/ffluci/view/header.htm index f47388a42..2c0836be5 100644 --- a/src/ffluci/view/header.htm +++ b/src/ffluci/view/header.htm @@ -1,9 +1,56 @@ -<% require("ffluci.http").htmlheader() %> - +<% +local req = require("ffluci.dispatcher").request +local menu = require("ffluci.menu").get()[req.category] +require("ffluci.i18n").loadc("default") +require("ffluci.http").htmlheader() +%> + + -FFLuCI Examples + +FFLuCI -

FFLuCI

-<%+menu%> -
\ No newline at end of file + + + + +
+ + <% end %> +
+ +
diff --git a/src/ffluci/view/menu.htm b/src/ffluci/view/menu.htm deleted file mode 100644 index 8d5c597cf..000000000 --- a/src/ffluci/view/menu.htm +++ /dev/null @@ -1,25 +0,0 @@ -<% -local req = require("ffluci.dispatcher").request -local menu = require("ffluci.menu").get()[req.category] -local menu_module = nil -require("ffluci.i18n").loadc("default") -%> - -- 2.25.1