On May 8, 6:18 am, Julie <radac...@gmail.com> wrote:
> I've been working with this code, which hides the "edit" button in IE fine:
>
> <script> if (!readOnly) return "<<slider chkSliderOptionsPanel OptionsPanel
> [[options »]] [[Change TiddlyWiki advanced options]]>>"; </script>
>
> But now, I see in Firefox and in Chrome, I have that edit button, but I do
> not want people to be able to make changes on any browser, so how do I make
> the TiddlyWiki read only in all browsers?

Normally, the "readOnly" flag is automatically set during startup
whenever a TW document is viewed via http: protocol.  This automatic
handling can be overridden by setting the <<option chkHttpReadOnly>>
checkbox to false, so that the document will be editable, even over
http.

You want to do the opposite... you want to ensure that the document is
NOT editable, regardless of how (or by whome) it is being viewed.
Unlike the normal use-case above, there is no <<option chkSomething>>
you can set to do this.  Instead, you need to force the TWCore's
internal global 'readOnly' flag to be set to true by creating a
tiddler (e.g. [[SetReadOnly]]), tagged with systemConfig, containing
this line:

   window.readOnly=true;

When you save-and-reload the document, the [[SetReadOnly]] tiddler
will be invoked (because of the systemConfig tag) and the readOnly
flag will be set.  However, this makes the document completely non-
editable for *everyone*, even *you*!  To work around this, you can
enhance the above line of code like this:

   window.readOnly==(config.options.txtUserName!="MyName");

replacing "MyName" with *your* TW username (the one you set via
<<option txtUserName>> in the sidebar options panel).  Instead of
always setting the readOnly flag to true for everyone, the above code
will set the readOnly flag *false* if the current username matches,
and *true* for everyone else.

enjoy,
-e
Eric Shulman
TiddlyTools / ELS Design Studios

----
WAS THIS ANSWER HELPFUL?  IF SO, PLEASE MAKE A DONATION
   http://www.TiddlyTools.com/#Donations
note: donations are directly used to pay for food, rent,
gas, net connection, etc., so please give generously and often!

Professional TiddlyWiki Consulting Services...
Analysis, Design, and Custom Solutions:
   http://www.TiddlyTools.com/#Contact

-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWiki" group.
To post to this group, send email to tiddlywiki@googlegroups.com.
To unsubscribe from this group, send email to 
tiddlywiki+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/tiddlywiki?hl=en.

Reply via email to