1) Zend Platform offers a (pretty decent) java bridge .. so use that to import the jar & call the caja functions 2) We command-line caja ... and wait 10 seconds for each caja request while java starts up ... ok maybe not a good option 3) Google hosts a caja service, we post the content to it and echo's the cajoled version back ... ok also bad for performance but if cached it might just work (for smaller sns's)
oh and there's always option 4, port caja to php, volunteers are welcome :-)
Don't worry it'll take a bit before caja is production ready (from what i heard), we got some time left to brainstorm still
-- Chris
On Jul 17, 2008, at 10:19 PM, Cassie wrote:
Oh, right, I see now.Yeah - the caja feature isn't included by default to make sure it doesn't break you guys at all. I'm not sure how php is going to get caja support but when we figure it out then we will probably know how to get the js filesoutside of a jar format... (i hope at least) Don't worry though... finishing rest will come first :) - CassieOn Thu, Jul 17, 2008 at 1:13 PM, Chris Chabot <[EMAIL PROTECTED]> wrote:the res:// is something that works with jars, pots and kettles and coffeebeans i think ? Well i overheard something like that the other nighti.a.w: it's a java / jar resource locator, for now thats fine since php doesn't do caja jar's either and caja is only available in jar format :)-- Chris On Jul 17, 2008, at 10:09 PM, Ropu wrote: just did a fast readingand, if not mistaken, in the PHP version at least, if the require featureinthe features.xml is an "absolute" path (at least http://*) we includedliteraly in the iframe. if not, is inlined.so i thought that that may be a references to an internal goog repositorythat uses domita.js.. but maybe res:// in the java version has an other functionality. just a warning ropu On Thu, Jul 17, 2008 at 4:55 PM, Cassie <[EMAIL PROTECTED]> wrote: hey ropu - thanks for reading the change!i don't think i quite understand your comment though - what did you seewhat wrong? - cassie On Thu, Jul 17, 2008 at 12:52 PM, Ropu <[EMAIL PROTECTED]> wrote: hi cassieis this line OK? +++ incubator/shindig/trunk/features/caja/feature.xml Thu Jul 17 12:37:30 2008 + <script src="res:///com/google/caja/plugin/domita-minified.js"></script> ropu On Thu, Jul 17, 2008 at 4:37 PM, <[EMAIL PROTECTED]> wrote: Author: dollDate: Thu Jul 17 12:37:30 2008 New Revision: 677699 URL: http://svn.apache.org/viewvc?rev=677699&view=rev Log: SHINDIG-436Patch from Mike Samuel. The caja js is now pulled directly from thecajamaven repo. The java integration has been updated and the cajaintegrationnow works.If you uncomment the caja dependency in opensocial-current/ feature.xmlandtoggle the "use caja" box in the sample container you should be able toseeincubator/shindig/trunk/java/gadgets/src/main/java/org/apache/ shindig/gadgets/servlet/CajaContentFilter.javathis work on the java side. Removed: incubator/shindig/trunk/features/caja/caja.js incubator/shindig/trunk/features/caja/domita.js incubator/shindig/trunk/features/caja/html-sanitizer.js incubator/shindig/trunk/features/caja/html4-defs.js incubator/shindig/trunk/features/caja/log-to-console.js incubator/shindig/trunk/features/caja/permissive.js incubator/shindig/trunk/features/caja/unicode.js Modified: incubator/shindig/trunk/features/caja/feature.xml incubator/shindig/trunk/features/opensocial-current/feature.xmlincubator/shindig/trunk/features/opensocial-reference/ container.jsincubator/shindig/trunk/features/pom.xml incubator/shindig/trunk/java/gadgets/pom.xmlincubator/shindig/trunk/javascript/samplecontainer/ samplecontainer.htmlincubator/shindig/trunk/pom.xml Modified: incubator/shindig/trunk/features/caja/feature.xml URL:http://svn.apache.org/viewvc/incubator/shindig/trunk/features/caja/feature.xml?rev=677699&r1=677698&r2=677699&view=diff= = = = = = = = = = = = ==================================================================--- incubator/shindig/trunk/features/caja/feature.xml (original)+++ incubator/shindig/trunk/features/caja/feature.xml Thu Jul 1712:37:302008@@ -16,18 +16,11 @@ KIND, either express or implied. See the License for the specific language governing permissions and limitations under theLicense.- TODO(doll): The caja.js file referenced here should come from maven- or something. We should not have our own copy of it. +The javascript referenced here should be found in the caja jar. --> <feature> <name>caja</name> <gadget> - <script src="caja.js"></script> - <script src="html4-defs.js"></script> - <script src="html-sanitizer.js"></script> - <script src="unicode.js"></script> - <script src="domita.js"></script> - <script src="log-to-console.js"></script> - <script src="permissive.js"></script> + <script src="res:///com/google/caja/plugin/domita-minified.js"></script> </gadget> </feature> Modified:incubator/shindig/trunk/features/opensocial-current/feature.xmlURL:http://svn.apache.org/viewvc/incubator/shindig/trunk/features/opensocial-current/feature.xml?rev=677699&r1=677698&r2=677699&view=diff= = = = = = = = = = = = ==================================================================--- incubator/shindig/trunk/features/opensocial-current/ feature.xml(original)+++ incubator/shindig/trunk/features/opensocial-current/ feature.xml ThuJul17 12:37:30 2008 @@ -20,6 +20,9 @@ <feature> <name>opensocial-0.8</name> <dependency>opensocial-reference</dependency> + <!-- <dependency>caja</dependency> -->+ <!-- Must include the "caja" feature to display samplecontainer -->+ <!-- gadgets when "use caja" is checked --> <gadget> <script src="jsonperson.js"></script> <script src="jsonactivity.js"></script> @@ -57,7 +60,7 @@opensocial.Container.setContainer(new ShindigContainer());} - if (configParams.enableCaja) { + if (window['caja']) { opensocial.Container.get().enableCaja(); } }); Modified:incubator/shindig/trunk/features/opensocial-reference/ container.jsURL:http://svn.apache.org/viewvc/incubator/shindig/trunk/features/opensocial-reference/container.js?rev=677699&r1=677698&r2=677699&view=diff= = = = = = = = = = = = ==================================================================--- incubator/shindig/trunk/features/opensocial-reference/ container.js(original)+++ incubator/shindig/trunk/features/opensocial-reference/ container.jsThuJul 17 12:37:30 2008 @@ -514,6 +514,9 @@ // By default, only allow references to anchors. if (/^#/.test(uri)) { return '#' + encodeURIComponent(decodeURIComponent(uri.substring(1))); + // and files on the same host + } else if (/^\/(?:[^\/][^?#]*)?$/) { + return encodeURI(decodeURI(uri)); } // This callback can be replaced with one that passes the URLthrough// a proxy that checks the mimetype.@@ -535,77 +538,548 @@ caja = window["caja"]; attachDocumentStub = window["attachDocumentStub"]; - var outers = caja.copy(___.sharedOuters); + var imports = caja.copy(___.sharedImports); + ___.getNewModuleHandler().setImports(imports);- // TODO(doll): We need to add caja allows for the gadgets namespacesothat- // this works properly. It does not belong in gadgets. - var igOnload = window["_IG_RegisterOnloadHandler"]; - if (igOnload) { - outers._IG_RegisterOnloadHandler = ___.simpleFunc(igOnload); + attachDocumentStub('-g___', uriCallback, imports); + var gadgetRoot = document.createElement('div'); + gadgetRoot.className = 'g___'; + imports.htmlEmitter___ = new HtmlEmitter(gadgetRoot); + document.body.appendChild(gadgetRoot); ++ // Add the opensocial APIs and mark them callable and readable.+ imports.gadgets = gadgets; + imports.opensocial = opensocial; + // The below described the opensocial reference APIs.+ // A prefix of "c_" specifies a class, "m_" a method, "f_" a field,+ // and "s_" a static member. + // Derived from http://code.google.com/apis/opensocial/docs/0.8/reference/ . + var opensocialSchema = { + c_gadgets: { + c_MiniMessage: { + m_createDismissibleMessage: 0, + m_createStaticMessage: 0, + m_createTimerMessage: 0, + m_dismissMessage: 0 + }, + c_Prefs: { + m_getArray: 0, + m_getBool: 0, + m_getCountry: 0, + m_getFloat: 0, + m_getInt: 0, + m_getLang: 0, + m_getMsg: 0, + m_getString: 0, + m_set: 0, + m_setArray: 0 + }, + c_Tab: { + m_getCallback: 0, + m_getContentContainer: 0, + m_getIndex: 0, + m_getName: 0, + m_getNameContainer: 0 + }, + c_TabSet: { + m_addTab: 0, + m_alignTabs: 0, + m_displayTabs: 0, + m_getHeaderContainer: 0, + m_getSelectedTab: 0, + m_getTabs: 0, + m_removeTab: 0, + m_setSelectedTab: 0, + m_swapTabs: 0 + }, + c_flash: { + s_embedCachedFlash: 0, + s_embedFlash: 0, + s_getMajorVersion: 0 + }, + c_io: { + c_AuthorizationType: { + s_NONE: 0, + s_OAUTH: 0, + s_SIGNED: 0 + }, + c_ContentType: { + s_DOM: 0, + s_FEED: 0, + s_JSON: 0, + s_TEXT: 0 + }, + c_MethodType: { + s_DELETE: 0, + s_GET: 0, + s_HEAD: 0, + s_POST: 0, + s_PUT: 0 + }, + c_ProxyUrlRequestParameters: { + s_REFRESH_INTERVAL: 0 + }, + c_RequestParameters: { + s_AUTHORIZATION: 0, + s_CONTENT_TYPE: 0, + s_GET_SUMMARIES: 0, + s_HEADERS: 0, + s_METHOD: 0, + s_NUM_ENTRIES: 0, + s_POST_DATA: 0 + }, + s_encodeValues: 0, + s_getProxyUrl: 0, + s_makeRequest: 0 + }, + c_json: { + s_parse: 0, + s_stringify: 0 + }, + c_pubsub: { + s_publish: 0, + s_subscribe: 0, + s_unsubscribe: 0 + }, + c_rpc: { + s_call: 0, + s_register: 0, + s_registerDefault: 0, + s_unregister: 0, + s_unregisterDefault: 0 + }, + c_skins: { + c_Property: { + s_ANCHOR_COLOR: 0, + s_BG_COLOR: 0, + s_BG_IMAGE: 0, + s_FONT_COLOR: 0 + }, + s_getProperty: 0 + }, + c_util: { + s_escapeString: 0, + s_getFeatureParameters: 0, + s_hasFeature: 0, + s_registerOnLoadHandler: 0, + s_unescapeString: 0 + }, + c_views: { + c_View: { + m_bind: 0, + m_getUrlTemplate: 0, + m_isOnlyVisibleGadget: 0 + }, + c_ViewType: { + s_CANVAS: 0, + s_HOME: 0, + s_PREVIEW: 0, + s_PROFILE: 0 + }, + s_bind: 0, + s_getCurrentView: 0, + s_getParams: 0, + s_requestNavigateTo: 0 + }, + c_window: { + s_adjustHeight: 0, + s_getViewportDimensions: 0, + s_setTitle: 0 + } + }, + c_opensocial: { + c_Activity: { + c_Field: { + s_APP_ID: 0, + s_BODY: 0, + s_BODY_ID: 0, + s_EXTERNAL_ID: 0, + s_ID: 0, + s_MEDIA_ITEMS: 0, + s_POSTED_TIME: 0, + s_PRIORITY: 0, + s_STREAM_FAVICON_URL: 0, + s_STREAM_SOURCE_URL: 0, + s_STREAM_TITLE: 0, + s_STREAM_URL: 0, + s_TEMPLATE_PARAMS: 0, + s_TITLE: 0, + s_TITLE_ID: 0, + s_URL: 0, + s_USER_ID: 0 + }, + m_getField: 0, + m_getId: 0, + m_setField: 0 + }, + c_Address: { + c_Field: { + s_COUNTRY: 0, + s_EXTENDED_ADDRESS: 0, + s_LATITUDE: 0, + s_LOCALITY: 0, + s_LONGITUDE: 0, + s_POSTAL_CODE: 0, + s_PO_BOX: 0, + s_REGION: 0, + s_STREET_ADDRESS: 0, + s_TYPE: 0, + s_UNSTRUCTURED_ADDRESS: 0 + }, + m_getField: 0 + }, + c_BodyType: { + c_Field: { + s_BUILD: 0, + s_EYE_COLOR: 0, + s_HAIR_COLOR: 0, + s_HEIGHT: 0, + s_WEIGHT: 0 + }, + m_getField: 0 + }, + c_Collection: { + m_asArray: 0, + m_each: 0, + m_getById: 0, + m_getOffset: 0, + m_getTotalSize: 0, + m_size: 0 + }, + c_CreateActivityPriority: { + s_HIGH: 0, + s_LOW: 0 + }, + c_DataRequest: { + c_DataRequestFields: { + s_ESCAPE_TYPE: 0 + }, + c_FilterType: { + s_ALL: 0, + s_HAS_APP: 0, + s_TOP_FRIENDS: 0 + }, + c_PeopleRequestFields: { + s_FILTER: 0, + s_FILTER_OPTIONS: 0, + s_FIRST: 0, + s_MAX: 0, + s_PROFILE_DETAILS: 0, + s_SORT_ORDER: 0 + }, + c_SortOrder: { + s_NAME: 0, + s_TOP_FRIENDS: 0 + }, + m_add: 0, + m_newFetchActivitiesRequest: 0, + m_newFetchPeopleRequest: 0, + m_newFetchPersonAppDataRequest: 0, + m_newFetchPersonRequest: 0, + m_newRemovePersonAppDataRequest: 0, + m_newUpdatePersonAppDataRequest: 0, + m_send: 0 + }, + c_DataResponse: { + m_get: 0, + m_getErrorMessage: 0, + m_hadError: 0 + }, + c_Email: { + c_Field: { + s_ADDRESS: 0, + s_TYPE: 0 + }, + m_getField: 0 + }, + c_Enum: { + c_Drinker: { + s_HEAVILY: 0, + s_NO: 0, + s_OCCASIONALLY: 0, + s_QUIT: 0, + s_QUITTING: 0, + s_REGULARLY: 0, + s_SOCIALLY: 0, + s_YES: 0 + }, + c_Gender: { + s_FEMALE: 0, + s_MALE: 0 + }, + c_LookingFor: { + s_ACTIVITY_PARTNERS: 0, + s_DATING: 0, + s_FRIENDS: 0, + s_NETWORKING: 0, + s_RANDOM: 0, + s_RELATIONSHIP: 0 + }, + c_Presence: { + s_AWAY: 0, + s_CHAT: 0, + s_DND: 0, + s_OFFLINE: 0, + s_ONLINE: 0, + s_XA: 0 + }, + c_Smoker: { + s_HEAVILY: 0, + s_NO: 0, + s_OCCASIONALLY: 0, + s_QUIT: 0, + s_QUITTING: 0, + s_REGULARLY: 0, + s_SOCIALLY: 0, + s_YES: 0 + }, + m_getDisplayValue: 0, + m_getKey: 0 + }, + c_Environment: { + c_ObjectType: { + s_ACTIVITY: 0, + s_ACTIVITY_MEDIA_ITEM: 0, + s_ADDRESS: 0, + s_BODY_TYPE: 0, + s_EMAIL: 0, + s_FILTER_TYPE: 0, + s_MESSAGE: 0, + s_MESSAGE_TYPE: 0, + s_NAME: 0, + s_ORGANIZATION: 0, + s_PERSON: 0, + s_PHONE: 0, + s_SORT_ORDER: 0, + s_URL: 0 + }, + m_getDomain: 0, + m_supportsField: 0 + }, + c_EscapeType: { + s_HTML_ESCAPE: 0, + s_NONE: 0 + }, + c_IdSpec: { + c_Field: { + s_GROUP_ID: 0, + s_NETWORK_DISTANCE: 0, + s_USER_ID: 0 + }, + c_PersonId: { + s_OWNER: 0, + s_VIEWER: 0 + }, + m_getField: 0, + m_setField: 0 + }, + c_MediaItem: { + c_Field: { + s_MIME_TYPE: 0, + s_TYPE: 0, + s_URL: 0 + }, + c_Type: { + s_AUDIO: 0, + s_IMAGE: 0, + s_VIDEO: 0 + }, + m_getField: 0, + m_setField: 0 + }, + c_Message: { + c_Field: { + s_BODY: 0, + s_BODY_ID: 0, + s_TITLE: 0, + s_TITLE_ID: 0, + s_TYPE: 0 + }, + c_Type: { + s_EMAIL: 0, + s_NOTIFICATION: 0, + s_PRIVATE_MESSAGE: 0, + s_PUBLIC_MESSAGE: 0 + }, + m_getField: 0, + m_setField: 0 + }, + c_Name: { + c_Field: { + s_ADDITIONAL_NAME: 0, + s_FAMILY_NAME: 0, + s_GIVEN_NAME: 0, + s_HONORIFIC_PREFIX: 0, + s_HONORIFIC_SUFFIX: 0, + s_UNSTRUCTURED: 0 + }, + m_getField: 0 + }, + c_NavigationParameters: { + c_DestinationType: { + s_RECIPIENT_DESTINATION: 0, + s_VIEWER_DESTINATION: 0 + }, + c_Field: { + s_OWNER: 0, + s_PARAMETERS: 0, + s_VIEW: 0 + }, + m_getField: 0, + m_setField: 0 + }, + c_Organization: { + c_Field: { + s_ADDRESS: 0, + s_DESCRIPTION: 0, + s_END_DATE: 0, + s_FIELD: 0, + s_NAME: 0, + s_SALARY: 0, + s_START_DATE: 0, + s_SUB_FIELD: 0, + s_TITLE: 0, + s_WEBPAGE: 0 + }, + m_getField: 0 + }, + c_Permission: { + s_VIEWER: 0 + }, + c_Person: { + c_Field: { + s_ABOUT_ME: 0, + s_ACTIVITIES: 0, + s_ADDRESSES: 0, + s_AGE: 0, + s_BODY_TYPE: 0, + s_BOOKS: 0, + s_CARS: 0, + s_CHILDREN: 0, + s_CURRENT_LOCATION: 0, + s_DATE_OF_BIRTH: 0, + s_DRINKER: 0, + s_EMAILS: 0, + s_ETHNICITY: 0, + s_FASHION: 0, + s_FOOD: 0, + s_GENDER: 0, + s_HAPPIEST_WHEN: 0, + s_HAS_APP: 0, + s_HEROES: 0, + s_HUMOR: 0, + s_ID: 0, + s_INTERESTS: 0, + s_JOBS: 0, + s_JOB_INTERESTS: 0, + s_LANGUAGES_SPOKEN: 0, + s_LIVING_ARRANGEMENT: 0, + s_LOOKING_FOR: 0, + s_MOVIES: 0, + s_MUSIC: 0, + s_NAME: 0, + s_NETWORK_PRESENCE: 0, + s_NICKNAME: 0, + s_PETS: 0, + s_PHONE_NUMBERS: 0, + s_POLITICAL_VIEWS: 0, + s_PROFILE_SONG: 0, + s_PROFILE_URL: 0, + s_PROFILE_VIDEO: 0, + s_QUOTES: 0, + s_RELATIONSHIP_STATUS: 0, + s_RELIGION: 0, + s_ROMANCE: 0, + s_SCARED_OF: 0, + s_SCHOOLS: 0, + s_SEXUAL_ORIENTATION: 0, + s_SMOKER: 0, + s_SPORTS: 0, + s_STATUS: 0, + s_TAGS: 0, + s_THUMBNAIL_URL: 0, + s_TIME_ZONE: 0, + s_TURN_OFFS: 0, + s_TURN_ONS: 0, + s_TV_SHOWS: 0, + s_URLS: 0 + }, + m_getDisplayName: 0, + m_getField: 0, + m_getId: 0, + m_isOwner: 0, + m_isViewer: 0 + }, + c_Phone: { + c_Field: { + s_NUMBER: 0, + s_TYPE: 0 + }, + m_getField: 0 + }, + c_ResponseItem: { + c_Error: { + s_BAD_REQUEST: 0, + s_FORBIDDEN: 0, + s_INTERNAL_ERROR: 0, + s_LIMIT_EXCEEDED: 0, + s_NOT_IMPLEMENTED: 0, + s_UNAUTHORIZED: 0 + }, + m_getData: 0, + m_getErrorCode: 0, + m_getErrorMessage: 0, + m_getOriginalDataRequest: 0, + m_hadError: 0 + }, + c_Url: { + c_Field: { + s_ADDRESS: 0, + s_LINK_TEXT: 0, + s_TYPE: 0 + }, + m_getField: 0 + }, + s_getEnvironment: 0, + s_hasPermission: 0, + s_newActivity: 0, + s_newDataRequest: 0, + s_newMediaItem: 0, + s_newMessage: 0, + s_newNavigationParameters: 0, + s_requestCreateActivity: 0, + s_requestPermission: 0, + s_requestSendMessage: 0, + s_requestShareApp: 0 + } + }; + function whitelist(schema, obj) { + if (!obj) { return; } // Occurs for optional features + for (var k in schema) { + if (schema.hasOwnProperty(k)) { + var m = k.match(/^([mcs])_(\w+)$/); + var type = m[1], name = m[2]; + switch (type) { + case 'c': + ___.allowRead(obj, name); + whitelist(schema[k], obj[name]); + break; + case 'm': + ___.allowCall(obj.prototype, name); + break; + case 'f': + ___.allowRead(obj.prototype, name); + break; + case 's': + if ('function' === typeof obj[name]) { + ___.allowCall(obj, name); + } else { + ___.allowRead(obj, name); + } + break; + } + } + } } - - attachDocumentStub('pre-', uriCallback, outers); -- // Temporarily adding some gadgets calls to the opensocial code.- // This should move into the gadgets js code very soon. - outers.gadgets = gadgets; -- // Adding all of the available opensocial calls as defined in thespec- outers.opensocial = opensocial;- ___.all2( - ___.allowCall, outers.opensocial, - ['requestSendMessage', 'requestShareApp','requestCreateActivity',- 'hasPermission', 'requestPermission', 'getEnvironment','newDataRequest', - 'newActivity', 'newActivityMediaItem', 'newMessage']); - - ___.all2( - ___.allowCall, opensocial.Collection.prototype, - ['getById', 'size', 'each', 'asArray', 'getTotalSize', 'getOffset']); - - ___.all2( - ___.allowCall, opensocial.Person.prototype,- ['getId', 'getDisplayName', 'getField', 'isViewer', 'isOwner']);- - ___.allowCall(opensocial.Address.prototype, 'getField'); - ___.allowCall(opensocial.BodyType.prototype, 'getField'); - ___.allowCall(opensocial.Email.prototype, 'getField'); - ___.allowCall(opensocial.Name.prototype, 'getField'); - ___.allowCall(opensocial.Organization.prototype, 'getField'); - ___.allowCall(opensocial.Phone.prototype, 'getField'); - ___.allowCall(opensocial.Url.prototype, 'getField'); - - ___.allowCall(opensocial.Activity.prototype, 'getId'); - ___.allowCall(opensocial.Activity.prototype, 'getField'); - - ___.allowCall(opensocial.MediaItem.prototype, 'getField'); - - ___.allowCall(opensocial.ResponseItem.prototype, 'hadError'); - ___.allowCall(opensocial.ResponseItem.prototype, 'getError'); - ___.allowCall(opensocial.ResponseItem.prototype, 'getOriginalDataRequest'); - ___.allowCall(opensocial.ResponseItem.prototype, 'getData'); - - ___.allowCall(opensocial.DataResponse.prototype, 'hadError'); - ___.allowCall(opensocial.DataResponse.prototype, 'get'); - - ___.all2( - ___.allowCall, opensocial.DataRequest.prototype,- ['getRequestObjects', 'add', 'send', 'newFetchPersonRequest',- 'newFetchPeopleRequest', 'newFetchPersonAppDataRequest',- 'newUpdatePersonAppDataRequest', 'newFetchActivitiesRequest']);- - ___.allowCall(opensocial.Environment.prototype, 'getDomain');- ___.allowCall(opensocial.Environment.prototype, 'supportsField');- - ___.allowCall(opensocial.Enum.prototype, 'getKey'); - ___.allowCall(opensocial.Enum.prototype, 'getDisplayValue'); - - ___.allowCall(opensocial.Message.prototype, 'getField'); - ___.allowCall(opensocial.Message.prototype, 'setField'); - - var moduleHandler = ___.freeze({ - getOuters: ___.simpleFunc(function() { return outers; }),- handle: ___.simpleFunc(function(newModule) { newModule(outers); })- }); - - ___.setNewModuleHandler(moduleHandler); + whitelist(opensocialSchema, window); }; Modified: incubator/shindig/trunk/features/pom.xml URL:http://svn.apache.org/viewvc/incubator/shindig/trunk/features/pom.xml?rev=677699&r1=677698&r2=677699&view=diff= = = = = = = = = = = = ==================================================================--- incubator/shindig/trunk/features/pom.xml (original)+++ incubator/shindig/trunk/features/pom.xml Thu Jul 17 12:37:30 2008@@ -72,8 +72,7 @@ <exclude>**/*.gif</exclude> <exclude>**/*.jpeg</exclude> <exclude>**/*.png</exclude> - - <!-- Caja has some bugs too --> + <!-- Caja is already minified --> <exclude>**/caja/*.js</exclude> </excludes> </configuration> Modified: incubator/shindig/trunk/java/gadgets/pom.xml URL:http://svn.apache.org/viewvc/incubator/shindig/trunk/java/gadgets/pom.xml?rev=677699&r1=677698&r2=677699&view=diff= = = = = = = = = = = = ==================================================================--- incubator/shindig/trunk/java/gadgets/pom.xml (original)+++ incubator/shindig/trunk/java/gadgets/pom.xml Thu Jul 17 12:37:302008@@ -131,6 +131,11 @@incubator/shindig/trunk/java/gadgets/src/main/java/org/apache/ shindig/gadgets/servlet/CajaContentFilter.java<scope>compile</scope> </dependency> <dependency> + <groupId>caja</groupId> + <artifactId>json_simple</artifactId> + <scope>compile</scope> + </dependency> + <dependency> <groupId>net.oauth</groupId> <artifactId>core</artifactId> <scope>compile</scope> Modified:URL:http://svn.apache.org/viewvc/incubator/shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/gadgets/servlet/CajaContentFilter.java?rev=677699&r1=677698&r2=677699&view=diff= = = = = = = = = = = = ==================================================================---incubator/shindig/trunk/java/gadgets/src/main/java/org/apache/ shindig/gadgets/servlet/CajaContentFilter.java(original)incubator/shindig/trunk/java/gadgets/src/main/java/org/apache/ shindig/gadgets/servlet/CajaContentFilter.java+++Thu Jul 17 12:37:30 2008@@ -21,17 +21,19 @@ import org.apache.shindig.gadgets.GadgetContentFilter; import org.apache.shindig.gadgets.GadgetException; +import com.google.caja.lexer.CharProducer; import com.google.caja.lexer.ExternalReference; +import com.google.caja.lexer.FilePosition; +import com.google.caja.lexer.InputSource; import com.google.caja.opensocial.DefaultGadgetRewriter; -import com.google.caja.opensocial.GadgetContentRewriter; -import com.google.caja.opensocial.UriCallback; import com.google.caja.opensocial.GadgetRewriteException; +import com.google.caja.opensocial.UriCallback; import com.google.caja.opensocial.UriCallbackException; import com.google.caja.opensocial.UriCallbackOption; -import com.google.caja.reporting.SimpleMessageQueue; -import com.google.caja.reporting.MessageQueue; import com.google.caja.reporting.Message; import com.google.caja.reporting.MessageContext; +import com.google.caja.reporting.MessageQueue; +import com.google.caja.reporting.SimpleMessageQueue; import java.io.IOException; import java.io.Reader; @@ -65,16 +67,16 @@ }; MessageQueue mq = new SimpleMessageQueue(); - GadgetContentRewriter rw = new DefaultGadgetRewriter(mq); - Readable input = new StringReader(content); - Appendable output = new StringBuilder(); + DefaultGadgetRewriter rw = new DefaultGadgetRewriter(mq); + CharProducer input = CharProducer.Factory.create( + new StringReader(content),+ FilePosition.instance(new InputSource(retrievedUri), 2, 2, 1,1));+ StringBuilder output = new StringBuilder(); try { rw.rewriteContent(retrievedUri, input, cb, output); } catch (GadgetRewriteException e) { throwCajolingException(e, mq); - } catch (UriCallbackException e) { - throwCajolingException(e, mq); } catch (IOException e) { throwCajolingException(e, mq); } Modified:incubator/shindig/trunk/javascript/samplecontainer/ samplecontainer.htmlURL:http://svn.apache.org/viewvc/incubator/shindig/trunk/javascript/samplecontainer/samplecontainer.html?rev=677699&r1=677698&r2=677699&view=diff= = = = = = = = = = = = ==================================================================---incubator/shindig/trunk/javascript/samplecontainer/ samplecontainer.htmlincubator/shindig/trunk/javascript/samplecontainer/ samplecontainer.html(original) +++Thu Jul 17 12:37:30 2008 @@ -51,10 +51,10 @@ var stateFileUrl = baseUrl + 'state-basicfriendlist.xml'; var stateFileUrlCookie = 'sampleContainerStateFileUrl'; -var useCaja = false; -var useCache = true; -var usePermissive = false; -var doEvil = false; +var useCaja; +var useCache; +var usePermissive; +var doEvil; var gadget; var viewerId = "john.doe"; @@ -93,13 +93,18 @@ }); }; -function changeGadgetUrl() { +function unpackFormState() { useCaja = document.getElementById("useCajaCheckbox").checked; useCache = document.getElementById("useCacheCheckbox").checked; - gadgets.container.nocache_ = useCache ? 0 : 1; - usePermissive =document.getElementById("usePermissiveCheckbox").checked;doEvil = document.getElementById("doEvilCheckbox").checked; +} + +function changeGadgetUrl() { + unpackFormState(); + + gadgets.container.nocache_ = useCache ? 0 : 1; + setEvilBit(); stateFileUrl = document.getElementById("stateFileUrl").value; @@ -260,19 +265,23 @@ </script> </head> -<body onLoad="initGadget();"> +<body onLoad="unpackFormState(); initGadget();"> <div id="headerDiv"> <div style="float:left">Gadget testing container</div> <div class="subTitle">Displaying gadget: <input type="text" size="75" id="gadgetUrl"/> - <input type="checkbox" id="useCacheCheckbox" checked="true"/>usecache - <input type="checkbox" id="useCajaCheckbox"/>use caja - <input type="checkbox" id="usePermissiveCheckbox"/>usepermissive+ <input type="checkbox" id="useCacheCheckbox" checked="true"+ /><label for="useCacheCheckbox">use cache</label> + <input type="checkbox" id="useCajaCheckbox" + /><label for="useCajaCheckbox">use caja</label> + <input type="checkbox" id="usePermissiveCheckbox"+ /><label for="usePermissiveCheckbox">use permissive</ label><br/> Using state: <input type="text" size="75" id="stateFileUrl"/> - <input type="checkbox" id="doEvilCheckbox"/>do evil + <input type="checkbox" id="doEvilCheckbox" + /><label for="doEvilCheckbox">do evil</label> <br/> <br/> Modified: incubator/shindig/trunk/pom.xml URL:http://svn.apache.org/viewvc/incubator/shindig/trunk/pom.xml?rev=677699&r1=677698&r2=677699&view=diff= = = = = = = = = = = = ==================================================================--- incubator/shindig/trunk/pom.xml (original)+++ incubator/shindig/trunk/pom.xml Thu Jul 17 12:37:30 2008 @@ -771,7 +771,13 @@ <dependency> <groupId>caja</groupId> <artifactId>caja</artifactId> - <version>r820</version> + <version>r1899</version> + <scope>compile</scope> + </dependency> + <dependency> + <groupId>caja</groupId> + <artifactId>json_simple</artifactId> + <version>r1</version> <scope>compile</scope> </dependency> <dependency>-- .-. --- .--. ..- R o p u-- .-. --- .--. ..- R o p u

