Changeset 550acf in indico
- Timestamp:
- 03/26/10 09:04:56 (3 years ago)
- Branches:
- master, burotel, hello-world-walkthrough, ipv6, new-webex, v0.97-series, v0.98-series, v0.98.2, v0.98.3, v0.98b1, v0.98b2, v0.99, 051b2622c51afb171a1dedb46a0df4fbb0cbd02e, 0da0c1403bae8e51d8229f460181c71b9e6dda72
- Children:
- 42572c
- Parents:
- c6839d
- git-author:
- Jose Benito <jose.benito.gonzalez@…> (03/25/10 19:33:51)
- git-committer:
- Jose Benito <jose.benito.gonzalez@…> (03/26/10 09:04:56)
- Location:
- indico/MaKaC
- Files:
-
- 5 edited
-
PDFinterface/conference.py (modified) (1 diff)
-
badge.py (modified) (2 diffs)
-
badgeDesignConf.py (modified) (3 diffs)
-
webinterface/pages/conferences.py (modified) (4 diffs)
-
webinterface/tpls/ConfModifBadgeDesign.tpl (modified) (19 diffs)
Legend:
- Unmodified
- Added
- Removed
-
indico/MaKaC/PDFinterface/conference.py
r019367 r550acf 2731 2731 # We draw the items of the badge 2732 2732 for item in self.__badgeTemplate.getItems(): 2733 2734 2733 # First we determine the actual text that has to be drawed. 2735 action = BadgeDesignConfiguration().items_actions[item.get Name()]2734 action = BadgeDesignConfiguration().items_actions[item.getKey()][1] 2736 2735 if isinstance(action, str): 2737 2736 # If for this kind of item we have to draw always the same string, let's draw it. -
indico/MaKaC/badge.py
r9881d7 r550acf 199 199 Useful so that javascript can analyze it on its own. 200 200 """ 201 202 # ensure that each item's got a key (in order to avoid 203 # using the name as key). 204 for item in self.__templateData[4]: 205 itemName = item['name'] 206 if not "key" in item: 207 item['key'] = itemName 208 ############################## 209 201 210 return self.__templateData 202 211 … … 385 394 self.__badgeTemplate = badgeTemplate 386 395 387 def get Name(self):388 """ Returns the name of the item.396 def getKey(self): 397 """ Returns the key of the item (non-translated name). 389 398 The name of an item idientifies the kind of item it is: "Name", "Country", "Fixed Text"... 390 399 """ 391 return self.__itemData['name'] 400 if "key" in self.__itemData: 401 return self.__itemData['key'] 402 else: 403 return self.__itemData['name'] 392 404 393 405 def getFixedText(self): -
indico/MaKaC/badgeDesignConf.py
r8c5d7bf r550acf 101 101 confDateInterval = adjusted_sDate.strftime("%d %B %Y") 102 102 elif adjusted_sDate.strftime("%B%Y") == adjusted_eDate.strftime("%B%Y"): 103 confDateInterval = "%s-%s %s"%(adjusted_sDate.day, adjusted_eDate.day, adjusted_sDate.strftime("%B %Y"))103 confDateInterval = "%s-%s %s"%(adjusted_sDate.day, adjusted_eDate.day, adjusted_sDate.strftime("%B %Y")) 104 104 return confDateInterval 105 105 … … 133 133 def __init__(self): 134 134 135 self.items_actions = { _("Title") : Registrant.getTitle,136 _("Full Name") : Registrant.getFullName,137 _("Full Name (w/o title)") : RegistrantFullName2,138 _("Full Name B") : RegistrantFullName3,139 _("Full Name B (w/o title)") : RegistrantFullName4,140 _("Full Name C") : RegistrantFullName5,141 _("Full Name C (w/o title)") : RegistrantFullName6,142 _("First Name") : Registrant.getFirstName,143 _("Surname") : Registrant.getSurName,144 _("Position") : Registrant.getPosition,145 _("Institution") : Registrant.getInstitution,146 _("Country") : RegistrantCountry,147 _("City") : Registrant.getCity,148 _("Address") : Registrant.getAddress,149 _("Phone") : Registrant.getPhone,150 _("Fax") : Registrant.getFax,151 _("Email") : Registrant.getEmail,152 _("Personal homepage") : Registrant.getPersonalHomepage,153 _("Amount") : Registrant.getTotal,154 _("Conference Name") : Conference.getTitle,155 _("Conference Dates") : ConferenceDates,156 _("Fixed Text") : BadgeTemplateItem.getFixedText135 self.items_actions = { "Title": (_("Title"), Registrant.getTitle), 136 "Full Name": (_("Full Name"), Registrant.getFullName), 137 "Full Name (w/o title)": (_("Full Name (w/o title)"), RegistrantFullName2), 138 "Full Name B": (_("Full Name B"), RegistrantFullName3), 139 "Full Name B (w/o title)": (_("Full Name B (w/o title)"), RegistrantFullName4), 140 "Full Name C": (_("Full Name C"), RegistrantFullName5), 141 "Full Name C (w/o title)": (_("Full Name C (w/o title)"), RegistrantFullName6), 142 "First Name": (_("First Name"), Registrant.getFirstName), 143 "Surname": (_("Surname"), Registrant.getSurName), 144 "Position": (_("Position"), Registrant.getPosition), 145 "Institution": (_("Institution"), Registrant.getInstitution), 146 "Country": (_("Country"), RegistrantCountry), 147 "City": (_("City"), Registrant.getCity), 148 "Address": (_("Address"), Registrant.getAddress), 149 "Phone": (_("Phone"), Registrant.getPhone), 150 "Fax": (_("Fax"), Registrant.getFax), 151 "Email": (_("Email"), Registrant.getEmail), 152 "Personal homepage": (_("Personal homepage"), Registrant.getPersonalHomepage), 153 "Amount": (_("Amount"), Registrant.getTotal), 154 "Conference Name": (_("Conference Name"), Conference.getTitle), 155 "Conference Dates": (_("Conference Dates"), ConferenceDates), 156 "Fixed Text": (_("Fixed Text"), BadgeTemplateItem.getFixedText) 157 157 } 158 158 … … 160 160 The groups are only used for the <select> box in the WConfModifBadgeDesign.tpl file. 161 161 """ 162 self.groups = [( _("Registrant Data"), [ _("Title"), _("Full Name"), _("Full Name (w/o title)"), _("Full Name B"), _("Full Name B (w/o title)"), _("Full Name C"), _("Full Name C (w/o title)"), _("First Name"), _("Surname"), _("Position"),163 _("Institution"), _("Country"), _("City"), _("Address"), _("Phone"), _("Fax"), _("Email"), _("Personal homepage"), _("Amount")]),164 ( _("Conference Data"), [ _("Conference Name"), _("Conference Dates")]),165 ( _("Fixed Elements"), [ _("Fixed Text")])]162 self.groups = [( _("Registrant Data"), [ "Title", "Full Name", "Full Name (w/o title)", "Full Name B", "Full Name B (w/o title)", "Full Name C", "Full Name C (w/o title)", "First Name", "Surname", "Position", 163 "Institution", "Country", "City", "Address", "Phone", "Fax", "Email", "Personal homepage", "Amount"]), 164 ( _("Conference Data"), [ "Conference Name", "Conference Dates"]), 165 ( _("Fixed Elements"), [ "Fixed Text"])] -
indico/MaKaC/webinterface/pages/conferences.py
re5c75c r550acf 12128 12128 vars["loadingIconURL"]=quoteattr(str(Config.getInstance().getSystemIconURL("loading"))) 12129 12129 vars["templateId"]=self.__templateId 12130 from MaKaC.services.interface.rpc.json import encode as jsonEncode 12131 vars["translateName"]= jsonEncode(dict([(key, value[0]) for key, value in BadgeDesignConfiguration().items_actions.iteritems()])) 12130 12132 12131 12133 cases = [] 12132 for itemName in BadgeDesignConfiguration().items_actions.keys(): 12134 badgeDesignConfiguration = BadgeDesignConfiguration() 12135 for itemKey in badgeDesignConfiguration.items_actions.keys(): 12133 12136 case = [] 12134 12137 case.append('case "') 12135 case.append(item Name)12138 case.append(itemKey) 12136 12139 case.append('":') 12137 12140 case.append('\n') 12138 12141 case.append('items[itemId] = new Item(itemId, "') 12139 case.append(item Name)12142 case.append(itemKey) 12140 12143 case.append('");') 12141 12144 case.append('\n') … … 12148 12151 12149 12152 optgroups = [] 12150 for optgroupName, options in BadgeDesignConfiguration().groups:12153 for optgroupName, options in badgeDesignConfiguration.groups: 12151 12154 optgroup = [] 12152 12155 optgroup.append('<optgroup label="') … … 12155 12158 optgroup.append('\n') 12156 12159 for optionName in options: 12157 optgroup.append('<option >')12158 optgroup.append( optionName)12160 optgroup.append('<option value="%s">'%optionName) 12161 optgroup.append(badgeDesignConfiguration.items_actions[optionName][0]) 12159 12162 optgroup.append('</option>') 12160 12163 optgroup.append('\n') … … 12486 12489 vars["titleMessage"]= _("Editing poster template") 12487 12490 vars["editingTemplate"]="true" 12488 templateDataString = simplejson.dumps(self.__conf.getPosterTemplateManager().getTemplateData(self.__templateId)) 12491 from MaKaC.services.interface.rpc.json import encode as jsonEncode 12492 templateDataString = jsonEncode(self.__conf.getPosterTemplateManager().getTemplateData(self.__templateId)) 12489 12493 vars["templateData"]=quoteattr(templateDataString) 12490 12494 -
indico/MaKaC/webinterface/tpls/ConfModifBadgeDesign.tpl
r626e2c r550acf 14 14 // Number of pixels per cm 15 15 var pixelsPerCm = 50; 16 16 17 17 // Id of the background used 18 18 var backgroundId = -1 … … 32 32 var lastSelectedDiv; 33 33 34 // Translation dictionary from key to name in current language. 35 var translate = <%=translateName%>; 36 34 37 // List of badge template items 35 38 var items = []; 36 39 37 40 // Item class 38 function Item(itemId, name) {41 function Item(itemId, key) { 39 42 this.id = itemId; 40 this. name = name;43 this.key = key; 41 44 this.x = initialOffset; 42 45 this.y = initialOffset; … … 64 67 '" style="cursor:move; font-weight:' + (this.bold ? 'bold' : 'normal') + '; font-style:' + (this.italic ? 'italic' : 'normal') + 65 68 '; text-align: ' + this.textAlign + ';"' + 66 '><tbody><tr><td><span style="color:' + this.color + '; font-family: ' + this.fontFamily + '; font-size:' + this.fontSize + ';">' + 67 (this. name == "Fixed Text" ? this.text : this.name) +69 '><tbody><tr><td><span style="color:' + this.color + '; font-family: ' + this.fontFamily + '; font-size:' + this.fontSize + ';">' + 70 (this.key == "Fixed Text" ? this.text : translate[this.key]) + 68 71 '</span></td></tr></tbody></table>'; 69 72 } 70 73 71 74 // Dimensions class 72 75 function Dimensions(width, height) { … … 106 109 // -an inner HTML with its content 107 110 itemId++; 108 111 109 112 var newDiv = document.createElement('div'); 110 113 … … 152 155 153 156 snap: ($F('snap checkbox') == "on") ? mySnap : false 154 }); 157 }); 155 158 156 159 // We store the initial position as a good position which to return to 157 160 newDiv.lastGoodPositionLeft = 0; 158 161 newDiv.lastGoodPositionTop = 0; 159 162 160 163 return newDiv; 161 164 } … … 174 177 markSelected(newDiv); 175 178 } 176 179 177 180 initialOffset += 10 178 181 … … 211 214 212 215 // Change the text that says which item is selected 213 $E('selection text').dom.innerHTML = items[newSelectedDiv.id].name;216 $E('selection text').dom.innerHTML = translate[items[newSelectedDiv.id].key]; 214 217 215 218 // TODO: add check to see if there's a table inside and not an image … … 233 236 $E('color selector').dom.selectedIndex = newSelectedItem.colorIndex; 234 237 $E('width field').dom.value = newSelectedItem.width / pixelsPerCm; 235 if (newSelectedItem. name== "Fixed Text") {238 if (newSelectedItem.key == "Fixed Text") { 236 239 $E('fixed text field').dom.value = newSelectedItem.text 237 240 } else { … … 277 280 278 281 } 279 282 280 283 // This function displays all the items in the 'items' array on the screen 281 284 // If there are already some items being displayed, it does not erase them … … 432 435 } 433 436 } 434 437 435 438 function changeText() { 436 439 if(lastSelectedDiv) { … … 454 457 document.hiddenform.submit() 455 458 } 456 459 457 460 function sending() { 458 461 Element.show('loadingIcon'); 459 462 } 460 463 461 464 firstLoad = true; 462 465 463 466 function sent() { 464 467 if (firstLoad) { … … 486 489 Element.hide('loadingIcon'); 487 490 } 488 491 489 492 function displayBackground(backgroundURL) { 490 493 var newBackground = document.createElement('img'); … … 500 503 var template = $E("templateDiv").dom; 501 504 template.appendChild(newBackground); 502 503 } 504 505 506 } 507 505 508 function removeBackground() { 506 509 if (backgroundId != -1) { … … 511 514 512 515 </script> 513 516 514 517 <!-- CONTEXT HELP DIVS --> 515 518 <div id="tooltipPool" style="display: none"> 516 <!-- Where is key? --> 519 <!-- Where is key? --> 517 520 <div id="features" class="tip"> 518 521 <b>FullName can have four different formats:</b><br> … … 523 526 </div> 524 527 </div> 525 <!-- END OF CONTEXT HELP DIVS --> 526 527 528 <!-- END OF CONTEXT HELP DIVS --> 529 530 528 531 <iframe id="uploadTarget" name="uploadTarget" src="" style="width:0px;height:0px;border:0" onload="sent()"></iframe> 529 532 … … 593 596 <input name="Delete Template Element Button" class="btn" value="<%= _("Remove")%>" type="button" onclick="removeElement()"> 594 597 595 <br/><br/> 598 <br/><br/> 596 599 597 600 <select name="Template Elements List" id="elementList"> … … 813 816 </tbody> 814 817 </table> 815 818 816 819 <form name="hiddenform" action="<%=saveTemplateURL%>" method="POST"> 817 820 <input name="templateId" value="<%=templateId%>" type="hidden"> 818 821 <input id="templateData" name="templateData" type="hidden"> 819 822 </form> 820 823 821 824 <!-- 822 825 <table id='test' width="200" height="200" border="1" onclick="alert(Element.getDimensions(this).width);this.width = parseInt(this.width) + 10; return false"> … … 826 829 827 830 <script type="text/javascript"> 828 831 829 832 // We load the template if we are editing a template 830 833 if (%(editingTemplate)s) { … … 842 845 templateDimensions = new Dimensions(425,270); //put here the initial dimensions of templateDiv. This is CERN default of 85mm x 54mm 843 846 } 844 847 845 848 previousTemplateDimensions = new Dimensions(0,0) 846 849 847 850 $E('badge width').dom.value = templateDimensions.width / pixelsPerCm; 848 851 $E('badge height').dom.value = templateDimensions.height / pixelsPerCm; 849 852 850 853 // This function initialises the rulers 851 854 updateRulers(); 852 855 853 856 // This function displays the items, if any have been loaded, on the screen 854 857 displayItems() 855 858 856 859 if (<%=editingTemplate%> && <%=hasBackground%>) { 857 860 backgroundId = <%=backgroundId%>
Note: See TracChangeset
for help on using the changeset viewer.
