399 uiprops.load(libuiprops) |
399 uiprops.load(libuiprops) |
400 for path in reversed([self.apphome] + self.cubes_path()): |
400 for path in reversed([self.apphome] + self.cubes_path()): |
401 self._load_ui_properties_file(uiprops, path) |
401 self._load_ui_properties_file(uiprops, path) |
402 self._load_ui_properties_file(uiprops, self.apphome) |
402 self._load_ui_properties_file(uiprops, self.apphome) |
403 datadir_url = uiprops.context['datadir_url'] |
403 datadir_url = uiprops.context['datadir_url'] |
404 # XXX pre 3.9 css compat |
404 # pre 3.9 css compat, however the old css still rules |
405 if self['use-old-css']: |
405 if self['use-old-css']: |
406 if (datadir_url+'/cubicweb.css') in uiprops['STYLESHEETS']: |
406 if (datadir_url+'/cubicweb.css') in uiprops['STYLESHEETS']: |
407 idx = uiprops['STYLESHEETS'].index(datadir_url+'/cubicweb.css') |
407 idx = uiprops['STYLESHEETS'].index(datadir_url+'/cubicweb.css') |
408 uiprops['STYLESHEETS'][idx] = datadir_url+'/cubicweb.old.css' |
408 uiprops['STYLESHEETS'][idx] = datadir_url+'/cubicweb.old.css' |
409 if datadir_url+'/cubicweb.reset.css' in uiprops['STYLESHEETS']: |
409 if datadir_url+'/cubicweb.reset.css' in uiprops['STYLESHEETS']: |
411 cubicweb_js_url = datadir_url + '/cubicweb.js' |
411 cubicweb_js_url = datadir_url + '/cubicweb.js' |
412 if cubicweb_js_url not in uiprops['JAVASCRIPTS']: |
412 if cubicweb_js_url not in uiprops['JAVASCRIPTS']: |
413 uiprops['JAVASCRIPTS'].insert(0, cubicweb_js_url) |
413 uiprops['JAVASCRIPTS'].insert(0, cubicweb_js_url) |
414 |
414 |
415 def _load_ui_properties_file(self, uiprops, path): |
415 def _load_ui_properties_file(self, uiprops, path): |
416 resourcesfile = join(path, 'data', 'external_resources') |
|
417 if exists(resourcesfile): |
|
418 warn('[3.9] %s file is deprecated, use an uiprops.py file' |
|
419 % resourcesfile, DeprecationWarning) |
|
420 datadir_url = uiprops.context['datadir_url'] |
|
421 for rid, val in read_config(resourcesfile).iteritems(): |
|
422 if rid in ('STYLESHEETS', 'STYLESHEETS_PRINT', |
|
423 'IE_STYLESHEETS', 'JAVASCRIPTS'): |
|
424 val = [w.strip().replace('DATADIR', datadir_url) |
|
425 for w in val.split(',') if w.strip()] |
|
426 if rid == 'IE_STYLESHEETS': |
|
427 rid = 'STYLESHEETS_IE' |
|
428 else: |
|
429 val = val.strip().replace('DATADIR', datadir_url) |
|
430 uiprops[rid] = val |
|
431 uipropsfile = join(path, 'uiprops.py') |
416 uipropsfile = join(path, 'uiprops.py') |
432 if exists(uipropsfile): |
417 if exists(uipropsfile): |
433 self.debug('loading %s', uipropsfile) |
418 self.debug('loading %s', uipropsfile) |
434 uiprops.load(uipropsfile) |
419 uiprops.load(uipropsfile) |
435 |
420 |