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').&quot; FROM {$dbprefix}templates_rights WHERE uid={$usr['uid']}&quot;;
                          $sresult = db_execute_assoc($squery) or safe_die($connect->ErrorMsg());//Checked
                          while ($srow = $sresult->FetchRow()) {
                                  $templaterights[$srow[&quot;folder&quot;]] = array(&quot;use&quot;=>$srow[&quot;use&quot;]);
                          }

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

                          $tquery = &quot;SELECT * FROM &quot;.$dbprefix.&quot;templates&quot;;
                          $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=&quot;row_odd&quot;';
                                            $table_row_odd_even = 'even';
                                    }
                                    else
                                    {
                                            $row_class = ' class=&quot;row_even&quot;';
                                            $table_row_odd_even = 'odd';
                                    };

                                  $usersummary .= &quot;\t\t\t&lt;tr$row_class>\n\t\t\t\t&lt;td>{$trow[&quot;folder&quot;]}&lt;/td>\n&quot;;

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

                          $usersummary .= &quot;\n\t\t&lt;/tbody>\n\n\t\t&lt;tfoot>\n\t\t\t&lt;tr>\t\t\t\t&lt;td colspan='3' align='center'>\n&quot;
                          .&quot;\t\t\t\t\t&lt;input type='submit' value='&quot;.$clang->gT(&quot;Save Settings&quot;).&quot;' />\n&quot;
                          .&quot;\t\t\t\t\t&lt;input type='hidden' name='action' value='usertemplates' />\n&quot;
                          .&quot;\t\t\t\t\t&lt;input type='hidden' name='uid' value='{$postuserid}' />\n\t\t\t\t&lt;/td>\n\t\t\t&lt;/tr>\n\t\t&lt;/tfoot>\n&quot;
                          .&quot;\t&lt;/table>\n&quot;
                          .&quot;&lt;/form>\n&quot;;
                          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