Changeset 1ced41a in indico
- Timestamp:
- 08/05/11 10:53:27 (22 months ago)
- Branches:
- master, hello-world-walkthrough, ipv6, v0.98-series, v0.98.2, v0.98.3, v0.98b2, v0.99, 051b2622c51afb171a1dedb46a0df4fbb0cbd02e, 0da0c1403bae8e51d8229f460181c71b9e6dda72
- Children:
- c87441
- Parents:
- 60171b
- git-author:
- Marius Damarackas <marius.damarackas@…> (04/13/11 14:40:39)
- git-committer:
- Jose Benito <jose.benito.gonzalez@…> (08/05/11 10:53:27)
- Location:
- indico/MaKaC
- Files:
-
- 13 edited
- 1 moved
-
common/Configuration.py (modified) (4 diffs)
-
common/info.py (modified) (3 diffs)
-
services/implementation/conference.py (modified) (1 diff)
-
webinterface/pages/admins.py (modified) (2 diffs)
-
webinterface/pages/category.py (modified) (4 diffs)
-
webinterface/pages/conferences.py (modified) (3 diffs)
-
webinterface/rh/admins.py (modified) (3 diffs)
-
webinterface/rh/categoryDisplay.py (modified) (1 diff)
-
webinterface/rh/conferenceDisplay.py (modified) (2 diffs)
-
webinterface/tpls/AdminsAddStyle.tpl (modified) (2 diffs)
-
webinterface/tpls/AdminsStyles.tpl (modified) (3 diffs)
-
webinterface/tpls/EventModifMainData.tpl (modified) (1 diff)
-
webinterface/tpls/events/Indico.tpl (moved) (moved from indico/MaKaC/webinterface/tpls/events/Meeting.tpl)
-
webinterface/wcomponents.py (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
indico/MaKaC/common/Configuration.py
r137cf0 r1ced41a 260 260 # default values - Administrators can update this list from the Indico 261 261 # administration web interface 262 __stylesheets = { 263 "cdsagenda_olist": "CDS Agenda ordered list", 264 "nicecompact":"Compact style", 265 "ilc":"ILC style", 266 "standard_inline_minutes":"Indico style - inline minutes", 267 "lhcrrb":"LHC RRB", 268 "xml":"Simple xml", 269 "alice_meeting":"ALICE meeting", 270 "administrative3": "Administrative style 2", 271 "administrative4": "Administrative style (all material)", 272 "atlas":"ATLAS Meeting", 273 "text":"Simple text", 274 "totem_meeting":"TOTEM Meeting", 275 "administrative2":"Administrative style (with time)", 276 "cdsagenda":"CDS Agenda style", 277 "static":"Parallel", 278 "sa":"Staff Association", 279 "sa2":"Staff Association (with time)", 280 "it":"IT style", 281 "cdsagenda_inline_minutes":"CDS Agenda inline minutes", 282 "lcg":"LCG style", 283 "lhcb_meeting":"LHCb meeting", 284 "egee_meeting":"EGEE meeting", 285 "administrative":"Administrative style", 286 "cms":"CMS Meeting", 287 "standard":"Indico style", 288 "lecture":"Lecture", 289 "egee_lecture":"EGEE lecture", 290 "event": "Event" } 262 __styles = { 263 "cdsagenda_olist": ("CDS Agenda ordered list", "CDSAgendaOrdered.tpl"), 264 "nicecompact": ("Compact style", "Compact.tpl"), 265 "ilc": ("ILC style", "ILC.tpl"), 266 "standard_inline_minutes": ("Indico style - inline minutes", "IndicoWithMinutes.tpl"), 267 "lhcrrb": ("LHC RRB", "LHCRBB.tpl"), 268 "xml": ("Simple xml", "SimpleXML.tpl"), 269 "alice_meeting": ("ALICE meeting", "ALICEMeeting.tpl"), 270 "administrative3": ("Administrative style 2", "Administrative3.tpl"), 271 "administrative4": ("Administrative style (all material)", "Administrative4.tpl"), 272 "atlas": ("ATLAS Meeting", "ATLASMeeting.tpl"), 273 "text": ("Simple text", "SimpleText.tpl"), 274 "totem_meeting": ("TOTEM Meeting", "TOTEMMeeting.tpl"), 275 "administrative2": ("Administrative style (with time)", "Administrative2.tpl"), 276 "cdsagenda": ("CDS Agenda style", "CDSAgenda.tpl"), 277 "static": ("Parallel", None), 278 "sa": ("Staff Association", "StaffAssociation.tpl"), 279 "sa2": ("Staff Association (with time)", "StaffAssociationWithTime.tpl"), 280 "it": ("IT style", "IT.tpl"), 281 "cdsagenda_inline_minutes": ("CDS Agenda inline minutes", "CDSAgendaWithMinutes.tpl"), 282 "lcg": ("LCG style", "LCG.tpl"), 283 "lhcb_meeting": ("LHCb meeting", "LHCbMeeting.tpl"), 284 "egee_meeting": ("EGEE meeting", "EGEEMeeting.tpl"), 285 "cms": ("CMS Meeting", "CMSMeeting.tpl"), 286 "standard": ("Indico style", "Indico.tpl"), 287 "lecture": ("Lecture", "Lecture.tpl"), 288 "egee_lecture": ("EGEE lecture", "EGEELecture.tpl"), 289 "event": ("Event", "Event.tpl"), 290 "jacow": ("JACoW XML", "JACoW.tpl"), 291 "endotofpet": ("EndoTOFPET", "EndoTOFPET.tpl"), 292 "pf": ("Pension Fund", "PensionFund.tpl"), 293 "crystal_clear": ("Crystal Clear", "CrystalClear.tpl"), 294 "openlab": ("Openlab", "Openlab.tpl"), 295 } 291 296 292 297 # default values - Administrators can update this list from the Indico … … 294 299 __eventStylesheets = { 295 300 "conference": [ 301 "administrative3", 302 "cdsagenda", 303 "cdsagenda_inline_minutes", 304 "cdsagenda_olist", 305 "egee_meeting", 296 306 "it", 297 "administrative3", 298 "administrative4", 299 "cdsagenda", 307 "jacow", 308 "lhcb_meeting", 309 "nicecompact", 310 "standard", 311 "static", 300 312 "text", 301 "egee_meeting", 302 "administrative", 303 "cdsagenda_olist", 304 "standard", 305 "nicecompact", 306 "cdsagenda_inline_minutes", 307 "lhcb_meeting", 308 "xml", 309 "static" ], 313 "xml"], 310 314 "simple_event": [ 311 315 "it", … … 314 318 "lecture", 315 319 "egee_lecture", 320 "jacow", 316 321 "xml", 317 322 "event" ], 318 323 "meeting": [ 319 "cdsagenda_olist", 320 "nicecompact", 321 "ilc", 322 "standard_inline_minutes", 323 "lhcrrb", 324 "xml", 325 "alice_meeting", 324 "administrative2", 326 325 "administrative3", 327 326 "administrative4", 327 "alice_meeting", 328 328 "atlas", 329 "cdsagenda", 330 "cdsagenda_inline_minutes", 331 "cdsagenda_olist", 332 "cms", 333 "crystal_clear", 334 "egee_meeting", 335 "endotofpet", 336 "ilc", 337 "it", 338 "lcg", 339 "lhcb_meeting", 340 "lhcrrb", 341 "nicecompact", 342 "openlab" 343 "pf", 344 "sa", 345 "sa2", 346 "standard", 347 "standard_inline_minutes", 348 "static", 329 349 "text", 330 350 "totem_meeting", 331 "administrative2", 332 "cdsagenda", 333 "static", 334 "sa", 335 "sa2", 336 "it", 337 "cdsagenda_inline_minutes", 338 "lcg", 339 "lhcb_meeting", 340 "egee_meeting", 341 "administrative", 342 "cms", 343 "standard" ] 351 "xml"] 344 352 } 353 345 354 346 355 # default values - Administrators can update this list from the Indico … … 489 498 'PublicURL' : "%s/%s" % (self.getBaseURL(), self.getPublicFolder()), 490 499 'SystemIcons' : self.__systemIcons, 491 'Styles heets' : self.__stylesheets,500 'Styles' : self.__styles, 492 501 'EventStylesheets' : self.__eventStylesheets, 493 502 'TempDir' : self.getUploadedFilesTempDir(), -
indico/MaKaC/common/info.py
r2da75d r1ced41a 432 432 433 433 class StyleManager(Persistent): 434 """This class manages the styles heetsused by the server for the display434 """This class manages the styles used by the server for the display 435 435 of events timetables 436 436 """ 437 437 438 438 def __init__( self ): 439 self._styles heets = Config.getInstance().getStylesheets()439 self._styles = Config.getInstance().getStyles() 440 440 self._eventStylesheets = Config.getInstance().getEventStylesheets() 441 441 self._defaultEventStylesheet = Config.getInstance().getDefaultEventStylesheet() 442 442 443 def getStylesheets(self): 444 """gives back the entire stylesheet list. 445 """ 446 return self._stylesheets 447 448 def setStylesheets(self, sList=[]): 449 self._stylesheets = sList 450 451 def getEventStylesheets(self): 452 """gives back the entire stylesheet/event association list. 443 def getStyles(self): 444 try: 445 return self._styles 446 except AttributeError: 447 self._styles = Config.getInstance().getStyles() 448 return self._styles 449 450 def setStyles(self, newStyles): 451 self._styles = newStyles 452 453 def getEventStyles(self): 454 """gives back the entire style/event association list. 453 455 """ 454 456 return self._eventStylesheets 455 457 456 def setEventStyles heets(self, sDict={}):458 def setEventStyles(self, sDict={}): 457 459 self._eventStylesheets = sDict 458 460 459 def getDefaultEventStyles heet(self):460 """gives back the default styles heet/event association461 def getDefaultEventStyles(self): 462 """gives back the default styles/event association 461 463 """ 462 464 return self._defaultEventStylesheet 463 465 464 def setDefaultEventStyle sheet(self, sDict={}):466 def setDefaultEventStyle(self, sDict={}): 465 467 self._defaultEventStylesheet = sDict 466 468 467 def getDefaultStyle sheetForEventType(self, type):469 def getDefaultStyleForEventType(self, eventType): 468 470 """gives back the default stylesheet for the given type of event 469 471 """ 470 return self._defaultEventStylesheet.get( type,"")471 472 def removeStyle( self, style, type=""):472 return self._defaultEventStylesheet.get(eventType, "") 473 474 def removeStyle(self, styleId, type=""): 473 475 if type == "": 474 476 # style globally removed 475 if style in self.getStylesheets().keys():476 styles = self.getStylesheets()477 del styles[style ]478 self.setStyles heets(styles)479 self.removeStyleFromAllTypes(style )477 styles = self.getStyles() 478 if styleId in styles.keys(): 479 del styles[styleId] 480 self.setStyles(styles) 481 self.removeStyleFromAllTypes(styleId) 480 482 else: 481 483 # style removed only in the type list 482 self.removeStyleFromEventType(style , type)484 self.removeStyleFromEventType(styleId, type) 483 485 484 486 def addStyleToEventType( self, style, type ): 485 dict = self.getEventStyles heets()487 dict = self.getEventStyles() 486 488 styles = dict.get(type,[]) 487 489 if style not in styles: 488 490 styles.append(style) 489 491 dict[type] = styles 490 self.setEventStyles heets(dict)492 self.setEventStyles(dict) 491 493 492 494 def removeStyleFromEventType( self, style, type ): 493 495 # style removed only in the type list 494 dict = self.getEventStyles heets()496 dict = self.getEventStyles() 495 497 styles = dict.get(type,[]) 496 defaultStyle = self.getDefaultStyle sheetForEventType(type)498 defaultStyle = self.getDefaultStyleForEventType(type) 497 499 if style != "" and style in styles: 498 500 styles.remove(style) 499 501 dict[type] = styles 500 self.setEventStyles heets(dict)502 self.setEventStyles(dict) 501 503 if style.strip() == defaultStyle.strip(): 502 504 if len(styles) > 0: … … 508 510 def setDefaultStyle( self, style, type ): 509 511 if style != "": 510 dict = self.getDefaultEventStyles heet()512 dict = self.getDefaultEventStyles() 511 513 dict[type] = style 512 self.setDefaultEventStyle sheet(dict)514 self.setDefaultEventStyle(dict) 513 515 514 516 def removeStyleFromAllTypes( self, style ): … … 516 518 self.removeStyleFromEventType(style, type) 517 519 518 def getStyle sheetListForEventType(self, type):519 """gives back the style sheetlist associated to a given type of event.520 def getStyleListForEventType(self, eventType): 521 """gives back the style list associated to a given type of event. 520 522 If no event was specified it returns the empty list. 521 523 Params: 522 524 type -- unique identifier of the event type 523 525 """ 524 return self._eventStylesheets.get( type, [] ) 525 526 def getStylesheetDictForEventType(self, type): 527 """gives back the stylesheet list associated to a given type of event. 526 return self._eventStylesheets.get(eventType, []) 527 528 def getExistingStylesForEventType(self, eventType): 529 result = [] 530 for style in self.getStyleListForEventType(eventType): 531 if self.existsTPLFile(style) or style == 'static': 532 result.append(style) 533 return result 534 535 def getStyleDictForEventType(self, type): 536 """gives back the style list associated to a given type of event. 528 537 If no event was specified it returns the empty list. 529 538 Params: 530 539 type -- unique identifier of the event type 531 540 """ 532 return dict((ssid, self._stylesheets[ssid]) for ssid in self._eventStylesheets.get( type, [] )) 533 534 def getStylesheetName( self, stylesheet ): 535 return self._stylesheets.get( stylesheet, "" ) 536 537 def getBaseXSLPath( self ): 538 return Config.getInstance().getStylesheetsDir() 539 540 def getXSLPath( self, stylesheet ): 541 if stylesheet.strip() != "": 542 basepath = Config.getInstance().getStylesheetsDir() 543 path = os.path.join( basepath, "%s.xsl" % stylesheet ) 541 styles = self.getStyles() 542 return dict((styleID, styles[styleID]) for styleID in self._eventStylesheets.get(type, [])) 543 544 def getStyleName(self, styleId): 545 styles = self.getStyles() 546 if styleId in styles: 547 return styles[styleId][0] 548 else: 549 return "" 550 551 def getBaseTPLPath(self): 552 tplDir = Config.getInstance().getTPLDir() 553 return os.path.join(tplDir, "events") 554 555 def existsTPLFile(self, styleId): 556 if styleId.strip() != "": 557 tplFile = self.getTPLFilename(styleId) 558 if not tplFile: 559 return False 560 path = os.path.join(self.getBaseTPLPath(), tplFile) 544 561 if os.path.exists(path): 545 return path 546 return "" 547 548 def getXSLFile( self, stylesheet ): 549 if self.getXSLPath( stylesheet ): 550 return "%s.xsl" % stylesheet 551 return "" 562 return True 563 return False 564 565 def getStyleFilenames(self): 566 return [fileName for styleName, fileName in self.getStyles().values()] 567 568 def getTPLFilename(self, styleId): 569 styles = self.getStyles() 570 if styleId in styles: 571 fileName = styles[styleId][1] 572 return fileName 573 else: 574 return None 552 575 553 576 def getBaseCSSPath( self ): -
indico/MaKaC/services/implementation/conference.py
rf6e097 r1ced41a 182 182 183 183 dispMgr = displayMgr.ConfDisplayMgrRegistery().getDisplayMgr(self._target) 184 dispMgr.setDefaultStyle(styleMgr.getDefaultStyle sheetForEventType(newType))184 dispMgr.setDefaultStyle(styleMgr.getDefaultStyleForEventType(newType)) 185 185 186 186 def _handleGet(self): -
indico/MaKaC/webinterface/pages/admins.py
r137cf0 r1ced41a 852 852 styleMgr = info.HelperMaKaCInfo.getMaKaCInfoInstance().getStyleManager() 853 853 vars["styleMgr"] = styleMgr 854 base XSLPath = styleMgr.getBaseXSLPath()854 baseTPLPath = styleMgr.getBaseTPLPath() 855 855 baseCSSPath = styleMgr.getBaseCSSPath() 856 vars["contextHelpText"] = i18nformat("""- <b>_(" XSL files")</b> _("are mandatory and located in"):<br/>%s<br/>- <b>_("CSS files")</b> _("are optional and located in"):<br/>%s<br/>- <b>_("Lines in red")</b> _("indicate a missing .xsl file (these styles will not be presented to the users"))<br/>- <b>_("XSL and CSS files")</b> _("should be named after the ID of the style (+extension: .xsl or .css)")""") % (baseXSLPath,baseCSSPath)856 vars["contextHelpText"] = i18nformat("""- <b>_("TPL files")</b> _("are mandatory and located in"):<br/>%s<br/>- <b>_("CSS files")</b> _("are optional and located in"):<br/>%s<br/>- <b>_("Lines in red")</b> _("indicate a missing .tpl file (these styles will not be presented to the users"))<br/>- <b>_("CSS files")</b> _("should be named after the ID of the style (plus extension .css)")""") % (baseTPLPath,baseCSSPath) 857 857 vars["deleteIconURL"] = Config.getInstance().getSystemIconURL("remove") 858 858 return vars … … 870 870 styleMgr = info.HelperMaKaCInfo.getMaKaCInfoInstance().getStyleManager() 871 871 vars["styleMgr"] = styleMgr 872 availableStylesheets = [] 873 XSLBasePath = styleMgr.getBaseXSLPath() 874 if os.path.exists(XSLBasePath): 875 for file in os.listdir(XSLBasePath): 876 if os.path.isfile(os.path.join(XSLBasePath,file)) and ".xsl" in file: 877 filename = file.replace(".xsl","") 878 if filename not in styleMgr.getStylesheets().keys(): 879 availableStylesheets.append(filename) 880 vars["availableStylesheets"] = availableStylesheets 881 vars["contextHelpText"] = "Lists all XSL files in %s which are not already used in a declared style" % XSLBasePath 872 availableStyles = [] 873 TPLBasePath = styleMgr.getBaseTPLPath() 874 if os.path.exists(TPLBasePath): 875 for filename in os.listdir(TPLBasePath): 876 if os.path.isfile(os.path.join(TPLBasePath, filename)) and filename.endswith(".tpl"): 877 if filename not in styleMgr.getStyleFilenames(): 878 availableStyles.append(filename) 879 vars["availableStyles"] = availableStyles 880 vars["contextHelpText"] = "Lists all TPL files in %s which are not already used in a declared style" % TPLBasePath 882 881 return vars 883 882 -
indico/MaKaC/webinterface/pages/category.py
r0e77ad r1ced41a 1222 1222 vars["supportEmail"] = vars.get("supportEmail","") 1223 1223 styleMgr = info.HelperMaKaCInfo.getMaKaCInfoInstance().getStyleManager() 1224 styles heets = styleMgr.getStylesheetListForEventType(self._type)1224 styles = styleMgr.getExistingStylesForEventType(self._type) 1225 1225 styleoptions = "" 1226 for style sheet in stylesheets:1226 for styleId in styles: 1227 1227 defStyle = "" 1228 1228 if self._categ: 1229 1229 defStyle = self._categ.getDefaultStyle(self._type) 1230 1230 if defStyle == "": 1231 defStyle = styleMgr.getDefaultStyle sheetForEventType(self._type)1232 if style sheet== defStyle:1231 defStyle = styleMgr.getDefaultStyleForEventType(self._type) 1232 if styleId == defStyle: 1233 1233 selected = "selected" 1234 1234 else: 1235 1235 selected = "" 1236 styleoptions += "<option value=\"%s\" %s>%s</option>" % (style sheet,selected,styleMgr.getStylesheetName(stylesheet))1236 styleoptions += "<option value=\"%s\" %s>%s</option>" % (styleId,selected,styleMgr.getStyleName(styleId)) 1237 1237 vars["styleOptions"] = styleoptions 1238 1238 … … 1479 1479 vars["items"] = self.__getSubCategoryItems( self._categ.getSubCategoryList(), vars["categModifyURLGen"] ) 1480 1480 styleMgr = info.HelperMaKaCInfo.getMaKaCInfoInstance().getStyleManager() 1481 vars["defaultMeetingStyle"] = styleMgr.getStyle sheetName(self._categ.getDefaultStyle("meeting"))1482 vars["defaultLectureStyle"] = styleMgr.getStyle sheetName(self._categ.getDefaultStyle("simple_event"))1481 vars["defaultMeetingStyle"] = styleMgr.getStyleName(self._categ.getDefaultStyle("meeting")) 1482 vars["defaultLectureStyle"] = styleMgr.getStyleName(self._categ.getDefaultStyle("simple_event")) 1483 1483 1484 1484 ## vars["defaultVisibility"] = self._categ.getVisibility() … … 1588 1588 for type in [ "simple_event", "meeting" ]: 1589 1589 styleMgr = info.HelperMaKaCInfo.getMaKaCInfoInstance().getStyleManager() 1590 styles heets = styleMgr.getStylesheetListForEventType(type)1590 styles = styleMgr.getExistingStylesForEventType(type) 1591 1591 styleoptions = "" 1592 for style sheet in stylesheets:1592 for styleId in styles: 1593 1593 defStyle = self._categ.getDefaultStyle(type) 1594 1594 if defStyle == "": 1595 defStyle = styleMgr.getDefaultStyle sheetForEventType(type)1596 if style sheet== defStyle:1595 defStyle = styleMgr.getDefaultStyleForEventType(type) 1596 if styleId == defStyle: 1597 1597 selected = "selected" 1598 1598 else: 1599 1599 selected = "" 1600 styleoptions += "<option value=\"%s\" %s>%s</option>" % (style sheet,selected,styleMgr.getStylesheetName(stylesheet))1600 styleoptions += "<option value=\"%s\" %s>%s</option>" % (styleId,selected,styleMgr.getStyleName(styleId)) 1601 1601 vars["%sStyleOptions" % type] = styleoptions 1602 1602 … … 1623 1623 for type in [ "simple_event", "meeting" ]: 1624 1624 styleMgr = info.HelperMaKaCInfo.getMaKaCInfoInstance().getStyleManager() 1625 styles heets = styleMgr.getStylesheetListForEventType(type)1625 styles = styleMgr.getExistingStylesForEventType(type) 1626 1626 styleoptions = "" 1627 for style sheet in stylesheets:1627 for styleId in styles: 1628 1628 defStyle = self.__target.getDefaultStyle(type) 1629 1629 if defStyle == "": 1630 defStyle = styleMgr.getDefaultStyle sheetForEventType(type)1631 if style sheet== defStyle:1630 defStyle = styleMgr.getDefaultStyleForEventType(type) 1631 if styleId == defStyle: 1632 1632 selected = "selected" 1633 1633 else: 1634 1634 selected = "" 1635 styleoptions += "<option value=\"%s\" %s>%s</option>" % (style sheet,selected,styleMgr.getStylesheetName(stylesheet))1635 styleoptions += "<option value=\"%s\" %s>%s</option>" % (styleId,selected,styleMgr.getStyleName(styleId)) 1636 1636 vars["%sStyleOptions" % type] = styleoptions 1637 1637 minfo = info.HelperMaKaCInfo.getMaKaCInfoInstance() -
indico/MaKaC/webinterface/pages/conferences.py
r601300 r1ced41a 1198 1198 vars['hasDifferentLocation'] = self._hasDifferentLocation 1199 1199 1200 body = wcomponents.WTemplated("events/Meeting").getHTML(vars) 1200 styleMgr = info.HelperMaKaCInfo.getMaKaCInfoInstance().getStyleManager() 1201 if styleMgr.existsTPLFile(self._view): 1202 fileName = os.path.splitext(styleMgr.getTPLFilename(self._view))[0] 1203 body = wcomponents.WTemplated(os.path.join("events", fileName)).getHTML(vars) 1204 else: 1205 return _("Template could not be found.") 1201 1206 1202 1207 frame = all(self._params.get(key, "") != "no" for key in ("frame", "fr")) … … 2845 2850 defStyle = displayMgr.ConfDisplayMgrRegistery().getDisplayMgr(self._conf).getDefaultStyle() 2846 2851 styleMgr = info.HelperMaKaCInfo.getMaKaCInfoInstance().getStyleManager() 2847 defaultStyle = styleMgr.getStyle sheetName(defStyle)2852 defaultStyle = styleMgr.getStyleName(defStyle) 2848 2853 vars["defaultStyle"] = defaultStyle 2849 2854 visibility = self._conf.getVisibility() … … 3063 3068 type = self._conf.getType() 3064 3069 vars["timezoneOptions"] = TimezoneRegistry.getShortSelectItemsHTML(self._conf.getTimezone()) 3065 styles heets=styleMgr.getStylesheetListForEventType(type)3070 styles=styleMgr.getExistingStylesForEventType(type) 3066 3071 styleoptions = "" 3067 3072 defStyle = displayMgr.ConfDisplayMgrRegistery().getDisplayMgr(self._conf).getDefaultStyle() 3068 if defStyle not in styles heets:3073 if defStyle not in styles: 3069 3074 defStyle = "" 3070 for style sheet in stylesheets:3071 if style sheet == defStyle or (defStyle == "" and stylesheet== "static"):3075 for styleId in styles: 3076 if styleId == defStyle or (defStyle == "" and styleId == "static"): 3072 3077 selected = "selected" 3073 3078 else: 3074 3079 selected = "" 3075 styleoptions += "<option value=\"%s\" %s>%s</option>" % (style sheet,selected,styleMgr.getStylesheetName(stylesheet))3080 styleoptions += "<option value=\"%s\" %s>%s</option>" % (styleId,selected,styleMgr.getStyleName(styleId)) 3076 3081 vars["conference"] = self._conf 3077 3082 vars["useRoomBookingModule"] = minfo.getRoomBookingModuleActive() -
indico/MaKaC/webinterface/rh/admins.py
r5f7a6d r1ced41a 297 297 self._new = params.get("new", "") 298 298 self._name = params.get("name", "") 299 self._xslfile = params.get("xslfile", "") 299 self._styleID = params.get("styleID", "") 300 self._tplfile = params.get("tplfile", "") 300 301 self._eventType = params.get("event_type", "") 301 302 self._action = params.get("action", "") … … 305 306 styleMgr = info.HelperMaKaCInfo.getMaKaCInfoInstance().getStyleManager() 306 307 if self._new != "": 307 if self._ xslfile not in styleMgr.getStylesheets().keys() and self._name!= "":308 styles = styleMgr.getStyles heets()309 styles[self._ xslfile] = self._name310 styleMgr.setStyles heets(styles)311 if self._action == "default" and self._eventType != "" and self._ xslfile != "":312 styleMgr.setDefaultStyle(self._ xslfile, self._eventType)313 if self._action == "delete" and self._eventType != "" and self._ xslfile != "":314 styleMgr.removeStyle(self._ xslfile, self._eventType)308 if self._styleID not in styleMgr.getStyles().keys() and self._name != "" and self._styleID != "": 309 styles = styleMgr.getStyles() 310 styles[self._styleID] = (self._name, self._tplfile) 311 styleMgr.setStyles(styles) 312 if self._action == "default" and self._eventType != "" and self._tplfile != "": 313 styleMgr.setDefaultStyle(self._tplfile, self._eventType) 314 if self._action == "delete" and self._eventType != "" and self._tplfile != "": 315 styleMgr.removeStyle(self._tplfile, self._eventType) 315 316 if self._action == "add" and self._eventType != "" and self._newstyle != "": 316 317 styleMgr.addStyleToEventType(self._newstyle, self._eventType) … … 323 324 def _checkParams( self, params ): 324 325 RHAdminBase._checkParams( self, params ) 325 self._ xslfile = params.get("xslfile", "")326 self._tplfile = params.get("tplfile", "") 326 327 self._eventType = params.get("event_type","") 327 328 328 329 def _process( self ): 329 330 styleMgr = info.HelperMaKaCInfo.getMaKaCInfoInstance().getStyleManager() 330 if self._ xslfile != "":331 styleMgr.removeStyle(self._ xslfile, self._eventType)331 if self._tplfile != "": 332 styleMgr.removeStyle(self._tplfile, self._eventType) 332 333 self._redirect(urlHandlers.UHAdminsStyles.getURL()) 333 334 -
indico/MaKaC/webinterface/rh/categoryDisplay.py
rc515e60 r1ced41a 512 512 dispMgr = displayMgr.ConfDisplayMgrRegistery().getDisplayMgr(c) 513 513 styleMgr = info.HelperMaKaCInfo.getMaKaCInfoInstance().getStyleManager() 514 dispMgr.setDefaultStyle(styleMgr.getDefaultStyle sheetForEventType(newType))514 dispMgr.setDefaultStyle(styleMgr.getDefaultStyleForEventType(newType)) 515 515 setValues = staticmethod( setValues ) 516 516 -
indico/MaKaC/webinterface/rh/conferenceDisplay.py
r601300 r1ced41a 403 403 if view == "": 404 404 styleMgr = info.HelperMaKaCInfo.getMaKaCInfoInstance().getStyleManager() 405 view =styleMgr.getDefaultStyle sheetForEventType( type )405 view =styleMgr.getDefaultStyleForEventType( type ) 406 406 displayMgr.ConfDisplayMgrRegistery().getDisplayMgr(self._target).setDefaultStyle( view ) 407 407 isLibxml = True … … 462 462 if view == "": 463 463 styleMgr = info.HelperMaKaCInfo.getMaKaCInfoInstance().getStyleManager() 464 view =styleMgr.getDefaultStyle sheetForEventType( type )464 view =styleMgr.getDefaultStyleForEventType( type ) 465 465 displayMgr.ConfDisplayMgrRegistery().getDisplayMgr(self._target).setDefaultStyle( view ) 466 466 # create the html factory -
indico/MaKaC/webinterface/tpls/AdminsAddStyle.tpl
r988cfe r1ced41a 7 7 <td> 8 8 <br> 9 <table width="60%" align="center" border="0" style="border-left: 1px solid #777777">9 <table width="60%" border="0"> 10 10 <tr> 11 11 <td colspan="3" class="groupTitle">${ _("New Display Style")}</td> 12 12 </tr> 13 % if len(availableStyles heets) == 0:13 % if len(availableStyles) == 0: 14 14 <tr> 15 <td colspan="3">${ _("All XSL stylesheets are already in use in a declared style. In order to add a new style, start by adding the corresponding .xsl file in") } ${ styleMgr.getBaseXSLPath()}</td>15 <td colspan="3">${ _("All template files are already in use in a declared style. In order to add a new style, start by adding the corresponding .tpl file in") } ${ styleMgr.getBaseTPLPath()}</td> 16 16 </tr> 17 17 % else: … … 21 21 </tr> 22 22 <tr> 23 <td nowrap class="titleCellTD"><span class="titleCellFormat">${ _("XSL Stylesheet")}</span></td> 23 <td nowrap class="titleCellTD"><span class="titleCellFormat">${ _("ID")}</span></td> 24 <td align="left" width="80%"><input type="text" name="styleID" size="25"> 25 ${inlineContextHelp(_("Style ID is used in URLs and for naming the CSS file. It must be unique for every style."))} 26 </td> 27 </tr> 28 <tr> 29 <td nowrap class="titleCellTD"><span class="titleCellFormat">${ _("Template file")}</span></td> 24 30 <td align="left"> 25 <select name=" xslfile">26 % for style in availableStyles heets:27 <option value="${ style }">${ style } .xsl</option>31 <select name="tplfile"> 32 % for style in availableStyles: 33 <option value="${ style }">${ style }</option> 28 34 % endfor 29 35 </select> -
indico/MaKaC/webinterface/tpls/AdminsStyles.tpl
r60171b r1ced41a 12 12 </form> 13 13 <table cellspacing="1" align="center"> 14 <tr style="border-bottom: 1px;"><th>${ _("Name (ID)")}</th><th>${ _("XSL file")}</th><th>${ _("CSS file")}</th><th>${ _("Actions")}</th></tr> 15 <% styles = styleMgr.getStylesheets().keys() %> 14 <tr style="border-bottom: 1px;"> 15 <th>${ _("Name")}</th> 16 <th>${ _("ID")}</th> 17 <th>${ _("TPL file")}</th> 18 <th>${ _("CSS file")}</th> 19 <th>${ _("Actions")}</th> 20 </tr> 21 <% styles = styleMgr.getStyles().keys() %> 16 22 <% styles.sort() %> 17 23 % for style in styles: 18 <tr style="background-color: ${"#faa" if styleMgr.getXSLPath(style) == "" and style != 'static' else "lightgreen"}"> 19 <td align="right">${ styleMgr.getStylesheetName(style) } (${style})</td> 20 <td align="center">${ _("found") if styleMgr.getXSLPath(style) else _("not found")}</td> 24 <tr style="background-color: ${"#faa" if not styleMgr.existsTPLFile(style) and style != 'static' else "lightgreen"}"> 25 <td align="left">${ styleMgr.getStyleName(style) }</td> 26 <td align="left">${style}</td> 27 <td align="left"> 28 % if style != 'static': 29 ${styleMgr.getTPLFilename(style)} 30 % else: 31 - 32 % endif 33 </td> 21 34 <td align="center">${ _("yes") if styleMgr.getCSSPath(style) else _("no")}</td> 22 35 <td> 23 36 % if style == "static": 24 ${inlineContextHelp(_('This style cannot be deleted. this is the default style for conferences.<br/>It does not rely on an XSL file.'))}37 ${inlineContextHelp(_('This style cannot be deleted. This is the default style for conferences.'))} 25 38 % else: 26 <a href="${urlHandlers.UHAdminsDeleteStyle.getURL( xslfile=style)}" onClick="if (!confirm('${ _("Are you sure you want to delete this style?")}')) { return false; }"><img border="0" src="${deleteIconURL}" alt="${ _("delete this style")}"></a>39 <a href="${urlHandlers.UHAdminsDeleteStyle.getURL(tplfile=style)}" onClick="if (!confirm('${ _("Are you sure you want to delete this style?")}')) { return false; }"><img border="0" src="${deleteIconURL}" alt="${ _("delete this style")}"></a> 27 40 % endif 28 41 </td> … … 44 57 <form action="${ urlHandlers.UHAdminsStyles.getURL() }" method="POST"> 45 58 <input type="hidden" name="event_type" value="${eventType}"> 46 <% styles = styleMgr.getStyle sheetListForEventType(eventType) %>59 <% styles = styleMgr.getStyleListForEventType(eventType) %> 47 60 <% styles.sort() %> 48 ${ _("current list:")} <select name=" xslfile">61 ${ _("current list:")} <select name="tplfile"> 49 62 % for style in styles: 50 <% isDefault = style.strip() ==styleMgr.getDefaultStylesheetForEventType(eventType).strip() %>51 <option value="${style}"${'style="font-weight: bold;" selected' if isDefault else ""}>${styleMgr.getStyle sheetName(style)}${" (default)" if isDefault else ""}</option>63 <% isDefault = style.strip() == styleMgr.getDefaultStyleForEventType(eventType).strip() %> 64 <option value="${style}"${'style="font-weight: bold;" selected' if isDefault else ""}>${styleMgr.getStyleName(style)}${" (default)" if isDefault else ""}</option> 52 65 % endfor 53 66 </select> … … 56 69 ${ _("add new style:")} 57 70 <select name="newstyle"> 58 % for style in styleMgr.getStyles heets():71 % for style in styleMgr.getStyles(): 59 72 % if style not in styles: 60 <option value="${ style }">${styleMgr.getStyle sheetName(style)}</option>73 <option value="${ style }">${styleMgr.getStyleName(style)}</option> 61 74 % endif 62 75 % endfor -
indico/MaKaC/webinterface/tpls/EventModifMainData.tpl
rc0de5a r1ced41a 247 247 <% from MaKaC.common import info %> 248 248 249 ${ macros.genericField(macros.FIELD_SELECT, 'inPlaceEditDefaultStyle', 'event.main.changeDefaultStyle', dict(conference="%s"%conferenceId), preCache=True, rh=self_._rh, options=info.HelperMaKaCInfo.getMaKaCInfoInstance().getStyleManager().getStyle sheetDictForEventType(confObj.getType()), orderOptionsBy = "value") }249 ${ macros.genericField(macros.FIELD_SELECT, 'inPlaceEditDefaultStyle', 'event.main.changeDefaultStyle', dict(conference="%s"%conferenceId), preCache=True, rh=self_._rh, options=info.HelperMaKaCInfo.getMaKaCInfoInstance().getStyleManager().getStyleDictForEventType(confObj.getType()), orderOptionsBy = "value") } 250 250 251 251 ${ macros.genericField(macros.FIELD_SELECT, 'inPlaceEditVisibility', 'event.main.changeVisibility', dict(conference="%s"%conferenceId), preCache=True, rh=self_._rh, options=visibilityList, orderOptionsBy = "key") } -
indico/MaKaC/webinterface/wcomponents.py
r39b7d0 r1ced41a 486 486 url.addParam("redirectURL",urlHandlers.UHConferenceOtherViews.getURL(self._conf)) 487 487 vars["confModif"] = i18nformat("""<a href=%s>_("exit manage")</a>""")%quoteattr(str(url)) 488 styleMgr = info.HelperMaKaCInfo.getMaKaCInfoInstance().getStyleManager()489 stylesheets = styleMgr.getStylesheetListForEventType(vars["type"])490 491 # View Menu492 viewoptions = []493 if len(stylesheets) != 0:494 stylesheets.sort()495 for stylesheet in stylesheets:496 viewoptions.append({"id": styleMgr.getStylesheetName(stylesheet), "name": stylesheet})497 488 498 489 # Dates Menu … … 604 595 # vars["confModif"] += i18nformat("""<a href=%s>_("full agenda")</a> | """)%(quoteattr(str(urlHandlers.UHConfForceEnterAccessKey.getURL(self._conf)))) 605 596 styleMgr = info.HelperMaKaCInfo.getMaKaCInfoInstance().getStyleManager() 606 styles heets = styleMgr.getStylesheetListForEventType(vars["type"])597 styles = styleMgr.getExistingStylesForEventType(vars["type"]) 607 598 608 599 viewoptions = [] 609 if len(styles heets) != 0:610 styles heets.sort(key=styleMgr.getStylesheetName)611 for style sheet in stylesheets:612 viewoptions.append({"id": style sheet, "name": styleMgr.getStylesheetName(stylesheet) })600 if len(styles) != 0: 601 styles.sort(key=styleMgr.getStyleName) 602 for styleId in styles: 603 viewoptions.append({"id": styleId, "name": styleMgr.getStyleName(styleId) }) 613 604 vars["viewoptions"] = viewoptions 614 vars["SelectedStyle"] = styleMgr.getStyle sheetName(vars["currentView"])605 vars["SelectedStyle"] = styleMgr.getStyleName(vars["currentView"]) 615 606 vars["displayURL"] = urlHandlers.UHConferenceDisplay.getURL(self._rh._conf) 616 607
Note: See TracChangeset
for help on using the changeset viewer.
