Kawai Wiki

Rev

Rev 36 | Rev 38 | 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 = {
37 soliveira 100
            	close: function() { clearCreateNewPageForm(); alert(formDirty); },
36 soliveira 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",
37 soliveira 112
                                click: function() {  $(this).dialog("close"); }
36 soliveira 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",
37 soliveira 161
                                click: function() {  $(this).dialog("close"); }
33 soliveira 162
                          }
163
                      ]
164
           };
165
 
166
          myDialog.dialog(options);
167
 
168
          return myDialog;
169
        }
37 soliveira 170
 
171
      	function prepareConfirmDialog(myDialog) {
33 soliveira 172
 
37 soliveira 173
            options = {
174
                autoOpen: false,
175
                width: 300,
176
                modal: true,
177
                title: "Confirmation:",
178
                buttons: [
179
                          {
180
                                text: "Yes",
181
                                click: function() { $(this).dialog("close"); }
182
                          },
183
                          {
184
                                text: "No",
185
                                click: function() {  $(this).dialog("close"); }
186
                          }
187
                      ]
188
           };
189
 
190
          myDialog.dialog(options);
191
 
192
          return myDialog;
193
        }
194
 
195
         function showConfirmDialog() {
196
 
197
            myDialog = $('#confirmDialog');
198
            myDialog = prepareConfirmDialog(myDialog);
199
            myDialog.dialog('open');
200
 
201
            return false;
202
        }
203
 
12 soliveira 204
    </script>
205
 
206
</head>
207
 
208
<body class="composite">
209
 
210
<!-- For Testing -->
211
<div id="dialog" title="Dialog Title" style="display: none;">I'm in a dialog</div>
212
 
37 soliveira 213
<!-- Close Confirm -->
214
<div id="confirmDialog" style="display: none;">
215
	<span id="confirmMessage">The confirmation message goes here.</span>
216
</div>
217
 
33 soliveira 218
<!-- For Editing Pages -->
28 soliveira 219
<div id="editPageDialog" style="display: none;">
220
<form id="editPageForm" action="<mtw:contextPath />/Page.editPage.mtw" method="post">
221
<input type="hidden" name="name" id ="editPageName" value="" />
222
<input type="hidden" name="languageId" id="editPageLanguageId" value="" />
12 soliveira 223
<table>
224
    <tr>
225
        <td>&nbsp;</td>
226
    </tr>
28 soliveira 227
    <mtw:outError field="html">
12 soliveira 228
        <tr>
229
            <td colspan="2"><span class="Negative" style="font-weight: bold;"><mtw:out /></span></td>
230
        </tr>
231
    </mtw:outError>
232
    <tr>
28 soliveira 233
        <td colspan="2"><mtw:textarea id="editPageTextArea" name="body" style="width: 100%; height: 465px;" /></td>
12 soliveira 234
    </tr>
235
</table>
236
</form>
237
</div>
238
 
33 soliveira 239
<!-- For Login -->
240
<div id="loginDialog" style="display: none;">
241
		<form action="<mtw:contextPath />/Login.mtw" method="post" id="loginForm">
242
			<table>
243
				<tr>
244
					<td>
245
						Username:
246
					</td>
247
					<td>
35 soliveira 248
						<mtw:input id="loginUsername" name="username" size="20" maxlength="20" />
249
						<span id="loginUsernameError">
33 soliveira 250
						<mtw:outError field="username">
251
							<font color="red">
252
								<b><mtw:out /></b>
253
							</font>
254
						</mtw:outError>
35 soliveira 255
						</span>
33 soliveira 256
					</td>
257
				</tr>
258
				<tr>
259
					<td>
260
						Password:
261
					</td>
262
					<td>
35 soliveira 263
						<mtw:input id="loginPassword" name="password" type="password" size="20" maxlength="20" />
264
						<span id="loginPasswordError">
33 soliveira 265
						<mtw:outError field="password">
266
							<font color="red">
267
								<b><mtw:out /></b>
268
							</font>
269
						</mtw:outError>
35 soliveira 270
						</span>
33 soliveira 271
					</td>
272
				</tr>
273
			</table>
274
		</form>
275
</div>
276
 
36 soliveira 277
<!-- Create New Page -->
278
<div id="createNewPageDialog" style="display: none;">
279
		<form action="<mtw:contextPath />/Page.add.mtw" method="post" id="createNewPageForm">
280
			<table>
281
				<tr>
282
					<td>
283
						Name:
284
					</td>
285
					<td>
286
						<mtw:input id="createNewPageName" name="name" size="40" maxlength="30" />
287
						<span id="createNewPageNameError">
288
						<mtw:outError field="name">
289
							<font color="red">
290
								<b><mtw:out /></b>
291
							</font>
292
						</mtw:outError>
293
						</span>
294
					</td>
295
				</tr>
296
				<tr>
297
					<td>
298
						Title:
299
					</td>
300
					<td>
301
						<mtw:input id="createNewPageTitle" name="title" size="40" maxlength="60" />
302
						<span id="createNewPageTitleError">
303
						<mtw:outError field="title">
304
							<font color="red">
305
								<b><mtw:out /></b>
306
							</font>
307
						</mtw:outError>
308
						</span>
309
					</td>
310
				</tr>
311
				<tr>
312
					<td>
313
						Language:
314
					</td>
315
					<td>
316
						<mtw:select name="languageId" list="languages" id="createNewPageLanguage" emptyField="true" />
317
						<span id="createNewPageLanguageError">
318
						<mtw:outError field="languageId">
319
							<font color="red">
320
								<b><mtw:out /></b>
321
							</font>
322
						</mtw:outError>
323
						</span>
324
					</td>
325
				</tr>
326
				<tr>
327
        			<td colspan="2"><mtw:textarea id="createNewPageTextArea" name="body" style="width: 100%; height: 465px;" /></td>
328
    			</tr>
329
			</table>
330
		</form>
331
</div>
33 soliveira 332
 
36 soliveira 333
 
12 soliveira 334
<div>
335
<table border="0">
336
    <tr>
337
        <td><a href="/"><img src="images/logos/logo.png" border="0"></img></a></td>
22 soliveira 338
        <td align="right" valign="bottom">
339
            <mtw:isLogged negate="true">
33 soliveira 340
                <a href="#" onclick="return showLoginDialog();">Login</a>
22 soliveira 341
            </mtw:isLogged>
342
            <mtw:isLogged>
36 soliveira 343
                <a href="#" onclick="return showCreateNewPageDialog();">Create New Page</a> |
37 soliveira 344
                <a href="#" onclick="">List Pages</a> |
31 soliveira 345
                <a href="#" onclick="return showEditPageDialog('CSS');" title="<k:editTooltip name="css" />">Edit CSS</a> |
22 soliveira 346
                <a href="<mtw:contextPath/>/Logout.mtw">Logout</a> (<mtw:out value="sessionUser.username" />)
347
            </mtw:isLogged>
348
            &nbsp;
349
            <a href="<mtw:urlWithLoc loc="pt" />"><img src="images/brazil.gif" border="0" width="20" height="13" /></a>
350
            <a href="<mtw:urlWithLoc loc="en" />"><img src="images/usa.gif" width="20" height="13" border="0" /></a>
351
            &nbsp;&nbsp;&nbsp;
352
        </td>
12 soliveira 353
    </tr>
354
</table>
355
</div>
356
 
357
<hr />
358
 
359
<div id="leftColumn"><mtw:isLogged>
360
    <mtw:hasAuthorization groups="admin, editor">
28 soliveira 361
        <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 362
    </mtw:hasAuthorization>
363
</mtw:isLogged>
20 soliveira 364
<div id="navcolumn">
365
    <div>
22 soliveira 366
    <mtw:out value="leftColumn.body" />
20 soliveira 367
    </div>
368
<br />
12 soliveira 369
</div>
370
 
371
</div>
372
 
373
<div id="bodyColumn">
28 soliveira 374
    <mtw:hasAuthorization groups="admin, editor">
375
    <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>
376
    </mtw:hasAuthorization>
24 soliveira 377
    <mtw:out value="bodyColumn.body" />
12 soliveira 378
</div>
379
 
380
<div class="clear">
381
<hr />
382
</div>
383
 
384
<div id="footer">
385
<div class="xright">Copyright  2011</div>
386
<div class="clear">
387
<hr />
388
</div>
389
</div>
390
 
391
</body>
392
</html>