Kawai Wiki

Rev

Rev 35 | Rev 37 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
12 soliveira 1
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2
<%@taglib prefix="mtw" uri="http://www.mentaframework.org/tags-mtw/"%>
26 soliveira 3
<%@ taglib uri="/WEB-INF/tld/taglib.tld" prefix="k" %>
12 soliveira 4
 
5
<html>
6
<head>
7
 
8
<title>Mentawai Web Framework</title>
9
 
10
<style type="text/css" media="all">
31 soliveira 11
@import url("<mtw:contextPath/>/GenerateCSS.getCSS.css");
12 soliveira 12
</style>
13
 
14
<meta http-equiv="imagetoolbar" content="no" />
15
<meta http-equiv="imagetoolbar" content="false" />
16
 
17
<link rel="shortcut icon" type="image/x-icon" href="favicon.ico" />
18
<link rel="icon" type="image/gif" href="/favicon.gif" />
31 soliveira 19
<link rel="stylesheet" href="<mtw:contextPath/>/GenerateCSS.getPrintCSS.css" type="text/css" media="print" />
12 soliveira 20
 
21
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
22
<meta name="author" content="Sergio Oliveira Junior" />
23
<meta name="email" content="sergio.oliveira.jr@gmail.com" />
24
 
25
<link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery-ui.css" rel="stylesheet" type="text/css" />
26
<script type="text/javascript" src="jquery/jquery-1.6.4.min.js"></script>
27
<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js"></script>
28
 
29
<script language="JavaScript">
30
 
31
        $(document).ready(function() {
33 soliveira 32
 
33
        	<mtw:if test="showForm" value="login">
12 soliveira 34
 
33 soliveira 35
			showLoginDialog();
36
 
37
			</mtw:if>
35 soliveira 38
 
39
			$('#loginDialog').keyup(function(e) {
40
    			if (e.keyCode == 13) {
41
        			$('#loginForm').submit();
42
    			}
43
			});
44
 
33 soliveira 45
 
12 soliveira 46
        });
47
 
28 soliveira 48
        function prepareEditPageDialog(myDialog, theTitle) {
12 soliveira 49
 
50
            options = {
51
                autoOpen: false,
52
                width: 800,
53
                modal: true,
54
                title: theTitle,
55
                buttons: [
56
                          {
57
                                text: "Save",
28 soliveira 58
                                click: function() { $('#editPageForm').submit(); }
12 soliveira 59
                          },
60
                          {
61
                                text: "Cancel",
62
                                click: function() { $(this).dialog("close"); }
63
                          }
64
                      ]
65
           };
66
 
67
          myDialog.dialog(options);
68
 
69
          return myDialog;
70
        }
33 soliveira 71
 
28 soliveira 72
        function showEditPageDialog(pageName) {
12 soliveira 73
 
28 soliveira 74
            $.getJSON('<mtw:contextPath />/Page.getPage.mtw?name=' + pageName, function(data) {
18 soliveira 75
 
28 soliveira 76
                $('#editPageTextArea').val(data.page.body);
77
                $('#editPageName').val(data.page.name);
78
                $('#editPageLanguageId').val(data.page.languageId);
12 soliveira 79
 
28 soliveira 80
                myDialog = $('#editPageDialog');
81
                myDialog = prepareEditPageDialog(myDialog, 'Editing <i><font color="darkblue">' + pageName + "</font></i> in <i>" + data.page.language + "<i>...");
12 soliveira 82
                myDialog.dialog('open');
83
            });
84
 
85
            return false;
86
        }
33 soliveira 87
 
36 soliveira 88
       	function showCreateNewPageDialog() {
89
 
90
            myDialog = $('#createNewPageDialog');
91
            myDialog = prepareCreateNewPageDialog(myDialog);
92
            myDialog.dialog('open');
93
 
94
            return false;
95
        }
96
 
97
        function prepareCreateNewPageDialog(myDialog) {
98
 
99
            options = {
100
            	close: function() { clearCreateNewPageForm(); },
101
                autoOpen: false,
102
                width: 800,
103
                modal: true,
104
                title: "Create New Page:",
105
                buttons: [
106
                          {
107
                                text: "Login",
108
                                click: function() { $('#loginForm').submit(); }
109
                          },
110
                          {
111
                                text: "Cancel",
112
                                click: function() {  clearCreateNewPageForm(); $(this).dialog("close"); }
113
                          }
114
                      ]
115
           };
116
 
117
          myDialog.dialog(options);
118
 
119
          return myDialog;
120
        }
121
 
33 soliveira 122
 
123
        function showLoginDialog() {
12 soliveira 124
 
33 soliveira 125
            myDialog = $('#loginDialog');
126
            myDialog = prepareLoginDialog(myDialog);
127
            myDialog.dialog('open');
128
 
129
            return false;
130
        }
131
 
35 soliveira 132
        function clearLoginForm() {
133
        	$('#loginUsername').val('');
134
        	$('#loginPassword').val('');
135
        	$('#loginUsernameError').text('');
136
        	$('#loginPasswordError').text('');
36 soliveira 137
        }
33 soliveira 138
 
36 soliveira 139
        function clearCreateNewPageForm() {
140
        	$('#createNewPageName').val('');
141
        	$('#createNewPageTitle').val('');
142
        	$('#createNewPageLanguage').val('');
143
        	$('#createNewPageTextArea').val('');
144
        }
145
 
33 soliveira 146
      	function prepareLoginDialog(myDialog) {
147
 
148
            options = {
35 soliveira 149
            	close: function() { clearLoginForm(); },
33 soliveira 150
                autoOpen: false,
151
                width: 290,
152
                modal: true,
153
                title: "Login:",
154
                buttons: [
155
                          {
156
                                text: "Login",
157
                                click: function() { $('#loginForm').submit(); }
158
                          },
159
                          {
160
                                text: "Cancel",
35 soliveira 161
                                click: function() {  clearLoginForm(); $(this).dialog("close"); }
33 soliveira 162
                          }
163
                      ]
164
           };
165
 
166
          myDialog.dialog(options);
167
 
168
          return myDialog;
169
        }
170
 
12 soliveira 171
    </script>
172
 
173
</head>
174
 
175
<body class="composite">
176
 
177
<!-- For Testing -->
178
<div id="dialog" title="Dialog Title" style="display: none;">I'm in a dialog</div>
179
 
33 soliveira 180
<!-- For Editing Pages -->
28 soliveira 181
<div id="editPageDialog" style="display: none;">
182
<form id="editPageForm" action="<mtw:contextPath />/Page.editPage.mtw" method="post">
183
<input type="hidden" name="name" id ="editPageName" value="" />
184
<input type="hidden" name="languageId" id="editPageLanguageId" value="" />
12 soliveira 185
<table>
186
    <tr>
187
        <td>&nbsp;</td>
188
    </tr>
28 soliveira 189
    <mtw:outError field="html">
12 soliveira 190
        <tr>
191
            <td colspan="2"><span class="Negative" style="font-weight: bold;"><mtw:out /></span></td>
192
        </tr>
193
    </mtw:outError>
194
    <tr>
28 soliveira 195
        <td colspan="2"><mtw:textarea id="editPageTextArea" name="body" style="width: 100%; height: 465px;" /></td>
12 soliveira 196
    </tr>
197
</table>
198
</form>
199
</div>
200
 
33 soliveira 201
<!-- For Login -->
202
<div id="loginDialog" style="display: none;">
203
		<form action="<mtw:contextPath />/Login.mtw" method="post" id="loginForm">
204
			<table>
205
				<tr>
206
					<td>
207
						Username:
208
					</td>
209
					<td>
35 soliveira 210
						<mtw:input id="loginUsername" name="username" size="20" maxlength="20" />
211
						<span id="loginUsernameError">
33 soliveira 212
						<mtw:outError field="username">
213
							<font color="red">
214
								<b><mtw:out /></b>
215
							</font>
216
						</mtw:outError>
35 soliveira 217
						</span>
33 soliveira 218
					</td>
219
				</tr>
220
				<tr>
221
					<td>
222
						Password:
223
					</td>
224
					<td>
35 soliveira 225
						<mtw:input id="loginPassword" name="password" type="password" size="20" maxlength="20" />
226
						<span id="loginPasswordError">
33 soliveira 227
						<mtw:outError field="password">
228
							<font color="red">
229
								<b><mtw:out /></b>
230
							</font>
231
						</mtw:outError>
35 soliveira 232
						</span>
33 soliveira 233
					</td>
234
				</tr>
235
			</table>
236
		</form>
237
</div>
238
 
36 soliveira 239
<!-- Create New Page -->
240
<div id="createNewPageDialog" style="display: none;">
241
		<form action="<mtw:contextPath />/Page.add.mtw" method="post" id="createNewPageForm">
242
			<table>
243
				<tr>
244
					<td>
245
						Name:
246
					</td>
247
					<td>
248
						<mtw:input id="createNewPageName" name="name" size="40" maxlength="30" />
249
						<span id="createNewPageNameError">
250
						<mtw:outError field="name">
251
							<font color="red">
252
								<b><mtw:out /></b>
253
							</font>
254
						</mtw:outError>
255
						</span>
256
					</td>
257
				</tr>
258
				<tr>
259
					<td>
260
						Title:
261
					</td>
262
					<td>
263
						<mtw:input id="createNewPageTitle" name="title" size="40" maxlength="60" />
264
						<span id="createNewPageTitleError">
265
						<mtw:outError field="title">
266
							<font color="red">
267
								<b><mtw:out /></b>
268
							</font>
269
						</mtw:outError>
270
						</span>
271
					</td>
272
				</tr>
273
				<tr>
274
					<td>
275
						Language:
276
					</td>
277
					<td>
278
						<mtw:select name="languageId" list="languages" id="createNewPageLanguage" emptyField="true" />
279
						<span id="createNewPageLanguageError">
280
						<mtw:outError field="languageId">
281
							<font color="red">
282
								<b><mtw:out /></b>
283
							</font>
284
						</mtw:outError>
285
						</span>
286
					</td>
287
				</tr>
288
				<tr>
289
        			<td colspan="2"><mtw:textarea id="createNewPageTextArea" name="body" style="width: 100%; height: 465px;" /></td>
290
    			</tr>
291
			</table>
292
		</form>
293
</div>
33 soliveira 294
 
36 soliveira 295
 
12 soliveira 296
<div>
297
<table border="0">
298
    <tr>
299
        <td><a href="/"><img src="images/logos/logo.png" border="0"></img></a></td>
22 soliveira 300
        <td align="right" valign="bottom">
301
            <mtw:isLogged negate="true">
33 soliveira 302
                <a href="#" onclick="return showLoginDialog();">Login</a>
22 soliveira 303
            </mtw:isLogged>
304
            <mtw:isLogged>
36 soliveira 305
                <a href="#" onclick="return showCreateNewPageDialog();">Create New Page</a> |
22 soliveira 306
                <a href="<mtw:contextPath/>/Page.list.mtw">List Pages</a> |
31 soliveira 307
                <a href="#" onclick="return showEditPageDialog('CSS');" title="<k:editTooltip name="css" />">Edit CSS</a> |
22 soliveira 308
                <a href="<mtw:contextPath/>/Logout.mtw">Logout</a> (<mtw:out value="sessionUser.username" />)
309
            </mtw:isLogged>
310
            &nbsp;
311
            <a href="<mtw:urlWithLoc loc="pt" />"><img src="images/brazil.gif" border="0" width="20" height="13" /></a>
312
            <a href="<mtw:urlWithLoc loc="en" />"><img src="images/usa.gif" width="20" height="13" border="0" /></a>
313
            &nbsp;&nbsp;&nbsp;
314
        </td>
12 soliveira 315
    </tr>
316
</table>
317
</div>
318
 
319
<hr />
320
 
321
<div id="leftColumn"><mtw:isLogged>
322
    <mtw:hasAuthorization groups="admin, editor">
28 soliveira 323
        <div style="text-align: right; padding-right: 14px; padding-top: 6px;"><a href="#" onclick="return showEditPageDialog('LeftColumn');" title="<k:editTooltip name="leftColumn" />">Edit</a></div>
12 soliveira 324
    </mtw:hasAuthorization>
325
</mtw:isLogged>
20 soliveira 326
<div id="navcolumn">
327
    <div>
22 soliveira 328
    <mtw:out value="leftColumn.body" />
20 soliveira 329
    </div>
330
<br />
12 soliveira 331
</div>
332
 
333
</div>
334
 
335
<div id="bodyColumn">
28 soliveira 336
    <mtw:hasAuthorization groups="admin, editor">
337
    <div style="text-align: right; padding-right: 14px;"><a href="#" onclick="return showEditPageDialog('<mtw:out value="bodyColumn.name" />');" title="<k:editTooltip name="bodyColumn" />">Edit</a></div>
338
    </mtw:hasAuthorization>
24 soliveira 339
    <mtw:out value="bodyColumn.body" />
12 soliveira 340
</div>
341
 
342
<div class="clear">
343
<hr />
344
</div>
345
 
346
<div id="footer">
347
<div class="xright">Copyright  2011</div>
348
<div class="clear">
349
<hr />
350
</div>
351
</div>
352
 
353
</body>
354
</html>