Skip to content

Commit

Permalink
fix 03736: removed excess <form> open tags from user template rights …
Browse files Browse the repository at this point in the history
…form in admin/userrighthandling.php

Updated output table to have an ID (for CSS purposes) <thead> and <tbody>
Added alternate row background colour to help see which row is which and highlighing of row mouse is hovering over via CSS in admin/styles/default/adminstyle.css


git-svn-id: file:///Users/Shitiz/Downloads/lssvn/source/limesurvey_dev@7731 b72ed6b6-b9f8-46b5-92b4-906544132732
  • Loading branch information
Evan Wills committed Oct 7, 2009
1 parent 957bb7a commit f917a53
Show file tree
Hide file tree
Showing 2 changed files with 83 additions and 41 deletions.
28 changes: 27 additions & 1 deletion admin/styles/default/adminstyle.css
Expand Up @@ -227,6 +227,32 @@ table.form2columns td:first-child {
table.form2columns td.centered {
text-align: center;
}
/* Added by evan to help usability on the user template rights form in useradmin/userrighthandling.php */
table#user-template-rights
{
width: 50%;
border: none;
border-collapse: collapse
}
table#user-template-rights tr.row_odd
{
background-color: #EBF2FA;
}
table#user-template-rights tr:hover
{
background-color: #D1D1DF;
}
table#user-template-rights tr td
,table#user-template-rights tr th
,table#user-template-rights tfoot tr td
{
border: none;
text-align: center;
}
table#user-template-rights tbody tr td:first-child
{
text-align: left;
}

.outlinetable {
border: 1px solid #111;
Expand Down Expand Up @@ -904,4 +930,4 @@ div.loader {
#help
{
float:right;
}
}
96 changes: 56 additions & 40 deletions admin/userrighthandling.php
Expand Up @@ -114,46 +114,62 @@

if ($action == "setusertemplates")
{
refreshtemplates();
$usersummary = "<table width='50%' border='0'>\n<tr><td colspan='2' bgcolor='black' align='center'><form method='post' action='$scriptname'>\n"
. "<strong><font color='white'>".$clang->gT("Set templates that this user may access").": ".$_POST['user']."</td></tr>\n";

$userlist = getuserlist();
foreach ($userlist as $usr)
{
if ($usr['uid'] == $postuserid)
{
$templaterights = array();
$squery = 'SELECT '.db_quote_id('folder').','.db_quote_id('use')." FROM {$dbprefix}templates_rights WHERE uid={$usr['uid']}";
$sresult = db_execute_assoc($squery) or safe_die($connect->ErrorMsg());//Checked
while ($srow = $sresult->FetchRow()) {
$templaterights[$srow["folder"]] = array("use"=>$srow["use"]);
}

$usersummary .= "<tr><th>".$clang->gT("Template Name")."</th><th>".$clang->gT("Allowed")."</th></tr>\n"
."<tr><form method='post' action='$scriptname'></tr>"
."<form action='$scriptname' method='post'>\n";

$tquery = "SELECT * FROM ".$dbprefix."templates";
$tresult = db_execute_assoc($tquery) or safe_die($connect->ErrorMsg()); //Checked
while ($trow = $tresult->FetchRow()) {
$usersummary .= "<tr><td>{$trow["folder"]}</td>";

$usersummary .= "<td align='center'><input type=\"checkbox\" class=\"checkboxbtn\" name=\"{$trow["folder"]}_use\" value=\"{$trow["folder"]}_use\"";
if(isset($templaterights[$trow["folder"]]) && $templaterights[$trow["folder"]]["use"] == 1) {
$usersummary .= " checked='checked' ";
}
$usersummary .=" /></td>\n</tr>\n";
}

$usersummary .= "<tr><form method='post' action='$scriptname'></tr>" // added by Dennis
."\n<tr><td colspan='3' align='center'>"
."<input type='submit' value='".$clang->gT("Save Settings")."' />"
."<input type='hidden' name='action' value='usertemplates' />"
."<input type='hidden' name='uid' value='{$postuserid}' /></td></tr>"
."</form>"
. "</table>\n";
continue;
refreshtemplates();
$usersummary = "\n<form action='$scriptname' method='post'>\n\t<table id=\"user-template-rights\" width='50%' border='0'>\n\t\t<thead>\n\t\t\t<tr>\n\t\t\t<th colspan=\"2\" style=\"background-color:#000; color:#fff;\">\n"
. $clang->gT('Set templates that this user may access').': '.$_POST['user']."</th>\n\t\t\t</tr>\n";

$userlist = getuserlist();
foreach ($userlist as $usr)
{
if ($usr['uid'] == $postuserid)
{
$templaterights = array();
$squery = 'SELECT '.db_quote_id('folder').','.db_quote_id('use')." FROM {$dbprefix}templates_rights WHERE uid={$usr['uid']}";
$sresult = db_execute_assoc($squery) or safe_die($connect->ErrorMsg());//Checked
while ($srow = $sresult->FetchRow())
{
$templaterights[$srow["folder"]] = array("use"=>$srow["use"]);
}

$usersummary .= "\t\t\t<tr>\n\t\t\t\t<th>"
.$clang->gT('Template Name')
."</th>\n\t\t\t\t<th>"
.$clang->gT('Allowed')
."</th>\n\t\t\t</tr>\n"
."\t</thead>\n\n<tbody>\n";

$tquery = "SELECT * FROM ".$dbprefix."templates";
$tresult = db_execute_assoc($tquery) or safe_die($connect->ErrorMsg()); //Checked
$table_row_odd_even = 'odd';
while ($trow = $tresult->FetchRow())
{
if($table_row_odd_even == 'odd' )
{
$row_class = ' class="row_odd"';
$table_row_odd_even = 'even';
}
else
{
$row_class = ' class="row_even"';
$table_row_odd_even = 'odd';
};
$usersummary .= "\t\t\t<tr$row_class>\n\t\t\t\t<td>{$trow["folder"]}</td>\n";

$usersummary .= "\t\t\t\t<td><input type=\"checkbox\" class=\"checkboxbtn\" name=\"{$trow["folder"]}_use\" value=\"{$trow["folder"]}_use\"";
if(isset($templaterights[$trow["folder"]]) && $templaterights[$trow["folder"]]["use"] == 1)
{
$usersummary .= ' checked="checked"';
}
$usersummary .=" /></td>\n\t\t\t</tr>\n";
}

$usersummary .= "\n\t\t</tbody>\n\n\t\t<tfoot>\n\t\t\t<tr>\t\t\t\t<td colspan='3' align='center'>\n"
."\t\t\t\t\t<input type=\"submit\" value=\"".$clang->gT('Save Settings')."\" />\n"
."\t\t\t\t\t<input type=\"hidden\" name=\"action\" value=\"usertemplates\" />\n"
."\t\t\t\t\t<input type=\"hidden\" name=\"uid\" value=\"{$postuserid}\" />\n\t\t\t\t</td>\n\t\t\t</tr>\n\t\t</tfoot>\n"
."\t</table>\n"
."</form>\n";
continue;
}
}
}
Expand Down

0 comments on commit f917a53

Please sign in to comment.