Thinking more about it, the lines 72 to 74 are necessary to avoid
stylesheet-flickering. If you load the stylesheet specified in the cookie
as late as window.onload is called, the wiki.css or OverrideStylesheet
gets displayed first before it is replaced by window.onload. So why do we
need the duplicate stylesheet loading in window.onload?

Well, for my needs it serves as a workaround to use this cookie mechanism.
I now call SetActiveStylesheet() in my javascript (inserted by means of
FleXhtml into the TopBorder) directly (not window.onload) and adding my
stylesheet as an alternate stylesheet in flexwiki.config.

The only drawback is: If the wiki contains other namespaces without these
additions, there will be issues when the visitor is going from one
namespace to another because the cookie isn't namespace specific. But I'll
presumably use only one namespace so this is fine for me.

Benno.

> That part of WikiDefault.js is Derek's code (I think).
> I see the duplication you are talking about and can only surmise it is
> there
> for some browser support where onload did not behave as expected. If that
> is
> not the case then perhaps it could be removed?
>
> John Davidson
>
> On 1/23/08, Benno Dielmann <[EMAIL PROTECTED]> wrote:
>>
>> I already tried defining my own window.onload function calling
>> SetActiveStylesheet(), but unfortunately, WikiDefault.js reads the
>> cookie
>> and
>> calls SetActiveStylesheet() twice: once directly in WikiDefault.js (not
>> wrapped in a function, l. 72-74) and the second time in a window.onload
>> anonymous function (l. 61-65). So even if I reassign window.onload to my
>> on
>> function the wrong stylesheet still gets loaded before the right one
>> resulting in visibly changing styles. Perhaps this code duplication is a
>> bug
>> in WikiDefault.js, perhaps it is wanted. Who knows more?
>>
>> If it isn't needed for some reason, the easiest solution would be to
>> just
>> remove lines 72 to 74 from WikiDefault.js.
>>
>> As I'm at home now where I don't have the possibility to run IIS,
>> further
>> exploration on my side has to wait until tomorrow.
>>
>> Benno.
>>
>> On Wednesday 23 January 2008 John Davidson wrote:
>> | The cookie is how Derek persists the preferred stylesheet across
>> pages.
>> It
>> | works well for all standard implementations, and by adding some
>> javascript
>> | of your own, you can probably make that javascript do exactly what you
>> | want. In your javascript you need to make a call to
>> | 'SetActiveStylesheet(var)' where you have set 'var' to the stylesheet
>> link
>> | name.
>> | Did you check out the topic [1] where I have styles directly in the
>> html
>> | being emitted by the xhtml plugin?
>> |
>> | If none of these work for you I can probably code an optional
>> alternate
>> | stylesheet for the admin section. this would work as there is no call
>> to
>> | WikiDefault.js in the admin pages.
>> |
>> | [1]
>> http://ods.dyndns.org/FlexWiki/default.aspx/OdsWiki/FleXhtmlDemo.html
>> |
>> | John Davidson
>> |
>> | On 1/23/08, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>> | > In short, I need to apply a stylesheet to all topics in a namespace
>> but
>> | > not to the admin and topic edit pages (etc.). Being able to put the
>> | > Stylesheet property in a custom border (defined in _NormalBorders)
>> and
>> to
>> | > disable stylesheet loading from WikiDefault.js would be it, but
>> | > properties in borders don't work. <OverrideStylesheet> doesn't work
>> | > either, because it doesn't exclude admin and edit pages.
>> | >
>> | > > Sorry I got out of sync on the last input.
>> | > > Benno, I assume you are using the xhtml plugin, correct?
>> | >
>> | > Yes I do :-). And it serves me well, even as a workaround for my
>> | > stylesheet problem: At the moment I just insert a <link />
>> referencing
>> my
>> | > stylesheet into the TopBorder via FleXhtml. But specifying
>> stylesheets
>> in
>> | > the document body is not nice at all and I don't know about
>> potential
>> | > side effects. And sometimes, when a browser (especially IE) hangs
>> while
>> | > loading the page, you see the default (wiki.css) design shortly
>> before
>> it
>> | > becomes replaced by my css.
>> | >
>> | > > I need to find a way to see what you are trying to do. Are any of
>> your
>> | > > pages
>> | > > available on a public web site, or are they limited to a local
>> | > > intranet?
>> | > >
>> | > > If they are on a public site please send me the URL's to replicate
>> the
>> | > > issue. Otherwise can you create copies of the topics on my wiki at
>> | > > ods.dyndns.org? You would have to send me the js and css files
>> (which I
>> | > > would delete later), so that it can be setup. I have a namespace
>> | > > 'TestWiki'
>> | > > that can be used.
>> | >
>> | > Unfortunately, this would require me to break things down to a demo
>> test
>> | > case because until now, it's not even on the intranet ;-)...
>> | >
>> | > The failure of the Stylesheet property is easy to replicate, though.
>> This
>> | > problem should exist on all FlexWiki versions which include the
>> cookie
>> | > mechanism of WikiDefault.js.
>> | >
>> | > Thanks a lot for your responses,
>> | >
>> | > Benno.
>> | >
>> | > > On Jan 23, 2008 1:19 PM, Derek Lakin <[EMAIL PROTECTED]>
>> wrote:
>> | > >> OK, this sounds like a bug related to the JavaScript required for
>> | > >> handling
>> | > >> alternate stylesheets. It would be great if you could raise a bug
>> on
>> | >
>> | > the
>> | >
>> | > >> tracker for this. I think the implementation was one of the many
>> | > >> contributions from John?
>> | > >>
>> | > >> Thanks,
>> | > >>
>> | > >> Derek.
>> | > >>
>> | > >> --------------------------------------------------
>> | > >> From: <[EMAIL PROTECTED]>
>> | > >> Sent: Wednesday, January 23, 2008 6:15 PM
>> | > >> To: <flexwiki-users@lists.sourceforge.net>
>> | > >> Subject: Re: [Flexwiki-users] Separate stylesheets for admin and
>> | > >> content?
>> | > >>
>> | > >> > Well... I found the cause but not the cure...
>> | > >> >
>> | > >> > The <link /> is generated, but WikiDefault.js loads a
>> stylesheet
>> | > >>
>> | > >> specified
>> | > >>
>> | > >> > in a cookie that gets set on page unload. So, when I surf to a
>> topic
>> | >
>> | > A
>> | >
>> | > >> > with Stylesheet property from a topic B without, WikiDefault.js
>> | > >> > loads
>> | > >>
>> | > >> the
>> | > >>
>> | > >> > stylesheet used by topic B when entering page A.
>> | > >> >
>> | > >> > Benno.
>> | > >> >
>> | > >> >> Looking at the generated HTML, there's no reason why putting
>> the
>> | > >> >> topic-specific CSS in the same location as the rest of your
>> CSS
>> | >
>> | > files
>> | >
>> | > >> >> (the
>> | > >> >> root folder) shouldn't work. What have you put in the
>> | > >> >> topic-specific
>> | > >>
>> | > >> CSS?
>> | > >>
>> | > >> >> Have you checked the generated HTML to ensure that the
>> additional
>> | > >>
>> | > >> <link
>> | > >>
>> | > >> >> />
>> | > >> >> tag has been generated?
>> | > >> >>
>> | > >> >> Derek.
>> | > >> >>
>> | > >> >> --------------------------------------------------
>> | > >> >> From: <[EMAIL PROTECTED]>
>> | > >> >> Sent: Wednesday, January 23, 2008 5:52 PM
>> | > >> >> To: <flexwiki-users@lists.sourceforge.net>
>> | > >> >> Subject: Re: [Flexwiki-users] Separate stylesheets for admin
>> and
>> | > >>
>> | > >> content?
>> | > >>
>> | > >> >>> Stylesheet: MyStylesheet.css
>> | > >> >>>
>> | > >> >>> with MyStylesheet.css in the FlexWiki root folder (where all
>> other
>> | > >>
>> | > >> such
>> | > >>
>> | > >> >>> as
>> | > >> >>> wiki.css reside) doesn't work. Do I have to specify a path?
>> Which
>> | > >>
>> | > >> path?
>> | > >>
>> | > >> >>> /FlexWiki/MyStylesheet.css doesn't work either. By the way,
>> I'm
>> | > >>
>> | > >> using
>> | > >>
>> | > >> >>> FlexWiki 2.0.0.179...
>> | > >> >>>
>> | > >> >>> Benno.
>> | > >> >>>
>> | > >> >>>> If you want the content from the left on the right and vice
>> | > >> >>>> versa, can't
>> | > >> >>>> you
>> | > >> >>>> just switch the definitions in _NormalBorders, rather than
>> doing
>> | > >>
>> | > >> the
>> | > >>
>> | > >> >>>> switch
>> | > >> >>>> in CSS?
>> | > >> >>>>
>> | > >> >>>> The Stylesheet page property defines an additional CSS file
>> for
>> | > >>
>> | > >> that
>> | > >>
>> | > >> >>>> topic.
>> | > >> >>>> E.g.
>> | > >> >>>>
>> | > >> >>>> Stylsheet: myNewStyleSheet.css
>> | > >> >>>>
>> | > >> >>>> Derek.
>> | > >> >>>>
>> | > >> >>>> --------------------------------------------------
>> | > >> >>>> From: <[EMAIL PROTECTED]>
>> | > >> >>>> Sent: Wednesday, January 23, 2008 4:34 PM
>> | > >> >>>> To: <flexwiki-users@lists.sourceforge.net>
>> | > >> >>>> Subject: Re: [Flexwiki-users] Separate stylesheets for admin
>> and
>> | > >> >>>> content?
>> | > >> >>>>
>> | > >> >>>>> Hi Derek,
>> | > >> >>>>>
>> | > >> >>>>> thanks a lot for your answer.
>> | > >> >>>>>
>> | > >> >>>>>> Admin.css is a hangover from before we updated the
>> stylesheet.
>> | >
>> | > As
>> | >
>> | > >> you
>> | > >>
>> | > >> >>>>>> point
>> | > >> >>>>>> out, I don't think it actually gets used by anything. At
>> this
>> | > >>
>> | > >> stage,
>> | > >>
>> | > >> >>>>>> I
>> | > >> >>>>>> don't
>> | > >> >>>>>> think it's possible to explicitly specify a different
>> | > >> >>>>>> stylesheet
>> | > >>
>> | > >> for
>> | > >>
>> | > >> >>>>>> the
>> | > >> >>>>>> admin pages without making some code changes. That said,
>> the
>> | > >>
>> | > >> admin
>> | > >>
>> | > >> >>>>>> pages
>> | > >> >>>>>> are
>> | > >> >>>>>> quite simple from a CSS point of view, so it shouldn't be
>> too
>> | > >> >>>>>> difficult
>> | > >> >>>>>> to
>> | > >> >>>>>> handle them in your override CSS file.
>> | > >> >>>>>
>> | > >> >>>>> Unfortunately, it is... For example, I exchange LeftBorder
>> and
>> | > >> >>>>> RightBorder
>> | > >> >>>>> so that LeftBorder is on the right side and RightBorder on
>> the
>> | > >>
>> | > >> left.
>> | > >>
>> | > >> >>>>> Sounds weird, but I do lots of javascript manipulations to
>> | > >> >>>>> nested lists
>> | > >> >>>>> in
>> | > >> >>>>> the left
>> | > >> >>>>> sidebar (building up a tree control). This takes some time
>> | > >> >>>>> during which
>> | > >> >>>>> IE
>> | > >> >>>>> stops rendering the rest of the page (regardless wether I
>> start
>> | > >>
>> | > >> this
>> | > >>
>> | > >> >>>>> window.onload or earlier). To enable the user to look at
>> the
>> | >
>> | > topic
>> | >
>> | > >> >>>>> content
>> | > >> >>>>> while the tree is generated, I placed the lists in the
>> | >
>> | > RightBorder
>> | >
>> | > >> >>>>> which
>> | > >> >>>>> comes after TopicBody in the pages' html. Long story, but
>> in
>> | >
>> | > short
>> | >
>> | > >> it
>> | > >>
>> | > >> >>>>> messes up my admin pages.
>> | > >> >>>>>
>> | > >> >>>>>> You can apply a specific stylesheet (in addition to any
>> | >
>> | > overrides
>> | >
>> | > >> or
>> | > >>
>> | > >> >>>>>> alternates) to a topic by using the Stylesheet page
>> property.
>> | > >> >>>>>> However,
>> | > >> >>>>>> there
>> | > >> >>>>>> doesn't seem to be a way to apply a stylesheet across a
>> | > >>
>> | > >> namespace,
>> | > >>
>> | > >> >>>>>> although
>> | > >> >>>>>> it shouldn't be too onerous to use the Stylesheet page
>> property
>> | > >>
>> | > >> from
>> | > >>
>> | > >> >>>>>> the
>> | > >> >>>>>> _ContentBaseDefinition topic for the namespace if you want
>> to
>> | > >>
>> | > >> raise
>> | > >> a
>> | > >>
>> | > >> >>>>>> feature request on the bug tracker [1]
>> | > >> >>>>>
>> | > >> >>>>> How do I use this Stylesheet page property? I wrote
>> | > >> >>>>>
>> | > >> >>>>> Stylesheet: MyStylesheet
>> | > >> >>>>>
>> | > >> >>>>> to a page, but it doesn't have any effect.
>> | > >> >>>>>
>> | > >> >>>>>> --------------------------------------------------
>> | > >> >>>>>> From: <[EMAIL PROTECTED]>
>> | > >> >>>>>> Sent: Wednesday, January 23, 2008 2:16 PM
>> | > >> >>>>>> To: <flexwiki-users@lists.sourceforge.net>
>> | > >> >>>>>> Subject: [Flexwiki-users] Separate stylesheets for admin
>> and
>> | > >>
>> | > >> content?
>> | > >>
>> | > >> >>>>>>> Hi all,
>> | > >> >>>>>>>
>> | > >> >>>>>>> for my project, I've highly customised stylesheets for a
>> | > >>
>> | > >> namespace.
>> | > >>
>> | > >> >>>>>>> If
>> | > >> >>>>>>> I
>> | > >> >>>>>>> include it using OverrideStylesheet in flexwiki.config,
>> it
>> | > >> >>>>>>> gets applied
>> | > >> >>>>>>> to
>> | > >> >>>>>>> all pages, including the admin section. Unfortunately, my
>> | > >> >>>>>>> customisations
>> | > >> >>>>>>> mess up the latter considerably so I'm looking for a
>> | >
>> | > possibility
>> | >
>> | > >> to
>> | > >>
>> | > >> >>>>>>> specify separate stylesheets for single namespaces and
>> for
>> the
>> | > >>
>> | > >> admin
>> | > >>
>> | > >> >>>>>>> pages.
>> | > >> >>>>>>>
>> | > >> >>>>>>> I can define my stylesheet as an alternate stylesheet in
>> | > >> >>>>>>> flexwiki.config,
>> | > >> >>>>>>> but this way the user would have to select my stylesheet
>> in
>> | > >> >>>>>>> the
>> | > >>
>> | > >> drop
>> | > >>
>> | > >> >>>>>>> down
>> | > >> >>>>>>> box, which is not an option for me.
>> | > >> >>>>>>>
>> | > >> >>>>>>> How can I specify a default stylesheet for a namespace
>> and
>> a
>> | > >> >>>>>>> separate
>> | > >> >>>>>>> on
>> | > >> >>>>>>> for the admin section?
>> | > >> >>>>>>>
>> | > >> >>>>>>> There is a admin.css in the admin directory, but it
>> doesn't
>> | >
>> | > seem
>> | >
>> | > >> to
>> | > >>
>> | > >> >>>>>>> be
>> | > >> >>>>>>> used anywhere... The admin pages just include wiki.css...
>> | >
>> | > What's
>> | >
>> | > >> the
>> | > >>
>> | > >> >>>>>>> purpose of this  admin.css?
>> | > >> >>>>>>>
>> | > >> >>>>>>> Additional question: Is it possible to specify
>> stylesheets
>> per
>> | > >> >>>>>>> namespace?
>> | > >> >>>>>>> Different namespace, different stylesheet?
>> | > >> >>>>>>>
>> | > >> >>>>>>> Cheers,
>> | > >> >>>>>>>
>> | > >> >>>>>>> Benno.
>> | >
>> | >
>> -------------------------------------------------------------------------
>> | >
>>
>> -------------------------------------------------------------------------
>> This SF.net email is sponsored by: Microsoft
>> Defy all challenges. Microsoft(R) Visual Studio 2008.
>> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
>> _______________________________________________
>> Flexwiki-users mailing list
>> Flexwiki-users@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/flexwiki-users
>>
>



-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Flexwiki-users mailing list
Flexwiki-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/flexwiki-users

Reply via email to