Kawai Wiki

Rev

Rev 130 | Rev 135 | 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,
134 soliveira 253
                title: 'Latest revisions in ' + language,
124 soliveira 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
 
134 soliveira 548
        function showListLastRevisionsDialog(lang, language, isLogged) {
124 soliveira 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>';
134 soliveira 560
 
561
                if (isLogged) {
562
                    tableData += '<th>&nbsp;</th>';
563
                }
564
 
124 soliveira 565
                tableData += '</tr>';
566
 
567
                $.each(data.revisions, function(i,revision) {
568
 
569
                    tableData += '<tr>';
570
 
571
                    pageName = revision.name;
572
 
573
                    if (revision.frontPage) {
574
                    	pageName = '[' + pageName + ']';
575
                    } else if (revision.systemPage) {
576
                    	pageName = '*' + pageName;
577
                    }
578
 
579
                    tableData += '<td align="center">' + pageName + '</td>';
580
                    tableData += '<td align="center">' + revision.revision + '</td>';
581
                    tableData += '<td align="center">' + revision.user.username + '</td>';
582
                    tableData += '<td align="center">' + revision.formattedCreatedOn + '</td>';
583
                    tableData += '<td align="left">' + revision.comment + '</td>';
584
 
585
					if (!revision.systemPage) {
586
                    	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>';
587
                    } else {
588
                    	tableData += '<td>&nbsp;</td>';
589
                    }
134 soliveira 590
 
591
                    if (isLogged) {
592
                        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>';
593
                    }
124 soliveira 594
 
595
                    tableData += '</tr>';
596
                });
597
 
598
                $('#listLastRevisionsTable').html(tableData);
599
                myDialog = $('#listLastRevisionsDialog');
600
                myDialog = prepareListLastRevisionsDialog(myDialog, language);
601
                myDialog.dialog('open');
602
                $('.ui-dialog :button').blur();
603
             });
604
 
605
            return false;
606
        }
607
 
608
 
609
       	function showCreateNewPageDialog() {
610
 
611
            $('#createNewPageFormName').val('<mtw:out value="bodyColumn.name" />');
612
            $('#createNewPageFormLang').val('<mtw:out value="bodyColumn.lang" />');
613
            $('#createPageLanguageCell').show();
614
 
615
            myDialog = $('#createNewPageDialog');
616
            myDialog = prepareCreateNewPageDialog(myDialog);
617
            myDialog.dialog('open');
618
 
619
            return false;
620
        }
621
 
622
        function prepareCreateNewPageDialog(myDialog) {
623
 
624
            options = {
625
            	close: function() { clearCreateNewPageForm(); },
626
                autoOpen: false,
627
                width: 800,
628
                modal: true,
629
                title: "Create New Page:",
630
                buttons: [
631
                          {
632
                                text: "Create",
633
                                click: function() { $('#createNewPageForm').submit(); }
634
                          },
635
                          {
636
                              text: "Preview",
637
                              click: function() { $('#createNewPageFormPreview').val('true'); $('#createNewPageForm').submit(); }
638
                          },
639
                          {
640
                                text: "Cancel",
641
                                click: function() {  $(this).dialog("close"); }
642
                          }
643
                      ]
644
           };
645
 
646
          myDialog.dialog(options);
647
 
648
          return myDialog;
649
        }
650
 
651
        function showFileUploadDialog() {
652
 
653
  			$('#uploadResults').html('');
654
 
655
        	myDialog = $('#fileUploadDialog');
656
        	myDialog = prepareFileUploadDialog(myDialog);
657
        	myDialog.dialog('open');
658
        }
659
 
660
 
661
        function showLoginDialog() {
662
 
663
            $('#loginFormName').val('<mtw:out value="bodyColumn.name" />');
664
            $('#loginFormLang').val('<mtw:out value="bodyColumn.lang" />');
665
 
666
            myDialog = $('#loginDialog');
667
            myDialog = prepareLoginDialog(myDialog);
668
            myDialog.dialog('open');
669
 
670
            return false;
671
        }
672
 
673
        function clearLoginForm() {
674
        	$('#loginUsername').val('');
675
        	$('#loginPassword').val('');
676
        	$('#loginUsernameError').text('');
677
        	$('#loginPasswordError').text('');
678
        }
679
 
680
        function clearCreateNewPageForm() {
681
        	$('#createNewPageName').val('');
682
        	$('#createNewPageTitle').val('');
683
        	$('#createNewPageLanguage').val('');
684
        	$('#createNewPageTextArea').val('');
685
        	$('#createNewPageNameError').text('');
686
        	$('#createNewPageTitleError').text('');
687
        	$('#createNewPageLanguageError').text('');
688
        	$('#createNewPageBodyError').text('');
689
        }
690
 
691
      	function prepareLoginDialog(myDialog) {
692
 
693
            options = {
694
            	close: function() { clearLoginForm(); },
695
                autoOpen: false,
696
                width: 290,
697
                modal: true,
698
                title: "Login:",
699
                buttons: [
700
                          {
701
                                text: "Login",
702
                                click: function() { $('#loginForm').submit(); }
703
                          },
704
                          {
705
                                text: "Cancel",
706
                                click: function() {  $(this).dialog("close"); }
707
                          }
708
                      ]
709
           };
710
 
711
          myDialog.dialog(options);
712
 
713
          return myDialog;
714
        }
715
 
716
      	function prepareConfirmDialog(myDialog) {
717
 
718
            options = {
719
                autoOpen: false,
720
                width: 300,
721
                modal: true,
722
                title: "Confirmation:",
723
                buttons: [
724
                          {
725
                                text: "Yes",
726
                                click: function() { $(this).dialog("close"); }
727
                          },
728
                          {
729
                                text: "No",
730
                                click: function() {  $(this).dialog("close"); }
731
                          }
732
                      ]
733
           };
734
 
735
          myDialog.dialog(options);
736
 
737
          return myDialog;
738
        }
739
 
740
         function showConfirmDialog() {
741
 
742
            myDialog = $('#confirmDialog');
743
            myDialog = prepareConfirmDialog(myDialog);
744
            myDialog.dialog('open');
745
 
746
            return false;
747
        }
748
 
749
    </script>
750
 
751
</head>
752
 
12 soliveira 753
<body class="composite">
754
 
755
<!-- For Testing -->
756
<div id="dialog" title="Dialog Title" style="display: none;">I'm in a dialog</div>
757
 
37 soliveira 758
<!-- Close Confirm -->
759
<div id="confirmDialog" style="display: none;">
760
	<span id="confirmMessage">The confirmation message goes here.</span>
761
</div>
762
 
124 soliveira 763
<!-- For file upload -->
764
<div id="fileUploadDialog" style="display: none;">
765
<br/>
766
<input id="file_upload" name="file_upload" type="file" />
767
<table cellspacing="2" cellpadding="5" id="uploadResults" style="margin-top: 10px;">
768
</table>
769
</div>
102 soliveira 770
 
124 soliveira 771
<!-- For files listing -->
772
<div id="fileListDialog" style="display: none;">
773
<table cellspacing="2" cellpadding="5" id="fileListTable" style="margin-top: 10px;">
774
</table>
775
</div>
103 soliveira 776
 
33 soliveira 777
<!-- For Editing Pages -->
124 soliveira 778
<div id="editPageDialog" style="display: none;">
779
<form id="editPageForm" action="<mtw:contextPath />/Page.edit.mtw" method="post">
780
<input type="hidden" name="name" id ="editPageName" value="" />
781
<input type="hidden" name="lang" id="editPageLang" value="" />
782
<input type="hidden" name="isPreview" id="editPagePreview" value="false" />
783
<table border="0">
784
    <tr>
785
        <td>&nbsp;</td>
786
    </tr>
787
                <tr class="editPageTitleCell">
788
                    <td>
789
                        Title:&nbsp;&nbsp;&nbsp;&nbsp;
790
                        <mtw:input id="editPageTitle" name="title" size="40" maxlength="60" />
791
                        <span id="editPageTitleError">
792
                        <mtw:outError field="title">
793
                            <font color="red">
794
                                <b><mtw:out /></b>
795
                            </font>
796
                        </mtw:outError>
797
                        </span>
798
                    </td>
799
                </tr>
800
                <tr class="editPageTitleCell"><td colspan="2">&nbsp;</td></tr>
801
    <tr>
802
        <td><mtw:textarea id="editPageTextArea" name="body" style="width: 100%; height: 465px;" />
803
        <span id="editPageTextAreaError">
804
                        <mtw:outError field="body">
805
                            <font color="red">
806
                                <b><mtw:out /></b>
807
                            </font>
808
                        </mtw:outError>
809
                        </span>
810
 
811
        </td>
812
    </tr>
813
 
814
    <tr id="editPageCommentCell">
815
                    <td width="20%">
816
                        Edit comment: (<i>optional</i>) &nbsp;&nbsp;&nbsp;&nbsp;
817
                        <mtw:input id="editPageComment" name="comment" size="40" maxlength="60" />
818
                        <span id="editPageCommentError">
819
                        <mtw:outError field="comment">
820
                            <font color="red">
821
                                <b><mtw:out /></b>
822
                            </font>
823
                        </mtw:outError>
824
                        </span>
825
                    </td>
826
                </tr>
827
 
828
</table>
829
</form>
830
</div>
12 soliveira 831
 
124 soliveira 832
<!-- For Showing Page Html -->
833
<div id="showPageDialog" style="display: none;">
834
<form id="showPageForm">
835
<table>
836
    <tr>
837
        <td>&nbsp;</td>
838
    </tr>
839
                <tr class="showPageTitleCell">
840
                    <td>
841
                        Title:
842
                    </td>
843
                    <td>
844
                        <mtw:input id="showPageTitle" name="title" size="40" maxlength="60" extra="readonly=readonly" />
845
                    </td>
846
                </tr>
847
                <tr class="showPageTitleCell"><td>&nbsp;</td></tr>
848
    <tr>
849
        <td colspan="2">
850
        <mtw:textarea id="showPageTextArea" name="body" style="width: 100%; height: 465px;" extra="readonly=readonly" />
851
        </td>
852
    </tr>
853
</table>
854
</form>
855
</div>
84 soliveira 856
 
857
 
124 soliveira 858
<!-- For Login -->
859
<div id="loginDialog" style="display: none;">
860
		<form action="<mtw:contextPath />/Login.mtw" method="post" id="loginForm">
861
            <input type="hidden" name="name" value="" id="loginFormName" />
862
            <input type="hidden" name="lang" value="" id="loginFormLang" />
863
			<table>
864
				<tr>
865
					<td>
866
						Username:
867
					</td>
868
					<td>
869
						<mtw:input id="loginUsername" name="username" size="20" maxlength="20" />
870
						<span id="loginUsernameError">
871
						<mtw:outError field="username">
872
							<font color="red">
873
								<b><mtw:out /></b>
874
							</font>
875
						</mtw:outError>
876
						</span>
877
					</td>
878
				</tr>
879
				<tr>
880
					<td>
881
						Password:
882
					</td>
883
					<td>
884
						<mtw:input id="loginPassword" name="password" type="password" size="20" maxlength="20" />
885
						<span id="loginPasswordError">
886
						<mtw:outError field="password">
887
							<font color="red">
888
								<b><mtw:out /></b>
889
							</font>
890
						</mtw:outError>
891
						</span>
892
					</td>
893
				</tr>
894
			</table>
895
		</form>
896
</div>
33 soliveira 897
 
124 soliveira 898
<!-- For displaying all pages -->
899
<div id="listAllPagesDialog" style="display: none;">
900
    <form action="#" method="post" id="listAllPagesForm">
901
    <table id="listAllPagesTable">
902
    </table>
903
    </form>
904
</div>
49 soliveira 905
 
81 soliveira 906
 
124 soliveira 907
<!-- For displaying revisions -->
908
<div id="listRevisionsDialog" style="display: none;">
909
    <table class="revisionsTable" id="listRevisionsTable">
910
    </table>
911
</div>
33 soliveira 912
 
124 soliveira 913
<!-- For displaying last revisions -->
914
<div id="listLastRevisionsDialog" style="display: none;">
915
    <table class="revisionsTable" id="listLastRevisionsTable">
916
    </table>
917
</div>
36 soliveira 918
 
124 soliveira 919
 
920
<!-- Create New Page -->
921
<div id="createNewPageDialog" style="display: none;">
922
		<form action="<mtw:contextPath />/Page.add.mtw" method="post" id="createNewPageForm">
923
            <input type="hidden" name="name" value="" id="createNewPageFormName" />
924
            <input type="hidden" name="lang" value="" id="createNewPageFormLang" />
925
            <input type="hidden" name="isPreview" value="false" id="createNewPageFormPreview" />
926
			<table>
927
				<tr>
928
					<td>
929
						Name:
930
					</td>
931
					<td>
932
						<mtw:input id="createNewPageName" name="newPage.name" size="40" maxlength="30" />
933
						<span id="createNewPageNameError">
934
						<mtw:outError field="newPage.name">
935
							<font color="red">
936
								<b><mtw:out /></b>
937
							</font>
938
						</mtw:outError>
939
						</span>
940
					</td>
941
				</tr>
942
				<tr>
943
					<td>
944
						Title:
945
					</td>
946
					<td>
947
						<mtw:input id="createNewPageTitle" name="newPage.title" size="40" maxlength="60" />
948
						<span id="createNewPageTitleError">
949
						<mtw:outError field="newPage.title">
950
							<font color="red">
951
								<b><mtw:out /></b>
952
							</font>
953
						</mtw:outError>
954
						</span>
955
					</td>
956
				</tr>
957
				<tr id="createPageLanguageCell">
958
					<td>
959
						Language:
960
					</td>
961
					<td>
962
						<mtw:select name="newPage.languageId" list="languages" id="createNewPageLanguage" emptyField="true" />
963
						<span id="createNewPageLanguageError">
964
						<mtw:outError field="newPage.languageId">
965
							<font color="red">
966
								<b><mtw:out /></b>
967
							</font>
968
						</mtw:outError>
969
						</span>
970
					</td>
971
				</tr>
972
				<tr>
973
        			<td colspan="2">
974
        				<mtw:textarea id="createNewPageTextArea" name="newPage.body" style="width: 100%; height: 465px;" />
975
        				<span id="createNewPageBodyError">
976
						<mtw:outError field="newPage.body">
977
							<font color="red">
978
								<b><mtw:out /></b>
979
							</font>
980
						</mtw:outError>
981
						</span>
982
        			</td>
983
    			</tr>
984
			</table>
985
		</form>
986
</div>
987
 
988
 
989
<div>
990
<table border="0">
991
    <tr>
992
        <td>
993
 
994
        <k:kcode name="logo" />
995
        <mtw:hasAuthorization groups="admin">
996
 
997
        <mtw:if test="logo.preview" value="false">
998
        <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>
999
        </mtw:if>
1000
 
1001
        <mtw:if test="logo.preview" value="true">
1002
        <br/>&nbsp;&nbsp;&nbsp;&nbsp;
1003
        <span style="font-size: 10px; font-weight: bold;">Preview</span><span style="font-size: 8px;">&nbsp;&nbsp;-&nbsp;</span>
1004
        <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;
1005
        <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;
1006
        <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>
1007
        </mtw:if>
1008
 
1009
        </mtw:hasAuthorization>
1010
 
1011
        </td>
1012
        <td align="right" valign="bottom">
1013
            <mtw:isLogged negate="true">
134 soliveira 1014
                <a href="#" onclick="return showListLastRevisionsDialog('<mtw:out value="bodyColumn.language.locale" />', '<mtw:out value="bodyColumn.language" />', false);">Last Updates</a> |
124 soliveira 1015
                <a href="#" onclick="return showLoginDialog();">Login</a>
1016
            </mtw:isLogged>
1017
            <mtw:isLogged>
1018
                <a href="#" onclick="return showCreateNewPageDialog();">Create New Page</a> |
1019
                <a href="#" onclick="return showListAllPagesDialog();">List Pages</a> |
1020
 
1021
                <mtw:hasAuthorization groups="admin">
1022
 
1023
                <mtw:if test="css.preview" value="true">
1024
                <b>CSS</b> -
1025
                <a href="<mtw:contextPath/>/Page.savePreview.mtw?name=<mtw:out value="css.name" />&lang=<mtw:out value="css.language.locale" />">Save</a>&nbsp;
1026
                <a href="#" onclick="return showEditPreviewDialog('<mtw:out value="css.name" />', '<mtw:out value="css.language.locale" />');" title="<k:editTooltip name="css" />">Edit</a>&nbsp;
1027
                <a href="<mtw:contextPath/>/Page.discardPreview.mtw?name=<mtw:out value="css.name" />&lang=<mtw:out value="css.language.locale" />">Discard</a> |
1028
                </mtw:if>
1029
 
1030
                <mtw:if test="css.preview" value="false">
1031
                <a href="#" onclick="return showEditPageDialog('CSS', 'en');" title="<k:editTooltip name="css" />">Edit CSS</a> |
1032
                </mtw:if>
1033
 
1034
                </mtw:hasAuthorization>
1035
 
1036
                <mtw:hasAuthorization groups="admin">
1037
 
1038
                <mtw:if test="js.preview" value="true">
1039
                <b>JavaScript</b> -
1040
                <a href="<mtw:contextPath/>/Page.savePreview.mtw?name=<mtw:out value="js.name" />&lang=<mtw:out value="js.language.locale" />">Save</a>&nbsp;
1041
                <a href="#" onclick="return showEditPreviewDialog('<mtw:out value="js.name" />', '<mtw:out value="js.language.locale" />');" title="<k:editTooltip name="js" />">Edit</a>&nbsp;
1042
                <a href="<mtw:contextPath/>/Page.discardPreview.mtw?name=<mtw:out value="js.name" />&lang=<mtw:out value="js.language.locale" />">Discard</a> |
1043
                </mtw:if>
1044
 
1045
                <mtw:if test="js.preview" value="false">
1046
                <a href="#" onclick="return showEditPageDialog('JavaScript', 'en');" title="<k:editTooltip name="js" />">Edit JavaScript</a> |
1047
                </mtw:if>
1048
 
1049
                </mtw:hasAuthorization>
1050
 
1051
                <mtw:hasAuthorization groups="admin, editor">
1052
 
1053
                <a href="#" onclick="return showFileUploadDialog();">Upload Files</a> |
1054
                <a href="#" onclick="return showFileListDialog();">List Files</a> |
134 soliveira 1055
                <a href="#" onclick="return showListLastRevisionsDialog('<mtw:out value="bodyColumn.language.locale" />', '<mtw:out value="bodyColumn.language" />', true);">Last Updates</a> |
124 soliveira 1056
 
1057
                </mtw:hasAuthorization>
1058
 
1059
 
1060
                <a href="<mtw:contextPath/>/Logout.mtw">Logout</a> (<mtw:out value="sessionUser.username" />)
1061
            </mtw:isLogged>
1062
            &nbsp;
1063
            <mtw:isLocale value="pt">
1064
	            <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>
1065
    	        <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>
1066
            </mtw:isLocale>
1067
            <mtw:isLocale value="en">
1068
            	<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>
1069
            	<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>
1070
            </mtw:isLocale>
1071
            &nbsp;&nbsp;&nbsp;
1072
        </td>
1073
    </tr>
1074
</table>
1075
</div>
1076
 
1077
<hr />
1078
 
1079
<div id="leftColumn"><mtw:isLogged>
1080
    <mtw:hasAuthorization groups="admin">
1081
 
1082
        <mtw:if test="leftColumn.preview" value="true">
1083
        <div style="text-align: left; padding-left: 8px; padding-top: 6px;">
1084
            <b>Preview</b>
1085
            &nbsp;-&nbsp;
1086
            <a href="<mtw:contextPath/>/Page.savePreview.mtw?name=<mtw:out value="leftColumn.name" />&lang=<mtw:out value="leftColumn.language.locale" />">Save</a>&nbsp;&nbsp;
1087
            <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;
1088
            <a href="<mtw:contextPath/>/Page.discardPreview.mtw?name=<mtw:out value="leftColumn.name" />&lang=<mtw:out value="leftColumn.language.locale" />">Discard</a>
1089
        </div>
1090
        </mtw:if>
73 soliveira 1091
 
124 soliveira 1092
        <mtw:if test="leftColumn.preview" value="false">
1093
        <div style="text-align: right; padding-right: 14px; padding-top: 6px;">
1094
        <a href="#" onclick="return showEditPageDialog('LeftColumn', '<mtw:out value="leftColumn.language.locale" />');" title="<k:editTooltip name="leftColumn" />">Edit</a>
1095
        &nbsp;&nbsp;
1096
        <a href="#" onclick="return showListRevisionsDialog('LeftColumn','<mtw:out value="leftColumn.language.locale" />','<mtw:out value="leftColumn.language" />', false);">Revisions</a>
1097
        </div>
1098
        </mtw:if>
1099
 
1100
 
1101
    </mtw:hasAuthorization>
1102
</mtw:isLogged>
1103
<div id="navcolumn">
1104
    <div>
1105
    <k:kcode name="leftColumn" />
1106
    </div>
1107
<br />
1108
</div>
63 soliveira 1109
 
124 soliveira 1110
</div>
1111
 
1112
<div id="bodyColumn">
1113
    <mtw:hasAuthorization groups="admin, editor">
1114
 
1115
    <mtw:if test="bodyColumn.preview" value="true">
1116
 
1117
    	<mtw:if test="bodyColumn.new" value="true">
1118
			<div style="text-align: left; padding-left: 4px;">
1119
			<b>This is a Preview</b>
1120
			&nbsp;-&nbsp;
1121
            <a href="<mtw:contextPath/>/Page.savePreview.mtw?name=<mtw:out value="bodyColumn.name" />&lang=<mtw:out value="bodyColumn.language.locale" />">Save</a>&nbsp;&nbsp;
1122
            <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;
1123
			<a href="<mtw:contextPath/>/Page.discardPreview.mtw?name=<mtw:out value="bodyColumn.name" />&lang=<mtw:out value="bodyColumn.language.locale" />">Discard</a>
1124
			</div>
1125
    	</mtw:if>
1126
    	<mtw:if test="bodyColumn.new" value="false">
1127
            <div style="text-align: left; padding-left: 4px;">
1128
            <b>This is a Preview</b>
1129
            &nbsp;-&nbsp;
1130
            <a href="<mtw:contextPath/>/Page.savePreview.mtw?name=<mtw:out value="bodyColumn.name" />&lang=<mtw:out value="bodyColumn.language.locale" />">Save</a>&nbsp;&nbsp;
1131
            <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;
1132
            <a href="<mtw:contextPath/>/Page.discardPreview.mtw?name=<mtw:out value="bodyColumn.name" />&lang=<mtw:out value="bodyColumn.language.locale" />">Discard</a>
1133
			</div>
1134
    	</mtw:if>
1135
 
1136
    </mtw:if>
1137
 
1138
    <mtw:if test="bodyColumn.preview" value="false">
1139
        <mtw:if test="bodyColumn.revision" value="true">
1140
            <div style="text-align: left; padding-left: 4px;"><span title="<k:editTooltip name="bodyColumn" />"><b>Revision #<mtw:out value="bodyColumn.revisionNumber" /></b></span></div>
1141
        </mtw:if>
1142
 
1143
        <mtw:if test="bodyColumn.revision" value="false">
1144
            <div style="text-align: right; padding-right: 14px;">
1145
            <a href="#" onclick="return showEditPageDialog('<mtw:out value="bodyColumn.name" />', '<mtw:out value="bodyColumn.language.locale" />');" title="<k:editTooltip name="bodyColumn" />">Edit</a>
1146
            &nbsp;&nbsp;
1147
            <a href="#" onclick="return showListRevisionsDialog('<mtw:out value="bodyColumn.name" />','<mtw:out value="bodyColumn.language.locale" />','<mtw:out value="bodyColumn.language" />', false);">Revisions</a>
1148
            </div>
1149
        </mtw:if>
1150
    </mtw:if>
1151
 
1152
    </mtw:hasAuthorization>
1153
    <k:kcode name="bodyColumn" />
1154
</div>
1155
 
1156
<div class="clear">
1157
<hr />
1158
</div>
1159
 
1160
<div id="footer">
130 soliveira 1161
<div><center>Copyright (c) 2011 - Powered by <a href="http://kawai.mentaframework.org" target="_blank"><b>Kawai</b></a></center></div>
124 soliveira 1162
<div class="clear">
1163
<hr />
1164
</div>
1165
</div>
1166
 
1167
</body>
1168
</html>