[CS-Project-svn_notify] SF.net SVN: cs-project:[1018] trunk/2.0
Brought to you by:
crazedsanity
From: <cra...@us...> - 2009-12-16 01:47:03
|
Revision: 1018 http://cs-project.svn.sourceforge.net/cs-project/?rev=1018&view=rev Author: crazedsanity Date: 2009-12-16 01:46:51 +0000 (Wed, 16 Dec 2009) Log Message: ----------- Test code to show off AJAX stuff (with jQuery), plus svn:externals for core libraries. Modified Paths: -------------- trunk/2.0/includes/ajax/test.inc trunk/2.0/public_html/index.php trunk/2.0/public_html/js/cs-project.js Added Paths: ----------- trunk/2.0/includes/ trunk/2.0/public_html/images/ajax-loader.gif trunk/2.0/public_html/js/ajax.js trunk/2.0/public_html/js/jquery.blockUI.js trunk/2.0/templates/content/ trunk/2.0/templates/content/index.content.tmpl trunk/2.0/templates/footer.shared.tmpl trunk/2.0/templates/header.shared.tmpl trunk/2.0/templates/infobar.shared.tmpl trunk/2.0/templates/main.shared.tmpl trunk/2.0/templates/menu.shared.tmpl trunk/2.0/templates/system/ trunk/2.0/templates/system/404.shared.tmpl trunk/2.0/templates/system/message_box.tmpl Removed Paths: ------------- trunk/2.0/public_html/includes/ Modified: trunk/2.0/includes/ajax/test.inc =================================================================== --- trunk/2.0/public_html/includes/ajax/test.inc 2009-12-14 16:16:39 UTC (rev 1016) +++ trunk/2.0/includes/ajax/test.inc 2009-12-16 01:46:51 UTC (rev 1018) @@ -10,5 +10,15 @@ * Last Updated:::::::: $Date$ */ +sleep(1); +$page->printOnFinish=false; +$xml = new cs_phpxmlCreator("ajaxresponse"); +$xml->add_tag("time", microtime()); +$xml->add_tag("callback_success", 'callback_test'); +$xml->add_tag("post_data", htmlentities($page->gfObj->debug_print($_POST,0))); +print($xml->create_xml_string()); + + +exit; ?> Added: trunk/2.0/public_html/images/ajax-loader.gif =================================================================== (Binary files differ) Property changes on: trunk/2.0/public_html/images/ajax-loader.gif ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Modified: trunk/2.0/public_html/index.php =================================================================== --- trunk/2.0/public_html/index.php 2009-12-14 16:20:46 UTC (rev 1017) +++ trunk/2.0/public_html/index.php 2009-12-16 01:46:51 UTC (rev 1018) @@ -11,4 +11,9 @@ */ +require_once(dirname(__FILE__) .'/../lib/cs-content/__autoload.php'); + +$cs = new contentSystem(); +$cs->finish(); + ?> Added: trunk/2.0/public_html/js/ajax.js =================================================================== --- trunk/2.0/public_html/js/ajax.js (rev 0) +++ trunk/2.0/public_html/js/ajax.js 2009-12-16 01:46:51 UTC (rev 1018) @@ -0,0 +1,118 @@ +//Use this for compatibility with Internet Explorer, so elements can actually be found. Done this +//way instead of via JQuery because JQuery doesn't actually support parsing XML +//(see http://dev.jquery.com/ticket/3143) +// +//SOURCE::: +//http://groups.google.com/group/jquery-en/browse_frm/thread/95718c9aab2c7483/af37adcb54b816c3?lnk=gst&q=parsexml&pli=1 +function parseXML( xml ) { + if( window.ActiveXObject && window.GetObject ) { + var dom = new ActiveXObject( 'Microsoft.XMLDOM' ); + dom.loadXML( xml ); + return dom; + } + if( window.DOMParser ) + return new DOMParser().parseFromString( xml, 'text/xml' ); + throw new Error( 'No XML parser available' ); +} + + +function ajax_getRequest(type, isAsync, url) { + if(isAsync != false && isAsync != true) { + isAsync = true; + } + + myUrl='/ajax/'; + if(url != undefined) { + myUrl = url; + } + + $.ajax ({ + url : myUrl + type, + cache : false, + async : isAsync, + dataType : 'text/xml', + success: function (returnXml) { + var xml = parseXML(returnXml); + if($(xml).find('type').text() == 'auth') { + updateLoginBox(xml); + } + }, + error: function (returnXml) { + alert("Call to " + type + " failed::: " + returnXml); + } + }); +} + + + +function handle_ajaxLoginResult(xml) { + if(typeof xml == "object") { + updateLoginBox(xml); + + //they're logged in. Redirect. + if($(xml).find('status').text() == 1 && getURLVar('loginDestination')) { + var dest = Url.decode(getURLVar('loginDestination')); + document.location=dest; + } + } +} + + + +function ajax_successCallback(xmlData) { + var xmlObj = parseXML(xmlData); + var $xmlObj = $(xmlObj); + if($xmlObj.find('callback_success').text()) { + //call the callback function... + var funcname = $xmlObj.find('callback_success').text(); + //TODO: figure out how to AVOID using eval() here... + eval(funcname + '(xmlObj)'); + } +} + + + +function ajax_doPost(formName, postData, msgTitle, msgBody, isAsync) { + if(msgTitle != undefined && msgTitle != null && msgTitle.length) { + $.growlUI(msgTitle, msgBody); + } + + if(isAsync == undefined) { + isAsync = true; + } + + var myUrl = "/ajax/" + formName; + + $.ajax({ + url: myUrl, + type: "POST", + data: postData, + success: ajax_successCallback + }); +} + + + + +//Code to pull _GET vars, from http://techfeed.net/blog/index.cfm/2007/2/6/JavaScript-URL-variables +function getURLVar(urlVarName) { + //divide the URL in half at the '?' + var urlHalves = String(document.location).split('?'); + var urlVarValue = ''; + if(urlHalves[1]){ + //load all the name/value pairs into an array + var urlVars = urlHalves[1].split('&'); + //loop over the list, and find the specified url variable + for(i=0; i<=(urlVars.length); i++){ + if(urlVars[i]){ + //load the name/value pair into an array + var urlVarPair = urlVars[i].split('='); + if (urlVarPair[0] && urlVarPair[0] == urlVarName) { + //I found a variable that matches, load it's value into the return variable + urlVarValue = urlVarPair[1]; + } + } + } + } + return urlVarValue; +} Modified: trunk/2.0/public_html/js/cs-project.js =================================================================== --- trunk/2.0/public_html/js/cs-project.js 2009-12-14 16:20:46 UTC (rev 1017) +++ trunk/2.0/public_html/js/cs-project.js 2009-12-16 01:46:51 UTC (rev 1018) @@ -1,371 +1,66 @@ +var ajaxLoadingImage = '<img src="/images/ajax-loader.gif" border="0"/>'; -function toggleDisplay(obj) { - if(obj != null) { - //check if "obj" is an object or just a string. - if(obj != null && typeof(obj) == 'object') { - var el = obj; - } - else { - var el = document.getElementById(obj); - } - - var oldDisplay = el.style.display; - - - if(oldDisplay == 'none') { - var newDisplay = 'inline'; - } - else { - var newDisplay = 'none'; - } - - el.style.display = newDisplay; - } -} - - -/** - * Works simply by having 2 divs and an input with standardized - * prefixes, and having special suffixes so it's easy to call - * without having to pass the names of the three elements. -**/ -function enableInput(prefixName) { - //set the names of the items. - var inputObjName = prefixName + '_input'; - var textDivName = prefixName + '_text'; - var inputDivName = prefixName + '_inputDiv'; +/* START AJAX TEST FUNCTIONS */ - - - if(document.getElementById(inputDivName)) { - //make the text disappear. - toggleDisplay(textDivName, 'inline'); - } - - if(document.getElementById(inputDivName)) { - //make the input div appear. - //toggleDisplay(inputDivName, 'inline'); - new Effect.Appear(inputDivName); - } - - //now enable the input. - if(document.getElementById(inputObjName) != null) { - var inputObj = document.getElementById(inputObjName); - inputObj.disabled = false; - inputObj.style.display = 'inline'; - } -} - -/** - * Hide the text div & enable one of two divs. -**/ -function setup__enableInput(prefixName, selectedOption) { - - //EXAMPLE: if "prefixName"=="example" and "selectedOption"=="option1"... - - //example_text - var textDivName = prefixName + '_text'; - - //example_option1_div - var optionDivName = prefixName + '_' + selectedOption + '_div'; - - //example_option1_submitButton - var submitButtonName = prefixName + '_' + selectedOption +'_submitButton'; - - //example_selectedOption - var selectedOptionName = prefixName + '_selectedOption'; - - //hide the text. - var textDiv = document.getElementById(textDivName); - textDiv.style.display = 'none'; - - //display the option. - var optionDiv = document.getElementById(optionDivName); - optionDiv.style.display = 'inline'; - - //set the value of the option input. - var selectedOptionInput = document.getElementById(selectedOptionName); - selectedOptionInput.value = selectedOption; - - //display the submit button. - var submitButton = document.getElementById(submitButtonName); - submitButton.style.display = 'inline'; -} - - -function cs_addAttribute(selectObj) { - if(selectObj != null && selectObj.selectedIndex > 0) { - //okay, get the value... - var myValue = selectObj.options[selectObj.selectedIndex].value; - var valueInputObj = document.getElementById('addAttribute_value'); - - if(myValue.length > 0) { - //okay... - if(myValue == '**new**') { - toggleDisplay('addAttribute_select', 'inline'); - toggleDisplay('addAttribute_new', 'inline'); - document.getElementById('addAttribute_list').disabled=true; - document.getElementById('addAttribute_new_input').disabled=false; - } - else { - document.getElementById('addAttribute_new_input').value = myValue; - document.getElementById('addAttribute_new_input').disabled=false; - } - valueInputObj.disabled = false; - cs_enableSubmitButton(); + //------------------------------------------------------------------------- + function updatePageLoadData(newData) { + if(newData.length > 0) { + $("#pageLoadData").html(newData); } else { - valueInputObj.disabled = true; + $("#pageLoadData").text(""); } - } -}//end cs_addAttribute() - - -function cs_contactDelAttrib(checkBoxObj) { - if(checkBoxObj != null) { - var myName = checkBoxObj.value; - var inputName = 'editAttribute_' + myName; - var enableInputObj = document.getElementById(inputName); - - if(enableInputObj != null) { - cs_enableSubmitButton(); - enableInputObj.disabled = true; - } - else { - alert("Cannot find input with id=(" + inputName + ")"); - } - } -}//end cs_contactDelAttrib() - - -function cs_contactEdit() { - //form appears, static data disappears. - toggleDisplay('mainContact_static', 'inline'); - toggleDisplay('mainContact_form', 'inline'); + }//end updatePageLoadData() + //------------------------------------------------------------------------- - //now enable some elements. - document.getElementById('contactData_company').disabled=false; - document.getElementById('contactData_fname').disabled=false; - document.getElementById('contactData_lname').disabled=false; - document.getElementById('contactData_email').disabled=false; - cs_enableSubmitButton(); -}//end cs_contactEdit() - - -function cs_enableSubmitButton(buttonName, disVal) { - if(buttonName != null) { - var buttonObj = document.getElementById(buttonName); - } - else { - var buttonObj = document.getElementById('submitButton'); - } - //if(disVal == null || (disVal != true && disVal != false)) { - // disVal = false; - //} - - if(buttonObj != null && buttonObj.type == 'submit') { - buttonObj.disabled = disVal; - } - - return(disVal); -}//end cs_enableSubmitButton() - -function cs_attributeEdit(myName) { - var linkDivObj = document.getElementById('link_editAttribute_' + myName); - var inputDivObj = document.getElementById('input_editAttribute_' + myName); - var inputObj = document.getElementById('editAttribute_' + myName); - - if(linkDivObj != null && inputDivObj != null && inputObj != null) { - linkDivObj.style.display = 'none'; - inputDivObj.style.display = 'inline'; - inputObj.disabled = false; - cs_enableSubmitButton(); - } - -}//end cs_attributeEdit() - - -function cs_setContactEmailId(newValue) { - var inputObj = document.getElementById('contactData_email'); - - if(inputObj != null && newValue != null) { - inputObj.value = newValue; - - //reset the old fontWeight... - myObj = null; - var checkBoxes = updateContactForm.garbage_contactEmailId; - for(counter = 0; counter < checkBoxes.length; counter++) { - curValue = checkBoxes[counter].value; - myName = 'display_ceid_' + curValue; - myObj = document.getElementById(myName); - - if(myObj != null) { - if(curValue == newValue) { - myObj.style.fontWeight = 'bold'; - } - else { - myObj.style.fontWeight = 'normal'; - } - } + //------------------------------------------------------------------------- + function show_ajaxLoading(myText) { + if(!myText.length || myText == null || myText == undefined) { + myText = "loading...."; } - } -}//end cs_setContactEmailId() - - -function cs_contactAddEmail(obj) { - var newEmailObj = document.getElementById('contactData_newContactEmail'); + updatePageLoadData(ajaxLoadingImage + myText); + }//end show_ajaxLoading() + //------------------------------------------------------------------------- - newEmailObj.disabled = false; - - if(obj != null) { - //passed the object: they want the value updated. - newEmailObj.value = obj.value; - cs_setContactEmailId('new'); - } - else { - var linkDivObj = document.getElementById('contactAddEmail_link'); - var radioDivObj = document.getElementById('contactAddEmail_radioDiv'); - var radioInputObj = document.getElementById('contactAddEmail_radio'); - var textDivObj = document.getElementById('contactAddEmail_text'); - var textInputObj = document.getElementById('contactAddEmail_input'); - - linkDivObj.style.display = 'none'; - radioDivObj.style.display = 'inline'; - textDivObj.style.display = 'inline'; - - textInputObj.disabled = false; - radioInputObj.disabled = false; - radioInputObj.checked = true; - } - -}//end cs_contactAddEmail() - -/** - * The data inside the given div is replaced... - */ -function cs_submitButton_processing(buttonDivName) { - - var buttonDivObj = document.getElementById(buttonDivName + '_button'); - var imageDivObj = document.getElementById(buttonDivName + '_image'); - - if(buttonDivObj != null && imageDivObj != null) { - //buttonDivObj.style.display = 'none'; - //imageDivObj.style.display = 'inline'; + //------------------------------------------------------------------------- + function ajax_getTestResponse() { - toggleDisplay(buttonDivObj, 'none'); - toggleDisplay(imageDivObj, 'inline'); - } - else { - alert("at least one object is null::: " + buttonDivObj + imageDivObj); - } - -}//end cs_submitButton_processing() - - -function lostPassword_validate() { - //document.print("checking... " + time()); - //var dateObj = new Date(); - //document.write("checking... " + dateObj.getMilliseconds()); - //clearInterval(); - - var hashObj = document.getElementById('hashInput'); - var checksumObj = document.getElementById('checksumInput'); - var debugObj = document.getElementById('debug'); - - var buttonShouldBe = ""; - var enableVal = ""; - var showEnableVal = ""; - var passMatchText = "not checked..."; - var passMatch = false; - - var passCheckObj = document.getElementById('password'); - var passConfirmObj = document.getElementById('passwordConfirm'); - - //alert(hashObj.toString()); - - if(hashObj != null && checksumObj != null && passCheckObj != null && passConfirmObj != null) { - passMatchText = "do not match"; - passMatch = false; - if(passCheckObj.value == passConfirmObj.value) { - passMatchText = "<b>match</b>"; - passMatch = true; + myPostData = { + "firstItem" : "myTest", + "secondItem" : $("#pageLoadData").html() } + show_ajaxLoading("Checking response..."); + ajax_doPost("test", myPostData, "WAIT", "Doing a test POST via AJAX, be patient."); - //check that the hash is 32 characters long. - if(hashObj.value.length == 32 && checksumObj.value.length > 3 && passMatch == true) { - buttonShouldBe = 'enabled'; - enableVal = cs_enableSubmitButton(); - } - else { - buttonShouldBe = 'DISabled'; - enableVal = cs_enableSubmitButton(null, true); - } - - showEnableVal = "FALSE"; - if(enableVal == true) { - showEnableVal = "true"; - } - } + }//end ajax_getTestResponse() + //------------------------------------------------------------------------- - debugObj.innerHTML = "HASH VALUE: " + hashObj.value + "<br>\nLENGTH: " + hashObj.value.length - + "<hr>checksum Value: " + checksumObj.value + "<br>\nLENGTH: " + checksumObj.value.length - + "<hr>Button should be: " + buttonShouldBe + "<br>\nButton REALLY IS " + enableVal - + "<hr>Passwords: " + passMatchText; - //debugObj.innerHTML = info + hashObj.toString(); - //clearInterval(); -}//end lostPassword_validate() + //------------------------------------------------------------------------- + function callback_test(xmlObj) { + $xmlObj = $(xmlObj); + updatePageLoadData("Response complete... time was (" + $xmlObj.find("time").text() +")"); + $("#response").html($xmlObj.find("post_data").text()); + }//end callback_test() + //------------------------------------------------------------------------- +/* END AJAX TEST FUNCTIONS */ -function cs_confirmLostPass() { - cs_submitButton_processing('submitRequest'); - var hashInputObj = document.getElementById('hashInput'); - var checksumInputObj = document.getElementById('checksumInput'); - - hashInputObj.readonly = true; - checksumInputObj.readonly = true; -}//end cs_confirmLostPass() -function clearErrorMessage() { - var name = 'MAIN_error_message'; - document.getElementById(name).innerHTML=""; -}//end clearErrorMessage() - - -/** - * Overload the xajax call to be able to do things like clearing out the - * div that contains set messages... - */ -function checkAjax() { - var retval = false; - if(this.xajaxLoaded) { - retval = true; - } - return retval; -} -var clearMessageTimeoutID; -if(checkAjax()) { - //keep around the old call function - xajax.realCall = xajax.call; - //override the call function to bend to our wicked ways - xajax.call = function(sFunction, aArgs, sRequestType) - { - //clear out the message. - if(this.clearMessageTimeoutID) { - clearTimeout(this.clearMessageTimeoutID); - } - this.clearMessageTimeoutID = setTimeout("clearErrorMessage();", 10000); - - //call the old call function - return this.realCall(sFunction, aArgs, sRequestType); - } -} \ No newline at end of file +//------------------------------------------------------------------------- +$(document).ready(function() { + updatePageLoadData("page loaded!"); + $("#button1").click(function() { + ajax_getTestResponse(); + }); +}); +//------------------------------------------------------------------------- Added: trunk/2.0/public_html/js/jquery.blockUI.js =================================================================== --- trunk/2.0/public_html/js/jquery.blockUI.js (rev 0) +++ trunk/2.0/public_html/js/jquery.blockUI.js 2009-12-16 01:46:51 UTC (rev 1018) @@ -0,0 +1,422 @@ +/* + * jQuery blockUI plugin + * Version 2.20 (19-MAY-2009) + * @requires jQuery v1.2.3 or later + * + * Examples at: http://malsup.com/jquery/block/ + * Copyright (c) 2007-2008 M. Alsup + * Dual licensed under the MIT and GPL licenses: + * http://www.opensource.org/licenses/mit-license.php + * http://www.gnu.org/licenses/gpl.html + * + * Thanks to Amir-Hossein Sobhi for some excellent contributions! + */ + +;(function($) { + +if (/1\.(0|1|2)\.(0|1|2)/.test($.fn.jquery) || /^1.1/.test($.fn.jquery)) { + alert('blockUI requires jQuery v1.2.3 or later! You are using v' + $.fn.jquery); + return; +} + +$.fn._fadeIn = $.fn.fadeIn; + +var setExpr = (function() { + if (!$.browser.msie) return false; + var div = document.createElement('div'); + try { div.style.setExpression('width','0+0'); } + catch(e) { return false; } + return true; +})(); + + +// global $ methods for blocking/unblocking the entire page +$.blockUI = function(opts) { install(window, opts); }; +$.unblockUI = function(opts) { remove(window, opts); }; + +// convenience method for quick growl-like notifications (http://www.google.com/search?q=growl) +$.growlUI = function(title, message, timeout, onClose) { + var $m = $('<div class="growlUI"></div>'); + if (title) $m.append('<h1>'+title+'</h1>'); + if (message) $m.append('<h2>'+message+'</h2>'); + if (timeout == undefined) timeout = 3000; + $.blockUI({ + message: $m, fadeIn: 700, fadeOut: 1000, centerY: false, + timeout: timeout, showOverlay: false, + onUnblock: onClose, + css: $.blockUI.defaults.growlCSS + }); +}; + +// plugin method for blocking element content +$.fn.block = function(opts) { + return this.unblock({ fadeOut: 0 }).each(function() { + if ($.css(this,'position') == 'static') + this.style.position = 'relative'; + if ($.browser.msie) + this.style.zoom = 1; // force 'hasLayout' + install(this, opts); + }); +}; + +// plugin method for unblocking element content +$.fn.unblock = function(opts) { + return this.each(function() { + remove(this, opts); + }); +}; + +$.blockUI.version = 2.20; // 2nd generation blocking at no extra cost! + +// override these in your code to change the default behavior and style +$.blockUI.defaults = { + // message displayed when blocking (use null for no message) + message: '<h1>Please wait...</h1>', + + // styles for the message when blocking; if you wish to disable + // these and use an external stylesheet then do this in your code: + // $.blockUI.defaults.css = {}; + css: { + padding: 0, + margin: 0, + width: '30%', + top: '40%', + left: '35%', + textAlign: 'center', + color: '#000', + border: '3px solid #aaa', + backgroundColor:'#fff', + cursor: 'wait' + }, + + // styles for the overlay + overlayCSS: { + backgroundColor: '#000', + opacity: 0.6, + cursor: 'wait' + }, + + // styles applied when using $.growlUI + growlCSS: { + width: '350px', + top: '10px', + left: '', + right: '10px', + border: 'none', + padding: '5px', + opacity: 0.6, + cursor: null, + color: '#fff', + backgroundColor: '#000', + '-webkit-border-radius': '10px', + '-moz-border-radius': '10px' + }, + + // IE issues: 'about:blank' fails on HTTPS and javascript:false is s-l-o-w + // (hat tip to Jorge H. N. de Vasconcelos) + iframeSrc: /^https/i.test(window.location.href || '') ? 'javascript:false' : 'about:blank', + + // force usage of iframe in non-IE browsers (handy for blocking applets) + forceIframe: false, + + // z-index for the blocking overlay + baseZ: 1000, + + // set these to true to have the message automatically centered + centerX: true, // <-- only effects element blocking (page block controlled via css above) + centerY: true, + + // allow body element to be stetched in ie6; this makes blocking look better + // on "short" pages. disable if you wish to prevent changes to the body height + allowBodyStretch: true, + + // enable if you want key and mouse events to be disabled for content that is blocked + bindEvents: true, + + // be default blockUI will supress tab navigation from leaving blocking content + // (if bindEvents is true) + constrainTabKey: true, + + // fadeIn time in millis; set to 0 to disable fadeIn on block + fadeIn: 200, + + // fadeOut time in millis; set to 0 to disable fadeOut on unblock + fadeOut: 400, + + // time in millis to wait before auto-unblocking; set to 0 to disable auto-unblock + timeout: 0, + + // disable if you don't want to show the overlay + showOverlay: true, + + // if true, focus will be placed in the first available input field when + // page blocking + focusInput: true, + + // suppresses the use of overlay styles on FF/Linux (due to performance issues with opacity) + applyPlatformOpacityRules: true, + + // callback method invoked when unblocking has completed; the callback is + // passed the element that has been unblocked (which is the window object for page + // blocks) and the options that were passed to the unblock call: + // onUnblock(element, options) + onUnblock: null, + + // don't ask; if you really must know: http://groups.google.com/group/jquery-en/browse_thread/thread/36640a8730503595/2f6a79a77a78e493#2f6a79a77a78e493 + quirksmodeOffsetHack: 4 +}; + +// private data and functions follow... + +var ie6 = $.browser.msie && /MSIE 6.0/.test(navigator.userAgent); +var pageBlock = null; +var pageBlockEls = []; + +function install(el, opts) { + var full = (el == window); + var msg = opts && opts.message !== undefined ? opts.message : undefined; + opts = $.extend({}, $.blockUI.defaults, opts || {}); + opts.overlayCSS = $.extend({}, $.blockUI.defaults.overlayCSS, opts.overlayCSS || {}); + var css = $.extend({}, $.blockUI.defaults.css, opts.css || {}); + msg = msg === undefined ? opts.message : msg; + + // remove the current block (if there is one) + if (full && pageBlock) + remove(window, {fadeOut:0}); + + // if an existing element is being used as the blocking content then we capture + // its current place in the DOM (and current display style) so we can restore + // it when we unblock + if (msg && typeof msg != 'string' && (msg.parentNode || msg.jquery)) { + var node = msg.jquery ? msg[0] : msg; + var data = {}; + $(el).data('blockUI.history', data); + data.el = node; + data.parent = node.parentNode; + data.display = node.style.display; + data.position = node.style.position; + if (data.parent) + data.parent.removeChild(node); + } + + var z = opts.baseZ; + + // blockUI uses 3 layers for blocking, for simplicity they are all used on every platform; + // layer1 is the iframe layer which is used to supress bleed through of underlying content + // layer2 is the overlay layer which has opacity and a wait cursor (by default) + // layer3 is the message content that is displayed while blocking + + var lyr1 = ($.browser.msie || opts.forceIframe) + ? $('<iframe class="blockUI" style="z-index:'+ (z++) +';display:none;border:none;margin:0;padding:0;position:absolute;width:100%;height:100%;top:0;left:0" src="'+opts.iframeSrc+'"></iframe>') + : $('<div class="blockUI" style="display:none"></div>'); + var lyr2 = $('<div class="blockUI blockOverlay" style="z-index:'+ (z++) +';display:none;border:none;margin:0;padding:0;width:100%;height:100%;top:0;left:0"></div>'); + var lyr3 = full ? $('<div class="blockUI blockMsg blockPage" style="z-index:'+z+';display:none;position:fixed"></div>') + : $('<div class="blockUI blockMsg blockElement" style="z-index:'+z+';display:none;position:absolute"></div>'); + + // if we have a message, style it + if (msg) + lyr3.css(css); + + // style the overlay + if (!opts.applyPlatformOpacityRules || !($.browser.mozilla && /Linux/.test(navigator.platform))) + lyr2.css(opts.overlayCSS); + lyr2.css('position', full ? 'fixed' : 'absolute'); + + // make iframe layer transparent in IE + if ($.browser.msie || opts.forceIframe) + lyr1.css('opacity',0.0); + + $([lyr1[0],lyr2[0],lyr3[0]]).appendTo(full ? 'body' : el); + + // ie7 must use absolute positioning in quirks mode and to account for activex issues (when scrolling) + var expr = $.browser.msie && ($.browser.version < 8 || !$.boxModel) && (!$.boxModel || $('object,embed', full ? null : el).length > 0); + if (ie6 || (expr && setExpr)) { + // give body 100% height + if (full && opts.allowBodyStretch && $.boxModel) + $('html,body').css('height','100%'); + + // fix ie6 issue when blocked element has a border width + if ((ie6 || !$.boxModel) && !full) { + var t = sz(el,'borderTopWidth'), l = sz(el,'borderLeftWidth'); + var fixT = t ? '(0 - '+t+')' : 0; + var fixL = l ? '(0 - '+l+')' : 0; + } + + // simulate fixed position + $.each([lyr1,lyr2,lyr3], function(i,o) { + var s = o[0].style; + s.position = 'absolute'; + if (i < 2) { + full ? s.setExpression('height','Math.max(document.body.scrollHeight, document.body.offsetHeight) - (jQuery.boxModel?0:'+opts.quirksmodeOffsetHack+') + "px"') + : s.setExpression('height','this.parentNode.offsetHeight + "px"'); + full ? s.setExpression('width','jQuery.boxModel && document.documentElement.clientWidth || document.body.clientWidth + "px"') + : s.setExpression('width','this.parentNode.offsetWidth + "px"'); + if (fixL) s.setExpression('left', fixL); + if (fixT) s.setExpression('top', fixT); + } + else if (opts.centerY) { + if (full) s.setExpression('top','(document.documentElement.clientHeight || document.body.clientHeight) / 2 - (this.offsetHeight / 2) + (blah = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop) + "px"'); + s.marginTop = 0; + } + else if (!opts.centerY && full) { + var top = (opts.css && opts.css.top) ? parseInt(opts.css.top) : 0; + var expression = '((document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop) + '+top+') + "px"'; + s.setExpression('top',expression); + } + }); + } + + // show the message + if (msg) { + lyr3.append(msg); + if (msg.jquery || msg.nodeType) + $(msg).show(); + } + + if (($.browser.msie || opts.forceIframe) && opts.showOverlay) + lyr1.show(); // opacity is zero + if (opts.fadeIn) { + if (opts.showOverlay) + lyr2._fadeIn(opts.fadeIn); + if (msg) + lyr3.fadeIn(opts.fadeIn); + } + else { + if (opts.showOverlay) + lyr2.show(); + if (msg) + lyr3.show(); + } + + // bind key and mouse events + bind(1, el, opts); + + if (full) { + pageBlock = lyr3[0]; + pageBlockEls = $(':input:enabled:visible',pageBlock); + if (opts.focusInput) + setTimeout(focus, 20); + } + else + center(lyr3[0], opts.centerX, opts.centerY); + + if (opts.timeout) { + // auto-unblock + var to = setTimeout(function() { + full ? $.unblockUI(opts) : $(el).unblock(opts); + }, opts.timeout); + $(el).data('blockUI.timeout', to); + } +}; + +// remove the block +function remove(el, opts) { + var full = el == window; + var $el = $(el); + var data = $el.data('blockUI.history'); + var to = $el.data('blockUI.timeout'); + if (to) { + clearTimeout(to); + $el.removeData('blockUI.timeout'); + } + opts = $.extend({}, $.blockUI.defaults, opts || {}); + bind(0, el, opts); // unbind events + var els = full ? $('body').children().filter('.blockUI') : $('.blockUI', el); + + if (full) + pageBlock = pageBlockEls = null; + + if (opts.fadeOut) { + els.fadeOut(opts.fadeOut); + setTimeout(function() { reset(els,data,opts,el); }, opts.fadeOut); + } + else + reset(els, data, opts, el); +}; + +// move blocking element back into the DOM where it started +function reset(els,data,opts,el) { + els.each(function(i,o) { + // remove via DOM calls so we don't lose event handlers + if (this.parentNode) + this.parentNode.removeChild(this); + }); + + if (data && data.el) { + data.el.style.display = data.display; + data.el.style.position = data.position; + if (data.parent) + data.parent.appendChild(data.el); + $(data.el).removeData('blockUI.history'); + } + + if (typeof opts.onUnblock == 'function') + opts.onUnblock(el,opts); +}; + +// bind/unbind the handler +function bind(b, el, opts) { + var full = el == window, $el = $(el); + + // don't bother unbinding if there is nothing to unbind + if (!b && (full && !pageBlock || !full && !$el.data('blockUI.isBlocked'))) + return; + if (!full) + $el.data('blockUI.isBlocked', b); + + // don't bind events when overlay is not in use or if bindEvents is false + if (!opts.bindEvents || (b && !opts.showOverlay)) + return; + + // bind anchors and inputs for mouse and key events + var events = 'mousedown mouseup keydown keypress'; + b ? $(document).bind(events, opts, handler) : $(document).unbind(events, handler); + +// former impl... +// var $e = $('a,:input'); +// b ? $e.bind(events, opts, handler) : $e.unbind(events, handler); +}; + +// event handler to suppress keyboard/mouse events when blocking +function handler(e) { + // allow tab navigation (conditionally) + if (e.keyCode && e.keyCode == 9) { + if (pageBlock && e.data.constrainTabKey) { + var els = pageBlockEls; + var fwd = !e.shiftKey && e.target == els[els.length-1]; + var back = e.shiftKey && e.target == els[0]; + if (fwd || back) { + setTimeout(function(){focus(back)},10); + return false; + } + } + } + // allow events within the message content + if ($(e.target).parents('div.blockMsg').length > 0) + return true; + + // allow events for content that is not being blocked + return $(e.target).parents().children().filter('div.blockUI').length == 0; +}; + +function focus(back) { + if (!pageBlockEls) + return; + var e = pageBlockEls[back===true ? pageBlockEls.length-1 : 0]; + if (e) + e.focus(); +}; + +function center(el, x, y) { + var p = el.parentNode, s = el.style; + var l = ((p.offsetWidth - el.offsetWidth)/2) - sz(p,'borderLeftWidth'); + var t = ((p.offsetHeight - el.offsetHeight)/2) - sz(p,'borderTopWidth'); + if (x) s.left = l > 0 ? (l+'px') : '0'; + if (y) s.top = t > 0 ? (t+'px') : '0'; +}; + +function sz(el, p) { + return parseInt($.css(el,p))||0; +}; + +})(jQuery); Added: trunk/2.0/templates/content/index.content.tmpl =================================================================== --- trunk/2.0/templates/content/index.content.tmpl (rev 0) +++ trunk/2.0/templates/content/index.content.tmpl 2009-12-16 01:46:51 UTC (rev 1018) @@ -0,0 +1,14 @@ + +<h1>AJAX TEST</h1> + +<p class="smallprint">NOTE: you might want to use Firefox with FireBug turned on +so you can watch the data being sent.</p> + +<form> + <input type="button" id="button1" value="Click me"/> +</form> + + +<div id="pageLoadData" style="border:solid #000 1px;">This gets updated once the page is completely loaded.</div> + +<div id="response">No data yet... CLICK THE BUTTON!!!</div> Property changes on: trunk/2.0/templates/content/index.content.tmpl ___________________________________________________________________ Added: svn:executable + * Added: trunk/2.0/templates/footer.shared.tmpl =================================================================== --- trunk/2.0/templates/footer.shared.tmpl (rev 0) +++ trunk/2.0/templates/footer.shared.tmpl 2009-12-16 01:46:51 UTC (rev 1018) @@ -0,0 +1,9 @@ +<hr> +<div align="center"><font size="1"> + All content is ©opyright CrazedSanity + Computer Industries, 1998-{curYear}. <br> + CrazedSanity Computer Industries is a division of <a href="http://unlimited.buzzkill.org">BuzzKill + Productions Unlimited ®</a>. All rights reserved. <br> + For questions, to report a problem, or to offer your first born child as a sacrifice, + contact <a href="mailto:webmaster@127.0.0.1">webmaster -at- crazedsanity.com</a>.</font><BR><BR> +</div> Property changes on: trunk/2.0/templates/footer.shared.tmpl ___________________________________________________________________ Added: svn:executable + * Added: trunk/2.0/templates/header.shared.tmpl =================================================================== --- trunk/2.0/templates/header.shared.tmpl (rev 0) +++ trunk/2.0/templates/header.shared.tmpl 2009-12-16 01:46:51 UTC (rev 1018) @@ -0,0 +1,12 @@ +<table border="0" cellpadding="0" cellspacing="0" width="100%"> +<tbody><tr> + <td align="center"> + + </td> +</tr> +<TR> + <td align="center"><!-- This row should span across the page. --> + <HR>{date} {time} {timezone}<HR> + </td> +</tr> +</tbody></table> Property changes on: trunk/2.0/templates/header.shared.tmpl ___________________________________________________________________ Added: svn:executable + * Added: trunk/2.0/templates/infobar.shared.tmpl =================================================================== --- trunk/2.0/templates/infobar.shared.tmpl (rev 0) +++ trunk/2.0/templates/infobar.shared.tmpl 2009-12-16 01:46:51 UTC (rev 1018) @@ -0,0 +1,39 @@ + <form name="login" method="post" action="/login.php"> + <table width="100%" border="0" bgcolor="#CCCCCC"> + <tr> + <td width="85%">Sign up for your FREE membership!</td> + <td width="6%">Username:</td> + <td width="9%"> + <input type="text" name="username" size="10" maxlength="60"> + </td> + </tr> + <tr> + <td width="85%">Forget your username/password?</td> + <td width="6%">Password:</td> + <td width="9%"> + <input type="password" name="password" size="10" maxlength="60"> + </td> + </tr> + <tr> + <td width="85%"> </td> + <td width="6%"> + <input type="submit" name="action" value="Login"> + </td> + <td width="9%"> + <input type="reset" value="Reset"> + </td> + </tr> + </table> + </form> +<!-- END infobar_login --> +<!-- BEGIN infobar_logout --> + <table width="100%" border="0" bgcolor="#CCCCCC"> + <tr> + <td>Welcome, {USER_fname}</td> + <td>DATE: {PAGE_date}</td> + </tr> + <tr> + <td><a href="/logout.php">logout</a></td> + <td> </td> + </tr> + </table> Property changes on: trunk/2.0/templates/infobar.shared.tmpl ___________________________________________________________________ Added: svn:executable + * Added: trunk/2.0/templates/main.shared.tmpl =================================================================== --- trunk/2.0/templates/main.shared.tmpl (rev 0) +++ trunk/2.0/templates/main.shared.tmpl 2009-12-16 01:46:51 UTC (rev 1018) @@ -0,0 +1,46 @@ +<html> + +<head> +<title>{html_title}</title> +<link rel="stylesheet" href="/css/crazed.css" type="text/css"> +<script language="javascript" src="/js/jquery-1.3.2.min.js" type="text/javascript"></script> +<script language="javascript" src="/js/jquery.blockUI.js" type="text/javascript"></script> +<script language="javascript" src="/js/ajax.js" type="text/javascript"></script> +<script language="javascript" src="/js/cs-project.js" type="text/javascript"></script> +</head> + +<LINK REL="SHORTCUT ICON" HREF="/favicon.ico"> +<BODY bgcolor='white' text='#666666' link='#006666' vlink='#333355' alink='#FF0000' bgproperties='fixed'> + +<table border=0 cellpadding=0 cellspacing=0 width="90%" align="center"> +<tr> + <!-- This row should span across the page. --> + <td align="center" colspan=2> + {header} + {error_msg} + </td> +</tr> +<tr valign=top> + <td> + {menu} + </td> + + <td align="center"> + <table border=0 cellspacing=2 cellpadding=2 width="100%"> + <tr> + <td> + {content} + </td> + </tr> + </table> + </td> +</tr> +<tr> + <td colspan="2"> + {footer} + </td> +</tr> +</table> + +</body> +</html> Property changes on: trunk/2.0/templates/main.shared.tmpl ___________________________________________________________________ Added: svn:executable + * Property changes on: trunk/2.0/templates/menu.shared.tmpl ___________________________________________________________________ Added: svn:executable + * Added: trunk/2.0/templates/system/404.shared.tmpl =================================================================== --- trunk/2.0/templates/system/404.shared.tmpl (rev 0) +++ trunk/2.0/templates/system/404.shared.tmpl 2009-12-16 01:46:51 UTC (rev 1018) @@ -0,0 +1,33 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> + +<html xmlns="http://www.w3.org/1999/xhtml" lang="en_US" xml:lang="en_US"> +<!-- + * Created on Jun 3, 2007 + * +--> + <head> + <title>Page Not Found</title> + <link rel="stylesheet" href="{APPURL}/css/site.css" type="text/css"> + </head> + <body> + + <table border=0 cellpadding=0 cellspacing=0 width="90%" align="center"> +<TR> + <td align="center"><!-- This row should span across the page. --><hr>{datetime}<hr></td> +</TR> + + <tr> + + <td> + + + {content} + + + + </td> + </tr> +</table> + </body> +</html> Added: trunk/2.0/templates/system/message_box.tmpl =================================================================== --- trunk/2.0/templates/system/message_box.tmpl (rev 0) +++ trunk/2.0/templates/system/message_box.tmpl 2009-12-16 01:46:51 UTC (rev 1018) @@ -0,0 +1,29 @@ +<!-- *** MESSAGE_BOX START (/system/message_box.tmpl) *** --> +<table border="0" cellspacing="0" cellpadding="0" align="center"> + <tr> + <td class="{messageType}" width="5" align="left" valign="top"><img src="{APPURL}/images/frame/crn-white-tl.gif" width="5" height="5" alt=""></td> + <td class="{messageType}"><img src="{APPURL}/images/clear.gif" width="20" height="2" alt=""></td> + <td class="{messageType}" width="5" align="right" valign="top"><img src="{APPURL}/images/frame/crn-white-tr.gif" width="5" height="5" alt=""></td> + </tr> + <tr> + <td class="{messageType}" width="5"><img src="{APPURL}/images/clear.gif" width="5" height="20" alt=""></td> + <td> + <table class="{messageType}" width="100%" border="0" cellspacing="0" cellpadding="5"> + <tr> + <td valign="top"> + <p style="border-style: solid; border-width: 0px 0px 2px 0px" class="title1">{title}</p> +<p style="margin: 5px 0px 5px 0px">{message}</p> + {redirect} </td> + </tr> + </table></td> + <td class="{messageType}" width="5"><img src="{APPURL}/images/clear.gif" width="5" height="20" alt=""></td> + </tr> + <tr> + <td class="{messageType}" width="5" align="left" valign="bottom"><img src="{APPURL}/images/frame/crn-white-bl.gif" width="5" height="5" alt=""></td> + <td class="{messageType}"><img src="{APPURL}/images/clear.gif" width="20" height="2" alt=""></td> + <td class="{messageType}" width="5" align="right" valign="bottom"><img src="{APPURL}/images/frame/crn-white-br.gif" width="5" height="5" alt=""></td> + </tr> + </table> +<br> +<!-- *** MESSAGE_BOX END (/system/message_box.tmpl) *** --> + Property changes on: trunk/2.0/templates/system/message_box.tmpl ___________________________________________________________________ Added: svn:executable + * This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |