Script problems

6 views
Skip to first unread message

whatever

unread,
Sep 29, 2010, 5:50:45 AM9/29/10
to ccTiddly
Hi!
In my TiddlyWiki I have the following script:
<script>
story.closeAllTiddlers();
story.displayTiddler(null,config.options.txtUserName+'\'s
Dashboard'); //display the user's dashboard
if(!store.tiddlerExists(config.options.txtUserName+'\'s Dashboard')) //
if dashboard doesn't exist
story.displayTiddler(null,'404'); //display tiddler 404
window.showBackstage = window.simpleRoles.contains('Admin')
</script>

It's located in DefaultDashboard tiddler and tagged systemConfig. It's
also the only tiddler in DefaultTiddlers. Its purpose is to restrict
access to users who aren't in the Admin group. I use Tobi Beer's
SimpleRolesPlugin (http://tobibeer.tiddlyspace.com/#SimpleRolesPlugin)
to assign roles. The above script works beautifully in TiddlyWiki, but
when I tried it on ccTiddly, I get Error: Syntax error.

Any ideas?
w

Kashgarinn

unread,
Sep 29, 2010, 6:31:44 AM9/29/10
to ccTiddly
I'd check if any javascript is working, try adding an alert(); box to
see if javascript is running at all.

S.

whatever

unread,
Sep 29, 2010, 6:42:27 AM9/29/10
to ccTiddly
Javascript is running. I have another workspace setup and it's working
fine. I even tried the alert(); box and it worked.
w

Kashgarinn

unread,
Sep 30, 2010, 7:30:19 PM9/30/10
to ccTiddly
Then it's just a matter of fiddling with the functions, test other
tiddler names you know are loaded into the wiki. If that works, then
you're getting somewhere.

S.

whatever

unread,
Nov 3, 2010, 4:10:27 PM11/3/10
to ccTiddly
Hi!
I modified the script somewhat:
<script>
story.closeAllTiddlers();
if(store.tiddlerExists(config.options.txtUserName+'\'s Dashboard'))
{story.displayTiddler(null,config.options.txtUserName+'\'s
Dashboard');}
else
{story.displayTiddler(null,'404');}
window.showBackstage = window.simpleRoles.contains('Admin');
</script>

It works as it's supposed to. It is located in the DefaultDashboard
tiddler and used to be invoked at the very end of PageTemplate with
<div refresh='content' tiddler='DefaultDashboard'></div>
The only problem was that when I logged out, the tiddler shown was the
last user's dashboard instead of the tiddler in the DefaultTiddlers or
the AnonDefaultTiddlers. I fixed that problem by moving the script
from the PageTemplate to the DefaultTiddlers. It works perfectly
now. :D
w

w
Reply all
Reply to author
Forward
0 new messages