Kawai Wiki

Rev

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