← Back to team overview

mahara-contributors team mailing list archive

[Bug 1436854] Re: Allow the call of SVG images in javascript

 

Hi,

I just coded a fix for this. Here is my solution.

The call of the javascript function get_themeurl() in js/mahara.js file
is only a shortcut the global js var config.theme.

My understanding is that this is first populated by the php themepaths()
function in lib/web.php.

So this task is closely related to the task "Allow themepaths function to use get_image_url() function " :
https://bugs.launchpad.net/mahara/+bug/1444463

My solution will fix them both.

My solution is :
1. To replace strings in themepaths() ex: from 'images/'btn_close.png' to 'btn_close'
2. Create a function to replace multiple foreach loop in the code and to detect if the path has an extension : If yes, call get_url, if no, call get_image_url.
3. Replace all get_themeurl() call to use the new key and replace the config.theme call in js file to use get_themeurl() with the correct key.

I have two questions :

First, I do not finally need to create a new get_image_url() function
for javascript because the old get_themeurl() will work if we replace
the key in the  themepaths() function. It is correct ?

Second, do we need to allow retrocompatibility for the themepaths images
and for the get_themeurl() function.

For exemple, with my fix, the new way to call an image url in javascript
will be  get_themeurl('myimage') instead of
get_themeurl('images/myimage.png'). Do I need support anymore this type
of calling ?

Second, its seem to be possible to add some themepath with the
$extraconfig['themepaths'] used by smarty().

Do I need to support anymore 'images/myimage.png' call for images ?

Thanks !

-- 
You received this bug notification because you are a member of Mahara
Contributors, which is subscribed to Mahara.
Matching subscriptions: Subscription for all Mahara Contributors -- please ask on #mahara-dev or mahara.org forum before editing or unsubscribing it!
https://bugs.launchpad.net/bugs/1436854

Title:
  Allow the call of SVG images in javascript

Status in Mahara ePortfolio:
  Confirmed

Bug description:
  In the htdocs/js/mahara.js file, we should create a method equivalent
  to the method php get_image_url () in htdocs/lib/web.php

  It should also replace the call of the method get_themeurl by this new
  method and replace config.theme['images/myimage.png'] calls in the
  javascript files.

  This task is related with:
  https://bugs.launchpad.net/mahara/+bug/1416890

To manage notifications about this bug go to:
https://bugs.launchpad.net/mahara/+bug/1436854/+subscriptions


References