Kawai Wiki

Rev

Rev 102 | Rev 104 | 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
 
88 soliveira 8
<title><mtw:out  value="bodyColumn.title" /></title>
12 soliveira 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
 
102 soliveira 29
<link href="<mtw:contextPath />/GenerateCSS.getAnyCss.css?file=/uploadify/uploadify.css" type="text/css" rel="stylesheet" />
30
<script type="text/javascript" src="<mtw:contextPath />/uploadify/swfobject.js"></script>
31
<script type="text/javascript" src="<mtw:contextPath />/uploadify/jquery.uploadify.v2.1.4.min.js"></script>
87 soliveira 32
 
33
<!-- Include required JS files -->
34
<script type="text/javascript" src="<mtw:contextPath/>/sh/js/shCore.js"></script>
35
 
36
<!--
37
    At least one brush, here we choose JS. You need to include a brush for every
38
    language you want to highlight
39
-->
40
<script type="text/javascript" src="<mtw:contextPath/>/sh/js/shBrushJava.js"></script>
41
 
42
<!-- Include *at least* the core style and default theme -->
43
<link href="<mtw:contextPath/>/GenerateCSS.getShCss.css?file=shCore.css" rel="stylesheet" type="text/css" />
44
<link href="<mtw:contextPath/>/GenerateCSS.getShCss.css?file=shThemeDefault.css" rel="stylesheet" type="text/css" />
45
 
46
<!-- Finally, to actually run the highlighter, you need to include this JS on your page -->
47
<script type="text/javascript">
88 soliveira 48
     SyntaxHighlighter.all();
87 soliveira 49
</script>
50
 
100 soliveira 51
<!--  User JavaScript -->
52
<script type="text/javascript">
87 soliveira 53
 
100 soliveira 54
<mtw:out value="js.body" />
55
 
56
</script>
57
 
58
 
12 soliveira 59
<script language="JavaScript">
60
 
61
        $(document).ready(function() {
33 soliveira 62
 
63
        	<mtw:if test="showForm" value="login">
39 soliveira 64
				showLoginDialog();
65
			</mtw:if>
66
 
67
			<mtw:if test="showForm" value="add">
68
				showCreateNewPageDialog();
33 soliveira 69
			</mtw:if>
35 soliveira 70
 
71
			$('#loginDialog').keyup(function(e) {
72
    			if (e.keyCode == 13) {
73
        			$('#loginForm').submit();
74
    			}
75
			});
76
 
102 soliveira 77
			$('#file_upload').uploadify({
78
				'uploader'  : '<mtw:contextPath />/uploadify/uploadify.swf',
79
				'script'    : '<mtw:contextPath />/Admin.upload.mtw',
80
				'cancelImg' : '<mtw:contextPath />/uploadify/cancel.png',
81
				'folder'    : '<mtw:contextPath />/uploads',
82
				'auto'      : true,
83
				'multi'     : true,
84
				'onComplete'  : function(event, ID, fileObj, response, data) {
33 soliveira 85
 
102 soliveira 86
					var resp = eval('(' + response + ')');
87
 
88
					if (resp.status == 'success') {
89
						$('#uploadResults').append('<tr><td style="color: blue;">' + resp.msg + '</td></tr>');
90
					} else if (resp.status == 'error') {
91
						$('#uploadResults').append('<tr><td style="color: red;">' + resp.msg + '</td></tr>');
92
					}
93
				}
94
			});
95
 
12 soliveira 96
        });
97
 
28 soliveira 98
        function prepareEditPageDialog(myDialog, theTitle) {
12 soliveira 99
 
100
            options = {
101
                autoOpen: false,
102
                width: 800,
103
                modal: true,
104
                title: theTitle,
105
                buttons: [
106
                          {
107
                                text: "Save",
28 soliveira 108
                                click: function() { $('#editPageForm').submit(); }
12 soliveira 109
                          },
110
                          {
65 soliveira 111
                                text: "Preview",
112
                                click: function() { $('#editPagePreview').val('true'); $('#editPageForm').submit(); }
113
                          },
114
                          {
12 soliveira 115
                                text: "Cancel",
116
                                click: function() { $(this).dialog("close"); }
117
                          }
118
                      ]
119
           };
120
 
121
          myDialog.dialog(options);
122
 
123
          return myDialog;
124
        }
49 soliveira 125
 
84 soliveira 126
        function prepareShowPageDialog(myDialog, theTitle) {
127
 
128
            options = {
129
                autoOpen: false,
130
                width: 800,
131
                modal: true,
132
                title: theTitle,
133
                buttons: [
134
                          {
135
                                text: "Back",
136
                                click: function() { $(this).dialog("close"); }
137
                          }
138
                      ]
139
           };
140
 
141
          myDialog.dialog(options);
142
 
143
          return myDialog;
103 soliveira 144
        }
145
 
146
		function prepareFileListDialog(myDialog) {
147
 
148
            options = {
149
                autoOpen: false,
150
                width: 400,
151
                height: 300,
152
                modal: true,
153
                title: "Files uploaded:",
154
                buttons: [
155
                          {
156
                                text: "Close",
157
                                click: function() { $(this).dialog("close"); }
158
                          }
159
                      ]
160
           };
161
 
162
          myDialog.dialog(options);
163
 
164
          return myDialog;
84 soliveira 165
        }
103 soliveira 166
 
84 soliveira 167
 
49 soliveira 168
        function prepareListAllPagesDialog(myDialog) {
169
 
170
            options = {
171
                autoOpen: false,
172
                width: 800,
53 soliveira 173
                height: 450,
49 soliveira 174
                modal: true,
175
                title: 'Pages:',
176
                buttons: [
177
                          {
55 soliveira 178
                                text: "FrontPage",
56 soliveira 179
                                click: function() { $('#listAllPagesForm').attr('action', '<mtw:contextPath/>/Page.setFrontPage.mtw'); $('#listAllPagesForm').submit(); }
49 soliveira 180
                          },
181
                          {
55 soliveira 182
                                text: "Delete",
57 soliveira 183
                                click: function() { $('#listAllPagesForm').attr('action', '<mtw:contextPath/>/Page.delete.mtw'); $('#listAllPagesForm').submit(); }
55 soliveira 184
                          },
185
                          {
49 soliveira 186
                                text: "Close",
187
                                click: function() { $(this).dialog("close"); }
188
                          }
189
                      ]
190
           };
191
 
192
          myDialog.dialog(options);
193
 
194
          return myDialog;
195
        }
196
 
81 soliveira 197
        function prepareListRevisionsDialog(myDialog, name, lang) {
198
 
199
            options = {
200
                autoOpen: false,
201
                width: 800,
202
                height: 450,
203
                modal: true,
204
                title: 'Revisions for ' + name + ' in ' + lang,
205
                buttons: [
206
                          {
84 soliveira 207
                                text: "Back",
81 soliveira 208
                                click: function() { $(this).dialog("close"); }
209
                          }
210
                      ]
211
           };
212
 
213
          myDialog.dialog(options);
214
 
215
          return myDialog;
216
        }
33 soliveira 217
 
102 soliveira 218
        function prepareFileUploadDialog(myDialog) {
219
 
220
            options = {
221
                autoOpen: false,
222
                width: 400,
223
                height: 300,
224
                modal: true,
225
                title: 'Uploading files...',
226
                buttons: [
227
                          {
228
                                text: "Close",
229
                                click: function() { $(this).dialog("close"); }
230
                          }
231
                      ]
232
           };
233
 
234
          myDialog.dialog(options);
235
 
236
          return myDialog;
237
        }
238
 
41 soliveira 239
        function showEditPageDialog(pageName, lang) {
12 soliveira 240
 
41 soliveira 241
            $.getJSON('<mtw:contextPath />/Page.get.mtw?name=' + pageName + '&lang=' + lang, function(data) {
18 soliveira 242
 
72 soliveira 243
                if (data.page.systemPage) {
244
                	$('.editPageTitleCell').hide();
245
                } else {
246
                	$('.editPageTitleCell').show();
247
                	$('#editPageTitle').val(data.page.title);
248
                }
28 soliveira 249
                $('#editPageTextArea').val(data.page.body);
250
                $('#editPageName').val(data.page.name);
41 soliveira 251
                $('#editPageLang').val(data.page.lang);
12 soliveira 252
 
28 soliveira 253
                myDialog = $('#editPageDialog');
254
                myDialog = prepareEditPageDialog(myDialog, 'Editing <i><font color="darkblue">' + pageName + "</font></i> in <i>" + data.page.language + "<i>...");
12 soliveira 255
                myDialog.dialog('open');
256
            });
257
 
258
            return false;
259
        }
103 soliveira 260
 
261
        function showFileListDialog() {
84 soliveira 262
 
103 soliveira 263
            $.getJSON('<mtw:contextPath />/Admin.listFiles.mtw', function(data) {
264
 
265
				$('#fileListTable').html('');
266
 
267
            	if (data.files.length == 0) {
268
            		$('#fileListTable').html('<tr><td align="center">No files uploaded yet!</td></tr>');
269
            	} else {
270
            		$.each(data.files, function(i,file) {
271
						$('#fileListTable').append('<tr><td>' + file + '</td></tr>');
272
            		});
273
            	}
274
 
275
                myDialog = $('#fileListDialog');
276
                myDialog = prepareFileListDialog(myDialog);
277
                myDialog.dialog('open');
278
            });
279
 
280
            return false;
281
        }
282
 
86 soliveira 283
        function showShowPageDialog(pageName, lang, revision) {
84 soliveira 284
 
86 soliveira 285
            $.getJSON('<mtw:contextPath />/Page.get.mtw?name=' + pageName + '&lang=' + lang + '&revision=' + revision, function(data) {
84 soliveira 286
 
287
                if (data.page.systemPage) {
288
                    $('.showPageTitleCell').hide();
289
                } else {
290
                    $('.showPageTitleCell').show();
291
                    $('#showPageTitle').val(data.page.title);
292
                }
293
                $('#showPageTextArea').val(data.page.body);
294
 
86 soliveira 295
                theTitle = 'Showing <i><font color="darkblue">' + pageName + "</font></i> in <i>" + data.page.language + "<i>...";
296
                if (revision > 0) {
297
                    theTitle += ' (Revision #' + revision + ')';
298
                }
299
 
84 soliveira 300
                myDialog = $('#showPageDialog');
86 soliveira 301
                myDialog = prepareShowPageDialog(myDialog, theTitle);
84 soliveira 302
                myDialog.dialog('open');
303
            });
304
 
305
            return false;
306
        }
307
 
63 soliveira 308
 
65 soliveira 309
        function showEditPreviewDialog(pageName, lang) {
49 soliveira 310
 
63 soliveira 311
            $.getJSON('<mtw:contextPath />/Page.getPreview.mtw?name=' + pageName + '&lang=' + lang, function(data) {
65 soliveira 312
 
72 soliveira 313
            	if (data.page.systemPage) {
314
                	$('.editPageTitleCell').hide();
315
                } else {
316
                	$('.editPageTitleCell').show();
317
                	$('#editPageTitle').val(data.page.title);
318
                }
65 soliveira 319
                $('#editPageTextArea').val(data.page.body);
320
                $('#editPageName').val(data.page.name);
321
                $('#editPageLang').val(data.page.lang);
322
 
323
                myDialog = $('#editPageDialog');
324
                myDialog = prepareEditPageDialog(myDialog, 'Editing <i><font color="darkblue">' + pageName + "</font></i> in <i>" + data.page.language + "<i>...");
325
                myDialog.dialog('open');
326
            });
63 soliveira 327
 
65 soliveira 328
            return false;
329
        }
330
 
331
 
332
       	function showEditPreviewNewPageDialog(pageName, lang) {
333
 
334
            $.getJSON('<mtw:contextPath />/Page.getPreview.mtw?name=' + pageName + '&lang=' + lang, function(data) {
335
 
63 soliveira 336
           		$('#createNewPageName').val(data.page.name);
337
        		$('#createNewPageTitle').val(data.page.title);
338
        		$('#createNewPageLanguage').val(data.page.languageId);
339
        		$('#createNewPageTextArea').val(data.page.body);
340
        		$('#createNewPageNameError').text('');
341
        		$('#createNewPageTitleError').text('');
342
        		$('#createNewPageLanguageError').text('');
343
        		$('#createNewPageBodyError').text('');
344
 
345
				showCreateNewPageDialog();
72 soliveira 346
 
347
				$('#createPageLanguageCell').hide();
63 soliveira 348
            });
349
 
350
            return false;
351
        }
352
 
49 soliveira 353
        function showListAllPagesDialog() {
354
 
355
            $.getJSON('<mtw:contextPath />/Page.list.mtw', function(data) {
356
 
357
                tableData = '';
358
                tableData += '<tr>';
55 soliveira 359
                tableData += '<th>&nbsp;</th>';
49 soliveira 360
                tableData += '<th>Name</th>';
361
                tableData += '<th>Language</th>';
362
                tableData += '<th>Created By</th>';
363
                tableData += '<th>Modified By</th>';
364
                tableData += '<th>&nbsp;</th>';
81 soliveira 365
                tableData += '<th>&nbsp;</th>';
84 soliveira 366
                tableData += '<th>&nbsp;</th>';
49 soliveira 367
                tableData += '</tr>';
368
 
369
                $.each(data.pages, function(i,page) {
55 soliveira 370
 
371
                	pageName = page.name;
49 soliveira 372
 
373
                    modifiedBy = '';
374
                    if (page.modifiedById > 0) {
375
                        modifiedBy = page.modifiedBy.username;
376
                    }
377
 
378
                    if (page.systemPage == true) {
55 soliveira 379
                        pageName = '*' + pageName;
49 soliveira 380
                    }
381
 
382
                    if (page.frontPage == true) {
55 soliveira 383
                        pageName = '[' + pageName + ']';
49 soliveira 384
                    }
52 soliveira 385
 
386
                    modifiedOnTitle = '';
387
                    if (page.formattedModifiedOn != null) {
388
                    	modifiedOnTitle = ' title="' + page.formattedModifiedOn + '"';
389
                    }
390
 
391
                    createdOnTitle = '';
392
                    if (page.formattedCreatedOn != null) {
393
                    	createdOnTitle = ' title="' + page.formattedCreatedOn + '"';
394
                    }
53 soliveira 395
 
55 soliveira 396
                    radioCell = '&nbsp;';
53 soliveira 397
                    viewCell = '&nbsp;';
55 soliveira 398
                    if (page.CSS == false && page.systemPage == false) {
84 soliveira 399
                    	viewCell = '<a title="View Page" tabindex="-1" href="<mtw:contextPath/>/Page.mtw?name=' + page.name + '&lang=' + page.lang + '"><img src="<mtw:contextPath/>/images/preview.png" border="0" /></a> ';
55 soliveira 400
                    	if (page.frontPage == false) {
58 soliveira 401
                    		radioCell = '<input tabindex="-1" type="radio" name="pageId" id="pageId" value="' + page.id + '" />';
55 soliveira 402
                    	}
53 soliveira 403
                    }
79 soliveira 404
 
81 soliveira 405
                    viewRevisionsCell = '&nbsp;';
406
 
407
                    if (page.modified) {
408
                        viewRevisionsCell = '<a title="View Revisions" class="revisionLink" tabindex="-1" href="#" onclick="return showListRevisionsDialog(\'' + page.name + '\',\'' + page.lang + '\',\'' + page.language + '\');"><img src="<mtw:contextPath/>/images/folder.png" height="24" height="20" border="0" /></a>';
409
                    }
54 soliveira 410
 
411
                    nameTitle = '';
412
                    if (page.title != null && page.title != '') {
413
                    	nameTitle = ' title="' + page.title + '"';
414
                    }
49 soliveira 415
 
416
                    tableData += '<tr>';
55 soliveira 417
                    tableData += '<td>' + radioCell + '</td>';
418
                    tableData += '<td' + nameTitle + '>' + pageName + '</td>';
49 soliveira 419
                    tableData += '<td align="center">' + page.language + '</td>';
52 soliveira 420
                    tableData += '<td align="center"' + createdOnTitle + '>' + page.createdBy.username + '</td>';
421
                    tableData += '<td align="center"' + modifiedOnTitle + '>' + modifiedBy + '</td>';
53 soliveira 422
                    tableData += '<td align="center">' + viewCell + '</td>';
86 soliveira 423
                    tableData += '<td align="center"><a tabindex="-1" title="View Html" href="#" onclick="return showShowPageDialog(\'' + page.name + '\',\'' + page.lang + '\', -1);"><img src="<mtw:contextPath/>/images/view.png" border="0" /></a></td>';
81 soliveira 424
                    tableData += '<td align="center">' + viewRevisionsCell + '</td>';
49 soliveira 425
                    tableData += '</tr>';
426
                });
427
 
428
                $('#listAllPagesTable').html(tableData);
429
 
81 soliveira 430
                myDialogDiv = $('#listAllPagesDialog');
431
                myDialog = prepareListAllPagesDialog(myDialogDiv);
49 soliveira 432
                myDialog.dialog('open');
58 soliveira 433
                $('.ui-dialog :button').blur();
49 soliveira 434
             });
435
 
436
            return false;
437
        }
79 soliveira 438
 
81 soliveira 439
        function showListRevisionsDialog(name, lang, language) {
79 soliveira 440
 
441
            $.getJSON('<mtw:contextPath />/Page.getRevisions.mtw?name=' + name + '&lang=' + lang, function(data) {
442
 
443
                tableData = '';
444
                tableData += '<tr>';
445
                tableData += '<th>Revision</th>';
446
                tableData += '<th>Author</th>';
80 soliveira 447
                tableData += '<th>Date</th>';
84 soliveira 448
 
83 soliveira 449
                if (data.isSystemPage == false) {
450
                    tableData += '<th>&nbsp;</th>';
451
                }
84 soliveira 452
                tableData += '<th>&nbsp;</th>';
79 soliveira 453
                tableData += '</tr>';
454
 
455
                $.each(data.revisions, function(i,revision) {
456
 
457
                    tableData += '<tr>';
458
                    tableData += '<td>' + revision.revision + '</td>';
80 soliveira 459
                    tableData += '<td align="center">' + revision.user.username + '</td>';
460
                    tableData += '<td align="center">' + revision.formattedCreatedOn + '</td>';
84 soliveira 461
 
83 soliveira 462
                    if (data.isSystemPage == false) {
84 soliveira 463
                        tableData += '<td align="center"><a title="View Page" tabindex="-1" href="<mtw:contextPath/>/Page.mtw?name=' + revision.name + '&lang=' + revision.lang + '&revision=' + revision.revision +'"><img src="<mtw:contextPath/>/images/preview.png" border="0" /></a></td>';
83 soliveira 464
                    }
84 soliveira 465
 
86 soliveira 466
                    tableData += '<td align="center"><a tabindex="-1" title="View Html" href="#" onclick="return showShowPageDialog(\'' + revision.name + '\',\'' + revision.lang + '\',' + revision.revision + ');"><img src="<mtw:contextPath/>/images/view.png" border="0" /></a></td>';
84 soliveira 467
 
79 soliveira 468
                    tableData += '</tr>';
469
                });
470
 
81 soliveira 471
                $('#listRevisionsTable').html(tableData);
472
                myDialog = $('#listRevisionsDialog');
473
                myDialog = prepareListRevisionsDialog(myDialog, name, language);
79 soliveira 474
                myDialog.dialog('open');
475
                $('.ui-dialog :button').blur();
476
             });
477
 
478
            return false;
479
        }
33 soliveira 480
 
36 soliveira 481
       	function showCreateNewPageDialog() {
482
 
42 soliveira 483
            $('#createNewPageFormName').val('<mtw:out value="bodyColumn.name" />');
484
            $('#createNewPageFormLang').val('<mtw:out value="bodyColumn.lang" />');
72 soliveira 485
            $('#createPageLanguageCell').show();
42 soliveira 486
 
36 soliveira 487
            myDialog = $('#createNewPageDialog');
488
            myDialog = prepareCreateNewPageDialog(myDialog);
489
            myDialog.dialog('open');
490
 
491
            return false;
492
        }
493
 
494
        function prepareCreateNewPageDialog(myDialog) {
495
 
496
            options = {
38 soliveira 497
            	close: function() { clearCreateNewPageForm(); },
36 soliveira 498
                autoOpen: false,
499
                width: 800,
500
                modal: true,
501
                title: "Create New Page:",
502
                buttons: [
503
                          {
38 soliveira 504
                                text: "Create",
505
                                click: function() { $('#createNewPageForm').submit(); }
36 soliveira 506
                          },
507
                          {
60 soliveira 508
                              text: "Preview",
509
                              click: function() { $('#createNewPageFormPreview').val('true'); $('#createNewPageForm').submit(); }
510
                          },
511
                          {
36 soliveira 512
                                text: "Cancel",
37 soliveira 513
                                click: function() {  $(this).dialog("close"); }
36 soliveira 514
                          }
515
                      ]
516
           };
517
 
518
          myDialog.dialog(options);
519
 
520
          return myDialog;
521
        }
522
 
102 soliveira 523
        function showFileUploadDialog() {
524
 
525
  			$('#uploadResults').html('');
526
 
527
        	myDialog = $('#fileUploadDialog');
528
        	myDialog = prepareFileUploadDialog(myDialog);
529
        	myDialog.dialog('open');
530
        }
531
 
33 soliveira 532
 
533
        function showLoginDialog() {
12 soliveira 534
 
42 soliveira 535
            $('#loginFormName').val('<mtw:out value="bodyColumn.name" />');
536
            $('#loginFormLang').val('<mtw:out value="bodyColumn.lang" />');
537
 
33 soliveira 538
            myDialog = $('#loginDialog');
539
            myDialog = prepareLoginDialog(myDialog);
540
            myDialog.dialog('open');
541
 
542
            return false;
543
        }
544
 
35 soliveira 545
        function clearLoginForm() {
546
        	$('#loginUsername').val('');
547
        	$('#loginPassword').val('');
548
        	$('#loginUsernameError').text('');
549
        	$('#loginPasswordError').text('');
36 soliveira 550
        }
33 soliveira 551
 
36 soliveira 552
        function clearCreateNewPageForm() {
553
        	$('#createNewPageName').val('');
554
        	$('#createNewPageTitle').val('');
555
        	$('#createNewPageLanguage').val('');
556
        	$('#createNewPageTextArea').val('');
39 soliveira 557
        	$('#createNewPageNameError').text('');
558
        	$('#createNewPageTitleError').text('');
559
        	$('#createNewPageLanguageError').text('');
560
        	$('#createNewPageBodyError').text('');
36 soliveira 561
        }
562
 
33 soliveira 563
      	function prepareLoginDialog(myDialog) {
564
 
565
            options = {
35 soliveira 566
            	close: function() { clearLoginForm(); },
33 soliveira 567
                autoOpen: false,
568
                width: 290,
569
                modal: true,
570
                title: "Login:",
571
                buttons: [
572
                          {
573
                                text: "Login",
574
                                click: function() { $('#loginForm').submit(); }
575
                          },
576
                          {
577
                                text: "Cancel",
37 soliveira 578
                                click: function() {  $(this).dialog("close"); }
33 soliveira 579
                          }
580
                      ]
581
           };
582
 
583
          myDialog.dialog(options);
584
 
585
          return myDialog;
586
        }
37 soliveira 587
 
588
      	function prepareConfirmDialog(myDialog) {
33 soliveira 589
 
37 soliveira 590
            options = {
591
                autoOpen: false,
592
                width: 300,
593
                modal: true,
594
                title: "Confirmation:",
595
                buttons: [
596
                          {
597
                                text: "Yes",
598
                                click: function() { $(this).dialog("close"); }
599
                          },
600
                          {
601
                                text: "No",
602
                                click: function() {  $(this).dialog("close"); }
603
                          }
604
                      ]
605
           };
606
 
607
          myDialog.dialog(options);
608
 
609
          return myDialog;
610
        }
611
 
612
         function showConfirmDialog() {
613
 
614
            myDialog = $('#confirmDialog');
615
            myDialog = prepareConfirmDialog(myDialog);
616
            myDialog.dialog('open');
617
 
618
            return false;
619
        }
620
 
12 soliveira 621
    </script>
622
 
623
</head>
624
 
625
<body class="composite">
626
 
627
<!-- For Testing -->
628
<div id="dialog" title="Dialog Title" style="display: none;">I'm in a dialog</div>
629
 
37 soliveira 630
<!-- Close Confirm -->
631
<div id="confirmDialog" style="display: none;">
632
	<span id="confirmMessage">The confirmation message goes here.</span>
633
</div>
634
 
102 soliveira 635
<!-- For file upload -->
636
<div id="fileUploadDialog" style="display: none;">
637
<br/>
638
<input id="file_upload" name="file_upload" type="file" />
639
<table cellspacing="2" cellpadding="5" id="uploadResults" style="margin-top: 10px;">
640
</table>
641
</div>
642
 
103 soliveira 643
<!-- For files listing -->
644
<div id="fileListDialog" style="display: none;">
645
<table cellspacing="2" cellpadding="5" id="fileListTable" style="margin-top: 10px;">
646
</table>
647
</div>
648
 
649
 
33 soliveira 650
<!-- For Editing Pages -->
28 soliveira 651
<div id="editPageDialog" style="display: none;">
41 soliveira 652
<form id="editPageForm" action="<mtw:contextPath />/Page.edit.mtw" method="post">
28 soliveira 653
<input type="hidden" name="name" id ="editPageName" value="" />
41 soliveira 654
<input type="hidden" name="lang" id="editPageLang" value="" />
65 soliveira 655
<input type="hidden" name="isPreview" id="editPagePreview" value="false" />
12 soliveira 656
<table>
657
    <tr>
658
        <td>&nbsp;</td>
659
    </tr>
72 soliveira 660
                <tr class="editPageTitleCell">
661
                    <td>
662
                        Title:
663
                    </td>
664
                    <td>
665
                        <mtw:input id="editPageTitle" name="title" size="40" maxlength="60" />
666
                        <span id="editPageTitleError">
667
                        <mtw:outError field="title">
668
                            <font color="red">
669
                                <b><mtw:out /></b>
670
                            </font>
671
                        </mtw:outError>
672
                        </span>
673
                    </td>
674
                </tr>
675
                <tr class="editPageTitleCell"><td>&nbsp;</td></tr>
12 soliveira 676
    <tr>
72 soliveira 677
        <td colspan="2"><mtw:textarea id="editPageTextArea" name="body" style="width: 100%; height: 465px;" />
678
        <span id="editPageTextAreaError">
679
                        <mtw:outError field="body">
680
                            <font color="red">
681
                                <b><mtw:out /></b>
682
                            </font>
683
                        </mtw:outError>
684
                        </span>
685
 
686
        </td>
12 soliveira 687
    </tr>
688
</table>
689
</form>
690
</div>
691
 
84 soliveira 692
<!-- For Showing Page Html -->
693
<div id="showPageDialog" style="display: none;">
694
<form id="showPageForm">
695
<table>
696
    <tr>
697
        <td>&nbsp;</td>
698
    </tr>
699
                <tr class="showPageTitleCell">
700
                    <td>
701
                        Title:
702
                    </td>
703
                    <td>
704
                        <mtw:input id="showPageTitle" name="title" size="40" maxlength="60" extra="readonly=readonly" />
705
                    </td>
706
                </tr>
707
                <tr class="showPageTitleCell"><td>&nbsp;</td></tr>
708
    <tr>
709
        <td colspan="2">
710
        <mtw:textarea id="showPageTextArea" name="body" style="width: 100%; height: 465px;" extra="readonly=readonly" />
711
        </td>
712
    </tr>
713
</table>
714
</form>
715
</div>
716
 
717
 
33 soliveira 718
<!-- For Login -->
719
<div id="loginDialog" style="display: none;">
720
		<form action="<mtw:contextPath />/Login.mtw" method="post" id="loginForm">
42 soliveira 721
            <input type="hidden" name="name" value="" id="loginFormName" />
722
            <input type="hidden" name="lang" value="" id="loginFormLang" />
33 soliveira 723
			<table>
724
				<tr>
725
					<td>
726
						Username:
727
					</td>
728
					<td>
35 soliveira 729
						<mtw:input id="loginUsername" name="username" size="20" maxlength="20" />
730
						<span id="loginUsernameError">
33 soliveira 731
						<mtw:outError field="username">
732
							<font color="red">
733
								<b><mtw:out /></b>
734
							</font>
735
						</mtw:outError>
35 soliveira 736
						</span>
33 soliveira 737
					</td>
738
				</tr>
739
				<tr>
740
					<td>
741
						Password:
742
					</td>
743
					<td>
35 soliveira 744
						<mtw:input id="loginPassword" name="password" type="password" size="20" maxlength="20" />
745
						<span id="loginPasswordError">
33 soliveira 746
						<mtw:outError field="password">
747
							<font color="red">
748
								<b><mtw:out /></b>
749
							</font>
750
						</mtw:outError>
35 soliveira 751
						</span>
33 soliveira 752
					</td>
753
				</tr>
754
			</table>
755
		</form>
756
</div>
757
 
49 soliveira 758
<!-- For displaying all pages -->
759
<div id="listAllPagesDialog" style="display: none;">
56 soliveira 760
    <form action="#" method="post" id="listAllPagesForm">
53 soliveira 761
    <table id="listAllPagesTable">
49 soliveira 762
    </table>
56 soliveira 763
    </form>
49 soliveira 764
</div>
765
 
81 soliveira 766
 
767
<!-- For displaying revisions -->
768
<div id="listRevisionsDialog" style="display: none;">
769
    <form action="#" method="post" id="listRevisionsForm">
770
    <table id="listRevisionsTable">
771
    </table>
772
    </form>
773
</div>
774
 
36 soliveira 775
<!-- Create New Page -->
776
<div id="createNewPageDialog" style="display: none;">
777
		<form action="<mtw:contextPath />/Page.add.mtw" method="post" id="createNewPageForm">
42 soliveira 778
            <input type="hidden" name="name" value="" id="createNewPageFormName" />
779
            <input type="hidden" name="lang" value="" id="createNewPageFormLang" />
60 soliveira 780
            <input type="hidden" name="isPreview" value="false" id="createNewPageFormPreview" />
36 soliveira 781
			<table>
782
				<tr>
783
					<td>
784
						Name:
785
					</td>
786
					<td>
39 soliveira 787
						<mtw:input id="createNewPageName" name="newPage.name" size="40" maxlength="30" />
36 soliveira 788
						<span id="createNewPageNameError">
39 soliveira 789
						<mtw:outError field="newPage.name">
36 soliveira 790
							<font color="red">
791
								<b><mtw:out /></b>
792
							</font>
793
						</mtw:outError>
794
						</span>
795
					</td>
796
				</tr>
797
				<tr>
798
					<td>
799
						Title:
800
					</td>
801
					<td>
39 soliveira 802
						<mtw:input id="createNewPageTitle" name="newPage.title" size="40" maxlength="60" />
36 soliveira 803
						<span id="createNewPageTitleError">
39 soliveira 804
						<mtw:outError field="newPage.title">
36 soliveira 805
							<font color="red">
806
								<b><mtw:out /></b>
807
							</font>
808
						</mtw:outError>
809
						</span>
810
					</td>
811
				</tr>
67 soliveira 812
				<tr id="createPageLanguageCell">
36 soliveira 813
					<td>
814
						Language:
815
					</td>
816
					<td>
39 soliveira 817
						<mtw:select name="newPage.languageId" list="languages" id="createNewPageLanguage" emptyField="true" />
36 soliveira 818
						<span id="createNewPageLanguageError">
39 soliveira 819
						<mtw:outError field="newPage.languageId">
36 soliveira 820
							<font color="red">
821
								<b><mtw:out /></b>
822
							</font>
823
						</mtw:outError>
824
						</span>
825
					</td>
826
				</tr>
827
				<tr>
39 soliveira 828
        			<td colspan="2">
829
        				<mtw:textarea id="createNewPageTextArea" name="newPage.body" style="width: 100%; height: 465px;" />
830
        				<span id="createNewPageBodyError">
831
						<mtw:outError field="newPage.body">
832
							<font color="red">
833
								<b><mtw:out /></b>
834
							</font>
835
						</mtw:outError>
836
						</span>
837
        			</td>
36 soliveira 838
    			</tr>
839
			</table>
840
		</form>
841
</div>
33 soliveira 842
 
36 soliveira 843
 
12 soliveira 844
<div>
845
<table border="0">
846
    <tr>
75 soliveira 847
        <td>
848
 
93 soliveira 849
        <k:kcode name="logo" />
75 soliveira 850
        <mtw:hasAuthorization groups="admin">
86 soliveira 851
 
75 soliveira 852
        <mtw:if test="logo.preview" value="false">
89 soliveira 853
        <br/>&nbsp;&nbsp;&nbsp;&nbsp;<a href="#" style="font-size: 8px;" onclick="return showEditPageDialog('logo', '<mtw:out value="logo.lang" />');" title="<k:editTooltip name="logo" />">Edit Logo</a>
75 soliveira 854
        </mtw:if>
86 soliveira 855
 
75 soliveira 856
        <mtw:if test="logo.preview" value="true">
857
        <br/>&nbsp;&nbsp;&nbsp;&nbsp;
858
        <span style="font-size: 10px; font-weight: bold;">Preview</span><span style="font-size: 8px;">&nbsp;&nbsp;-&nbsp;</span>
859
        <a style="font-size: 8px;" href="<mtw:contextPath/>/Page.savePreview.mtw?name=<mtw:out value="logo.name" />&lang=<mtw:out value="logo.language.locale" />">Save</a>&nbsp;
860
        <a style="font-size: 8px;" href="#" onclick="return showEditPreviewDialog('<mtw:out value="logo.name" />', '<mtw:out value="logo.language.locale" />');" title="<k:editTooltip name="logo" />">Edit</a>&nbsp;
861
        <a style="font-size: 8px;" href="<mtw:contextPath/>/Page.discardPreview.mtw?name=<mtw:out value="logo.name" />&lang=<mtw:out value="logo.language.locale" />">Discard</a>
862
        </mtw:if>
86 soliveira 863
 
75 soliveira 864
        </mtw:hasAuthorization>
865
 
866
        </td>
22 soliveira 867
        <td align="right" valign="bottom">
868
            <mtw:isLogged negate="true">
33 soliveira 869
                <a href="#" onclick="return showLoginDialog();">Login</a>
22 soliveira 870
            </mtw:isLogged>
871
            <mtw:isLogged>
36 soliveira 872
                <a href="#" onclick="return showCreateNewPageDialog();">Create New Page</a> |
49 soliveira 873
                <a href="#" onclick="return showListAllPagesDialog();">List Pages</a> |
100 soliveira 874
 
44 soliveira 875
                <mtw:hasAuthorization groups="admin">
74 soliveira 876
 
877
                <mtw:if test="css.preview" value="true">
878
                <b>CSS</b> -
879
                <a href="<mtw:contextPath/>/Page.savePreview.mtw?name=<mtw:out value="css.name" />&lang=<mtw:out value="css.language.locale" />">Save</a>&nbsp;
880
                <a href="#" onclick="return showEditPreviewDialog('<mtw:out value="css.name" />', '<mtw:out value="css.language.locale" />');" title="<k:editTooltip name="css" />">Edit</a>&nbsp;
881
                <a href="<mtw:contextPath/>/Page.discardPreview.mtw?name=<mtw:out value="css.name" />&lang=<mtw:out value="css.language.locale" />">Discard</a> |
882
                </mtw:if>
883
 
884
                <mtw:if test="css.preview" value="false">
41 soliveira 885
                <a href="#" onclick="return showEditPageDialog('CSS', 'en');" title="<k:editTooltip name="css" />">Edit CSS</a> |
74 soliveira 886
                </mtw:if>
887
 
100 soliveira 888
                </mtw:hasAuthorization>
74 soliveira 889
 
100 soliveira 890
                <mtw:hasAuthorization groups="admin">
891
 
892
                <mtw:if test="js.preview" value="true">
893
                <b>JavaScript</b> -
894
                <a href="<mtw:contextPath/>/Page.savePreview.mtw?name=<mtw:out value="js.name" />&lang=<mtw:out value="js.language.locale" />">Save</a>&nbsp;
895
                <a href="#" onclick="return showEditPreviewDialog('<mtw:out value="js.name" />', '<mtw:out value="js.language.locale" />');" title="<k:editTooltip name="js" />">Edit</a>&nbsp;
896
                <a href="<mtw:contextPath/>/Page.discardPreview.mtw?name=<mtw:out value="js.name" />&lang=<mtw:out value="js.language.locale" />">Discard</a> |
897
                </mtw:if>
898
 
899
                <mtw:if test="js.preview" value="false">
900
                <a href="#" onclick="return showEditPageDialog('JavaScript', 'en');" title="<k:editTooltip name="js" />">Edit JavaScript</a> |
901
                </mtw:if>
902
 
44 soliveira 903
                </mtw:hasAuthorization>
100 soliveira 904
 
102 soliveira 905
                <mtw:hasAuthorization groups="admin, editor">
100 soliveira 906
 
102 soliveira 907
                <a href="#" onclick="return showFileUploadDialog();">Upload Files</a> |
103 soliveira 908
                <a href="#" onclick="return showFileListDialog();">List Files</a> |
102 soliveira 909
 
910
                </mtw:hasAuthorization>
911
 
912
 
22 soliveira 913
                <a href="<mtw:contextPath/>/Logout.mtw">Logout</a> (<mtw:out value="sessionUser.username" />)
914
            </mtw:isLogged>
915
            &nbsp;
39 soliveira 916
            <mtw:isLocale value="pt">
86 soliveira 917
	            <a href="<mtw:urlWithLoc loc="pt" tagsToExclude="revision" />"><img src="images/brazil.gif" border="0" width="20" height="13" style="border: 3px solid #ccc;" /></a>
918
    	        <a href="<mtw:urlWithLoc loc="en" tagsToExclude="revision" />"><img src="images/usa.gif" width="20" height="13" border="0" style="border: 3px solid #fff;" /></a>
39 soliveira 919
            </mtw:isLocale>
920
            <mtw:isLocale value="en">
86 soliveira 921
            	<a href="<mtw:urlWithLoc loc="pt" tagsToExclude="revision" />"><img src="images/brazil.gif" border="0" width="20" height="13" style="border: 3px solid #fff;" /></a>
922
            	<a href="<mtw:urlWithLoc loc="en" tagsToExclude="revision" />"><img src="images/usa.gif" width="20" height="13" border="0" style="border: 3px solid #ccc;" /></a>
39 soliveira 923
            </mtw:isLocale>
22 soliveira 924
            &nbsp;&nbsp;&nbsp;
925
        </td>
12 soliveira 926
    </tr>
927
</table>
928
</div>
929
 
930
<hr />
931
 
932
<div id="leftColumn"><mtw:isLogged>
44 soliveira 933
    <mtw:hasAuthorization groups="admin">
73 soliveira 934
 
935
        <mtw:if test="leftColumn.preview" value="true">
936
        <div style="text-align: left; padding-left: 8px; padding-top: 6px;">
937
            <b>Preview</b>
938
            &nbsp;-&nbsp;
939
            <a href="<mtw:contextPath/>/Page.savePreview.mtw?name=<mtw:out value="leftColumn.name" />&lang=<mtw:out value="leftColumn.language.locale" />">Save</a>&nbsp;&nbsp;
940
            <a href="#" onclick="return showEditPreviewDialog('<mtw:out value="leftColumn.name" />', '<mtw:out value="leftColumn.language.locale" />');" title="<k:editTooltip name="leftColumn" />">Edit</a>&nbsp;&nbsp;
941
            <a href="<mtw:contextPath/>/Page.discardPreview.mtw?name=<mtw:out value="leftColumn.name" />&lang=<mtw:out value="leftColumn.language.locale" />">Discard</a>
942
        </div>
943
        </mtw:if>
944
 
945
        <mtw:if test="leftColumn.preview" value="false">
41 soliveira 946
        <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>
73 soliveira 947
        </mtw:if>
948
 
949
 
12 soliveira 950
    </mtw:hasAuthorization>
951
</mtw:isLogged>
20 soliveira 952
<div id="navcolumn">
953
    <div>
93 soliveira 954
    <k:kcode name="leftColumn" />
20 soliveira 955
    </div>
956
<br />
12 soliveira 957
</div>
958
 
959
</div>
960
 
961
<div id="bodyColumn">
28 soliveira 962
    <mtw:hasAuthorization groups="admin, editor">
63 soliveira 963
 
964
    <mtw:if test="bodyColumn.preview" value="true">
65 soliveira 965
 
966
    	<mtw:if test="bodyColumn.new" value="true">
71 soliveira 967
			<div style="text-align: left; padding-left: 4px;">
968
			<b>This is a Preview</b>
969
			&nbsp;-&nbsp;
970
            <a href="<mtw:contextPath/>/Page.savePreview.mtw?name=<mtw:out value="bodyColumn.name" />&lang=<mtw:out value="bodyColumn.language.locale" />">Save</a>&nbsp;&nbsp;
971
            <a href="#" onclick="return showEditPreviewNewPageDialog('<mtw:out value="bodyColumn.name" />', '<mtw:out value="bodyColumn.language.locale" />');" title="<k:editTooltip name="bodyColumn" />">Edit</a>&nbsp;&nbsp;
69 soliveira 972
			<a href="<mtw:contextPath/>/Page.discardPreview.mtw?name=<mtw:out value="bodyColumn.name" />&lang=<mtw:out value="bodyColumn.language.locale" />">Discard</a>
66 soliveira 973
			</div>
65 soliveira 974
    	</mtw:if>
975
    	<mtw:if test="bodyColumn.new" value="false">
71 soliveira 976
            <div style="text-align: left; padding-left: 4px;">
977
            <b>This is a Preview</b>
978
            &nbsp;-&nbsp;
979
            <a href="<mtw:contextPath/>/Page.savePreview.mtw?name=<mtw:out value="bodyColumn.name" />&lang=<mtw:out value="bodyColumn.language.locale" />">Save</a>&nbsp;&nbsp;
980
            <a href="#" onclick="return showEditPreviewDialog('<mtw:out value="bodyColumn.name" />', '<mtw:out value="bodyColumn.language.locale" />');" title="<k:editTooltip name="bodyColumn" />">Edit</a>&nbsp;&nbsp;
981
            <a href="<mtw:contextPath/>/Page.discardPreview.mtw?name=<mtw:out value="bodyColumn.name" />&lang=<mtw:out value="bodyColumn.language.locale" />">Discard</a>
66 soliveira 982
			</div>
65 soliveira 983
    	</mtw:if>
984
 
63 soliveira 985
    </mtw:if>
986
 
987
    <mtw:if test="bodyColumn.preview" value="false">
86 soliveira 988
        <mtw:if test="bodyColumn.revision" value="true">
989
            <div style="text-align: left; padding-left: 4px;"><span title="<k:editTooltip name="bodyColumn" />"><b>Revision #<mtw:out value="bodyColumn.revisionNumber" /></b></span></div>
990
        </mtw:if>
991
 
992
        <mtw:if test="bodyColumn.revision" value="false">
993
            <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>
994
        </mtw:if>
63 soliveira 995
    </mtw:if>
996
 
28 soliveira 997
    </mtw:hasAuthorization>
93 soliveira 998
    <k:kcode name="bodyColumn" />
12 soliveira 999
</div>
1000
 
1001
<div class="clear">
1002
<hr />
1003
</div>
1004
 
1005
<div id="footer">
63 soliveira 1006
<div class="xright">Copyright (c) 2011</div>
12 soliveira 1007
<div class="clear">
1008
<hr />
1009
</div>
1010
</div>
1011
 
1012
</body>
1013
</html>