Kawai Wiki

Rev

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