document.mak 9.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211
  1. <%inherit file="local:templates.master"/>
  2. <%namespace name="POD" file="pboard.templates.pod"/>
  3. <%namespace name="DOC" file="pboard.templates.document-widgets"/>
  4. <%namespace name="DOCTABS" file="pboard.templates.document-widgets-tabs"/>
  5. <%def name="title()">
  6. % if current_node!=None:
  7. pod :: document ${current_node.getTruncatedLabel(40)} [#${current_node.node_id} / ${current_node.getStatus().label}]
  8. % else:
  9. pod :: document root
  10. % endif
  11. </%def>
  12. <%def name="node_treeview(node_list, indentation=0)">
  13. % if len(node_list)<=0 and indentation==0:
  14. <p class="pod-grey">${_('You have no document yet.')}</p>
  15. % endif
  16. % if len(node_list)>0:
  17. % for item in node_list:
  18. <div id='pod-menu-item-${item.node.node_id}' class="pod-toolbar-parent ${'pod-status-active' if current_node!=None and item.node.node_id==current_node.node_id else ''}" style="padding-left: ${(indentation+2)*0.5}em; position: relative;">
  19. <a class="toggle-child-menu-items"><i class='${item.node.getIconClass()}'></i></a>
  20. <a href="${tg.url('/document/%s'%(item.node.node_id))}" title="${item.node.data_label}">
  21. % if item.node.getStatus().status_family=='closed' or item.node.getStatus().status_family=='invisible':
  22. <strike>
  23. % endif
  24. ${item.node.getTruncatedLabel(32-0.8*(indentation+1))}
  25. % if item.node.getStatus().status_family=='closed' or item.node.getStatus().status_family=='invisible':
  26. </strike>
  27. % endif
  28. </a>
  29. <div class="pod-toolbar">
  30. <a href="${tg.url('/api/move_node_upper?node_id=%i'%(item.node.node_id))}" title="${_('Move up')}"><i class="fa fa-arrow-up"></i></a>
  31. <a href="${tg.url('/api/move_node_lower?node_id=%i'%(item.node.node_id))}" title="${_('Move down')}"><i class="fa fa-arrow-down"></i></a>
  32. </div>
  33. <div class="pod-status ${item.node.getStatus().css}" title='${item.node.getStatus().label}'>
  34. <i class='${item.node.getStatus().icon}'></i>
  35. </div>
  36. </div>
  37. % if len(item.children)>0:
  38. <div id="pod-menu-item-${item.node.node_id}-children">${node_treeview(node_list=item.children, indentation=indentation+1)}</div>
  39. % endif
  40. % endfor
  41. % endif
  42. </%def>
  43. <%def name="node_treeview_in_select_field(node_list, indentation, selected_id=0)">
  44. % if len(node_list)>0:
  45. % if indentation==0:
  46. <option style="margin-left: ${0.5*indentation}em; color: #CCC;" value="0">no parent...</option>
  47. % endif
  48. % for node in node_list:
  49. % if selected_id!=node.node_id:
  50. <option style="margin-left: ${0.5*indentation}em;" value="${node.node_id}">${node.data_label}</option>
  51. % else:
  52. <option style="margin-left: ${0.5*indentation}em;" value="${node.node_id}" selected>${node.data_label}</option>
  53. % endif
  54. ${node_treeview_in_select_field(node.getChildren(), indentation+1, selected_id)}
  55. % endfor
  56. % endif
  57. </%def>
  58. <%def name='toggle_view_mode()'>
  59. <li title=" ${_('Toggle view mode [narrow, medium, large]')}">
  60. <a title="${_('Toggle view mode: narrow')}" id='view-size-toggle-button-small' class="pod-do-not-display"><i class='fa fa-eye'></i></a>
  61. <a title="${_('Toggle view mode: medium')}" id='view-size-toggle-button-medium'><i class='fa fa-eye'></i></a>
  62. <a title="${_('Toggle view mode: large')}" id='view-size-toggle-button-large' class="pod-do-not-display"><i class='fa fa-eye'></i></a>
  63. </li>
  64. </%def>
  65. #######
  66. ##
  67. ## HERE COMES THE BREADCRUMB
  68. ##
  69. <div class="row">
  70. ${DOC.BreadCrumb(current_node, allowed_nodes)}
  71. </div>
  72. <div class="row">
  73. <div id='application-left-panel' class="span3" >
  74. <link rel="stylesheet" href="${tg.url('/jstree/dist/themes/default/style.min.css')}" />
  75. <script src="${tg.url('/jstree/dist/jstree.js')}"></script>
  76. <style>
  77. #mypodtree {overflow:hidden;}
  78. #mypodtree:hover {overflow:visible; }
  79. </style>
  80. <h5>${_('Content explorer')}</h5>
  81. <div id="mypodtree"></div>
  82. <script>
  83. $(function () {
  84. $('#mypodtree').jstree({
  85. "plugins" : [ "wholerow"],
  86. 'core' : {
  87. 'error': function (error) {
  88. console.log('Error ' + error.toString())
  89. },
  90. 'data' : {
  91. 'dataType': 'json',
  92. 'contentType': 'application/json; charset=utf-8',
  93. 'url' : function (node) {
  94. if (node.id==='#') {
  95. return '${tg.url("/api/menu/initialize", dict(current_node_id=current_node.node_id if current_node else 0))}';
  96. } else {
  97. return '${tg.url("/api/menu/children")}';
  98. }
  99. },
  100. 'data' : function(node) {
  101. console.log("NODE => "+JSON.stringify(node))
  102. return {
  103. 'id' : node.id
  104. };
  105. },
  106. 'success': function (new_data) {
  107. console.log('loaded new menu data' + new_data)
  108. console.log(new_data);
  109. return new_data;
  110. },
  111. },
  112. }
  113. });
  114. $('#mypodtree').on("select_node.jstree", function (e, data) {
  115. url = "${tg.url('/document/')}"+data.selected[0];
  116. console.log("Opening document: "+url);
  117. location.href = url;
  118. });
  119. $('#mypodtree').on("loaded.jstree", function () {
  120. nodes = $('#mypodtree .jstree-node');
  121. console.log("nodes = "+nodes.length);
  122. if (nodes.length<=0) {
  123. $("#mypodtree").append( "<p class='pod-grey'>${_('There is no content yet.')|n}" );
  124. $("#mypodtree").append( "<p><a class=\"btn btn-success\" data-toggle=\"modal\" role=\"button\" href=\"#add-document-modal-form\"><i class=\"fa fa-plus\"></i> ${_('Create a topic')}</a></p>" );
  125. }
  126. });
  127. });
  128. </script>
  129. ## INFO - D.A. - 2014-05-28 - Hide old school menu
  130. ## <div>
  131. ## ${node_treeview(menu_node_list)}
  132. ## </div>
  133. </div>
  134. <div id='application-main-panel' class="span9">
  135. % if current_node==None:
  136. <div class="row">
  137. ${DOC.FirstTimeFakeDocument()}
  138. </div>
  139. % else:
  140. <div class="row">
  141. <div id='application-document-panel' class="span5">
  142. <div id='current-document-content' class="">
  143. ######
  144. ##
  145. ## CURRENT DOCUMENT TOOLBAR - START
  146. ##
  147. ## The Toolbar is a div with a specific id
  148. ##
  149. ${DOC.Toolbar(current_node, node_status_list, root_node_list_for_select_field, 'current-document-toobar', current_user_rights, current_user)}
  150. ${DOC.ShowTitle(current_node, keywords, 'current-document-title')}
  151. ${DOC.ShowContent(current_node, keywords)}
  152. </div>
  153. ${DOC.EditForm(current_node)}
  154. </div>
  155. <div id='application-metadata-panel' class="span4">
  156. ######
  157. ##
  158. ## HERE WE INCLUDE ALL MODAL DIALOG WHICH WILL BE ACCESSIBLE THROUGH TABS OR MENU
  159. ##
  160. ${DOC.DocumentEditModalDialog(current_node, None, tg.url('/api/create_document'), h.ID.AddDocumentModalForm(current_node), _('New Sub-document'))}
  161. ${DOC.EventEditModalDialog(current_node, None, tg.url('/api/create_event'), h.ID.AddEventModalForm(current_node), _('Add an event'))}
  162. ${DOC.ContactEditModalDialog(current_node, None, tg.url('/api/create_contact'), h.ID.AddContactModalForm(current_node), _('Add a new contact'))}
  163. ${DOC.FileEditModalDialog(current_node, None, tg.url('/api/create_file'), h.ID.AddFileModalForm(current_node), _('Add a new file'))}
  164. ${DOC.MoveDocumentModalDialog(current_node, tg.url('/api/set_parent_node'), h.ID.MoveDocumentModalForm(current_node), _('Move the document'))}
  165. <div class="tabbable">
  166. <ul class="nav nav-tabs" style="margin-bottom: 0em;">
  167. <li>${DOC.MetadataTab('#subdocuments', 'tab', _('Subdocuments'), 'fa-file-text-o', current_node.getChildren())}</li>
  168. <li>${DOC.MetadataTab('#events', 'tab', _('Calendar'), 'fa-calendar', current_node.getEvents())}</li>
  169. <li>${DOC.MetadataTab('#contacts', 'tab', _('Address book'), 'fa-user', current_node.getContacts())}</li>
  170. <li class="active">${DOC.MetadataTab('#comments', 'tab', _('Comment thread'), 'fa-comments-o', current_node.getComments())}</li>
  171. <li>${DOC.MetadataTab('#files', 'tab', _('Attachments'), 'fa-paperclip', current_node.getFiles())}</li>
  172. <li class="pull-right">${DOC.MetadataTab('#accessmanagement', 'tab', _('Access Management'), 'fa-key', current_node.getGroupsWithSomeAccess())}</li>
  173. <li class="pull-right">${DOC.MetadataTab('#history', 'tab', _('History'), 'fa-history', current_node.getHistory())}</li>
  174. </ul>
  175. ################################
  176. ##
  177. ## PANEL SHOWING ASSOCIATED DATA AND METADATA
  178. ##
  179. ################################
  180. <div class="tab-content">
  181. <div class="tab-pane" id="subdocuments">${DOCTABS.SubdocumentContent(current_node)}</div>
  182. <div class="tab-pane" id="events">${DOCTABS.EventTabContent(current_user, current_node)}</div>
  183. <div class="tab-pane" id="contacts">${DOCTABS.ContactTabContent(current_node)}</div>
  184. <div class="tab-pane active" id="comments">${DOCTABS.CommentTabContent(current_user, current_node)}</div>
  185. <div class="tab-pane" id="files">${DOCTABS.FileTabContent(current_node)}</div>
  186. <div class="tab-pane" id="history">${DOCTABS.HistoryTabContent(current_node)}</div>
  187. <div class="tab-pane" id="accessmanagement">${DOCTABS.AccessManagementTab(current_node, current_user_rights, current_user)}</div>
  188. </div>
  189. </div>
  190. </div>
  191. </div>
  192. % endif
  193. </div>
  194. </div>
  195. </div>