Browse Source

add event feature + extended menu bar

damien 11 years ago
parent
commit
d2e53c25da

+ 302 - 117
pboard/data/templates/home/daccorsi/sources/protos/pboard/pboard/pboard/templates/dashboard.mak.py View File

@@ -4,13 +4,13 @@ UNDEFINED = runtime.UNDEFINED
4 4
 __M_dict_builtin = dict
5 5
 __M_locals_builtin = locals
6 6
 _magic_number = 9
7
-_modified_time = 1378722899.890202
7
+_modified_time = 1378917566.913937
8 8
 _enable_loop = True
9 9
 _template_filename = '/home/daccorsi/sources/protos/pboard/pboard/pboard/templates/dashboard.mak'
10 10
 _template_uri = '/home/daccorsi/sources/protos/pboard/pboard/pboard/templates/dashboard.mak'
11 11
 _source_encoding = 'utf-8'
12 12
 from markupsafe import escape_silent as escape
13
-_exports = ['node_treeview', 'get_icon_class_from_node_type', 'title', 'node_treeview_in_select_field']
13
+_exports = ['node_treeview', 'title', 'node_treeview_in_select_field', 'node_treeview_for_set_parent_menu']
14 14
 
15 15
 
16 16
 def _mako_get_namespace(context, name):
@@ -20,7 +20,10 @@ def _mako_get_namespace(context, name):
20 20
         _mako_generate_namespaces(context)
21 21
         return context.namespaces[(__name__, name)]
22 22
 def _mako_generate_namespaces(context):
23
-    pass
23
+    # SOURCE LINE 2
24
+    ns = runtime.TemplateNamespace(u'POD', context._clean_inheritance_tokens(), templateuri=u'pboard.templates.pod', callables=None,  calling_uri=_template_uri)
25
+    context.namespaces[(__name__, u'POD')] = ns
26
+
24 27
 def _mako_inherit(template, context):
25 28
     _mako_generate_namespaces(context)
26 29
     return runtime._inherit_from(context, u'local:templates.master', _template_uri)
@@ -28,69 +31,180 @@ def render_body(context,**pageargs):
28 31
     __M_caller = context.caller_stack._push_frame()
29 32
     try:
30 33
         __M_locals = __M_dict_builtin(pageargs=pageargs)
34
+        def node_treeview_for_set_parent_menu(node_id,node_list,indentation=-1):
35
+            return render_node_treeview_for_set_parent_menu(context._locals(__M_locals),node_id,node_list,indentation)
31 36
         root_node_list = context.get('root_node_list', UNDEFINED)
32
-        tg = context.get('tg', UNDEFINED)
37
+        node_status_list = context.get('node_status_list', UNDEFINED)
33 38
         current_node = context.get('current_node', UNDEFINED)
34
-        def node_treeview(node_list,indentation=0):
39
+        def node_treeview(node_list,indentation=-1):
35 40
             return render_node_treeview(context._locals(__M_locals),node_list,indentation)
36
-        def node_treeview_in_select_field(node_list,indentation):
37
-            return render_node_treeview_in_select_field(context._locals(__M_locals),node_list,indentation)
41
+        tg = context.get('tg', UNDEFINED)
42
+        POD = _mako_get_namespace(context, 'POD')
43
+        _ = context.get('_', UNDEFINED)
38 44
         __M_writer = context.writer()
39 45
         # SOURCE LINE 1
40 46
         __M_writer(u'\n')
41
-        # SOURCE LINE 4
47
+        # SOURCE LINE 2
48
+        __M_writer(u'\n\n\n')
49
+        # SOURCE LINE 22
42 50
         __M_writer(u'\n\n')
43
-        # SOURCE LINE 31
51
+        # SOURCE LINE 56
44 52
         __M_writer(u'\n\n')
45
-        # SOURCE LINE 44
53
+        # SOURCE LINE 72
46 54
         __M_writer(u'\n\n')
47
-        # SOURCE LINE 48
48
-        __M_writer(u'\n\n  <div class="row">\n    <div class="span3">\n      <legend>\n        Documents\n      </legend>\n\n      <!-- Button to trigger modal -->\n      <p>\n        <a href="#addFolderNode" role="button" class="btn" data-toggle="modal">\n          <i class="icon-g-circle-plus"></i> Create document</a>\n      </p>\n      <!-- Modal -->\n      <div id="addFolderNode" class="modal hide" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">\n        <div class="modal-header">\n          <button type="button" class="close" data-dismiss="modal" aria-hidden="true">\xd7</button>\n          <h3 id="myModalLabel">Create a new page</h3>\n        </div>\n        <div class="modal-body">\n          <form id="create_document_form" method="POST" action="')
49
-        # SOURCE LINE 68
50
-        __M_writer(escape(tg.url('/create_document')))
51
-        __M_writer(u'" class="form-horizontal">\n            <div class="control-group">\n              <label class="control-label" for="data_label">Title</label>\n              <div class="controls">\n                <input type="text" id="data_label" name="data_label" placeholder="page title...">\n              </div>\n            </div>\n            <div class="control-group">\n              <label class="control-label" for="parent_id">As child of...</label>\n              <div class="controls">\n                <select id="parent_id" name="parent_id" placeholder="as child of...">\n                  ')
52
-        # SOURCE LINE 79
53
-        __M_writer(escape(node_treeview_in_select_field(root_node_list, 0)))
54
-        __M_writer(u'\n                </select>\n              </div>\n            </div>\n            <div class="control-group">\n              <label class="control-label" for="data_content">Description</label>\n              <div class="controls">\n\n                <textarea id="data_content" name="data_content"></textarea>\n              </div>\n            </div>\n          </form>\n        </div>\n        <div class="modal-footer">\n          <button class="btn" data-dismiss="modal" aria-hidden="true">Close</button>\n          <button id="create_document_save_button" class="btn btn-primary">Save changes</button>\n        </div>\n      </div>\n\n      <div>\n        <table class="table table-striped table-hover table-condensed">\n          ')
55
-        # SOURCE LINE 100
55
+        # SOURCE LINE 76
56
+        __M_writer(u'\n\n  <div class="row">\n    <div class="span3">\n      <div class="btn-group">\n        <button class="btn">')
57
+        # SOURCE LINE 81
58
+        __M_writer(escape(_('Documents')))
59
+        __M_writer(u'</button>\n        <button class="btn" title="')
60
+        # SOURCE LINE 82
61
+        __M_writer(escape(_('Show current filtering state')))
62
+        __M_writer(u'"><i class="  icon-g-eye-open"></i></button>\n        \n        <a class="btn dropdown-toggle" data-toggle="dropdown" href="#" title=\'')
63
+        # SOURCE LINE 84
64
+        __M_writer(escape(_('Adjust filtering')))
65
+        __M_writer(u'\'><i class=" icon-g-adjust"></i></a>\n                <ul class="dropdown-menu">\n')
66
+        # SOURCE LINE 86
67
+        for node_status in node_status_list:
68
+            # SOURCE LINE 87
69
+            __M_writer(u'            <li>\n              <a class="')
70
+            # SOURCE LINE 88
71
+            __M_writer(escape(node_status.css))
72
+            __M_writer(u'" href="')
73
+            __M_writer(escape(tg.url('/edit_status?node_id=%i&node_status=%s'%(current_node.node_id, node_status.status_id))))
74
+            __M_writer(u'">\n                <i class="')
75
+            # SOURCE LINE 89
76
+            __M_writer(escape(node_status.icon_id))
77
+            __M_writer(u'"></i> ')
78
+            __M_writer(escape(node_status.label))
79
+            __M_writer(u'\n              </a>\n            </li>\n')
80
+        # SOURCE LINE 93
81
+        __M_writer(u'        </ul>\n      </div>\n      <p></p>\n      <div>\n        ')
82
+        # SOURCE LINE 97
56 83
         __M_writer(escape(node_treeview(root_node_list)))
57
-        __M_writer(u'\n        </table>\n      </div>\n    </div>\n    <div class="span5">\n      <div class="page-header">\n        <h3>')
84
+        __M_writer(u'\n      </div>\n    </div>\n    <div class="span9">\n        \n        \n        \n        <form style=\'display: none;\' id="current-document-title-edit-form" method=\'post\' action=\'')
85
+        # SOURCE LINE 104
86
+        __M_writer(escape(tg.url('/edit_label')))
87
+        __M_writer(u'\'>\n          <div class="input-prepend input-append">\n            <input type=\'hidden\' name=\'node_id\' value=\'')
58 88
         # SOURCE LINE 106
89
+        __M_writer(escape(current_node.node_id))
90
+        __M_writer(u"'/>\n            ")
91
+        # SOURCE LINE 107
92
+        __M_writer(escape(POD.CancelButton('current-document-title-edit-cancel-button')))
93
+        __M_writer(u"\n            <input type='text' name='data_label' value='")
94
+        # SOURCE LINE 108
59 95
         __M_writer(escape(current_node.data_label))
60
-        __M_writer(u'</h3>\n      </div>\n\n      <div class="btn-group">\n        <button class="btn"><i class="icon-g-edit"></i> Edit</button>\n\n      </div>\n\n      <div class="btn-group">\n        <a class="btn btn-primary" href="#"><i class="icon-g-stats icon-g-white"></i> Status</a>\n        <a class="btn btn-primary dropdown-toggle" data-toggle="dropdown" href="#"><span class="caret"></span></a>\n        <ul class="dropdown-menu">\n        \n          \n  \n          <li><a class="btn-success" href="#"><i class="icon-g-sun"></i> Open</a></li>\n          <li><a class="btn-warning" href="#"><i class="icon-g-rotation-lock"></i> in Standby</a></li>\n          <li><a class="btn-danger"  href="#"><i class="icon-g-circle-exclamation-mark"></i> Hot</a></li>\n          <li><a class="btn " href="#"><i class="icon-g-ok"></i> Finished</a></li>\n          <li><a class="btn btn-disabled" href="#"><i class="icon-g-ban"></i> Archived</a></li>\n        </ul>\n\n      </div>\n\n      <div class="btn-group">\n        <a class="btn btn-primary" href="#" ><i class="icon-g-circle-plus icon-g-white"></i> Add</a>\n        <a class="btn btn-primary dropdown-toggle" data-toggle="dropdown" href="#"><span class="caret"></span></a>\n        <ul class="dropdown-menu">\n          <li><a href="#"><i class="icon-g-calendar" ></i> Event</a></li>\n          <li><a href="#"><i class="icon-g-comments"></i> Comment</a></li>\n          <li><a href="#"><i class="icon-g-user"></i> Contact</a></li>\n          <li><a href="#"><i class="icon-g-attach"></i> File</a></li>\n        </ul>\n      </div>\n\n      <div class="btn-group">\n        <button class="btn btn-danger"><i class="icon-g-white icon-g-remove"></i> Delete</button>\n      </div>\n      \n    \n      <div>\n        ')
61
-        # SOURCE LINE 147
96
+        __M_writer(u'\' class="span2" />\n            ')
97
+        # SOURCE LINE 109
98
+        __M_writer(escape(POD.SaveButton('current-document-title-save-cancel-button')))
99
+        __M_writer(u'\n          </div>\n        </form>\n\n\n      <div class="btn-group">\n        <button class="btn">Status</button>\n        <a class="btn ')
100
+        # SOURCE LINE 116
101
+        __M_writer(escape(current_node.getStatus().css))
102
+        __M_writer(u'" href="#"><i class="')
103
+        __M_writer(escape(current_node.getStatus().icon))
104
+        __M_writer(u'"></i> ')
105
+        __M_writer(escape(current_node.getStatus().getLabel()))
106
+        __M_writer(u'</a>\n        <a class="btn ')
107
+        # SOURCE LINE 117
108
+        __M_writer(escape(current_node.getStatus().css))
109
+        __M_writer(u' dropdown-toggle" data-toggle="dropdown" href="#"><span class="caret"></span></a>\n        <ul class="dropdown-menu">\n')
110
+        # SOURCE LINE 119
111
+        for node_status in node_status_list:
112
+            # SOURCE LINE 120
113
+            __M_writer(u'            <li>\n              <a class="')
114
+            # SOURCE LINE 121
115
+            __M_writer(escape(node_status.css))
116
+            __M_writer(u'" href="')
117
+            __M_writer(escape(tg.url('/edit_status?node_id=%i&node_status=%s'%(current_node.node_id, node_status.status_id))))
118
+            __M_writer(u'">\n                <i class="')
119
+            # SOURCE LINE 122
120
+            __M_writer(escape(node_status.icon_id))
121
+            __M_writer(u'"></i> ')
122
+            __M_writer(escape(node_status.label))
123
+            __M_writer(u'\n              </a>\n            </li>\n')
124
+        # SOURCE LINE 126
125
+        __M_writer(u'        </ul>\n      </div>\n      <div class="btn-group">\n        ')
126
+        # SOURCE LINE 129
127
+        __M_writer(escape(POD.EditButton('current-document-content-edit-button', True)))
128
+        __M_writer(u'\n        <a class="btn" href="#" data-toggle="dropdown"><i class="icon-g-move"></i> ')
129
+        # SOURCE LINE 130
130
+        __M_writer(escape(_('Move to')))
131
+        __M_writer(u' <span class="caret"></span></a>\n        <ul class="dropdown-menu">\n          ')
132
+        # SOURCE LINE 132
133
+        __M_writer(escape(node_treeview_for_set_parent_menu(current_node.node_id, root_node_list)))
134
+        __M_writer(u"\n        </ul>\n\n\n        <a href='")
135
+        # SOURCE LINE 136
136
+        __M_writer(escape(tg.url('/force_delete_node?node_id=%i'%(current_node.node_id))))
137
+        __M_writer(u'\' id=\'current-document-force-delete-button\' class="btn" onclick="return confirm(\'')
138
+        __M_writer(escape(_('Delete current document?')))
139
+        __M_writer(u'\');"><i class="icon-g-remove"></i> ')
140
+        __M_writer(escape(_('Delete')))
141
+        __M_writer(u'</a>\n      </div>\n      \n            <!--</div> PAGE HEADER -->\n      <h3 id="current-document-title">')
142
+        # SOURCE LINE 140
143
+        __M_writer(escape(current_node.data_label))
144
+        __M_writer(u'</h3>\n</div>\n      <div class="span5">\n      \n      <p>\n        <div id=\'current-document-content\' class="">\n          ')
145
+        # SOURCE LINE 146
146
+        __M_writer(current_node.data_content)
147
+        __M_writer(u'\n        </div>\n        <form style=\'display: none;\' id="current-document-content-edit-form" method=\'post\' action=\'')
148
+        # SOURCE LINE 148
149
+        __M_writer(escape(tg.url('/edit_content')))
150
+        __M_writer(u"'>\n          <input type='hidden' name='node_id' value='")
151
+        # SOURCE LINE 149
152
+        __M_writer(escape(current_node.node_id))
153
+        __M_writer(u'\'/>\n          <textarea id="current_node_textarea" name=\'data_content\' spellcheck="false" wrap="off" autofocus placeholder="Enter something ...">\n            ')
154
+        # SOURCE LINE 151
62 155
         __M_writer(current_node.data_content)
63
-        __M_writer(u'\n      </div>\n    </div>\n    <div class="span4">\n      <div class="tabbable">\n        <ul class="nav nav-tabs">\n            <li class="active">\n              <a href="#events" data-toggle="tab" title="History"><i class="icon-g-calendar"></i></a>\n            </li>\n            <li><a href="#contacts" data-toggle="tab" title="Contacts"><i class="icon-g-user""></i> </a></li>\n            <li><a href="#comments" data-toggle="tab" title="Comments"><i class="icon-g-comments"></i> </a></li>\n            <li><a href="#files" data-toggle="tab" title="Files"><i class="icon-g-attach"></i> </a></li>\n        </ul>\n        <div class="tab-content">\n            <div class="tab-pane active" id="events">\n              <!--p class="text-right" >\n                <button class="text-right btn btn-info " type="button"><i class="icon-g-plus icon-g-white"></i> new event</button>\n              </p-->\n              <table class="table table-striped table-hover table-condensed">\n                <thead>\n                  <tr>\n                    <th>Date</th>\n                    <th>Time</th>\n                    <th>\n                      Event\n                    </th>\n                    <th>\n                      <a href="" title="Add an event"><i class="icon-g-plus"></i></a>\n                    </th>\n                  </tr>\n                </thead>\n')
64
-        # SOURCE LINE 178
156
+        __M_writer(u'\n          </textarea>\n          ')
157
+        # SOURCE LINE 153
158
+        __M_writer(escape(POD.CancelButton('current-document-content-edit-cancel-button', True)))
159
+        __M_writer(u'\n          ')
160
+        # SOURCE LINE 154
161
+        __M_writer(escape(POD.SaveButton('current-document-content-edit-save-button', True)))
162
+        __M_writer(u'\n        </form>\n      </p>\n    </div>\n    <div class="span4">\n      <div class="tabbable">\n        <ul class="nav nav-tabs">\n            <li class="active">\n              <a href="#events" data-toggle="tab" title="History"><i class="icon-g-history"></i></a>\n            </li>\n            <li><a href="#contacts" data-toggle="tab" title="Contacts"><i class="icon-g-phone""></i> </a></li>\n            <li><a href="#comments" data-toggle="tab" title="Comments"><i class="icon-g-comments"></i> </a></li>\n            <li><a href="#files" data-toggle="tab" title="Files"><i class="icon-g-attach"></i> </a></li>\n            <li><a href="#contacts" data-toggle="tab" title="Users"><i class="icon-g-user""></i> </a></li>\n        </ul>\n        <div class="tab-content">\n            <div class="tab-pane active" id="events">\n\n')
163
+        # SOURCE LINE 172
164
+        __M_writer(escape(POD.AddButton('current-document-add-event-button', True, _(' Add event'))))
165
+        __M_writer(u"\n<form style='display: none;' id='current-document-add-event-form' action='")
166
+        # SOURCE LINE 173
167
+        __M_writer(escape(tg.url('/api/create_event')))
168
+        __M_writer(u'\' method=\'post\' class="well">\n  <input type="hidden" name=\'parent_id\' value=\'')
169
+        # SOURCE LINE 174
170
+        __M_writer(escape(current_node.node_id))
171
+        __M_writer(u'\'/>\n  <fieldset>\n    <legend>Add an event</legend>\n    <label>\n      <input type="text" name=\'data_label\' placeholder="Event"/>\n    </label>\n    <label>\n      <div class="datetime-picker-input-div input-append date">\n        <input name=\'data_datetime\' data-format="dd/MM/yyyy hh:mm" type="text" placeholder="date and time"/>\n        <span class="add-on"><i data-time-icon="icon-g-clock" data-date-icon="icon-g-calendar"></i></span>\n      </div>\n    </label>\n    <label class="checkbox">\n      <input disabled name=\'add_reminder\' type="checkbox"> add a reminder\n    </label>\n    <label>\n      <div class="datetime-picker-input-div input-append date">\n        <input disabled name=\'data_reminder_datetime\' data-format="dd/MM/yyyy hh:mm" type="text" placeholder="date and time"/>\n        <span class="add-on"><i data-time-icon="icon-g-clock" data-date-icon="icon-g-calendar"></i></span>\n      </div>\n    </label>\n\n    ')
172
+        # SOURCE LINE 196
173
+        __M_writer(escape(POD.CancelButton('current-document-add-event-cancel-button', True)))
174
+        __M_writer(u'\n    ')
175
+        # SOURCE LINE 197
176
+        __M_writer(escape(POD.SaveButton('current-document-add-event-save-button', True)))
177
+        __M_writer(u'\n  </fieldset>\n</form>\n\n              <table class="table table-striped table-hover table-condensed">\n                <thead>\n                  <tr>\n                    <th>Date</th>\n                    <th>Time</th>\n                    <th>\n                      Event\n                    </th>\n                    <th>\n                      <a href="" title="Add an event"><i class="icon-g-plus"></i></a>\n                    </th>\n                  </tr>\n                </thead>\n')
178
+        # SOURCE LINE 214
65 179
         for event in current_node.getEvents():
66
-            # SOURCE LINE 179
180
+            # SOURCE LINE 215
67 181
             __M_writer(u'                <tr title="Last updated: ')
68 182
             __M_writer(escape(event.updated_at))
69 183
             __M_writer(u'">\n                   <td>')
70
-            # SOURCE LINE 180
184
+            # SOURCE LINE 216
71 185
             __M_writer(escape(event.getFormattedDate(event.data_datetime)))
72 186
             __M_writer(u'</td>\n                   <td>')
73
-            # SOURCE LINE 181
187
+            # SOURCE LINE 217
74 188
             __M_writer(escape(event.getFormattedTime(event.data_datetime)))
75 189
             __M_writer(u'</td>\n                   <td>')
76
-            # SOURCE LINE 182
190
+            # SOURCE LINE 218
77 191
             __M_writer(escape(event.data_label))
78 192
             __M_writer(u'</td>\n                   <td>\n                     <a href=""><i class="icon-g-edit"></i></a>\n                   </td>\n                </tr>\n')
79
-        # SOURCE LINE 188
193
+        # SOURCE LINE 224
80 194
         __M_writer(u'              </table>\n            </div>\n            <div class="tab-pane" id="contacts">\n')
81
-        # SOURCE LINE 191
195
+        # SOURCE LINE 227
82 196
         for contact in current_node.getContacts():
83
-            # SOURCE LINE 192
197
+            # SOURCE LINE 228
84 198
             __M_writer(u'                <div class="well">\n                  <legend class="text-info">')
85
-            # SOURCE LINE 193
199
+            # SOURCE LINE 229
86 200
             __M_writer(escape(contact.data_label))
87 201
             __M_writer(u'</legend>\n                  <div>')
88
-            # SOURCE LINE 194
202
+            # SOURCE LINE 230
89 203
             __M_writer(contact.data_content)
90 204
             __M_writer(u'</div>\n                </div>\n')
91
-        # SOURCE LINE 197
205
+        # SOURCE LINE 233
92 206
         __M_writer(u'            </div>\n            <div class="tab-pane" id="comments">')
93
-        # SOURCE LINE 198
207
+        # SOURCE LINE 234
94 208
         __M_writer(current_node.data_content)
95 209
         __M_writer(u'</div>\n            <div class="tab-pane" id="files">Files</div>\n        </div>\n      </div>\n    </div>\n  </div>\n\n')
96 210
         return ''
@@ -98,75 +212,81 @@ def render_body(context,**pageargs):
98 212
         context.caller_stack._pop_frame()
99 213
 
100 214
 
101
-def render_node_treeview(context,node_list,indentation=0):
215
+def render_node_treeview(context,node_list,indentation=-1):
102 216
     __M_caller = context.caller_stack._push_frame()
103 217
     try:
104
-        def node_treeview(node_list,indentation=0):
218
+        def node_treeview(node_list,indentation=-1):
105 219
             return render_node_treeview(context,node_list,indentation)
106 220
         len = context.get('len', UNDEFINED)
221
+        _ = context.get('_', UNDEFINED)
107 222
         tg = context.get('tg', UNDEFINED)
108 223
         __M_writer = context.writer()
109
-        # SOURCE LINE 6
224
+        # SOURCE LINE 24
110 225
         __M_writer(u'\n')
111
-        # SOURCE LINE 7
112
-        if len(node_list)>0:
113
-            # SOURCE LINE 8
114
-            __M_writer(u'    <!--ul style="list-style:none; margin-left: ')
115
-            __M_writer(escape((indentation+1)*0.5))
116
-            __M_writer(u'em;"-->\n')
117
-            # SOURCE LINE 9
118
-            for node in node_list:
119
-                # SOURCE LINE 10
120
-                __M_writer(u'      <tr title="Last updated: ')
121
-                __M_writer(escape(node.updated_at))
122
-                __M_writer(u'">\n        <td style="padding-left: ')
123
-                # SOURCE LINE 11
124
-                __M_writer(escape((indentation+1)*0.5))
125
-                __M_writer(u'em;">\n          <a href="?node=')
126
-                # SOURCE LINE 12
127
-                __M_writer(escape(node.node_id))
128
-                __M_writer(u'" title="')
129
-                __M_writer(escape(node.data_label))
130
-                __M_writer(u'">\n            <i class=\'')
131
-                # SOURCE LINE 13
132
-                __M_writer(escape(node.getIconClass()))
133
-                __M_writer(u"'></i>\n")
134
-                # SOURCE LINE 14
135
-                if len(node.data_label)<=15:
136
-                    # SOURCE LINE 15
137
-                    __M_writer(u'              ')
226
+        # SOURCE LINE 25
227
+        if indentation==-1:
228
+            # SOURCE LINE 26
229
+            __M_writer(u'    <div class="pod-toolbar-parent" style="padding-left: 0.5em; position: relative;">\n      <a href="?node=0" title="')
230
+            # SOURCE LINE 27
231
+            __M_writer(escape(_('Root')))
232
+            __M_writer(u'">\n        <i class=\'icon-g-folder-open\'></i>\n        ')
233
+            # SOURCE LINE 29
234
+            __M_writer(escape(_('Root')))
235
+            __M_writer(u'\n      </a>\n      <div class="pod-toolbar">\n        <a href="')
236
+            # SOURCE LINE 32
237
+            __M_writer(escape(tg.url('/create_document?parent_id=0')))
238
+            __M_writer(u'" title="')
239
+            __M_writer(escape(_('Add child document')))
240
+            __M_writer(u'"><i class="icon-g-circle-plus"></i></a>\n      </div>\n    </div>\n    ')
241
+            # SOURCE LINE 35
242
+            __M_writer(escape(node_treeview(node_list, 0)))
243
+            __M_writer(u'\n')
244
+            # SOURCE LINE 36
245
+        else:
246
+            # SOURCE LINE 37
247
+            if len(node_list)>0:
248
+                # SOURCE LINE 38
249
+                for node in node_list:
250
+                    # SOURCE LINE 39
251
+                    __M_writer(u'        <div class="pod-toolbar-parent" style="padding-left: ')
252
+                    __M_writer(escape((indentation+2)*0.5))
253
+                    __M_writer(u'em; position: relative;">\n          <a href="?node=')
254
+                    # SOURCE LINE 40
255
+                    __M_writer(escape(node.node_id))
256
+                    __M_writer(u'" title="')
138 257
                     __M_writer(escape(node.data_label))
258
+                    __M_writer(u'">\n            <i class=\'')
259
+                    # SOURCE LINE 41
260
+                    __M_writer(escape(node.getIconClass()))
261
+                    __M_writer(u"'></i> ")
262
+                    __M_writer(escape(node.getTruncatedLabel(32-0.8*(indentation+1))))
263
+                    __M_writer(u'\n          </a>\n          <div class="pod-toolbar">\n            <a href="')
264
+                    # SOURCE LINE 44
265
+                    __M_writer(escape(tg.url('/move_node_upper?node_id=%i'%(node.node_id))))
266
+                    __M_writer(u'" title="')
267
+                    __M_writer(escape(_('Move up')))
268
+                    __M_writer(u'"><i class="icon-g-up-arrow"></i></a>\n            <a href="')
269
+                    # SOURCE LINE 45
270
+                    __M_writer(escape(tg.url('/move_node_lower?node_id=%i'%(node.node_id))))
271
+                    __M_writer(u'" title="')
272
+                    __M_writer(escape(_('Move down')))
273
+                    __M_writer(u'"><i class="icon-g-down-arrow"></i></a>\n            <a href="')
274
+                    # SOURCE LINE 46
275
+                    __M_writer(escape(tg.url('/create_document?parent_id=%i'%(node.node_id))))
276
+                    __M_writer(u'" title="')
277
+                    __M_writer(escape(_('Add child document')))
278
+                    __M_writer(u'"><i class="icon-g-circle-plus"></i></a>\n          </div>\n          <div class="pod-status ')
279
+                    # SOURCE LINE 48
280
+                    __M_writer(escape(node.getStatus().css))
281
+                    __M_writer(u'" title=\'')
282
+                    __M_writer(escape(node.getStatus().label))
283
+                    __M_writer(u"'>\n             <i class='")
284
+                    # SOURCE LINE 49
285
+                    __M_writer(escape(node.getStatus().icon))
286
+                    __M_writer(u"'></i>\n          </div>\n        </div>\n        ")
287
+                    # SOURCE LINE 52
288
+                    __M_writer(escape(node_treeview(node.getChildren(), indentation+1)))
139 289
                     __M_writer(u'\n')
140
-                    # SOURCE LINE 16
141
-                else:
142
-                    # SOURCE LINE 17
143
-                    __M_writer(u'              ')
144
-                    __M_writer(escape(node.data_label[0:15]))
145
-                    __M_writer(u'...\n')
146
-                # SOURCE LINE 19
147
-                __M_writer(u'          </a>\n        </td>\n        <td class="text-right">\n          <a href="')
148
-                # SOURCE LINE 22
149
-                __M_writer(escape(tg.url('/move_node_upper?node_id=%i'%(node.node_id))))
150
-                __M_writer(u'" title="Move up"><i class=" icon-g-up-arrow"></i></a>\n          <a href="')
151
-                # SOURCE LINE 23
152
-                __M_writer(escape(tg.url('/move_node_lower?node_id=%i'%(node.node_id))))
153
-                __M_writer(u'" title="Move down"><i class=" icon-g-down-arrow"></i></a>\n          <a href="" title="Edit"><i class="icon-g-edit"></i></a>\n        </td>\n      </tr>\n      ')
154
-                # SOURCE LINE 27
155
-                __M_writer(escape(node_treeview(node.getChildren(), indentation+1)))
156
-                __M_writer(u'\n')
157
-            # SOURCE LINE 29
158
-            __M_writer(u'    <!--/ul-->\n')
159
-        return ''
160
-    finally:
161
-        context.caller_stack._pop_frame()
162
-
163
-
164
-def render_get_icon_class_from_node_type(context,node_type):
165
-    __M_caller = context.caller_stack._push_frame()
166
-    try:
167
-        __M_writer = context.writer()
168
-        # SOURCE LINE 2
169
-        __M_writer(u'\n\n')
170 290
         return ''
171 291
     finally:
172 292
         context.caller_stack._pop_frame()
@@ -175,46 +295,111 @@ def render_get_icon_class_from_node_type(context,node_type):
175 295
 def render_title(context):
176 296
     __M_caller = context.caller_stack._push_frame()
177 297
     try:
298
+        current_node = context.get('current_node', UNDEFINED)
178 299
         __M_writer = context.writer()
179
-        # SOURCE LINE 46
180
-        __M_writer(u'\nLearning TurboGears 2.3: Quick guide to the Quickstart pages.\n')
300
+        # SOURCE LINE 74
301
+        __M_writer(u'\nPOD :: ')
302
+        # SOURCE LINE 75
303
+        __M_writer(escape(current_node.getTruncatedLabel(40)))
304
+        __M_writer(u' [')
305
+        __M_writer(escape(current_node.getStatus().label))
306
+        __M_writer(u']\n')
181 307
         return ''
182 308
     finally:
183 309
         context.caller_stack._pop_frame()
184 310
 
185 311
 
186
-def render_node_treeview_in_select_field(context,node_list,indentation):
312
+def render_node_treeview_in_select_field(context,node_list,indentation,selected_id=0):
187 313
     __M_caller = context.caller_stack._push_frame()
188 314
     try:
189
-        def node_treeview_in_select_field(node_list,indentation):
190
-            return render_node_treeview_in_select_field(context,node_list,indentation)
315
+        def node_treeview_in_select_field(node_list,indentation,selected_id=0):
316
+            return render_node_treeview_in_select_field(context,node_list,indentation,selected_id)
191 317
         len = context.get('len', UNDEFINED)
192 318
         __M_writer = context.writer()
193
-        # SOURCE LINE 33
319
+        # SOURCE LINE 58
194 320
         __M_writer(u'\n')
195
-        # SOURCE LINE 34
321
+        # SOURCE LINE 59
196 322
         if len(node_list)>0:
197
-            # SOURCE LINE 35
323
+            # SOURCE LINE 60
198 324
             if indentation==0:
199
-                # SOURCE LINE 36
325
+                # SOURCE LINE 61
200 326
                 __M_writer(u'        <option style="margin-left: ')
201 327
                 __M_writer(escape(0.5*indentation))
202 328
                 __M_writer(u'em; color: #CCC;" value="0">no parent...</option>\n')
203
-            # SOURCE LINE 38
329
+            # SOURCE LINE 63
204 330
             for node in node_list:
205
-                # SOURCE LINE 39
206
-                __M_writer(u'        <option style="margin-left: ')
207
-                __M_writer(escape(0.5*indentation))
208
-                __M_writer(u'em;" value="')
209
-                __M_writer(escape(node.node_id))
210
-                __M_writer(u'">')
211
-                __M_writer(escape(node.data_label))
212
-                __M_writer(u'</option>\n        ')
213
-                # SOURCE LINE 40
214
-                __M_writer(escape(node_treeview_in_select_field(node.getChildren(), indentation+1)))
331
+                # SOURCE LINE 64
332
+                if selected_id!=node.node_id:
333
+                    # SOURCE LINE 65
334
+                    __M_writer(u'          <option style="margin-left: ')
335
+                    __M_writer(escape(0.5*indentation))
336
+                    __M_writer(u'em;" value="')
337
+                    __M_writer(escape(node.node_id))
338
+                    __M_writer(u'">')
339
+                    __M_writer(escape(node.data_label))
340
+                    __M_writer(u'</option>\n')
341
+                    # SOURCE LINE 66
342
+                else:
343
+                    # SOURCE LINE 67
344
+                    __M_writer(u'          <option style="margin-left: ')
345
+                    __M_writer(escape(0.5*indentation))
346
+                    __M_writer(u'em;" value="')
347
+                    __M_writer(escape(node.node_id))
348
+                    __M_writer(u'" selected>')
349
+                    __M_writer(escape(node.data_label))
350
+                    __M_writer(u'</option>\n')
351
+                # SOURCE LINE 69
352
+                __M_writer(u'        ')
353
+                __M_writer(escape(node_treeview_in_select_field(node.getChildren(), indentation+1, selected_id)))
215 354
                 __M_writer(u'\n')
216
-            # SOURCE LINE 42
217
-            __M_writer(u'      </ul>\n')
355
+        return ''
356
+    finally:
357
+        context.caller_stack._pop_frame()
358
+
359
+
360
+def render_node_treeview_for_set_parent_menu(context,node_id,node_list,indentation=-1):
361
+    __M_caller = context.caller_stack._push_frame()
362
+    try:
363
+        tg = context.get('tg', UNDEFINED)
364
+        current_node = context.get('current_node', UNDEFINED)
365
+        len = context.get('len', UNDEFINED)
366
+        _ = context.get('_', UNDEFINED)
367
+        def node_treeview_for_set_parent_menu(node_id,node_list,indentation=-1):
368
+            return render_node_treeview_for_set_parent_menu(context,node_id,node_list,indentation)
369
+        __M_writer = context.writer()
370
+        # SOURCE LINE 5
371
+        __M_writer(u'\n')
372
+        # SOURCE LINE 6
373
+        if indentation==-1:
374
+            # SOURCE LINE 7
375
+            __M_writer(u'    <li><a href="')
376
+            __M_writer(escape(tg.url('/api/set_parent_node?node_id=%i&new_parent_id=0'%(current_node.node_id))))
377
+            __M_writer(u'">')
378
+            __M_writer(escape(_('Root')))
379
+            __M_writer(u'</a>\n      ')
380
+            # SOURCE LINE 8
381
+            __M_writer(escape(node_treeview_for_set_parent_menu(node_id, node_list, 0)))
382
+            __M_writer(u'\n    </li>\n')
383
+            # SOURCE LINE 10
384
+        else:
385
+            # SOURCE LINE 11
386
+            if len(node_list)>0:
387
+                # SOURCE LINE 12
388
+                __M_writer(u'      <ul>\n')
389
+                # SOURCE LINE 13
390
+                for new_parent_node in node_list:
391
+                    # SOURCE LINE 14
392
+                    __M_writer(u'        <li>\n          <a href="')
393
+                    # SOURCE LINE 15
394
+                    __M_writer(escape(tg.url('/api/set_parent_node?node_id=%i&new_parent_id=%i'%(node_id, new_parent_node.node_id))))
395
+                    __M_writer(u'">')
396
+                    __M_writer(escape(new_parent_node.getTruncatedLabel(40-indentation*2)))
397
+                    __M_writer(u'</a>\n          ')
398
+                    # SOURCE LINE 16
399
+                    __M_writer(escape(node_treeview_for_set_parent_menu(node_id, new_parent_node.getChildren(), indentation+1)))
400
+                    __M_writer(u'\n        </li>\n')
401
+                # SOURCE LINE 19
402
+                __M_writer(u'      </ul>\n')
218 403
         return ''
219 404
     finally:
220 405
         context.caller_stack._pop_frame()

File diff suppressed because it is too large
+ 49 - 46
pboard/data/templates/home/daccorsi/sources/protos/pboard/pboard/pboard/templates/master.mak.py


+ 51 - 0
pboard/pboard/controllers/api.py View File

@@ -0,0 +1,51 @@
1
+# -*- coding: utf-8 -*-
2
+"""Sample controller with all its actions protected."""
3
+from tg import expose, flash, require, url, lurl, request, redirect, tmpl_context
4
+from tg.i18n import ugettext as _, lazy_ugettext as l_
5
+from tg import predicates
6
+
7
+
8
+from pboard.lib.base import BaseController
9
+from pboard.lib   import dbapi as pld
10
+from pboard.model import data as pmd
11
+from pboard import model as pm
12
+
13
+__all__ = ['PODApiController']
14
+
15
+class PODApiController(BaseController):
16
+    """Sample controller-wide authorization"""
17
+    
18
+    # The predicate that must be met for all the actions in this controller:
19
+    # allow_only = has_permission('manage',
20
+    #                             msg=l_('Only for people with the "manage" permission'))
21
+    
22
+    @expose('pboard.templates.index')
23
+    def index(self):
24
+        """Let the user know that's visiting a protected controller."""
25
+        flash(_("Secure Controller here"))
26
+        return dict(page='index')
27
+    
28
+    @expose()
29
+    def create_event(self, parent_id=None, data_label=u'',data_datetime=None,data_reminder_datetime=None,add_reminder=False, **kw):
30
+
31
+      loNewNode = pld.createNode()
32
+      loNewNode.parent_id     = int(parent_id)
33
+      loNewNode.node_type     = pmd.PBNodeType.Event
34
+      loNewNode.data_label    = data_label
35
+      loNewNode.data_content  = ''
36
+      loNewNode.data_datetime = data_datetime
37
+      if add_reminder:
38
+        loNewNode.data_reminder_datetime = data_reminder_datetime
39
+
40
+      pm.DBSession.flush()
41
+      redirect(lurl('/dashboard?node=%i'%(loNewNode.parent_id)))
42
+
43
+    @expose()
44
+    def set_parent_node(self, node_id, new_parent_id, **kw):
45
+      loNewNode = pld.getNode(node_id)
46
+      if new_parent_id!='':
47
+        loNewNode.parent_id = int(new_parent_id)
48
+      pm.DBSession.flush()
49
+      redirect(lurl('/dashboard?node=%s'%(node_id)))
50
+
51
+

+ 16 - 2
pboard/pboard/controllers/root.py View File

@@ -14,7 +14,10 @@ from pboard.lib.base import BaseController
14 14
 from pboard.controllers.error import ErrorController
15 15
 
16 16
 import pboard.model as pbm
17
+import pboard.controllers as pbc
17 18
 from pboard.lib import dbapi as pld
19
+from pboard.controllers import api as pbca
20
+
18 21
 __all__ = ['RootController']
19 22
 
20 23
 
@@ -37,6 +40,8 @@ class RootController(BaseController):
37 40
 
38 41
     error = ErrorController()
39 42
 
43
+    api = pbca.PODApiController()
44
+    
40 45
     def _before(self, *args, **kw):
41 46
         tmpl_context.project_name = "pboard"
42 47
 
@@ -122,7 +127,8 @@ class RootController(BaseController):
122 127
         print "{{{{{{{{{{{{{{{{{{{{}}}}}}}}}}}}}}}}}}}}", liNodeId
123 128
         # liNodeId = 5
124 129
         loCurrentNode    = pbm.DBSession.query(pbmd.PBNode).filter(pbmd.PBNode.node_id==liNodeId).one()
125
-        return dict(root_node_list=loRootNodeList, current_node=loCurrentNode)
130
+        loNodeStatusList = pbmd.PBNodeStatus.getList()
131
+        return dict(root_node_list=loRootNodeList, current_node=loCurrentNode, node_status_list = loNodeStatusList)
126 132
 
127 133
     @expose()
128 134
     def move_node_upper(self, node_id=0, came_from=lurl('/dashboard')):
@@ -156,6 +162,12 @@ class RootController(BaseController):
156 162
       redirect(lurl('/dashboard?node=%s'%(node_id)))
157 163
 
158 164
     @expose()
165
+    def edit_status(self, node_id, node_status):
166
+      loNewNode = pld.getNode(node_id)
167
+      loNewNode.node_status = node_status
168
+      redirect(lurl('/dashboard?node=%s'%(node_id)))
169
+
170
+    @expose()
159 171
     def edit_content(self, node_id, data_content, **kw):
160 172
       loNewNode = pld.getNode(node_id)
161 173
       loNewNode.data_content = data_content
@@ -167,5 +179,7 @@ class RootController(BaseController):
167 179
       liParentId = loNode.parent_id
168 180
       if loNode.getChildNb()<=0:
169 181
         DBSession.delete(loNode)
170
-      redirect(lurl('/dashboard?node=%i'%(liParentId)))
182
+      redirect(lurl('/dashboard?node=%i'%(liParentId or 0)))
183
+
184
+
171 185
 

+ 59 - 14
pboard/pboard/model/data.py View File

@@ -19,7 +19,7 @@ pb_node_table = Table('pb_nodes', metadata,
19 19
     Column('parent_id', Integer, ForeignKey('pb_nodes.node_id'), nullable=True, default=None),
20 20
     Column('node_order', Integer, nullable=True, default=1),
21 21
     Column('node_type',   Unicode(16), unique=False, nullable=False, default=u'data'),
22
-    Column('node_status', Unicode(16), unique=False, nullable=False, default=u'open'),
22
+    Column('node_status', Unicode(16), unique=False, nullable=False, default=u'new'),
23 23
 
24 24
     Column('created_at', DateTime, unique=False, nullable=False),
25 25
     Column('updated_at', DateTime, unique=False, nullable=False),
@@ -27,6 +27,7 @@ pb_node_table = Table('pb_nodes', metadata,
27 27
     Column('data_label',   Unicode(1024), unique=False, nullable=False, default=u''),
28 28
     Column('data_content', Text(), unique=False, nullable=False, default=u''),
29 29
     Column('data_datetime', DateTime, unique=False, nullable=False),
30
+    Column('data_reminder_datetime', DateTime, unique=False, nullable=True),
30 31
 )
31 32
 """
32 33
 - node_type
@@ -41,38 +42,73 @@ pb_node_table = Table('pb_nodes', metadata,
41 42
 """
42 43
 
43 44
 class PBNodeStatusItem(object):
44
-  def __init__(self, psStatusId, psStatusLabel, psStatusFamily, psForegroundColor): #, psBackgroundColor):
45
+  def __init__(self, psStatusId, psStatusLabel, psStatusFamily, psIconId, psCssClass): #, psBackgroundColor):
45 46
     self._sStatusId     = psStatusId
46 47
     self._sStatusLabel  = psStatusLabel
47 48
     self._sStatusFamily = psStatusFamily
48
-    self._sForegroundColor = psForegroundColor
49
+    self._sIconId   = psIconId
50
+    self._sCssClass = psCssClass
49 51
     # self._sBackgroundColor = psBackgroundColor
50 52
   
51
-  @property
52
-  def label(self):
53
+  def getLabel(self):
53 54
     return self._sStatusLabel
54 55
     
56
+  @property
57
+  def icon(self):
58
+    return self._sIconId
59
+    
55 60
   def getId(self):
56 61
     return self._sStatusId
57 62
 
63
+  @property
64
+  def css(self):
65
+    return self._sCssClass
66
+
67
+  @property
68
+  def status_id(self):
69
+    return self._sStatusId
70
+    
71
+  @property
72
+  def icon_id(self):
73
+    return self._sIconId
74
+
75
+  @property
76
+  def label(self):
77
+    return self._sStatusLabel
58 78
 
59 79
 class PBNodeStatus(object):
60 80
     
61 81
   StatusList = dict()
62
-  StatusList['immortal'] = PBNodeStatusItem('immortal',  'Information', 'normal', 'rgb(51,51,51)')
63
-  StatusList['open']     = PBNodeStatusItem('open',      'Open',        'normal', 'rgb(91,183,91)')
64
-  StatusList['standby']  = PBNodeStatusItem('standby',   'in Standby',  'normal', 'rgb(250, 167, 50)')
65
-  StatusList['hot']      = PBNodeStatusItem('hot',       'Hot',         'normal', 'rgb(218, 79, 73)')
66
-  StatusList['done']     = PBNodeStatusItem('done',      'Done',        'closed', 'rgb(51, 51, 51)')
67
-  StatusList['closed']   = PBNodeStatusItem('closed',    'Closed',      'closed', 'rgb(51, 51, 51)')
68
-  StatusList['archived'] = PBNodeStatusItem('archived',  'Archived',    'invisible', 'rgb(51, 51, 51)')
69
-  StatusList['deleted']  = PBNodeStatusItem('deleted',   'Deleted',     'invisible', 'rgb(51, 51, 51)')
82
+  StatusList['immortal']   = PBNodeStatusItem('immortal',   'Information', 'normal', 'icon-g-circle-info',            'pod-status-grey-light')
83
+  StatusList['new']        = PBNodeStatusItem('new',        'New',         'open',   'icon-g-lightbulb icon-g-white', 'btn-success')
84
+  StatusList['inprogress'] = PBNodeStatusItem('inprogress', 'In progress', 'open',   ' icon-g-roundabout icon-g-white', 'btn-info')
85
+  StatusList['standby']    = PBNodeStatusItem('standby',    'In Standby',  'open',   'icon-g-clock icon-g-white', 'btn-warning')
86
+  StatusList['hot']        = PBNodeStatusItem('hot',        'Hot',         'open',   'icon-g-warning-sign icon-g-white', 'btn-danger')
87
+  StatusList['done']       = PBNodeStatusItem('done',       'Done',        'closed', 'icon-g-ok-2', 'pod-status-grey-light')
88
+  StatusList['closed']     = PBNodeStatusItem('closed',     'Closed',      'closed', 'icon-g-lightbulb', 'pod-status-grey-middle')
89
+  StatusList['archived']   = PBNodeStatusItem('archived',   'Archived',    'invisible', 'icon-g-wallet', 'pod-status-grey-dark')
90
+  StatusList['deleted']    = PBNodeStatusItem('deleted',    'Deleted',     'invisible', 'icon-g-bin',                    'pod-status-grey-dark')
70 91
 
71 92
   @classmethod
72 93
   def getList(cls):
73
-    return PBNodeStatus.StatusList.iteritems()
94
+    return [
95
+      PBNodeStatus.StatusList['immortal'],
96
+      PBNodeStatus.StatusList['new'],
97
+      PBNodeStatus.StatusList['inprogress'],
98
+      PBNodeStatus.StatusList['standby'],
99
+      PBNodeStatus.StatusList['hot'],
100
+      PBNodeStatus.StatusList['done'],
101
+      PBNodeStatus.StatusList['closed'],
102
+      PBNodeStatus.StatusList['archived'],
103
+      PBNodeStatus.StatusList['deleted']
104
+    ]
74 105
     
106
+    PBNodeStatus.StatusList.values()
107
+    
108
+  @classmethod
75 109
   def getStatusItem(cls, psStatusId):
110
+    print "====> ID=", psStatusId
111
+    print "====> ITEM=", PBNodeStatus.StatusList[psStatusId]
76 112
     return PBNodeStatus.StatusList[psStatusId]
77 113
 
78 114
 class PBNodeType(object):
@@ -150,6 +186,15 @@ class PBNode(object):
150 186
   def getStatus(self):
151 187
     return PBNodeStatus.getStatusItem(self.node_status)
152 188
 
189
+  def getTruncatedLabel(self, piCharNb):
190
+    lsTruncatedLabel = u''
191
+    liMaxLength = int(piCharNb)
192
+    if len(self.data_label)>liMaxLength:
193
+      lsTruncatedLabel = self.data_label[0:liMaxLength-1]+u'…'
194
+    else:
195
+      lsTruncatedLabel = self.data_label
196
+    return lsTruncatedLabel
197
+
153 198
 from sqlalchemy.orm import mapper
154 199
 mapper(PBNode, pb_node_table)
155 200
 

+ 126 - 66
pboard/pboard/templates/dashboard.mak View File

@@ -1,45 +1,54 @@
1 1
 <%inherit file="local:templates.master"/>
2
+<%namespace name="POD" file="pboard.templates.pod"/>
2 3
 
3 4
 
5
+<%def name="node_treeview_for_set_parent_menu(node_id, node_list, indentation=-1)">
6
+  % if indentation==-1:
7
+    <li><a href="${tg.url('/api/set_parent_node?node_id=%i&new_parent_id=0'%(current_node.node_id))}">${_('Root')}</a>
8
+      ${node_treeview_for_set_parent_menu(node_id, node_list, 0)}
9
+    </li>
10
+  % else:
11
+    % if len(node_list)>0:
12
+      <ul>
13
+      % for new_parent_node in node_list:
14
+        <li>
15
+          <a href="${tg.url('/api/set_parent_node?node_id=%i&new_parent_id=%i'%(node_id, new_parent_node.node_id))}">${new_parent_node.getTruncatedLabel(40-indentation*2)}</a>
16
+          ${node_treeview_for_set_parent_menu(node_id, new_parent_node.getChildren(), indentation+1)}
17
+        </li>
18
+      % endfor
19
+      </ul>
20
+    % endif
21
+  % endif
22
+</%def>
4 23
 
5 24
 <%def name="node_treeview(node_list, indentation=-1)">
6 25
   % if indentation==-1:
7
-    <tr>
8
-      <td style="padding-left: ${(indentation+1)*0.8}em;">
9
-        <a href="?node=0" title="${_('Root')}">
10
-          <i class='icon-g-folder-open'></i>
11
-          ${_('Root')}
12
-        </a>
13
-      </td>
14
-      <td class="text-right">
15
-        <div class="pod-toolbar">
16
-          <a href="${tg.url('/create_document?parent_id=0')}" title="${_('Add child document')}"><i class="icon-g-circle-plus"></i></a>
17
-        </div>
18
-      </td>
19
-    </tr>
26
+    <div class="pod-toolbar-parent" style="padding-left: 0.5em; position: relative;">
27
+      <a href="?node=0" title="${_('Root')}">
28
+        <i class='icon-g-folder-open'></i>
29
+        ${_('Root')}
30
+      </a>
31
+      <div class="pod-toolbar">
32
+        <a href="${tg.url('/create_document?parent_id=0')}" title="${_('Add child document')}"><i class="icon-g-circle-plus"></i></a>
33
+      </div>
34
+    </div>
20 35
     ${node_treeview(node_list, 0)}
21 36
   % else:
22 37
     % if len(node_list)>0:
23 38
       % for node in node_list:
24
-        <tr title="Last updated: ${node.updated_at}">
25
-          <td style="padding-left: ${(indentation+1)*0.5}em;">
26
-            <a href="?node=${node.node_id}" title="${node.data_label}">
27
-              <i class='${node.getIconClass()}'></i>
28
-              % if len(node.data_label)<=15:
29
-                ${node.data_label}
30
-              % else:
31
-                ${node.data_label[0:15]}...
32
-              % endif
33
-            </a>
34
-          </td>
35
-          <td class="text-right">
36
-            <div class="pod-toolbar">
37
-              <a href="${tg.url('/move_node_upper?node_id=%i'%(node.node_id))}" title="${_('Move up')}"><i class="icon-g-up-arrow"></i></a>
38
-              <a href="${tg.url('/move_node_lower?node_id=%i'%(node.node_id))}" title="${_('Move down')}"><i class="icon-g-down-arrow"></i></a>
39
-              <a href="${tg.url('/create_document?parent_id=%i'%(node.node_id))}" title="${_('Add child document')}"><i class="icon-g-circle-plus"></i></a>
40
-            </div>
41
-          </td>
42
-        </tr>
39
+        <div class="pod-toolbar-parent" style="padding-left: ${(indentation+2)*0.5}em; position: relative;">
40
+          <a href="?node=${node.node_id}" title="${node.data_label}">
41
+            <i class='${node.getIconClass()}'></i> ${node.getTruncatedLabel(32-0.8*(indentation+1))}
42
+          </a>
43
+          <div class="pod-toolbar">
44
+            <a href="${tg.url('/move_node_upper?node_id=%i'%(node.node_id))}" title="${_('Move up')}"><i class="icon-g-up-arrow"></i></a>
45
+            <a href="${tg.url('/move_node_lower?node_id=%i'%(node.node_id))}" title="${_('Move down')}"><i class="icon-g-down-arrow"></i></a>
46
+            <a href="${tg.url('/create_document?parent_id=%i'%(node.node_id))}" title="${_('Add child document')}"><i class="icon-g-circle-plus"></i></a>
47
+          </div>
48
+          <div class="pod-status ${node.getStatus().css}" title='${node.getStatus().label}'>
49
+             <i class='${node.getStatus().icon}'></i>
50
+          </div>
51
+        </div>
43 52
         ${node_treeview(node.getChildren(), indentation+1)}
44 53
       % endfor
45 54
     % endif
@@ -63,63 +72,86 @@
63 72
 </%def>
64 73
 
65 74
 <%def name="title()">
66
-Learning TurboGears 2.3: Quick guide to the Quickstart pages.
75
+POD :: ${current_node.getTruncatedLabel(40)} [${current_node.getStatus().label}]
67 76
 </%def>
68 77
 
69 78
   <div class="row">
70 79
     <div class="span3">
71
-      <legend>
72
-        Documents
73
-      </legend>
74
-
80
+      <div class="btn-group">
81
+        <button class="btn">${_('Documents')}</button>
82
+        <button class="btn" title="${_('Show current filtering state')}"><i class="  icon-g-eye-open"></i></button>
83
+        
84
+        <a class="btn dropdown-toggle" data-toggle="dropdown" href="#" title='${_('Adjust filtering')}'><i class=" icon-g-adjust"></i></a>
85
+                <ul class="dropdown-menu">
86
+          % for node_status in node_status_list:
87
+            <li>
88
+              <a class="${node_status.css}" href="${tg.url('/edit_status?node_id=%i&node_status=%s'%(current_node.node_id, node_status.status_id))}">
89
+                <i class="${node_status.icon_id}"></i> ${node_status.label}
90
+              </a>
91
+            </li>
92
+          % endfor
93
+        </ul>
94
+      </div>
95
+      <p></p>
75 96
       <div>
76
-        <table class="table table-striped table-hover table-condensed">
77
-          ${node_treeview(root_node_list)}
78
-        </table>
97
+        ${node_treeview(root_node_list)}
79 98
       </div>
80 99
     </div>
81
-    <div class="span5">
82
-      <div class="page-header">
83
-        <h3 id="current-document-title">${current_node.data_label}</h3>
84
-        <form id="current-document-title-edit-form" method='post' action='${tg.url('/edit_label')}'>
100
+    <div class="span9">
101
+        
102
+        
103
+        
104
+        <form style='display: none;' id="current-document-title-edit-form" method='post' action='${tg.url('/edit_label')}'>
85 105
           <div class="input-prepend input-append">
86 106
             <input type='hidden' name='node_id' value='${current_node.node_id}'/>
87
-            <button id="current-document-title-edit-cancel-button" type="button" class="btn" title="${_('Cancel editing')}"><i class="icon-g-ban"></i></button>
107
+            ${POD.CancelButton('current-document-title-edit-cancel-button')}
88 108
             <input type='text' name='data_label' value='${current_node.data_label}' class="span2" />
89
-            <button id='current-document-title-save-cancel-button' type="button" class="btn" title="${_('Save')}"><i class="icon-g-edit"></i></button>
109
+            ${POD.SaveButton('current-document-title-save-cancel-button')}
90 110
           </div>
91 111
         </form>
92
-      </div>
93 112
 
94 113
 
95 114
       <div class="btn-group">
96
-        <a class="btn btn-primary" href="#"><i class="icon-g-stats icon-g-white"></i> Status</a>
97
-        <a class="btn btn-primary dropdown-toggle" data-toggle="dropdown" href="#"><span class="caret"></span></a>
115
+        <button class="btn">Status</button>
116
+        <a class="btn ${current_node.getStatus().css}" href="#"><i class="${current_node.getStatus().icon}"></i> ${current_node.getStatus().getLabel()}</a>
117
+        <a class="btn ${current_node.getStatus().css} dropdown-toggle" data-toggle="dropdown" href="#"><span class="caret"></span></a>
98 118
         <ul class="dropdown-menu">
99
-          <li><a class="btn-success" href="#"><i class="icon-g-sun"></i> Open</a></li>
100
-          <li><a class="btn-warning" href="#"><i class="icon-g-rotation-lock"></i> in Standby</a></li>
101
-          <li><a class="btn-danger"  href="#"><i class="icon-g-circle-exclamation-mark"></i> Hot</a></li>
102
-          <li><a class="btn " href="#"><i class="icon-g-ok"></i> Finished</a></li>
103
-          <li><a class="btn btn-disabled" href="#"><i class="icon-g-ban"></i> Archived</a></li>
119
+          % for node_status in node_status_list:
120
+            <li>
121
+              <a class="${node_status.css}" href="${tg.url('/edit_status?node_id=%i&node_status=%s'%(current_node.node_id, node_status.status_id))}">
122
+                <i class="${node_status.icon_id}"></i> ${node_status.label}
123
+              </a>
124
+            </li>
125
+          % endfor
104 126
         </ul>
105 127
       </div>
106 128
       <div class="btn-group">
107
-        <button id='current-document-content-edit-button' class="btn"><i class='icon-g-edit'></i> ${_('Edit')}</button>
108
-      </div>
109
-      <div class="btn-group">
110
-        <a href='${tg.url('/force_delete_node?node_id=%i'%(current_node.node_id))}' id='current-document-force-delete-button' class="btn btn-danger"><i class="icon-g-white icon-g-remove"></i> ${_('Delete')}</a>
129
+        ${POD.EditButton('current-document-content-edit-button', True)}
130
+        <a class="btn" href="#" data-toggle="dropdown"><i class="icon-g-move"></i> ${_('Move to')} <span class="caret"></span></a>
131
+        <ul class="dropdown-menu">
132
+          ${node_treeview_for_set_parent_menu(current_node.node_id, root_node_list)}
133
+        </ul>
134
+
135
+
136
+        <a href='${tg.url('/force_delete_node?node_id=%i'%(current_node.node_id))}' id='current-document-force-delete-button' class="btn" onclick="return confirm('${_('Delete current document?')}');"><i class="icon-g-remove"></i> ${_('Delete')}</a>
111 137
       </div>
138
+      
139
+            <!--</div> PAGE HEADER -->
140
+      <h3 id="current-document-title">${current_node.data_label}</h3>
141
+</div>
142
+      <div class="span5">
143
+      
112 144
       <p>
113 145
         <div id='current-document-content' class="">
114 146
           ${current_node.data_content|n}
115 147
         </div>
116
-        <form id="current-document-content-edit-form" method='post' action='${tg.url('/edit_content')}'>
148
+        <form style='display: none;' id="current-document-content-edit-form" method='post' action='${tg.url('/edit_content')}'>
117 149
           <input type='hidden' name='node_id' value='${current_node.node_id}'/>
118 150
           <textarea id="current_node_textarea" name='data_content' spellcheck="false" wrap="off" autofocus placeholder="Enter something ...">
119 151
             ${current_node.data_content|n}
120 152
           </textarea>
121
-          <button id="current-document-content-edit-cancel-button" type="button" class="btn" title="${_('Cancel editing')}"><i class="icon-g-ban"></i> ${_('Cancel')}</button>
122
-          <button id='current-document-content-edit-save-button' type="button" class="btn" title="${_('Save')}"><i class="icon-g-edit"></i>  ${_('Save')}</button>
153
+          ${POD.CancelButton('current-document-content-edit-cancel-button', True)}
154
+          ${POD.SaveButton('current-document-content-edit-save-button', True)}
123 155
         </form>
124 156
       </p>
125 157
     </div>
@@ -127,17 +159,45 @@ Learning TurboGears 2.3: Quick guide to the Quickstart pages.
127 159
       <div class="tabbable">
128 160
         <ul class="nav nav-tabs">
129 161
             <li class="active">
130
-              <a href="#events" data-toggle="tab" title="History"><i class="icon-g-calendar"></i></a>
162
+              <a href="#events" data-toggle="tab" title="History"><i class="icon-g-history"></i></a>
131 163
             </li>
132
-            <li><a href="#contacts" data-toggle="tab" title="Contacts"><i class="icon-g-user""></i> </a></li>
164
+            <li><a href="#contacts" data-toggle="tab" title="Contacts"><i class="icon-g-phone""></i> </a></li>
133 165
             <li><a href="#comments" data-toggle="tab" title="Comments"><i class="icon-g-comments"></i> </a></li>
134 166
             <li><a href="#files" data-toggle="tab" title="Files"><i class="icon-g-attach"></i> </a></li>
167
+            <li><a href="#contacts" data-toggle="tab" title="Users"><i class="icon-g-user""></i> </a></li>
135 168
         </ul>
136 169
         <div class="tab-content">
137 170
             <div class="tab-pane active" id="events">
138
-              <!--p class="text-right" >
139
-                <button class="text-right btn btn-info " type="button"><i class="icon-g-plus icon-g-white"></i> new event</button>
140
-              </p-->
171
+
172
+${POD.AddButton('current-document-add-event-button', True, _(' Add event'))}
173
+<form style='display: none;' id='current-document-add-event-form' action='${tg.url('/api/create_event')}' method='post' class="well">
174
+  <input type="hidden" name='parent_id' value='${current_node.node_id}'/>
175
+  <fieldset>
176
+    <legend>Add an event</legend>
177
+    <label>
178
+      <input type="text" name='data_label' placeholder="Event"/>
179
+    </label>
180
+    <label>
181
+      <div class="datetime-picker-input-div input-append date">
182
+        <input name='data_datetime' data-format="dd/MM/yyyy hh:mm" type="text" placeholder="date and time"/>
183
+        <span class="add-on"><i data-time-icon="icon-g-clock" data-date-icon="icon-g-calendar"></i></span>
184
+      </div>
185
+    </label>
186
+    <label class="checkbox">
187
+      <input disabled name='add_reminder' type="checkbox"> add a reminder
188
+    </label>
189
+    <label>
190
+      <div class="datetime-picker-input-div input-append date">
191
+        <input disabled name='data_reminder_datetime' data-format="dd/MM/yyyy hh:mm" type="text" placeholder="date and time"/>
192
+        <span class="add-on"><i data-time-icon="icon-g-clock" data-date-icon="icon-g-calendar"></i></span>
193
+      </div>
194
+    </label>
195
+
196
+    ${POD.CancelButton('current-document-add-event-cancel-button', True)}
197
+    ${POD.SaveButton('current-document-add-event-save-button', True)}
198
+  </fieldset>
199
+</form>
200
+
141 201
               <table class="table table-striped table-hover table-condensed">
142 202
                 <thead>
143 203
                   <tr>

+ 64 - 31
pboard/pboard/templates/master.mak View File

@@ -8,6 +8,8 @@
8 8
     <link rel="stylesheet" type="text/css" media="screen" href="${tg.url('/css/style.css')}" />
9 9
     <link rel="stylesheet" type="text/css" media="screen" href="${tg.url('/css/glyphicons.css')}" />
10 10
 
11
+    <link rel="stylesheet" type="text/css" media="screen" href="${tg.url('/css/bootstrap-datetimepicker.min.css')}" />
12
+
11 13
     <style>
12 14
       /* Wrapper for page content to push down footer */
13 15
       #wrap {
@@ -37,17 +39,40 @@
37 39
         }
38 40
       }
39 41
       
42
+
40 43
 div.pod-toolbar {
41 44
   visibility: hidden;
45
+  position: absolute;
46
+  right: 1.2em;
47
+  top: 0;
42 48
 }
43
-tr:Hover td div.pod-toolbar {
49
+
50
+.pod-toolbar-parent {
51
+  border-bottom: 1px dotted #CCC;
52
+}
53
+.pod-toolbar-parent:Hover {
54
+  background-color: #EFEFEF;
55
+}
56
+.pod-toolbar-parent:Hover > div.pod-toolbar {
44 57
   visibility: visible;
45 58
 }
59
+.pod-status {
60
+  position: absolute;
61
+  width: 1.2em;
62
+  text-align: center;
63
+  right: 0;
64
+  top: 0;
65
+}
46 66
 
47 67
 h3:Hover div.pod-toolbar {
48 68
   visibility: visible;
49 69
 }
50 70
 
71
+body { padding-top: 60px; }
72
+@media screen and (max-width: 768px) {
73
+    body { padding-top: 0px; }
74
+}
75
+
51 76
     </style>
52 77
 </head>
53 78
 <body class="${self.body_class()}">
@@ -67,6 +92,7 @@ h3:Hover div.pod-toolbar {
67 92
 
68 93
 <script src="/bootstrap-wysihtml5-0.0.2/libs/js/wysihtml5-0.3.0_rc2.js"></script>
69 94
 <script src="/bootstrap-wysihtml5-0.0.2/bootstrap-wysihtml5-0.0.2.js"></script>
95
+<script src="/javascript/bootstrap-datetimepicker.min.js"></script>
70 96
 
71 97
 <style>
72 98
 tr:Hover td div.pod-toolbar {
@@ -75,6 +101,11 @@ tr:Hover td div.pod-toolbar {
75 101
 tr:Hover td div.pod-toolbar {
76 102
   visibility: visible;
77 103
 }
104
+
105
+.pod-status-grey-light  { background-color: #DDD; }
106
+.pod-status-grey-middle { background-color: #BBB; }
107
+.pod-status-grey-dark   { background-color: #AAA; }
108
+
78 109
 </style>
79 110
 
80 111
   
@@ -90,21 +121,9 @@ tr:Hover td div.pod-toolbar {
90 121
 
91 122
             <script>
92 123
               $(document).ready(function() {
93
-               
94
-                $('#data_content').wysihtml5({
95
-                  "font-styles": true, //Font styling, e.g. h1, h2, etc. Default true
96
-                  "emphasis": true, //Italics, bold, etc. Default true
97
-                  "lists": true, //(Un)ordered lists, e.g. Bullets, Numbers. Default true
98
-                  "html": true, //Button which allows you to edit the generated HTML. Default false
99
-                  "link": false, //Button to insert a link. Default true
100
-                  "image": false, //Button to insert an image. Default true,
101
-                  // "color": true //Button to change color of font  
102
-                });
103
-                
104
-                $('#data_content').css("width", "30em");
105
-                $('#data_content').css("height", "12em");
106 124
 
107
-                $('#data_content_edit').wysihtml5({
125
+                
126
+                $('#current_node_textarea').wysihtml5({
108 127
                   "font-styles": true, //Font styling, e.g. h1, h2, etc. Default true
109 128
                   "emphasis": true, //Italics, bold, etc. Default true
110 129
                   "lists": true, //(Un)ordered lists, e.g. Bullets, Numbers. Default true
@@ -113,19 +132,6 @@ tr:Hover td div.pod-toolbar {
113 132
                   "image": false, //Button to insert an image. Default true,
114 133
                   // "color": true //Button to change color of font  
115 134
                 });
116
-                
117
-                $('#data_content_edit').css("width", "30em");
118
-                $('#data_content_edit').css("height", "12em");
119
-                
120
-                          $('#current_node_textarea').wysihtml5({
121
-            "font-styles": true, //Font styling, e.g. h1, h2, etc. Default true
122
-            "emphasis": true, //Italics, bold, etc. Default true
123
-            "lists": true, //(Un)ordered lists, e.g. Bullets, Numbers. Default true
124
-            "html": true, //Button which allows you to edit the generated HTML. Default false
125
-            "link": false, //Button to insert a link. Default true
126
-            "image": false, //Button to insert an image. Default true,
127
-            // "color": true //Button to change color of font  
128
-          });
129 135
                 $('#current_node_textarea').css('margin-bottom', '0');
130 136
                 $('#current_node_textarea').css("min-height", "12em");
131 137
                 $('#current_node_textarea').addClass("span5");
@@ -167,7 +173,34 @@ tr:Hover td div.pod-toolbar {
167 173
                   $('#current-document-content-edit-form').submit();
168 174
                 });
169 175
 
170
-                /* Force delete content form */
176
+
177
+                /* Add event form hide/show behavior */
178
+                $("#current-document-add-event-button" ).click(function() {
179
+                  $("#current-document-add-event-form" ).css("display", "block");
180
+                  $("#current-document-add-event-button" ).css("display", "none");
181
+                });
182
+                $('#current-document-add-event-cancel-button').on('click', function(e){
183
+                  $("#current-document-add-event-form" ).css("display", "none");
184
+                  $("#current-document-add-event-button" ).css("display", "block");
185
+                });
186
+                $('#current-document-add-event-save-button').on('click', function(e){
187
+                  e.preventDefault(); // We don't want this to act as a link so cancel the link action
188
+                  $('#current-document-add-event-form').submit();
189
+                });
190
+
191
+
192
+
193
+
194
+/*                $('.date-picker-input').datepicker({
195
+                  format: 'mm-dd-yyyy'
196
+                });
197
+*/
198
+                $(function() {
199
+                  $('.datetime-picker-input-div').datetimepicker({
200
+                    language: 'fr-FR',
201
+                    pickSeconds: false
202
+                  });
203
+                });
171 204
 
172 205
               });
173 206
               
@@ -201,10 +234,10 @@ tr:Hover td div.pod-toolbar {
201 234
 </%def>
202 235
 
203 236
 <%def name="main_menu()">
204
-  <div class="navbar">
237
+  <div id="pod-navbar" class="navbar navbar-fixed-top">
205 238
     <div class="navbar-inner">
206 239
       <div class="container">
207
-        <a class="brand" href="#"><img src="${tg.url('/img/turbogears_logo.png')}" alt="TurboGears 2"/> <strong>pod</strong></a>
240
+        <a class="brand" href="#"><!--img src="${tg.url('/img/turbogears_logo.png')}" alt="TurboGears 2"/--> <strong>pod</strong></a>
208 241
         <div class="nav-collapse">
209 242
           <ul class="nav">
210 243
             <li class="active"><a href="${tg.url('/dashboard')}"><i class="icon-home icon-white"></i> Dashboard</a></li>

+ 17 - 0
pboard/pboard/templates/pod.mak View File

@@ -0,0 +1,17 @@
1
+<%def name="Button(piId, pbWithLabel, psButtonCssClass, psButtonTitle, psButtonIcon, psButtonLabel)" >
2
+  <button id='${piId}' type="button" class="btn" title="${psButtonTitle}"><i class="${psButtonIcon}"></i>${u'' if (pbWithLabel==False) else u' %s'%(psButtonLabel)}</button>
3
+</%def>
4
+
5
+<%def name="SaveButton(piId, pbWithLabel=False)" >
6
+  ${Button(piId, pbWithLabel, 'btn', _('Save'), 'icon-g-edit', _('Save'))}
7
+</%def>
8
+<%def name="EditButton(piId, pbWithLabel=False)" >
9
+  ${Button(piId, pbWithLabel, 'btn', _('Edit'), 'icon-g-edit', _('Edit'))}
10
+</%def>
11
+<%def name='CancelButton(piId, pbWithLabel=False)'>
12
+  ${Button(piId, pbWithLabel, 'btn', _('Cancel'), 'icon-g-ban', _('Cancel'))}
13
+</%def>
14
+<%def name='AddButton(piId, pbWithLabel=False, psLabel=None)'>
15
+  ${Button(piId, pbWithLabel, 'btn', psLabel or _('New'), 'icon-g-circle-plus', psLabel or _('New'))}
16
+</%def>
17
+