[Hw4mdl-svn] SF.net SVN: hw4mdl: [240] branches/team/Thomas/integrations_common
Brought to you by:
jhlinder,
trollinger
From: <tro...@us...> - 2008-02-11 21:15:41
|
Revision: 240 http://hw4mdl.svn.sourceforge.net/hw4mdl/?rev=240&view=rev Author: trollinger Date: 2008-02-11 13:15:38 -0800 (Mon, 11 Feb 2008) Log Message: ----------- -handle error -add logs Modified Paths: -------------- branches/team/Thomas/integrations_common/php/common/WimbaLib.php branches/team/Thomas/integrations_common/php/common/WimbaXml.php branches/team/Thomas/integrations_common/web/js/ajax.js branches/team/Thomas/integrations_common/web/js/hwCommons.js branches/team/Thomas/integrations_common/web/js/xsl/wimba.xsl Modified: branches/team/Thomas/integrations_common/php/common/WimbaLib.php =================================================================== --- branches/team/Thomas/integrations_common/php/common/WimbaLib.php 2008-02-05 22:48:13 UTC (rev 239) +++ branches/team/Thomas/integrations_common/php/common/WimbaLib.php 2008-02-11 21:15:38 UTC (rev 240) @@ -1,5 +1,10 @@ <?php +define('WIMBA_INFO', 'info'); +define('WIMBA_WARN', 'warn'); +define('WIMBA_ERROR', 'error'); +define('WIMBA_DEBUG', 'debug'); +define('WIMBA_DIR', $CFG->dataroot . "/wimba"); /** * Returns the keys of the general parameters passed by GET or POST */ @@ -155,13 +160,15 @@ function manage_error($errno, $error, $file, $line, $context) { - global $CFG; - if ($errno < 10) { - redirection('welcome.php?error=rrr'); + + if ($errno == E_USER_ERROR or $errno == E_ERROR) { + wimba_add_log(WIMBA_ERROR,"general",$error); + } - if ($errno < 10) { - // add to log - } + else + { + wimba_add_log(WIMBA_DEBUG,"general",$error); + } } function txt($string) @@ -262,12 +269,15 @@ } } -function storeResource($rid, $params) +function storeResource($rid,$course_id, $params) { $voicetools = new Object(); $voicetools->rid = $rid; - $voicetools->course = $params["course_id"]; - $voicetools->name = $params["name"]; + $voicetools->course = $course_id; + if(isset($params["name"])) + { + $voicetools->name = $params["name"]; + } $voicetools->type = $params["type"]; if ($params != null) @@ -303,11 +313,11 @@ return voicetools_store_new_element($voicetools); } -function updateResource($rid, $params) +function updateResource($rid,$course_id, $params) { $voicetools = new Object(); $voicetools->rid = $rid; - $voicetools->course = $params["course_id"]; + $voicetools->course = $course_id; $voicetools->type = $params["type"]; $voicetools->availability = $params["accessAvailable"]; @@ -372,4 +382,48 @@ return $preview; } + +/**Add logs in moodledata + * param : the level og the log ('info', 'warn','error' or 'debug'), the message to display on the log + * return : void, store the log in MOODLEDATADIR/wimba/logs/LEVEL + */ +function wimba_add_log($level,$product,$message){ + +//Set the log level values. +$level_values = array( + WIMBA_DEBUG => 1, + WIMBA_INFO => 2, + WIMBA_WARN => 3, + WIMBA_ERROR => 4 +); + global $CFG; + + $log_product = $product."_log_level"; +//Write on the logs only if the configured level allows it. + if ($product=="general" ||$level_values[$level] >= $CFG->$log_product){ + + // Gets the site shortname + $site = get_record('course','id',SITEID); + + //Computes the timestamp corresponding to the day (at 00:00:00). + $today_timestamp = @mktime(0, 0, 0, date("m"), date("d"), date("Y")); + + //If it doesn't exist, create the log folder' + @mkdir(WIMBA_DIR, 0700); + + @mkdir(WIMBA_DIR . "/" . $product, 0700); + + $wimba_logs= WIMBA_DIR . "/" . $product . "/logs"; + @mkdir($wimba_logs, 0700); + + //Computes the log filename. Space characters are replaced by unerscore, to have a correct filename. + $file = $wimba_logs."/".str_replace(' ','_',$site->shortname)."-".$today_timestamp."-wimba.log"; + + //Writes the message in the log, and close it + $fh = @fopen($file, "a"); + @fwrite($fh,gmdate("Y-m-d H:i:s")." ".strtoupper($level)." ".$product." - ".$message."\n"); + @fclose($fh); + } +} + ?> Modified: branches/team/Thomas/integrations_common/php/common/WimbaXml.php =================================================================== --- branches/team/Thomas/integrations_common/php/common/WimbaXml.php 2008-02-05 22:48:13 UTC (rev 239) +++ branches/team/Thomas/integrations_common/php/common/WimbaXml.php 2008-02-11 21:15:38 UTC (rev 240) @@ -813,7 +813,7 @@ $ephones = $this->xmldoc->create_element("phones"); $ephoneL = $this->xmldoc->create_element("phoneLabel"); $ephoneL->append_child($this->xmldoc->create_text_node($phoneLabel)); - $ephones->append_child(ephoneL); + $ephones->append_child($ephoneL); foreach ($toll as $key => $value) { if($key!="" && $value!="") Modified: branches/team/Thomas/integrations_common/web/js/ajax.js =================================================================== --- branches/team/Thomas/integrations_common/web/js/ajax.js 2008-02-05 22:48:13 UTC (rev 239) +++ branches/team/Thomas/integrations_common/web/js/ajax.js 2008-02-11 21:15:38 UTC (rev 240) @@ -161,6 +161,7 @@ if (action != null) { url += "?action=" + action; } + transform(url,"first",div,nextAction) } @@ -224,6 +225,7 @@ url:pathXsl, mimetype:"application/xml", load:function (type, data, evt) { + xslData = data; var xml = xsltProcess(xmlSource, xslData); hidePopup(); @@ -271,7 +273,7 @@ * (Google AJAXSLT) to execute the xslt transformation because it is not supported natively */ function transform(urlXml,TypeParams, div,nextAction) { - + if(window.ActiveXObject){//ie if(TypeParams=="first") @@ -300,28 +302,28 @@ xsltTransformation(sourceDoc,xslDoc,div,nextAction); - }else if (window.XSLTProcessor){//firefox + } + 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:pathXsl, mimetype:"application/xml", load:function (type, data, evt) { - //do the xslt transformatio - + //do the xslt transformation xsltTransformation(xmlSource,data,div,nextAction) - }, error:BadResult, content:null, @@ -371,7 +373,7 @@ * and add the html into the page */ function xsltTransformation(xml,xsl,div,nextAction){ - + if(window.ActiveXObject)//ie { var result = xml.transformNode(xsl); @@ -394,7 +396,7 @@ var processor = new XSLTProcessor(); processor.setParameter(null, 'pathPictures', pathPictures); - + processor.importStylesheet(xsl); document.getElementById(div).innerHTML=""; var resultDocument = processor.transformToFragment(xml, document); @@ -416,10 +418,10 @@ if(nextAction!="") eval(nextAction); - }else{ - + } + else + { var xml = xsltProcess(xml, xsl); - //hide the loading page if (div == "all") { hidePopup(); Modified: branches/team/Thomas/integrations_common/web/js/hwCommons.js =================================================================== --- branches/team/Thomas/integrations_common/web/js/hwCommons.js 2008-02-05 22:48:13 UTC (rev 239) +++ branches/team/Thomas/integrations_common/web/js/hwCommons.js 2008-02-11 21:15:38 UTC (rev 240) @@ -94,7 +94,7 @@ if(archiveMatched>0){//change the pciture var pictureId = elements[roomLinked].id + "_ExpandPicture"; - changePicture(pictureId, pathPictures+"listitem-show.png"); + changePicture(pictureId, pathPictures+"/items/listitem-show.png"); } elements[roomLinked].setAttribute("stateSearch", "");//change the status of the element to manage the display elements[roomLinked].style.display = display; @@ -136,10 +136,10 @@ //management of the picture to expand the archives if(archiveMatched>0){ var pictureId = elements[roomLinked].id + "_ExpandPicture"; - changePicture(pictureId, pathPictures+"listitem-hide.png"); + changePicture(pictureId, pathPictures+"/items/listitem-hide.png"); }else{ var pictureId = elements[roomLinked].id + "_ExpandPicture"; - changePicture(pictureId, pathPictures+"space-16px.png"); + changePicture(pictureId, pathPictures+"/items/space-16px.png"); } } } else { @@ -160,7 +160,7 @@ elements[roomLinked].style.display = display; elements[roomLinked].setAttribute("stateSearch", ""); var pictureId = elements[roomLinked].id + "_ExpandPicture"; - changePicture(pictureId, pathPictures+"listitem-hide.png"); + changePicture(pictureId, pathPictures+"/items/listitem-hide.png"); }else{ elements[roomLinked].style.display = "none"; elements[roomLinked].setAttribute("stateSearch", "ignore"); @@ -189,18 +189,18 @@ if (currentId != "" && currentId != id) { document.getElementById(currentId).style.backgroundColor = "white"; if(document.getElementById(currentId).getAttribute("typeProduct")=="archive"){ - document.getElementById(currentId+"_archive_subitem").src=pathPictures+"listitem-subitem.jpg"; - document.getElementById(currentId+"_archive_icon").src=pathPictures+"listitem-archiveicon.jpg"; + document.getElementById(currentId+"_archive_subitem").src=pathPictures+"/items/listitem-subitem.jpg"; + document.getElementById(currentId+"_archive_icon").src=pathPictures+"/items/listitem-archiveicon.jpg"; } } if (lineCurrentId != id) { document.getElementById(id).style.backgroundColor = "#c3dbf7"; if(type=="archive"){ - document.getElementById(id+"_archive_subitem").src=pathPictures+"listitem-subitem-selected.jpg"; - document.getElementById(id+"_archive_icon").src=pathPictures+"listitem-archiveicon-selected.jpg"; + document.getElementById(id+"_archive_subitem").src=pathPictures+"/items/listitem-subitem-selected.jpg"; + document.getElementById(id+"_archive_icon").src=pathPictures+"/items/listitem-archiveicon-selected.jpg"; } } - + //update the current context currentId = id; currentProduct = product; @@ -234,13 +234,13 @@ } } if(archiveAvailable==true){ - changePicture(id + "_ExpandPicture", pathPictures+"listitem-hide.png"); + changePicture(id + "_ExpandPicture", pathPictures+"/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", pathPictures+"listitem-show.png"); + changePicture(id + "_ExpandPicture", pathPictures+"/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 @@ -345,7 +345,7 @@ elements[i].style.display = "none"; 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"), pathPictures+"listitem-show.png"); + changePicture(document.getElementById(elements[linkedRoom].id + "_ExpandPicture"), pathPictures+"/items/listitem-show.png"); while (elements[i + 1].getAttribute("typeProduct") == "archive") { elements[i + 1].className = "archiveHide"; elements[i + 1].setAttribute("stateStudentView", "ignore"); @@ -370,7 +370,7 @@ } 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"), pathPictures+"listitem-show.png"); + changePicture(document.getElementById(elements[linkedRoom].id + "_ExpandPicture"), pathPictures+"/items/listitem-show.png"); } } @@ -387,7 +387,7 @@ 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"), pathPictures+"listitem-show.png"); + changePicture(document.getElementById(elements[i].id + "_ExpandPicture"), pathPictures+"/items/listitem-show.png"); } } else { @@ -447,6 +447,7 @@ changeFilterStatus(id, "rollover"); } } + function outFilter(id) { if (currentFilter == id) { changeFilterStatus(id, "enabled"); @@ -454,6 +455,7 @@ changeFilterStatus(id, "disabled"); } } + function changeFilterStatus(id, status) { if (document.getElementById(id) != null) { document.getElementById(id).className = "filter" + status; @@ -609,7 +611,7 @@ * Filled the session array thanks to the xmlDocument */ function createSessionByXmlDocument(data) { - + objDomTree = data.documentElement; if (objDomTree.getElementsByTagName("timeOfLoad")[0].hasChildNodes() == true) @@ -647,7 +649,6 @@ else session["role"] =""; - //preload all the pictures } @@ -710,6 +711,7 @@ } } } + /* * Launch the LiveClassroom into a popup */ @@ -723,6 +725,7 @@ window.open(complete_url, "lc_popup", "scrollbars=no,resizable=yes,width=700,height=500"); } } + /* * Launch the VoiceTools into a popup */ Modified: branches/team/Thomas/integrations_common/web/js/xsl/wimba.xsl =================================================================== --- branches/team/Thomas/integrations_common/web/js/xsl/wimba.xsl 2008-02-05 22:48:13 UTC (rev 239) +++ branches/team/Thomas/integrations_common/web/js/xsl/wimba.xsl 2008-02-11 21:15:38 UTC (rev 240) @@ -41,20 +41,24 @@ <div class="popupDialContainer"> <xsl:if test="popupDial/phones/phone!=''"> <div class="popupDialContent"> - <table cellspacing="0" cellpadding="0" border="0" > + <table cellspacing="0" cellpadding="0" border="0" > + <tr> + <td colspan="2"> + <label class='nameElement'> + <xsl:value-of select="popupDial/phones/phoneLabel" /> + </label> + </td> + </tr> <xsl:for-each select="popupDial/phones/phone"> <xsl:choose> - <xsl:when test="position()=1"> + <xsl:when test="position()=1"> <tr> - <td align="right" style="width:143px;"> - <xsl:value-of select="preceding::phoneLabel[1]" /> - </td> - <td align="right" style="width:95px;"> - <label class='nameElement'> - <xsl:value-of select="phoneDesc"/> : + <td align="right" colspan="2"> + <label> + <xsl:value-of select="phoneDesc"/> : </label> </td> - <td align="left" style="width:100px;"> + <td align="left"> <xsl:value-of select="number"/> </td> </tr> @@ -62,8 +66,8 @@ <xsl:otherwise> <tr> <td align="right" colspan="2"> - <label class='nameElement'> - <xsl:value-of select="phoneDesc"/> : + <label> + <xsl:value-of select="phoneDesc"/> : </label> </td> <td align="left"> @@ -79,12 +83,16 @@ <div class="popupDialContent"> <table cellspacing="0" cellpadding="0" border="0" > <tr> - <td align="right" style="width:143px;"> - <xsl:value-of select="popupDial/pin/pinLabel" /> - </td> - <td align="right" style="width:95px;"> + <td colspan="2"> + <label class='nameElement'> + <xsl:value-of select="popupDial/pin/pinLabel" /> + </label> + </td> + </tr> + <tr> + <td align="right" colspan="2"> <xsl:if test="popupDial/pin/instructor!=''"> - <label class='nameElement'> + <label> Instructor : </label> </xsl:if> @@ -95,7 +103,7 @@ </tr> <tr> <td align="right" colspan="2"> - <label class='nameElement'> + <label> Student : </label> </td> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |