document-widgets-tabs.mak 22KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573
  1. <%inherit file="local:templates.master"/>
  2. <%namespace name="POD" file="pod.templates.pod"/>
  3. <%def name="HistoryTabContent(poNode)">
  4. <h4>${_('Revisions')}</h4>
  5. <ul>
  6. % for version in poNode.getHistory():
  7. <li><a href="${tg.url('/document/%i/%i#tab-history'%(version.node_id, version.version_id))}">${version.created_at.strftime("%a %x %X")}</a></li>
  8. % endfor
  9. </ul>
  10. </%def>
  11. <%def name="AccessManagementTab(poNode, user_rights, user)">
  12. ######
  13. ##
  14. ## THIS WIDGET IS INTENDED TO BE USED ONE TIME ONLY IN A PAGE
  15. ##
  16. <h4>${_('Share options')}</h4>
  17. <p>
  18. % if poNode.is_shared==False:
  19. <span class="pod-grey">${_('This document is not shared')}</span>
  20. % else:
  21. <span class="">${_('This document is shared.')}</span>
  22. % endif
  23. </p>
  24. <p>
  25. % if poNode.is_shared==True:
  26. <table class="table table-striped table-hover table-condensed">
  27. <thead>
  28. <tr>
  29. <th><i class="fa fa-group"></i> ${_('Groups')}</th>
  30. <th></th>
  31. </tr>
  32. </thead>
  33. % for loGroupRightsOnNode in real_group_rights:
  34. % if loGroupRightsOnNode.hasSomeAccess():
  35. <tr>
  36. <td>${loGroupRightsOnNode.display_name}</td>
  37. <td>
  38. % if loGroupRightsOnNode.hasReadAccess():
  39. <span class="label label-success">R</span>
  40. % endif
  41. % if loGroupRightsOnNode.hasWriteAccess():
  42. <span class="label label-warning">W</span>
  43. % endif
  44. </td>
  45. </tr>
  46. % endif
  47. % endfor
  48. <thead>
  49. <tr>
  50. <th><i class="fa fa-user"></i> ${_('Individual users')}</th>
  51. <th></th>
  52. </tr>
  53. </thead>
  54. % for loGroupRightsOnNode in user_specific_group_rights:
  55. % if loGroupRightsOnNode.hasSomeAccess():
  56. <tr>
  57. <td>${loGroupRightsOnNode.display_name}</td>
  58. <td>
  59. % if loGroupRightsOnNode.hasReadAccess():
  60. <span class="label label-success">R</span>
  61. % endif
  62. % if loGroupRightsOnNode.hasWriteAccess():
  63. <span class="label label-warning">W</span>
  64. % endif
  65. </td>
  66. </tr>
  67. % endif
  68. % endfor
  69. </table>
  70. % endif
  71. <p>
  72. ######
  73. ##
  74. ## 2014-05-06 - D.A. We do not share documents on internet yet.
  75. ##
  76. ## <p>
  77. ## % if poNode.is_public==False:
  78. ## ${_('This document is not shared on internet')|n}
  79. ## % else:
  80. ## ${_('This document is <span class="label label-warning"><i class="fa fa-globe"></i><span>shared</span></span> on internet')|n}.
  81. ## ${_('The associated url is:')} <a href="FIXME">${poNode.public_url_key}</a>
  82. ## % endif
  83. ## </p>
  84. <!-- Button to trigger modal -->
  85. % if user.user_id==poNode.owner_id or (user_rights and user_rights.hasWriteAccess()):
  86. <a href="#edit-document-share-properties" role="button" class="btn btn-success" data-toggle="modal">
  87. <i class="fa fa-edit"></i>
  88. ${_('Edit share options')}
  89. </a>
  90. % endif
  91. <!-- Modal -->
  92. <div
  93. id="edit-document-share-properties"
  94. class="modal hide"
  95. tabindex="-1"
  96. role="dialog"
  97. aria-labelledby="myModalLabel"
  98. aria-hidden="true">
  99. <div class="modal-header">
  100. <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
  101. <h3 id="myModalLabel">Document sharing options</h3>
  102. </div>
  103. <div class="modal-body">
  104. <form id='document-share-form' method="GET" action="${tg.url('/api/set_access_management')}">
  105. <input type="hidden" name="node_id" value="${poNode.node_id}" />
  106. <input type="hidden" name="read" value="0" />
  107. <input type="hidden" name="write" value="0" />
  108. <fieldset>
  109. <label class="checkbox">
  110. <input name="is_shared" type="checkbox" id="document-share-selector" ${('', 'checked')[poNode.is_shared]}/>
  111. ${_('Share document with collaborators.')}
  112. </label>
  113. <div id="document-share-people-selector">
  114. <p>${_('Select read and write access for each group or people...')}</p>
  115. <script>
  116. function updateRights(psUserId, piNewValue) {
  117. if (typeof piNewValue === 'undefined') { piNewValue = -1; }
  118. var ACCESS_UNDEFINED = -1;
  119. var ACCESS_NONE = 0;
  120. var ACCESS_READ = 1;
  121. var ACCESS_WRITE = 2;
  122. var nodeIdForSelectedUser = 'user-'+psUserId+'-value';
  123. var widgetRead = $('#'+nodeIdForSelectedUser+'-read');
  124. var widgetWrite = $('#'+nodeIdForSelectedUser+'-write');
  125. var oldReadValue = widgetRead.val()
  126. var oldWriteValue = widgetWrite.val();
  127. if(oldReadValue=='' && oldWriteValue=='' && piNewValue==ACCESS_UNDEFINED || piNewValue==ACCESS_READ) {
  128. ## SET READ ACCESS
  129. widgetRead.val(psUserId)
  130. widgetWrite.val('')
  131. newHtml = '<span class="label label-success" title="${'Allow to read the item'}">R</span>';
  132. } else if(oldReadValue==psUserId && oldWriteValue=='' && piNewValue==ACCESS_UNDEFINED || piNewValue==ACCESS_READ+ACCESS_WRITE) {
  133. ## SET READ + WRITE ACCESS
  134. widgetRead.val(psUserId)
  135. widgetWrite.val(psUserId)
  136. newHtml = '<span class="label label-success" title="${'Allow to read the item'}">R</span> <span class="label label-warning" title="${'Allow to modify the item'}">W</span>';
  137. } else if (oldReadValue==psUserId && oldWriteValue==psUserId && piNewValue==ACCESS_UNDEFINED || piNewValue==ACCESS_NONE) {
  138. ## SET NO ACCESS
  139. widgetRead.val('')
  140. widgetWrite.val('')
  141. newHtml = '';
  142. } else {
  143. ## SET READ ACCESS (default)
  144. widgetRead.val(psUserId)
  145. widgetWrite.val('')
  146. newHtml = '<span class="label label-success" title="${'Allow to read the item'}">R</span>';
  147. }
  148. visibleid = 'user-'+psUserId+'-rights';
  149. $("#"+visibleid).html(newHtml);
  150. }
  151. </script>
  152. <table class="table table-striped table-hover table-condensed">
  153. ######
  154. ##
  155. ## REAL GROUPS LISTING HERE
  156. ##
  157. <thead>
  158. <tr>
  159. <th><i class="fa fa-group"></i></th>
  160. <th>${_('Group')}</th>
  161. <th>${_('Access')}</th>
  162. </tr>
  163. </thead>
  164. % for loGroupRightsOnNode in real_group_rights:
  165. <tr id='user-${loGroupRightsOnNode.group_id}-rights-row'>
  166. <td>
  167. <a
  168. class="btn btn-mini"
  169. onclick="updateRights(${loGroupRightsOnNode.group_id})"
  170. >
  171. <i class="fa fa-key"></i>
  172. </a>
  173. </td>
  174. <td class='pod-highlightable-access-management-cell'>
  175. ${loGroupRightsOnNode.display_name}
  176. <input type="hidden" id="user-${loGroupRightsOnNode.group_id}-value-read" name="read" value="" />
  177. <input type="hidden" id="user-${loGroupRightsOnNode.group_id}-value-write" name="write" value="" />
  178. </td>
  179. <td id="user-${loGroupRightsOnNode.group_id}-rights" class="pod-right-cell"></td>
  180. </tr>
  181. % endfor
  182. ######
  183. ##
  184. ## INDIVIDUAL USERS LISTING HERE
  185. ##
  186. <thead>
  187. <tr>
  188. <th><i class="fa fa-user"></i></th>
  189. <th>${_('Individual Users')}</th>
  190. <th>${_('Access')}</th>
  191. </tr>
  192. </thead>
  193. % for loGroupRightsOnNode in user_specific_group_rights:
  194. <tr id='user-${loGroupRightsOnNode.group_id}-rights-row'>
  195. <td>
  196. <a
  197. class="btn btn-mini"
  198. onclick="updateRights(${loGroupRightsOnNode.group_id})"
  199. >
  200. <i class="fa fa-key"></i>
  201. </a>
  202. </td>
  203. <td class='pod-highlightable-access-management-cell'>
  204. ${loGroupRightsOnNode.display_name}
  205. <input type="hidden" id="user-${loGroupRightsOnNode.group_id}-value-read" name="read" value="" />
  206. <input type="hidden" id="user-${loGroupRightsOnNode.group_id}-value-write" name="write" value="" />
  207. </td>
  208. <td id="user-${loGroupRightsOnNode.group_id}-rights" class="pod-right-cell"></td>
  209. </tr>
  210. % endfor
  211. </table>
  212. </div>
  213. </fieldset>
  214. ######
  215. ##
  216. ## 2014-05-06 - D.A. The documents are not yet sharable through internet
  217. ##
  218. ## <fieldset>
  219. ## <label class="checkbox">
  220. ## <input name="is_public" type="checkbox" id="document-public-selector" ${('', 'checked')[poNode.is_public]}/>
  221. ## ${_('Internet shared document')}
  222. ## <i class="fa fa-globe"></i>
  223. ## </label>
  224. ## <label id="document-public-key-selector">
  225. ## ${_('Key')}
  226. ## <div class="input-append">
  227. ## <input name="url_public_key" id="document-public-key" type="text">
  228. ## <span id="document-public-key-refresh-button" class="add-on btn" title="${_('Regenerate key')}">
  229. ## <i class="fa fa-refresh"></i>
  230. ## </span>
  231. ## </div>
  232. ## <p><a id='document-public-key-url' href="">http://share.pod.com/document/azefnzeioguneriugnreiugnre</a></p>
  233. ## </label>
  234. </fieldset>
  235. ####
  236. ## Button replaced by modal dialog button
  237. ## <button type="submit" class="btn btn-success">
  238. ## <i class="fa fa-check"></i>
  239. ## ${_('Save')}
  240. ## </button>
  241. </form>
  242. </div>
  243. <div class="modal-footer">
  244. <button class="btn" data-dismiss="modal" aria-hidden="true">
  245. <i class="fa fa-ban"></i> ${_('Cancel')}
  246. </button>
  247. <button class="btn btn-success" id="document-share-form-submit-button">
  248. <i class="fa fa-check"></i> ${_('Save changes')}
  249. </button>
  250. </div>
  251. <script>
  252. ##
  253. ## 2014-05-06 - D.A. - Documents are not yet sharable through internet
  254. ##
  255. ## function refreshDocumentPublicKey(psNewPublicKey) {
  256. ## var lsNewUrl = 'http://share.pod.com/document/'+psNewPublicKey;
  257. ## $('#document-public-key').val(psNewPublicKey);
  258. ## $('#document-public-key-url').attr('href', lsNewUrl);
  259. ## $('#document-public-key-url').text(lsNewUrl);
  260. ## }
  261. function toggleDocumentSharePeopleSelector(pbShowIt) {
  262. if (pbShowIt) {
  263. $('#document-share-people-selector').show();
  264. // $('#document-share-people-selector input').removeAttr("disabled");
  265. } else {
  266. $('#document-share-people-selector').hide();
  267. // $('#document-share-people-selector input').prop('disabled', 'disabled');
  268. }
  269. }
  270. ##
  271. ## 2014-05-06 - D.A. - Documents are not yet sharable through internet
  272. ##
  273. ## function toggleDocumentPublicKeyGenerator(pbShowIt) {
  274. ## if (pbShowIt) {
  275. ## $('#document-public-key-selector input').removeAttr("disabled");
  276. ## $('#document-public-key-refresh-button').removeProp('disabled');
  277. ## $('#document-public-key-refresh-button').removeClass('btn-disabled');
  278. ## $('#document-public-key-selector a').show();
  279. ## $('#document-public-key-refresh-button').on("click").click(function () {
  280. ## refreshDocumentPublicKey(generateStringId()); // New random 32-char id
  281. ## });
  282. ## if($('#document-public-key-selector input').val()=='') {
  283. ## refreshDocumentPublicKey(generateStringId());
  284. ## }
  285. ## } else {
  286. ## $('#document-public-key-refresh-button').prop('disabled', true);
  287. ## $('#document-public-key-refresh-button').addClass('btn-disabled');
  288. ## $('#document-public-key-selector input').prop('disabled', 'disabled');
  289. ## $('#document-public-key-refresh-button').off("click");
  290. ## $('#document-public-key-selector a').hide();
  291. ## }
  292. ## }
  293. ##
  294. ##
  295. ##
  296. // Callbacks setup
  297. $('#document-share-selector').change(function () {
  298. var checkedValue = $('#document-share-selector').prop("checked");
  299. toggleDocumentSharePeopleSelector(checkedValue);
  300. });
  301. ## $('#document-public-selector').change(function () {
  302. ## var checkedValue = $('#document-public-selector').prop("checked");
  303. ## toggleDocumentPublicKeyGenerator(checkedValue);
  304. ## });
  305. // Submit access-management modal dialog form
  306. $('#document-share-form-submit-button').click(function(){
  307. $("input[name='read'][value='']").remove();
  308. $("input[name='write'][value='']").remove();
  309. $('#document-share-form')[0].submit();
  310. });
  311. // Initial setup
  312. // Activate or disactivate users selector according
  313. // to current state of the is_shared property
  314. //
  315. // FIXME - 2014-05-06 - This is not working (should be done at document.ready time)
  316. // note: putting this in a document.ready callback does not work.
  317. //
  318. ##
  319. ## The following code is something like dirty ;)
  320. ## the goal of this piece of code is to setup view
  321. ## according to hidden input values
  322. ## for read/write access management
  323. ##
  324. ## FIXME % for loGroupRightsOnNode in real_group_rights:
  325. ## % for loCurrentGroup in real_group_rights + user_specific_group_rights:
  326. % for loGroupRightsOnNode in real_group_rights + user_specific_group_rights:
  327. % if loGroupRightsOnNode.hasSomeAccess()==False:
  328. updateRights(${loGroupRightsOnNode.group_id}, 0);
  329. % else:
  330. ##
  331. ## The following line should build some javascript code similar to this:
  332. ## updateRights(-5, 3);
  333. updateRights(${loGroupRightsOnNode.group_id}, ${loGroupRightsOnNode.rights});
  334. % endif
  335. % endfor
  336. toggleDocumentSharePeopleSelector($('#document-share-selector').prop("checked"));
  337. ## toggleDocumentPublicKeyGenerator($('#document-public-selector').prop("checked"));
  338. ##
  339. ## refreshDocumentPublicKey($('#document-public-key').val()); // First init
  340. </script>
  341. </div>
  342. </%def>
  343. <%def name="FileTabContent(poNode)">
  344. <h4>${_('Attachments')}</h4>
  345. % if len(poNode.getFiles())<=0:
  346. <p class="pod-grey">${_("There is currently no attachment.")}<br/></p>
  347. <p>${POD.OpenModalButton(h.ID.AddFileModalForm(poNode), _(' Attach first file'))}</p>
  348. % else:
  349. <p>${POD.OpenModalButton(h.ID.AddFileModalForm(poNode), _(' Attach a file'))}</p>
  350. % endif
  351. <div>
  352. % if len(poNode.getFiles())>0:
  353. % for loFile in poNode.getFiles():
  354. <p style="list-style-type:none; margin-bottom: 0.5em;">
  355. <i class="fa fa-paperclip"></i>
  356. <a
  357. href="${tg.url('/api/get_file_content/%s'%(loFile.node_id))}"
  358. title="${_('Download the file')}"
  359. >
  360. ${loFile.getTruncatedLabel(50)}
  361. </a>
  362. ## FIXME SHOW IMAGE THUMBNAIL <img src="${tg.url('/api/get_file_content_thumbnail/%i'%loFile.node_id)}"/>
  363. <a
  364. class="pull-right"
  365. href="${tg.url('/document/%i'%loFile.node_id)}"
  366. title="${_('View the attachment')}: ${loFile.getTruncatedLabel(-1)}"
  367. >
  368. <i class="fa fa-edit"></i>
  369. </a>
  370. </p>
  371. % endfor
  372. % endif
  373. </div>
  374. </%def>
  375. <%def name="SubdocumentContent(poNode)">
  376. <h4>${_('Sub-documents')}</h4>
  377. % if len(poNode.getChildren())<=0:
  378. <p class="pod-grey">${_("There is currently no child documents.")}</p>
  379. % endif
  380. <p>${POD.OpenModalButton(h.ID.AddDocumentModalForm(poNode), _('Add a document'))}</p>
  381. % if len(poNode.getChildren())>0:
  382. <div>
  383. % for subnode in poNode.getChildren():
  384. <p style="list-style-type:none;">
  385. <i class="fa-fw ${subnode.getIconClass()}"></i>
  386. <a href="${tg.url('/document/%i'%subnode.node_id)}">
  387. ${subnode.data_label}
  388. <span class="label ${subnode.getStatus().css} pull-right" title="${subnode.getStatus().label}">
  389. <i class="${subnode.getStatus().icon}"></i>
  390. </a>
  391. </p>
  392. % endfor
  393. </div>
  394. % endif
  395. </%def>
  396. <%def name="EventTabContent(current_user, poNode)">
  397. <h4>${_('Calendar')}</h4>
  398. % if len(poNode.getEvents())<=0:
  399. <p class="pod-grey">${_("The calendar is empty.")}<br/></p>
  400. <p>${POD.OpenModalButton(h.ID.AddEventModalForm(poNode), _(' Add first event'))}</p>
  401. % else:
  402. <p>${POD.OpenModalButton(h.ID.AddEventModalForm(poNode), _(' Add an event'))}</p>
  403. % endif
  404. % if len(poNode.getEvents())>0:
  405. <table class="table table-striped table-hover table-condensed">
  406. <thead>
  407. <tr>
  408. <th>Date</th>
  409. <th>Time</th>
  410. <th>
  411. Event
  412. </th>
  413. <th>
  414. <a href="" title="Add an event"><i class="icon-g-plus"></i></a>
  415. </th>
  416. </tr>
  417. </thead>
  418. % for event in poNode.getEvents():
  419. % if event.is_shared or event.owner_id==current_user.user_id:
  420. ##
  421. ## TODO - D.A. - Sharing groups are not checked here : a shared event is share with everybody
  422. ##
  423. <tr class="item-with-data-popoverable" data-content="${event.data_content}" rel="popover" data-placement="left" data-trigger="hover">
  424. <td>${event.getFormattedDate(event.data_datetime)}</td>
  425. <td>${event.getFormattedTime(event.data_datetime)}</td>
  426. <td>${event.data_label}</td>
  427. </tr>
  428. % endif
  429. % endfor
  430. </table>
  431. % endif
  432. </%def>
  433. <%def name="ContactTabContent(poNode)">
  434. <h4>${_('Address book')}</h4>
  435. % if len(poNode.getContacts())<=0:
  436. <p class="pod-grey">${_("The address book is empty.")}<br/></p>
  437. <p>${POD.OpenModalButton(h.ID.AddContactModalForm(poNode), _('Add first contact'))}</p>
  438. % else:
  439. <p>${POD.OpenModalButton(h.ID.AddContactModalForm(poNode), _('Add a contact'))}</p>
  440. % endif
  441. <!-- LIST OF CONTACT NODES -->
  442. % for contact in poNode.getContacts():
  443. <div class="well">
  444. <legend class="text-info">
  445. ${contact.data_label}
  446. ## TODO - 2013-11-20 - Use the right form in order to update meta-data
  447. <a class="pull-right" href="${tg.url('/document/%i'%contact.node_id)}"><i class="fa fa-edit"></i></a>
  448. </legend>
  449. <div>
  450. ## FIXME - D.A. - 2013-11-15 - Implement localisation stuff <a style='float: right;' href="" title='${_('Search on google maps')}'><i class='icon-g-google-maps'></i></a>
  451. ${contact.data_content|n}
  452. </div>
  453. </div>
  454. % endfor
  455. </%def>
  456. <%def name="CommentTabContent(current_user, poNode)">
  457. <h4>${_('Comment thread')}</h4>
  458. % if len(poNode.getComments())<=0:
  459. <p class="pod-grey">${_("The comment thread is empty.")}<br/></p>
  460. % endif
  461. % if len(poNode.getComments())>0:
  462. % if len(poNode.getComments())>5:
  463. ##
  464. ## We show a "direct down" button in case the page is too long
  465. ##
  466. <p>${POD.OpenLinkButton(h.ID.AddCommentInlineForm(), _('Add a comment'))}</p>
  467. % endif
  468. <div>
  469. % for comment in poNode.getComments():
  470. % if comment.is_shared or comment.owner_id==current_user.user_id:
  471. ##
  472. ## FIXME - 2014-05-29
  473. ## We do not check specific rights on comment but on document instead
  474. ## In the future full-API architecture, it should be fixed
  475. ##
  476. <p style="margin-bottom: 1em;">
  477. <i class="fa fa-comments-o"></i>
  478. <strong class="pod-grey">${comment._oOwner.display_name}</strong>
  479. <i class="pull-right">
  480. <span class="pod-grey">${_('the')}</span>
  481. ${comment.getFormattedDate(comment.updated_at)}
  482. <span class="pod-grey">${_('at')}</span>
  483. ${comment.getFormattedTime(comment.updated_at)}
  484. </i>
  485. <br/>
  486. % if comment.owner_id==current_user.user_id:
  487. <a class="pull-right" href="${tg.url('/api/toggle_share_status', dict(node_id=comment.node_id))}">
  488. % if comment.is_shared:
  489. <span class="label label-warning" title="${_('Shared comment. Click to make private.')}">${h.ICON.Shared|n}</span>
  490. % else:
  491. <span class="label label-info" title="${_('Private comment. Click to share.')}">${h.ICON.Private|n}</span>
  492. % endif
  493. </a>
  494. % endif
  495. ${comment.data_content|n}
  496. </p>
  497. % endif
  498. % endfor
  499. </div>
  500. % endif
  501. <hr style="border-top: 1px dotted #ccc; margin: 0;"/>
  502. <form class="form" id="${h.ID.AddCommentInlineForm()}" action="${tg.url('/api/create_comment')}" method="POST">
  503. <input type="hidden" name='parent_id' value='${poNode.node_id}'/>
  504. <input type="hidden" name='data_label' value=""/>
  505. <input type="hidden" id="add_comment_data_content_textarea" name='data_content' />
  506. <label>
  507. ${_('Write your comment below:')}
  508. ${POD.RichTextEditor('add_comment_data_content_textarea_wysiwyg', '', 'boldanditalic')}
  509. </label>
  510. <label>
  511. <input type="checkbox" name='is_shared' checked /> ${_('Share this comment')}
  512. </label>
  513. <span class="pull-right">
  514. % if len(poNode.getComments())<=0:
  515. ${POD.SaveButton('current-document-add-comment-save-button', True, _('Add first comment'))}
  516. % else:
  517. ${POD.SaveButton('current-document-add-comment-save-button', True, _('Comment'))}
  518. % endif
  519. </span>
  520. </form>
  521. <script>
  522. $('#current-document-add-comment-save-button').on('click', function(e){
  523. e.preventDefault(); // We don't want this to act as a link so cancel the link action
  524. $('#add_comment_data_content_textarea_wysiwyg').cleanHtml();
  525. $('#add_comment_data_content_textarea').val($('#add_comment_data_content_textarea_wysiwyg').html());
  526. $('#current-document-add-comment-form').submit();
  527. });
  528. </script>
  529. </%def>