//Register kernel modules function kernel_init() { } function kernel_debug() { } function kernel_system() { } function kernel_browser() { } function kernel_calendar() { } function kernel_desktop() { } function kernel_sidebar() { } function kernel_windowmanager() { } function kernel_taskbar() { } //Use PHP to include the kernel modules kernel_init.prototype.boot = function(){ //Loads the taskbar kernel.taskbar.init(); kernel.sidebar.init(); kernel.calendar.startTime(); initWindows(); kernel.debug.sendToConsole('kernel.init', 'System initialization completed, kernel ('+ top.kernelversion +') loaded successfull'); kernel.system.buildTag('init'); } kernel_debug.prototype.init = function() { kernel.debug.create(); } kernel_debug.prototype.create = function() { var tmp = document.createElement("div"); tmp.id = "debugConsoleDIV"; tmp.className = 'debugconsole'; tmp.style.backgroundImage = "url('images/debugconsole/background.png')"; tmp.innerHTML = '
Longhorn Debug Console
 
 
'; document.body.appendChild(tmp); } kernel_debug.prototype.sendToConsole = function(kfname, msg) { if (debugMode == "yes") { document.debug.console.value = document.debug.console.value + '['+kernel.calendar.getDateTime()+'] - ' + kfname + ' - ' + msg + '\n'; return; } } kernel_debug.prototype.show = function() { document.getElementById("debugConsoleDIV").style.display = "block"; } kernel_debug.prototype.hide = function() { document.getElementById("debugConsoleDIV").style.display = "none"; } kernel_system.prototype.init = function(){} kernel_system.prototype.getKernelModules = function(){ if (!kernel) return []; var ret = []; for (var i in kernel){ try{ if (kernel[i] instanceof Object && kernel[i].init instanceof Function){ // this is an module ret[ret.length] = "kernel."+i; } }catch(e){ } } return ret; } kernel_system.prototype.buildTag = function(action) { if (action == "init") { var tmp = document.createElement('div'); tmp.id = 'desktopBuildtag'; tmp.className = 'buildtag'; tmp.innerHTML = ''+buildtag+''; document.getElementById("desktop").appendChild(tmp); } } //Ajax vars var bustcachevar = 1; //bust potential caching of external pages after initial request? (1=yes, 0=no) var loadedobjects = ''; var rootdomain = 'http://'+window.location.hostName; var bustcacheparameter = ''; kernel_browser.prototype.init = function(){} kernel_browser.prototype.getCookie = function(name){ var start = document.cookie.indexOf(name+"="); var len = start+name.length+1; if ((!start) && (name != document.cookie.substring(0,name.length))) return null; if (start == -1) return null; var end = document.cookie.indexOf(";",len); if (end == -1) end = document.cookie.length; return unescape(document.cookie.substring(len,end)); } kernel_browser.prototype.setCookie = function(name,value,expires,path,domain,secure){ expires = expires * 60*60*24*1000; var today = new Date(); var expires_date = new Date( today.getTime() + (expires) ); var cookieString = name + "=" +escape(value) + ( (expires) ? ";expires=" + expires_date.toGMTString() : "") + ( (path) ? ";path=" + path : "") + ( (domain) ? ";domain=" + domain : "") + ( (secure) ? ";secure" : ""); document.cookie = cookieString; } kernel_browser.prototype.ajaxGetPage = function(url, containerid){ var page_request = false; if (window.XMLHttpRequest) { // if Mozilla, Safari etc page_request = new XMLHttpRequest(); } else if (window.ActiveXObject) { // if IE try { page_request = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try { page_request = new ActiveXObject("Microsoft.XMLHTTP"); } catch (e){} } } else { return false; } page_request.onreadystatechange = function() { if (page_request.readyState == 4 && (page_request.status==200 || window.location.href.indexOf("http")==-1)) { document.getElementById(containerid).innerHTML=page_request.responseText; } } if (bustcachevar) { //if bust caching of external page bustcacheparameter=(url.indexOf("?")!=-1)? "&"+new Date().getTime() : "?"+new Date().getTime(); page_request.open('GET', url+bustcacheparameter, true); page_request.send(null); } } kernel_browser.prototype.ajaxLoadObjs = function(){ if (!document.getElementById) { return; } for (i=0; i 12) { this.nCurrentMonth -= 12; this.nextYear(); } kernel.calendar.setYearMonth(this.nCurrentYear, this.nCurrentMonth); sidebarCalendar.updateMonthPicture(this.nCurrentMonth); } kernel_calendar.prototype.setYearMonth = function(nYear, nMonth) { this.nCurrentYear = nYear; this.nCurrentMonth = nMonth; var cross_obj=document.getElementById("main"); var cross_obj2=document.getElementById("main2"); cross_obj.innerHTML = ""+this.nCurrentYear+""; cross_obj2.innerHTML = "" + "" + "" + "" + "" + "
" + "" + "" + "
"+MonthNames[this.nCurrentMonth-1]+", "+this.nCurrentYear+"
" + "
" + "
\n"; var date = new Date(this.nCurrentYear, this.nCurrentMonth-1, 1); var nWeek = 1; var nDate = null; while (date.getMonth() == this.nCurrentMonth-1) { nDate = date.getDate(); var nLastDate = nDate; var posDay = date.getDay()-1; if (posDay == -1) posDay=6; var posLeft = posDay*(nWidth+5)+5; var posTop = (nWeek-1)*nHeight; var cross_obj3 = document.getElementById("idDate"+nDate).style; cross_obj3.left = posLeft; cross_obj3.top = posTop; if (date.getDay() == 0 || date.getDay() == 6) cross_obj3.color = "red"; else cross_obj3.color = "black"; cross_obj3.visibility = "visible"; date = new Date(this.nCurrentYear, date.getMonth(), date.getDate()+1); if (posDay == 6) nWeek++; } for (nDate++; nDate <= 31; nDate++){ var cross_obj3 = document.getElementById("idDate"+nDate).style; cross_obj3.visibility = "hidden"; } } kernel_calendar.prototype.setMonth = function(nMonth) { this.setYearMonth(nCurrentYear, nMonth); } kernel_calendar.prototype.prevYear = function() { this.nCurrentYear--; this.setYearMonth(this.nCurrentYear, this.nCurrentMonth); } kernel_calendar.prototype.nextYear = function() { this.nCurrentYear++; this.setYearMonth(this.nCurrentYear, this.nCurrentMonth); } kernel_desktop.prototype.init = function(){} kernel_desktop.prototype.onLeftClick = function() { kernel.debug.sendToConsole('kernel.desktop.onLeftclick', 'Desktop was clicked with left mouse button'); //Hides elements sidebarCalendar.remove(); kernel.debug.hide(); return; } kernel_desktop.prototype.create = function() { var tmp = document.createElement("div"); tmp.id = "desktop"; tmp.className = 'desktop'; tmp.onclick = function () { kernel.desktop.onLeftClick(); } tmp.innerHTML = ''; document.body.appendChild(tmp); } kernel_desktop.prototype.addIconToDesktop = function(iconText, icon, doAction, winWidth, winHeight, winUrl) { var tmp = document.createElement("div"); tmp.id = "desktopIcon"; tmp.className = 'desktopicon_normal'; tmp.onmouseover = function (evt) { this.className = 'desktopicon_mo'; }; tmp.onmouseout = function (evt) { this.className = 'desktopicon_normal'; }; tmp.ondblclick = function (evt) { doAction(winWidth, winHeight, '', '', winUrl); }; tmp.innerHTML = '

'+iconText+'
'; document.getElementById("desktop").appendChild(tmp); } kernel_sidebar.prototype.init = function() { kernel.sidebar.create(); kernel.sidebar.addWidget('properties'); kernel.sidebar.addWidget('split'); kernel.sidebar.addWidget('search'); kernel.sidebar.addWidget('split'); kernel.sidebar.addWidget('stickynotes'); kernel.sidebar.addWidget('split'); kernel.sidebar.addWidget('events'); kernel.sidebar.addWidget('split'); kernel.sidebar.addWidget('split','absolute','125px','','101px','0px'); kernel.sidebar.addWidget('clock','absolute','125px','','0px','0px'); kernel.debug.sendToConsole('kernel.sidebar.init', 'Kernel finished loading Sidebar..'); return; } kernel_sidebar.prototype.create = function() { var tmp = document.createElement('div'); tmp.id = 'sidebar'; tmp.className = 'sidebar'; tmp.innerHTML = ''; tmp.widgets = '0'; document.body.appendChild(tmp); } kernel_sidebar.prototype.addWidget = function(type,position,width,height,bottom,right) { var sidebar = document.getElementById("sidebar"); sidebar.widgets++; if (type == 'split') { var tmp = document.createElement('img'); tmp.src = 'images/sidebar/split.png'; if (position != "") { tmp.style.position = position; } if (bottom != "") { tmp.style.bottom = bottom; } if (right != "") { tmp.style.right = right; } tmp.border = '0'; tmp.style.zIndex = '3'; sidebar.appendChild(tmp); } if (type == 'properties') { var tmp = document.createElement('img'); tmp.src = 'images/sidebar/properties.png'; tmp.border = '0'; tmp.style.zIndex = '3'; sidebar.appendChild(tmp); } if (type == 'search') { var tmp = document.createElement('img'); tmp.src = 'images/sidebar/search.png'; tmp.border = '0'; tmp.style.zIndex = '3'; sidebar.appendChild(tmp); } if (type == 'stickynotes') { var tmp = document.createElement('img'); tmp.src = 'images/sidebar/stickynotes.png'; tmp.border = '0'; tmp.style.zIndex = '3'; sidebar.appendChild(tmp); } if (type == 'events') { var tmp = document.createElement('img'); tmp.src = 'images/sidebar/events.png'; tmp.border = '0'; tmp.style.zIndex = '3'; sidebar.appendChild(tmp); } if (type == 'clock') { var tmp = document.createElement('div'); tmp.id = 'sidebarClock'; tmp.style.zIndex = '3'; tmp.style.width = width; tmp.style.bottom = bottom; tmp.style.right = right; tmp.innerHTML = ''+ ''+ '
'; sidebar.appendChild(tmp); } } kernel_sidebar.prototype.cycle = function() { //send message to debug console kernel.debug.sendToConsole('kernel.sidebar.cycle', 'Cycling sidebar view (before cycling sidebar was: "'+top.sidebarstatus+'")'); var sidebarelement = document.getElementById("sidebar"); var Sbuildtag = document.getElementById("desktopBuildtag"); var taskbartray = document.getElementById("taskbartray"); if (top.sidebarstatus == "on") { sidebarelement.style.display = "none"; top.sidebarstatus = "off"; taskbartray.style.display = "block"; Sbuildtag.style.right = "5px"; return; } if (top.sidebarstatus == "off") { sidebarelement.style.display = "block"; top.sidebarstatus = "on"; taskbartray.style.display = "none"; Sbuildtag.style.right = "130px"; return; } return; } kernel_windowmanager.prototype.init = function(){} kernel_windowmanager.prototype.create = function(width,height,left,top,url) { LastWinID = LastWinID+1; kernel.debug.sendToConsole('kernel.windowmanager.create', 'Creating new window with ID "'+top.LastWinID+'"'); //-------> If no window probs. have been defined, set some defaults if (!width) { var width = 600; } if (!height){ var height = 400; } if (!left) { var left = 50; } if (!top) { var top = 50; } var div = document.createElement('DIV'); div.className='dhtmlgoodies_window'; document.body.appendChild(div); var topDiv = document.createElement('DIV'); topDiv.className='dhtmlgoodies_window_top'; div.appendChild(topDiv); var img = document.createElement('IMG'); img.src = 'images/themes/standard/top_center.jpg'; img.className='topCenterImage'; img.id = 'topCenterImageID'+LastWinID; topDiv.appendChild(img); //FIX: Resize top bar background document.getElementById(img.id).style.width = width-8+'px'; var img = document.createElement('IMG'); img.src = 'images/themes/standard/top_left.gif'; img.align='left'; topDiv.appendChild(img); var img = document.createElement('IMG'); img.src = 'images/themes/standard/top_right.gif'; img.align='right'; topDiv.appendChild(img); var buttonDiv = document.createElement('DIV'); buttonDiv.className='top_buttons'; topDiv.appendChild(buttonDiv); var img = document.createElement('IMG'); img.src = 'images/themes/standard/button_minimize.gif'; img.className='minimizeButton'; buttonDiv.appendChild(img); var img = document.createElement('IMG'); img.src = 'images/themes/standard/button_maximize.gif'; img.className='maximizeButton'; buttonDiv.appendChild(img); var img = document.createElement('IMG'); img.src = 'images/themes/standard/button_close.gif'; img.className='closeButton'; buttonDiv.appendChild(img); var toolbarDIV = document.createElement('DIV'); toolbarDIV.className='windowToolbar'; div.appendChild(toolbarDIV); var img = document.createElement('IMG'); img.src = 'images/themes/standard/toolbar_background.jpg'; img.className='toolbarCenterImage'; toolbarDIV.appendChild(img); var img = document.createElement('IMG'); img.src = 'images/themes/standard/toolbar_back_normal3.png'; img.style.position = "absolute"; img.style.top = "0"; img.style.left = "0"; toolbarDIV.appendChild(img); var img = document.createElement('IMG'); img.src = 'images/themes/standard/toolbar_search_normal.png'; img.style.position = "absolute"; img.style.top = "0"; img.style.right = "53"; toolbarDIV.appendChild(img); var img = document.createElement('IMG'); img.src = 'images/themes/standard/toolbar_favorits_normal.png'; img.style.position = "absolute"; img.style.top = "0"; img.style.right = "0"; toolbarDIV.appendChild(img); var middleDiv = document.createElement('DIV'); middleDiv.className='dhtmlgoodies_windowMiddle'; div.appendChild(middleDiv); var contentDiv = document.createElement('DIV'); contentDiv.className='dhtmlgoodies_windowContent'; contentDiv.innerHTML='
  
'; middleDiv.appendChild(contentDiv); var bottomDiv = document.createElement('DIV'); bottomDiv.className='dhtmlgoodies_window_bottom'; div.appendChild(bottomDiv); var img = document.createElement('IMG'); img.src = 'images/themes/standard/bottom_center.jpg'; img.className='bottomCenterImage'; bottomDiv.appendChild(img); var img = document.createElement('IMG'); img.src = 'images/themes/standard/bottom_left.jpg'; img.className='bottomLeftImage'; bottomDiv.appendChild(img); var img = document.createElement('IMG'); img.src = 'images/themes/standard/bottom_right.jpg'; img.className='resizeImage'; bottomDiv.appendChild(img); windowSizeArray[windowSizeArray.length] = [width,height]; windowPositionArray[windowPositionArray.length] = [left,top]; div.style.width = width + 'px'; contentDiv.style.height = height + 'px'; div.style.left = left + 'px'; div.style.top = top + 'px'; return initWindows(false,div); } kernel_windowmanager.prototype.maximizeWindow = function(activeId, obj) { if (activeId == "") { activeId = obj.id; } var ActiveWinID = 'dhtml_goodies_id'+activeId; var topCenterImageID = 'topCenterImageID'+activeId; var ActiveElement = document.getElementById(ActiveWinID); ActiveElement.style.top = 0; ActiveElement.style.left = 0; //----------> Detect Window width var winW = document.body.offsetWidth; if (sidebarstatus == "on") { winW = winW-top.sidebarWidth; } //----------> Detect window height if (window.innerHeight != "" && document.body.offsetHeight != "0") { var winH = document.body.offsetHeight; } else { var winH = window.innerHeight; } ActiveElement.style.height = winH; var newWinH = winH - top.taskbarHeight - windowBorderDel+'px'; //--------> Set window Height document.getElementById('windowContent' + activeId).style.height = newWinH; //--------> Set window width ActiveElement.style.width = winW; document.getElementById(topCenterImageID).style.width = winW-8+'px'; return; } kernel_taskbar.prototype.init = function() { kernel.taskbar.create(); kernel.taskbar.createSystray(); //kernel.debug.sendToConsole('kernel.taskbar.init', 'Kernel finished loading the taskbar..'); } kernel_taskbar.prototype.create = function() { var tb = document.createElement("div"); tb.id = "taskbarDIV"; tb.className = "taskbar"; tb.innerHTML = ''+ '' + '' + ''; document.body.appendChild(tb); } kernel_taskbar.prototype.createSystray = function() { var tmp = document.createElement("div"); tmp.id = "taskbartray"; tmp.className = "systray"; tmp.innerHTML = '' + '' + '' + '' + '' + '' + '' + '' + ''; document.body.appendChild(tmp); } kernel_taskbar.prototype.startButtonMouseOver = function() { document.getElementById("taskbar_button").src = "images/taskbar_startbutton_highligthed.png"; return; } kernel_taskbar.prototype.startButtonMouseOut = function() { document.getElementById("taskbar_button").src = "images/taskbar_startbutton_normal.png"; return; } kernel_taskbar.prototype.startButtonClick = function() { //send message to debug console kernel.debug.sendToConsole('kernel.taskbar.startButtonClick', 'Start button was clicked'); alert('Dont click this button'); return; } kernel_taskbar.prototype.sidebarButtonMouseOver = function() { document.getElementById("taskbar_min_sidebar").src = "images/taskbar_minsidebar_highligthed.png"; } kernel_taskbar.prototype.sidebarButtonMouseOut = function() { document.getElementById("taskbar_min_sidebar").src = "images/taskbar_minsidebar_normal.png"; } //Define the kernel modules function kernel() { this.init = new kernel_init(); this.debug = new kernel_debug(); this.system = new kernel_system(); this.browser = new kernel_browser(); this.calendar = new kernel_calendar(); this.desktop = new kernel_desktop(); this.sidebar = new kernel_sidebar(); this.windowmanager = new kernel_windowmanager(); this.taskbar = new kernel_taskbar(); } var kernel = new kernel();