@@ -140,17 +140,23 @@ def handle_heading_buttons(self, room):
140140
141141 # Check if attribute is formatting correct
142142 if 'sv_heading_buttons' in room .conf :
143+ page_type = room .conf ['sv_page' ]
143144 button_count = self .check_heading_buttons_attribute (room )
144145 if button_count > 0 :
145146 heading_buttons_text = room .conf ['sv_heading_buttons' ][0 ]
146147 heading_buttons_room = room .conf ['sv_heading_buttons' ][1 ]
147- heading_buttons_icon = room .conf ['sv_heading_buttons' ][2 ]
148+ if len (room .conf ['sv_heading_buttons' ]) > 2 :
149+ heading_buttons_icon = room .conf ['sv_heading_buttons' ][2 ]
150+ else :
151+ heading_buttons_icon = [] # create empty list, if no icons are defined
148152
149153 # Determine activ Button and set html class for it
150154 heading_buttons_active = ['' ] * button_count
151155
156+ for i in range (0 , len (heading_buttons_room )):
157+ heading_buttons_room [i ] = heading_buttons_room [i ].replace (' ' , '_' ).replace ('/' , '_' )
152158 for i in range (0 , len (heading_buttons_active )):
153- if heading_buttons_room [i ] == room .property .name :
159+ if heading_buttons_room [i ] == room .property .name . replace ( ' ' , '_' ). replace ( '/' , '_' ) :
154160 heading_buttons_active [i ] = 'ui-btn-active ui-state-persist' # active = 'ui-btn-active ui-state-persist'
155161 if len (heading_buttons_icon ) == 0 and len (heading_buttons_active ) < 4 :
156162 heading_buttons_active [i ] += ' ui-btn-largetext' # active = 'ui-btn-active ui-state-persist'
@@ -159,43 +165,43 @@ def handle_heading_buttons(self, room):
159165 if len (heading_buttons_icon ) == 0 :
160166 tpl_fn = 'heading_' + str (button_count ) + 'textbuttons.html'
161167 heading = self .parse_tpl_from_file (tpl_fn , [('{{ text1 }}' , heading_buttons_text [0 ]),
162- ('{{ room1 }}' , heading_buttons_room [0 ]),
168+ ('{{ page1 }}' , page_type + '.' + heading_buttons_room [0 ]),
163169 ('{{ activeclass1 }}' , heading_buttons_active [0 ])])
164170 heading = self .parse_tpl (heading , [('{{ text2 }}' , heading_buttons_text [1 ]),
165- ('{{ room2 }}' , heading_buttons_room [1 ]),
171+ ('{{ page2 }}' , page_type + '.' + heading_buttons_room [1 ]),
166172 ('{{ activeclass2 }}' , heading_buttons_active [1 ])])
167173
168174 if button_count > 2 :
169175 heading = self .parse_tpl (heading , [('{{ text3 }}' , heading_buttons_text [2 ]),
170- ('{{ room3 }}' , heading_buttons_room [2 ]),
176+ ('{{ page3 }}' , page_type + '.' + heading_buttons_room [2 ]),
171177 ('{{ activeclass3 }}' , heading_buttons_active [2 ])])
172178
173179 else :
174180 tpl_fn = 'heading_' + str (button_count ) + 'buttons.html'
175181 heading = self .parse_tpl_from_file (tpl_fn , [('{{ text1 }}' , heading_buttons_text [0 ]),
176- ('{{ room1 }}' , heading_buttons_room [0 ]),
182+ ('{{ page1 }}' , page_type + '.' + heading_buttons_room [0 ]),
177183 ('{{ navicon1 }}' , heading_buttons_icon [0 ]),
178184 ('{{ activeclass1 }}' , heading_buttons_active [0 ])])
179185 heading = self .parse_tpl (heading , [('{{ text2 }}' , heading_buttons_text [1 ]),
180- ('{{ room2 }}' , heading_buttons_room [1 ]),
186+ ('{{ page2 }}' , page_type + '.' + heading_buttons_room [1 ]),
181187 ('{{ navicon2 }}' , heading_buttons_icon [1 ]),
182188 ('{{ activeclass2 }}' , heading_buttons_active [1 ])])
183189
184190 if button_count > 2 :
185191 heading = self .parse_tpl (heading , [('{{ text3 }}' , heading_buttons_text [2 ]),
186- ('{{ room3 }}' , heading_buttons_room [2 ]),
192+ ('{{ page3 }}' , page_type + '.' + heading_buttons_room [2 ]),
187193 ('{{ navicon3 }}' , heading_buttons_icon [2 ]),
188194 ('{{ activeclass3 }}' , heading_buttons_active [2 ])])
189195
190196 if button_count > 3 :
191197 heading = self .parse_tpl (heading , [('{{ text4 }}' , heading_buttons_text [3 ]),
192- ('{{ room4 }}' , heading_buttons_room [3 ]),
198+ ('{{ page4 }}' , page_type + '.' + heading_buttons_room [3 ]),
193199 ('{{ navicon4 }}' , heading_buttons_icon [3 ]),
194200 ('{{ activeclass4 }}' , heading_buttons_active [3 ])])
195201
196202 if button_count > 4 :
197203 heading = self .parse_tpl (heading , [('{{ text5 }}' , heading_buttons_text [4 ]),
198- ('{{ room5 }}' , heading_buttons_room [4 ]),
204+ ('{{ page5 }}' , page_type + '.' + heading_buttons_room [4 ]),
199205 ('{{ navicon5 }}' , heading_buttons_icon [4 ]),
200206 ('{{ activeclass5 }}' , heading_buttons_active [4 ])])
201207
0 commit comments