Are tasks supported on the theme level?

Serge D
Serge D's picture

Joined: 2009-06-11
Posts: 2436
Posted: Wed, 2011-01-05 17:56

Are tasks supported on the theme level?
can I define mytheme_task.php in helpers folder of the theme and not module?

 
bharat
bharat's picture

Joined: 2002-05-21
Posts: 7985
Posted: Thu, 2011-01-06 02:44

Currently, no. The code to find tasks is in modules/gallery/helpers/task.php in get_definitions() -- it would also have to check for a task class on the theme. We'd have to add this code:

$class_name = theme::$site_theme_name . "_task";
if (method_exists($class_name, "available_tasks")) {
  // the theme has a task class
}

---
Problems? Check gallery3/var/logs
file a bug/feature ticket | upgrade to the latest code! | hacking G3? join us on IRC!

 
Serge D
Serge D's picture

Joined: 2009-06-11
Posts: 2436
Posted: Thu, 2011-01-06 05:21

Could you please add it for 3.1?

 
bharat
bharat's picture

Joined: 2002-05-21
Posts: 7985
Posted: Thu, 2011-01-06 05:27
 
joe7rocks
joe7rocks's picture

Joined: 2004-10-07
Posts: 556
Posted: Thu, 2011-01-06 05:36

Out of curiosity: what task would a theme have? :)

Dog Photos | Gallery2 Themes Demo

 
Serge D
Serge D's picture

Joined: 2009-06-11
Posts: 2436
Posted: Thu, 2011-01-06 07:35

I do not to write module just for that, but I can bundle some actions there, which are not really theme related per se

* mark and rebuild thumbs/resizes
* clear caches
* mark exif/iptc data for refresh
...

 
Retroguy
Retroguy's picture

Joined: 2010-12-29
Posts: 27
Posted: Thu, 2011-01-06 12:00
Quote:
* mark and rebuild thumbs/resizes
* clear caches
* mark exif/iptc data for refresh

These need to be on the maintenance page IMO, then they will be accessible regardless of which theme is installed.

regards,

http://retroguy.org

 
bharat
bharat's picture

Joined: 2002-05-21
Posts: 7985
Posted: Sun, 2011-01-09 01:29

There's a complicating factor here -- tasks that are in the site theme are not going to be available in the admin theme. So if you create tasks in the admin theme you can run them in the admin theme, but you can't run them when you're not in the admin theme. And any tasks you create/run in the site theme won't be available when you go to Admin > Maintenance. That seems a little weird and needs some more thought. I'm going to move this ticket to 3.1 for now.
---
Problems? Check gallery3/var/logs
file a bug/feature ticket | upgrade to the latest code! | hacking G3? join us on IRC!