Kawai Wiki

Rev

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

Rev Author Line No. Line
124 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/"%>
3
<%@ taglib uri="/WEB-INF/tld/taglib.tld" prefix="k" %>
4
 
5
<html>
6
<head>
7
 
8
<title><mtw:out  value="bodyColumn.title" /></title>
9
 
10
<style type="text/css" media="all">
11
@import url("<mtw:contextPath/>/Page.getCSS.mtw?file=main.css");
12
</style>
13
 
14
<meta http-equiv="imagetoolbar" content="no" />
15
<meta http-equiv="imagetoolbar" content="false" />
16
 
137 soliveira 17
<link rel="shortcut icon" type="image/x-icon" href="<mtw:contextPath />/uploads/images/favicon.ico" />
18
<link rel="icon" type="image/gif" href="<mtw:contextPath />uploads/images/favicon.gif" />
124 soliveira 19
<link rel="stylesheet" href="<mtw:contextPath/>/Page.getPrintCSS.mtw?file=print.css" type="text/css" media="print" />
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="<mtw:contextPath/>/css/jquery-ui-1.8.16.custom.css" rel="stylesheet" type="text/css" />
26
<script type="text/javascript" src="jquery/jquery-1.6.4.min.js"></script>
27
<script src="<mtw:contextPath/>/js/jquery-ui-1.8.16.custom.min.js"></script>
28
 
29
<link href="<mtw:contextPath />/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>
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/>/sh/css/shCore.css" rel="stylesheet" type="text/css" />
44
<link href="<mtw:contextPath/>/sh/css/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">
48
     SyntaxHighlighter.all();
49
</script>
50
 
51
<!--  User JavaScript -->
52
<script type="text/javascript">
53
 
54
<mtw:out value="js.body" />
55
 
56
</script>
57
 
58
 
59
<script language="JavaScript">
60
 
61
        $(document).ready(function() {
62
 
63
        	<mtw:if test="showForm" value="login">
64
				showLoginDialog();
65
			</mtw:if>
66
 
67
			<mtw:if test="showForm" value="add">
68
				showCreateNewPageDialog();
69
			</mtw:if>
70
 
71
			$('#loginDialog').keyup(function(e) {
72
    			if (e.keyCode == 13) {
73
        			$('#loginForm').submit();
74
    			}
75
			});
76
 
77
			$('#file_upload').uploadify({
78
				'uploader'  : '<mtw:contextPath />/uploadify/uploadify.swf',
79
				'script'    : '<mtw:contextPath />/File.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) {
85
 
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
 
96
        });
97
 
98
        function prepareEditPageDialog(myDialog, theTitle) {
99
 
100
            options = {
101
                autoOpen: false,
102
                width: 800,
103
                modal: true,
104
                title: theTitle,
105
                buttons: [
106
                          {
107
                                text: "Save",
108
                                click: function() { $('#editPageForm').submit(); }
109
                          },
110
                          {
111
                                text: "Preview",
112
                                click: function() { $('#editPagePreview').val('true'); $('#editPageForm').submit(); }
113
                          },
114
                          {
115
                                text: "Cancel",
116
                                click: function() { $(this).dialog("close"); }
117
                          }
118
                      ]
119
           };
120
 
121
          myDialog.dialog(options);
122
 
123
          return myDialog;
124
        }
125
 
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
                                text: "Close",
140
                                click: function() { $(this).dialog("close"); $('#listLastRevisionsDialog').dialog('close'); $('#listRevisionsDialog').dialog('close'); $('#listAllPagesDialog').dialog('close'); }
141
                          }
142
                      ]
143
           };
144
 
145
          myDialog.dialog(options);
146
 
147
          return myDialog;
148
        }
149
 
150
		function prepareFileListDialog(myDialog) {
151
 
152
            options = {
153
                autoOpen: false,
154
                width: 400,
155
                height: 300,
156
                modal: true,
157
                title: "Files uploaded:",
158
                buttons: [
159
                          {
160
                                text: "Close",
161
                                click: function() { $(this).dialog("close"); }
162
                          }
163
                      ]
164
           };
165
 
166
          myDialog.dialog(options);
167
 
168
          return myDialog;
169
        }
170
 
171
 
135 soliveira 172
        function prepareListAllPagesDialog(myDialog, showEdit) {
124 soliveira 173
 
135 soliveira 174
            listAllPagesButtons = [
175
                      {
176
                            text: "Close",
177
                            click: function() { $(this).dialog("close"); }
178
                      }];
179
 
180
            if (showEdit) {
181
                listAllPagesButtons = [
124 soliveira 182
                          {
183
                                text: "FrontPage",
184
                                click: function() { $('#listAllPagesForm').attr('action', '<mtw:contextPath/>/Page.setFrontPage.mtw'); $('#listAllPagesForm').submit(); }
185
                          },
186
                          {
187
                                text: "Delete",
188
                                click: function() { $('#listAllPagesForm').attr('action', '<mtw:contextPath/>/Page.delete.mtw'); $('#listAllPagesForm').submit(); }
189
                          },
190
                          {
191
                                text: "Close",
192
                                click: function() { $(this).dialog("close"); }
135 soliveira 193
                          }];
194
            }
195
 
196
            options = {
197
                autoOpen: false,
198
                width: 800,
199
                height: 450,
200
                modal: true,
201
                title: 'Pages:',
202
                buttons: listAllPagesButtons
124 soliveira 203
           };
204
 
205
          myDialog.dialog(options);
206
 
207
          return myDialog;
208
        }
209
 
210
        function prepareListRevisionsDialog(myDialog, name, lang, showBackButton) {
211
 
212
        	theButtons = [
213
                          {
214
                                text: "Back",
215
                                click: function() { $(this).dialog("close"); }
216
                          },
217
                          {
218
                                text: "Close",
219
                                click: function() { $(this).dialog("close"); $('#listAllPagesDialog').dialog('close'); }
220
                          }
221
                      ];
222
 
223
			if (!showBackButton) {
224
 
225
        	theButtons = [
226
                          {
227
                                text: "Close",
228
                                click: function() { $(this).dialog("close"); $('#listAllPagesDialog').dialog('close'); }
229
                          }
230
                      ];
231
			}
232
 
233
 
234
            options = {
235
                autoOpen: false,
236
                width: 800,
237
                height: 450,
238
                modal: true,
239
                title: 'Revisions for ' + name + ' in ' + lang,
240
                buttons: theButtons
241
           };
242
 
243
          myDialog.dialog(options);
244
 
245
          return myDialog;
246
        }
247
 
248
        function prepareListLastRevisionsDialog(myDialog, language) {
249
 
250
        	theButtons = [
251
                          {
252
                                text: "Close",
253
                                click: function() { $(this).dialog("close"); }
254
                          }
255
                      ];
256
 
257
            options = {
258
                autoOpen: false,
259
                width: 800,
260
                height: 450,
261
                modal: true,
134 soliveira 262
                title: 'Latest revisions in ' + language,
124 soliveira 263
                buttons: theButtons
264
           };
265
 
266
          myDialog.dialog(options);
267
 
268
          return myDialog;
269
        }
270
 
271
 
272
        function prepareFileUploadDialog(myDialog) {
273
 
274
            options = {
275
                autoOpen: false,
276
                width: 400,
277
                height: 300,
278
                modal: true,
279
                title: 'Uploading files...',
280
                buttons: [
281
                          {
282
                                text: "Close",
283
                                click: function() { $(this).dialog("close"); }
284
                          }
285
                      ]
286
           };
287
 
288
          myDialog.dialog(options);
289
 
290
          return myDialog;
291
        }
292
 
293
        function showEditPageDialog(pageName, lang) {
294
 
295
            $.getJSON('<mtw:contextPath />/Page.get.mtw?name=' + pageName + '&lang=' + lang, function(data) {
296
 
297
                if (data.page.systemPage) {
298
                	$('.editPageTitleCell').hide();
299
                } else {
300
                	$('.editPageTitleCell').show();
301
                	$('#editPageTitle').val(data.page.title);
302
                }
303
 
304
                if (data.page.new) {
305
                	$('#editPageCommentCell').hide();
306
                } else {
307
                	$('#editPageCommentCell').show();
308
                	if (data.page.preview) {
309
                		$('#editPageComment').val(data.page.comment);
310
                	}
311
                }
312
 
313
                $('#editPageTextArea').val(data.page.body);
314
                $('#editPageName').val(data.page.name);
315
                $('#editPageLang').val(data.page.lang);
316
 
317
                myDialog = $('#editPageDialog');
318
                myDialog = prepareEditPageDialog(myDialog, 'Editing <i><font color="darkblue">' + pageName + "</font></i> in <i>" + data.page.language + "<i>...");
319
                myDialog.dialog('open');
320
            });
321
 
322
            return false;
323
        }
324
 
325
        function showFileListDialog() {
326
 
327
            $.getJSON('<mtw:contextPath />/File.listFiles.mtw', function(data) {
328
 
329
				$('#fileListTable').html('');
330
 
331
            	if (data.files.length == 0) {
332
            		$('#fileListTable').html('<tr><td align="center">No files uploaded yet!</td></tr>');
333
            	} else {
334
            		$.each(data.files, function(i,file) {
335
						$('#fileListTable').append('<tr><td>' + file + '</td></tr>');
336
            		});
337
            	}
338
 
339
                myDialog = $('#fileListDialog');
340
                myDialog = prepareFileListDialog(myDialog);
341
                myDialog.dialog('open');
342
            });
343
 
344
            return false;
345
        }
346
 
347
        function showShowPageDialog(pageName, lang, revision) {
348
 
349
            $.getJSON('<mtw:contextPath />/Page.get.mtw?name=' + pageName + '&lang=' + lang + '&revision=' + revision, function(data) {
350
 
351
                if (data.page.systemPage) {
352
                    $('.showPageTitleCell').hide();
353
                } else {
354
                    $('.showPageTitleCell').show();
355
                    $('#showPageTitle').val(data.page.title);
356
                }
357
                $('#showPageTextArea').val(data.page.body);
358
 
359
                theTitle = 'Showing <i><font color="darkblue">' + pageName + "</font></i> in <i>" + data.page.language + "<i>...";
360
                if (revision > 0) {
361
                    theTitle += ' (Revision #' + revision + ')';
362
                }
363
 
364
                myDialog = $('#showPageDialog');
365
                myDialog = prepareShowPageDialog(myDialog, theTitle);
366
                myDialog.dialog('open');
367
            });
368
 
369
            return false;
370
        }
371
 
372
 
373
        function showEditPreviewDialog(pageName, lang) {
374
 
375
            $.getJSON('<mtw:contextPath />/Page.getPreview.mtw?name=' + pageName + '&lang=' + lang, function(data) {
376
 
377
            	if (data.page.systemPage) {
378
                	$('.editPageTitleCell').hide();
379
                } else {
380
                	$('.editPageTitleCell').show();
381
                	$('#editPageTitle').val(data.page.title);
382
                }
383
 
384
                if (data.page.new) {
385
                	$('#editPageCommentCell').hide();
386
                } else {
387
                	$('#editPageCommentCell').show();
388
                	if (data.page.preview) {
389
                		$('#editPageComment').val(data.page.comment);
390
                	}
391
                }
392
 
393
 
394
                $('#editPageTextArea').val(data.page.body);
395
                $('#editPageName').val(data.page.name);
396
                $('#editPageLang').val(data.page.lang);
397
 
398
                myDialog = $('#editPageDialog');
399
                myDialog = prepareEditPageDialog(myDialog, 'Editing <i><font color="darkblue">' + pageName + "</font></i> in <i>" + data.page.language + "<i>...");
400
                myDialog.dialog('open');
401
            });
402
 
403
            return false;
404
        }
405
 
406
 
407
       	function showEditPreviewNewPageDialog(pageName, lang) {
408
 
409
            $.getJSON('<mtw:contextPath />/Page.getPreview.mtw?name=' + pageName + '&lang=' + lang, function(data) {
410
 
411
           		$('#createNewPageName').val(data.page.name);
412
        		$('#createNewPageTitle').val(data.page.title);
413
        		$('#createNewPageLanguage').val(data.page.languageId);
414
        		$('#createNewPageTextArea').val(data.page.body);
415
        		$('#createNewPageNameError').text('');
416
        		$('#createNewPageTitleError').text('');
417
        		$('#createNewPageLanguageError').text('');
418
        		$('#createNewPageBodyError').text('');
419
 
420
				showCreateNewPageDialog();
421
 
422
				$('#createPageLanguageCell').hide();
423
            });
424
 
425
            return false;
426
        }
427
 
135 soliveira 428
        function showListAllPagesDialog(isAdmin) {
124 soliveira 429
 
430
            $.getJSON('<mtw:contextPath />/Page.list.mtw', function(data) {
431
 
432
                tableData = '';
433
                tableData += '<tr>';
135 soliveira 434
                if (isAdmin) tableData += '<th>&nbsp;</th>';
124 soliveira 435
                tableData += '<th>Name</th>';
436
                tableData += '<th>Language</th>';
437
                tableData += '<th>Created By</th>';
438
                tableData += '<th>Modified By</th>';
439
                tableData += '<th>&nbsp;</th>';
440
                tableData += '<th>&nbsp;</th>';
441
                tableData += '<th>&nbsp;</th>';
442
                tableData += '</tr>';
443
 
444
                $.each(data.pages, function(i,page) {
445
 
446
                	pageName = page.name;
447
 
448
                    modifiedBy = '';
449
                    if (page.modifiedById > 0) {
450
                        modifiedBy = page.modifiedBy.username;
451
                    }
452
 
453
                    if (page.systemPage == true) {
454
                        pageName = '*' + pageName;
455
                    }
456
 
457
                    if (page.frontPage == true) {
458
                        pageName = '[' + pageName + ']';
459
                    }
460
 
461
                    modifiedOnTitle = '';
462
                    if (page.formattedModifiedOn != null) {
463
                    	modifiedOnTitle = ' title="' + page.formattedModifiedOn + '"';
464
                    }
465
 
466
                    createdOnTitle = '';
467
                    if (page.formattedCreatedOn != null) {
468
                    	createdOnTitle = ' title="' + page.formattedCreatedOn + '"';
469
                    }
470
 
471
                    radioCell = '&nbsp;';
472
                    viewCell = '&nbsp;';
473
                    if (page.CSS == false && page.systemPage == false) {
474
                    	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> ';
475
                    	if (page.frontPage == false) {
476
                    		radioCell = '<input tabindex="-1" type="radio" name="pageId" id="pageId" value="' + page.id + '" />';
477
                    	}
478
                    }
479
 
480
                    viewRevisionsCell = '<a title="View Revisions" class="revisionLink" tabindex="-1" href="#" onclick="return showListRevisionsDialog(\'' + page.name + '\',\'' + page.lang + '\',\'' + page.language + '\', true);"><img src="<mtw:contextPath/>/images/folder.png" height="24" height="20" border="0" /></a>';
481
 
482
                    nameTitle = '';
483
                    if (page.title != null && page.title != '') {
484
                    	nameTitle = ' title="' + page.title + '"';
485
                    }
486
 
487
                    tableData += '<tr>';
135 soliveira 488
                    if (isAdmin) tableData += '<td>' + radioCell + '</td>';
124 soliveira 489
                    tableData += '<td' + nameTitle + '>' + pageName + '</td>';
490
                    tableData += '<td align="center">' + page.language + '</td>';
491
                    tableData += '<td align="center"' + createdOnTitle + '>' + page.createdBy.username + '</td>';
492
                    tableData += '<td align="center"' + modifiedOnTitle + '>' + modifiedBy + '</td>';
493
                    tableData += '<td align="center">' + viewCell + '</td>';
494
                    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>';
495
                    tableData += '<td align="center">' + viewRevisionsCell + '</td>';
496
                    tableData += '</tr>';
497
                });
498
 
499
                $('#listAllPagesTable').html(tableData);
500
 
501
                myDialogDiv = $('#listAllPagesDialog');
135 soliveira 502
                myDialog = prepareListAllPagesDialog(myDialogDiv, isAdmin);
124 soliveira 503
                myDialog.dialog('open');
504
                $('.ui-dialog :button').blur();
505
             });
506
 
507
            return false;
508
        }
509
 
510
        function showListRevisionsDialog(name, lang, language, showBackButton) {
511
 
512
            $.getJSON('<mtw:contextPath />/Page.getRevisions.mtw?name=' + name + '&lang=' + lang, function(data) {
513
 
514
                tableData = '';
515
                tableData += '<tr>';
516
                tableData += '<th>Revision</th>';
517
                tableData += '<th>Author</th>';
518
                tableData += '<th>Date</th>';
519
 
520
                if (data.isSystemPage == false) {
521
                    tableData += '<th>&nbsp;</th>';
522
                }
523
                tableData += '<th>&nbsp;</th>';
524
                tableData += '</tr>';
525
 
526
                $.each(data.revisions, function(i,revision) {
527
 
528
                	titleForComment = '';
529
                	if (revision.comment != null && revision.comment != '') {
530
                		titleForComment = ' title="' + revision.comment + '"';
531
                	}
532
 
533
                    tableData += '<tr>';
534
                    tableData += '<td' + titleForComment + '>' + revision.revision + '</td>';
535
                    tableData += '<td align="center">' + revision.user.username + '</td>';
536
                    tableData += '<td align="center">' + revision.formattedCreatedOn + '</td>';
537
 
538
                    if (data.isSystemPage == false) {
539
                        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>';
540
                    }
541
 
542
                    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>';
543
 
544
                    tableData += '</tr>';
545
                });
546
 
547
                $('#listRevisionsTable').html(tableData);
548
                myDialog = $('#listRevisionsDialog');
549
                myDialog = prepareListRevisionsDialog(myDialog, name, language, showBackButton);
550
                myDialog.dialog('open');
551
                $('.ui-dialog :button').blur();
552
             });
553
 
554
            return false;
555
        }
556
 
134 soliveira 557
        function showListLastRevisionsDialog(lang, language, isLogged) {
124 soliveira 558
 
559
            $.getJSON('<mtw:contextPath />/Page.getLastRevisions.mtw?lang=' + lang, function(data) {
560
 
561
                tableData = '';
562
                tableData += '<tr>';
563
                tableData += '<th>Page</th>';
564
                tableData += '<th>Revision</th>';
565
                tableData += '<th>Author</th>';
566
                tableData += '<th>Date</th>';
567
                tableData += '<th>Comment</th>';
568
                tableData += '<th>&nbsp;</th>';
134 soliveira 569
 
570
                if (isLogged) {
571
                    tableData += '<th>&nbsp;</th>';
572
                }
573
 
124 soliveira 574
                tableData += '</tr>';
575
 
576
                $.each(data.revisions, function(i,revision) {
577
 
578
                    tableData += '<tr>';
579
 
580
                    pageName = revision.name;
581
 
582
                    if (revision.frontPage) {
583
                    	pageName = '[' + pageName + ']';
584
                    } else if (revision.systemPage) {
585
                    	pageName = '*' + pageName;
586
                    }
136 soliveira 587
 
588
                    nameTitle = '';
589
                    if (revision.title != null && revision.title != '') {
590
                    	nameTitle = ' title="' + revision.title + '"';
591
                    }
124 soliveira 592
 
136 soliveira 593
                    tableData += '<td' + nameTitle + ' align="center">' + pageName + '</td>';
124 soliveira 594
                    tableData += '<td align="center">' + revision.revision + '</td>';
595
                    tableData += '<td align="center">' + revision.user.username + '</td>';
596
                    tableData += '<td align="center">' + revision.formattedCreatedOn + '</td>';
597
                    tableData += '<td align="left">' + revision.comment + '</td>';
598
 
599
					if (!revision.systemPage) {
600
                    	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>';
601
                    } else {
602
                    	tableData += '<td>&nbsp;</td>';
603
                    }
134 soliveira 604
 
605
                    if (isLogged) {
606
                        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>';
607
                    }
124 soliveira 608
 
609
                    tableData += '</tr>';
610
                });
611
 
612
                $('#listLastRevisionsTable').html(tableData);
613
                myDialog = $('#listLastRevisionsDialog');
614
                myDialog = prepareListLastRevisionsDialog(myDialog, language);
615
                myDialog.dialog('open');
616
                $('.ui-dialog :button').blur();
617
             });
618
 
619
            return false;
620
        }
621
 
622
 
623
       	function showCreateNewPageDialog() {
624
 
625
            $('#createNewPageFormName').val('<mtw:out value="bodyColumn.name" />');
626
            $('#createNewPageFormLang').val('<mtw:out value="bodyColumn.lang" />');
627
            $('#createPageLanguageCell').show();
628
 
629
            myDialog = $('#createNewPageDialog');
630
            myDialog = prepareCreateNewPageDialog(myDialog);
631
            myDialog.dialog('open');
632
 
633
            return false;
634
        }
635
 
636
        function prepareCreateNewPageDialog(myDialog) {
637
 
638
            options = {
639
            	close: function() { clearCreateNewPageForm(); },
640
                autoOpen: false,
641
                width: 800,
642
                modal: true,
643
                title: "Create New Page:",
644
                buttons: [
645
                          {
646
                                text: "Create",
647
                                click: function() { $('#createNewPageForm').submit(); }
648
                          },
649
                          {
650
                              text: "Preview",
651
                              click: function() { $('#createNewPageFormPreview').val('true'); $('#createNewPageForm').submit(); }
652
                          },
653
                          {
654
                                text: "Cancel",
655
                                click: function() {  $(this).dialog("close"); }
656
                          }
657
                      ]
658
           };
659
 
660
          myDialog.dialog(options);
661
 
662
          return myDialog;
663
        }
664
 
665
        function showFileUploadDialog() {
666
 
667
  			$('#uploadResults').html('');
668
 
669
        	myDialog = $('#fileUploadDialog');
670
        	myDialog = prepareFileUploadDialog(myDialog);
671
        	myDialog.dialog('open');
672
        }
673
 
674
 
675
        function showLoginDialog() {
676
 
677
            $('#loginFormName').val('<mtw:out value="bodyColumn.name" />');
678
            $('#loginFormLang').val('<mtw:out value="bodyColumn.lang" />');
679
 
680
            myDialog = $('#loginDialog');
681
            myDialog = prepareLoginDialog(myDialog);
682
            myDialog.dialog('open');
683
 
684
            return false;
685
        }
686
 
687
        function clearLoginForm() {
688
        	$('#loginUsername').val('');
689
        	$('#loginPassword').val('');
690
        	$('#loginUsernameError').text('');
691
        	$('#loginPasswordError').text('');
692
        }
693
 
694
        function clearCreateNewPageForm() {
695
        	$('#createNewPageName').val('');
696
        	$('#createNewPageTitle').val('');
697
        	$('#createNewPageLanguage').val('');
698
        	$('#createNewPageTextArea').val('');
699
        	$('#createNewPageNameError').text('');
700
        	$('#createNewPageTitleError').text('');
701
        	$('#createNewPageLanguageError').text('');
702
        	$('#createNewPageBodyError').text('');
703
        }
704
 
705
      	function prepareLoginDialog(myDialog) {
706
 
707
            options = {
708
            	close: function() { clearLoginForm(); },
709
                autoOpen: false,
710
                width: 290,
711
                modal: true,
712
                title: "Login:",
713
                buttons: [
714
                          {
715
                                text: "Login",
716
                                click: function() { $('#loginForm').submit(); }
717
                          },
718
                          {
719
                                text: "Cancel",
720
                                click: function() {  $(this).dialog("close"); }
721
                          }
722
                      ]
723
           };
724
 
725
          myDialog.dialog(options);
726
 
727
          return myDialog;
728
        }
729
 
730
      	function prepareConfirmDialog(myDialog) {
731
 
732
            options = {
733
                autoOpen: false,
734
                width: 300,
735
                modal: true,
736
                title: "Confirmation:",
737
                buttons: [
738
                          {
739
                                text: "Yes",
740
                                click: function() { $(this).dialog("close"); }
741
                          },
742
                          {
743
                                text: "No",
744
                                click: function() {  $(this).dialog("close"); }
745
                          }
746
                      ]
747
           };
748
 
749
          myDialog.dialog(options);
750
 
751
          return myDialog;
752
        }
753
 
754
         function showConfirmDialog() {
755
 
756
            myDialog = $('#confirmDialog');
757
            myDialog = prepareConfirmDialog(myDialog);
758
            myDialog.dialog('open');
759
 
760
            return false;
761
        }
762
 
763
    </script>
764
 
765
</head>
766
 
12 soliveira 767
<body class="composite">
768
 
769
<!-- For Testing -->
770
<div id="dialog" title="Dialog Title" style="display: none;">I'm in a dialog</div>
771
 
37 soliveira 772
<!-- Close Confirm -->
773
<div id="confirmDialog" style="display: none;">
774
	<span id="confirmMessage">The confirmation message goes here.</span>
775
</div>
776
 
124 soliveira 777
<!-- For file upload -->
778
<div id="fileUploadDialog" style="display: none;">
779
<br/>
780
<input id="file_upload" name="file_upload" type="file" />
781
<table cellspacing="2" cellpadding="5" id="uploadResults" style="margin-top: 10px;">
782
</table>
783
</div>
102 soliveira 784
 
124 soliveira 785
<!-- For files listing -->
786
<div id="fileListDialog" style="display: none;">
787
<table cellspacing="2" cellpadding="5" id="fileListTable" style="margin-top: 10px;">
788
</table>
789
</div>
103 soliveira 790
 
33 soliveira 791
<!-- For Editing Pages -->
124 soliveira 792
<div id="editPageDialog" style="display: none;">
793
<form id="editPageForm" action="<mtw:contextPath />/Page.edit.mtw" method="post">
794
<input type="hidden" name="name" id ="editPageName" value="" />
795
<input type="hidden" name="lang" id="editPageLang" value="" />
796
<input type="hidden" name="isPreview" id="editPagePreview" value="false" />
797
<table border="0">
798
    <tr>
799
        <td>&nbsp;</td>
800
    </tr>
801
                <tr class="editPageTitleCell">
802
                    <td>
803
                        Title:&nbsp;&nbsp;&nbsp;&nbsp;
804
                        <mtw:input id="editPageTitle" name="title" size="40" maxlength="60" />
805
                        <span id="editPageTitleError">
806
                        <mtw:outError field="title">
807
                            <font color="red">
808
                                <b><mtw:out /></b>
809
                            </font>
810
                        </mtw:outError>
811
                        </span>
812
                    </td>
813
                </tr>
814
                <tr class="editPageTitleCell"><td colspan="2">&nbsp;</td></tr>
815
    <tr>
816
        <td><mtw:textarea id="editPageTextArea" name="body" style="width: 100%; height: 465px;" />
817
        <span id="editPageTextAreaError">
818
                        <mtw:outError field="body">
819
                            <font color="red">
820
                                <b><mtw:out /></b>
821
                            </font>
822
                        </mtw:outError>
823
                        </span>
824
 
825
        </td>
826
    </tr>
827
 
828
    <tr id="editPageCommentCell">
829
                    <td width="20%">
830
                        Edit comment: (<i>optional</i>) &nbsp;&nbsp;&nbsp;&nbsp;
831
                        <mtw:input id="editPageComment" name="comment" size="40" maxlength="60" />
832
                        <span id="editPageCommentError">
833
                        <mtw:outError field="comment">
834
                            <font color="red">
835
                                <b><mtw:out /></b>
836
                            </font>
837
                        </mtw:outError>
838
                        </span>
839
                    </td>
840
                </tr>
841
 
842
</table>
843
</form>
844
</div>
12 soliveira 845
 
124 soliveira 846
<!-- For Showing Page Html -->
847
<div id="showPageDialog" style="display: none;">
848
<form id="showPageForm">
849
<table>
850
    <tr>
851
        <td>&nbsp;</td>
852
    </tr>
853
                <tr class="showPageTitleCell">
854
                    <td>
855
                        Title:
856
                    </td>
857
                    <td>
858
                        <mtw:input id="showPageTitle" name="title" size="40" maxlength="60" extra="readonly=readonly" />
859
                    </td>
860
                </tr>
861
                <tr class="showPageTitleCell"><td>&nbsp;</td></tr>
862
    <tr>
863
        <td colspan="2">
864
        <mtw:textarea id="showPageTextArea" name="body" style="width: 100%; height: 465px;" extra="readonly=readonly" />
865
        </td>
866
    </tr>
867
</table>
868
</form>
869
</div>
84 soliveira 870
 
871
 
124 soliveira 872
<!-- For Login -->
873
<div id="loginDialog" style="display: none;">
874
		<form action="<mtw:contextPath />/Login.mtw" method="post" id="loginForm">
875
            <input type="hidden" name="name" value="" id="loginFormName" />
876
            <input type="hidden" name="lang" value="" id="loginFormLang" />
877
			<table>
878
				<tr>
879
					<td>
880
						Username:
881
					</td>
882
					<td>
883
						<mtw:input id="loginUsername" name="username" size="20" maxlength="20" />
884
						<span id="loginUsernameError">
885
						<mtw:outError field="username">
886
							<font color="red">
887
								<b><mtw:out /></b>
888
							</font>
889
						</mtw:outError>
890
						</span>
891
					</td>
892
				</tr>
893
				<tr>
894
					<td>
895
						Password:
896
					</td>
897
					<td>
898
						<mtw:input id="loginPassword" name="password" type="password" size="20" maxlength="20" />
899
						<span id="loginPasswordError">
900
						<mtw:outError field="password">
901
							<font color="red">
902
								<b><mtw:out /></b>
903
							</font>
904
						</mtw:outError>
905
						</span>
906
					</td>
907
				</tr>
908
			</table>
909
		</form>
910
</div>
33 soliveira 911
 
124 soliveira 912
<!-- For displaying all pages -->
913
<div id="listAllPagesDialog" style="display: none;">
914
    <form action="#" method="post" id="listAllPagesForm">
915
    <table id="listAllPagesTable">
916
    </table>
917
    </form>
918
</div>
49 soliveira 919
 
81 soliveira 920
 
124 soliveira 921
<!-- For displaying revisions -->
922
<div id="listRevisionsDialog" style="display: none;">
923
    <table class="revisionsTable" id="listRevisionsTable">
924
    </table>
925
</div>
33 soliveira 926
 
124 soliveira 927
<!-- For displaying last revisions -->
928
<div id="listLastRevisionsDialog" style="display: none;">
929
    <table class="revisionsTable" id="listLastRevisionsTable">
930
    </table>
931
</div>
36 soliveira 932
 
124 soliveira 933
 
934
<!-- Create New Page -->
935
<div id="createNewPageDialog" style="display: none;">
936
		<form action="<mtw:contextPath />/Page.add.mtw" method="post" id="createNewPageForm">
937
            <input type="hidden" name="name" value="" id="createNewPageFormName" />
938
            <input type="hidden" name="lang" value="" id="createNewPageFormLang" />
939
            <input type="hidden" name="isPreview" value="false" id="createNewPageFormPreview" />
940
			<table>
941
				<tr>
942
					<td>
943
						Name:
944
					</td>
945
					<td>
946
						<mtw:input id="createNewPageName" name="newPage.name" size="40" maxlength="30" />
947
						<span id="createNewPageNameError">
948
						<mtw:outError field="newPage.name">
949
							<font color="red">
950
								<b><mtw:out /></b>
951
							</font>
952
						</mtw:outError>
953
						</span>
954
					</td>
955
				</tr>
956
				<tr>
957
					<td>
958
						Title:
959
					</td>
960
					<td>
961
						<mtw:input id="createNewPageTitle" name="newPage.title" size="40" maxlength="60" />
962
						<span id="createNewPageTitleError">
963
						<mtw:outError field="newPage.title">
964
							<font color="red">
965
								<b><mtw:out /></b>
966
							</font>
967
						</mtw:outError>
968
						</span>
969
					</td>
970
				</tr>
971
				<tr id="createPageLanguageCell">
972
					<td>
973
						Language:
974
					</td>
975
					<td>
976
						<mtw:select name="newPage.languageId" list="languages" id="createNewPageLanguage" emptyField="true" />
977
						<span id="createNewPageLanguageError">
978
						<mtw:outError field="newPage.languageId">
979
							<font color="red">
980
								<b><mtw:out /></b>
981
							</font>
982
						</mtw:outError>
983
						</span>
984
					</td>
985
				</tr>
986
				<tr>
987
        			<td colspan="2">
988
        				<mtw:textarea id="createNewPageTextArea" name="newPage.body" style="width: 100%; height: 465px;" />
989
        				<span id="createNewPageBodyError">
990
						<mtw:outError field="newPage.body">
991
							<font color="red">
992
								<b><mtw:out /></b>
993
							</font>
994
						</mtw:outError>
995
						</span>
996
        			</td>
997
    			</tr>
998
			</table>
999
		</form>
1000
</div>
1001
 
1002
 
1003
<div>
1004
<table border="0">
1005
    <tr>
1006
        <td>
1007
 
1008
        <k:kcode name="logo" />
1009
        <mtw:hasAuthorization groups="admin">
1010
 
1011
        <mtw:if test="logo.preview" value="false">
1012
        <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>
1013
        </mtw:if>
1014
 
1015
        <mtw:if test="logo.preview" value="true">
1016
        <br/>&nbsp;&nbsp;&nbsp;&nbsp;
1017
        <span style="font-size: 10px; font-weight: bold;">Preview</span><span style="font-size: 8px;">&nbsp;&nbsp;-&nbsp;</span>
1018
        <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;
1019
        <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;
1020
        <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>
1021
        </mtw:if>
1022
 
1023
        </mtw:hasAuthorization>
1024
 
1025
        </td>
1026
        <td align="right" valign="bottom">
1027
            <mtw:isLogged negate="true">
134 soliveira 1028
                <a href="#" onclick="return showListLastRevisionsDialog('<mtw:out value="bodyColumn.language.locale" />', '<mtw:out value="bodyColumn.language" />', false);">Last Updates</a> |
124 soliveira 1029
                <a href="#" onclick="return showLoginDialog();">Login</a>
1030
            </mtw:isLogged>
1031
            <mtw:isLogged>
1032
                <a href="#" onclick="return showCreateNewPageDialog();">Create New Page</a> |
135 soliveira 1033
                <a href="#" onclick="return showListAllPagesDialog(<mtw:out value="sessionUser.admin" />);">List Pages</a> |
124 soliveira 1034
 
135 soliveira 1035
                <mtw:hasAuthorization groups="admin, editor">
124 soliveira 1036
 
1037
                <mtw:if test="css.preview" value="true">
1038
                <b>CSS</b> -
1039
                <a href="<mtw:contextPath/>/Page.savePreview.mtw?name=<mtw:out value="css.name" />&lang=<mtw:out value="css.language.locale" />">Save</a>&nbsp;
1040
                <a href="#" onclick="return showEditPreviewDialog('<mtw:out value="css.name" />', '<mtw:out value="css.language.locale" />');" title="<k:editTooltip name="css" />">Edit</a>&nbsp;
1041
                <a href="<mtw:contextPath/>/Page.discardPreview.mtw?name=<mtw:out value="css.name" />&lang=<mtw:out value="css.language.locale" />">Discard</a> |
1042
                </mtw:if>
1043
 
1044
                <mtw:if test="css.preview" value="false">
1045
                <a href="#" onclick="return showEditPageDialog('CSS', 'en');" title="<k:editTooltip name="css" />">Edit CSS</a> |
1046
                </mtw:if>
1047
 
1048
                </mtw:hasAuthorization>
1049
 
135 soliveira 1050
                <mtw:hasAuthorization groups="admin, editor">
124 soliveira 1051
 
1052
                <mtw:if test="js.preview" value="true">
1053
                <b>JavaScript</b> -
1054
                <a href="<mtw:contextPath/>/Page.savePreview.mtw?name=<mtw:out value="js.name" />&lang=<mtw:out value="js.language.locale" />">Save</a>&nbsp;
1055
                <a href="#" onclick="return showEditPreviewDialog('<mtw:out value="js.name" />', '<mtw:out value="js.language.locale" />');" title="<k:editTooltip name="js" />">Edit</a>&nbsp;
1056
                <a href="<mtw:contextPath/>/Page.discardPreview.mtw?name=<mtw:out value="js.name" />&lang=<mtw:out value="js.language.locale" />">Discard</a> |
1057
                </mtw:if>
1058
 
1059
                <mtw:if test="js.preview" value="false">
1060
                <a href="#" onclick="return showEditPageDialog('JavaScript', 'en');" title="<k:editTooltip name="js" />">Edit JavaScript</a> |
1061
                </mtw:if>
1062
 
1063
                </mtw:hasAuthorization>
1064
 
1065
                <mtw:hasAuthorization groups="admin, editor">
1066
 
1067
                <a href="#" onclick="return showFileUploadDialog();">Upload Files</a> |
1068
                <a href="#" onclick="return showFileListDialog();">List Files</a> |
134 soliveira 1069
                <a href="#" onclick="return showListLastRevisionsDialog('<mtw:out value="bodyColumn.language.locale" />', '<mtw:out value="bodyColumn.language" />', true);">Last Updates</a> |
124 soliveira 1070
 
1071
                </mtw:hasAuthorization>
1072
 
1073
 
1074
                <a href="<mtw:contextPath/>/Logout.mtw">Logout</a> (<mtw:out value="sessionUser.username" />)
1075
            </mtw:isLogged>
1076
            &nbsp;
140 soliveira 1077
            <%--
124 soliveira 1078
            <mtw:isLocale value="pt">
1079
	            <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>
1080
    	        <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>
1081
            </mtw:isLocale>
1082
            <mtw:isLocale value="en">
1083
            	<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>
1084
            	<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>
1085
            </mtw:isLocale>
140 soliveira 1086
            --%>
1087
            <k:listFlags />
124 soliveira 1088
            &nbsp;&nbsp;&nbsp;
1089
        </td>
1090
    </tr>
1091
</table>
1092
</div>
1093
 
1094
<hr />
1095
 
1096
<div id="leftColumn"><mtw:isLogged>
135 soliveira 1097
    <mtw:hasAuthorization groups="admin, editor">
124 soliveira 1098
 
1099
        <mtw:if test="leftColumn.preview" value="true">
1100
        <div style="text-align: left; padding-left: 8px; padding-top: 6px;">
1101
            <b>Preview</b>
1102
            &nbsp;-&nbsp;
1103
            <a href="<mtw:contextPath/>/Page.savePreview.mtw?name=<mtw:out value="leftColumn.name" />&lang=<mtw:out value="leftColumn.language.locale" />">Save</a>&nbsp;&nbsp;
1104
            <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;
1105
            <a href="<mtw:contextPath/>/Page.discardPreview.mtw?name=<mtw:out value="leftColumn.name" />&lang=<mtw:out value="leftColumn.language.locale" />">Discard</a>
1106
        </div>
1107
        </mtw:if>
73 soliveira 1108
 
124 soliveira 1109
        <mtw:if test="leftColumn.preview" value="false">
1110
        <div style="text-align: right; padding-right: 14px; padding-top: 6px;">
1111
        <a href="#" onclick="return showEditPageDialog('LeftColumn', '<mtw:out value="leftColumn.language.locale" />');" title="<k:editTooltip name="leftColumn" />">Edit</a>
1112
        &nbsp;&nbsp;
1113
        <a href="#" onclick="return showListRevisionsDialog('LeftColumn','<mtw:out value="leftColumn.language.locale" />','<mtw:out value="leftColumn.language" />', false);">Revisions</a>
1114
        </div>
1115
        </mtw:if>
1116
 
1117
 
1118
    </mtw:hasAuthorization>
1119
</mtw:isLogged>
1120
<div id="navcolumn">
1121
    <div>
1122
    <k:kcode name="leftColumn" />
1123
    </div>
1124
<br />
1125
</div>
63 soliveira 1126
 
124 soliveira 1127
</div>
1128
 
1129
<div id="bodyColumn">
1130
    <mtw:hasAuthorization groups="admin, editor">
1131
 
1132
    <mtw:if test="bodyColumn.preview" value="true">
1133
 
1134
    	<mtw:if test="bodyColumn.new" value="true">
1135
			<div style="text-align: left; padding-left: 4px;">
1136
			<b>This is a Preview</b>
1137
			&nbsp;-&nbsp;
1138
            <a href="<mtw:contextPath/>/Page.savePreview.mtw?name=<mtw:out value="bodyColumn.name" />&lang=<mtw:out value="bodyColumn.language.locale" />">Save</a>&nbsp;&nbsp;
1139
            <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;
1140
			<a href="<mtw:contextPath/>/Page.discardPreview.mtw?name=<mtw:out value="bodyColumn.name" />&lang=<mtw:out value="bodyColumn.language.locale" />">Discard</a>
1141
			</div>
1142
    	</mtw:if>
1143
    	<mtw:if test="bodyColumn.new" value="false">
1144
            <div style="text-align: left; padding-left: 4px;">
1145
            <b>This is a Preview</b>
1146
            &nbsp;-&nbsp;
1147
            <a href="<mtw:contextPath/>/Page.savePreview.mtw?name=<mtw:out value="bodyColumn.name" />&lang=<mtw:out value="bodyColumn.language.locale" />">Save</a>&nbsp;&nbsp;
1148
            <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;
1149
            <a href="<mtw:contextPath/>/Page.discardPreview.mtw?name=<mtw:out value="bodyColumn.name" />&lang=<mtw:out value="bodyColumn.language.locale" />">Discard</a>
1150
			</div>
1151
    	</mtw:if>
1152
 
1153
    </mtw:if>
1154
 
1155
    <mtw:if test="bodyColumn.preview" value="false">
1156
        <mtw:if test="bodyColumn.revision" value="true">
1157
            <div style="text-align: left; padding-left: 4px;"><span title="<k:editTooltip name="bodyColumn" />"><b>Revision #<mtw:out value="bodyColumn.revisionNumber" /></b></span></div>
1158
        </mtw:if>
1159
 
1160
        <mtw:if test="bodyColumn.revision" value="false">
1161
            <div style="text-align: right; padding-right: 14px;">
1162
            <a href="#" onclick="return showEditPageDialog('<mtw:out value="bodyColumn.name" />', '<mtw:out value="bodyColumn.language.locale" />');" title="<k:editTooltip name="bodyColumn" />">Edit</a>
1163
            &nbsp;&nbsp;
1164
            <a href="#" onclick="return showListRevisionsDialog('<mtw:out value="bodyColumn.name" />','<mtw:out value="bodyColumn.language.locale" />','<mtw:out value="bodyColumn.language" />', false);">Revisions</a>
1165
            </div>
1166
        </mtw:if>
1167
    </mtw:if>
1168
 
1169
    </mtw:hasAuthorization>
1170
    <k:kcode name="bodyColumn" />
1171
</div>
1172
 
1173
<div class="clear">
1174
<hr />
1175
</div>
1176
 
1177
<div id="footer">
130 soliveira 1178
<div><center>Copyright (c) 2011 - Powered by <a href="http://kawai.mentaframework.org" target="_blank"><b>Kawai</b></a></center></div>
124 soliveira 1179
<div class="clear">
1180
<hr />
1181
</div>
1182
</div>
1183
 
1184
</body>
1185
</html>