Attachment 'pageeditor.patch'
Download 1 --- PageEditor-1.3.5.py 2005-07-28 00:51:40.000000000 +0900
2 +++ PageEditor.py 2005-11-03 10:09:45.780773100 +0900
3 @@ -275,6 +275,7 @@
4 page=self,
5 pagename=self.page_name, msg=status,
6 body_onload=self.lock.locktype and 'countdown()' or '', # broken / bug in Mozilla 1.5, when using #preview
7 + body_onbeforeunload = 'return confirmleaving();',
8 html_head=self.lock.locktype and (
9 _countdown_js % {
10 'lock_timeout': lock_timeout,
11 @@ -316,7 +332,7 @@
12 self.request.write('</p>')
13
14 # send form
15 - self.request.write('<form id="editor" method="post" action="%s/%s#preview">' % (
16 + self.request.write('<form id="editor" method="post" action="%s/%s#preview" onSubmit="flgChange = false;">' % (
17 self.request.getScriptname(),
18 wikiutil.quoteWikinameURL(self.page_name),
19 ))
20 @@ -352,9 +368,34 @@
21 # language into meta file.
22 lang = self.language or self.request.cfg.default_lang
23
24 + # XXXX Seungik Lee
25 + # to prevent moving out the page without saving it
26 +
27 + if preview:
28 + flgchange = 'true'
29 + else:
30 + flgchange = 'false'
31 +
32 +
33 + self.request.write(
34 + u'\r\n<script type="text/javascript">\r\n'
35 + u' var flgChange = %(ischanged)s;\r\n'
36 + u' function confirmleaving() { \r\n'
37 + u' if ( flgChange == true )\r\n'
38 + u' return "%(message)s";\r\n'
39 + u' \r\n'
40 + u' }\r\n'
41 + u'</script>\r\n' % {
42 + 'ischanged': flgchange,
43 + 'message': _('Your changes are not saved!'),
44 + }
45 + )
46 +
47 + # XXXX
48 +
49 self.request.write(
50 u'<textarea id="editor-textarea" name="savetext" lang="%(lang)s" dir="%(dir)s"'
51 - u' rows="%(rows)d">' % {
52 + u' rows="%(rows)d" onChange="flgChange = true;" onKeyPress="flgChange = true;">' % {
53 'lang': lang,
54 'dir': i18n.getDirection(lang),
55 'rows': text_rows,
56 @@ -366,7 +407,7 @@
57 self.request.write('</p>')
58
59 self.request.write("<p>", _("Optional comment about this change"),
60 - '<br><input id="editor-comment" type="text" name="comment" value="%s" maxlength="80"></p>' % (
61 + '<br><input id="editor-comment" type="text" name="comment" value="%s" maxlength="80" onChange="flgChange = true;" onKeyPress="flgChange = true;"></p>' % (
62 wikiutil.escape(kw.get('comment', ''), 1), ))
63
64 # Category selection
65 @@ -381,7 +422,7 @@
66
67 # button bar
68 button_spellcheck = (SpellCheck and
69 - '<input type="submit" name="button_spellcheck" value="%s">'
70 + '<input type="submit" name="button_spellcheck" value="%s" onClick="flgChange = false;">'
71 % _('Check Spelling')) or ''
72
73 save_button_text = _('Save Changes')
74 @@ -400,8 +441,8 @@
75
76 self.request.write('''
77 <p>
78 -<input type="submit" name="button_save" value="%s">
79 -<input type="submit" name="button_preview" value="%s"> %s
80 +<input type="submit" name="button_save" value="%s" onClick="flgChange = false;">
81 +<input type="submit" name="button_preview" value="%s" onClick="flgChange = false;"> %s
82 <input type="submit" name="button_cancel" value="%s">
83 </p>
84 <p>
Attached Files
To refer to attachments on a page, use attachment:filename, as shown below in the list of files. Do NOT use the URL of the [get] link, since this is subject to change and can break easily.You are not allowed to attach a file to this page.