API Overview API Index Package Overview Direct link to this page
JavaOnTracks 0.1.2
  net.jot.web.views. JOTBuiltinTemplates View Javadoc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57

/*
------------------------------------
JavaOnTracks          Thibaut Colar
tcolar-jot AT colar DOT net
Artistic Licence 2.0
http://www.javaontracks.net
------------------------------------
 */
package net.jot.web.views;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;

/**
 * 1 liner templates are generated using the "main" here from the templates in the "templates" folder
 * Those are just some JOT default/failover templates used when the user did not defined his own.
 * @author thibautc
 *
 */
public class JOTBuiltinTemplates {
public static final String WIDGETPAGEBUILDER_TEMPLATE="<html>\n    <head>\n        <meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\">\n        <title>Widget Page Editor</title>\n        <style type=\"text/css\">\n            .grid{background-color:#eeeeee;position:absolute;border:1px;border-style:dashed;width:98px;height:98px;float:left}    \n        </style>\n    </head>\n    \n    <body class=\"body\">    \n        <div style=\"overflow-x:auto;min-width:1000px\">\n            \n            <div style=\"float:left;width:250px\">\n                <div style=\"background-color:#a6b9db;width:250px;height:250px;\"><b>Editor</b><br/>\n                    <form id=\"selectform\" action=\"pagebuilderajax.do\">\n                        <input type=\"hidden\" name=\"action\" id=\"select_action\">\n                        <select id=\"widget_select\" name=\"widget_select\" size=\"5\">\n                        </select>\n                        <br/>\n                        <input type=\"button\" value=\"Remove\" onclick=\"document.getElementById('select_action').value='Remove';jot_ajax_JOTPagePreview_1_form('selectform');\">\n                        <br/>\n                        <input type=\"button\" value=\"Up\" onclick=\"document.getElementById('select_action').value='Up';jot_ajax_JOTPagePreview_1_form('selectform');\">\n                        <input type=\"button\" value=\"Down\" onclick=\"document.getElementById('select_action').value='Down';jot_ajax_JOTPagePreview_1_form('selectform');\">\n                    </form>\n                    <hr/>\n                    <form id=\"addform\" action=\"pagebuilderajax.do\">\n                        Name: <input type=\"name\" name=\"name\" size=\"8\"><br/>\n                        <input type=\"button\" name=\"action\" value=\"Add\" onclick=\"jot_ajax_JOTPagePreview_1_form('addform');\">\n                    </form>\n                    <hr/>\n                </div>\n                <div id=\"props\" style=\"background-color:#b9dba6;width:250px;min-height:25px;\">Properties\n                </div>\n            </div>\n            <div style=\"position:absolute;left:260px;top:8px;width:700px;\">\n                <jot:widget class=\"net.jot.web.widget.pagebuilder.JOTPagePreview\"/>\n            </div>\n            \n        </div>\n    </body>\n</html>\n";
public static final String EXAMPLEWIDGET_TEMPLATE="<html>\n<head>\n<meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\">\n<title>JOT Widget Example</title>\n</head>\n\n<body class=\"body\">    \n<jot:widget class=\"net.jot.web.widget.JOTExampleWidget\" args=\"size='15',color='#ffeeee'\"/>\n\n<jot:widget class=\"net.jot.web.widget.JOTExampleWidget\" args=\"refresh='2',size='25',color='#eeffee'\"/>\n\n<jot:widget class=\"net.jot.web.widget.JOTExampleWidget\" args=\"refresh='10',size='35',color='#eeeeff'\"/>\n</body>\n</html>\n";
public static final String FORBIDDEN_TEMPLATE="<html>\n<head>\n<meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\">\n<title>JOT Forbidden</title>\n<style type=\"text/css\">\n<!--\n.titlebar {\n        background-color: #2255bb;\n        border: thin solid #000000;\n        width:90%;\n        height:28px;\n}\n.title {\n        font-size: 20px;\n        font-weight: bold;\n        color:#CC9933;\n        left:40px;\n}\n.errorbar {\n        background-color: #1144aa;\n        border: thin solid #000000;\n        width:90%;\n        height:22px;\n}\n.error {\n        font-size: 16px;\n        font-weight: bold;\n        color:#CC9933;\n        left:40px;\n}\n.errorbox {\n        background-color: #002299;\n        border: thin solid #000000;\n        width:90%;\n        font-size: 12px;\n        font-weight: bold;\n        color:#CC9933;\n}\n.body {\n        background-color: #333333;\n}\n</style>\n</head>\n\n<body class=\"body\">\n<table width=\"100%\"><tr><td  align=\"center\">\n<div class=\"titlebar\">\n<div class=\"title\">! JOT: FORBIDDEN ACCESS !</div>\n</div>\n<div style=\"height:20px\"></div>\n<div class=\"errorbar\">\n<div class=\"error\">Forbidden</div>\n</div>\n<div class=\"errorbox\" align=\"left\">\nAccess to this page has been disabled.\n</div>\n</td></tr></table>\n</body>\n</html>\n";
public static final String ERROR_TEMPLATE="<html>\n<head>\n<meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\">\n<title>JOT Error</title>\n<style type=\"text/css\">\n<!--\n.titlebar {\n        background-color: #2255bb;\n        border: thin solid #000000;\n        width:90%;\n        height:28px;\n}\n.title {\n        font-size: 20px;\n        font-weight: bold;\n        color:#CC9933;\n        left:40px;\n}\n.errorbar {\n        background-color: #1144aa;\n        border: thin solid #000000;\n        width:90%;\n        height:22px;\n}\n.error {\n        font-size: 16px;\n        font-weight: bold;\n        color:#CC9933;\n        left:40px;\n}\n.errorbox {\n        background-color: #002299;\n        border: thin solid #000000;\n        width:90%;\n        font-size: 12px;\n        font-weight: bold;\n        color:#CC9933;\n}\n.body {\n        background-color: #333333;\n}\n</style>\n</head>\n\n<body class=\"body\">\n<table width=\"100%\"><tr><td  align=\"center\">\n<div class=\"titlebar\">\n<div class=\"title\">! JOT MISSING_VALUE !: UNEXPECTED ERROR !</div>\n</div>\n<div style=\"height:20px\"></div>\n<div class=\"errorbar\">\n<div class=\"error\">MISSING_VALUE !</div>\n</div>\n<div class=\"errorbox\" align=\"left\">\n<jot:loop over=\"getStackTrace(exception)\" as=\"traceElement\">\n&nbsp;@MISSING_VALUE !<br>\n</jot:loop>\n</div>\n<jot:if eval=\"cause\">\n<div class=\"errorbar\">\n<div class=\"error\">Caused By: MISSING_VALUE ! </div>\n</div>\n<div class=\"errorbox\" align=\"left\">\n<jot:loop over=\"getStackTrace(cause)\" as=\"traceElement\">\n&nbsp;@MISSING_VALUE !<br>\n</jot:loop>\n</div>\n</jot:if>\n</td></tr></table>\n</body>\n</html>\n";
public static final String FILEMANAGER_TEMPLATE="<html>\n<head>\n<meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\">\n<title>File Manager</title>\n<style type=\"text/css\">\n<!--\n.body {background-color: #ffffff;}\n.title {color: #0000aa;font-weight:bold;}\n.action {background-color: #ffeeee;}\n.folder {background-color: #eeeeee;color: #440088;}\n.file{background-color: #eeeeee;color: #000000;}\n.newFolder {background-color: #eeeeee;color: #440088;        font-weight:bold;}\n.newFile{background-color: #eeeeee;color: #000000;        font-weight:bold;}\n.upFolder{color: #ff0000;font-weight:bold;}\n.path{color: #008800;font-weight:bold;}\n.warning{position:absolute;top:200px;left:200px;background-color: #ffeeee;color:#ff0000;z-index: 99;border: 3px;border-color: #ff0000;border-style: ridge;min-width: 300px;min-height: 200px;padding: 5px}\n.question{position:absolute;top:200px;left:200px;background-color: #eeeeff;color:#00ff00;z-index: 99;border: 3px;border-color: #0000ff;border-style: ridge;min-width: 300px;min-height: 100px;padding: 5px;display:none}\n-->\n</style>\n</head>\n\n<body class=\"body\">\n<jot:if eval=\"fbSession.currentWarning\">\n<div id='warning' class=\"warning\" onClick=\"document.getElementById('warning').style.display='none';\">\n<center>\nMISSING_VALUE !\n</center>\n</div>\n</jot:if>\n\n<table width=\"100%\">\n<jot:if eval=\"fbSession.title\">\n<tr><td  class=\"title\" align=\"center\" colspan=\"2\">MISSING_VALUE !</td></tr>\n</jot:if>\n<jot:if eval=\"fbSession.isAllowCreateFolders\">\n<tr>\n<form action=\"?\" method=\"POST\"><td  class=\"action\">New Folder: </td><td  class=\"action\">\n    <input type=\"hidden\" name=\"_JOT_FB_ACTION\" value=\"CREATE_FOLDER\">\n    <input type=\"text\" size=\"20\" name=\"_JOT_FB_VALUE\">\n    <input type=\"submit\" value=\"Create Folder\">\n</td>\n</form>\n</tr>\n</jot:if>\n<jot:if eval=\"fbSession.isAllowUploadFile\">\n<tr>\n<form action=\"?\" enctype=\"multipart/form-data\"  method=\"POST\"><td  class=\"action\">Upload File(s): </td><td  class=\"action\">\n<jot:if eval=\"! fbSession.lookingForSingleFileUpload\">\n<input type=\"hidden\" name=\"_JOT_FB_ACTION\" value=\"UPLOAD\">\n</jot:if>\n<jot:if eval=\"fbSession.lookingForSingleFileUpload\">\n<input type=\"hidden\" name=\"_JOT_FB_ACTION\" value=\"SELECT\">\n</jot:if>\n<jot:loop from=\"1\" to=\"fbSession.nbOfUploadFields\">\n<input type=\"file\" size=\"20\" name=\"fileMISSING_VALUE !\"><br>\n</jot:loop>\n<jot:if eval=\"fbSession.isAllowUpdateFile\">\nOverwrite Existing files: <input type=\"checkbox\" name=\"_JOT_FORCE_UPDATE\"><br>\n<input type=\"submit\" value=\"Upload File(s)\">\n</jot:if>\n</td>\n</form>\n</tr>\n</jot:if>\n<tr><td colspan=\"2\">\n<jot:if eval=\"fbSession.isAllowShowPath\">\nLocation: <span class=\"path\">MISSING_VALUE !</span>\n</jot:if>\n</td></tr>\n</table>\n\n<jot:if eval=\"fbSession.isAllowListFiles\">\n<form action=\"?\" method=\"post\">\n<input type=\"hidden\" name=\"_JOT_FB_ACTION\" value=\"SELECT\">\n<table width=\"100%\">\n<jot:if eval=\"fbSession.upFolder\">\n<tr><td  colspan=\"2\" class=\"upFolder\"><a class=\"upFolder\" href='?_JOT_FB_ACTION=BROWSE_TO&_JOT_FB_VALUE=UP'>UP (MISSING_VALUE !)</a></td></tr>\n</jot:if>\n<jot:if eval=\"! fbSession.upFolder\">\n<tr><td  colspan=\"2\">UP</td></tr>\n</jot:if>\n<tr><td colspan=\"2\"><table border=\"1\">\n<tr><th>&nbsp;</th><th>Name (<a href=\"?_JOT_FB_ACTION=SORT_BY&_JOT_FB_VALUE=name\">sort</a>)</th><th>Size (<a href=\"?_JOT_FB_ACTION=SORT_BY&_JOT_FB_VALUE=size\">sort</a>)</th><th>Last Modif. (<a href=\"?_JOT_FB_ACTION=SORT_BY&_JOT_FB_VALUE=timestamp\">sort</a>)</th><th>Actions</th></tr>\n<jot:loop over=\"fbSession.fileListing\" as=\"file\">\n<tr>\n<td class=\"file\"><input type=\"checkbox\" name=\"_JOT_FILE_SELECT_MISSING_VALUE !\"></td>\n<jot:if eval=\"file.isDirectory()\">\n<td class='MISSING_VALUE !'>\n<a class='MISSING_VALUE !' href='?_JOT_FB_ACTION=BROWSE_TO&_JOT_FB_VALUE=MISSING_VALUE !'>\nMISSING_VALUE !\n</a>\n</td>\n<td class=\"file\">\n</td>\n<td class=\"file\">\nMISSING_VALUE !\n</td>\n</jot:if>\n<jot:if eval=\"! file.isDirectory()\">\n<td class='MISSING_VALUE !'>\n<jot:if eval=\"fbSession.isAllowDowloadFile\">\nMISSING_VALUE !\n</jot:if>\n<jot:if eval=\"! fbSession.isAllowDowloadFile\">\n<a class=\"MISSING_VALUE !\" href='?_JOT_FB_ACTION=DOWNLOAD&_JOT_FB_VALUE=MISSING_VALUE !'>\nMISSING_VALUE !\n</a>\n</jot:if>\n</td>\n<td class=\"file\">\nMISSING_VALUE !\n</td>\n<td class=\"file\">\nMISSING_VALUE !\n</td>\n</jot:if>\n<td class=\"file\">\n<!--  rename block -->\n<jot:if eval=\"fbSession.isAllowRenaming\">\n<a onClick=\"document.getElementById('rename_MISSING_VALUE !').style.display='block';\" href=\"#\">Rename</a>\n</jot:if>;\n<!--  delete block -->\n<jot:if eval=\"fbSession.isAllowDelete\">\n&nbsp<a onClick=\"document.getElementById('delete_MISSING_VALUE !').style.display='block';\" href=\"#\">Delete</a>\n</jot:if>\n</td>\n</tr>\n</jot:loop>\n</table></td></tr>\n</table>\n<input type=\"submit\" value=\"Select\">\n</form>\n</jot:if>\n\n<!-- We can't have form within forms, so we had the rename/delete form down here. -->\n<jot:loop over=\"fbSession.fileListing\" as=\"file\">\n<div class=\"question\" id=\"rename_MISSING_VALUE !\">\n<form action=\"?\"  method=\"POST\">\n<center>\n<input type=\"hidden\" name=\"_JOT_FB_ACTION\" value=\"RENAME\">\n<input type=\"hidden\" name=\"_JOT_FB_VALUE\" value=\"MISSING_VALUE !\">\nNew Name: <input type=\"text\" size=\"12\" name=\"newname\" value=\"MISSING_VALUE !\"><br><br>\n<input type=\"button\" value=\"Cancel\" onClick=\"document.getElementById('rename_MISSING_VALUE !').style.display='none';\"> <input type=\"submit\" value=\"Rename\">\n</center>\n</form>\n</div>\n<div class=\"question\" id=\"delete_MISSING_VALUE !\">\n<form action=\"?\"  method=\"POST\">\n<center>\n<input type=\"hidden\" name=\"_JOT_FB_ACTION\" value=\"DELETE\">\n<input type=\"hidden\" name=\"_JOT_FB_VALUE\" value=\"MISSING_VALUE !\">\nDelete 'MISSING_VALUE !' ?<br>\n<jot:if eval=\"file.isDirectory\">\n<jot:if eval=\"fbSession.isAllowDeleteFilledFolders\">\nDelete recursively: <input type=\"checkbox\" name=\"_JOT_FORCE_DELETE\"><br>\n</jot:if>\n</jot:if>\n<br>\n<input type=\"button\" value=\"Cancel\" onClick=\"document.getElementById('delete_MISSING_VALUE !').style.display='none';\"> <input type=\"submit\" value=\"Yes\">\n</center>\n</form>\n</div>\n</jot:loop>\n\n</body>\n</html>\n";

    /**
     * Used to transform the templates from the template folder into code 1 liners.
     * @param args
     * @throws Exception
     */
    public static void main(String[] args) throws Exception
    {
        File folder = new File("templates");
        String[] templates = folder.list();
        for (int i = 0; i != templates.length; i++)
        {
            String template = templates[i];
            String definition = "public static final String " + template.substring(0, template.indexOf(".")).toUpperCase() + "_TEMPLATE";
            File f = new File(folder, template);
            if (f.isFile())
            {
                BufferedReader reader = new BufferedReader(new FileReader(f));
                String oneLiner = "";
                String s;
                while ((s = reader.readLine()) != null)
                {
                    oneLiner += s + "\\n";
                }
                // backquotes the quotes
                oneLiner = oneLiner.replaceAll("\"", "\\\\\"");
                System.out.println(definition + "=\"" + oneLiner + "\";");
            }
        }
    }
}

Generated By: JavaOnTracks Doclet 0.1.5     ©Thibaut Colar