// // ipps_js_api.js - A Matruska IPPS Javascript API // // This API offers a portal to the XML-content published by the Matruska IPPS application. // // version 1.0 // //====================================================================================================// // // Copyright (C) 2004 Chevalier Media/ChevLab (http://www.chevaliermedia.com, http://www.matruska.com) //3526 KM, Kanaalstraat 29A, P.O. 5045 3502 JA, Utrecht, The Netherlands //
var IPPS_JSAPI_VERSION="1.0"; function IPPS() {this.XMLATT_VERSION="version"; this.XMLATT_PUBLISHDATE="published"; this.XMLATT_LIVETYPE="liveType"; this.XMLATT_MEDIAROOT="mediaroot"; this.XMLTAG_STRUCT="structure"; this.XMLTAGPATH_STRUCT='/structure'; this.XMLTAG_STRUCTURE="root"; this.XMLTAGPATH_STRUCTURE="/root"; this.XMLTAG_PRES="presentations"; this.XMLTAGPATH_PRES="/presentations"; this.XMLTAG_PRESENTATION="presentation"; this.XMLTAGPATH_PRESENTATION="/presentation"; this.XMLTAGPATH_PRESACCESS="/accesslist"; this.XMLTAGPATH_PRESMETA="/metadata"; this.XMLTAGPATH_PRESMEDIA="/media"; this.XMLTAGPATH_PRESTOC="/toc"; this.XMLTAGPATH_PRESPRELOAD="/preloadmedia"; this.XMLTAG_MEDIA="media"; this.XMLTAG_MEDIADURATION="duration"; this.XMLTAG_TOC="slide"; this.XMLTAG_PRELOADMEDIA="file"; this.XMLTAGPATH_MEDIATYPES="/media"; this.XMLTAG_MEDIATYPES="type"; this.XMLTAGPATH_PLAYLISTS="/playlists"; this.XMLTAG_PLAYLIST="playlist"; this.XMLTAG_PLAYLISTMEDIA="media"; this.XMLTAG_TEMPLATE="template"; this.XMLTAGPATH_TEMPLATES="/templates"; this.XMLTAGPATH_MODULES="/modules"; this.XMLTAGPATH_USERS="/users"; this.XMLTAG_USER="user"; this.PRESENTATION_SHORT=1; this.PRESENTATION_NORMAL=2; this.STRUCTURE_ROOTNAME="IPPS_root"; this.MODULE_KM='/module[@id="MOD%2D001"]'; this.MODULE_KM_MOST='/list[@id="2"]'; this.MODULE_KM_MOST_NAME='Most viewed'; this.MODULE_KM_BEST='/list[@id="3"]'; this.MODULE_KM_BEST_NAME='Best rated'; this.MODULE_KM_NEW='/list[@id="1"]'; this.MODULE_KM_NEW_NAME="What's new"; this.MODULE_KM_FORM='/page'; this.MODULE_FRP='/module[@id="MOD%2D002"]'; this.MODULE_FRP_FORM='/page'; this.MODULE_FRP_PRESENTATION='/presentations/presentation'; this.MODULE_RM='/module[@id="MOD%2D003"]'; this.MODULE_RM_LOC="modules/mod_rm/"; this.MODULE_RM_DIRECTLINK="Direct link"; this.MODULE_SETTINGS='/settings'; this.BROWSER_IE="ie"; this.BROWSER_NS6="ns6"; this.BROWSER_NS4="ns4"; this.BROWSER_UNSUPPORTED="unsupported"; this.PLATFORM_WIN="win"; this.PLATFORM_MAC="mac"; this.PLATFORM_UNIX="xll"; this.PLATFORM_LINUX="linux"; this.PLATFORM_UNSUPPORTED="unsupported"; this.MEDIATYPE_TEXT="1"; this.MEDIATYPE_TEXT_DESC="text"; this.MEDIATYPE_NUMBER="2"; this.MEDIATYPE_NUMBER_DESC="number"; this.MEDIATYPE_IMAGE="3"; this.MEDIATYPE_IMAGE_DESC="image"; this.MEDIATYPE_VIDEO="4"; this.MEDIATYPE_VIDEO_DESC="video"; this.MEDIATYPE_TEXTAREA="5"; this.MEDIATYPE_TEXTAREA_DESC="textarea"; this.MEDIATYPE_POWERPOINT="6"; this.MEDIATYPE_POWERPOINT_DESC="powerpoint"; this.MEDIATYPE_PDF="7"; this.MEDIATYPE_PDF_NAME="pdf"; this.MEDIATYPE_FLASH="8"; this.MEDIATYPE_FLASH_DESC="flash"; this.MEDIATYPE_DATE="9"; this.MEDIATYPE_DATE_DESC="date"; this.MEDIATYPE_HYPERLINK="10"; this.MEDIATYPE_HYPERLINK_DESC="hyperlink"; this.MEDIATYPE_FREETYPE="11"; this.MEDIATYPE_FREETYPE_DESC="free filetype"; this.ONLINE_LOCATION="/"; this.ONLINE="online"; this.OFFLINE_LOCATION="/"; this.OFFLINE="offline"; this.platform=null; this.browser=null; this.browserVersion=null; this.xmldom=null; this.content=null; this.player=null; this.errorMonitor=null; this._init=IPPS_init; this.get_platform=IPPS_get_platform; this.get_browser=IPPS_get_browser; this.get_browser_version=IPPS_get_browser_version; this.get_player=IPPS_get_player; this.get_content=IPPS_get_content; this.get_xmldom=IPPS_get_xmldom; this.get_error_monitor=IPPS_get_error_monitor; this.add_error=IPPS_add_error; this.set_offline_location=IPPS_set_offline_location; this.set_online_location=IPPS_set_online_location; this.find_screen_layer=Screen_findLayer; this.get_screen_layer=Screen_getLayer; this.get_screen_object=Screen_getObject; this.unescape=URL_unescape; this.escape=URL_escape; this._init();} function IPPS_init() {this.platform=this.get_platform(); this.browser=this.get_browser(); this.browserVersion=this.get_browser_version(); this.xmldom=this.get_xmldom(); this.errorMonitor=this.get_error_monitor();} function IPPS_get_browser() {if(this.browser) {return this.browser;}else{if(document.all) {return this.BROWSER_IE;}else if(!document.all && document.getElementById){return this.BROWSER_NS6;}else if(navigator.appName.toLowerCase().indexOf("netscape")==-1){return this.BROWSER_UNSUPPORTED;}else if(!document.all && !document.getElementById){return this.BROWSER_NS4;}}} function IPPS_get_browser_version() {if(this.browserVersion) {return this.browserVersion;}else{if (navigator.appVersion.indexOf("MSIE") !=-1) {var temp=navigator.appVersion.split("MSIE"); return parseFloat(temp[1]);}else{return 0;}}} function IPPS_get_platform() {if(this.platform) {return this.platform;}else{if(navigator.userAgent) {if(navigator.userAgent.toLowerCase().indexOf(this.PLATFORM_WIN)+1) {return this.PLATFORM_WIN;}else if(navigator.userAgent.toLowerCase().indexOf(this.PLATFORM_MAC)+1){return this.PLATFORM_MAC;}else if(navigator.userAgent.toLowerCase().indexOf(this.PLATFORM_LINUX)+1){return this.PLATFORM_LINUX;}else if(navigator.userAgent.toLowerCase().indexOf(this.PLATFORM_UNIX)+1){return this.PLATFORM_UNIX;}else{return this.PLATFORM_UNSUPPORTED;}}else{return this.PLATFORM_UNSUPPORTED;}}} function IPPS_get_player() {if(!this.player) {this.player=new Player(this);} return this.player;} function IPPS_get_content() {if(!this.content) {this.content=new Content(this);} return this.content;} function IPPS_get_xmldom() {if(!this.xmldom) {this.xmldom=new XMLdom(this);} return this.xmldom;} function IPPS_get_error_monitor() {if(!this.errorMonitor) {this.errorMonitor=new IPPS_error_monitor(this);} return this.errorMonitor;} function IPPS_set_offline_location(mediaroot) {if(mediaroot) {var loc=document.location.href.toLowerCase(); loc=loc.split(mediaroot)[0] + mediaroot; this.OFFLINE_LOCATION=loc;}} function IPPS_set_online_location(mediaroot) {if(mediaroot) {this.ONLINE_LOCATION=mediaroot;}} function IPPS_add_error(errorId, errorMsg) {if(errorId !=null && errorMsg !=null) {if(this.errorMonitor) {var ippsError=new IPPS_error(errorId, "IPPS", errorMsg); this.errorMonitor.add_error(ippsError);}}} function Player(ipps) {this.IPPS=ipps; this.playerObject=null; this.playerVersion=null; this.controllable=false; this.playList=null; this.loopPlaylist=false; this.PLAYSTATE_STOPPED="stopped"; this.PLAYSTATE_PLAYING="playing"; this.PLAYSTATE_PAUSED="paused"; this.PLAYSTATE_BUFFERING="buffering"; this.PLAYSTATE_UNSUPPORTED="unsupported"; this.NEXT_MARKER="next"; this.PREVIOUS_MARKER="prev"; this.VOLUME_ADD="add"; this.VOLUME_SUBSTRACT="substract"; this.VOLUME_NEW="replace"; this.PLAYLIST_FIRST="first"; this.PLAYLIST_PREVIOUS="previous"; this.PLAYLIST_NEXT="next"; this.PLAYLIST_LAST="last"; this.add_error=Player_add_error; this.detect_player_version=Player_detect_player_version; this.set_player_version=Player_set_player_version; this.get_player_object=Player_get_player_object; this.set_player_object=Player_set_player_object; this.set_controllability=Player_set_controllability; this.write_eventlistener=Player_write_eventlistener; this.get_eventlistener=Player_get_eventlistener; this.is_valid_stepfactor=Player_is_valid_stepfactor; this.get_player_property=Player_get_player_property; this.set_player_property=Player_set_player_property; this.set_playlist=Player_set_playlist; this.get_playlist=Player_get_playlist; this.get_current_media=Player_get_current_media; this.set_current_media=Player_set_current_media; this.get_current_media_duration=Player_get_current_media_duration; this.get_current_tocitem_position=Player_get_current_tocitem_position; this.play=Player_play; this.stop=Player_stop; this.pause=Player_pause; this.get_player_status=Player_get_player_status; this.goto_marker=Player_goto_marker; this.get_volume=Player_get_volume; this.set_volume=Player_set_volume; this.get_player_position=Player_get_player_position; this.play_item_from_playlist=Player_play_item_from_playlist; this.get_playlist_position=Player_get_playlist_position; this.get_playlist_length=Player_get_playlist_length; this.rewind_playlist=Player_rewind_playlist; this._init=Player_init; this._init();} function Player_init() {this.set_controllability();} function Player_set_player_version(pVersion) {if(pVersion && parseFloat(pVersion) !=0) {this.playerVersion=parseInt(pVersion);}} function Player_set_controllability() {if(this.IPPS.get_platform()==this.IPPS.PLATFORM_WIN) {if(this.IPPS.get_browser()==this.IPPS.BROWSER_IE) {this.controllable=true;}}} function Player_detect_player_version() {var versionNr=0; if(window.ActiveXObject && this.IPPS.get_platform() !=this.IPPS.PLATFORM_MAC) {if(this.IPPS.get_browser_version() >=6) {eval("try{player=new ActiveXObject(\"WMPlayer.OCX\");if(player){versionNr=player.versionInfo.split('.')[0];player=null;}}catch(er){this.add_error(\"P0_1\",\"Error creating WMPlayer.OCX object!\");}"); if(versionNr==0) {eval("try{player2=new ActiveXObject(\"MediaPlayer.MediaPlayer.1\");if(player2){versionNr=6;player2=null;}else{player2=null;this.add_error(\"P0_3\",\"MediaPlayer.MediaPlayer.1 object created, but with errors!\");}}catch(er2){player2=null;this.add_error(\"P0_2\",\"Error creating MediaPlayer.MediaPlayer.1 object!\");}");}}else{player=new ActiveXObject("WMPlayer.OCX"); if(player) {versionNr=player.versionInfo.split(".")[0]; player=null;}else{player2=new ActiveXObject("MediaPlayer.MediaPlayer.1"); if(player2) {versionNr=6; player2=null;}else{this.add_error("P0_2","Error creating MediaPlayer.MediaPlayer.1 object!"); player2=null;}}}}else if(window.GeckoActiveXObject){player=new GeckoActiveXObject("WMPlayer.OCX"); if(player) {versionNr=player.versionInfo.split(".")[0]; player=null;}else{player2=new GeckoActiveXObject("MediaPlayer.MediaPlayer.1"); if(player2 && (player2.FileName="")) {versionNr=6; player2=null;}else{player2=null;}}}else{var fHasWMP64=navigator.mimeTypes && navigator.mimeTypes["video/x-ms-wm"] && navigator.mimeTypes["video/x-ms-wmv"]; var fHasWMP7=navigator.mimeTypes && navigator.mimeTypes["application/x-drm-v2"] && navigator.mimeTypes["application/x-drm-v2"].enabledPlugin; var fHasWMP7forMac=navigator.mimeTypes && navigator.mimeTypes["application/x-ms-wmd"] && navigator.mimeTypes["application/x-ms-wmd"].enabledPlugin; if (fHasWMP7) {versionNr=9;}else if (fHasWMP7forMac) {versionNr=9;}else if(fHasWMP64) {versionNr=6;}else if(fHasWMP52) {versionNr=0;}} return parseInt(versionNr);} function Player_get_player_object(objName, width, height, playerSettings) {var useWidth=parseFloat(width); var useHeight=parseFloat(height); if(this.IPPS.get_browser() !=this.IPPS.BROWSER_UNSUPPORTED) {if(this.playerVersion) {var objectString=""; if(this.playerVersion==6) {objectString=objectString +"<OBJECT ID=\""+ objName +"\" WIDTH="+useWidth+" HEIGHT="+useHeight+" classid=\"CLSID:22D6F312-B0F6-11D0-94AB-0080C74C7E95\" "; objectString=objectString +"codebase=\"http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,4,5,1112\" "; objectString=objectString +"standby=\"Loading Microsoft Windows Media Player components...\" type=\"application/x-oleobject\">"; objectString=objectString +"<PARAM NAME=\"AutoStart\" VALUE=\"false\">"; objectString=objectString +"<PARAM NAME=\"ShowControls\" VALUE=\"FALSE\">"; objectString=objectString +"<PARAM NAME=\"ShowStatusBar\" VALUE=\"FALSE\">"; objectString=objectString +"<PARAM NAME=\"ShowDisplay\" VALUE=\"FALSE\">"; objectString=objectString +"<PARAM NAME=\"AutoSize\" VALUE=\"FALSE\">"; objectString=objectString +"<PARAM NAME=\"ShowTracker\" VALUE=\"FALSE\">"; objectString=objectString +"<PARAM NAME=\"VideoBorderColor\" VALUE=\"FALSE\">"; objectString=objectString +"<PARAM NAME=\"AnimationAtStart\" VALUE=\"false\">"; objectString=objectString +"<PARAM NAME=\"AllowChangeDisplaySize\" VALUE=\"TRUE\">"; objectString=objectString +"<EMBED type=\"application/x-mplayer2\" pluginspage=\"http://www.microsoft.com/Windows/MediaPlayer/\" "; objectString=objectString +"autostart=0 "; objectString=objectString +" "; objectString=objectString +"name=\"IPPSplayer_em\" "; objectString=objectString +"ShowTracker=0 "; objectString=objectString +"ShowControls=0 "; objectString=objectString +"ShowDisplay=0 "; objectString=objectString +"ShowStatusBar=0 "; objectString=objectString +"EnableJavaSript=\"true\" "; objectString=objectString +"height="+useHeight+" width="+useWidth+">"; objectString=objectString +"<\/EMBED>"; objectString=objectString +"<\/OBJECT>";}else{objectString=objectString +"<OBJECT ID=\""+ objName +"\" WIDTH="+useWidth+" HEIGHT="+useHeight+" CLASSID=\"CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6\" "; objectString=objectString +"standby=\"Loading Microsoft Windows Media Player components...\" type=\"application\/x-oleobject\">"; objectString=objectString +"<PARAM NAME=\"uiMode\" VALUE=\"none\">"; objectString=objectString +"<PARAM NAME=\"autoStart\" VALUE=\"0\">"; objectString=objectString +"<PARAM NAME=\"AnimationAtStart\" VALUE=\"false\">"; objectString=objectString +"<EMBED type=\"application\/x-mplayer2\" "; objectString=objectString +"pluginspage=\"http:\/\/www.microsoft.com\/Windows\/MediaPlayer\/\" "; objectString=objectString +"autostart=0 "; objectString=objectString +"name=\"IPPSplayer_em\" "; objectString=objectString +"ShowTracker=0 "; objectString=objectString +"ShowControls=0 "; objectString=objectString +"ShowDisplay=0 "; objectString=objectString +"ShowStatusBar=0 "; objectString=objectString +"EnableJavaSript=\"true\" "; objectString=objectString +"width="+useWidth+" "; objectString=objectString +"height="+useHeight+">"; if(false) {navigator.plugins.refresh(); objectString=objectString +"\x3C" + "applet MYSCRIPT Code=NPDS.npDSEvtObsProxy.class"; objectString=objectString +" WIDTH=5 HEIGHT=5 NAME=IPPSplayer_em\x3E \x3C/applet\x3E";} objectString=objectString +"<\/EMBED>"; objectString=objectString +"<\/OBJECT>";} return objectString;}else{this.add_error("P1_2","Player version not set!"); return "";}}else{this.add_error("P1_1","Unsupported browser!"); return "";}} function Player_write_eventlistener(optionalRef) {var playerRef; if(optionalRef) {playerRef=optionalRef;}else{playerRef="IPPSplayer";} var listener=""; listener=listener + "<SCR"; listener=listener + "IPT FOR=\""+ playerRef +"\" "; listener=listener + "EVENT=\"ScriptCommand(scType, scParam)\" "; listener=listener + "LANGUAGE=\"JScript\"> "; listener=listener + "if(scType==\"IPPSEVENT\"){"; listener=listener + "if(IPPS_handle_event){"; listener=listener + "eval(\"IPPS_handle_event(\"+scParam.substring(1,scParam.length-1)+\")\");"; listener=listener + "}else{window.status=scParam+\" --> event not handled!\";}"; listener=listener + "}else{}; <\/SCR"; listener=listener + "IPT>"; document.write(listener);} function Player_get_eventlistener(optionalRef) {var playerRef; if(optionalRef) {playerRef=optionalRef;}else{playerRef="IPPSplayer";} var listener=""; listener=listener + "<SCR"; listener=listener + "IPT FOR=\""+ playerRef +"\" "; listener=listener + "EVENT=\"ScriptCommand(scType, scParam)\" "; listener=listener + "LANGUAGE=\"JScript\"> "; listener=listener + "if(scType==\"IPPSEVENT\"){"; listener=listener + "if(IPPS_handle_event){"; listener=listener + "eval(\"IPPS_handle_event(\"+scParam.substring(1,scParam.length-1)+\")\");"; listener=listener + "}else{window.status=scParam+\" --> event not handled!\";}"; listener=listener + "}else{}; <\/SCR"; listener=listener + "IPT>"; return(listener);} function Player_set_player_object(containerID, objectID) {if(this.IPPS.browser !=this.IPPS.BROWSER_UNSUPPORTED) {if(containerID) {var playerDiv; if(containerID=="document") {playerDiv="";}else{playerDiv=this.IPPS.get_screen_layer(containerID);} if(playerDiv || playerDiv=="") {if(objectID) {this.playerObject=this.IPPS.get_screen_object(playerDiv, objectID);}else{this.add_error("P2_4","No playerobject passed in!");}}else{this.add_error("P2_3","Playerobject container not found!");}}else{this.add_error("P2_2","No playerobject container passed in!");}}else{this.add_error("P2_1","Unsupported browser!");}} function Player_get_player_property(propertyName, propertyArgs) {if(this.playerObject) {switch(propertyName) {case "markerCount": if(this.playerVersion >=7){return this.playerObject.currentMedia.markerCount;}else if(this.playerVersion==6){return this.playerObject.MarkerCount;}break; case "markerName": if(this.playerVersion >=7){return this.playerObject.currentMedia.getMarkerName(propertyArgs);}else if(this.playerVersion==6){return this.playerObject.GetMarkerName(propertyArgs);}break; case "totalTime": if(this.playerVersion >=7){return this.playerObject.currentMedia.duration;}else if(this.playerVersion==6){return this.playerObject.Duration;}break; case "currentPosition": if(this.playerVersion >=7 && this.IPPS.browser !=this.IPPS.BROWSER_NS4 && this.IPPS.browser !=this.IPPS.BROWSER_NS6){return this.playerObject.controls.currentPosition;}else if(this.playerVersion==6 || this.IPPS.browser==this.IPPS.BROWSER_NS4 || this.IPPS.browser==this.IPPS.BROWSER_NS6){if(this.IPPS.browser==this.IPPS.BROWSER_NS4 || this.IPPS.browser==this.IPPS.BROWSER_NS6) {return this.playerObject.GetCurrentPosition();}else{return this.playerObject.CurrentPosition;}}break; case "currentVolume": if(this.playerVersion >=7 && this.IPPS.browser !=this.IPPS.BROWSER_NS4 && this.IPPS.browser !=this.IPPS.BROWSER_NS6){return this.playerObject.settings.volume;}else if(this.playerVersion==6 || this.IPPS.browser==this.IPPS.BROWSER_NS4 || this.IPPS.browser==this.IPPS.BROWSER_NS6){if(this.IPPS.browser==this.IPPS.BROWSER_NS4 || this.IPPS.browser==this.IPPS.BROWSER_NS6) {return this.playerObject.GetVolume();}else{return this.playerObject.Volume;}}break; case "currentMarker": if(this.playerVersion >=7){return this.playerObject.controls.currentMarker;}else if(this.playerVersion==6){return this.playerObject.CurrentMarker;}break; default: this.add_error("P3_2","Unknown player property requested!"); return ""; break;}}else{this.add_error("P3_1","No player object to request property of!"); return null;}} function Player_set_player_property(propertyName, propertyValue) {if(this.playerObject) {switch(propertyName) {case "currentMarker": if(this.playerVersion >=7 && this.IPPS.browser !=this.IPPS.BROWSER_NS4 && this.IPPS.browser !=this.IPPS.BROWSER_NS6){this.playerObject.controls.currentMarker=propertyValue;}else if(this.playerVersion==6 || this.IPPS.browser==this.IPPS.BROWSER_NS4 || this.IPPS.browser==this.IPPS.BROWSER_NS6){if(this.IPPS.browser==this.IPPS.BROWSER_NS4 || this.IPPS.browser==this.IPPS.BROWSER_NS6) {this.playerObject.SetCurrentMarker(propertyValue);}else{this.playerObject.CurrentMarker=propertyValue;}}break; case "currentVolume": if(this.playerVersion >=7 && this.IPPS.browser !=this.IPPS.BROWSER_NS4 && this.IPPS.browser !=this.IPPS.BROWSER_NS6){this.playerObject.settings.volume=propertyValue;}else if(this.playerVersion==6 || this.IPPS.browser==this.IPPS.BROWSER_NS4 || this.IPPS.browser==this.IPPS.BROWSER_NS6){if(this.IPPS.browser==this.IPPS.BROWSER_NS4 || this.IPPS.browser==this.IPPS.BROWSER_NS6) {this.playerObject.SetVolume(propertyValue);}else{this.playerObject.Volume=propertyValue;}}break; case "currentMedia": if(this.playerVersion >=7 && this.IPPS.browser !=this.IPPS.BROWSER_NS4 && this.IPPS.browser !=this.IPPS.BROWSER_NS6){this.playerObject.URL=propertyValue;}else if(this.playerVersion==6 || this.IPPS.browser==this.IPPS.BROWSER_NS4 || this.IPPS.browser==this.IPPS.BROWSER_NS6){if(this.IPPS.browser==this.IPPS.BROWSER_NS4 || this.IPPS.browser==this.IPPS.BROWSER_NS6) {this.playerObject.SetFileName(propertyValue);}else{this.playerObject.FileName=propertyValue;}}break; case "gotoBeginning": if(this.playerVersion >=7 && this.IPPS.browser !=this.IPPS.BROWSER_NS4 && this.IPPS.browser !=this.IPPS.BROWSER_NS6){this.playerObject.controls.currentMarker=propertyValue;}else if(this.playerVersion==6 || this.IPPS.browser==this.IPPS.BROWSER_NS4 || this.IPPS.browser==this.IPPS.BROWSER_NS6){if(this.IPPS.browser==this.IPPS.BROWSER_NS4 || this.IPPS.browser==this.IPPS.BROWSER_NS6) {this.playerObject.SetCurrentMarker(propertyValue);}else{this.playerObject.CurrentMarker=propertyValue;}}break; case "transparency": if(this.playerVersion >=7 && this.IPPS.browser !=this.IPPS.BROWSER_NS4 && this.IPPS.browser !=this.IPPS.BROWSER_NS6){if(propertyValue) {this.playerObject.uiMode="none";}else{this.playerObject.uiMode="invisible";}}else if(this.playerVersion==6 || this.IPPS.browser==this.IPPS.BROWSER_NS4 || this.IPPS.browser==this.IPPS.BROWSER_NS6){if(this.IPPS.browser==this.IPPS.BROWSER_NS4 || this.IPPS.browser==this.IPPS.BROWSER_NS6) {this.playerObject.SetTransparentAtStart=propertyValue;}else{this.playerObject.TransparentAtStart=propertyValue;}}break; default: this.add_error("P4_2","Unknown player property to set!"); break;}}else{this.add_error("P4_1","No player object to set property of!");}} function Player_get_current_media() {if(!isNaN(this.currentMediaObject) && this.playList.get_media_count() > 0) {return this.playList.get_media_by_position(this.currentMediaObject+1);}else{this.add_error("P6","No current media object to return!"); return null;}} function Player_set_current_media(position) {if(!isNaN(this.currentMediaObject) && this.playList.get_media_count() > 0) {if(!isNaN(position) && position > 0 && position <=this.playList.get_media_count()) {this.currentMediaObject=position -1; this.set_player_property("currentMedia", this.playList.get_media_by_position(position).get_url());}else{this.add_error("P22_2","Invalid position index!");}}else{this.add_error("P22_1","No media objects to play!");}} function Player_get_current_media_duration(format) {if(!isNaN(this.currentMediaObject) && this.playList.get_media_count() > 0) {return this.playList.get_media_by_position(this.currentMediaObject+1).get_duration(format);}else{this.add_error("P7","No current media object to get duration from!"); return "";}} function Player_get_current_tocitem_position() {if(!isNaN(this.currentMediaObject) && this.playList.get_media_count() > 0) {tempPos=this.get_player_property("currentMarker"); if (tempPos==0) tempPos=1; return(tempPos);}else{this.add_error("P11","No current media object to get tocposition of!"); return 1;}} function Player_play() {if(this.playerObject) {if(this.playerVersion >=7){if(this.IPPS.browser==this.IPPS.BROWSER_NS4 || this.IPPS.browser==this.IPPS.BROWSER_NS6) {this.playerObject.Play();}else{this.playerObject.controls.play();}}else if(this.playerVersion==6){this.playerObject.Play();}}else{this.add_error("P8","No player object available for playing!");}} function Player_stop() {if(this.playerObject) {if(this.playerVersion >=7){if(this.IPPS.browser==this.IPPS.BROWSER_NS4 || this.IPPS.browser==this.IPPS.BROWSER_NS6) {this.playerObject.Stop();}else{this.playerObject.controls.stop();}}else if(this.playerVersion==6){this.playerObject.Stop();}}else{this.add_error("P9","No player object available for stopping!");}} function Player_pause() {if(this.playerObject) {if(this.get_player_status()==this.PLAYSTATE_PAUSED) {this.play();}else if(this.get_player_status()==this.PLAYSTATE_PLAYING){if(this.playerVersion >=7){if(this.IPPS.browser==this.IPPS.BROWSER_NS4 || this.IPPS.browser==this.IPPS.BROWSER_NS6) {this.playerObject.Pause();}else{this.playerObject.controls.pause();}}else if(this.playerVersion==6){this.playerObject.Pause();}}else{this.add_error("P10_2","Warning: player not in a (un)pausable state!");}}else{this.add_error("P10_1","No player object available for pausing!");}} function Player_get_player_status() {if(this.playerObject) {if(this.playerVersion >=7 && this.IPPS.browser !=this.IPPS.BROWSER_NS4 && this.IPPS.browser !=this.IPPS.BROWSER_NS6){switch(this.playerObject.playState) {case 1: return this.PLAYSTATE_STOPPED; break; case 2: return this.PLAYSTATE_PAUSED; break; case 3: return this.PLAYSTATE_PLAYING; break; case 6: case 7: case 9: case 11: return this.PLAYSTATE_BUFFERING; break; default: return this.PLAYSTATE_UNSUPPORTED; break;}}else if(this.playerVersion==6 || this.IPPS.browser==this.IPPS.BROWSER_NS4 || this.IPPS.browser==this.IPPS.BROWSER_NS6){var playStateNr; if(this.IPPS.browser==this.IPPS.BROWSER_NS4 || this.IPPS.browser==this.IPPS.BROWSER_NS6) {playStateNr=this.playerObject.GetPlayState();}else if(this.IPPS.browser==this.IPPS.BROWSER_IE){playStateNr=this.playerObject.PlayState;}else{this.add_error("P11_3","Invalid player version!");} if(playStateNr) {switch(playStateNr) {case 0: return this.PLAYSTATE_STOPPED; break; case 1: return this.PLAYSTATE_PAUSED; break; case 2: return this.PLAYSTATE_PLAYING; break; case 3: return this.PLAYSTATE_BUFFERING; break; default: return this.PLAYSTATE_UNSUPPORTED; break;}}else{this.add_error("P11_3","No playstate!"); return this.PLAYSTATE_UNSUPPORTED;}}else{this.add_error("P11_2","Invalid player version!"); return "";}}else{this.add_error("P11_1","No player object available to get status from!"); return "";}} function Player_goto_marker(markerNumber) {if(this.playerObject) {var nowMarker=this.get_player_property("currentMarker"); var mCount=this.get_player_property("markerCount"); if(markerNumber==this.NEXT_MARKER) {var newMarker=nowMarker; if(this.get_player_property("markerCount") > newMarker) {newMarker=newMarker +1;} this.set_player_property("currentMarker", newMarker);}else {if(markerNumber==this.PREVIOUS_MARKER) {var newMarker=nowMarker; if(newMarker > 1) {newMarker=newMarker -1;} this.set_player_property("currentMarker", newMarker);}else{if(markerNumber > 0 && markerNumber <=mCount) {this.set_player_property("currentMarker", markerNumber);}}}}else{this.add_error("P12","No player object available to set marker of!");}} function Player_get_volume(stepFactor) {if(this.playerObject) {var stepFactorCheck=true; if(stepFactor) {stepFactorCheck=this.is_valid_stepfactor(stepFactor);} if(stepFactorCheck) {var scaleVolume=this.get_player_property("currentVolume"); if(this.playerVersion==6 || this.IPPS.browser==this.IPPS.BROWSER_NS4 || this.IPPS.browser==this.IPPS.BROWSER_NS6){scaleVolume=100 - Math.floor((-1 * scaleVolume)/100);} if(stepFactor) {scaleVolume=Math.ceil((scaleVolume/100)*stepFactor); if(scaleVolume==0) {scaleVolume=1;}} return scaleVolume;}else{this.add_error("P13_2","Illegal stepFactor passed!"); return 0;}}else{this.add_error("P13_1","No player object available to get volume from!"); return 0;}} function Player_set_volume(value, valueHandling, stepFactor) {if(this.playerObject) {if(!isNaN(value)) {var stepFactorCheck=true; if(stepFactor) {stepFactorCheck=this.is_valid_stepfactor(stepFactor);} if(stepFactorCheck) {var newValue=value; if(valueHandling==this.VOLUME_NEW) {if(stepFactor) {newValue=Math.floor(((value-1)/(stepFactor-1))*100);} if(this.playerVersion==6 || this.IPPS.browser==this.IPPS.BROWSER_NS4 || this.IPPS.browser==this.IPPS.BROWSER_NS6) {newValue=(100 - newValue) * -100;}}else if(valueHandling==this.VOLUME_ADD) {if(stepFactor) {newValue=Math.floor(((value-1)/(stepFactor-1))*100);} newValue=this.get_volume() + newValue; if(newValue > 100) {newValue=100;} if(this.playerVersion==6 || this.IPPS.browser==this.IPPS.BROWSER_NS4 || this.IPPS.browser==this.IPPS.BROWSER_NS6) {newValue=(100 - newValue) * -100;}}else if(valueHandling==this.VOLUME_SUBSTRACT) {if(stepFactor) {newValue=Math.floor(((value-1)/(stepFactor-1))*100);} newValue=this.get_volume() - newValue; if(newValue < 0) {newValue=0;} if(this.playerVersion==6 || this.IPPS.browser==this.IPPS.BROWSER_NS4 || this.IPPS.browser==this.IPPS.BROWSER_NS6) {newValue=(100 - newValue) * -100;}}else{newValue=0; this.add_error("P14_4","Illegal valueHandling passed!");} this.set_player_property("currentVolume", newValue);}else{this.add_error("P14_3","Illegal stepFactor passed!");}}else{this.add_error("P14_2","Illegal value passed!");}}else{this.add_error("P14_1","No player object available to set volume of!");}} function Player_is_valid_stepfactor(stepFactor) {if(stepFactor) {if(isNaN(stepFactor)) {return false;}else{if(stepFactor < 2) {return false;}else{return true;}}}else{return false;}} function Player_get_player_position(format) {if(this.playerObject) {if(format) {var currentPosition=this.get_player_property("currentPosition"); var returnStr=""; var formatArr=format.split(":"); var hours=Math.floor(currentPosition/3600); var mins=Math.floor((currentPosition - 3600*hours)/60); var secs=Math.floor(currentPosition - (3600*hours + 60*mins)); for(var f=0;f<formatArr.length;f++) {switch(formatArr[f]) {case "hh": if(hours < 10) {hours="0"+ hours;} returnStr=returnStr + hours; break; case "h": returnStr=returnStr + hours; break; case "mm": if(mins < 10) {mins="0"+ mins;} returnStr=returnStr + mins; break; case "m": returnStr=returnStr + mins; break; case "ss": if(secs < 10) {secs="0"+ secs;} returnStr=returnStr + secs; break; case "s": returnStr=returnStr + secs; break; default: this.add_error("P15_3","Illegal duration format found!"); break;} if(f < formatArr.length -1) {returnStr=returnStr + ":";}} return returnStr;}else{this.add_error("P15_1","No format provided!"); return returnStr;}}else{this.add_error("P15_1","No player object available to get position of!"); return returnStr;}} function Player_set_playlist(IPPSmediaPlaylist, loopIt) {if(IPPSmediaPlaylist && IPPSmediaPlaylist.get_media_count() > 0) {this.playList=IPPSmediaPlaylist; this.loopPlaylist=loopIt; this.currentMediaObject=0; this.set_player_property("currentMedia", this.playList.get_media_by_position(1).get_url());}else{this.add_error("P16","Invalid media playlistobject passed in!");}} function Player_get_playlist_length() {if(this.playList) {return this.playList.get_media_count();}else{this.add_error("P19","No playlist object to get the length of!"); return 0;}} function Player_get_playlist() {if(this.playList) {return this.playList;}else{this.add_error("P21","No playlist object!"); return null;}} function Player_play_item_from_playlist(playListIndex) {if(this.get_playlist_length() > 0) {if(playListIndex) {if(playListIndex==this.PLAYLIST_FIRST) {this.currentMediaObject=0; this.set_player_property("currentMedia", this.playList.get_media_by_position(this.currentMediaObject+1).get_url()); this.play();}else if(playListIndex==this.PLAYLIST_PREVIOUS) {if(this.currentMediaObject > 0) {this.currentMediaObject=this.currentMediaObject-1;}else if(this.currentMediaObject==0) {this.currentMediaObject=this.get_playlist_length()-1;} this.set_player_property("currentMedia", this.playList.get_media_by_position(this.currentMediaObject+1).get_url()); this.play();}else if(playListIndex==this.PLAYLIST_NEXT) {if(this.currentMediaObject==this.get_playlist_length()-1) {this.currentMediaObject=0;}else{this.currentMediaObject=this.currentMediaObject +1;} this.set_player_property("currentMedia", this.playList.get_media_by_position(this.currentMediaObject+1).get_url()); this.play();}else if(playListIndex==this.PLAYLIST_LAST) {this.currentMediaObject=this.get_playlist_length() - 1; this.set_player_property("currentMedia", this.playList.get_media_by_position(this.currentMediaObject+1).get_url()); this.play();}else if(!isNaN(playListIndex) && playListIndex <=this.get_playlist_length() && playListIndex > 0) {this.currentMediaObject=playListIndex-1; this.set_player_property("currentMedia", this.playList.get_media_by_position(this.currentMediaObject+1).get_url()); this.play();}else{this.add_error("P17_3","Invalid playlist index!");}}else{this.add_error("P17_2","Invalid playlist index!");}}else{this.add_error("P17_1","The current playlist is empty!");}} function Player_get_playlist_position() {if(!isNaN(this.currentMediaObject)) {return this.currentMediaObject+1;}else{this.add_error("P18","The playlist isn't set yet!"); return -1;}} function Player_rewind_playlist() {if(this.get_playlist_length() > 0) {this.currentMediaObject=0; this.set_player_property("currentMedia", this.playList.get_media_by_position(this.currentMediaObject+1).get_url());}else{this.add_error("P12","Can't rewind playlist; it's empty!");}} function Player_add_error(errorId, errorMsg) {if(errorId !=null && errorMsg !=null) {if(this.IPPS.errorMonitor) {var ippsError=new IPPS_error(errorId, "Player", errorMsg); this.IPPS.errorMonitor.add_error(ippsError);}}} function Content(ipps) {this.IPPS=ipps; this.contentObject=null; this.contentParsed=false; this.structure=null; this.version=""; this.publishDate=""; this.liveType="online"; this.parse_content=Content_parse_content; this.is_parsed=Content_is_parsed; this.get_parsed_content=Content_get_parsed_content; this.content_to_string=Content_content_to_string; this.add_error=Content_add_error; this.set_parsed_content=Content_set_parsed_content; this.extract_mediatypes=Content_extract_mediatypes; this.set_standard_vars=Content_set_standard_vars; this.get_live_type=Content_get_live_type; this.get_root_location=Content_get_root_location; this.get_source_xml=Content_get_source_xml; this.get_root_structure=Content_get_root_structure; this.get_structure_by_id=Content_get_structure_by_id; this.get_structure_by_name=Content_get_structure_by_name; this.get_structure_name_by_id=Content_get_structure_name_by_id; this.get_all_templates=Content_get_all_templates; this.get_template_id_from_name=Content_get_template_id_from_name; this.get_template_name_from_id=Content_get_template_name_from_id; this.get_all_presentations=Content_get_all_presentations; this.get_presentation_by_id=Content_get_presentation_by_id; this.get_presentation_by_name_and_template=Content_get_presentation_by_name_and_template; this.get_presentations_by_template_name=Content_get_presentations_by_template_name; this.get_total_presentation_count=Content_get_total_presentation_count; this.get_all_playlists=Content_get_all_playlists; this.get_playlist_id_from_name=Content_get_playlist_id_from_name; this.get_playlist_name_from_id=Content_get_playlist_name_from_id; this.get_playlists_by_template_name=Content_get_playlists_by_template_name; this.get_email_from_user_id=Content_get_email_from_user_id; this.is_module_active=Content_is_module_active; this.get_module=Content_get_module; this.get_module_logpage=Content_get_module_logpage; this.testXMLparser=Content_testXMLparser;} function Content_parse_content(xmlContent, xmlType) {var dom; if(xmlContent !=null && xmlContent !="" && xmlType==1) {this.contentObject=null; this.contentParsed=false; if(this.IPPS.browser==this.IPPS.BROWSER_UNSUPPORTED) {dom=null;}else{dom=this.IPPS.xmldom.parseXMLdoc(xmlContent);} if(dom.docNode !=null) {this.contentObject=dom; this.contentParsed=true; this.set_standard_vars();}else{this.add_error("C1_2","Error during \"dom creation\"!");}}else{this.add_error("C1_1","No/Invalid content provided to parse!");}} function Content_is_parsed() {return this.contentParsed;} function Content_get_parsed_content() {if(this.is_parsed() && this.contentObject !=null) {return this.contentObject;}else{this.add_error("C9_1","No content available to return!"); return null;}} function Content_content_to_string(contentToString) {return(this.IPPS.xmldom.toString(contentToString));} function Content_set_parsed_content(contentObject) {if(contentObject.docNode !=null) {this.contentObject=contentObject; this.contentParsed=true; this.set_standard_vars();}else{this.add_error("C14_1","Invalid contentObject to set as content!");}} function Content_set_standard_vars() {if(this.is_parsed() && this.contentObject !=null) {var tempVersion=this.IPPS.xmldom.getAttribute(this.IPPS.xmldom.getRoot(this.contentObject), this.IPPS.XMLATT_VERSION); if(tempVersion) {this.version=this.IPPS.unescape(tempVersion);}else{this.add_error("C15_3","Error, no IPPS version attribute found!");} var tempPublish=this.IPPS.xmldom.getAttribute(this.IPPS.xmldom.getRoot(this.contentObject), this.IPPS.XMLATT_PUBLISHDATE); if(tempPublish) {this.publishDate=this.IPPS.unescape(tempPublish);}else{this.add_error("C15_2","Error, no IPPS publish-date attribute found!");} var tempLiveType=this.IPPS.xmldom.getAttribute(this.IPPS.xmldom.getRoot(this.contentObject), this.IPPS.XMLATT_LIVETYPE); if(tempLiveType) {this.liveType=this.IPPS.unescape(tempLiveType);}else{this.add_error("C15_4","Error, no IPPS liveType attribute found!");} var tempMediaroot=this.IPPS.xmldom.getAttribute(this.IPPS.xmldom.getRoot(this.contentObject), this.IPPS.XMLATT_MEDIAROOT); if(tempMediaroot) {if(this.liveType=="offline") {this.IPPS.set_offline_location(this.IPPS.unescape(tempMediaroot).toLowerCase());}else if(this.liveType=="online"){this.IPPS.set_online_location(this.IPPS.unescape(tempMediaroot).toLowerCase());}}else{this.add_error("C15_5","Error, no IPPS liveType attribute found!");} this.extract_mediatypes();}else{this.add_error("C15_1","No content available set standard vars for!");}} function Content_get_live_type() {return this.liveType;} function Content_get_root_location() {if(this.get_live_type()=="online") {return this.IPPS.ONLINE_LOCATION;}else if(this.get_live_type()=="offline"){return this.IPPS.OFFLINE_LOCATION;}else{return "/";}} function Content_get_total_presentation_count() {if(this.is_parsed() && this.contentObject !=null) {var modsAll=this.IPPS.xmldom.selectNode(this.contentObject, this.IPPS.XMLTAGPATH_PRES); if(modsAll) {var mods=this.IPPS.xmldom.getElements(modsAll, this.IPPS.XMLTAG_PRESENTATION); return mods.length;}else{this.add_error("C3_2","No \"presentations\" element in IPPS content"); return 0;}}else{this.add_error("C3_1","No content available to get presentation count from!"); return 0;}} function Content_get_source_xml() {if(this.is_parsed() && this.contentObject !=null) {return this.IPPS.xmldom.getSource(this.contentObject);}else{this.add_error("C4","No content available to return source from!");}} function Content_get_root_structure() {if(this.is_parsed() && this.contentObject !=null) {if(this.structure) {return this.structure;}else{var root=this.IPPS.xmldom.selectNode(this.contentObject, this.IPPS.XMLTAGPATH_STRUCT); if(root) {return (new Structure(this.IPPS, "0", this.IPPS.STRUCTURE_ROOTNAME, root));}else{this.add_error("C5_2","No '"+ this.IPPS.XMLTAGPATH_STRUCT +"' element to get structure from!"); return this.structure;}}}else{this.add_error("C5_1","No content available to get structure from!"); return this.structure;}} function Content_get_presentation_by_id(presID) {if(this.is_parsed() && this.contentObject !=null) {var root=this.IPPS.xmldom.selectNode(this.contentObject, this.IPPS.XMLTAGPATH_PRES); if(root) {var node=this.IPPS.xmldom.getElementByTagAndAttribute(root, this.IPPS.XMLTAG_PRESENTATION, "id", ""+presID); root=null; if(node) {var chosenPres=new Presentation(this.IPPS, node, this.IPPS.PRESENTATION_SHORT); if(chosenPres) {return chosenPres;}else{this.add_error("C6_4","Error during creation of presentation-object!"); return null;}}else{this.add_error("C6_3","No presentation found with ID '"+ presID +"'!"); return null;}}else{this.add_error("C6_2","No content '"+ this.IPPS.XMLTAGPATH_PRES +"' element to get presentations from!"); return null;}}else{this.add_error("C6_1","No content available to get presentations from!"); return null;}} function Content_get_presentation_by_name_and_template(presName, tmplName) {if(this.is_parsed() && this.contentObject !=null) {var tmplId=this.get_template_id_from_name(tmplName); if(tmplId) {var root=this.IPPS.xmldom.selectNode(this.contentObject, this.IPPS.XMLTAGPATH_PRES); if(root) {var nodes=this.IPPS.xmldom.getElements(root, this.IPPS.XMLTAG_PRESENTATION); root=null; if((nodes) && (nodes.length > 0)) {var n=0; var found=false; while(n < nodes.length) {if(this.IPPS.unescape(this.IPPS.xmldom.getAttribute(nodes[n], "name"))==presName && this.IPPS.unescape(this.IPPS.xmldom.getAttribute(nodes[n], "template_id"))==tmplId) {var chosenPres=new Presentation(this.IPPS, nodes[n], this.IPPS.PRESENTATION_SHORT); if(chosenPres) {found=true; return chosenPres;}else{this.add_error("C13_5","Error during creation of presentation-object!"); return null;}} n++;} if(!found) {this.add_error("C13_4","No presentations found with name '"+ presName +"'!"); return null;}}else{this.add_error("C13_4","No presentations found!"); return null;}}else{this.add_error("C13_3","No content '"+ this.IPPS.XMLTAGPATH_PRES +"' element to get presentations from!"); return null;}}else{this.add_error("C13_2","No template found with name '"+ tmplName +"'!"); return null;}}else{this.add_error("C13_1","No content available to get presentations from!"); return null;}} function Content_get_presentations_by_template_name(tmplName) {var presentations=new Array(); var tmplId; if(this.is_parsed() && this.contentObject !=null) {tmplId=this.get_template_id_from_name(tmplName); if(tmplId) {var root=this.IPPS.xmldom.selectNode(this.contentObject, this.IPPS.XMLTAGPATH_PRES); if(root) {var nodes=this.IPPS.xmldom.getElements(root, this.IPPS.XMLTAG_PRESENTATION); root=null; if((nodes) && nodes.length > 0) {for(var t=0;t<nodes.length;t++) {if(this.IPPS.unescape(this.IPPS.xmldom.getAttribute(nodes[t], "template_id"))==tmplId) {var chosenPres=new Presentation(this.IPPS, nodes[t], this.IPPS.PRESENTATION_SHORT); if(chosenPres) {presentations[presentations.length]=chosenPres;}else{this.add_error("C19_5","Error during creation of presentation-object!");}}}}else{this.add_error("C19_4","No presentation found with template ID '"+ tmplId +"'!");}}else{this.add_error("C19_3","No content '"+ this.IPPS.XMLTAGPATH_PRES +"' element to get presentations from!");}}else{this.add_error("C19_2","No content '"+ this.IPPS.XMLTAGPATH_PRES +"' element to get presentations from!");}}else{this.add_error("C19_1","No content available to get presentations from!");} return presentations;} function Content_get_all_presentations() {var presentations=new Array(); if(this.is_parsed() && this.contentObject !=null) {var root=this.IPPS.xmldom.selectNode(this.contentObject, this.IPPS.XMLTAGPATH_PRES); if(root) {var nodes=this.IPPS.xmldom.getElements(root, this.IPPS.XMLTAG_PRESENTATION); root=null; if((nodes) && nodes.length > 0) {for(var t=0;t<nodes.length;t++) {var chosenPres=new Presentation(this.IPPS, nodes[t], this.IPPS.PRESENTATION_SHORT); if(chosenPres) {presentations[presentations.length]=chosenPres;}else{this.add_error("C22_4","Error during creation of presentation-object!");}}}else{this.add_error("C22_3","No presentations found!");}}else{this.add_error("C22_2","No content '"+ this.IPPS.XMLTAGPATH_PRES +"' element to get presentations from!");}}else{this.add_error("C22_1","No content available to get presentations from!");} return presentations;} function Content_get_structure_by_id(structID) {if(this.is_parsed() && this.contentObject !=null) {var root=this.IPPS.xmldom.selectNode(this.contentObject, this.IPPS.XMLTAGPATH_STRUCT); if(root) {var node=this.IPPS.xmldom.getElementByTagAndAttribute(root, this.IPPS.XMLTAG_STRUCTURE, "id", ""+structID); root=null; if(node) {var chosenStruct=new Structure(this.IPPS, this.IPPS.xmldom.getAttribute(node, "id"), this.IPPS.xmldom.getAttribute(node, "name"), node); if(chosenStruct) {return chosenStruct;}else{this.add_error("C7_4","Error during creation of structure-object!"); return null;}}else{this.add_error("C7_3","No structure found with ID '"+ structID +"'!"); return null;}}else{this.add_error("C7_2","No content '"+ this.IPPS.XMLTAGPATH_STRUCTURE +"' element to get structure from!"); return null;}}else{this.add_error("C7_1","No content available to get a structure from!"); return null;}} function Content_get_structure_name_by_id(structID) {if(this.is_parsed() && this.contentObject !=null) {var root=this.IPPS.xmldom.selectNode(this.contentObject, this.IPPS.XMLTAGPATH_STRUCT); if(root) {if(structID=="0") {return this.IPPS.STRUCTURE_ROOTNAME;}else{var node=this.IPPS.xmldom.getElementByTagAndAttribute(root, this.IPPS.XMLTAG_STRUCTURE, "id", ""+structID); root=null; if(node) {var structName=this.IPPS.xmldom.getAttribute(node,"name"); if(structName) {return this.IPPS.unescape(structName);}else{this.add_error("C24_4","No structure name attribute found in structure with id '"+ structID +"'!"); return null;}}else{this.add_error("C24_3","No structure found with ID '"+ structID +"'!"); return null;}}}else{this.add_error("C24_2","No content '"+ this.IPPS.XMLTAGPATH_STRUCTURE +"' element to get structure from!"); return null;}}else{this.add_error("C24_1","No content available to get a structure from!"); return null;}} function Content_get_structure_by_name(structName) {if(this.is_parsed() && this.contentObject !=null) {var root=this.IPPS.xmldom.selectNode(this.contentObject, this.IPPS.XMLTAGPATH_STRUCT); if(root) {var node=this.IPPS.xmldom.getElementByTagAndAttribute(root, this.IPPS.XMLTAG_STRUCTURE, "name", structName); root=null; if(node) {var chosenStruct=new Structure(this.IPPS, this.IPPS.xmldom.getAttribute(node, "id"), structName, node); if(chosenStruct) {return chosenStruct;}else{this.add_error("C12_5","Error during creation of structure-object!"); return null;}}else{this.add_error("C12_3","No structure found with name '"+ structName +"'!"); return null;}}else{this.add_error("C12_2","No content '"+ this.IPPS.XMLTAGPATH_STRUCTURE +"' element to get structure from!"); return null;}}else{this.add_error("C12_1","No content available to get a structure from!"); return null;}} function Content_extract_mediatypes() {if(this.is_parsed() && this.contentObject !=null) {var typesRoot=this.IPPS.xmldom.selectNode(this.contentObject, this.IPPS.XMLTAGPATH_MEDIATYPES); if(typesRoot) {var types=this.IPPS.xmldom.getElements(typesRoot, this.IPPS.XMLTAG_MEDIATYPES); if(types.length > 0) {for(var j=0;j<types.length;j++) {var jTypeName=this.IPPS.unescape(this.IPPS.xmldom.getAttribute(types[j],"name")); var jTypeID=this.IPPS.xmldom.getAttribute(types[j],"id"); if((jTypeName) && (jTypeID)) {switch(jTypeName) {case "text": this.IPPS.MEDIATYPE_TEXT=jTypeID; this.IPPS.MEDIATYPE_TEXT_DESC=jTypeName; break; case "number": this.IPPS.MEDIATYPE_NUMBER=jTypeID; this.IPPS.MEDIATYPE_NUMBER_DESC=jTypeName; break; case "image": this.IPPS.MEDIATYPE_IMAGE=jTypeID; this.IPPS.MEDIATYPE_IMAGE_DESC=jTypeName; break; case "video": this.IPPS.MEDIATYPE_VIDEO=jTypeID; this.IPPS.MEDIATYPE_VIDEO_DESC=jTypeName; break; case "textarea": this.IPPS.MEDIATYPE_TEXTAREA=jTypeID; this.IPPS.MEDIATYPE_TEXTAREA_DESC=jTypeName; break; case "powerpoint": this.IPPS.MEDIATYPE_POWERPOINT=jTypeID; this.IPPS.MEDIATYPE_POWERPOINT_DESC=jTypeName; break; case "pdf": this.IPPS.MEDIATYPE_PDF=jTypeID; this.IPPS.MEDIATYPE_PDF_DESC=jTypeName; break; case "flash": this.IPPS.MEDIATYPE_FLASH=jTypeID; this.IPPS.MEDIATYPE_FLASH_DESC=jTypeName; break; case "date": this.IPPS.MEDIATYPE_DATE=jTypeID; this.IPPS.MEDIATYPE_DATE_DESC=jTypeName; break; case "hyperlink": this.IPPS.MEDIATYPE_HYPERLINK=jTypeID; this.IPPS.MEDIATYPE_HYPERLINK_DESC=jTypeName; break; case "free filetype": this.IPPS.MEDIATYPE_FREETYPE=jTypeID; this.IPPS.MEDIATYPE_FREETYPE_DESC=jTypeName; break; default: this.add_error("C8_5","Warning: undefined mediatype!"); break;}}else{this.add_error("C8_4","Warning: illegal mediatype attributes found!");}}}else{this.add_error("C8_3","No mediatype elements found!");}}else{this.add_error("C8_2","No element found to extract mediatypes from!");}}else{this.add_error("C8_1","No content available to extract mediatypes from!");}} function Content_get_all_templates() {var templates=new Array(); if(this.is_parsed() && this.contentObject !=null) {var root=this.IPPS.xmldom.selectNode(this.contentObject, this.IPPS.XMLTAGPATH_TEMPLATES); if(root) {var node=this.IPPS.xmldom.getElements(root, this.IPPS.XMLTAG_TEMPLATE); root=null; if((node) && node.length > 0) {var n=0; while(n<node.length) {var tempArr=new Array(); tempArr.id=this.IPPS.xmldom.getAttribute(node[n], "id"); tempArr.name=this.IPPS.unescape(this.IPPS.xmldom.getAttribute(node[n], "name")); templates[templates.length]=tempArr; n++;}}else{this.add_error("C20_3","No template elements found!");}}else{this.add_error("C20_2","No templateroot found!");}}else{this.add_error("C20_1","No content available to get template id from!");} return templates;} function Content_get_template_id_from_name(tmplName) {if(this.is_parsed() && this.contentObject !=null) {var root=this.IPPS.xmldom.selectNode(this.contentObject, this.IPPS.XMLTAGPATH_TEMPLATES); if(root) {var node=this.IPPS.xmldom.getElements(root, this.IPPS.XMLTAG_TEMPLATE); root=null; if(node.length > 0) {var n=0; var foundNode; while(n<node.length) {if(this.IPPS.unescape(this.IPPS.xmldom.getAttribute(node[n],"name"))==tmplName) {foundNode=node[n];} n++;} if(foundNode) {return this.IPPS.xmldom.getAttribute(foundNode, "id");}else{return null;}}else{this.add_error("C16_3","No template found with name '"+ tmplName +"'!"); return null;}}else{this.add_error("C16_2","No template elements found!"); return null;}}else{this.add_error("C16_1","No content available to get template id from!"); return null;}} function Content_get_template_name_from_id(tmplId) {if(this.is_parsed() && this.contentObject !=null) {var root=this.IPPS.xmldom.selectNode(this.contentObject, this.IPPS.XMLTAGPATH_TEMPLATES); if(root) {var node=this.IPPS.xmldom.getElementByTagAndAttribute(root, this.IPPS.XMLTAG_TEMPLATE, "id", ""+tmplId); root=null; if(node) {return this.IPPS.unescape(this.IPPS.xmldom.getAttribute(node, "name"));}else{this.add_error("C18_3","No template found with id '"+ tmplId +"'!"); return null;}}else{this.add_error("C18_2","No template elements found!"); return null;}}else{this.add_error("C18_1","No content available to get template id from!"); return null;}} function Content_get_playlist_name_from_id(id) {var root=this.get_parsed_content(); if(root) {var listroot=this.IPPS.xmldom.selectNode(root, this.IPPS.XMLTAGPATH_PLAYLISTS); if(listroot) {var playlist=this.IPPS.xmldom.getElementByTagAndAttribute(listroot, this.IPPS.XMLTAG_PLAYLIST, "id", ""+id); if(playlist) {return this.IPPS.unescape(this.IPPS.xmldom.getAttribute(playlist, "name"));}else{this.add_error("C9_3","No playlist found with id '"+ id +"'!"); return null;}}else{this.add_error("C9_2","No playlists found to search for playlistname!"); return null;}}else{this.add_error("C9_1","No parsed content found to search for playlistname!"); return null;}} function Content_get_playlist_id_from_name(name, tmplName) {var root=this.get_parsed_content(); if(root) {var tmplId=this.get_template_id_from_name(tmplName); if(tmplId) {var listroot=this.IPPS.xmldom.selectNode(root, this.IPPS.XMLTAGPATH_PLAYLISTS); if(listroot) {var playlist=this.IPPS.xmldom.getElements(listroot, this.IPPS.XMLTAG_PLAYLIST); if((playlist) && (playlist.length > 0)) {var p=0; var found=false; while(p<playlist.length) {if(this.IPPS.unescape(this.IPPS.xmldom.getAttribute(playlist[p], "name"))==name && this.IPPS.xmldom.getAttribute(playlist[p], "template_id")==tmplId) {found=true; return this.IPPS.xmldom.getAttribute(playlist[p], "id");} p++;} if(!found) {this.add_error("C10_5","No playlist found with name '"+ name +"'!"); return null;} return this.IPPS.xmldom.getAttribute(playlist, "id")}else{this.add_error("C10_4","No playlists found!"); return null;}}else{this.add_error("C10_3","No playlistroot found to search for playlists!"); return null;}}else{this.add_error("C10_2","No template found with name '"+ tmplName +"'!"); return null;}}else{this.add_error("C10_1","No parsed content found to search for playlist-id!"); return null;}} function Content_get_all_playlists() {var playlistArr=new Array(); var root=this.get_parsed_content(); if(root) {var listroot=this.IPPS.xmldom.selectNode(root, this.IPPS.XMLTAGPATH_PLAYLISTS); if(listroot) {var playlist=this.IPPS.xmldom.getElements(listroot, this.IPPS.XMLTAG_PLAYLIST); if(playlist && playlist.length > 0) {var pl=0; while(pl < playlist.length) {var playlistObj=new Array(); playlistObj.id=this.IPPS.xmldom.getAttribute(playlist[pl], "id"); playlistObj.name=this.IPPS.xmldom.getAttribute(playlist[pl], "name"); playlistObj.template_id=this.IPPS.xmldom.getAttribute(playlist[pl], "template_id"); playlistArr[playlistArr.length]=playlistObj; pl++;}}else{this.add_error("C11_3","No playlists found !");}}else{this.add_error("C11_2","No playlist root element found!");}}else{this.add_error("C11_1","No parsed content found to search for playlists!");} return playlistArr;} function Content_get_playlists_by_template_name(tmplName) {var playlists=new Array(); var root=this.get_parsed_content(); if(root) {var tmplId=this.get_template_id_from_name(tmplName); if(tmplId) {var listroot=this.IPPS.xmldom.selectNode(root, this.IPPS.XMLTAGPATH_PLAYLISTS); if(listroot) {var playlist=this.IPPS.xmldom.getElements(listroot, this.IPPS.XMLTAG_PLAYLIST); if((playlist) && (playlist.length> 0)) {var p=0; while(p < playlist.length) {if(this.IPPS.xmldom.getAttribute(playlist[p], "template_id")==tmplId) {var playlistObj=new Array(); playlistObj.id=this.IPPS.xmldom.getAttribute(playlist[p], "id"); playlistObj.name=this.IPPS.xmldom.getAttribute(playlist[p], "name"); playlistObj.template_id=this.IPPS.xmldom.getAttribute(playlist[p], "template_id"); playlists[playlists.length]=playlistObj;} p++;}}else{this.add_error("C17_4","No playlists found!");}}else{this.add_error("C17_3","No playlist-root found to search for playlists!");}}else{this.add_error("C17_2","No template found with name '"+ tmplName +"'!");}}else{this.add_error("C17_1","No parsed content found to search for playlists!");} return playlists;} function Content_testXMLparser() {} function Content_get_module(moduleType, moduleIPPS) {var modules; var module; if(this.is_module_active(moduleType)) {modules=this.IPPS.xmldom.selectNode(this.get_parsed_content(), this.IPPS.XMLTAGPATH_MODULES); if(moduleType==this.IPPS.MODULE_KM) {var moduleroot; moduleroot=this.IPPS.xmldom.selectNode(modules, moduleType); if(moduleroot) {var settingsNode=this.IPPS.xmldom.selectNode(moduleroot, this.IPPS.MODULE_SETTINGS); if(!settingsNode) {settingsNode="";} var pageNode=this.IPPS.xmldom.selectNode(moduleroot, this.IPPS.MODULE_KM_FORM); if(!pageNode) {pageNode="";} if((IPPS_Module_km)) {module=new IPPS_Module_km(moduleIPPS, settingsNode, pageNode);}}}else if(moduleType==this.IPPS.MODULE_FRP){var moduleroot; moduleroot=this.IPPS.xmldom.selectNode(modules, moduleType); if(moduleroot) {var settingsNode=this.IPPS.xmldom.selectNode(moduleroot, this.IPPS.MODULE_SETTINGS); if(!settingsNode) {settingsNode="";} if(IPPS_Module_frp) {module=new IPPS_Module_frp(moduleIPPS, settingsNode);}}} if(module) {return(module);}else{this.add_error("C21_2", "Error during Module-instantiation!"); return null;}}else{this.add_error("C21_1", "Module not active!"); return null;}} function Content_get_module_logpage(logType, logVars, callback) {var logPage=""; var rootLoc=this.get_root_location(); if(this.get_live_type()==this.IPPS.ONLINE) {if(this.is_module_active(this.IPPS.MODULE_RM) || this.is_module_active(this.IPPS.MODULE_KM)) {logPage=rootLoc + this.IPPS.MODULE_RM_LOC +"prelog.asp?logType="+ logType; switch(logType) {case "category": if(this.is_module_active(this.IPPS.MODULE_RM)) {if((logVars) && (logVars.length==3)) {logPage=logPage +"&pres="+ this.IPPS.escape(logVars[0]); logPage=logPage +"&presid="+ logVars[1]; logPage=logPage +"&category="+ this.IPPS.escape(logVars[2]);}else{this.add_error("C23_3", "Logarguments missing/invalid for category logging!");}} break; case "slide": if(this.is_module_active(this.IPPS.MODULE_RM)) {if((logVars) && (logVars.length==5)) {logPage=logPage +"&pres="+ this.IPPS.escape(logVars[0]); logPage=logPage +"&presid="+ logVars[1]; logPage=logPage +"&playlist="+ this.IPPS.escape(logVars[2]); logPage=logPage +"&slidenumber="+ logVars[3]; logPage=logPage +"&totalslides="+ logVars[4];}else{this.add_error("C23_4", "Logarguments missing/invalid for slide logging!");}} break; case "response": if(this.is_module_active(this.IPPS.MODULE_RM)) {if((logVars) && (logVars.length==1)) {logPage=logPage +"&response="+ logVars[0];}else{this.add_error("C23_5", "Logarguments missing/invalid for response logging!");}} break; case "download": if(this.is_module_active(this.IPPS.MODULE_RM)) {if((logVars) && (logVars.length==5)) {logPage=logPage +"&pres="+ this.IPPS.escape(logVars[0]); logPage=logPage +"&presid="+ logVars[1]; logPage=logPage +"&mediaid="+ logVars[2]; logPage=logPage +"&medianame="+ this.IPPS.escape(logVars[3]); logPage=logPage +"&mediatype="+ logVars[4];}else{this.add_error("C23_6", "Logarguments missing/invalid for download logging!");}} break; case "evaluation": if((logVars) && (logVars.length==1)) {logPage=logPage +"&pres="+ this.IPPS.escape(logVars[0]); logPage=logPage +"&list_id=3"; if(this.is_module_active(this.IPPS.MODULE_RM)) {logPage=logPage +"&rm_active=1";} if(this.is_module_active(this.IPPS.MODULE_KM)) {logPage=logPage +"&km_active=1";}}else{this.add_error("C23_7", "Logarguments missing/invalid for evaluation logging!");} break; case "viewing": if((logVars) && (logVars.length==2)) {logPage=logPage +"&pres_id="+ logVars[0]; logPage=logPage +"&playlist_id="+ logVars[1]; logPage=logPage +"&list_id=2"; if(this.is_module_active(this.IPPS.MODULE_KM)) {logPage=logPage +"&km_active=1";}}else{this.add_error("C23_8", "Logarguments missing/invalid for view logging!");} break;} if(callback !="") {if(callback.toLowerCase().indexOf("://")==-1) {logPage=logPage +"&callback="+ this.IPPS.escape(rootLoc + callback);}else{logPage=logPage +"&callback="+ this.IPPS.escape(callback);}}}else{this.add_error("C23_2", "Warning: RM Module not active!"); if(callback !="") {if(callback.toLowerCase().indexOf("://")==-1) {logPage=rootLoc + callback;}else{logPage=callback;}}}}else{this.add_error("C23_1", "Not online!"); if(callback !="") {if(callback.toLowerCase().indexOf("://")==-1) {logPage=rootLoc + callback;}else{logPage=callback;}}} return logPage;} function Content_is_module_active(moduleType) {var active=false; var modules; var root=this.get_parsed_content(); if(root) {modules=this.IPPS.xmldom.selectNode(root, this.IPPS.XMLTAGPATH_MODULES); if(modules) {var module; module=this.IPPS.xmldom.selectNode(modules, moduleType); if(module) {active=true;}}} return active;} function Content_get_email_from_user_id(user_id) {var root=this.get_parsed_content(); if(root) {var listroot=this.IPPS.xmldom.selectNode(root, this.IPPS.XMLTAGPATH_USERS); if(listroot) {var user=this.IPPS.xmldom.selectNode(listroot, "/"+ this.IPPS.XMLTAG_USER +'[@id="'+ user_id +'"]'); if(user) {user_email=this.IPPS.xmldom.getAttribute(user, "email"); if(user_email) {return this.IPPS.unescape(user_email);}else{this.add_error("C22_4","No email attribute found!"); return null;}}else{this.add_error("C22_3","No user found with id '"+ user_id +"'!"); return null;}}else{this.add_error("C22_2","No users-root found!"); return null;}}else{this.add_error("C22_1","No parsed content found!"); return null;} return playlists;} function Content_add_error(errorId, errorMsg) {if(errorId !=null && errorMsg !=null) {if(this.IPPS.errorMonitor) {var ippsError=new IPPS_error(errorId, "Content", errorMsg); this.IPPS.errorMonitor.add_error(ippsError);}}} function Structure(ipps, id, name, nodeOffset) {this.IPPS=ipps; this.id=id; this.name=this.IPPS.unescape(name); this.structure=new Array(); this.presentations=new Array(); this.nodeOffset=nodeOffset; this.get_id=Structure_get_id; this.get_name=Structure_get_name; this.add_error=Structure_add_error; this.has_presentations=Structure_has_pres; this.has_structure=Structure_has_struct; this.has_presentation_by_template=Structure_has_presentation_by_template; this.get_presentation_count=Structure_get_pres_count; this.get_structure_count=Structure_get_struct_count; this.get_presentations=Structure_get_presentations; this.get_presentation_info=Structure_get_pres_info; this.get_sub_structure_by_position=Structure_get_sub_structure_by_position; this.get_sub_structure_by_id=Structure_get_sub_structure_by_id; this.get_sub_history_by_id=Structure_get_sub_history_by_id; this.extract_presentations=Structure_extract_pres; this.extract_structure=Structure_extract_struct; this._init=Structure_init; this._init();} function Structure_init() {if(this.extract_presentations()) {this.nodeOffset=null;}else if(this.extract_structure()){this.nodeOffset=null;}else{this.nodeOffset=null;}} function Structure_get_id() {if(this.id !=null) {return this.id;}else{this.add_error("S1","Structure id not set!"); return "";}} function Structure_get_name() {if(this.name !=null) {return this.name;}else{this.add_error("S2","Structure name not set!"); return "";}} function Structure_extract_pres() {if(this.presentations.length==0 && this.nodeOffset !=null) {var pres=this.IPPS.xmldom.getElements(this.nodeOffset, this.IPPS.XMLTAG_PRESENTATION); if(pres.length > 0) {var j=0; while(j<pres.length) {var presToAdd=new Array(); presToAdd.id=this.IPPS.xmldom.getAttribute(pres[j], "id"); this.presentations[this.presentations.length]=presToAdd; j++;} return true;}else{return false;}}else{if(this.has_presentations()) {this.add_error("S3","Extracting already done and "+ this.presentations.length +" presentation(s) found!");}else{this.add_error("S4","Extracting already done and no presentations found!");} return false;}} function Structure_extract_struct() {if(this.structure.length==0 && this.nodeOffset !=null) {var struct=this.IPPS.xmldom.getElements(this.nodeOffset, this.IPPS.XMLTAG_STRUCTURE); if(struct.length > 0) {var j=0; while(j<struct.length) {this.structure[this.structure.length]=new Structure(this.IPPS, this.IPPS.xmldom.getAttribute(struct[j], "id"), this.IPPS.xmldom.getAttribute(struct[j], "name"), struct[j]); j++;} return true;}else{return false;}}else{if(this.has_structure()) {this.add_error("S5","Extracting already done and "+ this.structure.length +" structure element(s) found!");}else{this.add_error("S6","Extracting already done and no structure elements found!");} return false;}} function Structure_has_pres() {if(this.presentations.length > 0) {return true;}else{return false;}} function Structure_has_struct() {if(this.structure.length > 0) {return true;}else{return false;}} function Structure_get_pres_count() {return this.presentations.length;} function Structure_get_struct_count() {return this.structure.length;} function Structure_get_pres_info(presIndex) {if(presIndex >=0 && presIndex < this.get_presentation_count()) {return this.presentations[parseInt(presIndex)];}else{this.add_error("S7","Requested presentation not found!"); return(new Array[-1]);}} function Structure_get_presentations() {return this.presentations;} function Structure_get_sub_structure_by_position(structIndex) {if(structIndex >=0 && structIndex < this.get_structure_count()) {return this.structure[parseInt(structIndex)];}else{this.add_error("S8","Requested structure not found!"); return null;}} function Structure_get_sub_structure_by_id(structId) {if(this.get_structure_count() > 0) {var s=0; var found=false; while(s < this.get_structure_count()) {if(this.structure[s].get_id()==structId) {found=true; return this.structure[s];}else{var subTry=this.structure[s].get_sub_structure_by_id(structId); if(subTry) {found=true; return subTry;}} s++;} if(!found) {return null;}}else{this.add_error("S9","Requested structure with id '"+ structId +"' not found!"); return null;}} function Structure_get_sub_history_by_id(structId, structArray) {if(this.get_structure_count() > 0) {var s=0; var found=false; while(s < this.get_structure_count()) {if(this.structure[s].get_id()==structId) {found=true; if(!structArray) {var structArray=new Array();} structArray[structArray.length]=this.structure[s].get_id(); if(this.get_id()=="0") {return structArray;}else{structArray[structArray.length]=this.get_id(); return structArray;}}else{if(!structArray) {var structArray=new Array();} var subTry=this.structure[s].get_sub_history_by_id(structId, structArray); if(subTry) {found=true; if(this.get_id()=="0") {return structArray;}else{structArray[structArray.length]=this.get_id(); return structArray;}}} s++;} if(!found) {return null;}}else{this.add_error("S11","Requested structure with id '"+ structId +"' not found!"); return null;}} function Structure_has_presentation_by_template(templateName) {var found=false; var tmplId=this.IPPS.get_content().get_template_id_from_name(templateName); if(tmplId) {if(this.get_presentation_count() > 0) {var p=0; while(p < this.get_presentation_count()) {var shortPres=this.IPPS.get_content().get_presentation_by_id(this.presentations[p]["id"]); if(shortPres) {if(shortPres.get_template_id()==tmplId) {found=true;}} if(found) {break;} p++;}}else if(this.get_structure_count() > 0) {var s=0; while(s < this.get_structure_count()) {found=this.structure[s].has_presentation_by_template(templateName); if(found) {break;} s++;}}}else{this.add_error("S10_1","Template with the name '"+ templateName +"' not found!");} return found;} function Structure_add_error(errorId, errorMsg) {if(errorId !=null && errorMsg !=null) {if(this.IPPS.errorMonitor) {var ippsError=new IPPS_error(errorId, "Structure", errorMsg); this.IPPS.errorMonitor.add_error(ippsError);}}} function Presentation(ipps, node, type) {this.IPPS=ipps; this.node=node; this.type=type; this.add_error=Presentation_add_error; this.get_id=Presentation_get_id; this.get_name=Presentation_get_name; this.get_parsed_content=Presentation_get_parsed_content; this.get_template_id=Presentation_get_template_id; this.get_user_id=Presentation_get_user_id; this.get_playlists=Presentation_get_playlists; this.get_playlist_name_from_id=Presentation_get_playlist_name_from_id; this.get_playlist_id_from_name=Presentation_get_playlist_id_from_name; this.has_playlist_by_name=Presentation_has_playlist_by_name; this.has_playlist_by_id=Presentation_has_playlist_by_id; this.get_first_publish_date=Presentation_get_first_publish_date; this.get_metadata=Presentation_get_metadata; this.get_module_setting=Presentation_get_module_setting; this.get_module_content=Presentation_get_module_content; if(this.type==this.IPPS.PRESENTATION_NORMAL) {this.check_access=Presentation_check_access; this.extract_playlist=Presentation_extract_playlist; this.get_playlist_by_id=Presentation_get_playlist_by_id; this.get_playlist_by_name=Presentation_get_playlist_by_name; this.get_all_media_nodes=Presentation_get_all_media_nodes; this.get_media_by_type=Presentation_get_media_by_type; this.get_media_by_id_and_type=Presentation_get_media_by_id_and_type; this.get_media_by_name_and_type=Presentation_get_media_by_name_and_type; this.get_media_by_node_name_and_type=Presentation_get_media_by_node_name_and_type;} this._init=Presentation_init; this._init();} function Presentation_init() {if(this.IPPS.xmldom.getTagname(this.node) !=this.IPPS.XMLTAG_PRESENTATION) {this.node=this.IPPS.xmldom.selectNode(this.node, this.IPPS.XMLTAGPATH_PRESENTATION);}} function Presentation_get_id() {var id=this.IPPS.xmldom.getAttribute(this.node, "id"); if(id) {return parseInt(id);}else{this.add_error("PR1","Not able to get the id attribute of the presentation!"); return null;}} function Presentation_get_name() {var name=this.IPPS.xmldom.getAttribute(this.node, "name"); if(name) {return this.IPPS.unescape(name);}else{this.add_error("PR2","Not able to get the name attribute of the presentation!"); return null;}} function Presentation_get_user_id() {var id=this.IPPS.xmldom.getAttribute(this.node, "user_id"); if(id) {return parseInt(id);}else{this.add_error("PR19","Not able to get the user_id attribute of the presentation!"); return null;}} function Presentation_get_parsed_content() {if(this.node) {return this.node;}else{this.add_error("PR24","Not able to get the parsed content of the presentation!"); return null;}} function Presentation_get_first_publish_date() {var publish_date=this.IPPS.xmldom.getAttribute(this.node, "published"); if(publish_date) {return this.IPPS.unescape(publish_date);}else{this.add_error("PR20","Not able to get the first_publish_date attribute of the presentation!"); return null;}} function Presentation_get_template_id() {var type=this.IPPS.xmldom.getAttribute(this.node, "template_id"); if(type) {return type;}else{this.add_error("PR3","Not able to get the template attribute of the presentation!"); return null;}} function Presentation_get_metadata(metadataName) {var metaroot=this.IPPS.xmldom.selectNode(this.node, this.IPPS.XMLTAGPATH_PRESMETA); if(metaroot) {var metadata=this.IPPS.xmldom.getElements(metaroot, metadataName); if(metadata && metadata.length > 0) {return this.IPPS.unescape(this.IPPS.xmldom.getNodeValue(metadata[0]));}else{this.add_error("PR4_2","Not able to get the metadata named '"+ metadataName +"' of this presentation!"); return "";}}else{this.add_error("PR4_1","No metadata rootelement found in this presentation"); return "";}} function Presentation_check_access(incomingDoc) {var referrer; var access=false; if(incomingDoc) {if(incomingDoc.referrer=="") {referrer=incomingDoc.location.href;}else{referrer=incomingDoc.referrer;}}else{if(self.document.referrer=="") {referrer=self.document.location.href;}else{referrer=self.document.referrer;}} var metaroot=this.IPPS.xmldom.selectNode(this.node, this.IPPS.XMLTAGPATH_PRESACCESS); if(metaroot) {var restricted=this.IPPS.xmldom.getAttribute(metaroot, "restricted"); if(restricted=="1") {var allowed=this.IPPS.xmldom.getElements(metaroot, "domain"); if(allowed) {var a=0; while(a < allowed.length) {if(referrer.toLowerCase().indexOf(this.IPPS.unescape(this.IPPS.xmldom.getNodeValue(allowed[a])).toLowerCase()) > -1) {access=true;} a++;}}}else if(restricted=="0"){access=true; var allowed=this.IPPS.xmldom.getElements(metaroot, "domain"); if(allowed) {var a=0; while(a < allowed.length) {if(referrer.toLowerCase().indexOf(this.IPPS.unescape(this.IPPS.xmldom.getNodeValue(allowed[a])).toLowerCase()) > -1) {access=false;} a++;}}}}else{this.add_error("PR23_1","No accesslist rootelement found in this presentation");} return access;} function Presentation_get_playlists() {var playlists=new Array(); var playlistdata=this.IPPS.xmldom.getElements(this.node, this.IPPS.XMLTAG_PLAYLIST); if(playlistdata && playlistdata.length > 0) {var f=0; while(f < playlistdata.length) {if(this.type==this.IPPS.PRESENTATION_SHORT) {playlists[playlists.length]=this.IPPS.xmldom.getAttribute(playlistdata[f], "id");}else if(this.type==this.IPPS.PRESENTATION_NORMAL){playlists[playlists.length]=this.extract_playlist(playlistdata[f]);} f++;}}else{this.add_error("PR8_1","No playlistdata found in this presentation");} return playlists;} function Presentation_get_playlist_by_id(id) {var playlist=this.IPPS.xmldom.getElementByTagAndAttribute(this.node, this.IPPS.XMLTAG_PLAYLIST, "id", ""+id); if(playlist) {var returnPlaylist=this.extract_playlist(playlist); if(returnPlaylist) {return returnPlaylist;}else{this.add_error("PR14_2","Error during playlist creation"); return null;}}else{this.add_error("PR14_1","No playlist found in this presentation with id '"+ id +"'"); return null;}} function Presentation_get_playlist_name_from_id(id) {var root=this.IPPS.get_content().get_parsed_content(); if(root) {var listroot=this.IPPS.xmldom.selectNode(root, this.IPPS.XMLTAGPATH_PLAYLISTS); if(listroot) {var playlist=this.IPPS.xmldom.getElementByTagAndAttribute(listroot, this.IPPS.XMLTAG_PLAYLIST, "id", ""+id); if(playlist) {return this.IPPS.unescape(this.IPPS.xmldom.getAttribute(playlist, "name"));}else{this.add_error("PR15_3","No playlist found with id '"+ id +"'!"); return null;}}else{this.add_error("PR15_2","No playlistroot found to search for playlistname!"); return null;}}else{this.add_error("PR15_1","No parsed content found to search for playlistname!"); return null;}} function Presentation_get_playlist_id_from_name(name) {var root=this.IPPS.get_content().get_parsed_content(); if(root) {var listroot=this.IPPS.xmldom.selectNode(root, this.IPPS.XMLTAGPATH_PLAYLISTS); if(listroot) {var playlists=this.IPPS.xmldom.getElements(listroot, this.IPPS.XMLTAG_PLAYLIST); if((playlists) && (playlists.length > 0)) {var found=false; var p=0; while(p < playlists.length) {if(this.IPPS.unescape(this.IPPS.xmldom.getAttribute(playlists[p], "name"))==name && this.IPPS.xmldom.getAttribute(playlists[p], "template_id")==this.get_template_id()) {found=true; return this.IPPS.xmldom.getAttribute(playlists[p], "id");} p++;} if(!found) {this.add_error("PR16_4","No playlist found with name '"+ name +"'!"); return null;}}else{this.add_error("PR16_3","No playlists found to search for playlist-id!"); return null;}}else{this.add_error("PR16_2","No playlists found to search for playlist-id!"); return null;}}else{this.add_error("PR16_1","No parsed content found to search for playlist-id!"); return null;}} function Presentation_get_playlist_by_name(name) {var playlistID=this.get_playlist_id_from_name(name); if(playlistID) {var playlist=this.IPPS.xmldom.getElementByTagAndAttribute(this.node, this.IPPS.XMLTAG_PLAYLIST, "id", ""+playlistID); if(playlist) {return this.extract_playlist(playlist);}else{this.add_error("PR17_2","No playlist found in this presentation with name '"+ name +"'"); return null;}}else{this.add_error("PR17_1","No playlist in the content with name '"+ name +"'"); return null;}} function Presentation_has_playlist_by_name(name) {var found=false; var playlistID=this.get_playlist_id_from_name(name); if(playlistID) {var playlist=this.IPPS.xmldom.getElementByTagAndAttribute(this.node, this.IPPS.XMLTAG_PLAYLIST, "id", ""+playlistID); if(playlist) {found=true;}}else{this.add_error("PR18_1","No playlist in the content with name '"+ name +"'");} return found;} function Presentation_has_playlist_by_id(id) {var found=false; var playlist=this.IPPS.xmldom.getElementByTagAndAttribute(this.node, this.IPPS.XMLTAG_PLAYLIST, "id", ""+id); if(playlist) {found=true;} return found;} function Presentation_extract_playlist(playlistNode) {var media=new Array(); var preloadmedia=new Array(); var mediadata=this.IPPS.xmldom.getElements(playlistNode, this.IPPS.XMLTAG_PLAYLISTMEDIA); if(mediadata && mediadata.length > 0) {var f2=0; while(f2 < mediadata.length) {tempMedia=this.get_media_by_id_and_type(this.IPPS.xmldom.getAttribute(mediadata[f2], "id"), this.IPPS.xmldom.getAttribute(mediadata[f2], "type_id")); if(tempMedia) {media[media.length]=tempMedia; var preloaddata=this.IPPS.xmldom.selectNode(mediadata[f2], this.IPPS.XMLTAGPATH_PRESPRELOAD); if(preloaddata) {var filedata=this.IPPS.xmldom.getElements(preloaddata, this.IPPS.XMLTAG_PRELOADMEDIA); if(filedata && filedata.length > 0) {if(this.IPPS.xmldom.getAttribute(mediadata[f2],"type_id")==this.IPPS.MEDIATYPE_VIDEO) {var fd=0; while(fd < filedata.length) {var tocItem=tempMedia.get_tocitem_by_id(this.IPPS.xmldom.getAttribute(filedata[fd],"id")); if(tocItem) {preloadmedia[preloadmedia.length]=tocItem.get_url();} fd++;}}}else{this.add_error("PR8_4","No preloadfiles found in this presentation!");}}else{this.add_error("PR8_3","No preloadroot found in this presentation!");}}else{this.add_error("PR8_2","error during media creation");} f2++;}} return new Playlist(this.IPPS, this.IPPS.xmldom.getAttribute(playlistNode, "id"), this.get_playlist_name_from_id(this.IPPS.xmldom.getAttribute(playlistNode, "id")), media, preloadmedia);} function Presentation_get_all_media_nodes() {var mediaroot=this.IPPS.xmldom.selectNode(this.node, this.IPPS.XMLTAGPATH_PRESMEDIA); if(mediaroot) {var mediadata=this.IPPS.xmldom.getElements(mediaroot, this.IPPS.XMLTAG_MEDIA); if(mediadata && mediadata.length > 0) {return mediadata;}else{this.add_error("PR9_2","No media elements found in this presentation"); return null;}}else{this.add_error("PR9_1","No media rootelement found in this presentation"); return null;}} function Presentation_get_media_by_id_and_type(id, type) {var mediadata=this.get_all_media_nodes(); if(mediadata) {var f2=0; var mediafound=false; while(f2 < mediadata.length) {if(this.IPPS.xmldom.getAttribute(mediadata[f2], "id")==id) {if(this.IPPS.xmldom.getAttribute(mediadata[f2], "type_id")==type) {mediafound=true; return new Media(this.IPPS, mediadata[f2]);}} f2++;} if(!mediafound) {this.add_error("PR10_2","No media element found in this presentation with id '"+id+"' and type '"+type+"'!"); return null;}}else{this.add_error("PR10_1","No media elements found in this presentation"); return null;}} function Presentation_get_media_by_name_and_type(name, type) {var mediadata=this.get_all_media_nodes(); if(mediadata) {var f2=0; var mediafound=false; while(f2 < mediadata.length) {if(this.IPPS.unescape(this.IPPS.xmldom.getAttribute(mediadata[f2], "name"))==name) {if(this.IPPS.xmldom.getAttribute(mediadata[f2], "type_id")==type) {mediafound=true; return new Media(this.IPPS, mediadata[f2]);}} f2++;} if(!mediafound) {this.add_error("PR11_2","No media element found in this presentation with name '"+name+"' and type '"+type+"'!"); return null;}}else{this.add_error("PR11_1","No media elements found in this presentation"); return null;}} function Presentation_get_media_by_type(type) {var returnMedia=new Array(); var mediadata=this.get_all_media_nodes(); if(mediadata) {var f2=0; var mediafound=false; while(f2 < mediadata.length) {if(this.IPPS.xmldom.getAttribute(mediadata[f2], "type_id")==type) {mediafound=true; returnMedia[returnMedia.length]=new Media(this.IPPS, mediadata[f2]);} f2++;} if(!mediafound) {this.add_error("PR12_2","No media element found in this presentation type '"+type+"'!");}}else{this.add_error("PR12_1","No media elements found in this presentation");} return returnMedia;} function Presentation_get_media_by_node_name_and_type(nodename, type) {var mediadata=this.get_all_media_nodes(); if(mediadata) {var f2=0; var mediafound=false; while(f2 < mediadata.length) {if(this.IPPS.unescape(this.IPPS.xmldom.getAttribute(mediadata[f2], "nodename"))==nodename) {if(this.IPPS.xmldom.getAttribute(mediadata[f2], "type_id")==type) {mediafound=true; return new Media(this.IPPS, mediadata[f2]);}} f2++;} if(!mediafound) {this.add_error("PR13_2","No media element found in this presentation with nodename '"+nodename+"' and type '"+type+"'!"); return null;}}else{this.add_error("PR13_1","No media elements found in this presentation"); return null;}} function Presentation_get_module_setting(moduleType, settingName) {var moduleroot=this.IPPS.xmldom.selectNode(this.node, this.IPPS.XMLTAGPATH_MODULES); if(moduleroot) {var settingroot=this.IPPS.xmldom.selectNode(moduleroot, moduleType); if(settingroot) {var metadata=this.IPPS.xmldom.getAttribute(settingroot, settingName); if(metadata) {return this.IPPS.unescape(metadata);}else{this.add_error("PR21_3","Not able to get the setting named '"+ settingName +"' of this presentation!"); return null;}}else{this.add_error("PR21_2","No module element found in this presentation for the specified type"); return null;}}else{this.add_error("PR21_1","No modules element found in this presentation"); return null;}} function Presentation_get_module_content(moduleType, subcontent) {var moduleroot=this.IPPS.xmldom.selectNode(this.node, this.IPPS.XMLTAGPATH_MODULES); if(moduleroot) {var settingroot=this.IPPS.xmldom.selectNode(moduleroot, moduleType); if(settingroot) {if(subcontent) {var metadata=this.IPPS.xmldom.selectNode(settingroot, subcontent); if(metadata) {return metadata;}else{this.add_error("PR22_3","Not able to get the content '"+ subcontent +"' of this presentation!"); return null;}}else{return settingroot;}}else{this.add_error("PR22_2","No module element found in this presentation for the specified type"); return null;}}else{this.add_error("PR22_1","No modules element found in this presentation"); return null;}} function Presentation_add_error(errorId, errorMsg) {if(errorId !=null && errorMsg !=null) {if(this.IPPS.errorMonitor) {var ippsError=new IPPS_error(errorId, "Presentation", errorMsg); this.IPPS.errorMonitor.add_error(ippsError);}}} function Playlist(ipps, id, name, media, preloadmedia) {this.IPPS=ipps; this.id=id; this.name=name; this.media=media; this.preloadmedia=preloadmedia; this.actualpreload=new Array(); this.get_media_count=Playlist_get_media_count; this.get_preloadmedia_count=Playlist_get_preloadmedia_count; this.get_media_by_position=Playlist_get_media_by_position; this.get_preloadmedia_by_position=Playlist_get_preloadmedia_by_position; this.get_total_duration=Playlist_get_total_duration; this.get_total_tocitems=Playlist_get_total_tocitems; this.get_tocitem_position=Playlist_get_tocitem_position; this.get_id=Playlist_get_id; this.get_name=Playlist_get_name; this.do_preload=Playlist_do_preload;} function Playlist_get_media_count() {return this.media.length;} function Playlist_get_preloadmedia_count() {return this.preloadmedia.length;} function Playlist_get_id() {return this.id;} function Playlist_get_name() {return this.IPPS.unescape(this.name);} function Playlist_get_media_by_position(position) {if(!isNaN(position)) {if(position > 0 && position <=this.get_media_count()) {return this.media[position-1];}else{return null; this.add_error("PL1_2","Invalid playlist position");}}else{return null; this.add_error("PL1_1","Invalid playlist position");}} function Playlist_get_preloadmedia_by_position(position) {if(!isNaN(position)) {if(position > 0 && position <=this.get_preloadmedia_count()) {return this.preloadmedia[position-1];}else{return null; this.add_error("PL2_2","Invalid playlist position");}}else{return null; this.add_error("PL2_1","Invalid playlist position");}} function Playlist_get_total_duration(format) {var returnStr=""; var totalSecs=0; var duration=new Array(); if(format) {var formatArr=format.split(":"); if(this.get_media_count() > 0) {var p=1; while(p <=this.get_media_count()) {totalSecs=totalSecs + this.get_media_by_position(p).get_duration_in_seconds(); p++;} var hours=Math.floor(totalSecs/3600); var mins=Math.floor((totalSecs - 3600*hours)/60); var secs=Math.floor(totalSecs - (3600*hours + 60*mins)); for(var f=0;f<formatArr.length;f++) {switch(formatArr[f]) {case "hh": if(hours < 10) {hours="0"+ hours;} returnStr=returnStr + hours; break; case "mm": if(mins < 10) {mins="0"+ mins;} returnStr=returnStr + mins; break; case "ss": if(secs < 10) {secs="0"+ secs;} returnStr=returnStr + secs; break; default: this.add_error("P15_2","Illegal duration format found!"); break;} if(f < formatArr.length -1) {returnStr=returnStr + ":";}}}else{for(var f=0;f<formatArr.length;f++) {returnStr +="00"; if(f < formatArr.length -1) {returnStr +=":";}}}}else{this.add_error("P15_1","No duration format found!");} return returnStr;} function Playlist_get_total_tocitems() {var totalTocs=0; if(this.get_media_count() > 0) {var p=1; while(p <=this.get_media_count()) {totalTocs=totalTocs + this.get_media_by_position(p).get_toclist_length(); p++;}} return totalTocs;} function Playlist_get_tocitem_position(currentMediaPos,currentMediaTocPos) {var totalTocs=0; if((this.get_media_count() > 0) && (this.get_media_count() <=currentMediaPos)) {var p=1; while(p < currentMediaPos) {totalTocs=totalTocs + this.get_media_by_position(p).get_toclist_length(); p++;}} return parseInt(totalTocs + currentMediaTocPos);} function Playlist_do_preload() {if(this.get_preloadmedia_count() > 0) {var liveType=this.IPPS.get_content().liveType; for(var j=0;j<this.get_preloadmedia_count();j++) {this.actualpreload[j]=new Image(); if(liveType=="offline") {this.actualpreload[j].src=this.get_preloadmedia_by_position(j+1) +"&nolog=1";}else{this.actualpreload[j].src=this.get_preloadmedia_by_position(j+1);}}}else{this.add_error("P16_1","Warning: trying to preload playlist without preloadmedia!");}} function Playlist_add_error(errorId, errorMsg) {if(errorId !=null && errorMsg !=null) {if(this.IPPS.errorMonitor) {var ippsError=new IPPS_error(errorId, "Playlist", errorMsg); this.IPPS.errorMonitor.add_error(ippsError);}}} function Media(ipps, node) {this.IPPS=ipps; this.node=node; this.MEDIA_TYPE=""; this.add_error=Media_add_error; this.get_id=Media_get_id; this.get_name=Media_get_name; this.get_nodename=Media_get_nodename; this.get_mediatype=Media_get_mediatype; this.get_mediatype_description=Media_get_mediatype_description; this.get_url=Media_get_url; this.get_extension=Media_get_extension; this.duration=new Array(); this.tocList=new Array(); this.set_duration=Media_set_duration; this.set_toclist=Media_set_toclist; this.get_duration=Media_get_duration; this.get_duration_in_seconds=Media_get_duration_in_seconds; this.get_tocitem_by_id=Media_get_tocitem_by_id; this.get_tocitem_by_position=Media_get_tocitem_by_position; this.get_tocitem_position_by_id=Media_get_tocitem_position_by_id; this.get_toclist_length=Media_get_toclist_length; this.get_hyperlink_target=Media_get_hyperlink_target; this.get_hyperlink_text=Media_get_hyperlink_text; this._init=Media_init; this._init();} function Media_init() {this.MEDIA_TYPE=this.get_mediatype(); if(this.MEDIA_TYPE==this.IPPS.MEDIATYPE_VIDEO) {this.set_duration(); this.set_toclist();}} function Media_get_mediatype() {var tempType=this.IPPS.xmldom.getAttribute(this.node, "type_id"); if(tempType) {return tempType;}else{this.add_error("M0","No mediatype attribute found!"); return "";}} function Media_get_mediatype_description() {var tempType=this.IPPS.xmldom.getAttribute(this.node, "type_id"); if(tempType) {if(tempType==this.IPPS.MEDIATYPE_TEXT) {return this.IPPS.MEDIATYPE_TEXT_DESC;}else if(tempType==this.IPPS.MEDIATYPE_NUMBER) {return this.IPPS.MEDIATYPE_NUMBER_DESC;}else if(tempType==this.IPPS.MEDIATYPE_IMAGE) {return this.IPPS.MEDIATYPE_IMAGE_DESC;}else if(tempType==this.IPPS.MEDIATYPE_VIDEO) {return this.IPPS.MEDIATYPE_VIDEO_DESC;}else if(tempType==this.IPPS.MEDIATYPE_TEXTAREA) {return this.IPPS.MEDIATYPE_TEXTAREA_DESC;}else if(tempType==this.IPPS.MEDIATYPE_POWERPOINT) {return this.IPPS.MEDIATYPE_POWERPOINT_DESC;}else if(tempType==this.IPPS.MEDIATYPE_PDF) {return this.IPPS.MEDIATYPE_PDF_DESC;}else if(tempType==this.IPPS.MEDIATYPE_FLASH) {return this.IPPS.MEDIATYPE_FLASH_DESC;}else if(tempType==this.IPPS.MEDIATYPE_DATE) {return this.IPPS.MEDIATYPE_DATE_DESC;}else if(tempType==this.IPPS.MEDIATYPE_HYPERLINK) {return this.IPPS.MEDIATYPE_HYPERLINK_DESC;}else if(tempType==this.IPPS.MEDIATYPE_FREETYPE) {return this.IPPS.MEDIATYPE_FREETYPE_DESC;}}else{this.add_error("M14","No mediatype attribute found!"); return "";}} function Media_set_duration() {var durationEm=this.IPPS.xmldom.getElements(this.node, this.IPPS.XMLTAG_MEDIADURATION); if(durationEm && durationEm.length > 0) {var durFF=this.IPPS.xmldom.getAttribute(durationEm[0],"ff"); var durSS=this.IPPS.xmldom.getAttribute(durationEm[0],"ss"); var durMM=this.IPPS.xmldom.getAttribute(durationEm[0],"mm"); var durHH=this.IPPS.xmldom.getAttribute(durationEm[0],"hh"); if(durHH) {this.duration.hh=durHH;}else{this.duration.hh="00";} if(durMM) {this.duration.mm=durMM;}else{this.duration.mm="00";} if(durSS) {this.duration.ss=durSS;}else{this.duration.ss="00";} if(durFF) {this.duration.ff=durFF;}else{this.duration.ff="00";}}else{this.add_error("M1","No durationelement found in this media");}} function Media_set_toclist() {var slideroot=this.IPPS.xmldom.selectNode(this.node, this.IPPS.XMLTAGPATH_PRESTOC); if(slideroot) {var slidedata=this.IPPS.xmldom.getElements(slideroot, this.IPPS.XMLTAG_TOC); if(slidedata && slidedata.length > 0) {var f=0; while(f < slidedata.length) {this.tocList[f]=new Tocitem(this.IPPS,slidedata[f]); f++;}}else{this.add_error("M2_2","Attention: no toc slides found in video!");}}else{this.add_error("M2_1","No toclist rootelement found in this video");}} function Media_get_duration(format) {var returnStr=""; if(this.MEDIA_TYPE==this.IPPS.MEDIATYPE_VIDEO) {var formatArr=format.split(":"); for(var f=0;f<formatArr.length;f++) {if(this.duration[""+formatArr[f]]) {returnStr +=this.duration[""+formatArr[f]]; if(f < formatArr.length -1) {returnStr +=":";}}else{this.add_error("M3_2","Illegal duration format found!"); break;}}}else{this.add_error("M3_1","This media-object doesn't support the method: get_duration()!");} return returnStr;} function Media_get_duration_in_seconds() {var returnInt=0; if(this.MEDIA_TYPE==this.IPPS.MEDIATYPE_VIDEO) {returnInt=parseFloat(this.duration["hh"])*3600; returnInt=returnInt+ parseFloat(this.duration["mm"])*60; returnInt=returnInt+ parseFloat(this.duration["ss"]);}else{this.add_error("M10_1","This media-object doesn't support the method: get_duration_in_seconds()!");} return returnInt;} function Media_get_url() {if(this.MEDIA_TYPE==this.IPPS.MEDIATYPE_HYPERLINK) {var tempURL=this.IPPS.xmldom.getAttribute(this.node, "url");}else{var tempURL=this.IPPS.xmldom.getAttribute(this.node, "filename");} if(tempURL) {var liveType=this.IPPS.get_content().liveType; if(liveType=="offline" && this.MEDIA_TYPE !=this.IPPS.MEDIATYPE_HYPERLINK) {tempURL=this.IPPS.unescape(tempURL); while(tempURL.substring(0,1)=="/") {tempURL=tempURL.substring(1);} return (tempURL);}else{return this.IPPS.unescape(tempURL);}}else{this.add_error("M4","No media-URL found!"); return "";}} function Media_get_extension() {var extension="no-file"; if(this.MEDIA_TYPE==this.IPPS.MEDIATYPE_VIDEO || this.MEDIA_TYPE==this.IPPS.MEDIATYPE_IMAGE || this.MEDIA_TYPE==this.IPPS.MEDIATYPE_POWERPOINT || this.MEDIA_TYPE==this.IPPS.MEDIATYPE_PDF || this.MEDIA_TYPE==this.IPPS.MEDIATYPE_FLASH || this.MEDIA_TYPE==this.IPPS.MEDIATYPE_FREETYPE) {var tempURL=this.get_url(); if(tempURL) {var extensionSplit=tempURL.split("."); if(extensionSplit.length > 1) {extension=extensionSplit[extensionSplit.length-1];}else{this.add_error("M15_2","Missing/incorrect extension for file of type '"+ this.get_mediatype_description() +"'!"); extension="incorrect";}}}else{this.add_error("M15_1","This media-object doesn't support the method: get_extension()!");} return extension;} function Media_get_id() {var tempID=this.IPPS.xmldom.getAttribute(this.node, "id"); if(tempID) {return parseFloat(tempID);}else{this.add_error("M5","No media-ID found!"); return null;}} function Media_get_name() {var tempID=this.IPPS.xmldom.getAttribute(this.node, "name"); if(tempID) {return this.IPPS.unescape(tempID);}else{this.add_error("M12","No media-name found!"); return null;}} function Media_get_nodename() {var tempID=this.IPPS.xmldom.getAttribute(this.node, "nodename"); if(tempID) {return this.IPPS.unescape(tempID);}else{this.add_error("M13","No media-nodename found!"); return null;}} function Media_get_tocitem_by_id(tocId) {if(this.MEDIA_TYPE==this.IPPS.MEDIATYPE_VIDEO) {if(this.tocList.length > 0) {var tocFound=null; if(tocId && !isNaN(tocId)) {for(var f=0;f<this.tocList.length;f++) {if(this.tocList[f].get_id()==parseInt(tocId)) {tocFound=this.tocList[f]; break;}} if(!tocFound) {this.add_error("M6_4","No tocitem found with id \""+ tocId +"\"!");}}else{this.add_error("M6_3","the given tocId is invalid!");} return tocFound;}else{this.add_error("M6_2","This media has no tocitems!"); return null;}}else{this.add_error("M6_1","This media-object doesn't support the method: get_tocitem_by_id()!"); return null;}} function Media_get_tocitem_position_by_id(tocId) {if(this.MEDIA_TYPE==this.IPPS.MEDIATYPE_VIDEO) {if(this.tocList.length > 0) {var tocFound=false; if(tocId && !isNaN(tocId)) {for(var f=0;f<this.tocList.length;f++) {if(this.tocList[f].get_id()==parseInt(tocId)) {return f+1; tocFound=true; break;}} if(!tocFound) {this.add_error("M11_4","No tocitem found with id \""+ tocId +"\"!"); return -1;}}else{this.add_error("M11_3","the given tocId is invalid!"); return -1;} return -1;}else{this.add_error("M11_2","This media has no tocitems!"); return -1;}}else{this.add_error("M11_1","This media-object doesn't support the method: get_tocitem_by_id()!"); return -1;}} function Media_get_tocitem_by_position(tocPos) {if(this.MEDIA_TYPE==this.IPPS.MEDIATYPE_VIDEO) {if(this.tocList.length > 0 && tocPos > 0 && tocPos <=this.tocList.length) {return this.tocList[tocPos-1];}else{this.add_error("M10_2","No tocitem found!"); return null;}}else{this.add_error("M10_1","This media-object doesn't support the method: get_tocitem_by_id()!"); return null;}} function Media_get_toclist_length() {if(this.MEDIA_TYPE==this.IPPS.MEDIATYPE_VIDEO) {return this.tocList.length;}else{this.add_error("M7_1","This media-object doesn't support the method: get_toclist_length()!"); return 0;}} function Media_get_hyperlink_target() {if(this.MEDIA_TYPE==this.IPPS.MEDIATYPE_HYPERLINK) {var temptarget=this.IPPS.xmldom.getAttribute(this.node, "target"); if(temptarget) {return this.IPPS.unescape(temptarget);}else{this.add_error("M8_2","No hyperlink target found!"); return "";}}else{this.add_error("M8_1","This media-object doesn't support the method: get_hyperlink_target()!"); return "";}} function Media_get_hyperlink_text() {if(this.MEDIA_TYPE==this.IPPS.MEDIATYPE_HYPERLINK) {var temptext=this.IPPS.xmldom.getAttribute(this.node, "text"); if(temptext) {return this.IPPS.unescape(temptext);}else{this.add_error("M9_2","No hyperlink text found!"); return "";}}else{this.add_error("M9_1","This media-object doesn't support the method: get_hyperlink_text()!"); return "";}} function Media_add_error(errorId, errorMsg) {if(errorId !=null && errorMsg !=null) {if(this.IPPS.errorMonitor) {var ippsError=new IPPS_error(errorId, "Media", errorMsg); this.IPPS.errorMonitor.add_error(ippsError);}}} function Tocitem(ipps, node) {this.IPPS=ipps; this.node=node; this.add_error=Tocitem_add_error; this.get_id=Tocitem_get_id; this.get_title=Tocitem_get_title; this.get_url=Tocitem_get_url; this.get_position=Tocitem_get_position;} function Tocitem_get_id() {var tempID=this.IPPS.xmldom.getAttribute(this.node, "id"); if(tempID) {return(parseInt(tempID));}else{this.add_error("T1","No slide-ID found!"); return(null);}} function Tocitem_get_title() {var tempTitle=this.IPPS.xmldom.getAttribute(this.node, "title"); if(tempTitle) {return this.IPPS.unescape(tempTitle);}else{this.add_error("T2","No slide-title found!"); return "";}} function Tocitem_get_url() {var liveType=this.IPPS.get_content().liveType; var tempURL=this.IPPS.xmldom.getAttribute(this.node, "filename"); if(tempURL) {if(liveType=="offline") {tempURL=this.IPPS.unescape(tempURL); while(tempURL.substring(0,1)=="/") {tempURL=tempURL.substring(1);} return (tempURL);}else{return this.IPPS.unescape(tempURL);}}else{this.add_error("T3","No slide-url found!"); return "";}} function Tocitem_get_position(format) {var returnStr=""; var formatArr=format.split(":"); for(var f=0;f<formatArr.length;f++) {var pos=this.IPPS.xmldom.getAttribute(this.node, ""+formatArr[f]); if(pos) {returnStr +=pos; if(f < formatArr.length -1) {returnStr +=":";}}else{this.add_error("T4","Illegal position format found!"); break;}} return returnStr;} function Tocitem_add_error(errorId, errorMsg) {if(errorId !=null && errorMsg !=null) {if(this.IPPS.errorMonitor) {var ippsError=new IPPS_error(errorId, "Tocitem", errorMsg); this.IPPS.errorMonitor.add_error(ippsError);}}} function IPPS_Form(ipps, formObject, moduleType, IPPS_PRESENTATION, IPPS_PLAYLIST_ID, formName) {this.FORM_INPUTFIELD="small_text"; this.FORM_INPUTAREA="large_text"; this.FORM_TEXT="text"; this.FORM_RADIO="radio"; this.FORM_CHECKBOX="checkbox"; this.FORM_PULLDOWN="pulldown"; this.FORM_ELEMENTTAG="element"; this.FORM_ANSWERTAG="answer"; this.IPPS=ipps; this.node=formObject; this.moduleType=moduleType; this.name=formName; this.presentation_id=IPPS_PRESENTATION.get_id(); this.presentation_name=IPPS_PRESENTATION.get_name(); this.id=""; this.playlist_id=IPPS_PLAYLIST_ID; this.user_id=IPPS_PRESENTATION.get_user_id(); this.elements=new Array(); this.add_error=IPPS_Form_add_error; this.get_element_count=IPPS_Form_get_element_count; this.get_element_by_position=IPPS_Form_get_element_by_position; this.get_presentation_id=IPPS_Form_get_presentation_id; this.get_presentation_name=IPPS_Form_get_presentation_name; this.get_playlist_id=IPPS_Form_get_playlist_id; this.get_id=IPPS_Form_get_id; this.get_module_type=IPPS_Form_get_module_type; this.get_name=IPPS_Form_get_name; if(this.get_module_type()==this.IPPS.MODULE_FRP || this.moduleType==this.IPPS.MODULE_KM_BEST) {if(this.get_module_type()==this.IPPS.MODULE_FRP) {this.lead_minimum=50; this.get_lead_minimum=IPPS_Form_get_lead_minimum; this.get_user_id=IPPS_Form_get_user_id; this.lead_questions=new Array(); this.set_lead_info=IPPS_Form_set_lead_info; this.get_lead_questions_count=IPPS_Form_get_lead_questions_count; this.get_lead_questions=IPPS_Form_get_lead_questions;} this.get_maximum_answerscore=IPPS_Form_get_maximum_answerscore;} this.get_questions_count=IPPS_Form_get_questions_count; this.get_questions=IPPS_Form_get_questions; this.questions=new Array(); this.set_question_info=IPPS_Form_set_question_info; this.init=IPPS_Form_init; this.init();} function IPPS_Form_init() {if(this.node) {this.id=this.IPPS.xmldom.getAttribute(this.node, "id"); this.elements=this.IPPS.xmldom.getElements(this.node, this.FORM_ELEMENTTAG); if(this.moduleType==this.IPPS.MODULE_FRP) {this.set_question_info();} if(this.moduleType==this.IPPS.MODULE_KM_BEST) {this.set_question_info();}}else{this.add_error("F1", "No content node!");}} function IPPS_Form_set_question_info() {if(this.node) {var l=0; while(l<this.elements.length) {var type=this.IPPS.xmldom.getAttribute(this.elements[l], "type"); if(type !=this.FORM_TEXT) {this.questions[this.questions.length]=this.IPPS.xmldom.getAttribute(this.elements[l], "id");} l++;}}} function IPPS_Form_set_lead_info(EXTERNAL_LEADMIN) {if(this.node) {if(this.moduleType==this.IPPS.MODULE_FRP) {this.lead_minimum=EXTERNAL_LEADMIN; var l=0; while(l<this.elements.length) {if(this.IPPS.xmldom.getAttribute(this.elements[l], "lead")=="1") {if(this.IPPS.xmldom.getAttribute(this.elements[l], "type") !=this.FORM_TEXT) {this.lead_questions[this.lead_questions.length]=this.IPPS.xmldom.getAttribute(this.elements[l], "id");}} l++;}}else{this.add_error("F2_2", "This is not a qualifying form!");}}else{this.add_error("F2_1", "No content node!");}} function IPPS_Form_get_element_by_position(position) {if(this.get_element_count() > 0) {if(position > 0 && position <=this.get_element_count()) {var element=new Array(); element.type=this.IPPS.xmldom.getAttribute(this.elements[position-1], "type"); element.id=this.IPPS.xmldom.getAttribute(this.elements[position-1], "id"); if(element["type"] !=this.FORM_TEXT) {element.question=this.IPPS.unescape(this.IPPS.xmldom.getAttribute(this.elements[position-1], "text")); element.question_id=this.IPPS.xmldom.getAttribute(this.elements[position-1], "id"); element.value=this.IPPS.unescape(this.IPPS.xmldom.getAttribute(this.elements[position-1], "value"));} if(element["type"]==this.FORM_TEXT) {element.text=this.IPPS.unescape(this.IPPS.xmldom.getAttribute(this.elements[position-1], "text"));}else{var answers=new Array(); element.answers=answers; var attribEl=this.IPPS.xmldom.getElements(this.elements[position-1], "answer"); if(attribEl.length > 0) {var a=0; while(a < attribEl.length) {var answer=new Array(); answer.id=this.IPPS.xmldom.getAttribute(attribEl[a], "id"); answer.value=this.IPPS.unescape(this.IPPS.xmldom.getAttribute(attribEl[a], "value")); if(this.IPPS.xmldom.getAttribute(attribEl[a], "selected")=="1") {answer.selected=true;}else{answer.selected=false;} if(element["type"]==this.FORM_INPUTFIELD || element["type"]==this.FORM_INPUTAREA) {answer.maxlength=this.IPPS.xmldom.getAttribute(attribEl[a], "maxlength");}else{answer.text=this.IPPS.unescape(attribEl[a].getText());} element.answers[element.answers.length]=answer; a++;}}else{this.add_error("F3_9", "No answers found for this element!");}} if(this.moduleType==this.IPPS.MODULE_FRP) {element.qualifying=(parseInt(this.IPPS.xmldom.getAttribute(this.elements[position-1], "lead")))? true:false;} return(element);}else{this.add_error("F3_2", "Invalid position!"); return null;}}else{this.add_error("F3_1", "No elements!"); return null;}} function IPPS_Form_get_maximum_answerscore(ELEMENT) {var maximum=0; if(ELEMENT["type"]==this.FORM_PULLDOWN || ELEMENT["type"]==this.FORM_CHECKBOX || ELEMENT["type"]==this.FORM_RADIO) {if((ELEMENT.answers) && (ELEMENT.answers.length > 0)) {var a=0; while(a < ELEMENT.answers.length) {var answer=ELEMENT.answers[a]; if(!isNaN(answer.value)) {if(parseInt(answer.value) > maximum) {maximum=parseInt(answer.value);}} a++;}}else{this.add_error("F12_2", "No answers found for this element!");}}else{this.add_error("F12_1", "Invalid element type to get the maximum score of!");} return maximum;} function IPPS_Form_get_module_type() {if(this.moduleType) {return this.moduleType;}else{this.add_error("F4", "No moduleType set!"); return null;}} function IPPS_Form_get_name() {if(this.name) {return this.name;}else{this.add_error("F9", "No name set!"); return "";}} function IPPS_Form_get_element_count() {return this.elements.length;} function IPPS_Form_get_lead_minimum() {if(this.get_module_type()==this.IPPS.MODULE_FRP) {return this.lead_minimum;}else{this.add_error("F5", "This is not a qualifying form!"); return 0;}} function IPPS_Form_get_lead_questions_count() {if(this.get_module_type()==this.IPPS.MODULE_FRP) {return this.lead_questions.length;}else{this.add_error("F6", "This is not a qualifying form!"); return 0;}} function IPPS_Form_get_questions_count() {return this.questions;} function IPPS_Form_get_lead_questions() {if(this.get_module_type()==this.IPPS.MODULE_FRP) {return this.lead_questions;}else{this.add_error("F10", "This is not a qualifying form!"); return new Array();}} function IPPS_Form_get_questions() {if(this.get_module_type()==this.IPPS.MODULE_FRP || this.get_module_type()==this.IPPS.MODULE_KM_BEST) {return this.questions;}else{this.add_error("F11", "This is not a qualifying form!"); return new Array();}} function IPPS_Form_get_user_id() {if(this.get_module_type()==this.IPPS.MODULE_FRP) {return this.user_id;}else{this.add_error("F8", "This is not an emailable form!"); return 0;}} function IPPS_Form_get_presentation_id() {return this.presentation_id;} function IPPS_Form_get_presentation_name() {return this.presentation_name;} function IPPS_Form_get_playlist_id() {return this.playlist_id;} function IPPS_Form_get_id() {return this.id;} function IPPS_Form_add_error(errorId, errorMsg) {if(errorId !=null && errorMsg !=null) {if(this.IPPS.errorMonitor) {var ippsError=new IPPS_error(errorId, "IPPS_Form", errorMsg); this.IPPS.errorMonitor.add_error(ippsError);}}} function IPPS_error_monitor(ipps) {this.IPPS=ipps; this.errors=new Array(); this.monitorMethod=0; this.monitorField=null; this.add_error=IPPS_error_monitor_add_error; this.get_latest_error=IPPS_error_monitor_get_latest_error; this.set_monitor_method=IPPS_error_monitor_set_monitor_method; this.monitor_error=IPPS_error_monitor_monitor_error;} function IPPS_error_monitor_add_error(ippsError) {if(ippsError.is_valid()) {this.errors[this.errors.length]=ippsError; if(this.monitorMethod > 0) {this.monitor_error(this.errors.length-1);}}else{}} function IPPS_error_monitor_get_latest_error() {if(this.errors && (this.errors.length > 0)) {return this.errors[this.errors.length-1].error_to_string();}else{return "no errors \n";}} function IPPS_error_monitor_set_monitor_method(method, reference) {switch(method) {case 0: case 1: case 2: this.monitorMethod=method; this.monitorField=null; break; case 3: if(reference !=null && reference.value) {this.monitorMethod=3; this.monitorField=reference;}else{this.monitorMethod=0; this.monitorField=null; var ippsError=new IPPS_error("EM2", "Error monitor", "The provided monitor field reference is invalid"); this.IPPS.errorMonitor.add_error(ippsError);} break; case 4: if(reference !=null && reference.value) {this.monitorMethod=4; this.monitorField=reference;}else{this.monitorMethod=0; this.monitorField=null; var ippsError=new IPPS_error("EM1", "Error monitor", "The provided monitor field reference is invalid"); this.IPPS.errorMonitor.add_error(ippsError);} break;}} function IPPS_error_monitor_monitor_error(errorPos) {switch(this.monitorMethod) {case 1: alert(this.errors[errorPos].error_to_string()); break; case 2: window.status=this.errors[errorPos].error_to_string(); break; case 3: this.monitorField.value=this.errors[errorPos].error_to_string(); break; case 4: this.monitorField.value=this.monitorField.value +"\n"+ this.errors[errorPos].error_to_string(); break;}} function IPPS_error(errorId, errorCaller, errorMsg) {this.errorId=errorId; this.caller=errorCaller; this.message=errorMsg; this.is_valid=IPPS_error_is_valid; this.error_to_string=IPPS_error_to_string;} function IPPS_error_is_valid() {if(this.errorId !=null && this.caller !=null && this.message !=null) {return true;} return false;} function IPPS_error_to_string() {if(this.is_valid()) {return (this.errorId + " " + this.caller + ", " + this.message);}else{return("error while converting IPPS error to string");}} function XMLdom(ipps) {this.IPPS=ipps; this.usedParser="classic"; this.add_parse_error=XMLdom_add_parse_error; this.add_error=XMLdom_add_error; this.parseXMLdoc=XMLdom_parseXMLdoc; this.getRoot=XMLdom_getRoot; this.getSource=XMLdom_getSource; this.getElementByTagAndAttribute=XMLdom_getElementByTagAndAttribute; this.getElements=XMLdom_getElements; this.selectNode=XMLdom_selectNode; this.selectNodes=XMLdom_selectNodes; this.getNodeValue=XMLdom_getNodeValue; this.getAttribute=XMLdom_getAttribute; this.getTagname=XMLdom_getTagname; this.toString=XMLdom_toString;} function XMLdom_parseXMLdoc(xmlDocument) {var ret=new XMLDoc(xmlDocument, XMLdom_add_xml_error); if(ret) {return ret;}else{this.add_error("X5","Error during XMLdoc parsing"); return null;}} function XMLdom_getRoot(xmlDocument) {return xmlDocument.docNode;} function XMLdom_getSource(xmlDocument) {return xmlDocument.source;} function XMLdom_getElementByTagAndAttribute(node, tagName, attName, attValue) {var ret; var again=true; if (this.IPPS.unescape(node.getAttribute(attName))==attValue) {if(tagName=="") {again=false; return node;}else{if(node.tagName==tagName) {again=false; return node;}}} if(again) {var elements=node.getElements(); var intLoop=0; while (intLoop < elements.length) {var element=elements[intLoop]; ret=this.getElementByTagAndAttribute(element, tagName, attName, attValue); if (ret !=null) {break;} intLoop++;}} return ret;} function XMLdom_getElements(node, tagFilter) {if(tagFilter) {return node.getElements(tagFilter);}else{return node.getElements();}} function XMLdom_selectNode(node, pattern) {return node.selectNode(pattern);} function XMLdom_selectNodes(node, pattern) {return null;} function XMLdom_toString(xmlNode) {if(xmlNode.getUnderlyingXMLText) {return (xmlNode.getUnderlyingXMLText());}else{this.add_error("X4","No 'to stringconvertable' method found!"); return "";}} function XMLdom_getNodeValue(node) {var nodeValue=node.getText(); if(nodeValue) {return nodeValue;}else{this.add_error("X3","No node value found!"); return "";}} function XMLdom_getTagname(node) {var nodeValue=node.tagName; if(nodeValue) {return nodeValue;}else{this.add_error("X2","No node tagname found!"); return "";}} function XMLdom_getAttribute(node, attName) {return node.getAttribute(attName);} function XMLdom_add_parse_error(errorMsg) {this.add_error("X1", errorMsg);} function XMLdom_add_xml_error(errorMsg) {XMLdom_add_error("Xxmldom", errorMsg);} function XMLdom_add_error(errorId, errorMsg) {if(errorId !=null && errorMsg !=null) {if(this.IPPS.errorMonitor) {var ippsError=new IPPS_error(errorId, "XMLdom", errorMsg); this.IPPS.errorMonitor.add_error(ippsError);}}} function Screen_getLayer(name) {if(this.get_browser()==this.BROWSER_NS4) {return this.find_screen_layer(name, document);}else if(this.get_browser()==this.BROWSER_IE) {return eval('document.all["' + name +'"]');}else if(this.get_browser()==this.BROWSER_NS6) {return document.getElementById(name);}else{return null;}} function Screen_getObject(objectContainer, objectID) {if(this.get_browser()==this.BROWSER_NS4) {if(objectContainer=="") {return eval("document."+objectID);}else{return objectContainer.document.objectID;}}else if(this.get_browser()==this.BROWSER_NS6 || this.get_browser()==this.BROWSER_IE) {return document.getElementById(objectID);}else{return null;}} function Screen_findLayer(name, doc) {var i, layer; for (i=0; i < doc.layers.length; i++) {layer=doc.layers[i]; if (layer.name==name)return layer; if (layer.document.layers.length > 0) {layer=this.find_screen_layer(name, layer.document); if (layer !=null) return layer;}} return null;} function URL_unescape(escapedStr) {return unescape(escapedStr);} function URL_escape(unescapedStr) {var tempString=unescapedStr; tempString.replace("_","%5F"); tempString.replace("-","%2D"); return escape(tempString);} var IPPS_API=new IPPS();
