document.mak 9.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200
  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. #######
  59. ##
  60. ## HERE COMES THE BREADCRUMB
  61. ##
  62. <div class="row">
  63. ${DOC.BreadCrumb(current_node, allowed_nodes)}
  64. </div>
  65. <div class="row">
  66. <div id='application-left-panel' class="span3" >
  67. <link rel="stylesheet" href="${tg.url('/jstree/dist/themes/default/style.min.css')}" />
  68. <script src="${tg.url('/jstree/dist/jstree.js')}"></script>
  69. <style>
  70. #mypodtree {overflow:hidden;}
  71. #mypodtree:hover {overflow:visible; }
  72. </style>
  73. <h5>${_('Content explorer')}</h5>
  74. <div id="mypodtree"></div>
  75. <script>
  76. $(function () {
  77. $('#mypodtree').jstree({
  78. "plugins" : [ "wholerow"],
  79. 'core' : {
  80. 'error': function (error) {
  81. console.log('Error ' + error.toString())
  82. },
  83. 'data' : {
  84. 'dataType': 'json',
  85. 'contentType': 'application/json; charset=utf-8',
  86. 'url' : function (node) {
  87. if (node.id==='#') {
  88. return '${tg.url("/api/menu/initialize", dict(current_node_id=current_node.node_id if current_node else 0))}';
  89. } else {
  90. return '${tg.url("/api/menu/children")}';
  91. }
  92. },
  93. 'data' : function(node) {
  94. console.log("NODE => "+JSON.stringify(node))
  95. return {
  96. 'id' : node.id
  97. };
  98. },
  99. 'success': function (new_data) {
  100. console.log('loaded new menu data' + new_data)
  101. console.log(new_data);
  102. return new_data;
  103. },
  104. },
  105. }
  106. });
  107. $('#mypodtree').on("select_node.jstree", function (e, data) {
  108. url = "${tg.url('/document/')}"+data.selected[0];
  109. console.log("Opening document: "+url);
  110. location.href = url;
  111. });
  112. $('#mypodtree').on("loaded.jstree", function () {
  113. nodes = $('#mypodtree .jstree-node');
  114. console.log("nodes = "+nodes.length);
  115. if (nodes.length<=0) {
  116. $("#mypodtree").append( "<p class='pod-grey'>${_('There is no content yet.')|n}</p>" );
  117. }
  118. });
  119. });
  120. </script>
  121. ## INFO - D.A. - 2014-05-28 - Hide old school menu
  122. ## <div>
  123. ## ${node_treeview(menu_node_list)}
  124. ## </div>
  125. </div>
  126. <div id='application-main-panel' class="span9">
  127. % if current_node==None:
  128. <div class="row">
  129. ${DOC.FirstTimeFakeDocument()}
  130. </div>
  131. % else:
  132. <div class="row">
  133. <div id='application-document-panel' class="span5">
  134. <div id='current-document-content' class="">
  135. ######
  136. ##
  137. ## CURRENT DOCUMENT TOOLBAR - START
  138. ##
  139. ## The Toolbar is a div with a specific id
  140. ##
  141. ${DOC.Toolbar(current_node, node_status_list, root_node_list_for_select_field, 'current-document-toobar')}
  142. ${DOC.ShowTitle(current_node, keywords, 'current-document-title')}
  143. ${DOC.ShowContent(current_node, keywords)}
  144. </div>
  145. ${DOC.EditForm(current_node)}
  146. </div>
  147. <div id='application-metadata-panel' class="span4">
  148. ######
  149. ##
  150. ## HERE WE INCLUDE ALL MODAL DIALOG WHICH WILL BE ACCESSIBLE THROUGH TABS OR MENU
  151. ##
  152. ${DOC.DocumentEditModalDialog(current_node, None, tg.url('/api/create_document'), h.ID.AddDocumentModalForm(current_node), _('New Sub-document'))}
  153. ${DOC.EventEditModalDialog(current_node, None, tg.url('/api/create_event'), h.ID.AddEventModalForm(current_node), _('Add an event'))}
  154. ${DOC.ContactEditModalDialog(current_node, None, tg.url('/api/create_contact'), h.ID.AddContactModalForm(current_node), _('Add a new contact'))}
  155. ${DOC.FileEditModalDialog(current_node, None, tg.url('/api/create_file'), h.ID.AddFileModalForm(current_node), _('Add a new file'))}
  156. ${DOC.MoveDocumentModalDialog(current_node, tg.url('/api/set_parent_node'), h.ID.MoveDocumentModalForm(current_node), _('Move the document'))}
  157. <div class="tabbable">
  158. <ul class="nav nav-tabs" style="margin-bottom: 0em;">
  159. <li>${DOC.MetadataTab('#subdocuments', 'tab', _('Subdocuments'), 'fa-file-text-o', current_node.getChildren())}</li>
  160. <li>${DOC.MetadataTab('#events', 'tab', _('Calendar'), 'fa-calendar', current_node.getEvents())}</li>
  161. <li>${DOC.MetadataTab('#contacts', 'tab', _('Address book'), 'fa-user', current_node.getContacts())}</li>
  162. <li class="active">${DOC.MetadataTab('#comments', 'tab', _('Comment thread'), 'fa-comments-o', current_node.getComments())}</li>
  163. <li>${DOC.MetadataTab('#files', 'tab', _('Attachments'), 'fa-paperclip', current_node.getFiles())}</li>
  164. <li class="pull-right">${DOC.MetadataTab('#accessmanagement', 'tab', _('Access Management'), 'fa-key', current_node.getGroupsWithSomeAccess())}</li>
  165. <li class="pull-right">${DOC.MetadataTab('#history', 'tab', _('History'), 'fa-history', current_node.getHistory())}</li>
  166. </ul>
  167. ################################
  168. ##
  169. ## PANEL SHOWING ASSOCIATED DATA AND METADATA
  170. ##
  171. ################################
  172. <div class="tab-content">
  173. <div class="tab-pane" id="subdocuments">${DOCTABS.SubdocumentContent(current_node)}</div>
  174. <div class="tab-pane" id="events">${DOCTABS.EventTabContent(current_user, current_node)}</div>
  175. <div class="tab-pane" id="contacts">${DOCTABS.ContactTabContent(current_node)}</div>
  176. <div class="tab-pane active" id="comments">${DOCTABS.CommentTabContent(current_user, current_node)}</div>
  177. <div class="tab-pane" id="files">${DOCTABS.FileTabContent(current_node)}</div>
  178. <div class="tab-pane" id="history">${DOCTABS.HistoryTabContent(current_node)}</div>
  179. <div class="tab-pane" id="accessmanagement">${DOCTABS.AccessManagementTab(current_node)}</div>
  180. </div>
  181. </div>
  182. </div>
  183. </div>
  184. % endif
  185. </div>
  186. </div>
  187. </div>