Mercurial > hg > MPIWGWeb
changeset 243:980794794bb5
added preferences for number of publications, talks, and teachings on profile page.
author | casties |
---|---|
date | Fri, 07 Feb 2014 14:53:37 +0100 |
parents | 0b7a95c02f68 |
children | dd667083a56d |
files | MPIWGStaff.py zpt/staff/edit_publications.zpt zpt/staff/edit_talks.zpt zpt/staff/edit_teaching.zpt zpt/staff/member_index_html.zpt |
diffstat | 5 files changed, 41 insertions(+), 23 deletions(-) [+] |
line wrap: on
line diff
--- a/MPIWGStaff.py Fri Feb 07 12:39:08 2014 +0100 +++ b/MPIWGStaff.py Fri Feb 07 14:53:37 2014 +0100 @@ -568,7 +568,9 @@ url = argv.get('ics_url', None) if url: + # # ICS URL driven talks + # cal_id = "%s_talks"%self.getUsername() # use ICS calendar cal = self.getTalksCal() @@ -589,12 +591,18 @@ upcoming = argv.get('only_upcoming', None) cal.setFlag('only_upcoming', (upcoming == 'yes')) # number of events - cal.setFlag('show_num', int(argv.get('show_num', 5))) + talks_num = int(argv.get('talks_num', 5)) + self.changeData({'talks_num': talks_num}) - # manually edited talks elif argv.has_key('main_fields'): #got data to change + # + # manually edited talks + # self.invalidate_cache() self.changeAdditionalData(argv); + # number of events + talks_num = int(argv.get('talks_num', 5)) + self.changeData({'talks_num': talks_num}) return pt() @@ -608,6 +616,9 @@ if argv.has_key('main_fields'): #got data to change self.invalidate_cache() self.changeAdditionalData(argv); + # number of items + teachings_num = int(argv.get('teachings_num', 5)) + self.changeData({'teachings_num': teachings_num}) pt=PageTemplateFile('zpt/staff/edit_teaching.zpt', globals()).__of__(self) return pt() @@ -637,13 +648,16 @@ def editPublications(self,REQUEST): """editiere die Publications von der Webseite""" data=REQUEST.form + newData = {} - if data.has_key('selectionMode'): - query="UPDATE personal_www SET publications_mode=%s WHERE key=%s" + if 'selectionMode' in data: + newData['publications_mode'] = data['selectionMode'] - self.executeZSQL(query,[data['selectionMode'],self.getKey()]) - - self.refresh_content() + if 'publications_num' in data: + newData['publications_num'] = int(data['publications_num']) + + if len(newData) > 0: + self.changeData(newData) pt=PageTemplateFile('zpt/staff/edit_publications.zpt', globals()).__of__(self) return pt()
--- a/zpt/staff/edit_publications.zpt Fri Feb 07 12:39:08 2014 +0100 +++ b/zpt/staff/edit_publications.zpt Fri Feb 07 14:53:37 2014 +0100 @@ -17,6 +17,9 @@ Show selected publications. </p> <p> + Number of items on profile page: <input name="publications_num" size="2" tal:attributes="value python:here.content.publications_num or 5"/> + </p> + <p> <input type="submit" value="Set mode" /> </p> </form>
--- a/zpt/staff/edit_talks.zpt Fri Feb 07 12:39:08 2014 +0100 +++ b/zpt/staff/edit_talks.zpt Fri Feb 07 14:53:37 2014 +0100 @@ -75,10 +75,9 @@ Show only upcoming events in the calendar: <span metal:use-macro="here/common_template/macros/yesno_input_radio"/> </tal:block> </p> - <p tal:condition="cal"> - Number of events to show: <input name="show_num" size="2" tal:attributes="value python:cal.getFlag('show_num', 5)"/> + <p> + Number of items on profile page: <input name="talks_num" size="2" tal:attributes="value python:here.content.talks_num or 5"/> </p> - <p> <input type="submit" value="submit"/> </p>
--- a/zpt/staff/edit_teaching.zpt Fri Feb 07 12:39:08 2014 +0100 +++ b/zpt/staff/edit_teaching.zpt Fri Feb 07 14:53:37 2014 +0100 @@ -6,8 +6,8 @@ <tal:block metal:fill-slot="body"> <form tal:attributes="action string:$root/editTeaching" method="post"> - <input type="hidden" name="key_main" tal:attributes="value python:here.content.key"> - <input type="hidden" name="main_fields" value="teaching__title"> + <input type="hidden" name="key_main" tal:attributes="value python:here.content.key"/> + <input type="hidden" name="main_fields" value="teaching__title"/> <table tal:define="teachings python:here.getTeaching(published=False)"> <tr> <th>Date</th> @@ -53,6 +53,9 @@ </tr> </table> <p> + Number of items on profile page: <input name="teachings_num" size="2" tal:attributes="value python:here.content.teachings_num or 5"/> + </p> + <p> <input type="submit" value="submit"/> </p>
--- a/zpt/staff/member_index_html.zpt Fri Feb 07 12:39:08 2014 +0100 +++ b/zpt/staff/member_index_html.zpt Fri Feb 07 14:53:37 2014 +0100 @@ -51,9 +51,8 @@ </div> <!-- publications --> - <!-- tal:define="publications python:here.ZDBInlineSearch(_table='pubmanbiblio',key_main=key,_op_key_main='eq')" --> <tal:block - tal:define="publications python:member.getPublicationsFromPubman(limit=6)" + tal:define="show_num python:content.publications_num or 5; publications python:member.getPublicationsFromPubman(limit=show_num+1)" tal:condition="publications"> <h2 class="line">Selected publications</h2> @@ -68,15 +67,15 @@ <span tal:repeat="ident python:publication[4]"><a class="external" target="_blank" tal:attributes="href python:ident[1]" tal:content="python:ident[0]">See also</a></span> </li> </ul> - <p tal:condition="python:len(publications)>5"> + <p tal:condition="python:len(publications)>show_num"> <a class="internal" tal:attributes="href string:$baseUrl/publications_full_html">More publications</a> </p> </tal:block> <!-- Talks --> - <tal:block tal:define="calendar member/getTalksCal"> + <tal:block tal:define="calendar member/getTalksCal; show_num python:content.talks_num or 5"> <tal:block tal:condition="calendar"> - <tal:block tal:define="upcoming python:calendar.getFlag('only_upcoming', False); show_num python:calendar.getFlag('show_num', 5); + <tal:block tal:define="upcoming python:calendar.getFlag('only_upcoming', False); talks python:test(upcoming, calendar.getAllItemsFromTodayOn()[:show_num], calendar.getNext(show_num, reverse=True))" tal:condition="talks"> <h2 class="line" tal:condition="upcoming">Upcoming talks and presentations</h2> @@ -92,7 +91,7 @@ </tal:block> </tr> </table> - <p tal:condition="python:len(calendar.getItems())>5"> + <p tal:condition="python:len(calendar.getItems())>show_num"> <a class="internal" tal:attributes="href string:$baseUrl/talks_full_html">More</a> </p> </tal:block> @@ -103,14 +102,14 @@ <h2 class="line">Talks and presentations</h2> <table class="items shorter"> - <tr tal:repeat="talk python:here.ZDBSlice(talks,size=5)"> + <tr tal:repeat="talk python:here.ZDBSlice(talks,size=show_num)"> <td width="25%" tal:content="talk/date" /> <td><a class="external" target="_blank" tal:omit-tag="not:talk/link" tal:attributes="href talk/link"> <span tal:replace="talk/place" /> – <i><span tal:replace="talk/title" /></i> </a></td> </tr> </table> - <p tal:condition="python:len(talks)>5"> + <p tal:condition="python:len(talks)>show_num"> <a class="internal" tal:attributes="href string:$baseUrl/talks_full_html">More</a> </p> </tal:block> @@ -118,12 +117,12 @@ </tal:block> <!-- Teaching activities --> - <tal:block tal:define="teachings member/getTeaching" tal:condition="teachings"> + <tal:block tal:define="teachings member/getTeaching; show_num python:content.teachings_num or 5" tal:condition="teachings"> <h2 class="line">Teaching activities</h2> <table class="items shorter"> - <tr tal:repeat="teaching python:here.ZDBSlice(teachings, size=5)"> + <tr tal:repeat="teaching python:here.ZDBSlice(teachings, size=show_num)"> <td width="25%"> <a tal:omit-tag="not:teaching/link" tal:attributes="href teaching/link"> <span tal:replace="teaching/date" /> </a> @@ -135,7 +134,7 @@ </td> </tr> </table> - <p tal:condition="python:len(teachings)>5"> + <p tal:condition="python:len(teachings)>show_num"> <a class="internal" tal:attributes="href string:$baseUrl/teaching_full_html">More</a> </p> </tal:block>