Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
1#!/usr/local/bin/python
2# encoding: utf-8
3"""
4*marshall_sidebar for the PESSTO Marshall*
6:Author:
7 David Young
8"""
9import sys
10import os
11import khufu
12from marshall_webapp.models.transients import models_transients_count
13from marshall_webapp.templates.commonelements import forms
14import copy
17def marshall_sidebar(
18 log,
19 request,
20 thisPageName
21):
22 """Get the left navigation bar for the pessto marshall
24 **Key Arguments**
26 - ``log`` -- logger
27 - ``request`` -- the pyramid request
28 - ``thisPageName`` -- the name of the page currently displayed
31 **Return**
33 - ``leftNavBar`` -- the left navigation bar for the pessto marshall
35 """
36 log.debug('starting the ``marshall_sidebar`` function')
37 ## VARIABLES ##
38 leftColumnContent = ""
40 # MAKE SURE PARAMETERS PERSIST IF REQUEST COMING FROM A TRANSIENT RESOURCE
41 if request.referer and "transients" not in request.referer:
42 params = {}
43 else:
44 params = dict(request.params)
46 header = _marshall_sidebar_header(
47 log=log,
48 request=request,
49 params=params
50 )
52 targetSelectionQueue = _get_target_selection_queue(
53 log,
54 request=request,
55 thisPageName=thisPageName,
56 params=params
57 )
59 observationQueues = _get_observation_queues(
60 log,
61 request=request,
62 thisPageName=thisPageName,
63 params=params
64 )
66 classificationQueues = _get_classification_queues(
67 log,
68 request=request,
69 thisPageName=thisPageName,
70 params=params
71 )
73 referenceLists = _get_reference_lists(
74 log,
75 request=request,
76 thisPageName=thisPageName,
77 params=params
78 )
80 developmentLinks = _get_development_links(
81 log,
82 thisPageName=thisPageName,
83 params=params
84 )
86 marshall_sidebar = """
87%s
88%s <br>
89%s <br>
90%s <br>
91%s <br>""" % (
92 header,
93 targetSelectionQueue,
94 observationQueues,
95 classificationQueues,
96 referenceLists,
97 # developmentLinks
98 )
100 log.debug('completed the ``marshall_sidebar`` function')
101 return marshall_sidebar
104def _marshall_sidebar_header(
105 log,
106 request,
107 params):
108 """Generate the left navigation bar header content
110 **Key Arguments**
112 - ``log`` -- logger
113 - ``request`` -- the pyramid request
114 - ``params`` -- params required for links
117 **Return**
119 - ``content`` -- the left nav bar header content
121 """
123 log.debug('starting the ``_marshall_sidebar_header`` function')
124 ## VARIABLES ##
126 href = request.route_path('transients')
128 pesstoIcon = khufu.image(
129 src=request.static_path(
130 'marshall_webapp:static/images/pessto_icon.png'),
131 href=href,
132 display="rounded", # [ rounded | circle | polaroid ]
133 pull=False, # [ "left" | "right" | "center" ]
134 htmlClass=False,
135 thumbnail=False,
136 # width=25,
137 onPhone=True,
138 onTablet=True,
139 onDesktop=True,
140 htmlId="marshall_sideBarPesstoIcon"
141 )
143 padding = khufu.grid_column(
144 span=1, # 1-12
145 offset=0, # 1-12
146 content="",
147 htmlId=False,
148 htmlClass=False,
149 onPhone=True,
150 onTablet=True,
151 onDesktop=True,
152 )
154 pesstoIcon = khufu.grid_column(
155 span=4, # 1-12
156 offset=8, # 1-12
157 content=pesstoIcon,
158 htmlId=False,
159 htmlClass=False,
160 onPhone=True,
161 onTablet=True,
162 onDesktop=True,
163 )
165 pesstoIcon = khufu.grid_row(
166 responsive=True,
167 columns=pesstoIcon,
168 htmlId="marshall_sideBarPesstoIconRow",
169 htmlClass=False,
170 onPhone=True,
171 onTablet=True,
172 onDesktop=True
173 )
175 createNewTicketForm, createNewButton = forms.create_new_ticket_form.create_new_ticket_form(
176 log=log,
177 request=request,
178 )
180 popover = khufu.popover(
181 tooltip=True,
182 placement="right", # [ top | bottom | left | right ]
183 trigger="hover", # [ False | click | hover | focus | manual ]
184 title="manually create a ticket for a new object",
185 content=False,
186 delay=20
187 )
189 createNewButton = khufu.grid_row(
190 responsive=True,
191 columns="%(createNewButton)s %(createNewTicketForm)s" % locals(),
192 htmlId=False,
193 htmlClass=False,
194 onPhone=True,
195 onTablet=True,
196 onDesktop=True
197 )
199 log.debug('completed the ``_marshall_sidebar_header`` function')
200 return "%(pesstoIcon)s %(createNewButton)s" % locals()
203def _get_development_links(
204 log,
205 thisPageName,
206 params):
207 """get development links
209 **Key Arguments**
211 - ``log`` -- logger
212 - ``thisPageName`` -- the name of the current page
213 - ``params`` -- params required for links
216 **Return**
218 - ``developmentLinks`` -- the development queue - a list of links
220 """
221 log.debug('starting the ``_get_development_links`` function')
222 ## VARIABLES ##
224 title = khufu.li(
225 content="development",
226 # if a subMenu for dropdown this should be <ul>
227 span=False, # [ False | 1-12 ]
228 disabled=False,
229 submenuTitle=False,
230 divider=False,
231 navStyle="header", # [ active | header ]
232 navDropDown=False,
233 pager=False # [ False | "previous" | "next" ]
234 )
236 loggingLink = khufu.a(
237 content='logging',
238 href='/marshall/logs/styled_log.html',
239 tableIndex=False,
240 triggerStyle=False
241 )
243 loggingLink = khufu.li(
244 content=loggingLink,
245 # if a subMenu for dropdown this should be <ul>
246 span=False, # [ False | 1-12 ]
247 disabled=False,
248 submenuTitle=False,
249 divider=False,
250 navStyle=False, # [ active | header ]
251 navDropDown=False,
252 pager=False # [ False | "previous" | "next" ]
253 )
255 linkList = khufu.ul(
256 itemList=[title, loggingLink, ], # e.g a list links
257 unstyled=False,
258 inline=False,
259 dropDownMenu=False, # [ false | true ]
260 navStyle="list", # [ nav | tabs | pills | list ]
261 navPull="right", # [ false | left | right ]
262 navDirection=False, # [ 'default' | 'stacked' | 'horizontal' ]
263 breadcrumb=False, # [ False | True ]
264 pager=False,
265 thumbnails=False,
266 mediaList=False
267 )
269 column = khufu.grid_column(
270 span=12, # 1-12
271 offset=0, # 1-12
272 content=linkList,
273 htmlId=False,
274 htmlClass=False,
275 onPhone=True,
276 onTablet=True,
277 onDesktop=True
278 )
280 developmentLinks = khufu.grid_row(
281 responsive=True,
282 columns=column,
283 htmlId=False,
284 htmlClass=False,
285 onPhone=True,
286 onTablet=True,
287 onDesktop=True
288 )
290 log.debug('completed the ``_get_development_links`` function')
291 return developmentLinks
294def _get_observation_queues(
295 log,
296 request,
297 thisPageName,
298 params):
299 """get observation queues
301 **Key Arguments**
303 - ``log`` -- logger
304 - ``thisPageName`` -- the name of the current page
305 - ``params`` -- params required for links
308 **Return**
310 - ``observationQueues`` -- the observation queue - a list of links
312 """
313 log.debug('starting the ``_get_observation_queues`` function')
314 ## VARIABLES ##
316 title = khufu.li(
317 content="observation queues",
318 # if a subMenu for dropdown this should be <ul>
319 span=False, # [ False | 1-12 ]
320 disabled=False,
321 submenuTitle=False,
322 divider=False,
323 navStyle="header", # [ active | header ]
324 navDropDown=False,
325 pager=False # [ False | "previous" | "next" ]
326 )
328 count = models_transients_count(
329 log,
330 request=request,
331 mwfFlag='"pending observation"',
332 awfFlag=None,
333 cFlag=None
334 ).get()
336 theseParams = copy.deepcopy(params)
337 theseParams["mwl"] = 'pending observation'
338 theseParams = _remove_parameters(
339 log=log,
340 params=theseParams,
341 paramsToRemove=["snoozed", "cf", "awl", "pageStart", "q"]
342 )
344 theseParams["filterBy1"] = False
346 classificationTargetsLink = khufu.a(
347 content='<i class="icon-target2"></i> classification targets (%s)' % (
348 count,),
349 href=request.route_path(
350 'transients', _query=theseParams),
351 tableIndex=False,
352 triggerStyle=False
353 )
355 navStyle = khufu.is_navStyle_active(
356 log,
357 thisPageName,
358 "pending observation"
359 )
361 classificationTargetsLink = khufu.li(
362 content=classificationTargetsLink,
363 # if a subMenu for dropdown this should be <ul>
364 span=False, # [ False | 1-12 ]
365 disabled=False,
366 submenuTitle=False,
367 divider=False,
368 navStyle=navStyle, # [ active | header ]
369 navDropDown=False,
370 pager=False # [ False | "previous" | "next" ]
371 )
373 count = models_transients_count(
374 log,
375 request=request,
376 mwfFlag='"following"',
377 awfFlag=None,
378 cFlag=None
379 ).get()
381 theseParams = copy.deepcopy(params)
382 theseParams["mwl"] = 'following'
383 theseParams = _remove_parameters(
384 log=log,
385 params=theseParams,
386 paramsToRemove=["snoozed", "cf", "awl", "pageStart", "q"]
387 )
389 theseParams["filterBy1"] = False
391 followupTargetsLink = khufu.a(
392 content='<i class="icon-pin"></i> + followup targets (%s)' % (count,),
393 href=request.route_path('transients', _query=theseParams),
394 tableIndex=False,
395 triggerStyle=False
396 )
398 navStyle = khufu.is_navStyle_active(
399 log,
400 thisPageName,
401 "following"
402 )
404 followupTargetsLink = khufu.li(
405 content=followupTargetsLink,
406 # if a subMenu for dropdown this should be <ul>
407 span=False, # [ False | 1-12 ]
408 disabled=False,
409 submenuTitle=False,
410 divider=False,
411 navStyle=navStyle, # [ active | header ]
412 navDropDown=False,
413 pager=False # [ False | "previous" | "next" ]
414 )
416 count = models_transients_count(
417 log,
418 request=request,
419 mwfFlag='"pending observation" OR listName="following"',
420 awfFlag=None,
421 cFlag=None
422 ).get()
424 theseParams = copy.deepcopy(params)
425 theseParams["mwl"] = 'allObsQueue'
426 theseParams = _remove_parameters(
427 log=log,
428 params=theseParams,
429 paramsToRemove=["snoozed", "cf", "awl", "pageStart", "q"]
430 )
432 theseParams["filterBy1"] = False
434 allTargetsLink = khufu.a(
435 content='= all targets (%s)' % (count,),
436 href=request.route_path('transients', _query=theseParams),
437 tableIndex=False,
438 triggerStyle=False
439 )
441 navStyle = khufu.is_navStyle_active(
442 log,
443 thisPageName,
444 "allObsQueue"
445 )
447 allTargetsLink = khufu.li(
448 content=allTargetsLink,
449 # if a subMenu for dropdown this should be <ul>
450 span=False, # [ False | 1-12 ]
451 disabled=False,
452 submenuTitle=False,
453 divider=False,
454 navStyle=navStyle, # [ active | header ]
455 navDropDown=False,
456 pager=False # [ False | "previous" | "next" ]
457 )
459 linkList = khufu.ul(
460 itemList=[title, classificationTargetsLink,
461 followupTargetsLink, allTargetsLink, ], # e.g a list links
462 unstyled=False,
463 inline=False,
464 dropDownMenu=False, # [ false | true ]
465 navStyle="list", # [ nav | tabs | pills | list ]
466 navPull="right", # [ false | left | right ]
467 navDirection=False, # [ 'default' | 'stacked' | 'horizontal' ]
468 breadcrumb=False, # [ False | True ]
469 pager=False,
470 thumbnails=False,
471 mediaList=False
472 )
474 column = khufu.grid_column(
475 span=12, # 1-12
476 offset=0, # 1-12
477 content=linkList,
478 htmlId=False,
479 htmlClass=False,
480 onPhone=True,
481 onTablet=True,
482 onDesktop=True
483 )
485 observationQueues = khufu.grid_row(
486 responsive=True,
487 columns=column,
488 htmlId=False,
489 htmlClass=False,
490 onPhone=True,
491 onTablet=True,
492 onDesktop=True
493 )
495 log.debug('completed the ``_get_observation_queues`` function')
496 return observationQueues
499def _get_classification_queues(
500 log,
501 request,
502 thisPageName,
503 params):
504 """get classification queues
506 **Key Arguments**
508 - ``log`` -- logger
509 - ``thisPageName`` -- the name of the current page
510 - ``params`` -- params required for links
513 **Return**
515 - ``classificationQueues`` -- the classification queue - a list of links
517 """
518 import khufu
520 log.debug('starting the ``_get_classification_queues`` function')
521 ## VARIABLES ##
523 title = khufu.li(
524 content="classification & astronote queues",
525 # if a subMenu for dropdown this should be <ul>
526 span=False, # [ False | 1-12 ]
527 disabled=False,
528 submenuTitle=False,
529 divider=False,
530 navStyle="header", # [ active | header ]
531 navDropDown=False,
532 pager=False # [ False | "previous" | "next" ]
533 )
535 count = models_transients_count(
536 log,
537 request=request,
538 mwfFlag='"pending classification"',
539 awfFlag=None,
540 cFlag=None
541 ).get()
543 theseParams = copy.deepcopy(params)
544 theseParams["mwl"] = 'pending classification'
545 theseParams = _remove_parameters(
546 log=log,
547 params=theseParams,
548 paramsToRemove=["snoozed", "cf", "awl", "pageStart", "q"]
549 )
551 theseParams["filterBy1"] = False
553 queuedForClassificationLink = khufu.a(
554 content='queued for classification (%s)' % (count,),
555 href=request.route_path(
556 'transients', _query=theseParams),
557 tableIndex=False,
558 triggerStyle=False
559 )
561 navStyle = khufu.is_navStyle_active(
562 log,
563 thisPageName,
564 "pending classification"
565 )
567 queuedForClassificationLink = khufu.li(
568 content=queuedForClassificationLink,
569 # if a subMenu for dropdown this should be <ul>
570 span=False, # [ False | 1-12 ]
571 disabled=False,
572 submenuTitle=False,
573 divider=False,
574 navStyle=navStyle, # [ active | header ]
575 navDropDown=False,
576 pager=False # [ False | "previous" | "next" ]
577 )
579 count = models_transients_count(
580 log,
581 request=request,
582 mwfFlag=None,
583 awfFlag='"queued for atel"',
584 cFlag=None
585 ).get()
587 theseParams = copy.deepcopy(params)
588 theseParams["awl"] = 'queued for atel'
589 theseParams = _remove_parameters(
590 log=log,
591 params=theseParams,
592 paramsToRemove=["snoozed", "cf", "mwl", "pageStart", "q"]
593 )
595 theseParams["filterBy1"] = False
597 queuedForAtelLink = khufu.a(
598 content='queued for astronote (%s)' % (count,),
599 href=request.route_path(
600 'transients', _query=theseParams),
601 tableIndex=False,
602 triggerStyle=False
603 )
605 navStyle = khufu.is_navStyle_active(
606 log,
607 thisPageName,
608 "queued for astronote"
609 )
611 queuedForAtelLink = khufu.li(
612 content=queuedForAtelLink,
613 # if a subMenu for dropdown this should be <ul>
614 span=False, # [ False | 1-12 ]
615 disabled=False,
616 submenuTitle=False,
617 divider=False,
618 navStyle=navStyle, # [ active | header ]
619 navDropDown=False,
620 pager=False # [ False | "previous" | "next" ]
621 )
623 linkList = khufu.ul(
624 # e.g a list links
625 itemList=[title, queuedForClassificationLink, queuedForAtelLink, ],
626 unstyled=False,
627 inline=False,
628 dropDownMenu=False, # [ false | true ]
629 navStyle="list", # [ nav | tabs | pills | list ]
630 navPull="right", # [ false | left | right ]
631 navDirection=False, # [ 'default' | 'stacked' | 'horizontal' ]
632 breadcrumb=False, # [ False | True ]
633 pager=False,
634 thumbnails=False,
635 mediaList=False
636 )
638 column = khufu.grid_column(
639 span=12, # 1-12
640 offset=0, # 1-12
641 content=linkList,
642 htmlId=False,
643 htmlClass=False,
644 onPhone=True,
645 onTablet=True,
646 onDesktop=True
647 )
649 classificationQueues = khufu.grid_row(
650 responsive=True,
651 columns=column,
652 htmlId=False,
653 htmlClass=False,
654 onPhone=True,
655 onTablet=True,
656 onDesktop=True
657 )
659 log.debug('completed the ``_get_classification_queues`` function')
660 return classificationQueues
663def _get_reference_lists(
664 log,
665 request,
666 thisPageName,
667 params):
668 """get reference lists
670 **Key Arguments**
672 - ``log`` -- logger
673 - ``thisPageName`` -- the name of the current page
674 - ``params`` -- params required for links
677 **Return**
679 - ``referenceLists`` -- the reference queue - a list of links
681 """
682 import khufu
684 log.debug('starting the ``_get_reference_lists`` function')
685 ## VARIABLES ##
687 title = khufu.li(
688 content="reference",
689 # if a subMenu for dropdown this should be <ul>
690 span=False, # [ False | 1-12 ]
691 disabled=False,
692 submenuTitle=False,
693 divider=False,
694 navStyle="header", # [ active | header ]
695 navDropDown=False,
696 pager=False # [ False | "previous" | "next" ]
697 )
699 count = models_transients_count(
700 log,
701 request=request,
702 mwfFlag=None,
703 awfFlag=None,
704 cFlag='"NOT NULL"'
705 ).get()
707 theseParams = copy.deepcopy(params)
708 theseParams["mwl"] = 'all'
709 theseParams["cf"] = 1
710 theseParams = _remove_parameters(
711 log=log,
712 params=theseParams,
713 paramsToRemove=["snoozed", "awl", "pageStart", "q"]
714 )
716 classifiedLink = khufu.a(
717 content='classified (%s)' % (count,),
718 href=request.route_path('transients', _query=theseParams),
719 tableIndex=False,
720 triggerStyle=False
721 )
723 navStyle = khufu.is_navStyle_active(
724 log,
725 thisPageName,
726 "classified"
727 )
729 classifiedLink = khufu.li(
730 content=classifiedLink,
731 # if a subMenu for dropdown this should be <ul>
732 span=False, # [ False | 1-12 ]
733 disabled=False,
734 submenuTitle=False,
735 divider=False,
736 navStyle=navStyle, # [ active | header ]
737 navDropDown=False,
738 pager=False # [ False | "previous" | "next" ]
739 )
741 count = models_transients_count(
742 log,
743 request=request,
744 mwfFlag='"followup complete"',
745 awfFlag=None,
746 cFlag=None
747 ).get()
749 theseParams = copy.deepcopy(params)
750 theseParams["mwl"] = 'followup complete'
751 theseParams = _remove_parameters(
752 log=log,
753 params=theseParams,
754 paramsToRemove=["snoozed", "cf", "awl", "pageStart", "q"]
755 )
757 followupCompleteLink = khufu.a(
758 content='<i class="icon-checkmark-circle"></i> followup complete (%s)' % (
759 count,),
760 href=request.route_path(
761 'transients', _query=theseParams),
762 tableIndex=False,
763 triggerStyle=False
764 )
766 navStyle = khufu.is_navStyle_active(
767 log,
768 thisPageName,
769 "followup complete"
770 )
772 followupCompleteLink = khufu.li(
773 content=followupCompleteLink,
774 # if a subMenu for dropdown this should be <ul>
775 span=False, # [ False | 1-12 ]
776 disabled=False,
777 submenuTitle=False,
778 divider=False,
779 navStyle=navStyle, # [ active | header ]
780 navDropDown=False,
781 pager=False # [ False | "previous" | "next" ]
782 )
784 count = models_transients_count(
785 log,
786 request=request,
787 mwfFlag='"archive"',
788 awfFlag=None,
789 cFlag=None
790 ).get()
792 theseParams = copy.deepcopy(params)
793 theseParams["mwl"] = 'archive'
794 theseParams = _remove_parameters(
795 log=log,
796 params=theseParams,
797 paramsToRemove=["snoozed", "cf", "awl", "pageStart", "q"]
798 )
800 allArchivedLink = khufu.a(
801 content='<i class="icon-archive5"></i> all archived (%s)' % (count,),
802 href=request.route_path('transients', _query=theseParams),
803 tableIndex=False,
804 triggerStyle=False
805 )
807 navStyle = khufu.is_navStyle_active(
808 log,
809 thisPageName,
810 "archive"
811 )
813 allArchivedLink = khufu.li(
814 content=allArchivedLink,
815 # if a subMenu for dropdown this should be <ul>
816 span=False, # [ False | 1-12 ]
817 disabled=False,
818 submenuTitle=False,
819 divider=False,
820 navStyle=navStyle, # [ active | header ]
821 navDropDown=False,
822 pager=False # [ False | "previous" | "next" ]
823 )
825 count = models_transients_count(
826 log,
827 request=request,
828 mwfFlag='"all"',
829 awfFlag=None,
830 cFlag=None
831 ).get()
833 theseParams = copy.deepcopy(params)
834 theseParams["mwl"] = 'all'
835 theseParams = _remove_parameters(
836 log=log,
837 params=theseParams,
838 paramsToRemove=["snoozed", "cf", "awl", "pageStart", "q"]
839 )
841 allLink = khufu.a(
842 content='all (%s)' % (count,),
843 href=request.route_path('transients', _query=theseParams),
844 tableIndex=False,
845 triggerStyle=False
846 )
848 navStyle = khufu.is_navStyle_active(
849 log,
850 thisPageName,
851 "all"
852 )
854 allLink = khufu.li(
855 content=allLink,
856 # if a subMenu for dropdown this should be <ul>
857 span=False, # [ False | 1-12 ]
858 disabled=False,
859 submenuTitle=False,
860 divider=False,
861 navStyle=navStyle, # [ active | header ]
862 navDropDown=False,
863 pager=False # [ False | "previous" | "next" ]
864 )
866 linkList = khufu.ul(
867 # e.g a list links
868 itemList=[title, allLink, classifiedLink,
869 followupCompleteLink, allArchivedLink],
870 unstyled=False,
871 inline=False,
872 dropDownMenu=False, # [ false | true ]
873 navStyle="list", # [ nav | tabs | pills | list ]
874 navPull="right", # [ false | left | right ]
875 navDirection=False, # [ 'default' | 'stacked' | 'horizontal' ]
876 breadcrumb=False, # [ False | True ]
877 pager=False,
878 thumbnails=False,
879 mediaList=False
880 )
882 column = khufu.grid_column(
883 span=12, # 1-12
884 offset=0, # 1-12
885 content=linkList,
886 htmlId=False,
887 htmlClass=False,
888 onPhone=True,
889 onTablet=True,
890 onDesktop=True
891 )
893 referenceLists = khufu.grid_row(
894 responsive=True,
895 columns=column,
896 htmlId=False,
897 htmlClass=False,
898 onPhone=True,
899 onTablet=True,
900 onDesktop=True
901 )
903 log.debug('completed the ``_get_reference_lists`` function')
904 return referenceLists
907def _get_target_selection_queue(
908 log,
909 request,
910 thisPageName,
911 params):
912 """get tagert selection queue
914 **Key Arguments**
916 - ``log`` -- logger
917 - ``params`` -- params required for links
920 **Return**
922 - ``targetSelectionQueue`` -- the target selection queue - a list of links
924 """
925 import khufu
927 log.debug('starting the ``_get_tagert_selection_queue`` function')
928 ## VARIABLES ##
930 placeHolder = khufu.image(
931 src='holder.js/300x200/auto/industrial/text:hello world',
932 )
934 title = khufu.li(
935 content="target selection queues",
936 # if a subMenu for dropdown this should be <ul>
937 span=False, # [ False | 1-12 ]
938 disabled=False,
939 submenuTitle=False,
940 divider=False,
941 navStyle="header", # [ active | header ]
942 navDropDown=False,
943 pager=False # [ False | "previous" | "next" ]
944 )
946 count = models_transients_count(
947 log,
948 request=request,
949 mwfFlag='"inbox"',
950 awfFlag=None,
951 cFlag=None
952 ).get()
954 theseParams = copy.deepcopy(params)
956 theseParams["mwl"] = 'inbox'
957 theseParams = _remove_parameters(
958 log=log,
959 params=theseParams,
960 paramsToRemove=["snoozed", "cf", "awl", "pageStart", "q"]
961 )
963 theseParams["filterBy1"] = "decDeg"
964 theseParams["filterValue1"] = 30
965 theseParams["filterOp1"] = "<"
967 inboxLink = khufu.a(
968 content='<i class="icon-inbox"></i> inbox (%s)' % (count,),
969 href=request.route_path('transients', _query=theseParams),
970 tableIndex=False,
971 triggerStyle=False
972 )
974 navStyle = khufu.is_navStyle_active(
975 log,
976 thisPageName,
977 "inbox"
978 )
980 inboxLink = khufu.li(
981 content=inboxLink, # if a subMenu for dropdown this should be <ul>
982 span=False, # [ False | 1-12 ]
983 disabled=False,
984 submenuTitle=False,
985 divider=False,
986 navStyle=navStyle, # [ active | header ]
987 navDropDown=False,
988 pager=False # [ False | "previous" | "next" ]
989 )
991 count = models_transients_count(
992 log,
993 request=request,
994 mwfFlag=None,
995 awfFlag=None,
996 cFlag=None,
997 snoozed=1
998 ).get()
1000 theseParams = copy.deepcopy(params)
1001 theseParams["snoozed"] = 1
1002 theseParams["mwl"] = "all"
1003 theseParams = _remove_parameters(
1004 log=log,
1005 params=theseParams,
1006 paramsToRemove=["cf", "awl", "pageStart", "q"]
1007 )
1009 theseParams["filterBy1"] = "decDeg"
1010 theseParams["filterValue1"] = 30
1011 theseParams["filterOp1"] = "<"
1013 snoozedLink = khufu.a(
1014 content='<i class="icon-alarm3"></i> snoozed (%s)' % (count,),
1015 href=request.route_path('transients', _query=theseParams),
1016 tableIndex=False,
1017 triggerStyle=False
1018 )
1020 navStyle = khufu.is_navStyle_active(
1021 log,
1022 thisPageName,
1023 "snoozed"
1024 )
1026 snoozedLink = khufu.li(
1027 content=snoozedLink, # if a subMenu for dropdown this should be <ul>
1028 span=False, # [ False | 1-12 ]
1029 disabled=False,
1030 submenuTitle=False,
1031 divider=False,
1032 navStyle=navStyle, # [ active | header ]
1033 navDropDown=False,
1034 pager=False # [ False | "previous" | "next" ]
1035 )
1037 count = models_transients_count(
1038 log,
1039 request=request,
1040 mwfFlag='"review for followup"',
1041 awfFlag=None,
1042 cFlag=None
1043 ).get()
1045 theseParams = copy.deepcopy(params)
1046 theseParams["mwl"] = 'review for followup'
1047 theseParams = _remove_parameters(
1048 log=log,
1049 params=theseParams,
1050 paramsToRemove=["snoozed", "cf", "awl", "pageStart", "q"]
1051 )
1053 theseParams["filterBy1"] = "decDeg"
1054 theseParams["filterValue1"] = 30
1055 theseParams["filterOp1"] = "<"
1057 reviewForFollowupLink = khufu.a(
1058 content='<i class="icon-eye"></i> review for followup (%s)' % (
1059 count,),
1060 href=request.route_path(
1061 'transients', _query=theseParams),
1062 tableIndex=False,
1063 triggerStyle=False
1064 )
1066 navStyle = khufu.is_navStyle_active(
1067 log,
1068 thisPageName,
1069 "review for followup"
1070 )
1072 reviewForFollowupLink = khufu.li(
1073 content=reviewForFollowupLink,
1074 # if a subMenu for dropdown this should be <ul>
1075 span=False, # [ False | 1-12 ]
1076 disabled=False,
1077 submenuTitle=False,
1078 divider=False,
1079 navStyle=navStyle, # [ active | header ]
1080 navDropDown=False,
1081 pager=False # [ False | "previous" | "next" ]
1082 )
1084 linkList = khufu.ul(
1085 # e.g a list links
1086 itemList=[title, inboxLink, snoozedLink, reviewForFollowupLink, ],
1087 unstyled=False,
1088 inline=False,
1089 dropDownMenu=False, # [ false | true ]
1090 navStyle="list", # [ nav | tabs | pills | list ]
1091 navPull="right", # [ false | left | right ]
1092 navDirection=False, # [ 'default' | 'stacked' | 'horizontal' ]
1093 breadcrumb=False, # [ False | True ]
1094 pager=False,
1095 thumbnails=False,
1096 mediaList=False
1097 )
1099 column = khufu.grid_column(
1100 span=12, # 1-12
1101 offset=0, # 1-12
1102 content=linkList,
1103 htmlId=False,
1104 htmlClass=False,
1105 onPhone=True,
1106 onTablet=True,
1107 onDesktop=True
1108 )
1110 targetSelectionQueue = khufu.grid_row(
1111 responsive=True,
1112 columns=column,
1113 htmlId=False,
1114 htmlClass=False,
1115 onPhone=True,
1116 onTablet=True,
1117 onDesktop=True
1118 )
1120 log.debug('completed the ``get_tagert_selection_queue`` function')
1121 return targetSelectionQueue
1124def _remove_parameters(
1125 log,
1126 params,
1127 paramsToRemove
1128):
1129 """Get the left navigation bar for the pessto marshall
1131 **Key Arguments**
1133 - ``log`` -- logger
1134 - ``params`` -- the parameters of the request
1135 - ``paramsToRemove`` -- the parameters to remove from the incoming request
1138 **Return**
1140 - ``params`` -- the clean parameters
1142 """
1143 log.debug('starting the ``_remove_parameter`` function')
1145 if isinstance(paramsToRemove, ("".__class__, u"".__class__)):
1146 paramsToRemove = [paramsToRemove]
1148 for key in paramsToRemove:
1149 if key in params:
1150 del params[key]
1152 log.debug('completed the ``_remove_parameters `` function')
1153 return params