Browse Source

- increase opacity of full-screen editor

Damien Accorsi 11 years ago
parent
commit
b8748e9107

+ 1 - 14
pboard/pboard/controllers/root.py View File

119
         loCurrentUser   = pld.PODStaticController.getCurrentUser()
119
         loCurrentUser   = pld.PODStaticController.getCurrentUser()
120
         loApiController = pld.PODUserFilteredApiController(loCurrentUser.user_id)
120
         loApiController = pld.PODUserFilteredApiController(loCurrentUser.user_id)
121
 
121
 
122
-        # loRootNodeList   = pbm.DBSession.query(pbmd.PBNode).filter(pbmd.PBNode.parent_id==None).order_by(pbmd.PBNode.node_order).all()
123
         loRootNodeList = loApiController.buildTreeListForMenu(pbmd.PBNodeStatus.getVisibleIdsList())
122
         loRootNodeList = loApiController.buildTreeListForMenu(pbmd.PBNodeStatus.getVisibleIdsList())
124
         liNodeId         = int(node)
123
         liNodeId         = int(node)
125
 
124
 
126
         loCurrentNode    = None
125
         loCurrentNode    = None
127
         loNodeStatusList = None
126
         loNodeStatusList = None
127
+
128
         try:
128
         try:
129
           loNodeStatusList = pbmd.PBNodeStatus.getChoosableList()
129
           loNodeStatusList = pbmd.PBNodeStatus.getChoosableList()
130
           loCurrentNode    = loApiController.getNode(liNodeId)
130
           loCurrentNode    = loApiController.getNode(liNodeId)
133
 
133
 
134
         # FIXME - D.A - 2013-11-07 - Currently, the code build a new item if no item found for current user
134
         # FIXME - D.A - 2013-11-07 - Currently, the code build a new item if no item found for current user
135
         # the correct behavior should be to redirect to setup page
135
         # the correct behavior should be to redirect to setup page
136
-        if loCurrentNode is not None and "%s"%loCurrentNode.node_id!=node:
137
-          redirect(tg.url('/document/%i'%loCurrentNode.node_id))
138
-
139
-        if loCurrentNode is None:
140
-          loCurrentNode = loApiController.getNode(0) # try to get an item
141
-          if loCurrentNode is not None:
142
-            flash(_('Document not found. Randomly showing item #%i')%(loCurrentNode.node_id), 'warning')
143
-            redirect(tg.url('/document/%i'%loCurrentNode.node_id))
144
-          else:
145
-            flash(_('Your first document has been automatically created'), 'info')
146
-            loCurrentNode = loApiController.createDummyNode()
147
-            pm.DBSession.flush()
148
-            redirect(tg.url('/document/%i'%loCurrentNode.node_id))
149
 
136
 
150
         return dict(
137
         return dict(
151
             root_node_list=loRootNodeList,
138
             root_node_list=loRootNodeList,

+ 1 - 1
pboard/pboard/model/data.py View File

333
           break
333
           break
334
       return PBNodeStatus.getStatusItem(lsRealStatusId)
334
       return PBNodeStatus.getStatusItem(lsRealStatusId)
335
 
335
 
336
-  def getTruncatedLabel(self: PBNode, piCharNb: int):
336
+  def getTruncatedLabel(self, piCharNb: int):
337
     """
337
     """
338
     return a truncated version of the data_label property.
338
     return a truncated version of the data_label property.
339
     if piCharNb is not > 0, then the full data_label is returned
339
     if piCharNb is not > 0, then the full data_label is returned

+ 6 - 4
pboard/pboard/public/css/style.css View File

127
 
127
 
128
   padding: 0.5em 0.5em 0.5em 0.5em;
128
   padding: 0.5em 0.5em 0.5em 0.5em;
129
   
129
   
130
-  filter: alpha(opacity=90); /* internet explorer */
131
-  -khtml-opacity: 0.9;      /* khtml, old safari */
132
-  -moz-opacity: 0.9;       /* mozilla, netscape */
133
-  opacity: 0.9;           /* fx, safari, opera */
130
+  filter: alpha(opacity=95); /* internet explorer */
131
+  -khtml-opacity: 0.95;      /* khtml, old safari */
132
+  -moz-opacity: 0.95;       /* mozilla, netscape */
133
+  opacity: 0.95;           /* fx, safari, opera */
134
 }
134
 }
135
 
135
 
136
 .full-size-overlay-inner {
136
 .full-size-overlay-inner {
190
   margin-bottom: 0;
190
   margin-bottom: 0;
191
 }
191
 }
192
 
192
 
193
+ul.nav-tabs li.active > a { background-color: #efefef; }
194
+div.tab-pane > h4 { background-color: #efefef; padding: 0.5em; margin: 0 0 0.5em 0;}

+ 11 - 4
pboard/pboard/public/javascript/pod.js View File

1
+  function generateStringId(charNb = 32, allowedChars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789") {
2
+    var text = "";
3
+
4
+    for( var i=0; i < charNb; i++ ) {
5
+      text += allowedChars.charAt(Math.floor(Math.random() * allowedChars.length));
6
+    }
7
+
8
+    return text;
9
+  }
10
+
1
   function toggleFullScreen(outerWidgetId, innerWidgetId) {
11
   function toggleFullScreen(outerWidgetId, innerWidgetId) {
2
     if($(outerWidgetId).hasClass('full-size-overlay')) {
12
     if($(outerWidgetId).hasClass('full-size-overlay')) {
3
       // Toggle from fullscreen to "normal"
13
       // Toggle from fullscreen to "normal"
97
       $("#current-document-content-edit-form" ).css("display", "block");
107
       $("#current-document-content-edit-form" ).css("display", "block");
98
       $("#current-document-toobar").css("display", "none");
108
       $("#current-document-toobar").css("display", "none");
99
     });
109
     });
100
-    $("#current-document-content" ).dblclick(function() {
101
-      $("#current-document-content" ).css("display", "none");
102
-      $("#current-document-content-edit-form" ).css("display", "block");
103
-    });
110
+
104
     $("#current-document-content-edit-cancel-button, #current-document-content-edit-cancel-button-top" ).click(function() {
111
     $("#current-document-content-edit-cancel-button, #current-document-content-edit-cancel-button-top" ).click(function() {
105
       $("#current-document-content" ).css("display", "block");
112
       $("#current-document-content" ).css("display", "block");
106
       $("#current-document-content-edit-form" ).css("display", "none");
113
       $("#current-document-content-edit-form" ).css("display", "none");

+ 198 - 12
pboard/pboard/templates/document-widgets.mak View File

4
 <%def name="node_treeview_for_set_parent_menu(node_id, node_list, indentation=-1)">
4
 <%def name="node_treeview_for_set_parent_menu(node_id, node_list, indentation=-1)">
5
   % if indentation==-1:
5
   % if indentation==-1:
6
     <li>
6
     <li>
7
-      <a href="${tg.url('/api/set_parent_node?node_id=%i&new_parent_id=0'%(current_node.node_id))}">
7
+      <a href="${tg.url('/api/set_parent_node', dict(node_id=node_id, new_parent_id=0))}">
8
         <i class="fa fa-file-text-o"></i> ${_('Home')}
8
         <i class="fa fa-file-text-o"></i> ${_('Home')}
9
       </a>
9
       </a>
10
       ${node_treeview_for_set_parent_menu(node_id, node_list, 0)}
10
       ${node_treeview_for_set_parent_menu(node_id, node_list, 0)}
14
       <ul style="list-style: none;">
14
       <ul style="list-style: none;">
15
       % for new_parent_node in node_list:
15
       % for new_parent_node in node_list:
16
         <li>
16
         <li>
17
-          <a href="${tg.url('/api/set_parent_node?node_id=%i&new_parent_id=%i'%(node_id, new_parent_node.node_id))}"><i class="fa fa-file-text-o"></i> ${new_parent_node.getTruncatedLabel(40-indentation*2)}
17
+          <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)}
18
           </a>
18
           </a>
19
           ${node_treeview_for_set_parent_menu(node_id, new_parent_node.getStaticChildList(), indentation+1)}
19
           ${node_treeview_for_set_parent_menu(node_id, new_parent_node.getStaticChildList(), indentation+1)}
20
         </li>
20
         </li>
27
 <%def name="Toolbar(poNode, plNodeStatusList, plRootNodes, psDivId)">
27
 <%def name="Toolbar(poNode, plNodeStatusList, plRootNodes, psDivId)">
28
   <div id="${psDivId}">
28
   <div id="${psDivId}">
29
     <div class="btn-group">
29
     <div class="btn-group">
30
-  % if poNode.parent_id!=None and poNode.parent_id!=0:
31
       ${POD.EditButton('current-document-content-edit-button', True)}
30
       ${POD.EditButton('current-document-content-edit-button', True)}
32
-  % endif
33
       <button class="btn btn-small"  data-toggle="dropdown" href="#"> 
31
       <button class="btn btn-small"  data-toggle="dropdown" href="#"> 
34
         <i class="fa  fa-signal"></i>
32
         <i class="fa  fa-signal"></i>
35
         ${_("Change status")}
33
         ${_("Change status")}
103
       </ul>
101
       </ul>
104
       <a
102
       <a
105
         class="btn btn-small btn-danger"
103
         class="btn btn-small btn-danger"
106
-        href='${tg.url('/api/edit_status?node_id=%i&node_status=%s'%(poNode.node_id, 'deleted'))}'
104
+        href='${tg.url('/api/edit_status', dict(node_id=poNode.node_id, node_status='deleted'))}'
107
         id='current-document-force-delete-button' onclick="return confirm('${_('Delete current document?')}');"
105
         id='current-document-force-delete-button' onclick="return confirm('${_('Delete current document?')}');"
108
         title="${_('Delete')}"
106
         title="${_('Delete')}"
109
         ><i class="fa fa-trash-o"></i></a>
107
         ><i class="fa fa-trash-o"></i></a>
116
     <li>
114
     <li>
117
       <span class="divider"> / Documents /</span>
115
       <span class="divider"> / Documents /</span>
118
     </li>
116
     </li>
119
-    % for breadcrumb_node in poNode.getBreadCrumbNodes():
120
-    <li>
121
-      <a href="${tg.url('/document/%s'%(breadcrumb_node.node_id))}">${breadcrumb_node.getTruncatedLabel(30)}</a>
122
-      <span class="divider">/</span>
123
-    </li>
124
-    % endfor
125
-    <li class="active">${poNode.data_label}</li>
117
+    % if poNode!=None:
118
+      % for breadcrumb_node in poNode.getBreadCrumbNodes():
119
+      <li>
120
+        <a href="${tg.url('/document/%s'%(breadcrumb_node.node_id))}">${breadcrumb_node.getTruncatedLabel(30)}</a>
121
+        <span class="divider">/</span>
122
+      </li>
123
+      % endfor
124
+      <li class="active">${poNode.data_label}</li>
125
+    % endif
126
   </ul>
126
   </ul>
127
 </%def>
127
 </%def>
128
 
128
 
172
   <h3 id="${psId}" title="Document ${poNode.node_id}: ${poNode.data_label}">
172
   <h3 id="${psId}" title="Document ${poNode.node_id}: ${poNode.data_label}">
173
     ${poNode.data_label}
173
     ${poNode.data_label}
174
     <sup class="label ${poNode.getStatus().css}" href="#">
174
     <sup class="label ${poNode.getStatus().css}" href="#">
175
+      <i class="${poNode.getStatus().icon_id}"></i>
175
       ${poNode.getStatus().label}
176
       ${poNode.getStatus().label}
176
     </sup>
177
     </sup>
178
+    
179
+    % if poNode.is_shared==False:
180
+      <sup class="label label-info" title="${_('This document is private')}">
181
+        <i class="fa fa-key"></i>
182
+        ${_('private')}
183
+      </sup>
184
+    % else:
185
+      <sup class="label label-warning" title="${_('This document is collaborative')}">
186
+        <i class="fa fa-group"></i>
187
+        ${_('collaborative')}
188
+      </sup>
189
+    % endif
190
+######
191
+##
192
+## 2014-05-06 - D.A. - The document is not yet internet-sharable
193
+##
194
+##    % if poNode.is_public==True:
195
+##      <sup class="label label-warning" href="#">
196
+##        <i class="fa fa-globe"></i>
197
+##        <span title="${_('This document is published through internet at %s')%poNode.public_url_key}">${_('shared')}</span>
198
+##      </sup>
199
+##    % endif
200
+
177
   </h3>
201
   </h3>
178
 </%def>
202
 </%def>
179
 
203
 
192
   </a>
216
   </a>
193
 </%def>
217
 </%def>
194
 
218
 
219
+
220
+<%def name="FirstTimeFakeDocument()">
221
+  <div id='application-document-panel' class="span5">
222
+    <div id='current-document-content' class="">
223
+      <p class="alert alert-info">
224
+        <i class="fa  fa-smile-o"></i> <strong>${_('Welcome aboard.')}</strong>
225
+      </p>
226
+      <p>
227
+        ${_('It appears you do not have any document yet. We suggest you to start by creating a new document.')}
228
+      </p>
229
+      <p>
230
+        ${_('We suggest you to start by creating a new document.')}
231
+      </p>
232
+      <p class="alert alert-info">
233
+        <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}
234
+      </p>
235
+      <p class="pull-right">
236
+        <a href="#create-new-document-modal-form" role="button" class="btn btn-success" data-toggle="modal">
237
+          <i class="fa fa-plus"></i>
238
+          ${_('Create your first document')}
239
+        </a>
240
+      </p>
241
+  
242
+      ${DocumentEditModalDialog(None, None, tg.url('/api/create_document'), 'create-new-document-modal-form', 'Create your first document')}
243
+    </div>
244
+    <script>
245
+    </script>
246
+  </div>
247
+</%def>
248
+
249
+<%def name="DocumentEditModalDialog(piParentNodeId, poNode, psPostUrl, psModalId, psTitle)">
250
+  <div
251
+    id="${psModalId}"
252
+    class="modal hide"
253
+    tabindex="-1"
254
+    role="dialog"
255
+    aria-labelledby="myModalLabel"
256
+    aria-hidden="true">
257
+    
258
+   <div class="modal-header">
259
+## MODAL HEADER
260
+      <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
261
+      <h3 id="myModalLabel">${psTitle}</h3>
262
+## MODAL HEADER [END]
263
+    </div>
264
+
265
+    <div class="modal-body">
266
+## MODAL BODY
267
+      <form id='${psModalId}-form' method="GET" action="${psPostUrl}">
268
+        <div style="padding: 0.5em 0 0 0">
269
+          % if poNode!=None:
270
+            <input type="hidden" name="node_id" value="${poNode.node_id}"/>
271
+          % endif
272
+          <input type="hidden" name="parent_id" value="${piParentNodeId if piParentNodeId else 0}"/>
273
+          
274
+          <input type="hidden" name="data_content" id="${psModalId}-textarea" />
275
+          <input
276
+            type="text"
277
+            name="data_label"
278
+            value="${poNode.data_label if poNode!=None else ''}"
279
+            class="span4"
280
+            placeholder="${_('document title')}"
281
+          />
282
+        </div>
283
+        <div>
284
+          ${POD.RichTextEditor(psModalId+'-textarea-wysiwyg', poNode.data_content if poNode!=None else '')}
285
+        </div>
286
+      </form>
287
+
288
+## MODAL BODY [END]
289
+    </div>
290
+    
291
+    <div class="modal-footer">
292
+## MODAL FOOTER
293
+      <button class="btn" data-dismiss="modal" aria-hidden="true">
294
+        <i class="fa fa-ban"></i> ${_('Cancel')}
295
+      </button>
296
+      <button class="btn btn-success" id="${psModalId}-form-submit-button">
297
+        <i class="fa fa-check"></i> ${_('Save changes')}
298
+      </button>
299
+## MODAL FOOTER [END]
300
+      <script>
301
+        $('#${psModalId}-form-submit-button').click(function(){
302
+          $('#${psModalId}-textarea-wysiwyg').cleanHtml();
303
+          $('#${psModalId}-textarea').val($('#${psModalId}-textarea-wysiwyg').html());
304
+          $('#${psModalId}-form')[0].submit();
305
+        });
306
+      </script>
307
+    </div>
308
+  </div>
309
+</%def>
310
+
311
+
312
+<%def name="FileEditModalDialog(piParentNodeId, poNode, psPostUrl, psModalId, psTitle)">
313
+  <div
314
+    id="${psModalId}"
315
+    class="modal hide"
316
+    tabindex="-1"
317
+    role="dialog"
318
+    aria-labelledby="myModalLabel"
319
+    aria-hidden="true">
320
+    
321
+   <div class="modal-header">
322
+## MODAL HEADER
323
+      <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
324
+      <h3 id="myModalLabel">${psTitle}</h3>
325
+## MODAL HEADER [END]
326
+    </div>
327
+
328
+    <div class="modal-body">
329
+## MODAL BODY
330
+      <form id='${psModalId}-form' method="POST" action="${psPostUrl}" enctype="multipart/form-data">
331
+          % if poNode!=None:
332
+            <input type="hidden" name="node_id" value="${poNode.node_id}"/>
333
+          % endif
334
+          <input type="hidden" name="parent_id" value="${piParentNodeId if piParentNodeId else 0}"/>
335
+          <input type="hidden" name="data_content" id="${psModalId}-textarea" />
336
+        <div>
337
+          <label>
338
+            ${_('Title')}
339
+            <input
340
+              type="text"
341
+              name="data_label"
342
+              value="${poNode.data_label if poNode!=None else ''}"
343
+              class="span4"
344
+              placeholder="${_('this field is optionnal')}"
345
+            />
346
+          </label>
347
+          <label>
348
+            ${_('Choose a file...')}
349
+            <input type="file" class="span4" placeholder="${_('choose a file...')}" name="data_file"/>
350
+          </label>
351
+          
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
+
359
+## MODAL BODY [END]
360
+    </div>
361
+    
362
+    <div class="modal-footer">
363
+## MODAL FOOTER
364
+      <button class="btn" data-dismiss="modal" aria-hidden="true">
365
+        <i class="fa fa-ban"></i> ${_('Cancel')}
366
+      </button>
367
+      <button class="btn btn-success" id="${psModalId}-form-submit-button">
368
+        <i class="fa fa-check"></i> ${_('Save changes')}
369
+      </button>
370
+## MODAL FOOTER [END]
371
+      <script>
372
+        $('#${psModalId}-form-submit-button').click(function(){
373
+          $('#${psModalId}-textarea-wysiwyg').cleanHtml();
374
+          $('#${psModalId}-textarea').val($('#${psModalId}-textarea-wysiwyg').html());
375
+          $('#${psModalId}-form')[0].submit();
376
+        });
377
+      </script>
378
+    </div>
379
+  </div>
380
+</%def>

+ 73 - 53
pboard/pboard/templates/document.mak View File

1
 <%inherit file="local:templates.master"/>
1
 <%inherit file="local:templates.master"/>
2
 <%namespace name="POD" file="pboard.templates.pod"/>
2
 <%namespace name="POD" file="pboard.templates.pod"/>
3
 <%namespace name="DOC" file="pboard.templates.document-widgets"/>
3
 <%namespace name="DOC" file="pboard.templates.document-widgets"/>
4
+<%namespace name="DOCTABS" file="pboard.templates.document-widgets-tabs"/>
4
 
5
 
5
 <%def name="title()">
6
 <%def name="title()">
6
-pod :: document ${current_node.getTruncatedLabel(40)} [#${current_node.node_id} / ${current_node.getStatus().label}]
7
+  % if current_node!=None:
8
+    pod :: document ${current_node.getTruncatedLabel(40)} [#${current_node.node_id} / ${current_node.getStatus().label}]
9
+  % else:
10
+    pod :: document root
11
+  % endif
7
 </%def>
12
 </%def>
8
 
13
 
9
 <%def name="node_treeview(node_list, indentation=-1)">
14
 <%def name="node_treeview(node_list, indentation=-1)">
10
   % if indentation==-1:
15
   % if indentation==-1:
11
     <div id='pod-menu-item-0' class="pod-toolbar-parent" style="padding-left: 0.5em; position: relative;">
16
     <div id='pod-menu-item-0' class="pod-toolbar-parent" style="padding-left: 0.5em; position: relative;">
12
       <a class="toggle-child-menu-items"><i class='fa fa-folder-open'></i></a>
17
       <a class="toggle-child-menu-items"><i class='fa fa-folder-open'></i></a>
13
-      <a href="?node=0" title="${_('Root')}">
18
+      <a href="${tg.url('/document')}" title="${_('Root')}">
14
         ${_('Root')}
19
         ${_('Root')}
15
       </a>
20
       </a>
16
       <div class="pod-toolbar">
21
       <div class="pod-toolbar">
22
   % else:
27
   % else:
23
     % if len(node_list)>0:
28
     % if len(node_list)>0:
24
       % for node in node_list:
29
       % for node in node_list:
25
-        <div id='pod-menu-item-${node.node_id}' class="pod-toolbar-parent ${'pod-status-active' if node.node_id==current_node.node_id else ''}" style="padding-left: ${(indentation+2)*0.5}em; position: relative;">
30
+        <div id='pod-menu-item-${node.node_id}' class="pod-toolbar-parent ${'pod-status-active' if current_node!=None and node.node_id==current_node.node_id else ''}" style="padding-left: ${(indentation+2)*0.5}em; position: relative;">
26
           <a class="toggle-child-menu-items"><i class='${node.getIconClass()}'></i></a>
31
           <a class="toggle-child-menu-items"><i class='${node.getIconClass()}'></i></a>
27
           <a href="${tg.url('/document/%s'%(node.node_id))}" title="${node.data_label}">
32
           <a href="${tg.url('/document/%s'%(node.node_id))}" title="${node.data_label}">
28
             % if node.getStatus().status_family=='closed' or node.getStatus().status_family=='invisible':
33
             % if node.getStatus().status_family=='closed' or node.getStatus().status_family=='invisible':
80
     </div>
85
     </div>
81
     <div id='application-main-panel' class="span9">
86
     <div id='application-main-panel' class="span9">
82
 
87
 
88
+      % if current_node==None:
89
+        <div class="row">
90
+          ${DOC.FirstTimeFakeDocument()}
91
+        </div>
92
+        
93
+      % else:
83
       <div class="row">
94
       <div class="row">
84
         <div id='application-document-panel' class="span5">
95
         <div id='application-document-panel' class="span5">
85
           <div id='current-document-content' class="">
96
           <div id='current-document-content' class="">
97
         </div>
108
         </div>
98
         <div id='application-metadata-panel' class="span4">
109
         <div id='application-metadata-panel' class="span4">
99
           <div class="tabbable">
110
           <div class="tabbable">
100
-            <ul class="nav nav-tabs" style="margin-bottom: 0.5em;">
111
+            <ul class="nav nav-tabs" style="margin-bottom: 0em;">
101
                 <li>${DOC.MetadataTab('#subdocuments', 'tab', _('Subdocuments'), 'fa-file-text-o', current_node.getChildren())}</li>
112
                 <li>${DOC.MetadataTab('#subdocuments', 'tab', _('Subdocuments'), 'fa-file-text-o', current_node.getChildren())}</li>
102
                 <li class="active">${DOC.MetadataTab('#events', 'tab', _('Calendar'), 'fa-calendar', current_node.getEvents())}</li>
113
                 <li class="active">${DOC.MetadataTab('#events', 'tab', _('Calendar'), 'fa-calendar', current_node.getEvents())}</li>
103
                 <li>${DOC.MetadataTab('#contacts', 'tab', _('Address book'), 'fa-user', current_node.getContacts())}</li>
114
                 <li>${DOC.MetadataTab('#contacts', 'tab', _('Address book'), 'fa-user', current_node.getContacts())}</li>
113
                 ################################
124
                 ################################
114
                 <!-- DEBUG - D.A. - 2013-11-07 - Not using tags for th moment -->
125
                 <!-- DEBUG - D.A. - 2013-11-07 - Not using tags for th moment -->
115
                 <div class="tab-pane" id="subdocuments">
126
                 <div class="tab-pane" id="subdocuments">
116
-                  <p><strong>Sub-documents</strong></p> 
127
+                  <h4>${_('Sub-documents')}</h4>
128
+                  ${DOC.DocumentEditModalDialog(current_node.node_id, None, tg.url('/api/create_document'), 'add-subdocument-modal-%i'%current_node.node_id, _('New Sub-document'))}
129
+                  
117
                 % if len(current_node.getChildren())<=0:
130
                 % if len(current_node.getChildren())<=0:
118
                   <p class="pod-grey">
131
                   <p class="pod-grey">
119
                     ${_("There is currently no child documents.")}<br/>
132
                     ${_("There is currently no child documents.")}<br/>
120
                   </p>
133
                   </p>
121
                   <p>
134
                   <p>
122
-                    
123
-                    <a class="btn btn-success btn-small" href="${tg.url('/api/create_document?parent_id=%i'%current_node.node_id)}">
124
-                      <i class="fa fa-plus"></i> ${_("Add one")}
135
+                    <a href="#add-subdocument-modal-${current_node.node_id}" role="button" class="btn btn-success btn-small" data-toggle="modal">
136
+                      <i class="fa fa-plus"></i>
137
+                      ${_("Add one")}
125
                     </a>
138
                     </a>
126
                   </p>
139
                   </p>
127
                 % else:
140
                 % else:
128
                   <p>
141
                   <p>
129
-                    <a class="btn btn-success btn-small" href="${tg.url('/api/create_document?parent_id=%i'%current_node.node_id)}">
142
+                    <a href="#add-subdocument-modal-${current_node.node_id}" role="button" class="btn btn-success btn-small" data-toggle="modal">
130
                       <i class="fa fa-plus"></i> ${_("Add one")}
143
                       <i class="fa fa-plus"></i> ${_("Add one")}
131
                     </a>
144
                     </a>
132
                   </p>
145
                   </p>
150
                 ##
163
                 ##
151
                 ################################
164
                 ################################
152
                 <div class="tab-pane active" id="events">
165
                 <div class="tab-pane active" id="events">
153
-                  <p><strong>Calendar</strong></p> 
166
+                  <h4>${_('Calendar')}</h4> 
154
                 % if len(current_node.getEvents())<=0:
167
                 % if len(current_node.getEvents())<=0:
155
                   <p class="pod-grey">${_("The calendar is empty.")}<br/></p>
168
                   <p class="pod-grey">${_("The calendar is empty.")}<br/></p>
156
                   <p>${POD.AddButton('current-document-add-event-button', True, _(' Add first event'))}</p>
169
                   <p>${POD.AddButton('current-document-add-event-button', True, _(' Add first event'))}</p>
227
                 ##
240
                 ##
228
                 ##############################
241
                 ##############################
229
                 <div class="tab-pane" id="contacts">
242
                 <div class="tab-pane" id="contacts">
230
-                  <p><strong>${_('Address book')}</strong></p> 
243
+                  <h4>${_('Address book')}</h4> 
231
                 % if len(current_node.getContacts())<=0:
244
                 % if len(current_node.getContacts())<=0:
232
                   <p class="pod-grey">${_("The address book is empty.")}<br/></p>
245
                   <p class="pod-grey">${_("The address book is empty.")}<br/></p>
233
                   <p>${POD.AddButton('current-document-add-contact-button', True, _(' Add first contact'), True)}</p>
246
                   <p>${POD.AddButton('current-document-add-contact-button', True, _(' Add first contact'), True)}</p>
275
                 ## PANEL SHOWING LIST OF COMMENTS
288
                 ## PANEL SHOWING LIST OF COMMENTS
276
                 ##
289
                 ##
277
                 ################################
290
                 ################################
278
-                <div class="tab-pane" id="comments">
279
-                  <p><strong>${_('Comment thread')}</strong></p> 
291
+                <div class="tab-pane" id="comments" style="margin: 0;">
292
+                  <h4>${_('Comment thread')}</h4>
280
                 % if len(current_node.getComments())<=0:
293
                 % if len(current_node.getComments())<=0:
281
                   <p class="pod-grey">${_("The comment thread is empty.")}<br/></p>
294
                   <p class="pod-grey">${_("The comment thread is empty.")}<br/></p>
282
-                  <p>${POD.AddButton('current-document-add-comment-button', True, _('Add first comment'), True)}</p>
283
-                % else:
284
-                  <p>${POD.AddButton('current-document-add-comment-button', True, _('Add a comment'))}</p>
285
                 % endif
295
                 % endif
286
-
287
-                  <!-- ADD COMMENT FORM -->
288
-                  <form style='display: none;' id='current-document-add-comment-form' action='${tg.url('/api/create_comment')}' method='post' class="well">
289
-                    <input type="hidden" name='parent_id' value='${current_node.node_id}'/>
290
-                    <fieldset>
291
-                      <legend>${_('Add a comment')}</legend>
292
-                      <label>
293
-                        <input type="text" name='data_label' placeholder="Title"/>
294
-                      </label>
295
-                      <label>
296
-                        <div>
297
-                          <input type="hidden" id="add_comment_data_content_textarea" name='data_content' />
298
-                          ${POD.RichTextEditor('add_comment_data_content_textarea_wysiwyg', '', 'boldanditalic|undoredo|fullscreen')}
299
-                        </div>
300
-                      </label>
301
-                      ${POD.CancelButton('current-document-add-comment-cancel-button', True)}
302
-                      ${POD.SaveButton('current-document-add-comment-save-button', True)}
303
-                    </fieldset>
304
-                  </form>
305
-
306
                   <!-- LIST OF COMMENTS -->
296
                   <!-- LIST OF COMMENTS -->
307
                 % if len(current_node.getComments())>0:
297
                 % if len(current_node.getComments())>0:
308
-                  <table class="table table-striped table-hover table-condensed">
298
+                  <div>
309
                     % for comment in current_node.getComments():
299
                     % for comment in current_node.getComments():
310
-                      <tr title="Last updated: ${comment.updated_at}">
311
-                        <td>
312
-                          <i>The ${comment.getFormattedDate(comment.updated_at)} at ${comment.getFormattedTime(comment.updated_at)}: </i><br/>
313
-                          <b>${comment.data_label}</b>
314
-                          ## TODO - 2013-11-20 - Use the right form in order to update meta-data
315
-                          <a class="pull-right" href="${tg.url('/document/%i'%comment.node_id)}"><i class="fa fa-edit"></i></a>
316
-                          <br/>
317
-                          <p>
318
-                            ${comment.data_content|n}
319
-                          </p>
320
-                        </td>
321
-                      </tr>
300
+                      <p>
301
+                        <a href="${tg.url('/api/toggle_share_status', dict(node_id=comment.node_id))}">
302
+                          % if comment.is_shared:
303
+                            <span class="label label-warning" title="${_('Shared comment. Click to make private.')}"><i class="fa fa-group"></i></span>
304
+                          % else:
305
+                            <span class="label label-info" title="${_('Private comment. Click to share.')}"><i class="fa fa-key"></i></span>
306
+                          % endif
307
+                        </a>
308
+                        <strong>${comment._oOwner.display_name}</strong>
309
+                        <i class="pull-right">
310
+                          The ${comment.getFormattedDate(comment.updated_at)} 
311
+                          at ${comment.getFormattedTime(comment.updated_at)}
312
+                        </i>
313
+                        <br/>
314
+                        ${comment.data_content|n}
315
+                        <hr style="border-top: 1px dotted #ccc; margin: 0;"/>
316
+                      </p>
322
                     % endfor
317
                     % endfor
323
-                  </table>
318
+                  </div>
324
                 % endif
319
                 % endif
320
+
321
+                  <!-- ADD COMMENT FORM -->
322
+                  <form class="form" id='current-document-add-comment-form' action='${tg.url('/api/create_comment')}' method='post'>
323
+                    <input type="hidden" name='parent_id' value='${current_node.node_id}'/>
324
+                    <input type="hidden" name='data_label' value=""/>
325
+                    <input type="hidden" id="add_comment_data_content_textarea" name='data_content' />
326
+                    ${POD.RichTextEditor('add_comment_data_content_textarea_wysiwyg', '', '')}
327
+                    <label>
328
+                      <input type="checkbox" name='is_shared'/> ${_('Share this comment')}
329
+                    </label>
330
+                    <span class="pull-right">
331
+                      % if len(current_node.getComments())<=0:
332
+                        ${POD.SaveButton('current-document-add-comment-save-button', True, _('Add first comment'))}
333
+                      % else:
334
+                        ${POD.SaveButton('current-document-add-comment-save-button', True, _('Comment'))}
335
+                      % endif
336
+                    </span>
337
+                  </form>
338
+
325
                 </div>
339
                 </div>
326
                 ################################
340
                 ################################
327
                 ##
341
                 ##
329
                 ##
343
                 ##
330
                 ################################
344
                 ################################
331
                 <div class="tab-pane" id="files">
345
                 <div class="tab-pane" id="files">
332
-                  <p><strong>${_('Attachments')}</strong></p> 
346
+                  ${DOCTABS.FilesTabContent(current_node)}
347
+                </div>
348
+
349
+                <div class="tab-pane" id="files">
350
+                  <h4>${_('Attachments')}</h4> 
333
                 % if len(current_node.getFiles())<=0:
351
                 % if len(current_node.getFiles())<=0:
334
                   <p class="pod-grey">${_("There is currently no attachment.")}<br/></p>
352
                   <p class="pod-grey">${_("There is currently no attachment.")}<br/></p>
335
                   <p>${POD.AddButton('current-document-add-file-button', True, _(' Attach first file'))}</p>
353
                   <p>${POD.AddButton('current-document-add-file-button', True, _(' Attach first file'))}</p>
390
                 ## PANEL SHOWING ACCESS MANAGEMENT
408
                 ## PANEL SHOWING ACCESS MANAGEMENT
391
                 ##
409
                 ##
392
                 ################################
410
                 ################################
411
+                
393
                 <div class="tab-pane" id="accessmanagement">
412
                 <div class="tab-pane" id="accessmanagement">
394
-                  blabla
413
+                  ${DOCTABS.AccessManagementTab(current_node)}
395
                 </div>
414
                 </div>
396
               </div>
415
               </div>
397
             </div>
416
             </div>
398
           </div>
417
           </div>
399
         </div>
418
         </div>
400
       </div>
419
       </div>
420
+      % endif
401
     </div>
421
     </div>
402
   </div>
422
   </div>
403
-
423
+</div>

+ 1 - 1
pboard/pboard/templates/master.mak View File

95
             </li>
95
             </li>
96
 
96
 
97
             <li title="Rebuild document index">
97
             <li title="Rebuild document index">
98
-            % if current_node is UNDEFINED:
98
+            % if current_node is UNDEFINED or current_node==None:
99
               <a href="${tg.url('/api/reindex_nodes?back_to_node_id=0')}"><i class="fa fa-refresh"></i></a>
99
               <a href="${tg.url('/api/reindex_nodes?back_to_node_id=0')}"><i class="fa fa-refresh"></i></a>
100
             % else:
100
             % else:
101
               <a href="${tg.url('/api/reindex_nodes?back_to_node_id=%i'%(current_node.node_id))}"><i class="fa fa-refresh"></i></a>
101
               <a href="${tg.url('/api/reindex_nodes?back_to_node_id=%i'%(current_node.node_id))}"><i class="fa fa-refresh"></i></a>

+ 9 - 2
pboard/pboard/templates/pod.mak View File

35
   <button id='${piId}' type="button" class="${psButtonCssClass}" title="${psButtonTitle}"><i class="${psButtonIcon}"></i>${'' if (pbWithLabel==False) else ' %s'%(psButtonLabel)}</button>
35
   <button id='${piId}' type="button" class="${psButtonCssClass}" title="${psButtonTitle}"><i class="${psButtonIcon}"></i>${'' if (pbWithLabel==False) else ' %s'%(psButtonLabel)}</button>
36
 </%def>
36
 </%def>
37
 
37
 
38
-<%def name="SaveButton(piId, pbWithLabel=False)" >
39
-  ${Button(piId, pbWithLabel, 'btn btn-small btn-success', _('Save'), ' icon-g-ok-2 icon-g-white', _('Save'))}
38
+<%def name="SaveButton(piId, pbWithLabel=False, psLabel='Save')" >
39
+## FIXME - Make the default value use _() in order to be translated
40
+  ${Button(piId, pbWithLabel, 'btn btn-small btn-success', psLabel, ' icon-g-ok-2 icon-g-white', psLabel)}
40
 </%def>
41
 </%def>
41
 <%def name="EditButton(piId, pbWithLabel=False)" >
42
 <%def name="EditButton(piId, pbWithLabel=False)" >
42
   ${Button(piId, pbWithLabel, 'btn btn-small', _('Edit'), 'fa fa-edit', _('Edit'))}
43
   ${Button(piId, pbWithLabel, 'btn btn-small', _('Edit'), 'fa fa-edit', _('Edit'))}
51
   ${Button(piId, pbWithLabel, 'btn btn-small', psLabel or _('New'), 'fa fa-plus', psLabel or _('New'))}
52
   ${Button(piId, pbWithLabel, 'btn btn-small', psLabel or _('New'), 'fa fa-plus', psLabel or _('New'))}
52
 % endif
53
 % endif
53
 </%def>
54
 </%def>
55
+<%def name="OpenModalButton(psModalAnchor, psLabel)">
56
+  <a href="#${psModalAnchor}" role="button" class="btn btn-success btn-small" data-toggle="modal">
57
+    <i class="fa fa-plus"></i>${psLabel}
58
+  </a>
59
+</%def>
60
+
54
 <%def name='Badge(psLabel, psCssClass="")'>
61
 <%def name='Badge(psLabel, psCssClass="")'>
55
   <span class='badge ${psCssClass}'>${psLabel}</span>
62
   <span class='badge ${psCssClass}'>${psLabel}</span>
56
 </%def>
63
 </%def>