Commit 072a2004 authored by Sebastien Robin's avatar Sebastien Robin

Merge remote-tracking branch 'remotes/trac/master'

parents b115e436 209534e7
/UNGProject/dojo/
/UNGProject/xinha/
/UNGProject/nbproject/
/UNGProject/jquery_sheet_editor/
......@@ -17,3 +18,6 @@ apache2.conf
/.installed.cfg
/.mr.developer.cfg
/parts/
#vi
*.swp
......@@ -13,9 +13,9 @@ div#pad-navigation-wrapper {
}
#pad-navigation-wrapper {
border-bottom: 1px solid #3D6474;
height: 25px;
height: 38px;
margin-top: 10px;
width: 100%;
width: 96%;
}
/* tabs */
#tabs_switcher {
......
[{"name":"Color Palette","url":"http:\/\/localhost\/gadgets\/sample\/colorpalette_oam.xml"},
{"name":"Date Listener","url":"http:\/\/localhost\/gadgets\/sample\/dateListener.oam.xml"}]
.gadgetContainer {
position:absolute;
}
\ No newline at end of file
This diff is collapsed.
if (typeof Node == 'undefined') {
Node = {};
Node.ELEMENT_NODE = 1;
Node.TEXT_NODE = 3;
}
function gel(id)
{
return(document.getElementById(id));
}
Browser = {};
Browser.isIE = (navigator.userAgent.indexOf('MSIE') != -1);
Browser.isFirefox = (navigator.userAgent.indexOf('Firefox') != -1);
Browser.isSafari = (navigator.userAgent.indexOf('Safari') != -1);
Browser.isOpera = (navigator.userAgent.indexOf('Opera') != -1);
Browser.addEventListener = function(eventType, onWhom, callback) {
if (onWhom.addEventListener) {
onWhom.addEventListener(eventType, callback, false);
} else {
onWhom.attachEvent('on' + eventType, callback);
}
}
Browser.removeEventListener = function(eventType, onWhom, callback)
{
if (onWhom.removeEventListener) {
onWhom.removeEventListener(eventType, callback, false);
} else {
onWhom.detachEvent('on' + eventType, callback);
}
}
Browser.bind = function(callback, toWom)
{
var __method = callback;
return function() {
return __method.apply(toWom, arguments);
}
}
Browser.setAlpha = function(element, alpha)
{
if (Browser.isIE) {
element.style.filter="Alpha(Opacity=" + (parseFloat(alpha) * 100) + ")";
} else {
element.style.opacity = alpha;
}
}
Browser.cancelEvent = function(e)
{
if (e.stopPropagation) {
e.stopPropagation();
}
if (e.preventDefault) {
e.preventDefault();
}
e.cancelBubble = true;
e.cancel = true;
e.returnValue = false;
return(false);
}
Browser.fetchPreviousSibling = function(element, tagName)
{
if (! tagName) {
tagName = element.tagName;
}
element = element.previousSibling;
while (element && element.tagName != tagName) {
element = element.previousSibling;
}
return(element);
}
Browser.fetchNextSibling = function(element, tagName)
{
if (! tagName) {
tagName = element.tagName;
}
element = element.nextSibling;
while (element && element.tagName != tagName) {
element = element.nextSibling;
}
return(element);
}
Browser.fetchFirst = function(element, tagName)
{
if (element.childNodes) {
tagName = tagName.toUpperCase()
for (var i = 0; i < element.childNodes.length; i++) {
var child = element.childNodes.item(i);
if ((child.tagName && child.tagName.toUpperCase() == tagName) || (!tagName && (child.nodeType == Node.ELEMENT_NODE))) {
return(child);
}
}
}
return(null);
}
Browser.fetchChildren = function(element, tagName)
{
var result = new Array();
tagName = tagName.toUpperCase();
result.item = function(index) {
if (index >= 0 && index < this.length) {
return(this[index]);
}
throw 'Index out of bounds';
}
if (element.childNodes) {
for (var i = 0; i < element.childNodes.length; i++) {
var child = element.childNodes.item(i);
if (child.tagName && child.tagName.toUpperCase() == tagName) {
result.push(child);
}
}
}
return(result);
}
Browser.elementFromPoint = function(parent, x, y) {
if (document.elementFromPoint) {
var element = document.elementFromPoint(x, y);
if (element) {
return(element);
}
} else {
var startPos = dojo.coords(parent);
if ((x >= startPos.x && x <= (startPos.x + parent.offsetWidth)) &&
(y >= startPos.y && y < (startPos.y + parent.offsetHeight))) {
for (var i = 0; i < parent.childNodes.length; i++) {
var child = parent.childNodes.item(i);
if (child.nodeType == Node.ELEMENT_NODE) {
var result = this.elementFromPoint(child, x, y);
if (result) {
return(result);
}
}
}
return(parent);
}
}
return(false);
}
Browser.getScrollTop = function(){
return window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop || 0;
}
Browser.getScrollLeft = function(){
return window.pageXOffset || document.documentElement.scrollLeft || document.body.scrollLeft || 0;
}
Browser.sumAncestorProperties = function(node, prop) {
if (!node) {
return 0;
} // FIXME: throw an error?
var retVal = 0;
while(node){
var val = node[prop];
if(val){
retVal += val - 0;
if(node==document.body){ break; }// opera and khtml #body & #html has the same values, we only need one value
}
node = node.parentNode;
}
return retVal;
}
Browser.getStyle = function(el, prop) {
if (document.defaultView && document.defaultView.getComputedStyle) {
return document.defaultView.getComputedStyle(el, null)[prop];
} else if (el.currentStyle) {
var value = el.currentStyle[prop];
if (typeof value == 'undefined') {
value = el.style[prop];
}
return(value);
} else {
return el.style[prop];
}
}
Browser.pixelValue = function(str)
{
if (typeof str == 'number') {
return(str);
}
if (!str) {
return(0);
}
var match = str.match(/(.*)(px|\%)?/);
if (match && match.length == 3)
return(parseFloat(match[1]));
return(0);
}
Browser.createElement = function(tagName, style, parent) {
var result = document.createElement(tagName);
if (style) {
result.className = style;
}
if (parent) {
parent.appendChild(result);
}
return(result);
}
Browser.evalScriptGlobal = function(script) {
// dojo.eval doesn't execute script in global scope on IE. Be aware that
// window.execScript doesn't return anything so really best just for
// declaring things like functions, etc
if (window.execScript) {
window.execScript(script);
return null;
}
return dojo.eval(script);
}
function _gel(id) {
return(document.getElementById(id));
}
/* styles for the banner and toolbar */
.banner {
background-image: url('../../images/OAAright.jpg');
background-repeat: repeat-x;
margin: 0;
height: 47px;
width: 100%;
}
.banner-left {
float: left;
height: 47px;
width: 320px;
}
.banner-right {
float: right;
height: 47px;
width: 1px;
}
.nomadToolbarIcon {
background-repeat: no-repeat;
width: 24px;
height: 24px;
text-align: center;
cursor: pointer;
}
.nomadIconHelp {
background-image: url('../../images/help.gif');
}
.nomadIconView {
background-image: url('../../images/view.gif');
}
.nomadIconImport {
background-image: url('../../images/plus-circle.png');
}
.nomadIconRefresh {
background-image: url('../../images/refreshResults.gif');
}
.nomadIconSearchResults {
background-image: url('../../images/plus-circle.png');
}
.nomadCheckedMenuItemIcon {
background-image: url('../../images/checkmark.gif');
}
.nomadIconNoBinding {
background-image: url('../../images/noBind.gif');
}
.nomadIconSingleBinding {
background-image: url('../../images/singleBind.gif');
}
.nomadIconMultipleBinding {
background-image: url('../../images/multipleBind.gif');
}
.nomadIconPreferences {
background-image: url('../../images/gear_small.gif');
}
.preEdit input {
font-style: italic;
font-weight: lighter;
color: #999;
}
input.postEdit {
font-style: normal;
font-weight: normal;
color: #000;
}
/* styles for palette*/
.nomadIconWidget {
background-image: url('../../images/component_18x18.gif');
}
.paletteItemIconRow {
display: none;
}
.dijitMenuItemHover .paletteItemIconRow {
display: table-row;
}
.dijitMenuItemHoverIE .paletteItemIconRow {
display: block;
}
.dijitMenuItemHover .nomadIconInfo {
background-image: url('../../images/info.png');
}
.dijitMenuItemHover .nomadIconRun {
background-image: url('../../images/run.gif');
}
.dijitMenuItemHover .nomadIconBookmark {
background-image: url('../../images/folder.gif');
}
.nomadPaletteItem {
cursor: default;
}
.dijitMenu .nomadInnerMenu {
border: 0;
}
.paletteScrollButton {
width: 100%;
height: 18px;
}
.nomadIconScrollUp {
background-image: url('../../images/uparrow.gif');
}
.nomadIconScrollDown {
background-image: url('../../images/downarrow.gif');
}
.dijitTitlePane.paletteNorgie {
min-width: 200px;
}
.dijitMenu .paletteNorgie .dijitTitlePaneTitle {
background-image: none;
background-color: #e0d138;
}
.nomadWiringOverlayCurrent {
background-color: purple;
}
.nomadWiringOverlayRecommended {
background-color: yellow;
}
.nomadWiringOverlayPossible {
/* background-color: gray;*/
}
.dijitTooltip .dijitTooltipContainer {
width: 200px;
}
#propertyDialog .gadgetBody {
border: none;
padding: 0;
height: auto;
}
.nomadErrorMsg {
color: red;
font-style: italic;
}
.tundra .nomadMultiSelect select, .tundra .nomadMultiSelect input {
/* use same layout styles for both major components of the multiselect control */
/*border: 1px solid #B3B3B3;*/
margin: 0em 0.1em;
}
/* dojo 1.1 doesn't necessarily gray text anymore due to '.dijitReset' rule it introduced */
input[disabled], textarea[disabled], option[disabled], optgroup[disabled], select[disabled] {
color: graytext;
}
/* dojo 1.1 is causing things in buttons to be vertical-align: middle which
* is bothering the arrows on our WiringDropDownButtons
*/
.wiringButton .dijitButtonNode * {
display: -moz-inline-box;
display: inline-block;
}
.wiringButton .dijitA11yDownArrow {
margin-left: 0.8em;
font-size: 0.75em;
color: #848484;
}
/* had to specify directly, IE wasn't inheriting well */
/*
#searchOptions.dijitMenuItemHover {
background-color: #f7f7f7;
color: #000;
}
*/
html body {
background:#DADADA;
margin:0px;
}
.properties {
display:none;
}
.gadgetBody {
position:relative;
padding:4px;
height:100%;
overflow:hidden;
background:white;
border-right: solid 1px #dfdfdf;
border-bottom: solid 1px #dfdfdf;
border-left: solid 1px #dfdfdf;
}
.gadgetFrame {
width:100%;
height:100%;
margin:0;
padding:0;
border:none;
}
.gadgetDragAvatar {
position:absolute;
display:none;
background:url(smallish_widget.png) center left no-repeat;
height:50px;
padding-left:54px;
overflow:hidden;
}
.gadgetDragAvatar div {
overflow:hidden;
background:#DADADA;
height:100%;
background:#fef49c;
border:1px solid #BCA902;
padding:2px;
font-size:14px;
}
.gadgetDropTarget {
position:absolute;
background:darkgray;
width:4px;
}
.gadgetContainer .gadgetBoxHeader {
height:4px;
background:#DAE6F6; /* url(corner_dg_TR.gif) 100% 0 no-repeat;*/
}
.gadgetContainer .gadgetBoxHeader div {
width:4px;
height:4px;
background:#DAE6F6; /* url(corner_dg_TL.gif) 0 0 no-repeat;*/
}
.gadgetContainer .gadgetBoxContent {
background:#DAE6F6;
padding:5px 9px 0px 9px;
}
.gadgetContainer .gadgetBoxFooter {
height:16px;
background:#DAE6F6; /* url(corner_db_BR16.png) 100% 0 no-repeat;*/
cursor:se-resize;
}
.gadgetContainer .gadgetBoxFooter div {
height:16px;
width:16px;
background:#DAE6F6; /* url(corner_dg_BL16.png) 0 0 no-repeat;*/
}
.gadgetHeader {
position:relative;
height:20px;
cursor:move;
background:#DADADA;
}
.absDeleteImg {
margin-top:3px;
margin-right:4px;
cursor:pointer;
float:right;
}
.absPropEditImg {
margin-top:2px;
margin-right:4px;
margin-left:4px;
cursor:pointer;
float:left;
}
.absSizerImg {
float:right;
cursor:se-resize;
}
.gadgetTitle {
overflow:hidden;
font-size:16px;
padding-top:2px;
white-space:nowrap;
}
dojo.declare("GadgetSite", null, {
constants : {
GADGET_CLASSNAMES: ['gadgetHeader', 'gadgetBody', 'gadgetTitle']
},
constructor: function(container, id, views) {
this.gadgetContainer = container;
this.widgetId = id;
this.views = views;
if (container) {
this.adopt(container);
}
if ( ! dijit.byId(id + "_propMenu") ) {
// Due to a bug in IE 6/7, we cannot call this method directly.
// This constructor is called from inline JavaScript and tries
// to manipulate the DOM of the containing element. On IE 6/7,
// this leads to a crash of the JS engine. In order to avoid
// that, we create the menu after the DOM has loaded.
dojo.addOnLoad(this, "createEditMenu");
}
},
/**
* create the edit menu for the widget attaching it to left click on
* the widget edit image in the widget header
*
*/
createEditMenu: function() {
dojo.require('dijit.Menu');
var targetImgNode = dojo.byId(this.widgetId+"_propMenuTarget");
if ( ! targetImgNode ) { // nothing to bind to...
return;
}
var widgetId = this.widgetId;
pMenu = new dijit.Menu(
{
targetNodeIds:[this.widgetId+"_propMenuTarget"],
id: this.widgetId + "_propMenu",
leftClickToOpen: true
});
pMenu.addChild(new dijit.MenuItem(
{
label: "Edit widget properties",
onClick: //dojo.hitch( window,
function(evt) {
mashupMaker.editGadget( widgetId );
}
//)
}));
pMenu.addChild(new dijit.MenuItem(
{
label: "Share widget",
onClick:
function(evt) {
mashupMaker.shareGadget( widgetId );
}
}));
// menu items for custom widget views go here
if ( typeof this.views == "object" ) {
var addedSeparator = false;
for ( var i = 0; i < this.views.length; i++ ) {
var viewName = this.views[i];
if ( viewName == 'default' ||
viewName == 'edit' ||
viewName == 'help' ) {
continue;
}
// Add an extra separator if there are any custom views
if ( ! addedSeparator ) {
pMenu.addChild(new dijit.MenuSeparator());
addedSeparator = true;
}
// Custom view names are QNames, which may consist of a
// prefix and a local part separated by a ':'. For the
// menu, we'll only display the local part.
var localPart = viewName.split(":").pop();
pMenu.addChild(new dijit.MenuItem(
{
label: localPart.charAt(0).toUpperCase() + localPart.substr(1),
onClick:
function(evt) {
var menuItem = dijit.getEnclosingWidget(evt.currentTarget);
mashupMaker.openGadgetView( widgetId, menuItem.fullQName );
},
fullQName: viewName
}));
}
}
pMenu.addChild(new dijit.MenuSeparator());
if ( this.views && dojo.indexOf(this.views, 'help') != -1 ) { // XXX this.views should exist; shouldn't need to check for it
pMenu.addChild(new dijit.MenuItem(
{
label: "Help",
onClick:
function(evt) {
mashupMaker.openGadgetView( widgetId, 'help' );
}
}));
} else {
pMenu.addChild(new dijit.MenuItem({label: "Help", disabled: true}));
}
pMenu.startup();
},
/**
* Return the body html element for this site. The body element actually contains the widget
*
* @return HTML Element
* @type {DOM}
*/
getBody: function() {
return(this.gadgetBody);
},
/**
* Return the containing html element for this site.
*
* @return HTML Element
* @type {DOM}
*/
getContainer: function() {
return(this.gadgetContainer);
},
/**
* Set the title of the gadget within the site.
*
* @param {String} title The title to be displayed
*/
setTitle : function(title) {
this._titleText = title;
var titleTarget = this.getTitleElement();
if (titleTarget) {
titleTarget.innerHTML = title;
}
},
/**
* Get the title of the gadget within the site.
*
* @return The title to be displayed
* @type {String}
*/
getTitle : function() {
var titleTarget = this.getTitleElement();
if (! this._titleText && titleTarget) {
this._titleText = titleTarget.innerHTML;
}
return(this._titleText);
},
getTitleElement : function() {
return(this.gadgetTitle);
},
/**
* @param {DOM} containerDOM The DOM element to adopt as the container
*/
adopt: function(containerDOM) {
if (containerDOM.tagName != 'TABLE' || containerDOM.className != 'gadgetContainer') {
return(false);
}
this.gadgetContainer = containerDOM;
dojo.forEach(this.constants.GADGET_CLASSNAMES,
dojo.hitch(this,
function(className) {
var gadgetPart = dojo.query('.' + className, containerDOM);
if (gadgetPart && gadgetPart.length) {
this[className] = gadgetPart[0];
}
})
);
},
getDimensions : function() {
var dimensions = {};
var style = dojo.getComputedStyle( this.gadgetBody );
dimensions.width = parseInt( style.width );
dimensions.height = parseInt( style.height );
return dimensions;
},
getPosition : function() {
var coords = dojo.coords( this.gadgetContainer );
return { x: coords.x, y: coords.y };
},
resize : function( width, height ) {
this.gadgetBody.style.width = width + "px";
this.gadgetBody.style.height = height + "px";
// XXX 'gadgetHeader' sizing should be done in theme specific file
if ( this.gadgetHeader ) {
this.gadgetHeader.style.width = dojo.coords( this.gadgetBody ).w + "px";
}
}
});
This diff is collapsed.
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright 2006-2008 OpenAjax Alliance
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<widget name="ColorPalette" id="http://openajax.org/samples/widgets/colorpalette"
spec="1.0" width="208" height="148"
xmlns="http://openajax.org/metadata">
<requires>
<library name="dojo" version="1.3" src="http://ajax.googleapis.com/ajax/libs/dojo/1.3/">
<preload>
djConfig = { isDebug: false, parseOnLoad: false, afterOnLoad: true };
</preload>
<require type="javascript" src="dojo/dojo.xd.js"/>
<require type="css" src="dojo/resources/dojo.css"/>
<require type="css" src="dijit/themes/dijit.css"/>
<require type="css" src="dijit/themes/dijit_rtl.css"/>
<require type="css" src="dijit/themes/tundra/ColorPalette.css"/>
</library>
</requires>
<properties>
<property name='color' datatype='String' defaultValue="#ffffff" sharedAs='color'/>
<!-- publish='true' -->
</properties>
<javascript location='afterContent'>
dojo.require("dijit.ColorPalette");
dojo.addOnLoad(function(){
new dijit.ColorPalette(
{ "class": "tundra",
onChange: function( color ) {
OpenAjax.widget.byId('__WID__').OpenAjax.setPropertyValue( 'color', color );
}
},
"__WID__palette"
);
});
</javascript>
<content>
<![CDATA[
<div class="tundra" style="background-color:#f5f5f5" >
<span ID='__WID__palette' dojoType="dijit.ColorPalette">
</span>
</div>
]]>
</content>
</widget>
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright 2006-2008 OpenAjax Alliance
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<widget name="DateListener" id="http://openajax.org/samples/widgets/DateListener"
spec="1.0" version='0.9' width="300" height="24" sandbox="true"
xmlns="http://openajax.org/metadata">
<description>This is a test widget that tests the UI representation of various parts of the OAA spec</description>
<properties>
<property name="date" datatype="Date" defaultValue="" sharedAs="date"></property>
<!--
<property name="subscribedDate" datatype="Date" defaultValue="" readonly="false" sharedAs="date">
// subscribe="true"
<description>last date published by another gadget</description>
</property>
<property name="publishedDate" datatype="String" defaultValue="" readonly="false" hidden="false" sharedAs="datestring">
// publish="true"
<description>when this value is changed, this date will be published to other gadgets</description>
</property>
<property name="hiddenDate" datatype="String" defaultValue="" readonly="false" hidden="true" sharedAs="datestring">
// publish="true"
<description>when this value is changed, this date will be published to other gadgets</description>
</property>
-->
</properties>
<content>
<![CDATA[
<script>
var w__WID__ = OpenAjax.widget.byId("__WID__");
w__WID__.onLoad = function() {
document.getElementById("__WID__date").value = this.OpenAjax.getPropertyValue( "date" );
};
w__WID__.handleClick = function() {
// alert("click!");
};
w__WID__.handleChange = function() {
this.OpenAjax.setPropertyValue( "date", document.getElementById("__WID__date").value );
};
w__WID__.onChangeDate = function( event ) {
document.getElementById("__WID__date").value = event.newValue;
};
</script>
<label id="__WID__date_label" for="__WID__date" style="border: 1px solid red;">date last broadcast: </label>
<input id="__WID__date" name="__WID__date" onclick="OpenAjax.widget.byId('__WID__').handleClick();" onChange="OpenAjax.widget.byId('__WID__').handleChange();"/>
]]>
</content>
</widget>
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<!--
Copyright 2009 OpenAjax Alliance
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>widget</title>
<script src="loader.js"></script>
<script>
(function() {
var scriptsLoaded = false,
windowLoaded = false;
function onWindowLoad( event ) {
windowLoaded = true;
loadWidget();
}
function onScriptsLoad( success, error ) {
// XXX handle error (success == false)
scriptsLoaded = true;
loadWidget();
}
function loadWidget() {
if ( scriptsLoaded && windowLoaded ) {
OpenAjax.widget._createRemoteWidget( document.getElementById("oaa_widget") );
}
}
function queryURLParam( param ) {
var result = new RegExp( "[\\?&]" + param + "=([^&#]*)" ).exec( window.location.search );
if ( result ) {
return decodeURIComponent( result[1].replace( /\+/g, "%20" ) );
}
return null;
}
window.onload = onWindowLoad;
var head = document.getElementsByTagName('HEAD').item(0);
var base = document.createElement( "base" );
base.setAttribute( "href", queryURLParam( "oawb" ) );
head.appendChild( base );
// load OpenAjax Hub files
var scripts;
var oaaHubJS = queryURLParam( "oawh" );
var m = oaaHubJS.match( /openajax(?:ManagedHub-.+|-mashup)\.js$/i );
if ( m ) {
var hubRoot = oaaHubJS.substring( 0, m.index );
var baseName = oaaHubJS.substring( m.index );
switch ( baseName.toLowerCase() ) {
case "openajaxmanagedhub-all.js":
scripts = [ { src: hubRoot + "OpenAjaxManagedHub-all.js" } ];
break;
case "openajaxmanagedhub-core.js":
scripts = [ { src: hubRoot + "OpenAjaxManagedHub-core.js" },
{ src: hubRoot + "json2.js" },
{ src: hubRoot + "crypto.js" },
{ src: hubRoot + "iframe.js" },
{ src: hubRoot + "FIM.js" } ];
break;
case "openajaxmanagedhub-std.js":
scripts = [ { src: hubRoot + "OpenAjaxManagedHub-std.js" },
{ src: hubRoot + "FIM.js" } ];
break;
case "openajax-mashup.js":
scripts = [ { src: hubRoot + "OpenAjax-mashup.js" },
{ src: hubRoot + "containers/iframe/json2.js" },
{ src: hubRoot + "containers/iframe/crypto.js" },
{ src: hubRoot + "containers/iframe/iframe.js" },
{ src: hubRoot + "containers/iframe/FIM.js" } ];
break;
}
}
// load "loader.js" -- assume it is a sibling of this file
scripts.push( { src: /(.+:\/\/.+\/)/.exec( window.location.href )[1] + "loader.js" } );
__openajax_widget__._loadScripts( scripts, false, onScriptsLoad );
})();
</script>
<style>
body {
margin: 0;
}
</style>
</head>
<body>
<div id="oaa_widget"></div>
</body>
</html>
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
/*
Copyright 2006-2009 OpenAjax Alliance
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// SMASH.CRYPTO
//
// Small library containing some minimal crypto functionality for a
// - a hash-function: SHA-1 (see FIPS PUB 180-2 for definition)
// BigEndianWord[5] <- smash.crypto.sha1( BigEndianWord[*] dataWA, int lenInBits)
//
// - a message authentication code (MAC): HMAC-SHA-1 (RFC2104/2202)
// BigEndianWord[5] <- smash.crypto.hmac_sha1(
// BigEndianWord[3-16] keyWA,
// Ascii or Unicode string dataS,
// int chrsz (8 for Asci/16 for Unicode)
//
// - pseudo-random number generator (PRNG): HMAC-SHA-1 in counter mode, following
// Barak & Halevi, An architecture for robust pseudo-random generation and applications to /dev/random, CCS 2005
// rngObj <- smash.crypto.newPRNG( String[>=12] seedS)
// where rngObj has methods
// addSeed(String seed)
// BigEndianWord[len] <- nextRandomOctets(int len)
// Base64-String[len] <- nextRandomB64Str(int len)
// Note: HMAC-SHA1 in counter-mode does not provide forward-security on corruption.
// However, the PRNG state is kept inside a closure. So if somebody can break the closure, he probably could
// break a whole lot more and forward-security of the prng is not the highest of concerns anymore :-)
if ( typeof OpenAjax._smash == 'undefined' ) { OpenAjax._smash = {}; }
OpenAjax._smash.crypto = {
// Some utilities
// convert a string to an array of big-endian words
'strToWA': function (/* Ascii or Unicode string */ str, /* int 8 for Asci/16 for Unicode */ chrsz){
var bin = Array();
var mask = (1 << chrsz) - 1;
for(var i = 0; i < str.length * chrsz; i += chrsz)
bin[i>>5] |= (str.charCodeAt(i / chrsz) & mask) << (32 - chrsz - i%32);
return bin;
},
// MAC
'hmac_sha1' : function(
/* BigEndianWord[3-16]*/ keyWA,
/* Ascii or Unicode string */ dataS,
/* int 8 for Asci/16 for Unicode */ chrsz)
{
// write our own hmac derived from paj's so we do not have to do constant key conversions and length checking ...
var ipad = Array(16), opad = Array(16);
for(var i = 0; i < 16; i++) {
ipad[i] = keyWA[i] ^ 0x36363636;
opad[i] = keyWA[i] ^ 0x5C5C5C5C;
}
var hash = this.sha1( ipad.concat(this.strToWA(dataS, chrsz)), 512 + dataS.length * chrsz);
return this.sha1( opad.concat(hash), 512 + 160);
},
// PRNG factory method
// see below 'addSeed', 'nextRandomOctets' & 'nextRandomB64Octets' for public methods of returnd prng object
'newPRNG' : function (/* String[>=12] */ seedS) {
that = this;
// parameter checking
// We cannot really verify entropy but obviously the string must have at least a minimal length to have enough entropy
// However, a 2^80 security seems ok, so we check only that at least 12 chars assuming somewhat random ASCII
if ( (typeof seedS != 'string') || (seedS.length < 12) ) {
alert("WARNING: Seed length too short ...");
}
// constants
var __refresh_keyWA = [ 0xA999, 0x3E36, 0x4706, 0x816A,
0x2571, 0x7850, 0xC26C, 0x9CD0,
0xBA3E, 0xD89D, 0x1233, 0x9525,
0xff3C, 0x1A83, 0xD491, 0xFF15 ]; // some random key for refresh ...
// internal state
var _keyWA = []; // BigEndianWord[5]
var _cnt = 0; // int
function extract(seedS) {
return that.hmac_sha1(__refresh_keyWA, seedS, 8);
}
function refresh(seedS) {
// HMAC-SHA1 is not ideal, Rijndal 256bit block/key in CBC mode with fixed key might be better
// but to limit the primitives and given that we anyway have only limited entropy in practise
// this seems good enough
var uniformSeedWA = extract(seedS);
for(var i = 0; i < 5; i++) {
_keyWA[i] ^= uniformSeedWA[i];
}
}
// inital state seeding
refresh(seedS);
// public methods
return {
// Mix some additional seed into the PRNG state
'addSeed' : function (/* String */ seed) {
// no parameter checking. Any added entropy should be fine ...
refresh(seed);
},
// Get an array of len random octets
'nextRandomOctets' : /* BigEndianWord[len] <- */ function (/* int */ len) {
var randOctets = [];
while (len > 0) {
_cnt+=1;
var nextBlock = that.hmac_sha1(_keyWA, (_cnt).toString(16), 8);
for (i=0; (i < 20) & (len > 0); i++, len--) {
randOctets.push( (nextBlock[i>>2] >> (i % 4) ) % 256);
}
// Note: if len was not a multiple 20, some random octets are ignored here but who cares ..
}
return randOctets;
},
// Get a random string of Base64-like (see below) chars of length len
// Note: there is a slightly non-standard Base64 with no padding and '-' and '_' for '+' and '/', respectively
'nextRandomB64Str' : /* Base64-String <- */ function (/* int */ len) {
var b64StrMap = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_";
var randOctets = this.nextRandomOctets(len);
var randB64Str = '';
for (var i=0; i < len; i++) {
randB64Str += b64StrMap.charAt(randOctets[i] & 0x3F);
}
return randB64Str;
}
}
},
// Digest function:
// BigEndianWord[5] <- sha1( BigEndianWord[*] dataWA, int lenInBits)
'sha1' : function(){
// Note: all Section references below refer to FIPS 180-2.
// private utility functions
// - 32bit addition with wrap-around
var add_wa = function (x, y){
var lsw = (x & 0xFFFF) + (y & 0xFFFF);
var msw = (x >> 16) + (y >> 16) + (lsw >> 16);
return (msw << 16) | (lsw & 0xFFFF);
}
// - 32bit rotatate left
var rol = function(num, cnt) {
return (num << cnt) | (num >>> (32 - cnt));
}
// - round-dependent function f_t from Section 4.1.1
function sha1_ft(t, b, c, d) {
if(t < 20) return (b & c) | ((~b) & d);
if(t < 40) return b ^ c ^ d;
if(t < 60) return (b & c) | (b & d) | (c & d);
return b ^ c ^ d;
}
// - round-dependent SHA-1 constants from Section 4.2.1
function sha1_kt(t) {
return (t < 20) ? 1518500249 :
(t < 40) ? 1859775393 :
(t < 60) ? -1894007588 :
/* (t < 80) */ -899497514 ;
}
// main algorithm.
return function( /* BigEndianWord[*] */ dataWA, /* int */ lenInBits) {
// Section 6.1.1: Preprocessing
//-----------------------------
// 1. padding: (see also Section 5.1.1)
// - append one 1 followed by 0 bits filling up 448 bits of last (512bit) block
dataWA[lenInBits >> 5] |= 0x80 << (24 - lenInBits % 32);
// - encode length in bits in last 64 bits
// Note: we rely on javascript to zero file elements which are beyond last (partial) data-block
// but before this length encoding!
dataWA[((lenInBits + 64 >> 9) << 4) + 15] = lenInBits;
// 2. 512bit blocks (actual split done ondemand later)
var W = Array(80);
// 3. initial hash using SHA-1 constants on page 13
var H0 = 1732584193;
var H1 = -271733879;
var H2 = -1732584194;
var H3 = 271733878;
var H4 = -1009589776;
// 6.1.2 SHA-1 Hash Computation
for(var i = 0; i < dataWA.length; i += 16) {
// 1. Message schedule, done below
// 2. init working variables
var a = H0; var b = H1; var c = H2; var d = H3; var e = H4;
// 3. round-functions
for(var j = 0; j < 80; j++)
{
// postponed step 2
W[j] = ( (j < 16) ? dataWA[i+j] : rol(W[j-3] ^ W[j-8] ^ W[j-14] ^ W[j-16], 1));
var T = add_wa( add_wa( rol(a, 5), sha1_ft(j, b, c, d)),
add_wa( add_wa(e, W[j]), sha1_kt(j)) );
e = d;
d = c;
c = rol(b, 30);
b = a;
a = T;
}
// 4. intermediate hash
H0 = add_wa(a, H0);
H1 = add_wa(b, H1);
H2 = add_wa(c, H2);
H3 = add_wa(d, H3);
H4 = add_wa(e, H4);
}
return Array(H0, H1, H2, H3, H4);
}
}()
};
This diff is collapsed.
This diff is collapsed.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!--
Copyright 2006-2009 OpenAjax Alliance
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Hub Tunnel</title>
<script src="iframe.js"></script><script src="FIM.js"></script>
<script type="text/javascript">
function init()
{
if ( window.postMessage ) {
var internalID = OpenAjax.hub.IframePMHubClient.queryURLParam( "oahj" );
var origin = OpenAjax.hub.IframePMHubClient.queryURLParam( "oaho" );
var securityToken = OpenAjax.hub.IframePMHubClient.queryURLParam( "oaht" );
window.parent.parent.OpenAjax.hub.IframePMContainer._pmListener
.connectFromTunnel( internalID, origin, securityToken, window );
} else {
var commLib = new smash.CommLib( false,
window.parent.parent.smash.SEComm.instances );
}
}
</script>
</head>
<body onload="init();"></body>
</html>
This diff is collapsed.
[buildout]
extensions = mr.developer
auto-checkout = xinha
auto-checkout = dojo xinha
parts = jsquery jsquery-ui
sources-dir =
[sources]
xinha = svn http://svn.xinha.org/tags/0.96.1 path=UNGProject egg=false
dojo = svn http://svn.dojotoolkit.org/src/branches/1.6/ path=UNGProject egg=false
[jsquery]
recipe = hexagonit.recipe.download
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment