1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
|
<!DOCTYPE html>
<html>
<head>
<title>Siyavula Content Editor</title>
<link rel="stylesheet" href="css/screen.css" type="text/css" />
<link rel="stylesheet" href="content/css/global.css" type="text/css"/>
<script type="text/javascript" src="js/jquery-latest.js"></script>
<script type="text/javascript" src="js/jquery.ui.all.js"</script>
<script type="text/javascript" src="content/js/global.js"</script>
<script type="text/javascript" src="content/js/navigation.js"</script>
<script type="text/javascript" src="tinymce/tiny_mce.js"></script>
<script type="text/javascript">
function editreturn(url) {
alert('return '+url);
window.location = url;
};
tinyMCE.init({
mode : "textareas",
theme : "advanced",
theme_advanced_toolbar_location : 'top',
theme_advanced_toolbar_align : 'left',
theme_advanced_resizing : 'true',
editor_selector:"mceAdvanced",
relative_urls : true,
document_base_url : 'http://localhost:8008/imgs',
content_css: "http://localhost:8008/content/css/global.css",
width: "1200",
height: "1200"
});
$(document).ready(function(){
var ed = tinyMCE.get('cntnt');
url = window.location+"";
parts = url.split('?');
parts.shift()
openfile = parts[0];
$('#editreturn')
.click(editreturn(parts.join('?')+'X'))
items = openfile.split('/');
items.pop();
openfile = items.join('/') + '/source.txt';
$('#cntnt').load('http://localhost:8008/cgi-bin/fetchFile.py',
{'openfile':openfile},
function(responseText, status, xhr)
{
ed.setContent(responseText);
});
});
function ajaxSave() {
var ed = tinyMCE.get('cntnt');
ed.setProgressState(1); // Show progress
$('#cntnt').load('http://localhost:8008/cgi-bin/saveFile.py',
{'openfile':openfile, 'content':ed.getContent()},
function(responseText, status, xhr){
ed.setProgressState(0);
});
};
function toggleEditor(id) {
if (!tinyMCE.get(id))
tinyMCE.execCommand('mceAddControl', false, id);
else
tinyMCE.execCommand('mceRemoveControl', false, id);
}
</script>
</head>
<body>
<div id="header">
<div id="topbtn_left"><div title="linkBack" id="editReturn" class="linkBack" />
</div></div>
<div id="lesson_title">
<img src="../assets/image/title_block_lt.png" width="33" height="75" align = "absmiddle" />
Content Editor
<img src="../assets/image/title_block_rt.png" width="33" height="75" align="absmiddle" />
</div>
<span style="font-size:24px; font-weight:bold">
<fieldset>
<legend>Siyavula Content Editor</legend>
…
<a href="javascript:ajaxSave();">save</a>
<a href="javascript:toggleEditor('cntnt');">web/html</a>
</fieldset>
</span>
<div id="topbtn_right">
<div title="Quit" id="linkQuit" class="linkQuit"></div>
</div>
</div>
<div id="content">
<textarea id="cntnt"
name='cntnt'
class='mceAdvanced'
</textarea>
</div>
<div id='footer'/>
</body>
</html>
|