[Hw4mdl-svn] SF.net SVN: hw4mdl: [200] trunk/moodle/mod
Brought to you by:
jhlinder,
trollinger
From: <tro...@us...> - 2008-01-09 11:42:27
|
Revision: 200 http://hw4mdl.svn.sourceforge.net/hw4mdl/?rev=200&view=rev Author: trollinger Date: 2008-01-09 03:37:50 -0800 (Wed, 09 Jan 2008) Log Message: ----------- update the repository after the 3.1.2 release Modified Paths: -------------- trunk/moodle/mod/liveclassroom/doAction.php trunk/moodle/mod/liveclassroom/js/ajax.js trunk/moodle/mod/liveclassroom/js/constants.js trunk/moodle/mod/liveclassroom/js/hwCommons.js trunk/moodle/mod/liveclassroom/js/pngfix.js trunk/moodle/mod/liveclassroom/js/xsl/wimba.xsl trunk/moodle/mod/liveclassroom/lib/common/WimbaCommons.php trunk/moodle/mod/liveclassroom/lib/common/WimbaUI.php trunk/moodle/mod/liveclassroom/lib/common/XmlArchive.php trunk/moodle/mod/liveclassroom/lib/lc/LCAction.php trunk/moodle/mod/liveclassroom/lib/lc/lcapi.php trunk/moodle/mod/liveclassroom/lib.php trunk/moodle/mod/liveclassroom/mod.html trunk/moodle/mod/liveclassroom/pictures/backgrounds/Thumbs.db trunk/moodle/mod/liveclassroom/pictures/buttons/Thumbs.db trunk/moodle/mod/liveclassroom/pictures/items/Thumbs.db trunk/moodle/mod/liveclassroom/pictures/items/filter-enabled-right.png trunk/moodle/mod/liveclassroom/pictures/items/filter-rollover-right.png trunk/moodle/mod/voicetools/css/StyleSheet.css trunk/moodle/mod/voicetools/error.php trunk/moodle/mod/voicetools/js/ajax.js trunk/moodle/mod/voicetools/js/constants.js trunk/moodle/mod/voicetools/js/hwCommons.js trunk/moodle/mod/voicetools/js/pngfix.js trunk/moodle/mod/voicetools/js/xsl/wimba.xsl trunk/moodle/mod/voicetools/lang/en/voicetools.php trunk/moodle/mod/voicetools/lang/en_utf8/voicetools.php trunk/moodle/mod/voicetools/lib/common/WimbaCommons.php trunk/moodle/mod/voicetools/lib/common/WimbaUI.php trunk/moodle/mod/voicetools/lib/common/XmlArchive.php trunk/moodle/mod/voicetools/lib/vt/WimbaVoicetools.php trunk/moodle/mod/voicetools/lib.php trunk/moodle/mod/voicetools/mod.html trunk/moodle/mod/voicetools/pictures/backgrounds/Thumbs.db trunk/moodle/mod/voicetools/pictures/buttons/Thumbs.db trunk/moodle/mod/voicetools/pictures/items/Thumbs.db trunk/moodle/mod/voicetools/pictures/items/filter-enabled-right.png trunk/moodle/mod/voicetools/pictures/items/filter-rollover-right.png trunk/moodle/mod/voicetools/voicerecorder.php Modified: trunk/moodle/mod/liveclassroom/doAction.php =================================================================== --- trunk/moodle/mod/liveclassroom/doAction.php 2008-01-09 10:36:38 UTC (rev 199) +++ trunk/moodle/mod/liveclassroom/doAction.php 2008-01-09 11:37:50 UTC (rev 200) @@ -27,7 +27,7 @@ * * ******************************************************************************/ -/* $Id: doAction.php 52708 2007-08-20 19:53:23Z thomasr $ */ +/* $Id: doAction.php 55986 2007-11-13 21:51:00Z thomasr $ */ /* This page manage the action create, update, delete for a room */ error_reporting(E_ERROR); @@ -76,7 +76,7 @@ exit; break; case "create" : - $id = $api->createRoom($session->getCourseId() . rand(), "false"); + $id = $api->createRoom(required_param('id', PARAM_SAFEDIR), "false"); $messageAction = "created"; $messageProduct = "room"; break; Modified: trunk/moodle/mod/liveclassroom/js/ajax.js =================================================================== --- trunk/moodle/mod/liveclassroom/js/ajax.js 2008-01-09 10:36:38 UTC (rev 199) +++ trunk/moodle/mod/liveclassroom/js/ajax.js 2008-01-09 11:37:50 UTC (rev 200) @@ -1,476 +1,546 @@ -/****************************************************************************** - * * - * Copyright (c) 1999-2007 Wimba, All Rights Reserved. * - * * - * COPYRIGHT: * - * This software is the property of Wimba. * - * It cannot be copied, used, or modified without obtaining an * - * authorization from the authors or a mandated member of Wimba. * - * If such an authorization is provided, any modified version * - * or copy of the software has to contain this header. * - * * - * WARRANTIES: * - * This software is made available by the authors in the hope * - * that it will be useful, but without any warranty. * - * Wimba is not liable for any consequence related to * - * the use of the provided software. * - * * - * Class: ajax.js * - * * - * Author: Thomas Rollinger * - * * - * Date: May 2007 * - * * - ******************************************************************************/ - -/* $Id$ */ - -function getURLParametersTab() { - var sURL = window.document.URL; - - var params = new Array(); - if (sURL.indexOf("?") > 0) { - var arrParams = sURL.split("?"); - var arrURLParams = arrParams[1].split("&"); - var i = 0; - for (i = 0; i < arrURLParams.length; i = i + 1) { - var param = arrURLParams[i].split("="); - params[param[0]] = param[1]; - } - } - return params; -} - - -function getURLParameters() { - var sURL = window.document.URL.toString(); - var params = ""; - if (sURL.indexOf("?") > 0) - { - var arrParams = sURL.split("?"); - - var arrURLParams = arrParams[1].split("&"); - - var arrParamNames = new Array(arrURLParams.length); - var arrParamValues = new Array(arrURLParams.length); - - var i = 0; - for (i = 0; i < arrURLParams.length; i ++ ) - { - var sParam = arrURLParams[i]; - arrParamNames[i] = sParam[0]; - if (sParam[1] != "") - params += "&" + unescape(sParam); - - } - params = params.substring(1, params.length) - } - return params; -} -function getSessionParameters() { - var params = new Array(); - params["signature"] = session["signature"]; - params["enc_courseId"] = session["courseId"]; - params["enc_email"] = session["email"]; - params["enc_firstname"] = session["firstName"]; - params["enc_lastname"] = session["lastName"]; - params["enc_role"] = session["role"]; - params["time"] = session["timeOfLoad"]; - if (currentProduct != "") { - params["product"] = currentProduct; - } - if (typeSelect != "") { - params["type"] = typeSelect; - } - if (currentId != "") { - params["id"] = currentId; - } - if (currentIdtab != "") { - params["idtab"] = currentIdtab; - } - if (currentCourseTab != "") { - params["tab"] = currentCourseTab; - } - params["studentView"] = studentView; - - return params; -} - -function getUrlParameters() { - var url = ""; - url += "signature=" + session["signature"]; - url += "&enc_courseId=" + session["courseId"]; - url += "&enc_email=" + session["email"]; - url += "&enc_firstname=" + session["firstName"]; - url += "&enc_lastname=" + session["lastName"]; - url += "&enc_role=" + session["role"]; - url += "&time=" + session["timeOfLoad"]; - if (currentProduct != "") { - url += "&product=" + currentProduct; - } - if (typeSelect != "") { - url += "&type=" + typeSelect; - } - - if (currentId != "") { - url += "&id=" + currentId; - } - - if (currentIdtab != "") { - url += "&idtab=" + currentIdtab; - } - if (currentCourseTab != "") { - url += "&tab = " + currentCourseTab; - } - url += "&studentView=" + studentView; - - return url; -} -function DisplayFirstPage(url, div, action, nextAction) { - if (div == "all") { - showPopup(); - } - if (action != null) { - url += "?action=" + action; - } - - - transform(url,"js/xsl/wimba.xsl","first",div,nextAction) -} - -function launchAjaxRequest(url, action, init, div,createWorkflow) { - //display the loading page - if (div == "all") { - showPopup(); - } - if (lcPopup != null) { - lcPopup.close(); - } - var parameters = ""; - if (action != "") { - url += "?action=" + action; - } - if (createWorkflow != "" && action!="") { - url += "&createWorkflow=" + createWorkflow; - } - isFilter = false; - transform(url,"js/xsl/wimba.xsl","",div) - if (init == true) { - - currentId = ""; - currentIdtab = "Info"; - advancedSettings = false; - } - -} - -/* -* Function used to dispaly the rss feed into the podcaster nugget -*/ -function launchSimpleAjaxRequest(url, action, init, div) { - //display the loading page - var xml; - var parameters = ""; - if (action != "") { - url += "?action=" + action; - } - - var xmlSource; - dojo.io.bind({ - url:url, mimetype:"text/plain", - load:function (type, data, evt) { - if (data.match("error") == "error") { - dom = xmlParse(data); - xmlSource = dom; - if (xslData == null) { //get the stylesheet - dojo.io.bind({ - url:"js/xsl/wimba.xsl", - mimetype:"application/xml", - load:function (type, data, evt) { - xslData = data; - var xml = xsltProcess(xmlSource, xslData); - hidePopup(); - document.getElementById(div).innerHTML = xml; - }, - error:BadResult, - content:null, - method:"POST"}); - } else { - transform(xml, xslData, 'all'); - } - } else { - displayRssFeed(data, div); - } - }, - error:BadResult, - content:getSessionParameters(), - method:"POST"}); -} - -function getRss(url, id, tab) { - if(id!=""){ - document.getElementById("rss").innerHTML = document.getElementById("loadingPopup").innerHTML; - currentId = id; - currentCourseTab = tab; - launchSimpleAjaxRequest(url, "getRss", true, "rss"); - } -} - -function transform(urlXml, stylesheet,TypeParams, div,nextAction) { - - if(window.ActiveXObject){//ie - - if(TypeParams=="first") - params=getURLParameters(); - else - params=getUrlParameters(); - - var sourceDoc = new ActiveXObject("Microsoft.XMLDOM") - sourceDoc.async = false - if(urlXml.substr((urlXml.length-1),urlXml.length)=="?") - sourceDoc.load(urlXml +params) - else if( urlXml.substr((urlXml.length-1),urlXml.length)=="&") - sourceDoc.load(urlXml+params) - else if( urlXml.indexOf("?") == -1) - sourceDoc.load(urlXml+"?"+params) - else - sourceDoc.load(urlXml+"&"+params) - - if (div == "all" && sourceDoc.documentElement.getElementsByTagName("type")[0].childNodes[0].nodeValue!="error") { - createSessionByXmlDocument(sourceDoc); - } - - var xslDoc = new ActiveXObject("Microsoft.XMLDOM") - xslDoc.async = false - xslDoc.load("js/xsl/wimba.xsl"); - - xsltTransformation(sourceDoc,xslDoc,div,nextAction); - - }else if (window.XSLTProcessor){//firefox - if(TypeParams=="first") - params=getURLParametersTab(); - else - params=getSessionParameters(); - - dojo.io.bind({url:urlXml, mimetype:"application/xml", load:function (type, data, evt) { - - if (div == "all" && data.documentElement.getElementsByTagName("type")[0].childNodes[0].nodeValue!="error") { - createSessionByXmlDocument(data); - } - - xmlSource = data; - //get the stylesheet - dojo.io.bind({ - url:stylesheet, - mimetype:"application/xml", - load:function (type, data, evt) { - //do the xslt transformatio - xsltTransformation(xmlSource,data,div,nextAction) - - }, - error:BadResult, - content:null, - method:"GET"}); - - }, - error:BadResult, - content:params, - method:"POST"}); - - }else{ - if(TypeParams=="first") - params=getURLParametersTab(); - else - params=getSessionParameters(); - var xmlSource; - dojo.io.bind({url:urlXml, mimetype:"text/plain", load:function (type, data, evt) { - if (div == "all" && data.match("error") != "error") { - createSession(data); - } - dom = xmlParse(data); - xmlSource = dom; - - dojo.io.bind({ - url:"js/xsl/wimba.xsl", - mimetype:"application/xml", - load:function (type, data, evt) { - //do the xslt transformatio - xsltTransformation(xmlSource,xslData,div,nextAction) - - }, - error:BadResult, - content:null, - method:"GET"}); - - - }, - error:BadResult, - content:params, - method:"POST"}); - - } - -} - -function xsltTransformation(xml,xsl,div,nextAction){ - - if(window.ActiveXObject)//ie - { - var result = xml.transformNode(xsl); - - if (div == "all") { - document.getElementById(div).innerHTML = result; - hidePopup(); - gestionDisplay(); - var text=new String(document.getElementById("all").innerHTML); - - } - if (div == "dialInfo") {//click on Info Button - document.getElementById(div).style.display = "block"; - document.getElementById(div).innerHTML = result; - document.getElementById(div).innerHTML = document.getElementById(div).innerHTML.replace("myform", "myFormPopup"); - opendDialInformations(); - } - if(nextAction!="") - eval(nextAction); - }else if (window.XSLTProcessor){//firefox - - var processor = new XSLTProcessor(); - processor.importStylesheet(xsl); - document.getElementById(div).innerHTML=""; - var resultDocument = processor.transformToFragment(xml, document); - - if (div == "all") { - hidePopup(); - document.getElementById(div).appendChild(resultDocument); - gestionDisplay(); - - } - if (div == "dialInfo") {//click on Info Button - document.getElementById(div).style.display = "block"; - - document.getElementById(div).appendChild(resultDocument); - document.getElementById(div).innerHTML = document.getElementById(div).innerHTML.replace("myform", "myFormPopup"); - opendDialInformations(); - } - - if(nextAction!="") - eval(nextAction); - - }else{ - - var xml = xsltProcess(xml, xsl); - - //hide the loading page - if (div == "all") { - hidePopup(); - document.getElementById(div).innerHTML = xml; - } - if (div == "dialInfo") {//click on Info Button - document.getElementById(div).style.display = "block"; - xml = xml.replace("myform", "myFormPopup"); - document.getElementById(div).innerHTML = xml; - opendDialInformations(); - } - gestionDisplay(); - if(nextAction!="") - eval(nextAction); - } - //manage the display of the accent - var content=new String(document.getElementById("all").innerHTML); - content=content.replace(/&/g,"&"); - document.getElementById("all").innerHTML=content; - var content=new String(document.getElementById("popupDial").innerHTML); - content=content.replace(/&/g,"&"); - document.getElementById("popupDial").innerHTML=content; - -} - - -function Management() -{ - -} - - -function BadResult(type, error) { - -} - -function loadSettings(url, action, div) { - launchAjaxRequest(url, action, false, div); -} - -function loadNewSettings(url, action, product, type, div,createWorkflow) { - currentProduct = product; - typeSelect = type; - launchAjaxRequest(url, action, false, div,createWorkflow); -} - -function saveDatabase(url, title, comment) { - var url = url + "?action=updateRecorder&title=" + title + "&comment=" + comment; - var xml; - dojo.io.bind({url:url, mimetype:"text/plain", load:function (type, data, evt) { - if (data == "bad") { - alert("problem to save"); - } - }, error:BadResult,content:getURLParametersTab(), method:"POST"}); - -} - -function showInformation(url, id, product) { - currentId = id; - currentProduct = product; - displayBackground(); - launchAjaxRequest(url, "getDialInformation", "false", "dialInfo"); -} - -function saveSettings(url, id) { - - url = url + "?action=saveSettings&id=" + id; - var returnValue = true; - var xml; - dojo.io.bind({url:url, mimetype:"text/plain", load:function (type, data, evt) { - if (data == "bad") { - alert("problem to save the new Settings"); - returnValue = false; - } - - }, error:BadResult, content:getForm(window.document.myform), method:"POST"}); - return returnValue; -} - -function getForm(obj) { - - var params = getSessionParameters(); - inputForm = obj.getElementsByTagName("input"); - var i=0; - for (i = 0; i < inputForm.length; i++) { - if (inputForm[i].type == "text") { - params[inputForm[i].name] = inputForm[i].value; - } - if (inputForm[i].type == "checkbox") { - if (inputForm[i].checked) { - params[inputForm[i].name] = inputForm[i].value; - } else { - params[inputForm[i].name] = "false"; - } - } - if (inputForm[i].type == "radio") { - if (inputForm[i].checked) { - params[inputForm[i].name] = inputForm[i].value; - } - } - } - inputForm = obj.getElementsByTagName("select"); - for (i = 0; i < inputForm.length; i++) { - var sel = inputForm[i]; - params[sel.name] = sel.options[sel.selectedIndex].value; - } - inputForm = obj.getElementsByTagName("textarea"); - for (i = 0; i < inputForm.length; i++) { - params[inputForm[i].name] = inputForm[i].value; - } - return params; -} - +/****************************************************************************** + * * + * Copyright (c) 1999-2007 Wimba, All Rights Reserved. * + * * + * COPYRIGHT: * + * This software is the property of Wimba. * + * It cannot be copied, used, or modified without obtaining an * + * authorization from the authors or a mandated member of Wimba. * + * If such an authorization is provided, any modified version * + * or copy of the software has to contain this header. * + * * + * WARRANTIES: * + * This software is made available by the authors in the hope * + * that it will be useful, but without any warranty. * + * Wimba is not liable for any consequence related to * + * the use of the provided software. * + * * + * Class: ajax.js * + * * + * Author: Thomas Rollinger * + * * + * Date: May 2007 * + * * + ******************************************************************************/ + + +/* + * Get the parameters passed with the GET Method and put them into a + * javascript array + */ +function getURLParametersTab() { + var sURL = window.document.URL; + + var params = new Array(); + if (sURL.indexOf("?") > 0) { + var arrParams = sURL.split("?"); + var arrURLParams = arrParams[1].split("&"); + var i = 0; + for (i = 0; i < arrURLParams.length; i = i + 1) { + var param = arrURLParams[i].split("="); + params[param[0]] = unescape(param[1].replace(/\+/g,"%20")); + } + } + return params; +} + +/* + * Get the parameters passed with the GET Method and + * create a string with them. + */ +function getURLParameters() { + var sURL = window.document.URL.toString(); + var params = ""; + if (sURL.indexOf("?") > 0) + { + var arrParams = sURL.split("?"); + + var arrURLParams = arrParams[1].split("&"); + + var arrParamNames = new Array(arrURLParams.length); + var arrParamValues = new Array(arrURLParams.length); + + var i = 0; + for (i = 0; i < arrURLParams.length; i ++ ) + { + var sParam = arrURLParams[i]; + arrParamNames[i] = sParam[0]; + if (sParam[1] != "") + params += "&" + unescape(sParam); + + } + params = params.substring(1, params.length) + } + return params; +} + +/* + * Create an array which contains different informations + * about the component status and session variable + */ +function getSessionParameters() { + var params = new Array(); + params["signature"] = session["signature"]; + params["enc_courseId"] = session["courseId"]; + params["enc_email"] = session["email"]; + params["enc_firstname"] = session["firstName"]; + params["enc_lastname"] = session["lastName"]; + params["enc_role"] = session["role"]; + params["time"] = session["timeOfLoad"]; + if (currentProduct != "") { + params["product"] = currentProduct; + } + if (typeSelect != "") { + params["type"] = typeSelect; + } + if (currentId != "") { + params["id"] = currentId; + } + if (currentIdtab != "") { + params["idtab"] = currentIdtab; + } + if (currentCourseTab != "") { + params["tab"] = currentCourseTab; + } + params["studentView"] = studentView; + + return params; +} +/* + * Create a string which contains different informations + * about the component status and session variable to be passed + * as a GET parameters + */ +function getUrlParameters() { + var url = ""; + url += "signature=" + session["signature"]; + url += "&enc_courseId=" + session["courseId"]; + url += "&enc_email=" + session["email"]; + url += "&enc_firstname=" + session["firstName"]; + url += "&enc_lastname=" + session["lastName"]; + url += "&enc_role=" + session["role"]; + url += "&time=" + session["timeOfLoad"]; + if (currentProduct != "") { + url += "&product=" + currentProduct; + } + if (typeSelect != "") { + url += "&type=" + typeSelect; + } + + if (currentId != "") { + url += "&id=" + currentId; + } + + if (currentIdtab != "") { + url += "&idtab=" + currentIdtab; + } + if (currentCourseTab != "") { + url += "&tab = " + currentCourseTab; + } + url += "&studentView=" + studentView; + + return url; +} + +/* + * Display the principal page of the component + * url : file which generate the xml + * div : id of the div where the html will be + * action : + * nextAction : + */ +function DisplayFirstPage(url, div, action, nextAction) { + if (div == "all") { + showPopup(); + } + if (action != null) { + url += "?action=" + action; + } + + + transform(url,"js/xsl/wimba.xsl","first",div,nextAction) +} + + +/* + * Create the context of the Ajax request and execute it + * + */ +function launchAjaxRequest(url, action, init, div,createWorkflow) { + //display the loading page + if(currentId == "" && action=="update") { + return false; + } + if (div == "all") { + showPopup(); + } + if (lcPopup != null) { + lcPopup.close(); + } + var parameters = ""; + if (action != "") { + url += "?action=" + action; + } + if (createWorkflow != "" && action!="") { + url += "&createWorkflow=" + createWorkflow; + } + isFilter = false; + transform(url,"js/xsl/wimba.xsl","",div) + if (init == true) { + + currentId = ""; + currentIdtab = "Info"; + advancedSettings = false; + } +} + +/* +* Function used to display the rss feed into the podcaster nugget +*/ +function launchSimpleAjaxRequest(url, action, init, div) { + //display the loading page + var xml; + var parameters = ""; + if (action != "") { + url += "?action=" + action; + } + + var xmlSource; + dojo.io.bind({ + url:url, mimetype:"text/plain", + load:function (type, data, evt) { + //error management + if (data.match("error") == "error") { + dom = xmlParse(data); + xmlSource = dom; + if (xslData == null) { //get the stylesheet + dojo.io.bind({ + url:"js/xsl/wimba.xsl", + mimetype:"application/xml", + load:function (type, data, evt) { + xslData = data; + var xml = xsltProcess(xmlSource, xslData); + hidePopup(); + document.getElementById(div).innerHTML = xml; + }, + error:BadResult, + content:null, + method:"POST"}); + } else { + transform(xml, xslData, 'all'); + } + } else { + //launch the generation of the display + displayRssFeed(data, div); + } + }, + error:BadResult, + content:getSessionParameters(), + method:"POST"}); +} + +/* + * Create the context of the Ajax request and execute it + */ +function getRss(url, id, tab) { + if(id!=""){ + document.getElementById("rss").innerHTML = document.getElementById("loadingPopup").innerHTML; + currentId = id; + currentCourseTab = tab; + launchSimpleAjaxRequest(url, "getRss", true, "rss"); + } +} + +/* + * This function execute the ajax request to get the approppriate xml and + * the xsl. Then, It execute the xslt transformation to generate the html + * + * For IE: we used the native javascript function to get the xml,xsl by Ajax and + * excecute the xslt transformation + * + * For Firefox : we used the dojo framework to get the xml,xsl by Ajax and the native + * function to execute the xslt transformation + * + * For Safari: we used he dojo framework to get the xml,xsl by Ajax and the google library + * (Google AJAXSLT) to execute the xslt transformation because it is not supported natively + */ +function transform(urlXml, stylesheet,TypeParams, div,nextAction) { + + if(window.ActiveXObject){//ie + + if(TypeParams=="first") + params=getURLParameters(); + else + params=getUrlParameters(); + + var sourceDoc = new ActiveXObject("Microsoft.XMLDOM") + sourceDoc.async = false + if(urlXml.substr((urlXml.length-1),urlXml.length)=="?") + sourceDoc.load(urlXml +params) + else if( urlXml.substr((urlXml.length-1),urlXml.length)=="&") + sourceDoc.load(urlXml+params) + else if( urlXml.indexOf("?") == -1) + sourceDoc.load(urlXml+"?"+params) + else + sourceDoc.load(urlXml+"&"+params) + + if (div == "all" && sourceDoc.documentElement.getElementsByTagName("type")[0].childNodes[0].nodeValue!="error") { + createSessionByXmlDocument(sourceDoc); + } + + var xslDoc = new ActiveXObject("Microsoft.XMLDOM") + xslDoc.async = false + xslDoc.load("js/xsl/wimba.xsl"); + + xsltTransformation(sourceDoc,xslDoc,div,nextAction); + + }else if (window.XSLTProcessor){//firefox + if(TypeParams=="first") + params=getURLParametersTab(); + else + params=getSessionParameters(); + + dojo.io.bind({url:urlXml, mimetype:"application/xml", load:function (type, data, evt) { + + if (div == "all" && data.documentElement.getElementsByTagName("type")[0].childNodes[0].nodeValue!="error") { + createSessionByXmlDocument(data); + } + + xmlSource = data; + //get the stylesheet + dojo.io.bind({ + url:stylesheet, + mimetype:"application/xml", + load:function (type, data, evt) { + //do the xslt transformatio + xsltTransformation(xmlSource,data,div,nextAction) + + }, + error:BadResult, + content:null, + method:"GET"}); + + }, + error:BadResult, + content:params, + method:"POST"}); + + }else{ + if(TypeParams=="first") + params=getURLParametersTab(); + else + params=getSessionParameters(); + var xmlSource; + dojo.io.bind({url:urlXml, mimetype:"text/plain", load:function (type, data, evt) { + if (div == "all" && data.match("error") != "error") { + createSession(data); + } + dom = xmlParse(data); + xmlSource = dom; + + dojo.io.bind({ + url:"js/xsl/wimba.xsl", + mimetype:"application/xml", + load:function (type, data, evt) { + //do the xslt transformatio + xsltTransformation(xmlSource,data,div,nextAction) + }, + error:BadResult, + content:null, + method:"GET"}); + + + }, + error:BadResult, + content:params, + method:"POST"}); + + } + +} + +/* + * Call the appropriate function to execute the xslt transformation + * and add the html into the page + */ +function xsltTransformation(xml,xsl,div,nextAction){ + + if(window.ActiveXObject)//ie + { + var result = xml.transformNode(xsl); + if (div == "all") { + document.getElementById(div).innerHTML = result; + hidePopup(); + gestionDisplay(); + var text=new String(document.getElementById("all").innerHTML); + + } + if (div == "dialInfo") {//click on Info Button + document.getElementById(div).style.display = "block"; + document.getElementById(div).innerHTML = result; + document.getElementById(div).innerHTML = document.getElementById(div).innerHTML.replace("myform", "myFormPopup"); + opendDialInformations(); + } + if(nextAction!="") + eval(nextAction); + }else if (window.XSLTProcessor){//firefox + + var processor = new XSLTProcessor(); + processor.importStylesheet(xsl); + document.getElementById(div).innerHTML=""; + var resultDocument = processor.transformToFragment(xml, document); + + if (div == "all") { + hidePopup(); + document.getElementById(div).appendChild(resultDocument); + gestionDisplay(); + + } + if (div == "dialInfo") {//click on Info Button + document.getElementById(div).style.display = "block"; + + document.getElementById(div).appendChild(resultDocument); + document.getElementById(div).innerHTML = document.getElementById(div).innerHTML.replace("myform", "myFormPopup"); + opendDialInformations(); + } + + if(nextAction!="") + eval(nextAction); + + }else{ + + var xml = xsltProcess(xml, xsl); + + //hide the loading page + if (div == "all") { + hidePopup(); + document.getElementById(div).innerHTML = xml; + } + if (div == "dialInfo") {//click on Info Button + document.getElementById(div).style.display = "block"; + xml = xml.replace("myform", "myFormPopup"); + document.getElementById(div).innerHTML = xml; + opendDialInformations(); + } + gestionDisplay(); + if(nextAction!="") + eval(nextAction); + } + //manage the display of the accent + var content=new String(document.getElementById("all").innerHTML); + content=content.replace(/&/g,"&"); + document.getElementById("all").innerHTML=content; + var content=new String(document.getElementById("popupDial").innerHTML); + content=content.replace(/&/g,"&"); + document.getElementById("popupDial").innerHTML=content; + +} + + +function Management() +{ + +} + + +function BadResult(type, error) { + +} + +/* + * load the setting of the Lc or Vt + */ +function loadSettings(url, action, div) { + launchAjaxRequest(url, action, false, div); +} + +/* + * Load the settings of a existing element(room or voice tools) + */ +function loadNewSettings(url, action, product, type, div,createWorkflow) { + currentProduct = product; + typeSelect = type; + launchAjaxRequest(url, action, false, div,createWorkflow); +} + +/* + * Save the comment and the title of the voice recorder + */ + +function saveDatabase(url, title, comment) { + var url = url + "?action=updateRecorder&title=" + title + "&comment=" + comment; + var xml; + dojo.io.bind({url:url, mimetype:"text/plain", load:function (type, data, evt) { + if (data == "bad") { + alert("problem to save"); + } + }, error:BadResult,content:getURLParametersTab(), method:"POST"}); + +} + +/* + * Get the dial-in informations fo a specific room + */ +function showInformation(url, id, product) { + currentId = id; + currentProduct = product; + displayBackground(); + launchAjaxRequest(url, "getDialInformation", "false", "dialInfo"); +} + +/* + * Save the settings of a existing room. It used to save the room settings before + * launch the advanced settings + */ +function saveSettings(url, id) { + + url = url + "?action=saveSettings&id=" + id; + var returnValue = true; + var xml; + dojo.io.bind({url:url, mimetype:"text/plain", load:function (type, data, evt) { + if (data == "bad") { + alert("problem to save the new Settings"); + returnValue = false; + } + + }, error:BadResult, content:getForm(window.document.myform), method:"POST"}); + return returnValue; +} + +/* + * get the value of all the input elements of the form + */ +function getForm(obj) { + + var params = getSessionParameters(); + inputForm = obj.getElementsByTagName("input"); + var i=0; + for (i = 0; i < inputForm.length; i++) { + if (inputForm[i].type == "text") { + params[inputForm[i].name] = inputForm[i].value; + } + if (inputForm[i].type == "checkbox") { + if (inputForm[i].checked) { + params[inputForm[i].name] = inputForm[i].value; + } else { + params[inputForm[i].name] = "false"; + } + } + if (inputForm[i].type == "radio") { + if (inputForm[i].checked) { + params[inputForm[i].name] = inputForm[i].value; + } + } + } + inputForm = obj.getElementsByTagName("select"); + for (i = 0; i < inputForm.length; i++) { + var sel = inputForm[i]; + params[sel.name] = sel.options[sel.selectedIndex].value; + } + inputForm = obj.getElementsByTagName("textarea"); + for (i = 0; i < inputForm.length; i++) { + params[inputForm[i].name] = inputForm[i].value; + } + return params; +} + Modified: trunk/moodle/mod/liveclassroom/js/constants.js =================================================================== --- trunk/moodle/mod/liveclassroom/js/constants.js 2008-01-09 10:36:38 UTC (rev 199) +++ trunk/moodle/mod/liveclassroom/js/constants.js 2008-01-09 11:37:50 UTC (rev 200) @@ -57,4 +57,5 @@ var xmlDoc; var xslData=null; var lcPopup=null; +var expandState=0; Modified: trunk/moodle/mod/liveclassroom/js/hwCommons.js =================================================================== --- trunk/moodle/mod/liveclassroom/js/hwCommons.js 2008-01-09 10:36:38 UTC (rev 199) +++ trunk/moodle/mod/liveclassroom/js/hwCommons.js 2008-01-09 11:37:50 UTC (rev 200) @@ -1,4 +1,4 @@ -/****************************************************************************** +/****************************************************************************** * * * Copyright (c) 1999-2007 Wimba, All Rights Reserved. * * * @@ -30,6 +30,7 @@ } return false; } + function isIE6() { var userAgent = navigator.userAgent; var start = userAgent.indexOf("(", 0); @@ -49,75 +50,123 @@ return false; } } +/* + * Manage the search of a specific element. This function is called every time + * when the user type a letter into the search field + */ function searchResource(searchValue) { activateFilter("all") var display = "table-row"; if (isInternetExplorer()) { display = "block"; - } - //manage the button - if (currentId != "") { + } + if (currentId != "") {//deselect the current element document.getElementById(currentId).style.backgroundColor = "white"; } - currentId = ""; + + searchValueLength=searchValue.length-1; + if(searchValue.indexOf("\"")==0 && searchValue.lastIndexOf("\"")==searchValueLength && searchValue.length>1) { + searchValue=searchValue.substr(1,(searchValueLength-1)); + } + + currentId = "";//init the current id because no element is selected var match = false; - var list = document.getElementById("list"); - var product = list.getElementsByTagName("div"); + var list = document.getElementById("list");//get the part which contains the global list + var product = list.getElementsByTagName("div");//get the products for (var i = 0; i < product.length; i++) { - var elements = product[i].getElementsByTagName("tr"); + var elements = product[i].getElementsByTagName("tr");//get the elements of this product var numMatch = 0; for (var x = 0; x < elements.length; x++) { - if (elements[x].getAttribute("typeProduct") != null && elements[x].getAttribute("stateStudentView") != "ignore") {//list element - + //if the current element is available for search + if (elements[x].getAttribute("typeProduct") != null && elements[x].getAttribute("stateStudentView") != "ignore") { if (searchValue == "") {//init elements[x].style.backgroundColor = "white"; - if (elements[x].getAttribute("typeProduct") == "archive" && elements[x - 1].getAttribute("preview") != "unavalaible") { - elements[x].className = "archiveHide"; - var pictureId = elements[x - 1].id + "_ExpandPicture"; - changePicture(pictureId, "pictures/items/listitem-show.png"); + if (elements[x + 1]!=null && elements[x + 1].getAttribute("typeProduct") == "archive") { + var roomLinked=x; + var archiveMatched=0; + while (elements[x + 1].getAttribute("typeProduct") == "archive" ) { + if(elements[x+1].getAttribute("stateStudentView") != "ignore"){ + elements[x + 1].className = "archiveHide"; + archiveMatched++ + } + x++; + } + + if(archiveMatched>0){//change the pciture + var pictureId = elements[roomLinked].id + "_ExpandPicture"; + changePicture(pictureId, "pictures/items/listitem-show.png"); + } + elements[roomLinked].setAttribute("stateSearch", "");//change the status of the element to manage the display + elements[roomLinked].style.display = display; } else { - if (studentView == true && elements[x].getAttribute("typeProduct") == "orphanedarchivestudent") { - elements[x].style.display = display; - elements[x].setAttribute("stateSearch", ""); - } else { - if (elements[x].getAttribute("stateStudentView") != "ignore" && elements[x].getAttribute("typeProduct") != "orphanedarchivestudent") { + if (studentView == true && elements[x].getAttribute("typeProduct") == "orphanedarchivestudent") { elements[x].style.display = display; elements[x].setAttribute("stateSearch", ""); - } - } + } else { + if (elements[x].getAttribute("stateStudentView") != "ignore" && elements[x].getAttribute("typeProduct") != "orphanedarchivestudent") { + elements[x].style.display = display; + elements[x].setAttribute("stateSearch", ""); + } + } } } else { + //if the element match if (elements[x].getAttribute("name")!=null && elements[x].getAttribute("name").toLowerCase().match(searchValue.toLowerCase())) { numMatch++; - if (numMatch == 1 && match != true) { + if (numMatch == 1 && match != true) {//first of the list will be selected elements[x].style.backgroundColor = "#c3dbf7"; currentId = elements[x].id; match = true; } elements[x].style.display = display; - elements[x].setAttribute("stateSearch", ""); + elements[x].setAttribute("stateSearch", "");//this element is match by the search var pictureId = elements[x].id + "_ExpandPicture"; - if (document.getElementById(pictureId) != null) { - changePicture(pictureId, "pictures/items/listitem-hide.png"); + if (document.getElementById(pictureId) != null) {//if archive available + var roomLinked=x; + var archiveMatched=0; while (elements[x + 1].getAttribute("typeProduct") == "archive") { - elements[x + 1].className = "archive"; - elements[x + 1].setAttribute("stateSearch", ""); - x++; + if(elements[x + 1].getAttribute("name").toLowerCase().match(searchValue.toLowerCase()) && elements[x+1].getAttribute("stateStudentView") != "ignore" ){ + elements[x + 1].className = "archive"; + elements[x + 1].setAttribute("stateSearch", ""); + archiveMatched++; + } + x++; } + //management of the picture to expand the archives + if(archiveMatched>0){ + var pictureId = elements[roomLinked].id + "_ExpandPicture"; + changePicture(pictureId, "pictures/items/listitem-hide.png"); + }else{ + var pictureId = elements[roomLinked].id + "_ExpandPicture"; + changePicture(pictureId, "pictures/items/space-16px.png"); + } } } else { - if (elements[x + 1] != null && elements[x + 1].getAttribute("name")!=null && elements[x + 1].getAttribute("name").match(searchValue) && elements[x + 1].getAttribute("typeProduct") == "archive") { - elements[x].style.display = display; - elements[x].setAttribute("stateSearch", ""); - var pictureId = elements[x].id + "_ExpandPicture"; - changePicture(pictureId, "pictures/items/listitem-hide.png"); - while (elements[x + 1].getAttribute("typeProduct") == "archive") { - elements[x + 1].className = "archive"; - elements[x + 1].setAttribute("stateSearch", ""); - x++; + //if a archive of the element matches the search + //the room will be displayed and the archive expanded + if (elements[x + 1] != null && elements[x + 1].getAttribute("name")!=null && elements[x + 1].getAttribute("typeProduct") == "archive") { + var archiveMatched=0; + var roomLinked=x; + while (elements[x + 1].getAttribute("typeProduct") == "archive") { + if(elements[x + 1].getAttribute("name").toLowerCase().match(searchValue.toLowerCase())&& elements[x+1].getAttribute("stateStudentView") != "ignore"){ + elements[x + 1].className = "archive"; + elements[x + 1].setAttribute("stateSearch", ""); + archiveMatched++; + } + x++; } + if(archiveMatched>0){ + elements[roomLinked].style.display = display; + elements[roomLinked].setAttribute("stateSearch", ""); + var pictureId = elements[roomLinked].id + "_ExpandPicture"; + changePicture(pictureId, "pictures/items/listitem-hide.png"); + }else{ + elements[roomLinked].style.display = "none"; + elements[roomLinked].setAttribute("stateSearch", "ignore"); + } } else { + //if the archive doesn't match, the archive will be hide if (elements[x].getAttribute("typeProduct") == "archive") { elements[x].className = "archiveHide"; } else { @@ -132,6 +181,7 @@ } gestionDisplay(); } + /* * Function called when the user click on a list elements */ @@ -151,7 +201,7 @@ } } - + //update the current context currentId = id; currentProduct = product; typeSelect = type; @@ -159,29 +209,47 @@ EnabledToolBar(); } } + +/* + * Manage the expand/collapse of the archive list + * + */ function hideArchive(id) { var archiveAvailable=false; var div = document.getElementById("div_" + LC_PRODUCT); + var name = "div_" + LC_PRODUCT; + var nameMore = "div_" + LC_PRODUCT +"_More"; var listRoomsArchives = div.getElementsByTagName("tr"); + var numHide=0; for (var i = 0; i < listRoomsArchives.length; i++) { if (listRoomsArchives[i].getAttribute("typeProduct") == "archive" && listRoomsArchives[i].getAttribute("id").match(id)) { + //test if the current is available : not displayed yet and not ignored by the switched to student view if (listRoomsArchives[i].className == "archiveHide" && listRoomsArchives[i].getAttribute("stateStudentView")!="ignore") { - listRoomsArchives[i].className = "archive"; - + listRoomsArchives[i].className = "archive"; //make this archive visible archiveAvailable=true; } else { listRoomsArchives[i].className = "archiveHide"; + numHide=1+numHide; } } } if(archiveAvailable==true){ changePicture(id + "_ExpandPicture", "pictures/items/listitem-hide.png"); div.style.height=""; - } + document.getElementById(nameMore).innerHTML = "<label class='moreRoom' onclick='RemoveAllDiv(\"" + name + "\",\"" + nameMore + "\",\"" + (listRoomsArchives.length-numHide) + "\")'>Show Top 5...</label>"; + expandState=1; + } else{ changePicture(id + "_ExpandPicture", "pictures/items/listitem-show.png"); - - } + if(expandState!=1) + document.getElementById(nameMore).innerHTML = "<label class='moreRoom' onclick='displayAllDiv(\"" + name + "\",\"" + nameMore + "\",\"" + (listRoomsArchives.length-numHide) + "\")'>"+(listRoomsArchives.length-numHide-5)+" more...</label>"; + else + document.getElementById(nameMore).innerHTML = "<label class='moreRoom' onclick='RemoveAllDiv(\"" + name + "\",\"" + nameMore + "\",\"" + (listRoomsArchives.length-numHide) + "\")'>Show Top 5...</label>"; + } + if (currentId != "") { + document.getElementById(currentId).style.backgroundColor = "white"; + } + currentId = ""; } /* * This function changes the state of the button when the user click on an element @@ -193,9 +261,8 @@ for (var x = 0; x < td.length; x++) { if (td[x].getAttribute("context") == "all" || document.getElementById("view")!=null && document.getElementById("view").value == "normal" || (td[x].getAttribute("context") != "instructor" && document.getElementById("view")!=null && document.getElementById("view").value == "student")) { if (td[x].getAttribute("type") == "button") { - + //test if this button has to be displayed for the current tools selected if (td[x].getAttribute("product") == "all" || td[x].getAttribute("product") == currentProduct) { - td[x].innerHTML = td[x].innerHTML.replace("disabled.png", "enabled.png"); td[x].className = "button_enabled"; } else { @@ -206,8 +273,10 @@ } } } + /* -* This function initializes the toolbar +* This function initializes the toolbar : +* It disables the */ function InitToolBar() { var toolBar = document.getElementById("toolBar"); @@ -223,7 +292,7 @@ } /* * This function manage the studentView : -* Remove the buttons not available for the student and remove the unavaible elements +* Remove the buttons not available for the student and remove the unavailable elements */ function switchView() { var display = "table-row"; @@ -269,17 +338,14 @@ for (var i = 0; i < elements.length; i++) { //show the element not match by search elements[i].setAttribute("stateSearch", ""); - if (elements[i].getAttribute("preview") == "unavailable" && document.getElementById("view").value == "student") { - if (elements[i].getAttribute("typeProduct") == "archive" && elements[i + 1] != null && elements[i + 1].getAttribute("typeProduct") != "archive") { - var pictureId = elements[i - 1].id + "_ExpandPicture"; - changePicture(pictureId, "pictures/items/space-16px.png"); - } else {//room - elements[i].setAttribute("stateStudentView", "ignore"); + // the unavailable elements are not displayed for the student + if (document.getElementById("view").value == "student") { + if(elements[i].getAttribute("preview") == "unavailable"){ + elements[i].setAttribute("stateStudentView", "ignore");//change the status of this element for the search elements[i].style.display = "none"; - var pictureId = elements[i].id + "_ExpandPicture"; - changePicture(pictureId, "pictures/items/listitem-show.png"); - if (elements[i + 1] != null && elements[i + 1].getAttribute("typeProduct") == "archive") { - + if(elements[i + 1] != null && elements[i + 1].getAttribute("typeProduct") == "archive"){//this room contains archives + document.getElementById(elements[linkedRoom].id + "_ExpandPicture").style.visibility="visible"; + changePicture(document.getElementById(elements[linkedRoom].id + "_ExpandPicture"), "pictures/items/listitem-show.png"); while (elements[i + 1].getAttribute("typeProduct") == "archive") { elements[i + 1].className = "archiveHide"; elements[i + 1].setAttribute("stateStudentView", "ignore"); @@ -287,63 +353,64 @@ } } - } - } else { - if ((elements[i].getAttribute("typeProduct") == "orphanedarchivestudent" && document.getElementById("view").value == "student")) { + }else if(elements[i].getAttribute("typeProduct") == "orphanedarchivestudent"){ elements[i].style.display = display; - } else { - if (elements[i].getAttribute("typeProduct") == "orphanedarchivestudent" && document.getElementById("view").value == "normal") { - elements[i].style.display = "none"; - } else { - if (document.getElementById("view").value == "normal") { - elements[i].setAttribute("stateStudentView", ""); - if (elements[i].getAttribute("typeProduct") != "archive") { - var pictureId = elements[i].id + "_ExpandPicture"; - changePicture(pictureId, "pictures/items/listitem-show.png"); - elements[i].style.display = display; - } else { - elements[i].style.display = ""; + }else{ + if(elements[i + 1] != null && elements[i + 1].getAttribute("typeProduct") == "archive"){//this room contains archives + var linkedRoom=i; + var archiveMatched=0; + while (elements[i + 1].getAttribute("typeProduct") == "archive") { + if(elements[i+1].getAttribute("preview") == "unavailable"){ + elements[i + 1].className = "archiveHide"; + elements[i + 1].setAttribute("stateStudentView", "ignore"); + }else{ + archiveMatched++; } - }else{ - if (elements[i + 1] != null && elements[i + 1].getAttribute("typeProduct") == "archive") { - var isArchiveExist=false; - var pictureId = elements[i].id + "_ExpandPicture"; - while (elements[i + 1].getAttribute("typeProduct") == "archive") { - elements[i + 1].className = "archiveHide"; - if(elements[i + 1].getAttribute("preview")=="unavailable") { - - elements[i + 1].setAttribute("stateStudentView", "ignore"); - - }else{ - - isArchiveExist=true; - } - i++; - } - if(isArchiveExist==false){ - - changePicture(pictureId, "pictures/items/space-16px.png"); - }else{ - changePicture(pictureId, "pictures/items/listitem-show.png"); - } - } - } + i++ + } + if(archiveMatched==0){//hide the element which allow the expand/collapse + document.getElementById(elements[linkedRoom].id + "_ExpandPicture").style.visibility="hidden"; + changePicture(document.getElementById(elements[linkedRoom].id + "_ExpandPicture"), "pictures/items/listitem-show.png"); + + } } + } + } else {//normal view + //the available archives linked to a unavailable room are displayed(name orphanedArchiveForStudent) for the student + if (elements[i].getAttribute("typeProduct") == "orphanedarchivestudent" && document.getElementById("view").value == "normal") { + elements[i].style.display = "none"; + } else { + + elements[i].setAttribute("stateStudentView", "");//init the context + if (elements[i].getAttribute("typeProduct") != "archive") { + elements[i].style.display = display; + if(elements[i+1]!=null && elements[i+1].getAttribute("typeProduct") == "archive"){ + document.getElementById(elements[i].id + "_ExpandPicture").style.visibility="visible"; + changePicture(document.getElementById(elements[i].id + "_ExpandPicture"), "pictures/items/listitem-show.png"); + + } + } else { + elements[i].style.display = ""; + } + } } } } gestionDisplay(); } -function getIdParameters(id) { - var tabId = id.split("_"); - //0=type - //1=id - //2=status - return tabId; -} + function activateFilter(product) { var otherProduct = LC_PRODUCT; + if (currentId != "") { + document.getElementById(currentId).style.backgroundColor = "white"; + } + InitToolBar();//the toolbar has to be initialized + currentDiv = product; + currentId = ""; + currentNid = ""; + currentProduct = ""; + isFilter = true; changeFilterStatus(currentFilter, "disabled"); changeFilterStatus("filter_" + product, "enabled"); @@ -351,12 +418,7 @@ if (document.getElementById(currentId) != null) { document.getElementById(currentId).style.background = "white"; } - InitToolBar(); - currentDiv = product; - currentId = ""; - currentNid = ""; - currentProduct = ""; - isFilter = true; + //display only the selected product into the list var list = document.getElementById("list"); var innerList = list.getElementsByTagName("div"); for (var i = 0; i < innerList.length; i++) { @@ -376,6 +438,7 @@ } } } + /* * manage the rollover of the filter */ @@ -396,14 +459,13 @@ document.getElementById(id).className = "filter" + status; } } + function gestionDisplay(product) { var more = "more"; if (navigator.language == "fr") { more = "de plus"; - } - - - //manage the heigth + } + //manage the heigth for the choice panel var productChoice = document.getElementById("productChoice"); if (productChoice != null) { var products = productChoice.getElementsByTagName("tr"); @@ -415,24 +477,43 @@ products[i].className = style; } } + + + if(document.getElementById("collapsePictureliveclassroom")) { + changePicture("collapsePictureliveclassroom", "pictures/items/category-expanded.png"); + document.getElementById("div_liveclassroom").setAttribute("state", "expand"); + } + if(document.getElementById("collapsePictureboard")) { + changePicture("collapsePictureboard", "pictures/items/category-expanded.png"); + document.getElementById("div_board").setAttribute("state", "expand"); + } + if(document.getElementById("collapsePicturepresentation")) { + changePicture("collapsePicturepresentation", "pictures/items/category-expanded.png"); + document.getElementById("div_presentation").setAttribute("state", "expand"); + } + if(document.getElementById("collapsePicturepc")) { + changePicture("collapsePicturepc", "pictures/items/category-expanded.png"); + document.getElementById("div_pc").setAttribute("state", "expand"); + } + + //manage the display of the list var list = document.getElementById('list') if(list!=null){ var products=list.getElementsByTagName("div") for( var i = 0; i < products.length; i++ ) { if(products[i].getAttribute("typeElement")=="productList" && (product==products[i].getAttribute("product") || product==null)){ var divProductMore=document.getElementById('div_'+products[i].getAttribute("typeproduct")+'_More'); - var divProductNoElement=document.getElementById('div_'+products[i].getAttribute("typeproduct")+'_NoElement'); var tr=products[i].getElementsByTagName("tr"); var numElement=0; + //count the number of element available of the current product for(var j=0;j<tr.length;j++){ - if(tr[j].getAttribute("typeProduct")==products[i].getAttribute("typeProduct") || document.getElementById("view")!=null && document.getElementById("view").value == "student" && tr[j].getAttribute("typeProduct")=="orphanedarchivestudent" ) + if(tr[j].getAttribute("typeProduct")==products[i].getAttribute("typeProduct") || document.getElementById("view")!=null && document.getElementById("view").value == "student" && tr[j].getAttribute("typeProduct")=="orphanedarchivestudent" || (products[i].getAttribute("typeProduct") == LC_PRODUCT && tr[j].getAttribute("typeProduct")=="orphanedarchive") ) if(tr[j].getAttribute("stateSearch")!="ignore" && tr[j].getAttribute("stateStudentView")!="ignore") numElement++; } - //4 div per product - + //4 div per product if(numElement > 5 && product==null && products.length>4){ products[i].style.height = 5 * 19 + "px"; divProductMore.style.display = "block"; @@ -441,15 +522,13 @@ divProductNoElement.style.display = "none"; }else if(numElement == 0){ products[i].style.display = "none"; - - divProductNoElement.style.display = "block"; divProductMore.style.display = "none"; }else{ products[i].style.display = "block"; products[i].style.height = ""; divProductMore.style.display = "none"; - divProductNoElement.style.display = "none"; + divProductNoElement.style.display = "none"; } } } @@ -461,22 +540,35 @@ } } + +/* + * Called to display the complete list of element for a product + */ function displayAllDiv(name, nameMore, number) { if (currentId != "") { document.getElementById(currentId).style.backgroundColor = "white"; } currentId = ""; + expandState = 1; document.getElementById(name).style.height = ""; document.getElementById(nameMore).innerHTML = "<label class='moreRoom' onclick='RemoveAllDiv(\"" + name + "\",\"" + nameMore + "\",\"" + number + "\")'>Show Top 5...</label>"; } +/* + * Called to hide the complete list of element and display just 5 elements + */ function RemoveAllDiv(name, nameMore, number) { if (currentId != "") { document.getElementById(currentId).style.backgroundColor = "white"; } currentId = ""; + expandState = 0; document.getElementById(name).style.height = 5 * 19 + "px"; document.getElementById(nameMore).innerHTML = "<label class='moreRoom' onclick='displayAllDiv(\"" + name + "\",\"" + nameMore + "\",\"" + number + "\")'>" + (number - 5) + " more...</label>"; } + +/* + * Called to hide the complete list of elements + */ function collapseGroupElement(product, pictureId) { var divProduct = document.getElementById("div_" + product); var divProductMore = document.getElementById("div_" + product + "_More"); @@ -488,7 +580,11 @@ divProduct.setAttribute("state", "collapse"); } else { divProduct.style.display = "block"; - divProductMore.style.display = "block"; + if(currentFilter == "filter_all") { + divProductMore.style.display = "block"; + } else { + divProductMore.style.display = "none"; + } changePicture(pictureId, "pictures/items/category-expanded.png"); divProduct.setAttribute("state", "expand"); } @@ -504,10 +600,14 @@ } else { if (document.getElementById(id) != null) { document.getElementById(id).src = pictureUrl; - // alert( document.images[id].src); + } } } + +/* + * Filled the session array thanks to the xmlDocument + */ function createSessionByXmlDocument(data) { objDomTree = data.documentElement; @@ -598,8 +698,9 @@ } - -//element function +/* + * Manage the launch of an element switch the context + */ function LaunchElement(url) { if (currentProduct == LC_PRODUCT) { LaunchLiveClassroom(url); @@ -609,6 +710,9 @@ } } } +/* + * Launch the LiveClassroom into a popup + */ function LaunchLiveClassroom(url, params) { var result = true; if (session["role"] == "StudentBis" || (session["role"] == "Instructor" && studentView == true)) { @@ -619,8 +723,12 @@ window.open(complete_url, "lc_popup", "scrollbars=no,resizable=yes,width=700,height=500"); } } +/* + * Launch the VoiceTools into a popup + */ function LaunchVoiceTools(url, params) { var result = true; + //Student view if (session["role"] == "StudentBis" || (session["role"] == "Instructor" && studentView == true)) { result = window.confirm("You are in Student View.\nYou will not have access to instructor features."); } @@ -631,22 +739,23 @@ } -//settings function +/* + * function called when you click on a tab in the settings + */ function onTab(id, additionalfunction) { - if (advancedSettings == true) { + if (advancedSettings == true && document.getElementById("tab" + id).className != "tabDisabled") { advancedSettings = false; currentIdtab = id;... [truncated message content] |