Skip to content

Commit

Permalink
Add user_prefs for accessibility
Browse files Browse the repository at this point in the history
Squashed commit of the following:

commit c985fb2
Author: drlippman <drlippman@yahoo.com>
Date:   Thu Apr 20 18:08:48 2017 -0700

    Remove old code

commit 92f2b90
Merge: 045112f 74ec75c
Author: drlippman <drlippman@yahoo.com>
Date:   Thu Apr 20 18:06:23 2017 -0700

    Merge branch 'master' into feature.user_prefs

    Conflicts:
    	forms.php
    	header.php

commit 045112f
Author: drlippman <drlippman@yahoo.com>
Date:   Tue Apr 18 19:10:28 2017 -0700

    Update help with user prefs
    Put timezone user pref last

commit 169244b
Author: drlippman <drlippman@yahoo.com>
Date:   Mon Apr 3 20:57:15 2017 -0700

    Rename migration number

commit df84aa0
Author: drlippman <drlippman@yahoo.com>
Date:   Mon Apr 3 18:54:45 2017 -0700

    Adjust loginpage example to remove a11y settings

commit 4e10007
Author: drlippman <drlippman@yahoo.com>
Date:   Mon Apr 3 18:54:07 2017 -0700

    Adjust LTI launch to use userprefs
    Remove accessibility options from LTI launch page
    Auto-submit tzname detection page if no assess timelimit

commit 4d67d6f
Author: drlippman <drlippman@yahoo.com>
Date:   Mon Apr 3 18:53:15 2017 -0700

    Move user preference loading into include file
    Remove old accessibility handling code

commit 612bca0
Author: drlippman <drlippman@yahoo.com>
Date:   Mon Apr 3 18:51:34 2017 -0700

    Bug fix top vs parent reference in GB_hide

commit 837572f
Author: David Lippman <drlippman@yahoo.com>
Date:   Sat Mar 25 02:31:20 2017 -0700

    Add warning when login tz doesn't match active tz

commit aaa9709
Author: drlippman <drlippman@yahoo.com>
Date:   Tue Mar 21 09:14:06 2017 -0700

    Delete user_prefs on user delete

commit 2fb45cf
Author: drlippman <drlippman@yahoo.com>
Date:   Sat Mar 18 11:17:32 2017 -0700

    Add LTI page for editing userprefs
    Add links from lti views

commit 0e897f9
Author: drlippman <drlippman@yahoo.com>
Date:   Sat Mar 18 10:07:10 2017 -0700

    Update branch to use new migrations approach

commit aa13cd1
Merge: 682bd2b 7146d1e
Author: drlippman <drlippman@yahoo.com>
Date:   Sat Mar 18 09:53:40 2017 -0700

    Merge branch 'master' into feature.user_prefs

    Conflicts:
    	assessment/showtest.php
    	upgrade.php
    	validate.php

commit 682bd2b
Author: drlippman <drlippman@yahoo.com>
Date:   Tue Mar 14 17:08:25 2017 -0700

    Move userpref handling to an include file

commit cd325f7
Author: drlippman <drlippman@yahoo.com>
Date:   Mon Mar 13 21:17:01 2017 -0700

    Implement new userprefs

commit 345136b
Merge: 03b0378 8b5ed89
Author: drlippman <drlippman@yahoo.com>
Date:   Mon Mar 13 19:33:06 2017 -0700

    Merge branch 'feature.user_prefs' of github.com:drlippman/IMathAS into feature.user_prefs

commit 03b0378
Merge: b7a7df4 0b2fa71
Author: drlippman <drlippman@yahoo.com>
Date:   Mon Mar 13 19:30:44 2017 -0700

    Merge branch 'master' of github.com:drlippman/IMathAS into feature.user_prefs

commit 8b5ed89
Author: David Lippman <drlippman@yahoo.com>
Date:   Mon Mar 13 19:25:37 2017 -0700

    Work on forms for user prefs

commit b7a7df4
Author: drlippman <drlippman@yahoo.com>
Date:   Sat Mar 11 22:22:41 2017 -0800

    Initial work on user a11y and display prefs
  • Loading branch information
drlippman committed Apr 21, 2017
1 parent 74ec75c commit ff4c504
Show file tree
Hide file tree
Showing 16 changed files with 654 additions and 289 deletions.
9 changes: 7 additions & 2 deletions actions.php
Original file line number Diff line number Diff line change
Expand Up @@ -780,6 +780,11 @@
}
}

require("includes/userprefs.php");
storeUserPrefs();


/* moved above
if (isset($_POST['settimezone'])) {
if (date_default_timezone_set($_POST['settimezone'])) {
$tzname = $_POST['settimezone'];
Expand All @@ -788,7 +793,7 @@
$stm = $DBH->prepare("UPDATE imas_sessions SET tzname=:tzname WHERE sessionid=:sessionid");
$stm->execute(array(':tzname'=>$tzname, ':sessionid'=>$sessionid));
}
}
}*/
} else if ($_GET['action']=="forumwidgetsettings") {
$checked = $_POST['checked'];
$all = explode(',',$_POST['allcourses']);
Expand All @@ -810,7 +815,7 @@
}
}
if ($isgb) {
echo '<html><body>Changes Recorded. <input type="button" onclick="top.GB_hide()" value="Done" /></body></html>';
echo '<html><body>Changes Recorded. <input type="button" onclick="parent.GB_hide()" value="Done" /></body></html>';
} else {
header('Location: ' . $urlmode . $_SERVER['HTTP_HOST'] . rtrim(dirname($_SERVER['PHP_SELF']), '/\\') . "/index.php");
}
Expand Down
4 changes: 4 additions & 0 deletions admin/actions.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,14 @@
$stm->execute(array(':id'=>$_GET['id']));
}
if ($stm->rowCount()==0) { break;}
$stm = $DBH->prepare("DELETE FROM imas_user_prefs WHERE userid=:userid");
$stm->execute(array(':userid'=>$_GET['id']));
$stm = $DBH->prepare("DELETE FROM imas_students WHERE userid=:userid");
$stm->execute(array(':userid'=>$_GET['id']));
$stm = $DBH->prepare("DELETE FROM imas_teachers WHERE userid=:userid");
$stm->execute(array(':userid'=>$_GET['id']));
$stm = $DBH->prepare("DELETE FROM imas_tutors WHERE userid=:userid");
$stm->execute(array(':userid'=>$_GET['id']));
$stm = $DBH->prepare("DELETE FROM imas_assessment_sessions WHERE userid=:userid");
$stm->execute(array(':userid'=>$_GET['id']));
$stm = $DBH->prepare("DELETE FROM imas_exceptions WHERE userid=:userid");
Expand Down
33 changes: 33 additions & 0 deletions admin/ltiuserprefs.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?php
//IMathAS: User preference editing for LTI users

require('../validate.php');
require('../includes/userprefs.php');
$action = "ltiuserprefs.php?cid=$cid";
if (isset($_GET['greybox'])) {
$flexwidth = true;
$nologo = true;
$action .= "&greybox=true";
$greybox = true;
} else {
$greybox = false;
}
$placeinhead = "<script type=\"text/javascript\" src=\"$imasroot/javascript/jstz_min.js\" ></script>";
require('../header.php');

if (isset($_POST['mathdisp'])) {
storeUserPrefs();
echo '<p>'._('Preferences saved. Your new preferences will go into effect when you visit a new page or load the current page.').'</p>';
if ($greybox) {
echo '<input type="button" onclick="parent.GB_hide()" value="'._('Done').'" />';
}
} else {
echo '<div id="headerforms" class="pagetitle"><h2>'._('User Preferences').'</h2></div>';
echo "<form enctype=\"multipart/form-data\" method=post action=\"$action\">\n";
showUserPrefsForm();
echo "<div class=submit><input type=submit value='Update Info'></div>\n";
echo "</form>\n";
}

require('../footer.php');
?>
24 changes: 17 additions & 7 deletions assessment/displayq2.php
Original file line number Diff line number Diff line change
Expand Up @@ -1504,7 +1504,7 @@ function makeanswerbox($anstype, $qn, $la, $options,$multi,$colorbox='') {
} else if ($useeqnhelper) {
$out .= "onfocus=\"showeedd('tc$qn',$useeqnhelper)\" onblur=\"hideee();hideeedd();\" ";
}
if (!isset($hidepreview)) {
if (!isset($hidepreview) && $GLOBALS['sessiondata']['userprefs']['livepreview']==1) {
$out .= 'onKeyUp="updateLivePreview(this)" ';
}
$out .= "/>$rightb";
Expand Down Expand Up @@ -1697,7 +1697,7 @@ function makeanswerbox($anstype, $qn, $la, $options,$multi,$colorbox='') {
} else if ($useeqnhelper) {
$out .= "onfocus=\"showeedd('tc$qn',$useeqnhelper)\" onblur=\"hideee();hideeedd();\" ";
}
if (!isset($hidepreview)) {
if (!isset($hidepreview) && $GLOBALS['sessiondata']['userprefs']['livepreview']==1) {
$out .= 'onKeyUp="updateLivePreview(this)" ';
}
$out .= "/>\n";
Expand Down Expand Up @@ -1925,7 +1925,7 @@ function makeanswerbox($anstype, $qn, $la, $options,$multi,$colorbox='') {
} else if ($useeqnhelper) {
$out .= "onfocus=\"showeedd('tc$qn',$useeqnhelper)\" onblur=\"hideee();hideeedd();\" ";
}
if (!isset($hidepreview)) {
if (!isset($hidepreview) && $GLOBALS['sessiondata']['userprefs']['livepreview']==1) {
$out .= 'onKeyUp="updateLivePreview(this)" ';
}
$out .= "/>";
Expand Down Expand Up @@ -2025,7 +2025,7 @@ function makeanswerbox($anstype, $qn, $la, $options,$multi,$colorbox='') {
} else if ($useeqnhelper) {
$out .= "onfocus=\"showeedd('tc$qn',$useeqnhelper)\" onblur=\"hideee();hideeedd();\" ";
}
if (!isset($hidepreview)) {
if (!isset($hidepreview) && $GLOBALS['sessiondata']['userprefs']['livepreview']==1) {
$out .= 'onKeyUp="updateLivePreview(this)" ';
}
$out .= "/>";
Expand Down Expand Up @@ -2128,7 +2128,7 @@ function makeanswerbox($anstype, $qn, $la, $options,$multi,$colorbox='') {
} else if ($useeqnhelper && $displayformat == 'usepreview') {
$out .= "onfocus=\"showeedd('qn$qn',$useeqnhelper)\" onblur=\"hideee();hideeedd();\" ";
}
if ($displayformat == 'usepreview') {
if ($displayformat == 'usepreview' && $GLOBALS['sessiondata']['userprefs']['livepreview']==1) {
$out .= 'onKeyUp="updateLivePreview(this)" ';
}
$addlclass = '';
Expand Down Expand Up @@ -2429,7 +2429,7 @@ function makeanswerbox($anstype, $qn, $la, $options,$multi,$colorbox='') {
} else if ($useeqnhelper) {
$out .= "onfocus=\"showeedd('tc$qn',$useeqnhelper,". (in_array('inequality',$ansformats)?"'ineq'":"'int'") .")\" onblur=\"hideee();hideeedd();\" ";
}
if (!isset($hidepreview)) {
if (!isset($hidepreview) && $GLOBALS['sessiondata']['userprefs']['livepreview']==1) {
$out .= 'onKeyUp="updateLivePreview(this)" ';
}
$out .= '/>';
Expand Down Expand Up @@ -2611,6 +2611,13 @@ function makeanswerbox($anstype, $qn, $la, $options,$multi,$colorbox='') {
$settings[7] = $newheight;
}
}
if ($GLOBALS['sessiondata']['userprefs']['drawentry']==1 && $GLOBALS['sessiondata']['graphdisp']==0) {
//can't imagine why someone would pick this, but if they do, need to set graphdisp to 2 temporarily
$revertgraphdisp = true;
$GLOBALS['sessiondata']['graphdisp']=2;
} else {
$revertgraphdisp = false;
}
if (!is_array($backg) && substr($backg,0,5)=="draw:") {
$plot = showplot("",$origxmin,$settings[1],$origymin,$settings[3],$sclinglbl,$sclinggrid,$settings[6],$settings[7]);
$insat = strpos($plot,');',strpos($plot,'axes'))+2;
Expand Down Expand Up @@ -2641,7 +2648,7 @@ function makeanswerbox($anstype, $qn, $la, $options,$multi,$colorbox='') {
if (isset($GLOBALS['hidedrawcontrols'])) {
$out .= $plot;
} else {
if ($GLOBALS['sessiondata']['graphdisp']==0) { //accessible entry
if ($GLOBALS['sessiondata']['userprefs']['drawentry']==0) { //accessible entry
$bg = 'a11ydraw:'.implode(',', $answerformat);
$out .= '<p>'._('Graph to add drawings to:').'</p>';
$out .= '<p>'.$plot.'</p>';
Expand Down Expand Up @@ -2841,6 +2848,9 @@ function makeanswerbox($anstype, $qn, $la, $options,$multi,$colorbox='') {

$out .= "drawla[$qn] = $la;</script>";
}
if ($revertgraphdisp) {
$GLOBALS['sessiondata']['graphdisp']=0;
}
$tip = _('Enter your answer by drawing on the graph.');
if (isset($answers)) {
$saarr = array();
Expand Down
2 changes: 2 additions & 0 deletions assessment/mathtest.css
Original file line number Diff line number Diff line change
Expand Up @@ -559,6 +559,8 @@ input[type=submit]:hover, button:hover,input[type=button]:hover {
#GB_window {
top: 10px;
left: 0px;
right: 0px;
margin: 0 auto;
position: fixed;
background: #fff;
border: 3px solid #369;
Expand Down
22 changes: 20 additions & 2 deletions assessment/showtest.php
Original file line number Diff line number Diff line change
Expand Up @@ -370,6 +370,9 @@
if (!isset($coursetheme)) { //should already be set from validate.php
$coursetheme = $courseinfo['theme'];
}
if (isset($sessiondata['userprefs']['usertheme']) && strcmp($sessiondata['userprefs']['usertheme'],'0')!=0) {
$coursetheme = $sessiondata['userprefs']['usertheme'];
}
$sessiondata['coursetheme'] = $coursetheme;

$sessiondata['coursetoolset'] = $courseinfo['toolset'];
Expand Down Expand Up @@ -1125,7 +1128,17 @@
echo "&gt; ", _('View as student'), "</div>";
} else {
echo "<div class=breadcrumb>";
echo "<span style=\"float:right;\" class=\"hideinmobile\">$userfullname</span>";
//echo "<span style=\"float:right;\" class=\"hideinmobile\">$userfullname</span>";
echo '<span class="floatright hideinmobile">';
if ($userfullname != ' ') {
echo "<a href=\"#\" onclick=\"GB_show('"._('User Preferences')."','$imasroot/admin/ltiuserprefs.php?cid=$cid&greybox=true',800,'auto');return false;\" title=\""._('User Preferences')."\" aria-label=\""._('Edit User Preferences')."\">";
echo "<span id=\"myname\">$userfullname</span> ";
echo "<img style=\"vertical-align:top\" src=\"$imasroot/img/gears.png\" alt=\"\"/></a>";
} else {
echo "<a href=\"#\" onclick=\"GB_show('"._('User Preferences')."','$imasroot/admin/ltiuserprefs.php?cid=$cid&greybox=true',800,'auto');return false;\">";
echo "<span id=\"myname\">".('User Preferences')."</span>";
}
echo '</span>';
if (isset($sessiondata['ltiitemtype']) && $sessiondata['ltiitemtype']==0) {
echo "$breadcrumbbase ", _('Assessment'), "</div>";
} else {
Expand All @@ -1137,7 +1150,12 @@
} else if ($isltilimited) {
echo '<div class="floatright">';
if ($userfullname != ' ') {
echo '<p><b>'.$userfullname.'</b></p>';
echo "<p><a href=\"#\" onclick=\"GB_show('"._('User Preferences')."','$imasroot/admin/ltiuserprefs.php?cid=$cid&greybox=true',800,'auto');return false;\" title=\""._('User Preferences')."\" aria-label=\""._('Edit User Preferences')."\">";
echo "<span id=\"myname\">$userfullname</span> ";
echo "<img style=\"vertical-align:top\" src=\"$imasroot/img/gears.png\" alt=\"\"/></a></p>";
} else {
echo "<p><a href=\"#\" onclick=\"GB_show('"._('User Preferences')."','$imasroot/admin/ltiuserprefs.php?cid=$cid&greybox=true',800,'auto');return false;\">";
echo "<span id=\"myname\">".('User Preferences')."</span></p>";
}
$out = '';
if ($testsettings['msgtoinstr']==1) {
Expand Down
Loading

0 comments on commit ff4c504

Please sign in to comment.