4122: Changed calls to getcookie and setcookie to ATutor.getcookie and ATutor.setcook...
authorlaurel <laurel.williams@utoronto.ca>
Mon, 26 Apr 2010 20:05:56 +0000 (20:05 -0000)
committerlaurel <laurel.williams@utoronto.ca>
Mon, 26 Apr 2010 20:05:56 +0000 (20:05 -0000)
docs/themes/blumin/include/box.tmpl.php
docs/themes/blumin/include/header.tmpl.php
docs/themes/default/include/box.tmpl.php
docs/themes/default/include/header.tmpl.php
docs/themes/default15/include/footer.tmpl.php
docs/themes/default15/include/header.tmpl.php
docs/themes/default_classic/include/footer.tmpl.php
docs/themes/default_classic/include/header.tmpl.php
docs/themes/fluid/include/header.tmpl.php
docs/themes/greenmin/include/header.tmpl.php
docs/themes/mobile/include/header.tmpl.php

index c96f56b..cc24276 100644 (file)
@@ -15,7 +15,7 @@ $compact_title = str_replace(' ', '', $this->title);
 </div>
 
 <script language="javascript" type="text/javascript">
-if (getcookie("m_<?php echo $this->title; ?>") == "0")
+if (ATutor.getcookie("m_<?php echo $this->title; ?>") == "0")
 {
        jQuery("#menu_<?php echo $compact_title; ?>").hide();
 }
index cfa264f..51d718b 100644 (file)
@@ -84,60 +84,6 @@ global $system_courses, $_custom_css, $_base_path;
 <body onload="<?php echo $this->onload; ?>">
 <script language="javascript" type="text/javascript">
 //<!--
-function getexpirydate(nodays){
-       var UTCstring;
-       Today = new Date();
-       nomilli=Date.parse(Today);
-       Today.setTime(nomilli+nodays*24*60*60*1000);
-       UTCstring = Today.toUTCString();
-       return UTCstring;
-}
-
-function setcookie(name,value,duration){
-       cookiestring=name+"="+escape(value)+";path=/;expires="+getexpirydate(duration);
-       document.cookie=cookiestring;
-       if(!getcookie(name)){
-               return false;
-       } else {
-               return true;
-       }
-}
-
-function getcookie(cookiename) {
-       var cookiestring=""+document.cookie;
-       var index1=cookiestring.indexOf(cookiename);
-       if (index1==-1 || cookiename=="") return ""; 
-       var index2=cookiestring.indexOf(';',index1);
-       if (index2==-1) index2=cookiestring.length; 
-       return unescape(cookiestring.substring(index1+cookiename.length+1,index2));
-}
-
-function setDisplay(objId) {
-       var toc = document.getElementById(objId);
-
-       var state = getcookie(objId);
-       if (document.getElementById(objId) && state && (state == 'none')) {
-               toggleToc(objId);
-       }
-}
-
-
-function setstates() {
-       return;
-       var objId = "side-menu";
-       var state = getcookie(objId);
-       if (document.getElementById(objId) && state && (state == 'none')) {
-               toggleToc(objId);
-       }
-
-       var objId = "toccontent";
-       var state = getcookie(objId);
-       if (document.getElementById(objId) && state && (state == 'none')) {
-               toggleToc(objId);
-       }
-
-}
-
 function showTocToggle(objId, show, hide, key, selected) {
        if(document.getElementById) {
                if (key) {
@@ -176,7 +122,7 @@ function toggleToc(objId) {
                hidelink.style.display='none';
                showlink.style.display='';
        }
-       setcookie(objId, toc.style.display, 1);
+       ATutor.setcookie(objId, toc.style.display, 1);
 }
 
 //toggle content folder in side menu "content navigation"
@@ -185,12 +131,12 @@ function toggleFolder(cid)
        if (jQuery("#tree_icon"+cid).attr("src") == tree_collapse_icon) {
                jQuery("#tree_icon"+cid).attr("src", tree_expand_icon);
                jQuery("#tree_icon"+cid).attr("alt", "<?php echo _AT('expand'); ?>");
-               setcookie("c<?php echo $this->course_id;?>_"+cid, null, 1);
+               ATutor.setcookie("c<?php echo $this->course_id;?>_"+cid, null, 1);
        }
        else {
                jQuery("#tree_icon"+cid).attr("src", tree_collapse_icon);
                jQuery("#tree_icon"+cid).attr("alt", "<?php echo _AT('collapse'); ?>");
-               setcookie("c<?php echo $this->course_id;?>_"+cid, "1", 1);
+               ATutor.setcookie("c<?php echo $this->course_id;?>_"+cid, "1", 1);
        }
        
        jQuery("#folder"+cid).slideToggle();
@@ -206,14 +152,14 @@ function elementToggle(elem, title)
                jQuery(elem).attr("src", element_expand_icon);
                jQuery(elem).attr("alt", "<?php echo _AT('show'). ' '; ?>"+ title);
                jQuery(elem).attr("title", "<?php echo _AT('show'). ' '; ?>"+ title);
-               setcookie("m_"+title, 0, 1);
+               ATutor.setcookie("m_"+title, 0, 1);
        }
        else {
                jQuery(elem).attr("src", element_collapse_icon);
                jQuery(elem).attr("alt", "<?php echo _AT('collapse'); ?>");
                jQuery(elem).attr("alt", "<?php echo _AT('hide'). ' '; ?>"+ title);
                jQuery(elem).attr("title", "<?php echo _AT('hide'). ' '; ?>"+ title);
-               setcookie("m_"+title, null, 1);;
+               ATutor.setcookie("m_"+title, null, 1);;
        }
        
        jQuery(elem).parent().next().slideToggle();
@@ -221,7 +167,7 @@ function elementToggle(elem, title)
 
 function printSubmenuHeader(title)
 {
-       if (getcookie("m_"+title) == "0")
+       if (ATutor.getcookie("m_"+title) == "0")
        {
                image = "<?php echo $_base_path?>images/mswitch_plus.gif";
                alt_text = "<?php echo _AT('show'); ?>" + title;
@@ -358,7 +304,7 @@ function printSubmenuHeader(title)
                <?php if ($this->course_id > 0 && $system_courses[$this->course_id]['side_menu']): ?>
                        <script type="text/javascript" language="javascript">
                        //<![CDATA[
-                       var state = getcookie("side-menu");
+                       var state = ATutor.getcookie("side-menu");
                        if (state && (state == 'none')) {
                                showTocToggle("side-menu", "<?php echo _AT('show'); ?>","<?php echo _AT('hide'); ?>", "", "show");
                        } else {
index c96f56b..cc24276 100644 (file)
@@ -15,7 +15,7 @@ $compact_title = str_replace(' ', '', $this->title);
 </div>
 
 <script language="javascript" type="text/javascript">
-if (getcookie("m_<?php echo $this->title; ?>") == "0")
+if (ATutor.getcookie("m_<?php echo $this->title; ?>") == "0")
 {
        jQuery("#menu_<?php echo $compact_title; ?>").hide();
 }
index 4487394..1540739 100644 (file)
@@ -86,60 +86,6 @@ global $system_courses, $_custom_css, $db;
 <body onload="<?php echo $this->onload; ?>">
 <script language="javascript" type="text/javascript">
 //<!--
-function getexpirydate(nodays){
-       var UTCstring;
-       Today = new Date();
-       nomilli=Date.parse(Today);
-       Today.setTime(nomilli+nodays*24*60*60*1000);
-       UTCstring = Today.toUTCString();
-       return UTCstring;
-}
-
-function setcookie(name,value,duration){
-       cookiestring=name+"="+escape(value)+";path=/;expires="+getexpirydate(duration);
-       document.cookie=cookiestring;
-       if(!getcookie(name)){
-               return false;
-       } else {
-               return true;
-       }
-}
-
-function getcookie(cookiename) {
-       var cookiestring=""+document.cookie;
-       var index1=cookiestring.indexOf(cookiename);
-       if (index1==-1 || cookiename=="") return ""; 
-       var index2=cookiestring.indexOf(';',index1);
-       if (index2==-1) index2=cookiestring.length; 
-       return unescape(cookiestring.substring(index1+cookiename.length+1,index2));
-}
-
-function setDisplay(objId) {
-       var toc = document.getElementById(objId);
-
-       var state = getcookie(objId);
-       if (document.getElementById(objId) && state && (state == 'none')) {
-               toggleToc(objId);
-       }
-}
-
-
-function setstates() {
-       return;
-       var objId = "side-menu";
-       var state = getcookie(objId);
-       if (document.getElementById(objId) && state && (state == 'none')) {
-               toggleToc(objId);
-       }
-
-       var objId = "toccontent";
-       var state = getcookie(objId);
-       if (document.getElementById(objId) && state && (state == 'none')) {
-               toggleToc(objId);
-       }
-
-}
-
 function showTocToggle(objId, show, hide, key, selected) {
        if(document.getElementById) {
                if (key) {
@@ -179,7 +125,7 @@ function toggleToc(objId) {
                hidelink.style.display='none';
                showlink.style.display='';
        }
-       setcookie(objId, hidelink.style.display, 1);
+       ATutor.setcookie(objId, hidelink.style.display, 1);
 }
 
 // toggle content folder in side menu "content navigation"
@@ -189,13 +135,13 @@ function toggleFolder(cid)
                jQuery("#tree_icon"+cid).attr("src", tree_expand_icon);
                jQuery("#tree_icon"+cid).attr("alt", "<?php echo _AT('expand'); ?>");
                jQuery("#tree_icon"+cid).attr("title", "<?php echo _AT('expand'); ?>");
-               setcookie("c<?php echo $this->course_id;?>_"+cid, null, 1);
+               ATutor.setcookie("c<?php echo $this->course_id;?>_"+cid, null, 1);
        }
        else {
                jQuery("#tree_icon"+cid).attr("src", tree_collapse_icon);
                jQuery("#tree_icon"+cid).attr("alt", "<?php echo _AT('collapse'); ?>");
                jQuery("#tree_icon"+cid).attr("title", "<?php echo _AT('collapse'); ?>");
-               setcookie("c<?php echo $this->course_id;?>_"+cid, "1", 1);
+               ATutor.setcookie("c<?php echo $this->course_id;?>_"+cid, "1", 1);
        }
        
        jQuery("#folder"+cid).slideToggle();
@@ -211,14 +157,14 @@ function elementToggle(elem, title)
                jQuery(elem).attr("src", element_expand_icon);
                jQuery(elem).attr("alt", "<?php echo _AT('show'). ' '; ?>"+ title);
                jQuery(elem).attr("title", "<?php echo _AT('show'). ' '; ?>"+ title);
-               setcookie("m_"+title, 0, 1);
+               ATutor.setcookie("m_"+title, 0, 1);
        }
        else {
                jQuery(elem).attr("src", element_collapse_icon);
                jQuery(elem).attr("alt", "<?php echo _AT('collapse'); ?>");
                jQuery(elem).attr("alt", "<?php echo _AT('hide'). ' '; ?>"+ title);
                jQuery(elem).attr("title", "<?php echo _AT('hide'). ' '; ?>"+ title);
-               setcookie("m_"+title, null, 1);;
+               ATutor.setcookie("m_"+title, null, 1);;
        }
        
        jQuery(elem).parent().next().slideToggle();
@@ -226,7 +172,7 @@ function elementToggle(elem, title)
 
 function printSubmenuHeader(title)
 {
-       if (getcookie("m_"+title) == "0")
+       if (ATutor.getcookie("m_"+title) == "0")
        {
                image = "<?php echo $this->base_path?>images/mswitch_plus.gif";
                alt_text = "<?php echo _AT('show'); ?> " + title;
@@ -381,7 +327,7 @@ function printSubmenuHeader(title)
                <div id="leftcolumn" <?php if ($_SESSION["prefs"]["PREF_SHOW_BREAD_CRUMBS"] == 0) { echo 'style="margin-top:-3.5em;"';} ?>>
                        <script type="text/javascript">
                        //<![CDATA[
-                       var state = getcookie("side-menu");
+                       var state = ATutor.getcookie("side-menu");
                        if (state && (state == 'none')) {
                                document.writeln('<a name="menu"></a><div style="display:none;" id="side-menu">');
                        } else {
@@ -412,7 +358,7 @@ function printSubmenuHeader(title)
                        <?php if ($this->course_id > 0 && $system_courses[$this->course_id]['side_menu']): ?>
                                <script type="text/javascript" language="javascript">
                                //<![CDATA[
-                               var state = getcookie("side-menu");
+                               var state = ATutor.getcookie("side-menu");
                                if (state && (state == 'none')) {
                                        showTocToggle("side-menu", "<?php echo _AT('show'); ?>","<?php echo _AT('hide'); ?>", "", "show");
                                } else {
index 406e77a..6ba8929 100644 (file)
@@ -14,7 +14,7 @@
                <td valign="top" style="width: 25%">
                <script type="text/javascript">
                //<![CDATA[
-               var state = getcookie("side-menu");
+               var state = ATutor.getcookie("side-menu");
                if (state && (state == 'none')) {
                        document.writeln('<a name="menu"></a><div style="display:none;" id="side-menu">');
                } else {
index fc04a91..a901a6a 100644 (file)
@@ -68,62 +68,8 @@ global $system_courses;
     <?php echo $this->custom_css; ?>
     <style id="pref_style" type="text/css"></style> 
 </head>
-<body onload="setstates(); <?php echo $this->onload; ?>"><script language="javascript" type="text/javascript">
+<body onload="<?php echo $this->onload; ?>"><script language="javascript" type="text/javascript">
 //<!--
-function getexpirydate(nodays){
-       var UTCstring;
-       Today = new Date();
-       nomilli=Date.parse(Today);
-       Today.setTime(nomilli+nodays*24*60*60*1000);
-       UTCstring = Today.toUTCString();
-       return UTCstring;
-}
-
-function setcookie(name,value,duration){
-       cookiestring=name+"="+escape(value)+";path=/;expires="+getexpirydate(duration);
-       document.cookie=cookiestring;
-       if(!getcookie(name)){
-               return false;
-       } else {
-               return true;
-       }
-}
-
-function getcookie(cookiename) {
-       var cookiestring=""+document.cookie;
-       var index1=cookiestring.indexOf(cookiename);
-       if (index1==-1 || cookiename=="") return ""; 
-       var index2=cookiestring.indexOf(';',index1);
-       if (index2==-1) index2=cookiestring.length; 
-       return unescape(cookiestring.substring(index1+cookiename.length+1,index2));
-}
-
-function setDisplay(objId) {
-       var toc = document.getElementById(objId);
-
-       var state = getcookie(objId);
-       if (document.getElementById(objId) && state && (state == 'none')) {
-               toggleToc(objId);
-       }
-}
-
-
-function setstates() {
-       return;
-       var objId = "side-menu";
-       var state = getcookie(objId);
-       if (document.getElementById(objId) && state && (state == 'none')) {
-               toggleToc(objId);
-       }
-
-       var objId = "toccontent";
-       var state = getcookie(objId);
-       if (document.getElementById(objId) && state && (state == 'none')) {
-               toggleToc(objId);
-       }
-       return true;
-}
-
 function showTocToggle(objId, show, hide, key, selected) {
        if(document.getElementById) {
                if (key) {
@@ -160,7 +106,7 @@ function toggleToc(objId) {
                hidelink.style.display='none';
                showlink.style.display='';
        }
-       setcookie(objId, toc.style.display, 1);
+       ATutor.setcookie(objId, toc.style.display, 1);
 }
 //-->
 </script>
@@ -301,7 +247,7 @@ function toggleToc(objId) {
                <?php if ($_SESSION['course_id'] > 0 && $system_courses[$_SESSION['course_id']]['side_menu']): ?>
                        <script type="text/javascript" language="javascript">
                        //<![CDATA[
-                       var state = getcookie("side-menu");
+                       var state = ATutor.getcookie("side-menu");
                        if (state && (state == 'none')) {
                                showTocToggle("side-menu", "<?php echo _AT('show'); ?>","<?php echo _AT('hide'); ?>", "", "show");
                        } else {
index a7926f6..aa56c7a 100644 (file)
@@ -9,7 +9,7 @@
                <td valign="top">
                <script type="text/javascript">
                //<![CDATA[
-               var state = getcookie("side-menu");
+               var state = ATutor.getcookie("side-menu");
                if (state && (state == 'none')) {
                        document.writeln('<div style="display:none;" id="side-menu">');
                } else {
index f30de9d..dac393c 100644 (file)
@@ -36,63 +36,9 @@ global $system_courses, $_custom_css, $_base_path;
     <?php echo $this->custom_css; ?>
     <style id="pref_style" type="text/css"></style> 
 </head>
-<body onload="setstates(); <?php echo $this->onload; ?>">
+<body onload="<?php echo $this->onload; ?>">
 <script language="javascript" type="text/javascript">
 //<!--
-function getexpirydate(nodays){
-       var UTCstring;
-       Today = new Date();
-       nomilli=Date.parse(Today);
-       Today.setTime(nomilli+nodays*24*60*60*1000);
-       UTCstring = Today.toUTCString();
-       return UTCstring;
-}
-
-function setcookie(name,value,duration){
-       cookiestring=name+"="+escape(value)+";path=/;expires="+getexpirydate(duration);
-       document.cookie=cookiestring;
-       if(!getcookie(name)){
-               return false;
-       } else {
-               return true;
-       }
-}
-
-function getcookie(cookiename) {
-       var cookiestring=""+document.cookie;
-       var index1=cookiestring.indexOf(cookiename);
-       if (index1==-1 || cookiename=="") return ""; 
-       var index2=cookiestring.indexOf(';',index1);
-       if (index2==-1) index2=cookiestring.length; 
-       return unescape(cookiestring.substring(index1+cookiename.length+1,index2));
-}
-
-function setDisplay(objId) {
-       var toc = document.getElementById(objId);
-
-       var state = getcookie(objId);
-       if (document.getElementById(objId) && state && (state == 'none')) {
-               toggleToc(objId);
-       }
-}
-
-
-function setstates() {
-       return;
-       var objId = "side-menu";
-       var state = getcookie(objId);
-       if (document.getElementById(objId) && state && (state == 'none')) {
-               toggleToc(objId);
-       }
-
-       var objId = "toccontent";
-       var state = getcookie(objId);
-       if (document.getElementById(objId) && state && (state == 'none')) {
-               toggleToc(objId);
-       }
-
-}
-
 function showTocToggle(objId, show, hide, key, selected) {
        if(document.getElementById) {
                if (key) {
@@ -129,7 +75,7 @@ function toggleToc(objId) {
                hidelink.style.display='none';
                showlink.style.display='';
        }
-       setcookie(objId, toc.style.display, 1);
+       ATutor.setcookie(objId, toc.style.display, 1);
 }
 
 //toggle content folder in side menu "content navigation"
@@ -138,12 +84,12 @@ function toggleFolder(cid)
        if (jQuery("#tree_icon"+cid).attr("src") == tree_collapse_icon) {
                jQuery("#tree_icon"+cid).attr("src", tree_expand_icon);
                jQuery("#tree_icon"+cid).attr("alt", "<?php echo _AT('expand'); ?>");
-               setcookie("c<?php echo $this->course_id;?>_"+cid, null, 1);
+               ATutor.setcookie("c<?php echo $this->course_id;?>_"+cid, null, 1);
        }
        else {
                jQuery("#tree_icon"+cid).attr("src", tree_collapse_icon);
                jQuery("#tree_icon"+cid).attr("alt", "<?php echo _AT('collapse'); ?>");
-               setcookie("c<?php echo $this->course_id;?>_"+cid, "1", 1);
+               ATutor.setcookie("c<?php echo $this->course_id;?>_"+cid, "1", 1);
        }
        
        jQuery("#folder"+cid).slideToggle();
@@ -159,14 +105,14 @@ function elementToggle(elem, title)
                jQuery(elem).attr("src", element_expand_icon);
                jQuery(elem).attr("alt", "<?php echo _AT('show'). ' '; ?>"+ title);
                jQuery(elem).attr("title", "<?php echo _AT('show'). ' '; ?>"+ title);
-               setcookie("m_"+title, 0, 1);
+               ATutor.setcookie("m_"+title, 0, 1);
        }
        else {
                jQuery(elem).attr("src", element_collapse_icon);
                jQuery(elem).attr("alt", "<?php echo _AT('collapse'); ?>");
                jQuery(elem).attr("alt", "<?php echo _AT('hide'). ' '; ?>"+ title);
                jQuery(elem).attr("title", "<?php echo _AT('hide'). ' '; ?>"+ title);
-               setcookie("m_"+title, null, 1);;
+               ATutor.setcookie("m_"+title, null, 1);;
        }
        
        jQuery(elem).parent().next().slideToggle();
@@ -174,7 +120,7 @@ function elementToggle(elem, title)
 
 function printSubmenuHeader(title)
 {
-       if (getcookie("m_"+title) == "0")
+       if (ATutor.getcookie("m_"+title) == "0")
        {
                image = "<?php echo $_base_path?>images/mswitch_plus.gif";
                alt_text = "<?php echo _AT('show'); ?>" + title;
@@ -339,7 +285,7 @@ function printSubmenuHeader(title)
                <?php if ($this->course_id > 0): ?>
                        <script type="text/javascript" language="javascript">
                        //<![CDATA[
-                       var state = getcookie("side-menu");
+                       var state = ATutor.getcookie("side-menu");
                        if (state && (state == 'none')) {
                                showTocToggle("side-menu", "<?php echo _AT('show'); ?>","<?php echo _AT('hide'); ?>", "n", "show");
                        } else {
index 135265e..fe1034c 100644 (file)
@@ -110,60 +110,6 @@ jQuery(document).ready(function () {
        });
 });
 
-function getexpirydate(nodays){
-       var UTCstring;
-       Today = new Date();
-       nomilli=Date.parse(Today);
-       Today.setTime(nomilli+nodays*24*60*60*1000);
-       UTCstring = Today.toUTCString();
-       return UTCstring;
-}
-
-function setcookie(name,value,duration){
-       cookiestring=name+"="+escape(value)+";path=/;expires="+getexpirydate(duration);
-       document.cookie=cookiestring;
-       if(!getcookie(name)){
-               return false;
-       } else {
-               return true;
-       }
-}
-
-function getcookie(cookiename) {
-       var cookiestring=""+document.cookie;
-       var index1=cookiestring.indexOf(cookiename);
-       if (index1==-1 || cookiename=="") return ""; 
-       var index2=cookiestring.indexOf(';',index1);
-       if (index2==-1) index2=cookiestring.length; 
-       return unescape(cookiestring.substring(index1+cookiename.length+1,index2));
-}
-
-function setDisplay(objId) {
-       var toc = document.getElementById(objId);
-
-       var state = getcookie(objId);
-       if (document.getElementById(objId) && state && (state == 'none')) {
-               toggleToc(objId);
-       }
-}
-
-
-function setstates() {
-       return;
-       var objId = "side-menu";
-       var state = getcookie(objId);
-       if (document.getElementById(objId) && state && (state == 'none')) {
-               toggleToc(objId);
-       }
-
-       var objId = "toccontent";
-       var state = getcookie(objId);
-       if (document.getElementById(objId) && state && (state == 'none')) {
-               toggleToc(objId);
-       }
-
-}
-
 function showTocToggle(objId, show, hide, key, selected) {
        if(document.getElementById) {
                if (key) {
@@ -202,16 +148,7 @@ function toggleToc(objId) {
                hidelink.style.display='none';
                showlink.style.display='';
        }
-       setcookie(objId, toc.style.display, 1);
-}
-
-function getcookie(cookiename) {
-       var cookiestring=""+document.cookie;
-       var index1=cookiestring.indexOf(cookiename);
-       if (index1==-1 || cookiename=="") return ""; 
-       var index2=cookiestring.indexOf(';',index1);
-       if (index2==-1) index2=cookiestring.length; 
-       return unescape(cookiestring.substring(index1+cookiename.length+1,index2));
+       ATutor.setcookie(objId, toc.style.display, 1);
 }
 
 //toggle content folder in side menu "content navigation"
@@ -220,12 +157,12 @@ function toggleFolder(cid)
        if (jQuery("#tree_icon"+cid).attr("src") == tree_collapse_icon) {
                jQuery("#tree_icon"+cid).attr("src", tree_expand_icon);
                jQuery("#tree_icon"+cid).attr("alt", "<?php echo _AT('expand'); ?>");
-               setcookie("c<?php echo $this->course_id;?>_"+cid, null, 1);
+               ATutor.setcookie("c<?php echo $this->course_id;?>_"+cid, null, 1);
        }
        else {
                jQuery("#tree_icon"+cid).attr("src", tree_collapse_icon);
                jQuery("#tree_icon"+cid).attr("alt", "<?php echo _AT('collapse'); ?>");
-               setcookie("c<?php echo $this->course_id;?>_"+cid, "1", 1);
+               ATutor.setcookie("c<?php echo $this->course_id;?>_"+cid, "1", 1);
        }
        
        jQuery("#folder"+cid).slideToggle();
@@ -241,14 +178,14 @@ function elementToggle(elem, title)
                jQuery(elem).attr("src", element_expand_icon);
                jQuery(elem).attr("alt", "<?php echo _AT('show'). ' '; ?>"+ title);
                jQuery(elem).attr("title", "<?php echo _AT('show'). ' '; ?>"+ title);
-               setcookie("m_"+title, 0, 1);
+               ATutor.setcookie("m_"+title, 0, 1);
        }
        else {
                jQuery(elem).attr("src", element_collapse_icon);
                jQuery(elem).attr("alt", "<?php echo _AT('collapse'); ?>");
                jQuery(elem).attr("alt", "<?php echo _AT('hide'). ' '; ?>"+ title);
                jQuery(elem).attr("title", "<?php echo _AT('hide'). ' '; ?>"+ title);
-               setcookie("m_"+title, null, 1);;
+               ATutor.setcookie("m_"+title, null, 1);;
        }
        
        jQuery(elem).parent().next().slideToggle();
index 00147db..a5d831b 100644 (file)
@@ -85,60 +85,6 @@ global $system_courses, $_custom_css, $_base_path;
 <body onload="<?php echo $this->onload; ?>">
 <script language="javascript" type="text/javascript">
 //<!--
-function getexpirydate(nodays){
-       var UTCstring;
-       Today = new Date();
-       nomilli=Date.parse(Today);
-       Today.setTime(nomilli+nodays*24*60*60*1000);
-       UTCstring = Today.toUTCString();
-       return UTCstring;
-}
-
-function setcookie(name,value,duration){
-       cookiestring=name+"="+escape(value)+";path=/;expires="+getexpirydate(duration);
-       document.cookie=cookiestring;
-       if(!getcookie(name)){
-               return false;
-       } else {
-               return true;
-       }
-}
-
-function getcookie(cookiename) {
-       var cookiestring=""+document.cookie;
-       var index1=cookiestring.indexOf(cookiename);
-       if (index1==-1 || cookiename=="") return ""; 
-       var index2=cookiestring.indexOf(';',index1);
-       if (index2==-1) index2=cookiestring.length; 
-       return unescape(cookiestring.substring(index1+cookiename.length+1,index2));
-}
-
-function setDisplay(objId) {
-       var toc = document.getElementById(objId);
-
-       var state = getcookie(objId);
-       if (document.getElementById(objId) && state && (state == 'none')) {
-               toggleToc(objId);
-       }
-}
-
-
-function setstates() {
-       return;
-       var objId = "side-menu";
-       var state = getcookie(objId);
-       if (document.getElementById(objId) && state && (state == 'none')) {
-               toggleToc(objId);
-       }
-
-       var objId = "toccontent";
-       var state = getcookie(objId);
-       if (document.getElementById(objId) && state && (state == 'none')) {
-               toggleToc(objId);
-       }
-
-}
-
 function showTocToggle(objId, show, hide, key, selected) {
        if(document.getElementById) {
                if (key) {
@@ -177,7 +123,7 @@ function toggleToc(objId) {
                hidelink.style.display='none';
                showlink.style.display='';
        }
-       setcookie(objId, toc.style.display, 1);
+       ATutor.setcookie(objId, toc.style.display, 1);
 }
 
 //toggle content folder in side menu "content navigation"
@@ -186,12 +132,12 @@ function toggleFolder(cid)
        if (jQuery("#tree_icon"+cid).attr("src") == tree_collapse_icon) {
                jQuery("#tree_icon"+cid).attr("src", tree_expand_icon);
                jQuery("#tree_icon"+cid).attr("alt", "<?php echo _AT('expand'); ?>");
-               setcookie("c<?php echo $this->course_id;?>_"+cid, null, 1);
+               ATutor.setcookie("c<?php echo $this->course_id;?>_"+cid, null, 1);
        }
        else {
                jQuery("#tree_icon"+cid).attr("src", tree_collapse_icon);
                jQuery("#tree_icon"+cid).attr("alt", "<?php echo _AT('collapse'); ?>");
-               setcookie("c<?php echo $this->course_id;?>_"+cid, "1", 1);
+               ATutor.setcookie("c<?php echo $this->course_id;?>_"+cid, "1", 1);
        }
        
        jQuery("#folder"+cid).slideToggle();
@@ -207,14 +153,14 @@ function elementToggle(elem, title)
                jQuery(elem).attr("src", element_expand_icon);
                jQuery(elem).attr("alt", "<?php echo _AT('show'). ' '; ?>"+ title);
                jQuery(elem).attr("title", "<?php echo _AT('show'). ' '; ?>"+ title);
-               setcookie("m_"+title, 0, 1);
+               ATutor.setcookie("m_"+title, 0, 1);
        }
        else {
                jQuery(elem).attr("src", element_collapse_icon);
                jQuery(elem).attr("alt", "<?php echo _AT('collapse'); ?>");
                jQuery(elem).attr("alt", "<?php echo _AT('hide'). ' '; ?>"+ title);
                jQuery(elem).attr("title", "<?php echo _AT('hide'). ' '; ?>"+ title);
-               setcookie("m_"+title, null, 1);;
+               ATutor.setcookie("m_"+title, null, 1);;
        }
        
        jQuery(elem).parent().next().slideToggle();
index 7069252..ffe17b7 100644 (file)
@@ -97,44 +97,6 @@ jQuery('#content_link').click(function(e) {
 <body onload="<?php echo $this->onload; ?>">
 <script language="javascript" type="text/javascript">
 //<!--
-function getexpirydate(nodays){
-       var UTCstring;
-       Today = new Date();
-       nomilli=Date.parse(Today);
-       Today.setTime(nomilli+nodays*24*60*60*1000);
-       UTCstring = Today.toUTCString();
-       return UTCstring;
-}
-
-function setcookie(name,value,duration){
-       cookiestring=name+"="+escape(value)+";path=/;expires="+getexpirydate(duration);
-       document.cookie=cookiestring;
-       if(!getcookie(name)){
-               return false;
-       } else {
-               return true;
-       }
-}
-
-function getcookie(cookiename) {
-       var cookiestring=""+document.cookie;
-       var index1=cookiestring.indexOf(cookiename);
-       if (index1==-1 || cookiename=="") return ""; 
-       var index2=cookiestring.indexOf(';',index1);
-       if (index2==-1) index2=cookiestring.length; 
-       return unescape(cookiestring.substring(index1+cookiename.length+1,index2));
-}
-
-function setDisplay(objId) {
-       var toc = document.getElementById(objId);
-
-       var state = getcookie(objId);
-       if (document.getElementById(objId) && state && (state == 'none')) {
-               toggleToc(objId);
-       }
-}
-
-
 function showTocToggle(objId, show, hide, key, selected) {
        if(document.getElementById) {
                if (key) {
@@ -174,7 +136,7 @@ function toggleToc(objId) {
                hidelink.style.display='none';
                showlink.style.display='';
        }
-       setcookie(objId, hidelink.style.display, 1);
+       ATutor.setcookie(objId, hidelink.style.display, 1);
 }
 
 // toggle content folder in side menu "content navigation"
@@ -183,12 +145,12 @@ function toggleFolder(cid)
        if (jQuery("#tree_icon"+cid).attr("src") == tree_collapse_icon) {
                jQuery("#tree_icon"+cid).attr("src", tree_expand_icon);
                jQuery("#tree_icon"+cid).attr("alt", "<?php echo _AT('expand'); ?>");
-               setcookie("c<?php echo $this->course_id;?>_"+cid, null, 1);
+               ATutor.setcookie("c<?php echo $this->course_id;?>_"+cid, null, 1);
        }
        else {
                jQuery("#tree_icon"+cid).attr("src", tree_collapse_icon);
                jQuery("#tree_icon"+cid).attr("alt", "<?php echo _AT('collapse'); ?>");
-               setcookie("c<?php echo $this->course_id;?>_"+cid, "1", 1);
+               ATutor.setcookie("c<?php echo $this->course_id;?>_"+cid, "1", 1);
        }
        
        jQuery("#folder"+cid).slideToggle();
@@ -204,14 +166,14 @@ function elementToggle(elem, title)
                jQuery(elem).attr("src", element_expand_icon);
                jQuery(elem).attr("alt", "<?php echo _AT('show'). ' '; ?>"+ title);
                jQuery(elem).attr("title", "<?php echo _AT('show'). ' '; ?>"+ title);
-               setcookie("m_"+title, 0, 1);
+               ATutor.setcookie("m_"+title, 0, 1);
        }
        else {
                jQuery(elem).attr("src", element_collapse_icon);
                jQuery(elem).attr("alt", "<?php echo _AT('collapse'); ?>");
                jQuery(elem).attr("alt", "<?php echo _AT('hide'). ' '; ?>"+ title);
                jQuery(elem).attr("title", "<?php echo _AT('hide'). ' '; ?>"+ title);
-               setcookie("m_"+title, null, 1);;
+               ATutor.setcookie("m_"+title, null, 1);;
        }
        
        jQuery(elem).parent().next().slideToggle();