diff --git a/genweb/organs/browser/stylesheets/genweb_organs.css b/genweb/organs/browser/stylesheets/genweb_organs.css index eb471aa4..37e49201 100644 --- a/genweb/organs/browser/stylesheets/genweb_organs.css +++ b/genweb/organs/browser/stylesheets/genweb_organs.css @@ -16,11 +16,8 @@ th.centerMiddle { .portaltype-genweb-organs-organgovern div.tab-pane.active, .portaltype-genweb-organs-sessio div.tab-pane.active, .portaltype-genweb-organs-acta div.tab-pane.active { - padding-top: 20px; + padding: 20px; background-color: #f0f0f0; - padding-left: 20px; - padding-bottom: 20px; - padding-right: 20px; } ul#tabs.nav.nav-tabs { @@ -91,9 +88,7 @@ a.collapsed .icon-chevron-down{ background-position: -456px -72px; } -table th { - background-color: #F7F7F7!important; -} + .containerIcons { text-align: center; @@ -824,10 +819,6 @@ padding: 0px 0px 32px 0px !important; top: 30px; z-index: 10; } -.clickable-row:hover { - cursor: pointer; - ; - } .ul-session span { float: right; @@ -1939,3 +1930,115 @@ td.organevent.cal_has_events .popover-content a { right: 3px; } +.calendari { + width: 100%; + text-align: center; + color: #4a4a4a; +} + +.calendari th { + background-color: white; +} + +.calendari th, .calendari td { + text-align: center; + height: 30px; + width: calc(100% / 7); +} + +.portlet-calendari .cal_has_events { + border: 1px solid white; +} + +.portlet-calendari .cal_has_events a { + color: #ffffff; + font-weight: bold; +} + +.cal_has_events { + background-color: #384e65; + text-shadow: none; + cursor: pointer; +} + +.cal_has_events:hover { + filter: brightness(80%); +} + +.icons-ul { + list-style: none; + margin: 15px 0 0 0; + font-size: 14px; + margin-top: 0px; + +} + +.icons-ul li p { + font-weight: bold; +} + +.icons-ul li { + border-bottom: 1px solid #eee; + line-height: 15px; + margin-bottom: 8px; + padding-bottom: 8px; + padding-top: 8px; + padding-left: 8px; + font-size: 14px; + border-left: 5px solid #007bc0; +} + +.icons-ul .text2 { + font-size:13px; +} + +.text2 a { + color: black; +} + +.btn:hover { + filter: brightness(90%); +} + + +#calendari header { + border-bottom: 5px solid #007bc0; + display: flex; +} + +.portlet-calendari .portlet-header { + display: flex; + min-height: 40px; +} + + +.portlet-calendari .calendari-anterior::before, .portlet-calendari .calendari-seguent::before { + content: "\f060"; + font-size: 1.125rem; + font-family: "FontAwesome"; + border-radius: 50%; + padding: 5px; + border: 1px solid transparent; +} + +.portlet-calendari .calendari-anterior:hover::before, .portlet-calendari .calendari-seguent:hover::before { + border: 1px solid #01559B; + transition: .25s all ease; +} + +.portlet-calendari h3 { + font-weight: 700; + font-size: 1.125rem; + text-align: center; + width: 100%; + margin: 2px; +} + +a.calendari-anterior:hover, +a.calendari-seguent:hover { + text-decoration: none; +} + +.portlet-calendari .calendari-seguent::before { + content: "\f061"; +} diff --git a/genweb/organs/browser/stylesheets/print.css b/genweb/organs/browser/stylesheets/print.css index 1768866f..4ef2cfd6 100644 --- a/genweb/organs/browser/stylesheets/print.css +++ b/genweb/organs/browser/stylesheets/print.css @@ -1,156 +1,165 @@ @media print { - body { - width: 210mm; height: 297mm; - margin: 0mm 2mm 20mm 5mm; - } +body { + width: 210mm; height: 297mm; + margin: 0mm 2mm 20mm 5mm; +} - html, body { - font-size: 15pt!important; - font-family: Arial, Helvetica, sans-serif; - line-height: 130% !important; - } +html, body { + font-size: 15pt!important; + font-family: Arial, Helvetica, sans-serif; + line-height: 130% !important; +} li { - line-height: 130% !important; - } + line-height: 130% !important; +} - #portal-header { - padding-bottom:50px; - } +#portal-header { + padding-bottom:50px; +} - .template-printacta header#portal-header { - display: none; - } +.template-printacta header#portal-header { + display: none; +} div.sessionCustomActions {display: none !important;} .sessionActions, #expandAll, #collapseAll, button.label.dropdown-toggle, -button.remove.label.label-important {display: none !important;} - - nav#portal-breadcrumbs, - .nav-collapse-eines, - #portal-personaltools-wrapper, - #portal-globalnav, - #portal-column-one, - .alert, - #edit-bar, - #viewlet-below-content-title, - #viewlet-above-content-title, - .header-image, - #cookies, - .extraInfo, - #commenting, - #viewlet-below-content > a, - input[type="submit"], - #content-core > button, - .linkNotificacions, - .btnActa, - #peu > div > div.row-fluid, - .reply-to-comment-button, - .bannerOrgans { - display: none !important; - } - - #portal-column-content { - margin:0 !important; - width:100% !important; - } - - #peu .span8 { - width:100% !important; - } - - div.pageBreak { - page-break-before: always !important; - } - - #portal-breadcrumbs { - display: inline !important; - } +button.remove.label.label-important { + display: none !important; +} + +nav#portal-breadcrumbs, +.nav-collapse-eines, +#portal-personaltools-wrapper, +#portal-globalnav, +#portal-column-one, +.alert, +#edit-bar, +#viewlet-below-content-title, +#viewlet-above-content-title, +.header-image, +#cookies, +.extraInfo, +#commenting, +#viewlet-below-content > a, +input[type="submit"], +#content-core > button, +.linkNotificacions, +.btnActa, +#peu > div > div.row-fluid, +.reply-to-comment-button, +.bannerOrgans { + display: none !important; +} + +#portal-column-content { + margin:0 !important; + width:100% !important; +} + +#peu .span8 { + width:100% !important; +} + +div.pageBreak { + page-break-before: always !important; +} + +#portal-breadcrumbs { + display: inline !important; +} /* #content a:link:after, #content a:visited:after { content: " [" attr() "] " !important; }*/ - a:hover { - text-decoration:none; - } - - a { - text-decoration:underline; - color: black; - } - - .plain a { - color:#555555; - font-family: Arial, Helvetica, sans-serif; - font-size: 12pt; - } - - h1, h2, h3 { - color: #557C95; - margin-top: 27px; - } - - h1 { - font-size: 24pt; - } - - h1 > span{ - color: #557C95; - } - - h2 { - margin-bottom: 20px !important; - font-size: 20pt; - } - - h3 { - font-family: Arial, Helvetica, sans-serif; - font-size: 18pt; - } - - h4 { - font-size:15pt !important; - } - - .caixa { - width: 9cm; - vertical-align: top; - } - - table { - font-size: 15pt !important; - line-height: 120% !important; - } - - h1.h1Print { - text-align: left; - font-size: 24pt; - } - - .h4Print {color: #557C95; } - - tbody > tr { - height: auto!important; - } - - header#portal-header, - footer#peu { - border: 0px; - } - - section#content-area { - margin-top: 0px; - } - - tbody { - font-size: 15pt !important; - font-family: Arial, Helvetica, sans-serif !important; - line-height: 130% !important;} +a:hover { + text-decoration:none; +} + +a { + text-decoration:underline; + color: black; +} + +.plain a { + color:#555555; + font-family: Arial, Helvetica, sans-serif; + font-size: 12pt; +} + +h1, h2, h3 { + color: #557C95; + margin-top: 27px; +} + +h1 { + font-size: 24pt; +} + +h1 > span{ + color: #557C95; +} + +h2 { + margin-bottom: 20px !important; + font-size: 20pt; +} + +h3 { + font-family: Arial, Helvetica, sans-serif; + font-size: 18pt; +} + +h4 { + font-size:15pt !important; +} + +.caixa { + width: 9cm; + vertical-align: top; +} + +table { + font-size: 15pt !important; + line-height: 120% !important; +} + +h1.h1Print { + text-align: left; + font-size: 24pt; +} + +.h4Print { + color: #557C95; +} + +tbody > tr { + height: auto!important; +} + +header#portal-header, +footer#peu { + border: 0px; +} + +section#content-area { + margin-top: 0px; +} + +tbody { + font-size: 15pt !important; + font-family: Arial, Helvetica, sans-serif !important; + line-height: 130% !important; +} + +.h2butlleti { + line-height: inherit; +} } diff --git a/genweb/organs/browser/utils.py b/genweb/organs/browser/utils.py index 956e3186..cd8967d8 100644 --- a/genweb/organs/browser/utils.py +++ b/genweb/organs/browser/utils.py @@ -315,3 +315,25 @@ def render(self):
usage: /movefilestoprivateorpublic? showfiles\ | move2Private \ | move2Public' + + +class showColorOrgans(grok.View): + + grok.context(IDexterityContent) + grok.name('showColorOrgans') + grok.require('cmf.ManagePortal') + grok.layer(IGenwebOrgansLayer) + + def render(self): + path = '/'.join(self.context.getPhysicalPath()) + all_brains = api.content.find(portal_type='genweb.organs.organgovern', path=path) + results = [] + for brain in all_brains: + obj = brain.getObject() + element = { + 'color': obj.eventsColor, + 'path': obj.absolute_url() + '/edit' + } + + results.append(element) + return json.dumps(results, indent=2, sort_keys=True) diff --git a/genweb/organs/browser/views/butlleti.pt b/genweb/organs/browser/views/butlleti.pt index 1c3d568b..bfbf9505 100644 --- a/genweb/organs/browser/views/butlleti.pt +++ b/genweb/organs/browser/views/butlleti.pt @@ -77,7 +77,7 @@ - Butlletin Session Title -

Butlletin Session Title

+

Butlletin Session Title

@@ -93,7 +93,7 @@ - Butlletin Session Title

-

Butlletin Session Title

+

Butlletin Session Title

diff --git a/genweb/organs/content/templates/organgovern_view.pt b/genweb/organs/content/templates/organgovern_view.pt index df33b035..418ea763 100644 --- a/genweb/organs/content/templates/organgovern_view.pt +++ b/genweb/organs/content/templates/organgovern_view.pt @@ -55,7 +55,7 @@
  •  Actes
  • - +
    @@ -76,11 +76,11 @@ - + @@ -160,19 +160,19 @@ - - + - -
      - Item Title - [ + Item Title + [ Session Number ]
    +
      - + Item Title - + + Numero Acord +   @@ -188,23 +188,22 @@ - - - + - - -
    + Titol + Data
      - + Item Title - + @@ -222,12 +221,6 @@ - - diff --git a/genweb/organs/content/templates/sessio_view.pt b/genweb/organs/content/templates/sessio_view.pt index fe2f1d75..8704b6fe 100644 --- a/genweb/organs/content/templates/sessio_view.pt +++ b/genweb/organs/content/templates/sessio_view.pt @@ -300,20 +300,20 @@
    + + tal:attributes="href item/absolute_url;" + tal:content="item/title"> Item Title + Numero Acord +   diff --git a/genweb/organs/portlets/portlet_calendar.pt b/genweb/organs/portlets/portlet_calendar.pt index edaeb764..8b3958cc 100644 --- a/genweb/organs/portlets/portlet_calendar.pt +++ b/genweb/organs/portlets/portlet_calendar.pt @@ -1,50 +1,37 @@ -
    -
    +
    -
    +
    -
    -

    - - - - monthname - year - - - - -

    -
    +
    + +

    + + monthname + + + year + +

    + +
    + +
    - - - - + + + + + @@ -55,27 +42,100 @@ events day/events; classtag python:view.getclasstag_event(day); limit python:len(events) if events is not None else 0" - tal:attributes="class python:u'ulearnevent%s%s%s%s%s' % + tal:attributes="class python:u'%s%s%s%s%s' % ((today and ' today' or ''), (next_month and ' cal_next_month' or ''), (prev_month and ' cal_prev_month' or ''), (events and ' cal_has_events' or ''), (classtag or '')); - style string:background-color:${day/color}"> - 31 - - - - + style string:background-color:${day/color}; + data-year day/year; data-month day/month; data-day day/day;"> + 31 + + +
    Su
    Su
    +
    +
    + + + diff --git a/genweb/organs/portlets/portlet_calendar.py b/genweb/organs/portlets/portlet_calendar.py index 7e0a4ea8..88092a71 100644 --- a/genweb/organs/portlets/portlet_calendar.py +++ b/genweb/organs/portlets/portlet_calendar.py @@ -17,8 +17,14 @@ from zope.formlib import form from zope.i18nmessageid import MessageFactory from zope.interface import implements +from datetime import datetime +from plone.app.event.base import localized_now +from plone.event.interfaces import IEvent +from datetime import timedelta + import calendar +import itertools PLMF = MessageFactory('plonelocales') @@ -154,6 +160,122 @@ def getclasstag_event(self, day): classtag += ' event-multiple ' return classtag + def getDateEvents(self): + formatDate = "%Y-%m-%d" + if 'day' in self.request.form: + date = '{}-{}-{}'.format(self.request.form['year'], self.request.form['month'], self.request.form['day']) + else: + date = datetime.today().strftime(formatDate) + dateEvent = datetime.strptime(date, formatDate) + return dateEvent + + def getNextThreeEvents(self): + context = aq_inner(self.context) + query_kw = {} + # if self.search_base: + # portal = getToolByName(context, 'portal_url').getPortalObject() + # query_kw['path'] = {'query': '%s%s' % ( + # '/'.join(portal.getPhysicalPath()), self.search_base)} + + # if self.state: + # query_kw['review_state'] = self.state + + events = get_events(context, ret_mode=RET_MODE_OBJECTS, expand=True, **query_kw) + events = self.filterNextEvents(events) + events = self.filterOccurrenceEvents(events) + + list_events = [] + for event in events[:3]: + list_events.append(self.getEventCalendarDict(event)) + + return list_events + + def getEventCalendarDict(self, event): + start = event.start.strftime('%d/%m') + searchStart = event.start.strftime('%m/%s') + end = event.end.strftime('%d/%m') + end = None if end == start else end + return dict(Title=event.title, + getURL=event.absolute_url(), + start=start, + searchStart=searchStart, + end=end, + community_type='event.community_type', + community_name=event.aq_parent.aq_parent.title, + community_url=event.aq_parent.aq_parent.absolute_url()) + + def filterOccurrenceEvents(self, events): + filter_events = [] + for event in events: + if not IEvent.providedBy(event): + ocurrence = event + event = event.aq_parent + if event not in filter_events: + event.ocstart = ocurrence.start + event.ocend = ocurrence.end + filter_events.append(event) + else: + filter_events.append(event) + + return filter_events + + def filterNextEvents(self, events): + filter_events = [] + for event in events: + if event.end > localized_now(): + filter_events.append(event) + return filter_events + + def getDayEventsGroup(self): + group_events = [] + if 'day' not in self.request.form and 'month' in self.request.form: + return None + + if 'day' not in self.request.form and 'month' not in self.request.form: + list_events = self.getNextThreeEvents() + else: + list_events = self.getDayEvents(self.getDateEvents()) + + if len(list_events): + list_events = sorted(list_events, key=lambda x: x['community_name']) + for key, group in itertools.groupby(list_events, key=lambda x: x['community_name']): + events = [event for event in group] + events = sorted(events, key=lambda x: (x['searchStart'], x['Title'])) + group_events.append(dict(Title=key, + getURL=events[0]['getURL'], + community_url=events[0]['community_url'], + community_type=events[0]['community_type'], + community_name=events[0]['community_name'], + num_events=len(events), + events=events)) + return group_events + else: + return None + + def getDayEvents(self, date): + events = self.getCalendarDict() + list_events = [] + if date.strftime('%Y-%m-%d') in events: + events = self.filterOccurrenceEvents(events[date.strftime('%Y-%m-%d')]) + for event in events: + list_events.append(self.getEventCalendarDict(event)) + return list_events + + def getCalendarDict(self): + context = aq_inner(self.context) + year, month = self.year_month_display() + monthdates = [dat for dat in self.cal.itermonthdates(year, month)] + + query_kw = {} + start = monthdates[0] + end = monthdates[-1] + events = get_events(context, + start=start - timedelta(days=30), + end=end, + ret_mode=RET_MODE_OBJECTS, + expand=True, **query_kw) + return construct_calendar(events, start=start, end=end) + @property def cal_data(self): """Calendar iterator over weeks and days of the month to display. @@ -212,6 +334,8 @@ def cal_data(self): caldata[-1].append( {'date': dat, 'day': dat.day, + 'month': dat.month, + 'year': dat.year, 'prev_month': dat.month < month, 'next_month': dat.month > month, 'color': color,