add theme settings configure page to domain_theme,

junphine - September 3, 2008 - 09:56
Project:Domain Access
Version:6.x-2.0-rc7
Component:- Domain Theme
Category:feature request
Priority:normal
Assigned:Unassigned
Status:closed
Description

add theme settings configure page to domain_theme,so one can change their domain site logo and some display settings.
installed it,visite admin/build/domain/theme/%domain_id,and then click configure operation to change theme settings.
Sorry I have no tools to file a proper patch,wolcome someone to make it.

AttachmentSize
domain_theme.zip6.79 KB

#1

agentrickard - September 3, 2008 - 14:45
Status:needs work» needs review

Will try to test next week, when back in the office. We initially passed on this feature in order to produce a stable release, but it is worth doing.

Did you use the existing 'settings' column in the {domain_theme} table? That's why that column is there.

#2

junphine - September 4, 2008 - 02:17

just used it.

#3

agentrickard - September 9, 2008 - 19:11

Please follow Drupal coding conventions.

#4

agentrickard - September 9, 2008 - 19:13
Status:needs review» needs work

The coder modules is your friend. Use it please. There are stub functions commented out here, misuse of spaces, tab stops. Not acceptable.

#5

Summit - September 19, 2008 - 13:00

Subscribing, very interested in this also for Drupal 5!
greetings,
Martijn

#6

peterx - October 15, 2008 - 21:09

What I would like long term is to list all the domains with the main theme settings as columns. If the Domain Theme module adds a row per domain with all the settings as a blob, I might work on an extension to move logo and other common fields out of the blob into separate columns.

An alternative might be a list that decodes the blob into a report we can use to find out what each theme contains so we can find the right sites when we want to change themes.

The following code in domain_theme.zip will pick up the settings from a random theme entry when the domain is not specified and more than one domain uses the specified theme. An improvement might be to order the result by domain_id ascending and select the first row so that the result is always from the first domain using the theme. Use limit 1 to return just the first row when there are many domains using the same theme.

  else if (!is_null($theme)) {
    $return = db_fetch_array(db_query("SELECT domain_id, theme, settings FROM {domain_theme} WHERE theme= '%s'", $theme));
  }

#7

celloandy - November 26, 2008 - 05:50

I tweaked the code to apply against version 6.x-2.0rc5, cleaned up the formatting, and made a fresh patch, which is attached. Note that this isn't my code; it's the same as before, just a bit prettier. The functionality I actually wanted was to be able to configure per-theme theme settings per domain, and I may try to extend the patch further to accomplish that objective.

AttachmentSize
domain_theme_settings.patch 3.81 KB

#8

celloandy - November 26, 2008 - 06:56

This version is updated with the functionality described in my last comment. Now, if a theme has been set for the domain, that theme's settings page is loaded in place of the default global settings page. Otherwise, it's the same as the last patch.

AttachmentSize
domain_theme_settings2.patch 4.04 KB

#9

waverate - December 4, 2008 - 11:40

Nice work.

Is it possible to add more settings to change a theme like colour or fixed width size? Or would it be easier to copy the themes with a unique name for each site?

#10

celloandy - January 7, 2009 - 17:53

Themes can add additional settings via the Theme Settings API, and my second patch allows that behavior, so making domain-specific copies was exactly what I was trying to avoid.

#11

Summit - January 7, 2009 - 19:49

this looks great functionality.
Will it be committed?
Thanks a lot in advance for considering!

Greetings,
Martijn

#12

Docc - February 3, 2009 - 10:41

subscribe, looks good. When wil this be commited?

#13

agentrickard - February 3, 2009 - 15:06
Version:6.x-1.1» 6.x-2.0-rc5
Status:needs work» needs review

Has anyone actually tested it against HEAD?

#14

Docc - February 10, 2009 - 15:10

This patch seems to work (rc5)
Only problem is that the domain_theme_settings_submit only implents a update query. Not an insert if no record exist in the domain_theme table.

#15

agentrickard - April 8, 2009 - 17:43
Status:needs review» needs work

Properly formatted patch. Untested.

AttachmentSize
303406-domain-theme.patch 4.54 KB

#16

agentrickard - April 8, 2009 - 18:09
Version:6.x-2.0-rc5» 6.x-2.0-rc6
Status:needs work» needs review

Here is a working patch from domain root. There is some related menu cleanup to be done. But the patch seems to work.

Note that you can only have one active theme per domain.

AttachmentSize
303406-domain-theme.patch 4.76 KB

#17

agentrickard - April 8, 2009 - 19:30

Perhaps we should kill the 'configure' link for non-active themes?

#18

agentrickard - April 29, 2009 - 17:44

Here is a more advanced patch, against HEAD, which allows per-domain settings per theme.

Requires running update.php.

I tested this with core themes, plus RootCandy, and was able to set the rootcandy icon size per domain. Nifty!

AttachmentSize
303406-theme-settings.patch 11.46 KB

#19

agentrickard - April 30, 2009 - 15:02
Status:needs review» needs work

This patch will not allow color switching with Garland, because Color module doesn't seem to support having more than one set of files per theme.

We _could_ copy some logic from color module to rewrite its behavior, but I am not crazy about that idea.

Here is a patch for testing -- note that Color module forces us to re-order the menu entry, too.

AttachmentSize
303406-theme-settings.patch 11.74 KB

#20

agentrickard - April 30, 2009 - 15:10

This patch tricks Color module into saving multiple directories, but we still have an issue because Color module's unique variables are not being loaded properly.

AttachmentSize
303406-theme-settings.patch 11.89 KB

#21

agentrickard - April 30, 2009 - 15:11

Removed the debug krumo().

AttachmentSize
303406-theme-settings.patch 11.87 KB

#22

agentrickard - May 1, 2009 - 20:23
Status:needs work» needs review

This versions is oh-so-close to working.

Still having issues with Color module deleting directories and not saving the proper logo file (or information).

Testers?

AttachmentSize
303406-theme-settings.patch 13.55 KB

#23

agentrickard - May 2, 2009 - 23:40

This version fixes the color module issues. Remaining to-do:

1) Uploaded logo files are not given unique enough names -- that is, all 'garland' theme logos are saved in 'files' as 'garland-logo'-- is there anything we can do? Perhaps temporarily set the files dir in $conf to 'files/domain_id/'?

2) We need to store the 'files' directory in the {domain_theme} table. That way, we _can_ delete directories that are not in use.

AttachmentSize
303406-theme-settings.patch 16.5 KB

#24

agentrickard - May 4, 2009 - 14:16

Mostly working patch -- anyone care to review?

AttachmentSize
303406-theme-settings.patch 19.51 KB

#25

jfirebau - May 13, 2009 - 13:32

agentrickard,

The patch you posted didn't work for me, but I think it is because I had the previous version of Domain Access installed. I will try my best to explain what I see.

Here's what I did. I used Eclipse to extract the latest Domain Access out of CVS as a project. Then applied your patch to Domain Access -- it said that it was 100% successful with a fuzzy factor of 2.

Then I zipped up the entire domain access module including the new Domain Access.

I turned off Domain Access in the modules, deleted the module -- unzipped the new CVS level, turned it back on -- ran update.php -- which did update some tables in the DB.

So far this all seems great.

Then I attempted the scenario that I care about -- I need to use the same theme on all my sub-domains but change the Logo image. So I went to my two domains and proceeded to set their default themes in the new Domain setup area. I made each domain directly point to a new image and then proceeded to test.

Neither of the two domains would honor the new logo info -- and what makes things even more interesting is that the template wasn't even coming close to honoring it. In fact, I noticed that it was returning a fully qualified path to another logo that I had tried to use on the previous version of Domain access when I attempted this feat before.

This suggests to me that I either have something that I need to clean out of my Database, or there is still something a little fishy with this module.

I tried dropping the domain_theme table and redoing all the previous steps (other than update.php) but that didn't seem to fix it either.

Any suggestions?

#26

agentrickard - May 13, 2009 - 14:11
Status:needs review» needs work

Did you read #23?

Logo image is a known issue at this time, since the auto-upload feature will name the file the same thing for every domain (something like 'logo-garland.png').

If you have logo files on the server and enter the path (not using the upload feature) it should work.

#27

jamesb23 - May 20, 2009 - 21:18

Firstly, thanks for the efforts so far :)

However I'm getting an error when trying to customize my site's theme:

Fatal error: Call to undefined function color_get_info() in C:\xampp\htdocs\sites\all\modules\domain\domain_theme\domain_theme.module on line 271

I'm using the latest 303406-theme-settings.patch, applied against the domain_theme from /head

One important thing to mention: I'm using the 'next gen' color module (color_soc08) here: http://drupal.org/project/color_soc08

I'm also using my own custom-developed theme.

More than likely it's something I've done wrong, I'll try and investigate the problem and will post back if I get anywhere.

[edited: more information]

I re-added the color_get_info function (from drupal 6's color.module) to the color.database.inc that comes with color_soc08:

function color_get_info($theme) {
  $path = drupal_get_path('theme', $theme);
  $file = $path .'/color/color.inc';
  if ($path && file_exists($file)) {
    include $file;
    return $info;
  }
}

Then in line 280 of domain_theme_module I then had a php error - the $theme parameter passed to array_key_exists is not a string. I guess my patched-in color_get_info function changed the value of $theme to an array rather than the theme-name - my hack was to re-issue the statement $theme = arg(4); before the call to array_key_exists. This caused the error to go away.

However, the next barrior seems to be the color module - which appears to be unsupported by domain_themes at present. The individual color-schemes that a color-module aware theme can support do not appear to work under the control of domain_themes (selecting color schemes always reverts back to the default).

I will try and find a solution, but my drupal/php knowledge is very limited. Apologies if my comments and work-arounds seem a little amateur-ish - I'm very new to drupal!

#28

agentrickard - May 21, 2009 - 18:14

It works and has been tested with core D6 color module, not the version you are using. I have been able to get Garland to change colors without any of the errors you report.

I do not plan to support Color Next Gen at this time. Note from the project page:

Not for production use yet! Under active development. Documentation and code are changing. Refer to the Handbook for the latest color.module syntax!

#29

agentrickard - May 23, 2009 - 16:03

Back to the work at hand.

Here is a patch that _almost_ works as desired. It forces each domain to move files into a specific directory (files/domain-1, files/domain-2 and so on) and fixes the naming issue with logo and icon uploads.

Still to do, if possible:

1) Delete unused color directories inside the domain-x folder. Right now, these just pile up, creating a new directory for each configuration. The core files/color directory continues to store only one copy, though.

2) Try to make it work with modules like Vertical Tabs, which have their own CSS files to copy. The problem there is that VT module reads the variable value for the color directory from the main site, and, due to the way forms are processed, I don't think we can force it to recognize our directory correctly.

So it may be that this gets committed as is, with some caveats.

AttachmentSize
303406-theme-settings.patch 19.69 KB

#30

agentrickard - May 24, 2009 - 17:09

The Vertical Tabs issue may be unsolvable, as that module writes to the variable table and we cannot control it.

#31

agentrickard - May 31, 2009 - 20:36
Status:needs work» needs review

This patch seems to work.

Note that with this patch, you must configure the primary (global) theme from the primary domain.

AttachmentSize
303406-theme-settings.patch 18.05 KB

#32

geenee - June 1, 2009 - 19:57

This is exactly what I have been trying to achieve with Domain Access! However I can't quite get this patch to work.

I've done a fresh install of Drupal, added domain access module and patched the files in the domain_theme folder, when i go to edit a domains theme settings ( admin/build/domain/theme/subsite/2/theme-settings) I get an error 'The directory /domain-2 does not exist.'

I've tried creating the directory 'domain-2' in sites/default/files, site/all/files and various other places but it still gives me the error...

Adding the filepath of a logo file and submitting the form gives the following error:

* The directory /domain-2 does not exist.
* The settings have not been saved because of the errors.

Any ideas?

#33

agentrickard - June 1, 2009 - 20:13

It should just append that value to whatever you have configured your files directory to be. You should not create the directory manually, it should be created for you.

You are using Public file method?
You ran update.php (or installed the module after patching domain_theme)?
You rebuilt your menus?
The 'files' directory is writable by the webserver?

#34

agentrickard - June 7, 2009 - 17:24
Status:needs review» fixed

Committing to HEAD.

#35

agentrickard - June 7, 2009 - 17:25

For reference.

AttachmentSize
303406.patch 22.89 KB

#36

orangecoat-ciallella - June 12, 2009 - 02:30
Status:fixed» needs review

I installed 6.x-2.0-rc7 and received the following error. Below is a patch against 6.x-2.0-rc7

Fatal error: Call to undefined function color_get_info() in /home/alliance/public_html/sites/all/modules/domain/domain_theme/domain_theme.admin.inc on line 133

This happened because I do not have color.module enabled, so the color_get_info() function doesn't exist. I see above that the same error occurred due to Color Next Gen module, but I am NOT using it or any other color related module.

I inspected the code and thought the use of module_exists() was appropriate and I consolidated all of the color specific code within an if statement and removed the return statement. I patched the code and tested with and without the color module enabled with success.

Please let me know if I should create an entirely new issue instead of re-opening a "fixed" issue. I didn't see any details in http://drupal.org/patch/submit about the proper protocol for handling a "fixed" issue that had a bug.

AttachmentSize
domain-303406-36.patch 2.1 KB

#37

agentrickard - June 12, 2009 - 13:47
Version:6.x-2.0-rc6» 6.x-2.0-rc7

No. This is a good patch. Color module is on by default so I never tested whether someone would turn it off.

#38

agentrickard - June 12, 2009 - 14:21

Here is a simpler version of the patch, which simply returns if no color settings.

Commtted! Thanks!

AttachmentSize
no-color.patch 1011 bytes

#39

agentrickard - June 13, 2009 - 19:41
Status:needs review» fixed

#40

System Message - June 27, 2009 - 19:50
Status:fixed» closed

Automatically closed -- issue fixed for 2 weeks with no activity.

#41

j.slemmer - July 19, 2009 - 12:05

Hi there,

I've stared playign around with the domain access module. And I've come across this issue in the latest release (rc8)
According to the conversation and patches it should be fixed, but I still get this error:

"The directory /domain-2 does not exist."

It is a clean install of Drupal 6.12 and RC8

Any suggestions?

#42

agentrickard - July 21, 2009 - 22:13

Don't comment on closed issues, for one. No one will see it.

 
 

Drupal is a registered trademark of Dries Buytaert.