Skip to content
Snippets Groups Projects
Commit 6ef150da authored by Brett Bieber's avatar Brett Bieber
Browse files

Add viewport column to voter table, add setViewPort function in javascript.

parent 1246b63e
Branches
Tags
No related merge requests found
......@@ -17,6 +17,7 @@ class DesignSurvey_Voter extends DB_DataObject
var $ip; // string(15) not_null
var $step; // int(10) unsigned
var $prototype_order; // blob(16777215) blob
var $viewport; // string(50)
var $submitdatetime; // datetime(19)
/* ZE2 compatibility trick*/
......
......@@ -212,6 +212,7 @@ CREATE TABLE IF NOT EXISTS `voter` (
`ip` varchar(15) NOT NULL default '',
`step` int(10) unsigned default NULL,
`prototype_order` mediumtext,
`viewport` varchar(50) default NULL,
`submitdatetime` datetime default NULL,
PRIMARY KEY (`id`),
KEY `ip` (`ip`)
......
......@@ -210,4 +210,26 @@ function setQuestionRating(qid,value)
input = document.getElementById('rq_'+qid);
input.value = value;
}
function setViewPort()
{
var viewportwidth;
var viewportheight;
if (typeof window.innerWidth != 'undefined') {
// the more standards compliant browsers (mozilla/netscape/opera/IE7) use window.innerWidth and window.innerHeight
viewportwidth = window.innerWidth,
viewportheight = window.innerHeight
} else if (typeof document.documentElement != 'undefined'
&& typeof document.documentElement.clientWidth != 'undefined'
&& document.documentElement.clientWidth != 0) {
// IE6 in standards compliant mode (i.e. with a valid doctype as the first line in the document)
viewportwidth = document.documentElement.clientWidth,
viewportheight = document.documentElement.clientHeight
} else {
// older versions of IE
viewportwidth = document.getElementsByTagName('body')[0].clientWidth,
viewportheight = document.getElementsByTagName('body')[0].clientHeight
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment