MarkdownWiki: put original text into edit-textarea, not the html'ified version.
[citadel.git] / webcit / static / t / edit / markdown_epic.html
1 <?=("head")>
2 <script type="text/javascript"> 
3     console.log('blarg');
4 </script>
5                 <script type="text/javascript" src="markdown/js/epiceditor.js"></script> 
6 <?%("COND:LOGGEDIN", 1, 1, 1, "", ="paging")>
7 <?ROOMBANNER>
8 <div id="content">
9
10 <div id="attachments_form">
11     <div id="loading">
12       <p><img src="static/webcit_icons/throbber.gif" alt=""></p>
13       <p><?_("Loading")></p>
14     </div>
15 </div>
16
17 <div id="Author">
18 <select name="display_name" size=1 id="from_id">
19 <?ITERATE("PREF:VALID:EMAIL:NAME", ="prefs_section_msg_handle_select")>
20 <?!("COND:THISROOM:FLAG:QR", 3, #"QR_ANONOPT")>
21 <option <?%("COND:BSTR", 1, "__ANONYMOUS__", "selected", "")> value="__ANONYMOUS__"><?_("Anonymous")></option>
22 <?!("X", 3)>
23 </select>
24 </div>
25 <div id="epiceditor">
26
27
28 <textarea id="msgtext" cols="80" rows="15"><?MAIL:EDITWIKI("edit", "X")></textarea>
29 </div>
30
31 </div>
32 </div>
33
34 <div style="display:none" id="submit-o-matic"><ul>
35 <li>
36         <a href="javascript:submit_post('post');">
37                 <img src="static/webcit_icons/essen/16x16/check.png" alt="">
38                 <span class="navbar_link">
39                 <?!("COND:BSTR", 1, "__RCPTREQUIRED")><?_("Send message")><?!("X", 1)>
40                 <??("COND:BSTR", 2, "__RCPTREQUIRED")><?_("Post message")><?!("X", 2)>
41                 </span>
42         </a>
43 </li>
44 <li>
45         <a href="javascript:submit_post('draft');">
46                 <img src="static/webcit_icons/essen/16x16/draft.png" alt="">
47                 <span class="navbar_link">
48                 <?_("Save to Drafts")>
49                 </span>
50         </a>
51 </li>
52 <li>
53         <a href="javascript:show_attachments_form();">
54                 <img src="static/webcit_icons/essen/16x16/attachement.png" alt="">
55                 <span class="navbar_link">
56                 <?_("Attachments:")>
57                 <span id="num_attachments"><?MSG:NATTACH></span>
58                 </span>
59         </a>
60 </li>
61 <li>
62         <a href="javascript:submit_post('cancel');">
63                 <img src="static/webcit_icons/essen/16x16/abort.png" alt="">
64                 <span class="navbar_link">
65                 <?_("Cancel")>
66                 </span>
67         </a>
68 </li>
69 <?!("COND:BSTR", 1, "__RCPTREQUIRED")><li>
70         <a href="javascript:PopOpenAddressBook('recp_id|<?_("To:")>|cc_id|<?_("CC:")>|bcc_id|<?_("BCC:")>');">
71                 <img src="static/webcit_icons/essen/16x16/contact.png" alt="">
72                 <span class="navbar_link">
73                 <?_("Contacts")>
74                 </span>
75         </a>
76 </li><?!("X", 1)>
77 </ul>
78 </div>
79
80 <script type="text/javascript"> 
81     console.log('blarg');
82         $("navbar").innerHTML = $("submit-o-matic").innerHTML;
83     console.log('blub');
84
85         function submit_post(which_action) {
86             
87         var p = { "postseq":"<?DATE:NOW:NO>",
88                   "return_to":"<?BSTR("return_to")>",
89                   "nonce":"<?NONCE>",
90                   "force_room":"<?THISROOM:NAME("X")>",
91                   "references":"<?BSTR("references")>",
92                   "page":"<?BSTR("page")>",
93                   "display_name":"willi",
94                   "submit_action":"",
95                   "markdown":"1",
96                   "msgtext" : editor.exportFile()
97         };
98
99         new Ajax.Request('post', {
100                 method: 'post',
101                 parameters: p,
102                 onComplete: function(transport) { ajax_important_message(transport.responseText.substr(4));}
103         });
104         }
105
106         function hide_attachments_form() {
107                 $('attachments_form').style.display = 'none';
108                 update_attachment_count();
109         }
110
111         function show_attachments_form() {
112                 $('attachments_form').style.display = 'block';
113
114                 p = 'template=edit_message_attachments_pane&r=' + CtdlRandomString();
115                 new Ajax.Updater(
116                         'attachments_form',
117                         'do_template',
118                         {
119                                 method: 'get',
120                                 parameters: p,
121                                 evalScripts: true
122                         }
123                 );
124         }
125
126         function update_attachment_count() {
127                 p = 'r=' + CtdlRandomString();
128                 new Ajax.Updater(
129                         'num_attachments',
130                         'show_num_attachments',
131                         {
132                                 method: 'get',
133                                 parameters: p
134                         }
135                 );
136         }
137
138         function remove_attachment(which_one) {
139                 p = 'which_attachment=' + which_one + '&r=' + CtdlRandomString();
140                 new Ajax.Updater(
141                         'gonna_upload_this',
142                         'remove_attachment',
143                         {
144                                 method: 'get',
145                                 parameters: p,
146                                 onComplete: function(){
147                                         show_attachments_form();
148                                         update_attachment_count();
149                                 }
150                         }
151                 );
152         }
153
154 </script>
155
156 <script type="text/javascript"> 
157 var editor = new EpicEditor().load();
158 </script>
159 <?=("addressbook_popup")>
160 <?=("trailing")>