Created
November 15, 2010 20:58
-
-
Save alexnask/700943 to your computer and use it in GitHub Desktop.
admin.thtml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{[ _GET(name) == _CONFIG(adminName) ] | |
{[ _GET(password) == _CONFIG(adminPass) ] | |
<!-- Logged in as administrator --> | |
{[ _POST(action) == NULL ] | |
<!-- No action :) --> | |
{[ _GET(database) == NULL ] | |
<!-- And no database selected --> | |
<h1>Listing databases</h1><br/> | |
<% | |
DatabaseNames: dbs | |
DatabaseCount: num | |
%> | |
{[ i: 0 .. num ] | |
<a href="oocms.cgi?page=admin&database=<%Show: dbs(i)%>&name=<%Show: _GET(name)%>&password=<%Show: _GET(password)%>"><%Show: dbs(i)%></a><br/> | |
} | |
} | |
{[ _GET(database) != NULL ] | |
<!-- Database selected --> | |
<h1>Listing database <%Show: _GET(database)%></h1><br/> | |
<% | |
Database: _GET(database) | |
Count: lineCount | |
PrintDatabase: lineCount | |
%> | |
<br/><br/> | |
<h3>Delete line</h3> | |
<em>Tip: numbering of lines starts at zero</em><br/><br/> | |
<form method="POST" action="oocms.cgi?page=admin&name=<% Show: _GET(name) %>&password=<% Show: _GET(password) %>&database=<% Show: _GET(database) %>"> | |
<input type="hidden" name="action" value="delete"/> | |
Number of line:<input type="text" name="deleteIndex" /><br/> | |
<input type="submit" value="Delete" /> | |
</form> | |
<br/><br/> | |
<h3>Edit/Create line</h3> | |
<em>Tip: numbering of lines starts at zero</em><br/> | |
<em>Tip: to create a line just leave number of line field empty</em><br/> | |
<em>Tip: leave a field empty to specify you do not want to change its value</em><br/><br/> | |
<form method="POST" action="oocms.cgi?page=admin&name=<% Show: _GET(name) %>&password=<% Show: _GET(password) %>&database=<% Show: _GET(database) %>"> | |
<input type="hidden" name="action" value="edit"/> | |
<p>Number of line:<input type="text" name="lineIndex" /><br/></p> | |
<% | |
ColumnCount: fields | |
%> | |
<input type="hidden" name="fields" value="<%Show: fields%>"/> | |
{[ i: 0 .. fields ] | |
<p>Column <%Show: i%>:<input type="text" name="data<%Show: i%>"/><br/></p> | |
} | |
<input type="submit" value="Edit" /> | |
</form> | |
} | |
} | |
{[ _POST(action) != NULL ] | |
{[ _GET(database) != NULL ] | |
<% | |
Database: _GET(database) | |
%> | |
{[ _POST(action) == delete ] | |
<!-- Need to delete stuff? What a shame... :( --> | |
<% | |
DeleteLine: _POST(deleteIndex) | |
%> | |
<p>Line <%Show: _POST(deleteIndex)%> deleted.</p> | |
} | |
{[ _POST(action) == edit ] | |
<!-- Edit/Create stuff --> | |
{[ _POST(fields) != NULL ] | |
{[ _POST(lineIndex) != NULL] | |
{[ i: 0 .. _POST(fields) ] | |
{[ _POST(data{i}) != NULL ] | |
<% | |
EditField: _POST(lineIndex),i,_POST(data{i}) | |
%> | |
} | |
} | |
<p>Line edited with success. <a href="oocms.cgi?page=admin&name=<% Show: _GET(name) %>&password=<% Show: _GET(password) %> ">Return to administration index.</a></p> | |
} | |
{[ _POST(lineIndex) == NULL] | |
<% Count: lineIndex %> | |
{[ i: 0 .. _POST(fields) ] | |
<% | |
EditField: lineIndex,i,_POST(data{i}) | |
%> | |
} | |
<p>Line created with success. <a href="oocms.cgi?page=admin&name=<% Show: _GET(name) %>&password=<% Show: _GET(password) %> ">Return to administration index.</a></p> | |
} | |
} | |
} | |
} | |
} | |
} | |
{[ _GET(password) != _CONFIG(adminPass) ] | |
<!-- Not logged in as administrator --> | |
<p>You must login as an administrator to access the control panel</p><br/> | |
<form method="GET" action="oocms.cgi"> | |
<input type="hidden" name="page" value="admin"/> | |
Name: <input type="text" name="name" /><br/> | |
Password: <input type="password" name="password" /><br/> | |
<input type="submit" value="login" /> | |
</form> | |
} | |
} | |
{[ _GET(name) != _CONFIG(adminName) ] | |
<!-- Not logged in as administrator --> | |
<p>You must login as an administrator to access the control panel</p><br/> | |
<form method="GET" action="oocms.cgi"> | |
Name: <input type="text" name="name" /><br/> | |
<input type="hidden" name="page" value="admin"/> | |
Password: <input type="password" name="password" /><br/> | |
<input type="submit" value="login" /> | |
</form> | |
} | |
<br/><br/><br/> | |
<em>Control panel - oocms version <% Show: _CONFIG(version) %></em> |
Loop syntax changed and now these changes are actually implemented in oocms
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Made THTML look a little bit better but i dont know how to make big changes in readability without re-designing my code entirely :/ just changed the block symbols but it looks better already ;)