You are viewing a plain text version of this content. The canonical link for it is here.
Posted to svn@forrest.apache.org by th...@apache.org on 2005/10/31 13:37:49 UTC

svn commit: r329808 - in /forrest/trunk/main/template-sites/v2/src/documentation/resources/themes/default: html/branding-theme-switcher.ft js/cssStyleSwitcher.js

Author: thorsten
Date: Mon Oct 31 04:37:39 2005
New Revision: 329808

URL: http://svn.apache.org/viewcvs?rev=329808&view=rev
Log:
Finished the theme switcher. In the end I used the cookie stuff submited by Kevin. Thanks a lot Kevin for your contribution that helped a lot. I enhanced the code by adding an example of a dynamic select box which contains all themes that one can select.

Modified:
    forrest/trunk/main/template-sites/v2/src/documentation/resources/themes/default/html/branding-theme-switcher.ft
    forrest/trunk/main/template-sites/v2/src/documentation/resources/themes/default/js/cssStyleSwitcher.js

Modified: forrest/trunk/main/template-sites/v2/src/documentation/resources/themes/default/html/branding-theme-switcher.ft
URL: http://svn.apache.org/viewcvs/forrest/trunk/main/template-sites/v2/src/documentation/resources/themes/default/html/branding-theme-switcher.ft?rev=329808&r1=329807&r2=329808&view=diff
==============================================================================
--- forrest/trunk/main/template-sites/v2/src/documentation/resources/themes/default/html/branding-theme-switcher.ft (original)
+++ forrest/trunk/main/template-sites/v2/src/documentation/resources/themes/default/html/branding-theme-switcher.ft Mon Oct 31 04:37:39 2005
@@ -56,6 +56,16 @@
             </select>
           </form>
           </div>
+          <div id="theme-switcher-dyn">Dynamic:
+            <form action="">
+              <select id="themeSwitcherSelect" onchange="switchThemeSelect(this);">
+                <option value="-1">Select a theme</option>
+              </select>
+            </form>
+            <script type="text/javascript">
+              initSelectSwitcher('themeSwitcherSelect');
+            </script>
+          </div>
         </xsl:template>
     </xsl:stylesheet>
   </forrest:template>

Modified: forrest/trunk/main/template-sites/v2/src/documentation/resources/themes/default/js/cssStyleSwitcher.js
URL: http://svn.apache.org/viewcvs/forrest/trunk/main/template-sites/v2/src/documentation/resources/themes/default/js/cssStyleSwitcher.js?rev=329808&r1=329807&r2=329808&view=diff
==============================================================================
--- forrest/trunk/main/template-sites/v2/src/documentation/resources/themes/default/js/cssStyleSwitcher.js (original)
+++ forrest/trunk/main/template-sites/v2/src/documentation/resources/themes/default/js/cssStyleSwitcher.js Mon Oct 31 04:37:39 2005
@@ -21,20 +21,22 @@
 * cssStyleSwitcher.js
 */
 function switchTheme(title){
-  for(var i = 0; i <document.getElementsByTagName("link").length; i++) {
-    var a = document.getElementsByTagName("link")[i];
+  var linkElements= document.getElementsByTagName("link");
+  for(var i = 0; i <linkElements.length; i++) {
+    var a = linkElements[i];
      //deactivate all screen css
     if (a.getAttribute("media") == "screen") {
       a.disabled=true;
     }
   }
   //activate the selected theme 
-  for(var i = 0; i <document.getElementsByTagName("link").length; i++) {
-    var a = document.getElementsByTagName("link")[i];
+  for(var i = 0; i <linkElements.length; i++) {
+    var a = linkElements[i];
     if (a.getAttribute("media") == "screen" ) {
       a.disabled = (a.getAttribute("title") == title)?false:true;
     }
   }
+  createCookie("style", title, 365);
 }
 /* change the active (preferred) stylesheet to the selected one and save it */
 function switchThemeSelect(selBox){
@@ -42,4 +44,60 @@
    var title= selBox.options[selIndex].value; // get the value of this index
    if (title == "-1") return false;
      switchTheme(title); // do the actual switch
-} // end method switchThemeSelect()
\ No newline at end of file
+} // end method switchThemeSelect()
+function initSelectSwitcher(themeSwitcherSelect){
+  var select = $(themeSwitcherSelect);
+  var themes=aviableThemes();
+  var tempTheme = themes.split(';');
+  for(var xi=0;xi < tempTheme.length;xi++) {
+    if (tempTheme[xi].length>1){
+      select.options[select.options.length] = new Option(tempTheme[xi]);
+    }
+  }
+}
+function aviableThemes(){
+  var currentTheme;
+  var themes="";
+  var linkElements= document.getElementsByTagName("link");
+  for(var i = 0; i <linkElements.length; i++) {
+    var a = linkElements[i];
+    if (a.getAttribute("media") == "screen" && a.getAttribute("title")) {
+      currentTheme=a.getAttribute("title");
+      var tempTheme = themes.split(';');
+      var contained = false;
+      for(var xi=0;xi < tempTheme.length;xi++) {
+        var theme = tempTheme[xi];
+        if (theme==currentTheme){
+          contained=true;
+        }
+      }
+      if (contained==false){
+        themes=themes+currentTheme+";";
+      }
+    }
+  }
+  return themes;
+}
+
+/*CookieStuff*/
+function createCookie(name, value, days) {
+	var date = new Date();
+	date.setTime(date.getTime() + (days*24*60*60*1000));
+	var expires = "; expires="+date.toGMTString();
+	document.cookie = name + "=" + value + expires + "; path=/";
+}
+function readCookie(name) {
+	var nameEQ = name + "=";
+	var ca = document.cookie.split(';');
+	for(var i=0;i < ca.length;i++) {
+		var c = ca[i];
+		while (c.charAt(0)==' ') c = c.substring(1,c.length);
+		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
+	}
+	return null;
+}
+function initBrandingThemeSwitcher(){
+	var cookie = readCookie("style");
+	switchTheme((cookie)?cookie:'default');
+}
+initBrandingThemeSwitcher();



Re: dynamic theme switcher (was: svn commit: r329808)

Posted by Thorsten Scherler <th...@apache.org>.
El mar, 01-11-2005 a las 18:32 +0000, Kevin escribió:
> On Tue, 2005-11-01 at 15:22 +0100, Thorsten Scherler wrote:
> > El lun, 31-10-2005 a las 21:26 +0000, Kevin escribió:
> > > On Mon, 2005-10-31 at 13:41 +0100, Thorsten Scherler wrote:
> > > > El lun, 31-10-2005 a las 12:37 +0000, thorsten@apache.org escribió:
> > > > > Author: thorsten
> > > > > Date: Mon Oct 31 04:37:39 2005
> > > > > New Revision: 329808
> > > > > 
> > > > > URL: http://svn.apache.org/viewcvs?rev=329808&view=rev
> > > > > Log:
> > > > > Finished the theme switcher. In the end I used the cookie stuff submited by Kevin. Thanks a lot Kevin for your contribution that helped a lot. I enhanced the code by adding an example of a dynamic select box which contains all themes that one can select.
> > > > 
> > > > Have fun with it. ;-)
> > > > 
> > > > salu2
> > > 
> > > Great work Thorsten the branding-theme-switcher.ft and js updates look
> > > good.
> > > 
> > > Kevin
> > 
> > Thanks very much, Kevin. :) You have been a big help on this, again. ;-)
> > 
> > ...but I just updated the contract and v2 to show off what I really
> > meant and understood you wanted to do. 
> 
> Yes this looks good. The cssStyleSwitcher using <link> and <style>
> tags. It may be confusing defining Pelt to be default and having
> default as an alternate. 

default will become "common".

> 
> I will need some time to understand the javascript. The old version
> was a simple switch of "alternate stylesheet" so IE users could
> emulate the menu "View->Style" of Moz browsers. This script is
> excelent though I've only looked on Moz Firefox and if you try
> "View->Style" on any of the profiled <style> alternates the page
> structure is lost (Pelt and default are as before).

Yes, because the script is aware of color derivatives that are based on
another theme. 

> If two style sheets are needed to define the complete layout I
> think they both need to be rel="alternate stylesheet" and have the
> same title. 

Hmm, the way it is implemented not. You define a main theme that will be
included if you select a color scheme.

> If the idea is to have a common css "pelt.basic.css".
> This is made persistant with rel="stylesheet" and no title and then
> a <style rel="alternate stylesheet" title="Pelt-Collabnet" ...>
> choice would be aggregated. 

Actually no because we deactivate all stylesheets before activating the
current selected. That does not matter if you do not choose a title.

> 
> Hmm I didn't get this right last time so I may be talking rubbish
> and the browser is not to spec.

Sure it would be nice if the browser build in feature could be used, but
the script does what we need (better what I understood). ;-)

> Thanks again Thorsten for this work.

Thanks for the feedback.
:)

salu2
-- 
thorsten

"Together we stand, divided we fall!" 
Hey you (Pink Floyd)


Re: dynamic theme switcher (was: svn commit: r329808)

Posted by Thorsten Scherler <th...@apache.org>.
El mié, 09-11-2005 a las 18:12 +0000, Kevin escribió:
> On Mon, 2005-11-07 at 20:28 +0100, Thorsten Scherler wrote:
> > El sáb, 05-11-2005 a las 14:43 +0000, Kevin escribió:
> > > My thoughts are:
> > > 
> > > branding-theme-switcher-profiler="false" needed a patch attached
> > 
> > The problem that I see on the patch is that if you have inline css in
> > your view means that their will always be executed due to the nature of
> > css. Everything that comes last will be used! Meaning that when using
> > inline css you are not able to deactivate them anymore.
> 
> Consider a user not using branding-theme-profiler.ft in their view file
> so there is no inline css. User is happy with <forrest:css ... to add
> their alternate stylesheets and would like to use branding-theme-
> switcher.ft to switch them. Setting branding-theme-switcher-profiler to
> false didn't work so the patch (string "false" not boolean false). 

Hmm, thx for spotting this, I will have a look ASAP.

> > > 
> > > If branding-theme-switcher-defaultTheme="Pelt"
> > > In view file have (<forrest:css ...) entries like below:
> > > 
> > > url="pelt.basic.css"
> > >   rel="stylesheet"
> > > (persistent | common - Is disabled=true allowed here?)
> > 
> > I comment just on this one. A theme switcher should not have common
> > persistent stylesheet because they will interfere with other
> > stylesheets. The current solution is using "common" css only for
> > color-profiling to not adding the basic.css to every profiled css.
> 
> If I say another way. Structurer sends a fixed html layout to the
> themer. This is a two column css layout with header and footer (S1).
> Layout/structure is persistent then we switch color. In the future
> structurer may be configurable and deliver a three column layout (S2)
> or even a Netscape 4 implementation using old layer tags (S3) ;) 
> 
> url="s1.common.css"
>   rel="stylesheet"
> (persistent no title)
> 
> url="s1.fonts.css"
>   rel="stylesheet" title="S1-Default"
> url="s1.colors.css"
>   rel="stylesheet" title="S1-Default"
> (preferred have title)
> 
> A user may separate concerns from common layout with fonts and colors.
> Collectively these three css are the default theme for that structure.

Still trying to understand.

> > > url="pelt.screen.css"
> > >   rel="stylesheet" theme="Pelt"
> > > (preferred | default - Is disabled=true allowed here?)
> > > 
> > > url="pelt.screen.css"
> > >   rel="alternate stylesheet" theme="Pelt-Default"
> > > (switchable back to default)
> > > 
> > 
> > What is the difference between "pelt"? Why 2? 
> > What do you mean by disabled=true? Do you mean the jscript disabling of
> > the css? If so yes you can disable evrything. ;-)
> 
> Yes disabled=true in jscript. IMO all css with rel="alternate
> stylesheet" will have disabled=true set by browser. IMO css that
> are persistent and preferred are allways disabled=false and
> should not be touched by jscript. 

...and here I see a problem. Imagine somebody do not want the 
> url="s1.common.css"
>   rel="stylesheet"
> (persistent no title)

the only way to override it to uncomment it in the structurer
definition, right?


> Now the first alternate below
> is to switch colors back to the default if another alternate has
> been chosen. IMO only alternate stylesheets go in the jscript theme
> chooser menu.


That means that:
> url="s1.fonts.css"
>   rel="stylesheet" title="S1-Default"
> url="s1.colors.css"
>   rel="stylesheet" title="S1-Default"
> (preferred have title)
Is always given and all alternate stylesheets have to unimplement the
css definition of this files. 


> 
> url="s1.colors.css"
>   rel="alternate stylesheet" title="S1-Pelt"
> (alternate to switch colors back to default)
> 
> > > url="pelt.forrest.css"
> > >   rel="alternate stylesheet" theme="Pelt-Forrest"
> > > (switchable)
> 
> url="s1.colors.forrest.css"
>   rel="alternate stylesheet" title="S1-Pelt-Forrest"
> 
> > > url="pelt.collabnet.css"
> > >   rel="alternate stylesheet" theme="Pelt-Collabnet"
> 
> url="s1.colors.collabnet.css"
>   rel="alternate stylesheet" title="S1-Pelt-Collabnet"
> 
> > > url="default.css"
> > >   rel="alternate stylesheet" theme="default"
> > > url="leather-dev.css"
> > >   rel="alternate stylesheet" theme="default"
> > > (one switchable as both have same title)
> 
> url="s1.leather-dev.css"
>   rel="alternate stylesheet" title="S1-Leather"
> url="s1.default.css"
>   rel="alternate stylesheet" title="S1-Leather"
> 
> > > IMO default.css and leather-dev.css could be combined together as
> > > leather.screen.css (leather-dev.css turns off - "display: none;"
> > > Pelt specific layout/structure). Is it default.css or common.css or
> > > just another switchable?
> > 
> > I agree that we need a cleanup of all this css-files but like Cyriaque
> > already stated I am  -1 to combine them. IMO leather-dev.css and
> > default.css has to go away as soon as I manage to move default to
> > common. Then we need a common.css out of both.
> 
> I agree. As Cyriaque said the leather-dev.css is disabling part of
> the layout structure (S1). Though default.css (common) contains Leather
> fonts and colors it would work as an alternate as S1-Leather above and
> below S1-Leather-Hot S1-Leather-Cool. IMO the name default.css (common)
> should be leather-complete.css.

sounds good.

> > > 
> > > url="leather.screen.css"
> > >   rel="alternate stylesheet" theme="Leather-Default"
> > > (switchable)
> > > 
> > > url="leather.hot.css"
> > >   rel="alternate stylesheet" theme="Leather-Hot"
> > > (switchable)
> 
> url="s1.leather-dev.css"
>   rel="alternate stylesheet" title="S1-Leather-Hot"
> url="s1.default.hot.css"
>   rel="alternate stylesheet" title="S1-Leather-Hot"
> 
> url="s1.leather-dev.css"
>   rel="alternate stylesheet" title="S1-Leather-Cool"
> url="s1.default.cool.css"
>   rel="alternate stylesheet" title="S1-Leather-Cool"
> 
> > > etc.
> > > 
> > 
> > Color profiling right now is only possible for one theme (the main theme
> > for the current request).
> 
> I think it is possible with alternates as above. If my explaination is
> ok. The main theme is S1-Default and alternates are:
> S1-Pelt, S1-Pelt-Forrest, S1-Pelt-Collabnet, etc
> S1-Leather, S1-Leather-Hot, S1-Leather-Cool, etc
>  

Hmm, I see.

> > > If branding-theme-switcher-defaultTheme="default"?
> > > Hmmm I'll look closer at the script to understand this if
> > > idea above is correct.
> > > 
> > > I understand if branding-theme-switcher-profiler="true"
> > > <style> css with the same title as <link> css will have
> > > disabled set false IMO only when rel="alternate stylesheet"
> > > and disabled set true for other rel="alternate stylesheet".
> > 
> > Wow. sorry do not understand.
> 
> OK. I've avoided talking about inline css this time.
> 

:)

> > > Is disabled=true allowed here? Was a comment next to
> > > persistent and preferred css above. Would all browsers
> > > allow it? The script works great just trying to understand.
> > > 
> > 
> > Yes disabled=true is for all browser that support the jscript spec in
> > this regard. IMO to get closer to a real theme switcher we should not
> > use persistent css because they will/can interfere with other css
> 
> As above. Yes disabled=true for all but *one* alternate css (the current
> color css or leather) which has disabled=false. I have used persistent
> css in this discussion of css color switching and alternates override
> colors. Then the special case of Leather which needs to disable part of
> the layout and can override fonts and colors.
> 
> Not sure what you mean. How will persistent interfere with other css.
> 

You just described how. ;-) You need to "disable part of the layout and
can override fonts and colors." I actually do not really like that. It
feels like a workaround.

> Anyway Thorsten thanks for your help I don't want to side track you
> again from other work. 

No, thank you. It is for people like you why I am developing the
dispatcher. ;-) If I get sidetracked that is perfectly alright. No
worries. Anyway, I need to finish the java code around the dispatcher
and will come to this topic. Feel free to submit a patch in the issue
tracker and I will test it.

Thank you again for all the feedback and good thoughts.

> These are my thoughts to get IE and Moz browsers
> to behave the same. Is there someone to test theme switcher with Opera?
> 

Opera is free now, just download it. ;-)

> Kevin
> 
> > salu2
> > 
> > > Kevin
> 
> 

salu2
-- 
thorsten

"Together we stand, divided we fall!" 
Hey you (Pink Floyd)


Re: dynamic theme switcher (was: svn commit: r329808)

Posted by Kevin <fo...@kegcl.demon.co.uk>.
On Mon, 2005-11-07 at 20:28 +0100, Thorsten Scherler wrote:
> El sáb, 05-11-2005 a las 14:43 +0000, Kevin escribió:
> > My thoughts are:
> > 
> > branding-theme-switcher-profiler="false" needed a patch attached
> 
> The problem that I see on the patch is that if you have inline css in
> your view means that their will always be executed due to the nature of
> css. Everything that comes last will be used! Meaning that when using
> inline css you are not able to deactivate them anymore.

Consider a user not using branding-theme-profiler.ft in their view file
so there is no inline css. User is happy with <forrest:css ... to add
their alternate stylesheets and would like to use branding-theme-
switcher.ft to switch them. Setting branding-theme-switcher-profiler to
false didn't work so the patch (string "false" not boolean false). 

> > 
> > If branding-theme-switcher-defaultTheme="Pelt"
> > In view file have (<forrest:css ...) entries like below:
> > 
> > url="pelt.basic.css"
> >   rel="stylesheet"
> > (persistent | common - Is disabled=true allowed here?)
> 
> I comment just on this one. A theme switcher should not have common
> persistent stylesheet because they will interfere with other
> stylesheets. The current solution is using "common" css only for
> color-profiling to not adding the basic.css to every profiled css.

If I say another way. Structurer sends a fixed html layout to the
themer. This is a two column css layout with header and footer (S1).
Layout/structure is persistent then we switch color. In the future
structurer may be configurable and deliver a three column layout (S2)
or even a Netscape 4 implementation using old layer tags (S3) ;) 

url="s1.common.css"
  rel="stylesheet"
(persistent no title)

url="s1.fonts.css"
  rel="stylesheet" title="S1-Default"
url="s1.colors.css"
  rel="stylesheet" title="S1-Default"
(preferred have title)

A user may separate concerns from common layout with fonts and colors.
Collectively these three css are the default theme for that structure.

> > url="pelt.screen.css"
> >   rel="stylesheet" theme="Pelt"
> > (preferred | default - Is disabled=true allowed here?)
> > 
> > url="pelt.screen.css"
> >   rel="alternate stylesheet" theme="Pelt-Default"
> > (switchable back to default)
> > 
> 
> What is the difference between "pelt"? Why 2? 
> What do you mean by disabled=true? Do you mean the jscript disabling of
> the css? If so yes you can disable evrything. ;-)

Yes disabled=true in jscript. IMO all css with rel="alternate
stylesheet" will have disabled=true set by browser. IMO css that
are persistent and preferred are allways disabled=false and
should not be touched by jscript. Now the first alternate below
is to switch colors back to the default if another alternate has
been chosen. IMO only alternate stylesheets go in the jscript theme
chooser menu.

url="s1.colors.css"
  rel="alternate stylesheet" title="S1-Pelt"
(alternate to switch colors back to default)

> > url="pelt.forrest.css"
> >   rel="alternate stylesheet" theme="Pelt-Forrest"
> > (switchable)

url="s1.colors.forrest.css"
  rel="alternate stylesheet" title="S1-Pelt-Forrest"

> > url="pelt.collabnet.css"
> >   rel="alternate stylesheet" theme="Pelt-Collabnet"

url="s1.colors.collabnet.css"
  rel="alternate stylesheet" title="S1-Pelt-Collabnet"

> > url="default.css"
> >   rel="alternate stylesheet" theme="default"
> > url="leather-dev.css"
> >   rel="alternate stylesheet" theme="default"
> > (one switchable as both have same title)

url="s1.leather-dev.css"
  rel="alternate stylesheet" title="S1-Leather"
url="s1.default.css"
  rel="alternate stylesheet" title="S1-Leather"

> > IMO default.css and leather-dev.css could be combined together as
> > leather.screen.css (leather-dev.css turns off - "display: none;"
> > Pelt specific layout/structure). Is it default.css or common.css or
> > just another switchable?
> 
> I agree that we need a cleanup of all this css-files but like Cyriaque
> already stated I am  -1 to combine them. IMO leather-dev.css and
> default.css has to go away as soon as I manage to move default to
> common. Then we need a common.css out of both.

I agree. As Cyriaque said the leather-dev.css is disabling part of
the layout structure (S1). Though default.css (common) contains Leather
fonts and colors it would work as an alternate as S1-Leather above and
below S1-Leather-Hot S1-Leather-Cool. IMO the name default.css (common)
should be leather-complete.css.

> > 
> > url="leather.screen.css"
> >   rel="alternate stylesheet" theme="Leather-Default"
> > (switchable)
> > 
> > url="leather.hot.css"
> >   rel="alternate stylesheet" theme="Leather-Hot"
> > (switchable)

url="s1.leather-dev.css"
  rel="alternate stylesheet" title="S1-Leather-Hot"
url="s1.default.hot.css"
  rel="alternate stylesheet" title="S1-Leather-Hot"

url="s1.leather-dev.css"
  rel="alternate stylesheet" title="S1-Leather-Cool"
url="s1.default.cool.css"
  rel="alternate stylesheet" title="S1-Leather-Cool"

> > etc.
> > 
> 
> Color profiling right now is only possible for one theme (the main theme
> for the current request).

I think it is possible with alternates as above. If my explaination is
ok. The main theme is S1-Default and alternates are:
S1-Pelt, S1-Pelt-Forrest, S1-Pelt-Collabnet, etc
S1-Leather, S1-Leather-Hot, S1-Leather-Cool, etc
 
> > If branding-theme-switcher-defaultTheme="default"?
> > Hmmm I'll look closer at the script to understand this if
> > idea above is correct.
> > 
> > I understand if branding-theme-switcher-profiler="true"
> > <style> css with the same title as <link> css will have
> > disabled set false IMO only when rel="alternate stylesheet"
> > and disabled set true for other rel="alternate stylesheet".
> 
> Wow. sorry do not understand.

OK. I've avoided talking about inline css this time.

> > Is disabled=true allowed here? Was a comment next to
> > persistent and preferred css above. Would all browsers
> > allow it? The script works great just trying to understand.
> > 
> 
> Yes disabled=true is for all browser that support the jscript spec in
> this regard. IMO to get closer to a real theme switcher we should not
> use persistent css because they will/can interfere with other css

As above. Yes disabled=true for all but *one* alternate css (the current
color css or leather) which has disabled=false. I have used persistent
css in this discussion of css color switching and alternates override
colors. Then the special case of Leather which needs to disable part of
the layout and can override fonts and colors.

Not sure what you mean. How will persistent interfere with other css.

Anyway Thorsten thanks for your help I don't want to side track you
again from other work. These are my thoughts to get IE and Moz browsers
to behave the same. Is there someone to test theme switcher with Opera?

Kevin

> salu2
> 
> > Kevin



Re: dynamic theme switcher (was: svn commit: r329808)

Posted by Thorsten Scherler <th...@apache.org>.
El sáb, 05-11-2005 a las 14:43 +0000, Kevin escribió:
> Sorry Thorsten I got side tracked by prototype.js :)
> 
> I'm looking at using branding-theme-switcher.ft to switch <link> css
> only. A corner image solution until corner image in <style> css are
> crawled. 
> 
> On Fri, 2005-11-04 at 01:45 +0100, Thorsten Scherler wrote: 
> > El mar, 01-11-2005 a las 18:32 +0000, Kevin escribió:
> > > If two style sheets are needed to define the complete layout I
> > > think they both need to be rel="alternate stylesheet" and have the
> > > same title. If the idea is to have a common css "pelt.basic.css".
> > > This is made persistant with rel="stylesheet" and no title 
> > 
> > How would the switch to the default.css (future common.css) work?
> 
> My thoughts are:
> 
> branding-theme-switcher-profiler="false" needed a patch attached

The problem that I see on the patch is that if you have inline css in
your view means that their will always be executed due to the nature of
css. Everything that comes last will be used! Meaning that when using
inline css you are not able to deactivate them anymore.

> 
> If branding-theme-switcher-defaultTheme="Pelt"
> In view file have (<forrest:css ...) entries like below:
> 
> url="pelt.basic.css"
>   rel="stylesheet"
> (persistent | common - Is disabled=true allowed here?)

I comment just on this one. A theme switcher should not have common
persistent stylesheet because they will interfere with other
stylesheets. The current solution is using "common" css only for
color-profiling to not adding the basic.css to every profiled css.

> url="pelt.screen.css"
>   rel="stylesheet" theme="Pelt"
> (preferred | default - Is disabled=true allowed here?)
> 
> url="pelt.screen.css"
>   rel="alternate stylesheet" theme="Pelt-Default"
> (switchable back to default)
> 

What is the difference between "pelt"? Why 2? 
What do you mean by disabled=true? Do you mean the jscript disabling of
the css? If so yes you can disable evrything. ;-)

> url="pelt.forrest.css"
>   rel="alternate stylesheet" theme="Pelt-Forrest"
> (switchable)
> 
> url="pelt.collabnet.css"
>   rel="alternate stylesheet" theme="Pelt-Collabnet"
> (switchable)
> 
> url="default.css"
>   rel="alternate stylesheet" theme="default"
> url="leather-dev.css"
>   rel="alternate stylesheet" theme="default"
> (one switchable as both have same title)
> 
> IMO default.css and leather-dev.css could be combined together as
> leather.screen.css (leather-dev.css turns off - "display: none;"
> Pelt specific layout/structure). Is it default.css or common.css or
> just another switchable?

I agree that we need a cleanup of all this css-files but like Cyriaque
already stated I am  -1 to combine them. IMO leather-dev.css and
default.css has to go away as soon as I manage to move default to
common. Then we need a common.css out of both.


> 
> url="leather.screen.css"
>   rel="alternate stylesheet" theme="Leather-Default"
> (switchable)
> 
> url="leather.hot.css"
>   rel="alternate stylesheet" theme="Leather-Hot"
> (switchable)
> 
> etc.
> 

Color profiling right now is only possible for one theme (the main theme
for the current request).

> If branding-theme-switcher-defaultTheme="default"?
> Hmmm I'll look closer at the script to understand this if
> idea above is correct.
> 
> I understand if branding-theme-switcher-profiler="true"
> <style> css with the same title as <link> css will have
> disabled set false IMO only when rel="alternate stylesheet"
> and disabled set true for other rel="alternate stylesheet".

Wow. sorry do not understand.

> Is disabled=true allowed here? Was a comment next to
> persistent and preferred css above. Would all browsers
> allow it? The script works great just trying to understand.
> 

Yes disabled=true is for all browser that support the jscript spec in
this regard. IMO to get closer to a real theme switcher we should not
use persistent css because they will/can interfere with other css

salu2

> Kevin
> 
> > You did unset all rel="alternate stylesheet" via requesting a "" title
> > but not the rel="stylesheet". Would that not interfere with e.g.
> > default.css? 
> > 
> > > and then
> > > a <style rel="alternate stylesheet" title="Pelt-Collabnet" ...>
> > > choice would be aggregated. 
> >  
> > see above. If it is possible to have default.css working with
> > rel="stylesheet" approach I will happily apply it. ;-)
-- 
thorsten

"Together we stand, divided we fall!" 
Hey you (Pink Floyd)


Re: dynamic theme switcher

Posted by Thorsten Scherler <th...@apache.org>.
El lun, 07-11-2005 a las 09:46 +0100, Cyriaque Dupoirieux escribió:
> Kevin a écrit :
> 
> >Sorry Thorsten I got side tracked by prototype.js :)
> >

jeje, it is really nice. ;-)

> >I'm looking at using branding-theme-switcher.ft to switch <DEFANGED_link> css
> >only. A corner image solution until corner image in  <!-- <DEFANGED_STYLE> css are
> >crawled. 

Actually I found out why it was not crawled and will commit that ASAP
(lunch break). All images are now crawled. :)

+        <!-- WORKAROUND The following transfomer are responsible for
generating links for inline css It produces non valid css!!!-->
+        <!-- FIXME make contracts self containing and open them for
css-->
+        <map:transform type="pattern"
+
src="{forrest:context}/resources/chaperon/grammars/link.xlex" />
+      <map:transform
+
src="{forrest:context}/resources/chaperon/stylesheets/pattern2link.xsl" />

More comments later.

salu2
-- 
thorsten

"Together we stand, divided we fall!" 
Hey you (Pink Floyd)


Re: dynamic theme switcher

Posted by Cyriaque Dupoirieux <Cy...@pcotech.fr>.
Kevin a écrit :

>Sorry Thorsten I got side tracked by prototype.js :)
>
>I'm looking at using branding-theme-switcher.ft to switch <DEFANGED_link> css
>only. A corner image solution until corner image in  <!-- <DEFANGED_STYLE> css are
>crawled. 
>
>On Fri, 2005-11-04 at 01:45 +0100, Thorsten Scherler wrote: 
>  
>
>>El mar, 01-11-2005 a las 18:32 +0000, Kevin escribió:
>>    
>>
>>>If two style sheets are needed to define the complete layout I
>>>think they both need to be rel="alternate stylesheet" and have the
>>>same title. If the idea is to have a common css "pelt.basic.css".
>>>This is made persistant with rel="stylesheet" and no title 
>>>      
>>>
>>How would the switch to the default.css (future common.css) work?
>>    
>>
>
>My thoughts are:
>
>branding-theme-switcher-profiler="false" needed a patch attached
>
>If branding-theme-switcher-defaultTheme="Pelt"
>In view file have (<forrest:css ...) entries like below:
>
>url="pelt.basic.css"
>  rel="stylesheet"
>(persistent | common - Is disabled=true allowed here?)
>
>url="pelt.screen.css"
>  rel="stylesheet" theme="Pelt"
>(preferred | default - Is disabled=true allowed here?)
>
>url="pelt.screen.css"
>  rel="alternate stylesheet" theme="Pelt-Default"
>(switchable back to default)
>
>url="pelt.forrest.css"
>  rel="alternate stylesheet" theme="Pelt-Forrest"
>(switchable)
>
>url="pelt.collabnet.css"
>  rel="alternate stylesheet" theme="Pelt-Collabnet"
>(switchable)
>
>url="default.css"
>  rel="alternate stylesheet" theme="default"
>url="leather-dev.css"
>  rel="alternate stylesheet" theme="default"
>(one switchable as both have same title)
>
>IMO default.css and leather-dev.css could be combined together as
>leather.screen.css (leather-dev.css turns off - "display: none;"
>Pelt specific layout/structure). Is it default.css or common.css or
>just another switchable?
>  
>
I agree that default is not a good name because it seems clear that this 
css has been writen for leather-dev.
But I don't think it's a good idea to merge default.css and 
leather-dev.css because the first one should be the one used by the 
leather theme. (The idea is to try to be close the 
http://www.csszengarden.com/ site) and the second one - as you said - is 
to disable the specificity of pelt theme which must not disturb the 
leather-dev theme...

Salutations,
Cyriaque,

>url="leather.screen.css"
>  rel="alternate stylesheet" theme="Leather-Default"
>(switchable)
>
>url="leather.hot.css"
>  rel="alternate stylesheet" theme="Leather-Hot"
>(switchable)
>
>etc.
>
>If branding-theme-switcher-defaultTheme="default"?
>Hmmm I'll look closer at the script to understand this if
>idea above is correct.
>
>I understand if branding-theme-switcher-profiler="true"
> <!-- <DEFANGED_STYLE> css with the same title as <DEFANGED_link> css will have
>disabled set false IMO only when rel="alternate stylesheet"
>and disabled set true for other rel="alternate stylesheet".
>
>Is disabled=true allowed here? Was a comment next to
>persistent and preferred css above. Would all browsers
>allow it? The script works great just trying to understand.
>
>Kevin
>
>  
>
>>You did unset all rel="alternate stylesheet" via requesting a "" title
>>but not the rel="stylesheet". Would that not interfere with e.g.
>>default.css? 
>>
>>    
>>
>>>and then
>>>a  <!-- <DEFANGED_STYLE rel="alternate stylesheet" title="Pelt-Collabnet" ...>
>>>choice would be aggregated. 
>>>      
>>>
>> 
>>see above. If it is possible to have default.css working with
>>rel="stylesheet" approach I will happily apply it. ;-)
>>    
>>
>>------------------------------------------------------------------------
>>
>>--- cssStyleSwitcher.js.orig	2005-11-03 16:50:44.000000000 +0000
>>+++ cssStyleSwitcher.js	2005-11-04 17:59:02.815917976 +0000
>>@@ -20,7 +20,7 @@
>> *
>> * cssStyleSwitcher.js
>> */
>>-var THEME_SWITCHER_PROFILING=false;
>>+var THEME_SWITCHER_PROFILING="false";
>> var THEME_SWITCHER_DEFAULT_THEME="";
>> function switchTheme(title){
>>   var linkElements= document.getElementsByTagName("link"); // get all linked objects
>>@@ -37,7 +37,7 @@
>>     if (a.getAttribute("media") == "screen" ) {
>> /* theme profiling will only change a couple of stylesheets so we need to include
>>     the default theme on which the profiling is based on*/
>>-      if (THEME_SWITCHER_PROFILING){
>>+      if (THEME_SWITCHER_PROFILING != "false"){
>>         if(title.lastIndexOf(THEME_SWITCHER_DEFAULT_THEME)>-1){
>>           var profiled = (a.getAttribute("title") == THEME_SWITCHER_DEFAULT_THEME || a.getAttribute("title") == title)?true:false;
>>           a.disabled = (profiled)?false:true;
>>@@ -49,6 +49,7 @@
>>       }
>>     }
>>   }
>>+if (THEME_SWITCHER_PROFILING != "false"){
>>   var styleElements= document.getElementsByTagName("style");// get all inline style objects
>>   for(var i = 0; i  <!-- <DEFANGED_STYLEElements.length; i++) {
>>     var a = styleElements[i];
>>@@ -63,18 +64,15 @@
>>     if (a.getAttribute("media") == "screen" ) {
>> /* theme profiling will only change a couple of stylesheets so we need to include
>>     the default theme on which the profiling is based on*/
>>-      if (THEME_SWITCHER_PROFILING){
>>         if(title.lastIndexOf(THEME_SWITCHER_DEFAULT_THEME)>-1){
>>           var profiled = (a.getAttribute("title") == THEME_SWITCHER_DEFAULT_THEME || a.getAttribute("title") == title)?true:false;
>>           a.disabled = (profiled)?false:true;
>>         }else{
>>           a.disabled = (a.getAttribute("title") == title)?false:true;
>>         }
>>-      }else{
>>-        a.disabled = (a.getAttribute("title") == title)?false:true;
>>-      }
>>     }
>>   }
>>+}
>>   createCookie("style", title, 365);
>> } // end method switchTheme(title)
>> /* change the active (preferred) stylesheet to the selected one and save it */
>>@@ -128,6 +126,7 @@
>>       }
>>     }
>>   }
>>+if (THEME_SWITCHER_PROFILING != "false"){
>>   var styleElements= document.getElementsByTagName("style");
>>   for(var i = 0; i  <!-- <DEFANGED_STYLEElements.length; i++) {
>>     var a = styleElements[i];
>>@@ -146,6 +145,7 @@
>>       }
>>     }
>>   }
>>+}
>>   return themes;
>> }
>> 
>>    
>>

Re: dynamic theme switcher (was: svn commit: r329808)

Posted by Kevin <fo...@kegcl.demon.co.uk>.
Sorry Thorsten I got side tracked by prototype.js :)

I'm looking at using branding-theme-switcher.ft to switch <link> css
only. A corner image solution until corner image in <style> css are
crawled. 

On Fri, 2005-11-04 at 01:45 +0100, Thorsten Scherler wrote: 
> El mar, 01-11-2005 a las 18:32 +0000, Kevin escribió:
> > If two style sheets are needed to define the complete layout I
> > think they both need to be rel="alternate stylesheet" and have the
> > same title. If the idea is to have a common css "pelt.basic.css".
> > This is made persistant with rel="stylesheet" and no title 
> 
> How would the switch to the default.css (future common.css) work?

My thoughts are:

branding-theme-switcher-profiler="false" needed a patch attached

If branding-theme-switcher-defaultTheme="Pelt"
In view file have (<forrest:css ...) entries like below:

url="pelt.basic.css"
  rel="stylesheet"
(persistent | common - Is disabled=true allowed here?)

url="pelt.screen.css"
  rel="stylesheet" theme="Pelt"
(preferred | default - Is disabled=true allowed here?)

url="pelt.screen.css"
  rel="alternate stylesheet" theme="Pelt-Default"
(switchable back to default)

url="pelt.forrest.css"
  rel="alternate stylesheet" theme="Pelt-Forrest"
(switchable)

url="pelt.collabnet.css"
  rel="alternate stylesheet" theme="Pelt-Collabnet"
(switchable)

url="default.css"
  rel="alternate stylesheet" theme="default"
url="leather-dev.css"
  rel="alternate stylesheet" theme="default"
(one switchable as both have same title)

IMO default.css and leather-dev.css could be combined together as
leather.screen.css (leather-dev.css turns off - "display: none;"
Pelt specific layout/structure). Is it default.css or common.css or
just another switchable?

url="leather.screen.css"
  rel="alternate stylesheet" theme="Leather-Default"
(switchable)

url="leather.hot.css"
  rel="alternate stylesheet" theme="Leather-Hot"
(switchable)

etc.

If branding-theme-switcher-defaultTheme="default"?
Hmmm I'll look closer at the script to understand this if
idea above is correct.

I understand if branding-theme-switcher-profiler="true"
<style> css with the same title as <link> css will have
disabled set false IMO only when rel="alternate stylesheet"
and disabled set true for other rel="alternate stylesheet".

Is disabled=true allowed here? Was a comment next to
persistent and preferred css above. Would all browsers
allow it? The script works great just trying to understand.

Kevin

> You did unset all rel="alternate stylesheet" via requesting a "" title
> but not the rel="stylesheet". Would that not interfere with e.g.
> default.css? 
> 
> > and then
> > a <style rel="alternate stylesheet" title="Pelt-Collabnet" ...>
> > choice would be aggregated. 
>  
> see above. If it is possible to have default.css working with
> rel="stylesheet" approach I will happily apply it. ;-)

Re: dynamic theme switcher (was: svn commit: r329808)

Posted by Thorsten Scherler <th...@apache.org>.
El mar, 01-11-2005 a las 18:32 +0000, Kevin escribió:
> If two style sheets are needed to define the complete layout I
> think they both need to be rel="alternate stylesheet" and have the
> same title. If the idea is to have a common css "pelt.basic.css".
> This is made persistant with rel="stylesheet" and no title 

How would the switch to the default.css (future common.css) work?

You did unset all rel="alternate stylesheet" via requesting a "" title
but not the rel="stylesheet". Would that not interfere with e.g.
default.css? 

> and then
> a <style rel="alternate stylesheet" title="Pelt-Collabnet" ...>
> choice would be aggregated. 
 
see above. If it is possible to have default.css working with
rel="stylesheet" approach I will happily apply it. ;-)
-- 
thorsten

"Together we stand, divided we fall!" 
Hey you (Pink Floyd)


Re: dynamic theme switcher (was: svn commit: r329808)

Posted by Kevin <fo...@kegcl.demon.co.uk>.
On Tue, 2005-11-01 at 15:22 +0100, Thorsten Scherler wrote:
> El lun, 31-10-2005 a las 21:26 +0000, Kevin escribió:
> > On Mon, 2005-10-31 at 13:41 +0100, Thorsten Scherler wrote:
> > > El lun, 31-10-2005 a las 12:37 +0000, thorsten@apache.org escribió:
> > > > Author: thorsten
> > > > Date: Mon Oct 31 04:37:39 2005
> > > > New Revision: 329808
> > > > 
> > > > URL: http://svn.apache.org/viewcvs?rev=329808&view=rev
> > > > Log:
> > > > Finished the theme switcher. In the end I used the cookie stuff submited by Kevin. Thanks a lot Kevin for your contribution that helped a lot. I enhanced the code by adding an example of a dynamic select box which contains all themes that one can select.
> > > 
> > > Have fun with it. ;-)
> > > 
> > > salu2
> > 
> > Great work Thorsten the branding-theme-switcher.ft and js updates look
> > good.
> > 
> > Kevin
> 
> Thanks very much, Kevin. :) You have been a big help on this, again. ;-)
> 
> ...but I just updated the contract and v2 to show off what I really
> meant and understood you wanted to do. 

Yes this looks good. The cssStyleSwitcher using <link> and <style>
tags. It may be confusing defining Pelt to be default and having
default as an alternate. 

I will need some time to understand the javascript. The old version
was a simple switch of "alternate stylesheet" so IE users could
emulate the menu "View->Style" of Moz browsers. This script is
excelent though I've only looked on Moz Firefox and if you try
"View->Style" on any of the profiled <style> alternates the page
structure is lost (Pelt and default are as before).

If two style sheets are needed to define the complete layout I
think they both need to be rel="alternate stylesheet" and have the
same title. If the idea is to have a common css "pelt.basic.css".
This is made persistant with rel="stylesheet" and no title and then
a <style rel="alternate stylesheet" title="Pelt-Collabnet" ...>
choice would be aggregated. 

Hmm I didn't get this right last time so I may be talking rubbish
and the browser is not to spec.

Thanks again Thorsten for this work.

Kevin


> New Revision: 330061
> 
> URL: http://svn.apache.org/viewcvs?rev=330061&view=rev
> Log:
> - Enabled theme-profiling in the theme switcher. In combination with the
> branding-theme-profiler this contract provides a quick way to create new
> themes and switch them. The default theme can have unlimited color
> derivatives. If you turn on the color profiling this contract will
> activate the default theme in combination with the profiling styles.
> - Updated the example fv to enable the full power of the contract.
> - removed static stuff in contract and made all possible values
> configurable via the fv.
> - you can choose between an "a-link" switcher, that will output the
> possible themes in <a href="">theme</a>$seperator... gramatic, or as
> select box.
> 
> With this commit I now *have to* solve the round-corner issue. ...but
> lucky me you already posted the code in another mail. :) Thx so much,
> Kevin. 
> 
> salu2


Re: dynamic theme switcher (was: svn commit: r329808)

Posted by Thorsten Scherler <th...@apache.org>.
El lun, 31-10-2005 a las 21:26 +0000, Kevin escribió:
> On Mon, 2005-10-31 at 13:41 +0100, Thorsten Scherler wrote:
> > El lun, 31-10-2005 a las 12:37 +0000, thorsten@apache.org escribió:
> > > Author: thorsten
> > > Date: Mon Oct 31 04:37:39 2005
> > > New Revision: 329808
> > > 
> > > URL: http://svn.apache.org/viewcvs?rev=329808&view=rev
> > > Log:
> > > Finished the theme switcher. In the end I used the cookie stuff submited by Kevin. Thanks a lot Kevin for your contribution that helped a lot. I enhanced the code by adding an example of a dynamic select box which contains all themes that one can select.
> > 
> > Have fun with it. ;-)
> > 
> > salu2
> 
> Great work Thorsten the branding-theme-switcher.ft and js updates look
> good.
> 
> Kevin

Thanks very much, Kevin. :) You have been a big help on this, again. ;-)

...but I just updated the contract and v2 to show off what I really
meant and understood you wanted to do. 

New Revision: 330061

URL: http://svn.apache.org/viewcvs?rev=330061&view=rev
Log:
- Enabled theme-profiling in the theme switcher. In combination with the
branding-theme-profiler this contract provides a quick way to create new
themes and switch them. The default theme can have unlimited color
derivatives. If you turn on the color profiling this contract will
activate the default theme in combination with the profiling styles.
- Updated the example fv to enable the full power of the contract.
- removed static stuff in contract and made all possible values
configurable via the fv.
- you can choose between an "a-link" switcher, that will output the
possible themes in <a href="">theme</a>$seperator... gramatic, or as
select box.

With this commit I now *have to* solve the round-corner issue. ...but
lucky me you already posted the code in another mail. :) Thx so much,
Kevin. 

salu2
-- 
thorsten

"Together we stand, divided we fall!" 
Hey you (Pink Floyd)


Re: dynamic theme switcher (was: svn commit: r329808)

Posted by Kevin <fo...@kegcl.demon.co.uk>.
On Mon, 2005-10-31 at 13:41 +0100, Thorsten Scherler wrote:
> El lun, 31-10-2005 a las 12:37 +0000, thorsten@apache.org escribió:
> > Author: thorsten
> > Date: Mon Oct 31 04:37:39 2005
> > New Revision: 329808
> > 
> > URL: http://svn.apache.org/viewcvs?rev=329808&view=rev
> > Log:
> > Finished the theme switcher. In the end I used the cookie stuff submited by Kevin. Thanks a lot Kevin for your contribution that helped a lot. I enhanced the code by adding an example of a dynamic select box which contains all themes that one can select.
> 
> Have fun with it. ;-)
> 
> salu2

Great work Thorsten the branding-theme-switcher.ft and js updates look
good.

Kevin



dynamic theme switcher (was: svn commit: r329808)

Posted by Thorsten Scherler <th...@apache.org>.
El lun, 31-10-2005 a las 12:37 +0000, thorsten@apache.org escribió:
> Author: thorsten
> Date: Mon Oct 31 04:37:39 2005
> New Revision: 329808
> 
> URL: http://svn.apache.org/viewcvs?rev=329808&view=rev
> Log:
> Finished the theme switcher. In the end I used the cookie stuff submited by Kevin. Thanks a lot Kevin for your contribution that helped a lot. I enhanced the code by adding an example of a dynamic select box which contains all themes that one can select.

Have fun with it. ;-)

salu2
-- 
thorsten

"Together we stand, divided we fall!" 
Hey you (Pink Floyd)