diff options
Diffstat (limited to 'funcweb/funcweb/static')
-rw-r--r-- | funcweb/funcweb/static/css/style.css | 10 | ||||
-rw-r--r-- | funcweb/funcweb/static/images/loading.gif | bin | 0 -> 46766 bytes | |||
-rw-r--r-- | funcweb/funcweb/static/javascript/ajax.js | 83 |
3 files changed, 91 insertions, 2 deletions
diff --git a/funcweb/funcweb/static/css/style.css b/funcweb/funcweb/static/css/style.css index b320cb6..703e22e 100644 --- a/funcweb/funcweb/static/css/style.css +++ b/funcweb/funcweb/static/css/style.css @@ -506,7 +506,7 @@ background-position:100% -24px; /*********** My Fedora Widget stuff *************/ .col { - margin: 5px + margin: 10px padding: 0 0 2ex; } @@ -642,7 +642,7 @@ background-position:100% -24px; .col { float: left; - margin: 5px; + margin: 30px; padding: 0 0 2ex; padding-bottom: 32767px; margin-bottom: -32767px; @@ -677,6 +677,10 @@ background-position:100% -24px; } +#col5 { + width: 200px; + margin-left: 500px; +} .widget-list { /*display: table-cell;*/ } @@ -699,6 +703,8 @@ background-position:100% -24px; background-color: white; } + + .widget h2 { border-width: 1px 1px 1px 1px; font-weight: bold; diff --git a/funcweb/funcweb/static/images/loading.gif b/funcweb/funcweb/static/images/loading.gif Binary files differnew file mode 100644 index 0000000..83729ec --- /dev/null +++ b/funcweb/funcweb/static/images/loading.gif diff --git a/funcweb/funcweb/static/javascript/ajax.js b/funcweb/funcweb/static/javascript/ajax.js new file mode 100644 index 0000000..7df4749 --- /dev/null +++ b/funcweb/funcweb/static/javascript/ajax.js @@ -0,0 +1,83 @@ +function remoteFormRequest(form, target, options) { + var query = Array(); + var contents = formContents(form); + for (var j=0; j<contents[0].length; j++) + query[contents[0][j]] = contents[1][j]; + query["tg_random"] = new Date().getTime(); + //makePOSTRequest(form.action, target, queryString(query)); + remoteRequest(form, form.action, target, query, options); + return true; +} + +function remoteRequest(source, target_url, target_dom, data, options) { + //before + if (options['before']) { + eval(options['before']); + } + if ((!options['confirm']) || confirm(options['confirm'])) { + makePOSTRequest(source, target_url, getElement(target_dom), queryString(data), options); + //after + if (options['after']) { + eval(options['after']); + } + } + return true; +} + +function makePOSTRequest(source, url, target, parameters, options) { + var http_request = false; + if (window.XMLHttpRequest) { // Mozilla, Safari,... + http_request = new XMLHttpRequest(); + if (http_request.overrideMimeType) { + http_request.overrideMimeType('text/xml'); + } + } else if (window.ActiveXObject) { // IE + try { + http_request = new ActiveXObject("Msxml2.XMLHTTP"); + } catch (e) { + try { + http_request = new ActiveXObject("Microsoft.XMLHTTP"); + } catch (e) {} + } + } + if (!http_request) { + alert('Cannot create XMLHTTP instance'); + return false; + } + + var insertContents = function () { + if (http_request.readyState == 4) { + // loaded + if (options['loaded']) { + eval(options['loaded']); + } + if (http_request.status == 200) { + if(target) { + target.innerHTML = http_request.responseText; + } + //success + if (options['on_success']) { + eval(options['on_success']); + } + } else { + //failure + if (options['on_failure']) { + eval(options['on_failure']); + } else { + alert('There was a problem with the request. Status('+http_request.status+')'); + } + } + //complete + if (options['on_complete']) { + eval(options['on_complete']); + } + } + } + + http_request.onreadystatechange = insertContents; + http_request.open('POST', url, true); + http_request.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); + http_request.setRequestHeader("Content-length", parameters.length); + http_request.setRequestHeader("Connection", "close"); + http_request.send(parameters); +} |