MARKDOWN: add epic editor
[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="epiceditor">
18
19
20 <textarea id="msgtext" cols="80" rows="15"></textarea>
21 </div>
22
23 </div>
24 </div>
25
26 <div style="display:none" id="submit-o-matic"><ul>
27 <li>
28         <a href="javascript:submit_post('post');">
29                 <img src="static/webcit_icons/essen/16x16/check.png" alt="">
30                 <span class="navbar_link">
31                 <?!("COND:BSTR", 1, "__RCPTREQUIRED")><?_("Send message")><?!("X", 1)>
32                 <??("COND:BSTR", 2, "__RCPTREQUIRED")><?_("Post message")><?!("X", 2)>
33                 </span>
34         </a>
35 </li>
36 <li>
37         <a href="javascript:submit_post('draft');">
38                 <img src="static/webcit_icons/essen/16x16/draft.png" alt="">
39                 <span class="navbar_link">
40                 <?_("Save to Drafts")>
41                 </span>
42         </a>
43 </li>
44 <li>
45         <a href="javascript:show_attachments_form();">
46                 <img src="static/webcit_icons/essen/16x16/attachement.png" alt="">
47                 <span class="navbar_link">
48                 <?_("Attachments:")>
49                 <span id="num_attachments"><?MSG:NATTACH></span>
50                 </span>
51         </a>
52 </li>
53 <li>
54         <a href="javascript:submit_post('cancel');">
55                 <img src="static/webcit_icons/essen/16x16/abort.png" alt="">
56                 <span class="navbar_link">
57                 <?_("Cancel")>
58                 </span>
59         </a>
60 </li>
61 <?!("COND:BSTR", 1, "__RCPTREQUIRED")><li>
62         <a href="javascript:PopOpenAddressBook('recp_id|<?_("To:")>|cc_id|<?_("CC:")>|bcc_id|<?_("BCC:")>');">
63                 <img src="static/webcit_icons/essen/16x16/contact.png" alt="">
64                 <span class="navbar_link">
65                 <?_("Contacts")>
66                 </span>
67         </a>
68 </li><?!("X", 1)>
69 </ul>
70 </div>
71
72 <script type="text/javascript"> 
73     console.log('blarg');
74         $("navbar").innerHTML = $("submit-o-matic").innerHTML;
75     console.log('blub');
76
77         function submit_post(which_action) {
78         var p = { "postseq":"<?DATE:NOW:NO>",
79                   "return_to":"<?BSTR("return_to")>",
80                   "nonce":"<?NONCE>",
81                   "force_room":"<?THISROOM:NAME("X")>",
82                   "references":"<?BSTR("references")>",
83                   "page":"<?BSTR("page")>",
84                   "submit_action":"",
85                   "markdown":"1",
86                   "msgtext" : editor.exportFile()
87         };
88
89         new Ajax.Request('post', {
90                 method: 'post',
91                 parameters: p,
92                 onComplete: function(transport) { ajax_important_message(transport.responseText.substr(4));}
93         });
94         }
95
96         function hide_attachments_form() {
97                 $('attachments_form').style.display = 'none';
98                 update_attachment_count();
99         }
100
101         function show_attachments_form() {
102                 $('attachments_form').style.display = 'block';
103
104                 p = 'template=edit_message_attachments_pane&r=' + CtdlRandomString();
105                 new Ajax.Updater(
106                         'attachments_form',
107                         'do_template',
108                         {
109                                 method: 'get',
110                                 parameters: p,
111                                 evalScripts: true
112                         }
113                 );
114         }
115
116         function update_attachment_count() {
117                 p = 'r=' + CtdlRandomString();
118                 new Ajax.Updater(
119                         'num_attachments',
120                         'show_num_attachments',
121                         {
122                                 method: 'get',
123                                 parameters: p
124                         }
125                 );
126         }
127
128         function remove_attachment(which_one) {
129                 p = 'which_attachment=' + which_one + '&r=' + CtdlRandomString();
130                 new Ajax.Updater(
131                         'gonna_upload_this',
132                         'remove_attachment',
133                         {
134                                 method: 'get',
135                                 parameters: p,
136                                 onComplete: function(){
137                                         show_attachments_form();
138                                         update_attachment_count();
139                                 }
140                         }
141                 );
142         }
143
144 </script>
145
146 <script type="text/javascript"> 
147 var editor = new EpicEditor().load();
148 </script>
149 <?=("addressbook_popup")>
150 <?=("trailing")>