Rev 44 | Rev 52 | 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"> |
||
39 | soliveira | 34 | showLoginDialog(); |
35 | </mtw:if> |
||
36 | |||
37 | <mtw:if test="showForm" value="add"> |
||
38 | showCreateNewPageDialog(); |
||
33 | soliveira | 39 | </mtw:if> |
35 | soliveira | 40 | |
41 | $('#loginDialog').keyup(function(e) { |
||
42 | if (e.keyCode == 13) { |
||
43 | $('#loginForm').submit(); |
||
44 | } |
||
45 | }); |
||
46 | |||
33 | soliveira | 47 | |
12 | soliveira | 48 | }); |
49 | |||
28 | soliveira | 50 | function prepareEditPageDialog(myDialog, theTitle) { |
12 | soliveira | 51 | |
52 | options = { |
||
53 | autoOpen: false, |
||
54 | width: 800, |
||
55 | modal: true, |
||
56 | title: theTitle, |
||
57 | buttons: [ |
||
58 | { |
||
59 | text: "Save", |
||
28 | soliveira | 60 | click: function() { $('#editPageForm').submit(); } |
12 | soliveira | 61 | }, |
62 | { |
||
63 | text: "Cancel", |
||
64 | click: function() { $(this).dialog("close"); } |
||
65 | } |
||
66 | ] |
||
67 | }; |
||
68 | |||
69 | myDialog.dialog(options); |
||
70 | |||
71 | return myDialog; |
||
72 | } |
||
49 | soliveira | 73 | |
74 | function prepareListAllPagesDialog(myDialog) { |
||
75 | |||
76 | options = { |
||
77 | autoOpen: false, |
||
78 | width: 800, |
||
79 | modal: true, |
||
80 | title: 'Pages:', |
||
81 | buttons: [ |
||
82 | { |
||
83 | text: "Update", |
||
84 | click: function() { $('#editPageForm').submit(); } |
||
85 | }, |
||
86 | { |
||
87 | text: "Close", |
||
88 | click: function() { $(this).dialog("close"); } |
||
89 | } |
||
90 | ] |
||
91 | }; |
||
92 | |||
93 | myDialog.dialog(options); |
||
94 | |||
95 | return myDialog; |
||
96 | } |
||
97 | |||
33 | soliveira | 98 | |
41 | soliveira | 99 | function showEditPageDialog(pageName, lang) { |
12 | soliveira | 100 | |
41 | soliveira | 101 | $.getJSON('<mtw:contextPath />/Page.get.mtw?name=' + pageName + '&lang=' + lang, function(data) { |
18 | soliveira | 102 | |
28 | soliveira | 103 | $('#editPageTextArea').val(data.page.body); |
104 | $('#editPageName').val(data.page.name); |
||
41 | soliveira | 105 | $('#editPageLang').val(data.page.lang); |
12 | soliveira | 106 | |
28 | soliveira | 107 | myDialog = $('#editPageDialog'); |
108 | myDialog = prepareEditPageDialog(myDialog, 'Editing <i><font color="darkblue">' + pageName + "</font></i> in <i>" + data.page.language + "<i>..."); |
||
12 | soliveira | 109 | myDialog.dialog('open'); |
110 | }); |
||
111 | |||
112 | return false; |
||
113 | } |
||
49 | soliveira | 114 | |
115 | function showListAllPagesDialog() { |
||
116 | |||
117 | $.getJSON('<mtw:contextPath />/Page.list.mtw', function(data) { |
||
118 | |||
119 | tableData = ''; |
||
120 | tableData += '<tr>'; |
||
121 | tableData += '<th>Name</th>'; |
||
122 | tableData += '<th>Language</th>'; |
||
123 | tableData += '<th>Front Page</th>'; |
||
124 | tableData += '<th>System Page</th>'; |
||
125 | tableData += '<th>Created By</th>'; |
||
126 | tableData += '<th>Modified By</th>'; |
||
127 | tableData += '<th> </th>'; |
||
128 | tableData += '</tr>'; |
||
129 | |||
130 | $.each(data.pages, function(i,page) { |
||
131 | |||
132 | modifiedBy = ''; |
||
133 | if (page.modifiedById > 0) { |
||
134 | modifiedBy = page.modifiedBy.username; |
||
135 | } |
||
136 | |||
137 | systemPage = ''; |
||
138 | if (page.systemPage == true) { |
||
139 | systemPage = 'X'; |
||
140 | } |
||
141 | |||
142 | frontPage = ''; |
||
143 | if (page.frontPage == true) { |
||
144 | frontPage = 'X'; |
||
145 | } |
||
146 | |||
147 | tableData += '<tr>'; |
||
148 | tableData += '<td>' + page.name + '</td>'; |
||
149 | tableData += '<td align="center">' + page.language + '</td>'; |
||
150 | tableData += '<td align="center">' + frontPage + '</td>'; |
||
151 | tableData += '<td align="center">' + systemPage + '</td>'; |
||
152 | tableData += '<td align="center">' + page.createdBy.username + '</td>'; |
||
153 | tableData += '<td align="center">' + modifiedBy + '</td>'; |
||
154 | tableData += '<td align="center"><a href="<mtw:contextPath/>/Page.mtw?name=' + page.name + '&lang=' + page.lang + '">View</a></td>'; |
||
155 | tableData += '</tr>'; |
||
156 | }); |
||
157 | |||
158 | $('#listAllPagesTable').html(tableData); |
||
159 | |||
160 | myDialog = $('#listAllPagesDialog'); |
||
161 | myDialog = prepareListAllPagesDialog(myDialog); |
||
162 | myDialog.dialog('open'); |
||
163 | }); |
||
164 | |||
165 | return false; |
||
166 | } |
||
33 | soliveira | 167 | |
36 | soliveira | 168 | function showCreateNewPageDialog() { |
169 | |||
42 | soliveira | 170 | $('#createNewPageFormName').val('<mtw:out value="bodyColumn.name" />'); |
171 | $('#createNewPageFormLang').val('<mtw:out value="bodyColumn.lang" />'); |
||
172 | |||
36 | soliveira | 173 | myDialog = $('#createNewPageDialog'); |
174 | myDialog = prepareCreateNewPageDialog(myDialog); |
||
175 | myDialog.dialog('open'); |
||
176 | |||
177 | return false; |
||
178 | } |
||
179 | |||
180 | function prepareCreateNewPageDialog(myDialog) { |
||
181 | |||
182 | options = { |
||
38 | soliveira | 183 | close: function() { clearCreateNewPageForm(); }, |
36 | soliveira | 184 | autoOpen: false, |
185 | width: 800, |
||
186 | modal: true, |
||
187 | title: "Create New Page:", |
||
188 | buttons: [ |
||
189 | { |
||
38 | soliveira | 190 | text: "Create", |
191 | click: function() { $('#createNewPageForm').submit(); } |
||
36 | soliveira | 192 | }, |
193 | { |
||
194 | text: "Cancel", |
||
37 | soliveira | 195 | click: function() { $(this).dialog("close"); } |
36 | soliveira | 196 | } |
197 | ] |
||
198 | }; |
||
199 | |||
200 | myDialog.dialog(options); |
||
201 | |||
202 | return myDialog; |
||
203 | } |
||
204 | |||
33 | soliveira | 205 | |
206 | function showLoginDialog() { |
||
12 | soliveira | 207 | |
42 | soliveira | 208 | $('#loginFormName').val('<mtw:out value="bodyColumn.name" />'); |
209 | $('#loginFormLang').val('<mtw:out value="bodyColumn.lang" />'); |
||
210 | |||
33 | soliveira | 211 | myDialog = $('#loginDialog'); |
212 | myDialog = prepareLoginDialog(myDialog); |
||
213 | myDialog.dialog('open'); |
||
214 | |||
215 | return false; |
||
216 | } |
||
217 | |||
35 | soliveira | 218 | function clearLoginForm() { |
219 | $('#loginUsername').val(''); |
||
220 | $('#loginPassword').val(''); |
||
221 | $('#loginUsernameError').text(''); |
||
222 | $('#loginPasswordError').text(''); |
||
36 | soliveira | 223 | } |
33 | soliveira | 224 | |
36 | soliveira | 225 | function clearCreateNewPageForm() { |
226 | $('#createNewPageName').val(''); |
||
227 | $('#createNewPageTitle').val(''); |
||
228 | $('#createNewPageLanguage').val(''); |
||
229 | $('#createNewPageTextArea').val(''); |
||
39 | soliveira | 230 | $('#createNewPageNameError').text(''); |
231 | $('#createNewPageTitleError').text(''); |
||
232 | $('#createNewPageLanguageError').text(''); |
||
233 | $('#createNewPageBodyError').text(''); |
||
36 | soliveira | 234 | } |
235 | |||
33 | soliveira | 236 | function prepareLoginDialog(myDialog) { |
237 | |||
238 | options = { |
||
35 | soliveira | 239 | close: function() { clearLoginForm(); }, |
33 | soliveira | 240 | autoOpen: false, |
241 | width: 290, |
||
242 | modal: true, |
||
243 | title: "Login:", |
||
244 | buttons: [ |
||
245 | { |
||
246 | text: "Login", |
||
247 | click: function() { $('#loginForm').submit(); } |
||
248 | }, |
||
249 | { |
||
250 | text: "Cancel", |
||
37 | soliveira | 251 | click: function() { $(this).dialog("close"); } |
33 | soliveira | 252 | } |
253 | ] |
||
254 | }; |
||
255 | |||
256 | myDialog.dialog(options); |
||
257 | |||
258 | return myDialog; |
||
259 | } |
||
37 | soliveira | 260 | |
261 | function prepareConfirmDialog(myDialog) { |
||
33 | soliveira | 262 | |
37 | soliveira | 263 | options = { |
264 | autoOpen: false, |
||
265 | width: 300, |
||
266 | modal: true, |
||
267 | title: "Confirmation:", |
||
268 | buttons: [ |
||
269 | { |
||
270 | text: "Yes", |
||
271 | click: function() { $(this).dialog("close"); } |
||
272 | }, |
||
273 | { |
||
274 | text: "No", |
||
275 | click: function() { $(this).dialog("close"); } |
||
276 | } |
||
277 | ] |
||
278 | }; |
||
279 | |||
280 | myDialog.dialog(options); |
||
281 | |||
282 | return myDialog; |
||
283 | } |
||
284 | |||
285 | function showConfirmDialog() { |
||
286 | |||
287 | myDialog = $('#confirmDialog'); |
||
288 | myDialog = prepareConfirmDialog(myDialog); |
||
289 | myDialog.dialog('open'); |
||
290 | |||
291 | return false; |
||
292 | } |
||
293 | |||
12 | soliveira | 294 | </script> |
295 | |||
296 | </head> |
||
297 | |||
298 | <body class="composite"> |
||
299 | |||
300 | <!-- For Testing --> |
||
301 | <div id="dialog" title="Dialog Title" style="display: none;">I'm in a dialog</div> |
||
302 | |||
37 | soliveira | 303 | <!-- Close Confirm --> |
304 | <div id="confirmDialog" style="display: none;"> |
||
305 | <span id="confirmMessage">The confirmation message goes here.</span> |
||
306 | </div> |
||
307 | |||
33 | soliveira | 308 | <!-- For Editing Pages --> |
28 | soliveira | 309 | <div id="editPageDialog" style="display: none;"> |
41 | soliveira | 310 | <form id="editPageForm" action="<mtw:contextPath />/Page.edit.mtw" method="post"> |
28 | soliveira | 311 | <input type="hidden" name="name" id ="editPageName" value="" /> |
41 | soliveira | 312 | <input type="hidden" name="lang" id="editPageLang" value="" /> |
12 | soliveira | 313 | <table> |
314 | <tr> |
||
315 | <td> </td> |
||
316 | </tr> |
||
28 | soliveira | 317 | <mtw:outError field="html"> |
12 | soliveira | 318 | <tr> |
319 | <td colspan="2"><span class="Negative" style="font-weight: bold;"><mtw:out /></span></td> |
||
320 | </tr> |
||
321 | </mtw:outError> |
||
322 | <tr> |
||
28 | soliveira | 323 | <td colspan="2"><mtw:textarea id="editPageTextArea" name="body" style="width: 100%; height: 465px;" /></td> |
12 | soliveira | 324 | </tr> |
325 | </table> |
||
326 | </form> |
||
327 | </div> |
||
328 | |||
33 | soliveira | 329 | <!-- For Login --> |
330 | <div id="loginDialog" style="display: none;"> |
||
331 | <form action="<mtw:contextPath />/Login.mtw" method="post" id="loginForm"> |
||
42 | soliveira | 332 | <input type="hidden" name="name" value="" id="loginFormName" /> |
333 | <input type="hidden" name="lang" value="" id="loginFormLang" /> |
||
33 | soliveira | 334 | <table> |
335 | <tr> |
||
336 | <td> |
||
337 | Username: |
||
338 | </td> |
||
339 | <td> |
||
35 | soliveira | 340 | <mtw:input id="loginUsername" name="username" size="20" maxlength="20" /> |
341 | <span id="loginUsernameError"> |
||
33 | soliveira | 342 | <mtw:outError field="username"> |
343 | <font color="red"> |
||
344 | <b><mtw:out /></b> |
||
345 | </font> |
||
346 | </mtw:outError> |
||
35 | soliveira | 347 | </span> |
33 | soliveira | 348 | </td> |
349 | </tr> |
||
350 | <tr> |
||
351 | <td> |
||
352 | Password: |
||
353 | </td> |
||
354 | <td> |
||
35 | soliveira | 355 | <mtw:input id="loginPassword" name="password" type="password" size="20" maxlength="20" /> |
356 | <span id="loginPasswordError"> |
||
33 | soliveira | 357 | <mtw:outError field="password"> |
358 | <font color="red"> |
||
359 | <b><mtw:out /></b> |
||
360 | </font> |
||
361 | </mtw:outError> |
||
35 | soliveira | 362 | </span> |
33 | soliveira | 363 | </td> |
364 | </tr> |
||
365 | </table> |
||
366 | </form> |
||
367 | </div> |
||
368 | |||
49 | soliveira | 369 | <!-- For displaying all pages --> |
370 | <div id="listAllPagesDialog" style="display: none;"> |
||
371 | <table border="1" cellspacing="5" cellpadding="5" id="listAllPagesTable"> |
||
372 | </table> |
||
373 | </div> |
||
374 | |||
36 | soliveira | 375 | <!-- Create New Page --> |
376 | <div id="createNewPageDialog" style="display: none;"> |
||
377 | <form action="<mtw:contextPath />/Page.add.mtw" method="post" id="createNewPageForm"> |
||
42 | soliveira | 378 | <input type="hidden" name="name" value="" id="createNewPageFormName" /> |
379 | <input type="hidden" name="lang" value="" id="createNewPageFormLang" /> |
||
36 | soliveira | 380 | <table> |
381 | <tr> |
||
382 | <td> |
||
383 | Name: |
||
384 | </td> |
||
385 | <td> |
||
39 | soliveira | 386 | <mtw:input id="createNewPageName" name="newPage.name" size="40" maxlength="30" /> |
36 | soliveira | 387 | <span id="createNewPageNameError"> |
39 | soliveira | 388 | <mtw:outError field="newPage.name"> |
36 | soliveira | 389 | <font color="red"> |
390 | <b><mtw:out /></b> |
||
391 | </font> |
||
392 | </mtw:outError> |
||
393 | </span> |
||
394 | </td> |
||
395 | </tr> |
||
396 | <tr> |
||
397 | <td> |
||
398 | Title: |
||
399 | </td> |
||
400 | <td> |
||
39 | soliveira | 401 | <mtw:input id="createNewPageTitle" name="newPage.title" size="40" maxlength="60" /> |
36 | soliveira | 402 | <span id="createNewPageTitleError"> |
39 | soliveira | 403 | <mtw:outError field="newPage.title"> |
36 | soliveira | 404 | <font color="red"> |
405 | <b><mtw:out /></b> |
||
406 | </font> |
||
407 | </mtw:outError> |
||
408 | </span> |
||
409 | </td> |
||
410 | </tr> |
||
411 | <tr> |
||
412 | <td> |
||
413 | Language: |
||
414 | </td> |
||
415 | <td> |
||
39 | soliveira | 416 | <mtw:select name="newPage.languageId" list="languages" id="createNewPageLanguage" emptyField="true" /> |
36 | soliveira | 417 | <span id="createNewPageLanguageError"> |
39 | soliveira | 418 | <mtw:outError field="newPage.languageId"> |
36 | soliveira | 419 | <font color="red"> |
420 | <b><mtw:out /></b> |
||
421 | </font> |
||
422 | </mtw:outError> |
||
423 | </span> |
||
424 | </td> |
||
425 | </tr> |
||
426 | <tr> |
||
39 | soliveira | 427 | <td colspan="2"> |
428 | <mtw:textarea id="createNewPageTextArea" name="newPage.body" style="width: 100%; height: 465px;" /> |
||
429 | <span id="createNewPageBodyError"> |
||
430 | <mtw:outError field="newPage.body"> |
||
431 | <font color="red"> |
||
432 | <b><mtw:out /></b> |
||
433 | </font> |
||
434 | </mtw:outError> |
||
435 | </span> |
||
436 | </td> |
||
36 | soliveira | 437 | </tr> |
438 | </table> |
||
439 | </form> |
||
440 | </div> |
||
33 | soliveira | 441 | |
36 | soliveira | 442 | |
12 | soliveira | 443 | <div> |
444 | <table border="0"> |
||
445 | <tr> |
||
39 | soliveira | 446 | <td><a href="<mtw:contextPath/>"><img src="images/logos/logo.png" border="0"></img></a></td> |
22 | soliveira | 447 | <td align="right" valign="bottom"> |
448 | <mtw:isLogged negate="true"> |
||
33 | soliveira | 449 | <a href="#" onclick="return showLoginDialog();">Login</a> |
22 | soliveira | 450 | </mtw:isLogged> |
451 | <mtw:isLogged> |
||
36 | soliveira | 452 | <a href="#" onclick="return showCreateNewPageDialog();">Create New Page</a> | |
49 | soliveira | 453 | <a href="#" onclick="return showListAllPagesDialog();">List Pages</a> | |
44 | soliveira | 454 | <mtw:hasAuthorization groups="admin"> |
41 | soliveira | 455 | <a href="#" onclick="return showEditPageDialog('CSS', 'en');" title="<k:editTooltip name="css" />">Edit CSS</a> | |
44 | soliveira | 456 | </mtw:hasAuthorization> |
22 | soliveira | 457 | <a href="<mtw:contextPath/>/Logout.mtw">Logout</a> (<mtw:out value="sessionUser.username" />) |
458 | </mtw:isLogged> |
||
459 | |
||
39 | soliveira | 460 | <mtw:isLocale value="pt"> |
461 | <a href="<mtw:urlWithLoc loc="pt" />"><img src="images/brazil.gif" border="0" width="20" height="13" style="border: 3px solid #ccc;" /></a> |
||
462 | <a href="<mtw:urlWithLoc loc="en" />"><img src="images/usa.gif" width="20" height="13" border="0" style="border: 3px solid #fff;" /></a> |
||
463 | </mtw:isLocale> |
||
464 | <mtw:isLocale value="en"> |
||
465 | <a href="<mtw:urlWithLoc loc="pt" />"><img src="images/brazil.gif" border="0" width="20" height="13" style="border: 3px solid #fff;" /></a> |
||
466 | <a href="<mtw:urlWithLoc loc="en" />"><img src="images/usa.gif" width="20" height="13" border="0" style="border: 3px solid #ccc;" /></a> |
||
467 | </mtw:isLocale> |
||
22 | soliveira | 468 | |
469 | </td> |
||
12 | soliveira | 470 | </tr> |
471 | </table> |
||
472 | </div> |
||
473 | |||
474 | <hr /> |
||
475 | |||
476 | <div id="leftColumn"><mtw:isLogged> |
||
44 | soliveira | 477 | <mtw:hasAuthorization groups="admin"> |
41 | soliveira | 478 | <div style="text-align: right; padding-right: 14px; padding-top: 6px;"><a href="#" onclick="return showEditPageDialog('LeftColumn', '<mtw:out value="leftColumn.language.locale" />');" title="<k:editTooltip name="leftColumn" />">Edit</a></div> |
12 | soliveira | 479 | </mtw:hasAuthorization> |
480 | </mtw:isLogged> |
||
20 | soliveira | 481 | <div id="navcolumn"> |
482 | <div> |
||
22 | soliveira | 483 | <mtw:out value="leftColumn.body" /> |
20 | soliveira | 484 | </div> |
485 | <br /> |
||
12 | soliveira | 486 | </div> |
487 | |||
488 | </div> |
||
489 | |||
490 | <div id="bodyColumn"> |
||
28 | soliveira | 491 | <mtw:hasAuthorization groups="admin, editor"> |
41 | soliveira | 492 | <div style="text-align: right; padding-right: 14px;"><a href="#" onclick="return showEditPageDialog('<mtw:out value="bodyColumn.name" />', '<mtw:out value="bodyColumn.language.locale" />');" title="<k:editTooltip name="bodyColumn" />">Edit</a></div> |
28 | soliveira | 493 | </mtw:hasAuthorization> |
24 | soliveira | 494 | <mtw:out value="bodyColumn.body" /> |
12 | soliveira | 495 | </div> |
496 | |||
497 | <div class="clear"> |
||
498 | <hr /> |
||
499 | </div> |
||
500 | |||
501 | <div id="footer"> |
||
39 | soliveira | 502 | <div class="xright">Copyright � 2011</div> |
12 | soliveira | 503 | <div class="clear"> |
504 | <hr /> |
||
505 | </div> |
||
506 | </div> |
||
507 | |||
508 | </body> |
||
509 | </html> |