View Issue Details

This bug affects 1 person(s).
 4
IDProjectCategoryView StatusLast Update
03736Bug reportsSurvey editingpublic2009-11-13 16:40
ReporterEvan Assigned ToEvan  
PrioritylowSeveritytrivial 
Status closedResolutionfixed 
Product Version1.85+ 
Fixed in Version1.86 
Summary03736: too many form (<form> tags in "Set template rights" in LS admin and alternate row colouring
Description

This is a two part report: Bug and feature-

Bug:
When setting the user rights to various templates in the LS admin, there are 4 <form method='post' action='$scriptname'> tags. But only one of them is closed. Also it's bad practice to open a form tag within a table, (unless its with the same table cell).
Also the main table should have a <thead> and <tbody> tags. (content generated by: '/admin/userrighthandling.php')

Feature:
It would be good if the tbody rows had alternate background colours for odd and even rows. This would require the wrapping table to have an ID and odd and even rows to have a class applied. (content generated by: '/admin/userrighthandling.php'. CSS controlled by 'styles/default/adminstyle.css')

Additional Information

Code for '/admin/userrighthandling.php', from line 119;

if ($action == "setusertemplates")
{
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-co
lor:#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;
                 }
          }

}

CSS for 'styles/default/adminstyle.css' from line 195

table#user-template-rights
{
width: 50%;
border: none;
border-collapse: collapse
}
table#user-template-rights tr.row_odd
{
background-color: #D1D1DF;
}
table#user-template-rights tr:hover
{
background-color: #c2c2DF;
}
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;
}

TagsNo tags attached.
Bug heat4
Complete LimeSurvey version number (& build)7191
I will donate to the project if issue is resolved
BrowserAll
Database type & versionMySQL 5.0.45
Server OS (if known)CentOS
Webserver software & version (if known)Apache/2.2.3 (CentOS)
PHP Version5.1.6

Users monitoring this issue

There are no users monitoring this issue.

Activities

Evan

Evan

2009-10-01 03:26

reporter   ~09683

I (Evan/eric_t_cruiser) can commit these changes within the next few days

c_schmitz

c_schmitz

2009-10-01 23:50

administrator   ~09689

Please commit!

Evan

Evan

2009-10-07 16:25

reporter   ~09731

Removed extra <form> open tags from user template permission form in admin/userrighthandling.php.
Added ID to table, <thead> and <tbody> tags to improve accessibility and rendering
Added CSS to differentiate alternate rows by background colour and to highlight row when mouse is hovering over it in admin/styles/default/adminstyle.css

Issue History

Date Modified Username Field Change
2009-10-01 03:24 Evan New Issue
2009-10-01 03:24 Evan Status new => assigned
2009-10-01 03:24 Evan Assigned To => user372
2009-10-01 03:24 Evan LimeSurvey build number => 7191
2009-10-01 03:24 Evan Browser => All
2009-10-01 03:24 Evan Database & DB-Version => MySQL 5.0.45
2009-10-01 03:24 Evan Operating System (Server) => CentOS
2009-10-01 03:24 Evan Webserver => Apache/2.2.3 (CentOS)
2009-10-01 03:24 Evan PHP Version => 5.1.6
2009-10-01 03:25 Evan Additional Information Updated
2009-10-01 03:26 Evan Note Added: 09683
2009-10-01 03:26 Evan Assigned To user372 => Evan
2009-10-01 23:50 c_schmitz Note Added: 09689
2009-10-07 16:25 Evan Note Added: 09731
2009-10-07 16:25 Evan Status assigned => resolved
2009-10-07 16:25 Evan Fixed in Version => 1.86
2009-10-07 16:25 Evan Resolution open => fixed
2009-11-13 16:40 c_schmitz Status resolved => closed
2010-10-25 00:17 c_schmitz Category Survey Design => Survey design
2019-11-01 17:25 c_schmitz Category Survey design => Survey editing