Problems with boolean javascript variable setted from smarty templat variables

82 views
Skip to first unread message

Francisco Mancardi

unread,
Mar 13, 2010, 4:36:00 AM3/13/10
to testlink-dev
// BUGID 0003275 + post on forum: //
http://www.teamst.org/phpBB2/viewtopic.php?t=3075
// seems that with config options that will be used on javascript via
smarty template variables
// we are having problems using FALSE/TRUE => use 0/1 (or our CONSTANT
DISABLED/ENABLED)

if some one out there has a better solution please let me know

regards

Erik Eloff

unread,
Mar 13, 2010, 11:57:56 AM3/13/10
to testli...@googlegroups.com
It depends on how they are used.
checkNotSaved = true/false is NOT an issue in 1.9
Becuase it is used like in code below The variable itself is NOT
written out in javascript. This is a good solution cause uneeded
javascript won't be sent to the client at all.
However if the config value is needed in js-code it should be sortof
escaped to text. There is probably something in smarty that could do
this (or just add a function booleanToJavascript() )

{if $tlCfg->gui->checkNotSaved}
<script type="text/javascript">
var unload_msg = "{$labels.warning_unsaved}";
var tc_editor = "{$tlCfg->gui->text_editor.all.type}";
</script>
<script src="gui/javascript/checkmodified.js" type="text/javascript"></script>
{/if}

Regards,
Eloff

Francisco Mancardi

unread,
Mar 15, 2010, 3:59:49 AM3/15/10
to testli...@googlegroups.com
The simpler solution is use 1/0 => think is the right road to follow. instead of stick with true or false,
that give NO advantage
Reply all
Reply to author
Forward
0 new messages