Changeset 7702
- Timestamp:
- 25 Feb 2012, 10:21:54 (13 years ago)
- Location:
- main/waeup.sirp/trunk/src/waeup/sirp
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.sirp/trunk/src/waeup/sirp/browser/pages.py
r7700 r7702 292 292 @property 293 293 def frontpage(self): 294 return self.context['configuration'].frontpage_html 294 portal_language = getUtility(ISIRPUtils).PORTAL_LANGUAGE 295 lang = self.request.cookies.get('sirp.language', portal_language) 296 return self.context['configuration'].frontpage_dict.get(lang,'') 295 297 296 298 class AdministrationPage(SIRPPage): … … 623 625 _('Add session configuration'), 624 626 _('Remove selected')] 625 626 form_fields = grok.AutoFields(IConfigurationContainer) 627 form_fields['frontpage_html'].for_display = True 627 form_fields = grok.AutoFields(IConfigurationContainer).omit('frontpage_dict') 628 628 629 629 def update(self): … … 638 638 return super(ConfigurationContainerManageFormPage, self).update() 639 639 640 def frontpage(self):640 def _frontpage(self): 641 641 view = ConfigurationContainerDisplayFormPage( 642 642 self.context,self.request) … … 647 647 def save(self, **data): 648 648 self.applyData(self.context, **data) 649 self.context.frontpage_ html = self.frontpage()649 self.context.frontpage_dict = self._frontpage() 650 650 self.flash(_('Settings have been saved.')) 651 651 return -
main/waeup.sirp/trunk/src/waeup/sirp/browser/static/waeup-base.css
r7684 r7702 104 104 } 105 105 106 textarea { 107 font-family: Courier, "Courier New", monospace; 108 } 109 106 110 /* IE doesn't like the footer tag*/ 107 111 .footer { -
main/waeup.sirp/trunk/src/waeup/sirp/frontpage.rst
r6361 r7702 30 30 31 31 Text 32 33 >>de<< 34 Dies ist die Standard-Startseite des Portals. Sie wurde in der Markup-Sprache 35 `reStructuredText (reST) <http://docutils.sourceforge.net/docs/user/rst/quickref.html>`_ 36 geschrieben. 37 38 Weitere reST-Beispiele zur Einführung: 39 40 1. Überschrift 41 ============== 42 43 Text 44 45 1.2 Überschrift 46 --------------- 47 48 Text 49 50 2. Überschrift 51 ============== 52 53 Text 54 55 2.1 Überschrift 56 --------------- 57 58 Text 59 60 2.2 Überschrift 61 --------------- 62 63 Text -
main/waeup.sirp/trunk/src/waeup/sirp/interfaces.py
r7677 r7702 18 18 import os 19 19 import re 20 import codecs 20 21 import zope.i18nmessageid 21 22 from datetime import datetime … … 44 45 VALIDATED = 'courses validated' 45 46 46 default_frontpage = u'' + open(os.path.join( 47 os.path.dirname(__file__), 'frontpage.rst'), 'rb').read() 47 default_frontpage = u'' + codecs.open(os.path.join( 48 os.path.dirname(__file__), 'frontpage.rst'), 49 encoding='utf-8', mode='rb').read() 48 50 49 51 def SimpleSIRPVocabulary(*terms): … … 416 418 ) 417 419 418 frontpage_ html = schema.Text(419 title = u'Content in HTMLformat',420 frontpage_dict = schema.Dict( 421 title = u'Content as language dictionary with values in html format', 420 422 required = False, 423 default = {}, 421 424 ) 422 425 -
main/waeup.sirp/trunk/src/waeup/sirp/widgets/restwidget.py
r7385 r7702 18 18 """A widget that renders restructured text. 19 19 """ 20 from zope.component import getUtility 20 21 from zope.formlib.widget import renderElement, DisplayWidget 21 22 from waeup.sirp.utils.helpers import ReST2HTML 23 from waeup.sirp.interfaces import ISIRPUtils 22 24 23 25 … … 27 29 28 30 def __call__(self): 31 """The ReSTDisplayWidget transforms a ReST text string into 32 a dictionary. 33 34 Different languages must be separated by `<<xy>>` whereas 35 xy is the language code. Text parts without correct leading 36 language separator - usually the first part has no language 37 descriptor - are interpreted as texts in the portal's language. 38 The latter can be configured in waeup.srp.utils.utils.SIRPUtils. 39 """ 29 40 if self._renderedValueSet(): 30 41 value = self._data … … 33 44 if value == self.context.missing_value: 34 45 return "" 35 return renderElement(u'div id="rest"', 36 contents=ReST2HTML(value)) 46 parts = value.split('>>') 47 elements = {} 48 lang = getUtility(ISIRPUtils).PORTAL_LANGUAGE 49 for part in parts: 50 if part[2:4] == u'<<': 51 lang = part[0:2].lower() 52 text = part[4:] 53 elements[lang] = renderElement(u'div id="rest"', 54 contents=ReST2HTML(text)) 55 else: 56 text = part 57 elements[lang] = renderElement(u'div id="rest"', 58 contents=ReST2HTML(text)) 59 return elements
Note: See TracChangeset for help on using the changeset viewer.