Permalink
Browse files

Front-end fundamentals.

  • Loading branch information...
develCuy committed Jun 19, 2011
0 parents commit d3484998825ce5f0e5d1dc43150eb0fe6b8900e8
Showing with 439 additions and 0 deletions.
  1. +19 −0 .htaccess
  2. +6 −0 CREDITS.txt
  3. +339 −0 LICENSE.txt
  4. +6 −0 content.html
  5. +2 −0 footer.html
  6. +15 −0 index.html
  7. +32 −0 lua.cgi
  8. +2 −0 sidebar_first.html
  9. +18 −0 style.css
@@ -0,0 +1,19 @@
+# Allow execution of .cgi scripts.
+AddHandler cgi-script .cgi
+
+<FilesMatch "\.(html)$">
+ Order allow,deny
+</FilesMatch>
+
+# Handle any 404 errors.
+ErrorDocument 404 /lua.cgi
+
+# Set the default handler.
+DirectoryIndex lua.cgi
+
+# Force simple error message for requests for non-existent favicon.ico.
+<Files favicon.ico>
+ # There is no end quote below, for compatibility with Apache 1.3.
+ ErrorDocument 404 "The requested file favicon.ico was not found.
+</Files>
+
@@ -0,0 +1,6 @@
+Original Author: Fernando Paredes Garcia <fernando@develcuy.com>
+
+Drupal
+------
+Ophal is inspired on Drupal API. Actually, some portions of source code were copied from Drupal and modified later.
+

Large diffs are not rendered by default.

Oops, something went wrong.
@@ -0,0 +1,6 @@
+<h4>Content</h4>
+<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. In tristique arcu sit amet nulla semper cursus. Pellentesque ut augue dui. Suspendisse ac turpis id ante gravida aliquet sed sed nisi. Fusce nec bibendum purus. Vivamus blandit ultrices magna, nec ultrices nulla ullamcorper ac. Donec eu tellus sit amet orci pharetra pharetra vitae vitae tortor. Etiam et ante vel urna mollis iaculis nec eu quam. Proin purus lectus, malesuada id hendrerit ut, pellentesque a justo. Vivamus eget magna risus, sit amet vulputate tellus. In dictum dapibus lorem, in mattis enim dapibus in. Praesent iaculis, nisl nec consequat viverra, libero purus lacinia mi, in condimentum est nisi eu lorem. Maecenas adipiscing aliquam sem, id convallis nunc imperdiet eget. Vestibulum quis sapien sodales eros ultricies adipiscing. Aliquam erat volutpat. Proin venenatis purus eget metus mattis feugiat.</p>
+
+<p>Ut luctus, orci vitae rhoncus semper, odio ante commodo erat, non pellentesque ipsum odio id arcu. Morbi congue libero nec nunc lobortis sit amet pretium turpis semper. Aliquam erat volutpat. Vestibulum scelerisque varius pulvinar. Etiam molestie diam et lorem sodales tristique. Ut sit amet erat urna. Morbi aliquam vulputate metus vitae dapibus. Ut viverra consectetur nisl eu fermentum. Nunc malesuada rhoncus ante, sed lacinia enim euismod vel. Integer accumsan velit dui, sit amet mattis nulla. In ac felis at magna suscipit auctor ut quis neque. Aliquam cursus gravida egestas.</p>
+
+<p>Morbi placerat viverra dui, vitae malesuada enim varius at. Donec hendrerit nisl sed ligula iaculis ornare. Donec fringilla vestibulum tristique. Pellentesque eget dui lorem, bibendum consectetur enim. Quisque consequat libero quis enim laoreet condimentum. Etiam sem felis, accumsan at accumsan eget, ultrices ac nulla. Etiam in mollis dolor. Ut a leo nibh. Praesent quis odio et dolor pulvinar adipiscing. Praesent ut sapien sit amet sem pulvinar interdum. Nullam accumsan imperdiet nisi. Pellentesque sodales magna vel tortor eleifend ac molestie dolor mollis. Praesent viverra mollis urna, eget pretium nulla congue nec. Curabitur neque elit, porttitor sit amet pharetra ac, vehicula rutrum lacus.</p>
@@ -0,0 +1,2 @@
+<h4>Footer</h4>
+Aliquam imperdiet luctus placerat. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae;
@@ -0,0 +1,15 @@
+<html xmlns="http://www.w3.org/1999/xhtml" lang="es" xml:lang="es">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+<title>Ophal</title>
+<link type="text/css" rel="stylesheet" media="all" href="/style.css" />
+</head>
+<body>
+<div id="header">
+<h1>Title</h1>
+</div>
+<div id="sidebar">]]; include [[sidebar_first.html]]; print [[</div>
+<div class="content">]]; include [[content.html]]; print [[</div>
+<div id="footer">]]; include [[footer.html]]; print [[</div>
+</body>
+</html>
32 lua.cgi
@@ -0,0 +1,32 @@
+#!/usr/bin/env luajit
+
+print [[Content-type: text/html; charset=utf-8
+]]
+
+function include(file)
+ -- read the whole contents of the file
+ local fh = assert(open(file))
+ local src = 'print [[' .. fh:read([[*a]]) .. ']]'
+ fh:close()
+ -- translates the file into a function
+ local prog = loadstring(src)
+ setfenv (prog, env)
+ local status, err = pcall(prog)
+ if not status then
+ print [[<strong>]]; print(err); print[[</strong>]]
+ end
+end
+
+--[[ TODO
+- Use hook:bootstrap to allow modules call its dependencies when needed,
+- Use hook:bootstrap to fill the list of Ophal modules to load,
+- Use hook:environment to fill the list of Lua functions to load, modules call its dependencies when needed,
+- Optionally (setting based), build a cache of dependencies based on path
+]]
+
+env = {open = io.open, pcall = pcall, loadstring = loadstring, setfenv = setfenv, assert = assert, print = print, include = include}
+env.env = env
+
+setfenv(include, env)
+
+include([[index.html]])
@@ -0,0 +1,2 @@
+<h4>Sidebar first</h4>
+Phasellus a massa nisl, quis auctor metus. Praesent sodales, sapien non pharetra facilisis, eros magna iaculis dui, et accumsan augue dui non massa. Aliquam tempor nisi bibendum orci aliquet eget molestie ante ullamcorper. Nullam interdum magna id metus commodo vel congue sem porta.
@@ -0,0 +1,18 @@
+#header {
+ margin: 0 0 16px 160px;
+}
+
+#sidebar {
+ width: 160px;
+ height: 600px;
+ position: fixed;
+ float: left;
+}
+
+.content {
+ margin-left: 170px; /* left sidebar*/
+}
+
+h1 {
+ margin-bottom: 5px;
+}

0 comments on commit d348499

Please sign in to comment.