document-widgets.mak 19KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540
  1. <%inherit file="local:templates.master"/>
  2. <%namespace name="POD" file="pboard.templates.pod"/>
  3. <%def name="node_treeview_for_set_parent_menu(node_id, node_list, indentation=-1)">
  4. % if indentation==-1:
  5. <li>
  6. <a href="${tg.url('/api/set_parent_node', dict(node_id=node_id, new_parent_id=0))}">
  7. <i class="fa fa-file-text-o"></i> ${_('Home')}
  8. </a>
  9. ${node_treeview_for_set_parent_menu(node_id, node_list, 0)}
  10. </li>
  11. % else:
  12. % if len(node_list)>0:
  13. <ul style="list-style: none;">
  14. % for new_parent_node in node_list:
  15. <li>
  16. <a href="${tg.url('/api/set_parent_node', dict(node_id=node_id, new_parent_id=new_parent_node.node_id))}"><i class="fa fa-file-text-o"></i> ${new_parent_node.getTruncatedLabel(40-indentation*2)}
  17. </a>
  18. ${node_treeview_for_set_parent_menu(node_id, new_parent_node.getStaticChildList(), indentation+1)}
  19. </li>
  20. % endfor
  21. </ul>
  22. % endif
  23. % endif
  24. </%def>
  25. <%def name="ToolbarMenuItemModal(psTargetModalId, psIconClasses, psMenuLabel)">
  26. <li><a href="#${psTargetModalId}" role="button" data-toggle="modal"><i class="${psIconClasses}"></i> ${psMenuLabel}</a></li>
  27. </%def>
  28. <%def name="ToolbarMenuItemInline(psTargetId, psIconClasses, psMenuLabel)">
  29. <li><a href="#${psTargetId}"><i class="${psIconClasses}"></i> ${psMenuLabel}</a></li>
  30. </%def>
  31. <%def name="ToolbarMenuItemLink(psTargetUrl, psIconClasses, psMenuLabel, psLinkCss='', psLinkTitle='')">
  32. % if psTargetUrl=='#':
  33. <li class="disabled"><a href="${psTargetUrl}" class="${psLinkCss}" title="${psLinkTitle}"><i class="${psIconClasses}"></i> ${psMenuLabel}</a></li>
  34. % else:
  35. <li><a href="${psTargetUrl}" class="${psLinkCss}" title="${psLinkTitle}"><i class="${psIconClasses}"></i> ${psMenuLabel}</a></li>
  36. % endif
  37. </%def>
  38. <%def name="Toolbar(poNode, plNodeStatusList, plRootNodes, psDivId)">
  39. <div id="${psDivId}">
  40. <div class="btn-group">
  41. ${POD.EditButton('current-document-content-edit-button', True)}
  42. <button class="btn btn-small" data-toggle="dropdown" href="#">
  43. <i class="fa fa-signal"></i>
  44. ${_("Change status")}
  45. </button>
  46. <a class="btn btn-small dropdown-toggle" data-toggle="dropdown" href="#">
  47. <span class="caret"></span>
  48. </a>
  49. <ul class="dropdown-menu">
  50. <li>
  51. <div class="pod-grey strong" ><strong><i class="fa fa-magic"></i> ${_('Current status is...')}</strong><br/></div>
  52. </li>
  53. % for node_status in plNodeStatusList:
  54. % if node_status.status_id==poNode.getStatus().status_id:
  55. ${ToolbarMenuItemLink('#', node_status.icon_id, node_status.label, 'disabled '+node_status.css, h.getExplanationAboutStatus(node_status.status_id, current_node.getStatus().status_id))}
  56. % endif
  57. % endfor
  58. <li class="divider" role="presentation"></li>
  59. <li>
  60. <div class=" strong" ><strong><i class="fa fa-magic"></i> ${_('Change to...')}</strong><br/></div>
  61. <div class="pod-grey"><i>${_('change the status to...')}</i></div>
  62. </li>
  63. % for node_status in plNodeStatusList:
  64. % if node_status.status_id!=poNode.getStatus().status_id:
  65. ${ToolbarMenuItemLink(tg.url('/api/edit_status', dict(node_id=current_node.node_id, node_status=node_status.status_id)), node_status.icon_id, node_status.label, node_status.css, h.getExplanationAboutStatus(node_status.status_id, current_node.getStatus().status_id))}
  66. % endif
  67. % endfor
  68. </ul>
  69. </div>
  70. <div class="btn-group">
  71. <button class="btn btn-small btn-success" data-toggle="dropdown" href="#">
  72. <i class="fa fa-plus"></i> ${_('Add')}
  73. </button>
  74. <a class="btn btn-small dropdown-toggle" data-toggle="dropdown" href="#"><span class="caret"></span></a>
  75. <ul class="dropdown-menu">
  76. <li>
  77. <div class="btn-success strong" ><strong><i class="fa fa-magic"></i> ${_('Add New...')}</strong><br/></div>
  78. <div class="pod-grey"><i>${_('create a totally new item...')}</i></div>
  79. </li>
  80. ${ToolbarMenuItemModal(h.ID.AddDocumentModalForm(current_node), 'fa fa-file-text-o', _('Document'))}
  81. ${ToolbarMenuItemModal(h.ID.AddFileModalForm(current_node), 'fa fa-paperclip', _('File'))}
  82. ${ToolbarMenuItemModal(h.ID.AddEventModalForm(current_node), 'fa fa-calendar', _('Event'))}
  83. ${ToolbarMenuItemModal(h.ID.AddContactModalForm(current_node), 'fa fa-user', _('Contact'))}
  84. ##
  85. ## FIXME - DA - 07-05-2014 - The link below is not working clean
  86. ##
  87. ${ToolbarMenuItemInline(h.ID.AddCommentInlineForm(), 'fa fa-comments-o', _('Comment'))}
  88. <li class="divider" role="presentation"></li>
  89. <li>
  90. <div class="btn-warning strong" ><strong><i class="fa fa-link"></i> Add Existing...</strong><br/></div>
  91. <div class="pod-grey"><i>link to an existing item...</i></div>
  92. </li>
  93. <li><p class="pod-grey"><i class="fa fa-danger"></i> coming soon!</p></li>
  94. </ul>
  95. </div>
  96. <div class="btn-group ">
  97. <a
  98. class="btn btn-small btn-warning"
  99. href="#"
  100. data-toggle="dropdown"
  101. title="${_('Move to')}"
  102. ><i class="fa fa-arrows"></i></a>
  103. <ul class="dropdown-menu">
  104. <li >
  105. <div class="btn-warning strong" ><strong><i class="fa fa-magic"></i> ${_("Move the document...")}</strong><br/></div>
  106. <div class="pod-grey"><i>move the document to...</i></div>
  107. </li>
  108. ${node_treeview_for_set_parent_menu(poNode.node_id, plRootNodes)}
  109. </ul>
  110. <a
  111. class="btn btn-small btn-danger"
  112. href='${tg.url('/api/edit_status', dict(node_id=poNode.node_id, node_status='deleted'))}'
  113. id='current-document-force-delete-button' onclick="return confirm('${_('Delete current document?')}');"
  114. title="${_('Delete')}"
  115. ><i class="fa fa-trash-o"></i></a>
  116. </div>
  117. </div>
  118. </%def>
  119. <%def name="BreadCrumb(poNode)">
  120. <ul class="breadcrumb span12">
  121. <li>
  122. <span class="divider">/</span>
  123. <a href="${tg.url('/document/')}">Documents</a>
  124. </li>
  125. % if poNode!=None:
  126. % for breadcrumb_node in poNode.getBreadCrumbNodes():
  127. <li>
  128. <span class="divider">/</span>
  129. <a href="${tg.url('/document/%s'%(breadcrumb_node.node_id))}">${breadcrumb_node.getTruncatedLabel(30)}</a>
  130. </li>
  131. % endfor
  132. <li class="active">
  133. <span class="divider">/</span>
  134. ${poNode.data_label}
  135. </li>
  136. % endif
  137. </ul>
  138. </%def>
  139. <%def name="EditForm(poNode)">
  140. <form
  141. style="display: none;"
  142. id="current-document-content-edit-form"
  143. method="post"
  144. action="${tg.url('/api/edit_label_and_content')}"
  145. >
  146. <div>
  147. ${POD.CancelButton('current-document-content-edit-cancel-button-top', True)}
  148. ${POD.SaveButton('current-document-content-edit-save-button-top', True)}
  149. </div>
  150. <div style="padding: 0.5em 0 0 0">
  151. <input type="hidden" name="node_id" value="${current_node.node_id}"/>
  152. <input type="hidden" name="data_content" id="current_node_textarea" />
  153. <label>
  154. ${_('Title')}
  155. <input
  156. type="text"
  157. name="data_label"
  158. value="${current_node.data_label}"
  159. class="span4"
  160. placeholder="${_('document title')}"
  161. />
  162. </label>
  163. </div>
  164. <div>
  165. ${POD.RichTextEditor('current_node_textarea_wysiwyg', current_node.data_content)}
  166. </div>
  167. <div class="pull-right">
  168. ${POD.CancelButton('current-document-content-edit-cancel-button', True)}
  169. ${POD.SaveButton('current-document-content-edit-save-button', True)}
  170. </div>
  171. </form>
  172. </%def>
  173. <%def name="ShowContent(poNode, psKeywords)">
  174. <div>
  175. % if len(psKeywords)>0 and psKeywords!='':
  176. ${poNode.getContentWithHighlightedKeywords(psKeywords.split(), poNode.getContentWithTags())|n}
  177. % else:
  178. ${poNode.getContentWithTags()|n}
  179. % endif
  180. </div>
  181. </%def>
  182. <%def name="ShowTitle(poNode, psKeywords, psId)">
  183. <h3 id="${psId}" title="Document ${poNode.node_id}: ${poNode.data_label}">
  184. ${poNode.data_label}
  185. <sup class="label ${poNode.getStatus().css}" href="#">
  186. <i class="${poNode.getStatus().icon_id}"></i>
  187. ${poNode.getStatus().label}
  188. </sup>
  189. % if poNode.is_shared==False:
  190. <sup class="label label-info" title="${_('This document is private')}">
  191. <i class="fa fa-key"></i>
  192. ${_('private')}
  193. </sup>
  194. % else:
  195. <sup class="label label-warning" title="${_('This document is shared')}">
  196. <i class="fa fa-group"></i>
  197. ${_('shared')}
  198. </sup>
  199. % endif
  200. ######
  201. ##
  202. ## 2014-05-06 - D.A. - The document is not yet internet-sharable
  203. ##
  204. ## % if poNode.is_public==True:
  205. ## <sup class="label label-warning" href="#">
  206. ## <i class="fa fa-globe"></i>
  207. ## <span title="${_('This document is published through internet at %s')%poNode.public_url_key}">${_('shared')}</span>
  208. ## </sup>
  209. ## % endif
  210. </h3>
  211. </%def>
  212. #######
  213. ##
  214. ## METADATA TAB FUNCTIONS
  215. ##
  216. <%def name="MetadataTab(psAnchorName, psDataToggleName, psTitle, psFontAwesomeIconClass, plItems)">
  217. <a
  218. href="${psAnchorName}"
  219. data-toggle="${psDataToggleName}"
  220. title="${psTitle}"
  221. >
  222. <i class="pod-dark-grey fa ${psFontAwesomeIconClass}"></i>
  223. ${POD.ItemNb(plItems)}
  224. </a>
  225. </%def>
  226. <%def name="FirstTimeFakeDocument()">
  227. <div id='application-document-panel' class="span5">
  228. <div id='current-document-content' class="">
  229. <p class="well">
  230. <strong>${_('Welcome aboard')}</strong>
  231. <i class="fa fa-smile-o fa-2x"></i>
  232. </p>
  233. ${_('<p>We suggest you to...<br/><br/></p>')|n}
  234. <h4>
  235. <i class="fa fa-angle-double-left fa-3x fa-fw pod-blue" style="vertical-align: middle"></i>
  236. ${_('work on existing documents')}
  237. </h4>
  238. <p class="text-center">${_('or')}</p>
  239. <h4 class="text-right">
  240. ${_('create a new document')}
  241. <i class="fa fa-angle-double-down fa-3x fa-fw pod-blue" style="vertical-align: middle"></i>
  242. </h4>
  243. <p class="pull-right">
  244. <a href="#${h.ID.AddDocumentModalForm()}" role="button" class="btn btn-success" data-toggle="modal">
  245. <i class="fa fa-plus"></i>
  246. ${_('Create a new document')}
  247. </a>
  248. </p>
  249. ${DocumentEditModalDialog(None, None, tg.url('/api/create_document'), h.ID.AddDocumentModalForm(), 'Create your first document')}
  250. <div style="clear: both;"></div>
  251. <p class="alert alert-info" style="margin-top: 2em;">
  252. <i class="fa fa-info-circle"></i> ${_('<strong>Note :</strong> You can even create a dummy document: you will be able to remove it later.')|n}
  253. </p>
  254. </div>
  255. <script>
  256. </script>
  257. </div>
  258. </%def>
  259. <%def name="DocumentEditModalDialog(piParentNodeId, poNode, psPostUrl, psModalId, psTitle)">
  260. <div
  261. id="${psModalId}"
  262. class="modal hide"
  263. tabindex="-1"
  264. role="dialog"
  265. aria-labelledby="myModalLabel"
  266. aria-hidden="true">
  267. <div class="modal-header">
  268. ## MODAL HEADER
  269. <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
  270. <h3 id="myModalLabel">${psTitle}</h3>
  271. ## MODAL HEADER [END]
  272. </div>
  273. <div class="modal-body">
  274. ## MODAL BODY
  275. <form id='${psModalId}-form' method="GET" action="${psPostUrl}">
  276. <div style="padding: 0.5em 0 0 0">
  277. % if poNode!=None:
  278. <input type="hidden" name="node_id" value="${poNode.node_id}"/>
  279. % endif
  280. <input type="hidden" name="parent_id" value="${piParentNodeId if piParentNodeId else 0}"/>
  281. <input type="hidden" name="data_content" id="${psModalId}-textarea" />
  282. <input
  283. type="text"
  284. name="data_label"
  285. value="${poNode.data_label if poNode!=None else ''}"
  286. class="span4"
  287. placeholder="${_('document title')}"
  288. />
  289. </div>
  290. <div>
  291. ${POD.RichTextEditor(psModalId+'-textarea-wysiwyg', poNode.data_content if poNode!=None else '')}
  292. </div>
  293. </form>
  294. ## MODAL BODY [END]
  295. </div>
  296. <div class="modal-footer">
  297. ## MODAL FOOTER
  298. <button class="btn" data-dismiss="modal" aria-hidden="true">
  299. <i class="fa fa-ban"></i> ${_('Cancel')}
  300. </button>
  301. <button class="btn btn-success" id="${psModalId}-form-submit-button">
  302. <i class="fa fa-check"></i> ${_('Save changes')}
  303. </button>
  304. ## MODAL FOOTER [END]
  305. <script>
  306. $('#${psModalId}-form-submit-button').click(function(){
  307. $('#${psModalId}-textarea-wysiwyg').cleanHtml();
  308. $('#${psModalId}-textarea').val($('#${psModalId}-textarea-wysiwyg').html());
  309. $('#${psModalId}-form')[0].submit();
  310. });
  311. </script>
  312. </div>
  313. </div>
  314. </%def>
  315. <%def name="FileEditModalDialog(piParentNodeId, poNode, psPostUrl, psModalId, psTitle)">
  316. <div
  317. id="${psModalId}"
  318. class="modal hide"
  319. tabindex="-1"
  320. role="dialog"
  321. aria-labelledby="myModalLabel"
  322. aria-hidden="true">
  323. <div class="modal-header">
  324. ## MODAL HEADER
  325. <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
  326. <h3 id="myModalLabel">${psTitle}</h3>
  327. ## MODAL HEADER [END]
  328. </div>
  329. <div class="modal-body">
  330. ## MODAL BODY
  331. <form id='${psModalId}-form' method="POST" action="${psPostUrl}" enctype="multipart/form-data">
  332. % if poNode!=None:
  333. <input type="hidden" name="node_id" value="${poNode.node_id}"/>
  334. % endif
  335. <input type="hidden" name="parent_id" value="${piParentNodeId if piParentNodeId else 0}"/>
  336. <input type="hidden" name="data_content" id="${psModalId}-textarea" />
  337. <div>
  338. <label>
  339. ${_('Title')}
  340. <input
  341. type="text"
  342. name="data_label"
  343. value="${poNode.data_label if poNode!=None else ''}"
  344. class="span4"
  345. placeholder="${_('this field is optionnal')}"
  346. />
  347. </label>
  348. <label>
  349. ${_('Choose a file...')}
  350. <input type="file" class="span4" placeholder="${_('choose a file...')}" name="data_file"/>
  351. </label>
  352. </div>
  353. <div>
  354. <label>${_('File description (optionnal)')}</label>
  355. ${POD.RichTextEditor(psModalId+'-textarea-wysiwyg', poNode.data_content if poNode!=None else '', '')}
  356. </div>
  357. </form>
  358. ## MODAL BODY [END]
  359. </div>
  360. <div class="modal-footer">
  361. ## MODAL FOOTER
  362. <button class="btn" data-dismiss="modal" aria-hidden="true">
  363. <i class="fa fa-ban"></i> ${_('Cancel')}
  364. </button>
  365. <button class="btn btn-success" id="${psModalId}-form-submit-button">
  366. <i class="fa fa-check"></i> ${_('Save changes')}
  367. </button>
  368. <script>
  369. $('#${psModalId}-form-submit-button').click(function(){
  370. $('#${psModalId}-textarea-wysiwyg').cleanHtml();
  371. $('#${psModalId}-textarea').val($('#${psModalId}-textarea-wysiwyg').html());
  372. $('#${psModalId}-form')[0].submit();
  373. });
  374. </script>
  375. ## MODAL FOOTER [END]
  376. </div>
  377. </div>
  378. </%def>
  379. <%def name="EventEditModalDialog(piParentNodeId, poNode, psPostUrl, psModalId, psTitle)">
  380. <div
  381. id="${psModalId}"
  382. class="modal hide"
  383. tabindex="-1"
  384. role="dialog"
  385. aria-labelledby="myModalLabel"
  386. aria-hidden="true">
  387. <div class="modal-header">
  388. ## MODAL HEADER
  389. <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
  390. <h3 id="myModalLabel">
  391. ${psTitle}
  392. </h3>
  393. ## MODAL HEADER [END]
  394. </div>
  395. <div class="modal-body">
  396. ###### MODAL BODY
  397. <form id='${psModalId}-form' action='${psPostUrl}' method='POST'>
  398. <input type="hidden" name='parent_id' value='${current_node.node_id}'/>
  399. <fieldset>
  400. <label>
  401. ${_('Event')}
  402. <input type="text" name='data_label' placeholder="Event"/>
  403. </label>
  404. <label>
  405. ${_('Date and time')}
  406. <div class="datetime-picker-input-div input-append date">
  407. <input name='data_datetime' data-format="dd/MM/yyyy hh:mm" type="text" placeholder="date and time"/>
  408. <span class="add-on"><i data-time-icon="icon-g-clock" data-date-icon="icon-g-calendar"></i></span>
  409. </div>
  410. </label>
  411. <label>
  412. ${_('Event description:')}
  413. <div>
  414. <input type="hidden" name="data_content" id="${psModalId}-textarea" />
  415. ${POD.RichTextEditor(psModalId+'-textarea-wysiwyg', poNode.data_content if poNode!=None else '', 'boldanditalic')}
  416. </div>
  417. </label>
  418. </fieldset>
  419. </form>
  420. ###### MODAL BODY [END]
  421. </div>
  422. <div class="modal-footer">
  423. ###### MODAL FOOTER
  424. <button class="btn" data-dismiss="modal" aria-hidden="true">
  425. <i class="fa fa-ban"></i> ${_('Cancel')}
  426. </button>
  427. <button class="btn btn-success" id="${psModalId}-form-submit-button">
  428. <i class="fa fa-check"></i> ${_('Save changes')}
  429. </button>
  430. <script>
  431. $('#${psModalId}-form-submit-button').click(function(){
  432. $('#${psModalId}-textarea-wysiwyg').cleanHtml();
  433. $('#${psModalId}-textarea').val($('#${psModalId}-textarea-wysiwyg').html());
  434. $('#${psModalId}-form')[0].submit();
  435. });
  436. </script>
  437. ###### MODAL FOOTER [END]
  438. </div>
  439. </div>
  440. </%def>
  441. <%def name="ContactEditModalDialog(piParentNodeId, poNode, psPostUrl, psModalId, psTitle)">
  442. <div
  443. id="${psModalId}"
  444. class="modal hide"
  445. tabindex="-1"
  446. role="dialog"
  447. aria-labelledby="myModalLabel"
  448. aria-hidden="true">
  449. <div class="modal-header">
  450. ## MODAL HEADER
  451. <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
  452. <h3 id="myModalLabel">${psTitle}</h3>
  453. ## MODAL HEADER [END]
  454. </div>
  455. <div class="modal-body">
  456. ## MODAL BODY
  457. <form id='${psModalId}-form' method="POST" action="${psPostUrl}">
  458. % if poNode!=None:
  459. <input type="hidden" name="node_id" value="${poNode.node_id}"/>
  460. % endif
  461. <input type="hidden" name="parent_id" value="${piParentNodeId if piParentNodeId else 0}"/>
  462. <input type="hidden" name="data_content" id="${psModalId}-textarea" />
  463. <div>
  464. <label>
  465. ${_('Contact name and firstname')}
  466. <input
  467. type="text"
  468. name="data_label"
  469. value="${poNode.data_label if poNode!=None else ''}"
  470. class="span4"
  471. placeholder="${_('name, firstname, title...')}"
  472. />
  473. </label>
  474. </div>
  475. <div>
  476. <label>${_('Address, phone, email, company...')}</label>
  477. ${POD.RichTextEditor(psModalId+'-textarea-wysiwyg', poNode.data_content if poNode!=None else '', 'boldanditalic')}
  478. </div>
  479. </form>
  480. ## MODAL BODY [END]
  481. </div>
  482. <div class="modal-footer">
  483. ## MODAL FOOTER
  484. <button class="btn" data-dismiss="modal" aria-hidden="true">
  485. <i class="fa fa-ban"></i> ${_('Cancel')}
  486. </button>
  487. <button class="btn btn-success" id="${psModalId}-form-submit-button">
  488. <i class="fa fa-check"></i> ${_('Save changes')}
  489. </button>
  490. <script>
  491. $('#${psModalId}-form-submit-button').click(function(){
  492. $('#${psModalId}-textarea-wysiwyg').cleanHtml();
  493. $('#${psModalId}-textarea').val($('#${psModalId}-textarea-wysiwyg').html());
  494. $('#${psModalId}-form')[0].submit();
  495. });
  496. </script>
  497. ## MODAL FOOTER [END]
  498. </div>
  499. </div>
  500. </%def>