Return-Path: X-Original-To: apmail-chemistry-commits-archive@www.apache.org Delivered-To: apmail-chemistry-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id C2AFE97F6 for ; Wed, 7 Mar 2012 09:04:50 +0000 (UTC) Received: (qmail 57882 invoked by uid 500); 7 Mar 2012 09:04:50 -0000 Delivered-To: apmail-chemistry-commits-archive@chemistry.apache.org Received: (qmail 57817 invoked by uid 500); 7 Mar 2012 09:04:49 -0000 Mailing-List: contact commits-help@chemistry.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@chemistry.apache.org Delivered-To: mailing list commits@chemistry.apache.org Received: (qmail 57800 invoked by uid 99); 7 Mar 2012 09:04:48 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 07 Mar 2012 09:04:48 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 07 Mar 2012 09:04:46 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 9B3822388860; Wed, 7 Mar 2012 09:04:26 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1297895 - in /chemistry/playground/chemistry-opencmis-javascript-client/src: main/webapp/cmislib.js main/webapp/index.html test/resources/testcmislib.js Date: Wed, 07 Mar 2012 09:04:26 -0000 To: commits@chemistry.apache.org From: jens@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20120307090426.9B3822388860@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: jens Date: Wed Mar 7 09:04:26 2012 New Revision: 1297895 URL: http://svn.apache.org/viewvc?rev=1297895&view=rev Log: add redirect to iframe for createDoc from HTML form Modified: chemistry/playground/chemistry-opencmis-javascript-client/src/main/webapp/cmislib.js chemistry/playground/chemistry-opencmis-javascript-client/src/main/webapp/index.html chemistry/playground/chemistry-opencmis-javascript-client/src/test/resources/testcmislib.js Modified: chemistry/playground/chemistry-opencmis-javascript-client/src/main/webapp/cmislib.js URL: http://svn.apache.org/viewvc/chemistry/playground/chemistry-opencmis-javascript-client/src/main/webapp/cmislib.js?rev=1297895&r1=1297894&r2=1297895&view=diff ============================================================================== --- chemistry/playground/chemistry-opencmis-javascript-client/src/main/webapp/cmislib.js (original) +++ chemistry/playground/chemistry-opencmis-javascript-client/src/main/webapp/cmislib.js Wed Mar 7 09:04:26 2012 @@ -16,7 +16,11 @@ * specific language governing permissions and limitations * under the License. */ - +function trace(text) { + if (window.console && window.console.log) { + window.console.log(text); + } +} function OperationContext() { this.propertyFilter = "*"; @@ -44,7 +48,7 @@ function CmisSessionFactory (parameters) }; this.getRepositories = function(cbFct) { - console.log("getRepositories() for URL: " + this.params[PARAM_URL]); + trace("getRepositories() for URL: " + this.params[PARAM_URL]); $.ajax( { url:this.params[PARAM_URL], dataType: "jsonp", @@ -59,7 +63,7 @@ function CmisError (httpCode, message, c this.cmisException = cmisException; this.stackTrace = stackTrace; - console.log(this.toString()); + trace(this.toString()); }; CmisError.prototype.toString = function() { @@ -153,7 +157,7 @@ function CmisSession(urlPrefix, reposito cmisSelector: "repositoryInfo" }; - console.log("getRepositoryInfo(): " + url); + trace("getRepositoryInfo(): " + url); this.doJson(url, data, cbFct); }; @@ -170,7 +174,7 @@ function CmisSession(urlPrefix, reposito suppressResponseCodes: true }; - console.log("getDocument(): " + url); + trace("getDocument(): " + url); this.doJson(url, data, cbFct); }; @@ -190,7 +194,7 @@ function CmisSession(urlPrefix, reposito suppressResponseCodes: true }; - console.log("getDocument(): " + url); + trace("getDocument(): " + url); this.doJson(url, data, cbFct); }; @@ -203,7 +207,7 @@ function CmisSession(urlPrefix, reposito suppressResponseCodes: true }; - console.log("deleteDocument(): " + url); + trace("deleteDocument(): " + url); $.ajax( { url: url, data: properties, @@ -213,12 +217,12 @@ function CmisSession(urlPrefix, reposito }; this.createDocument = function(name, typeId, folderId, customProperties, cbFct) { - console.log("createDocument(), name: " + name + ", typeId: " + typeId + ", folderId: " + folderId); + trace("createDocument(), name: " + name + ", typeId: " + typeId + ", folderId: " + folderId); return this.create(name, typeId, folderId, customProperties, "createDocument", cbFct); }; this.createFolder = function(name, typeId, folderId, customProperties, cbFct) { - console.log("createFolder(), name: " + name + ", typeId: " + typeId + ", folderId: " + folderId); + trace("createFolder(), name: " + name + ", typeId: " + typeId + ", folderId: " + folderId); return this.create(name, typeId, folderId, customProperties, "createFolder", cbFct); }; @@ -261,7 +265,7 @@ function CmisSession(urlPrefix, reposito suppressResponseCodes: true }; - console.log("getTypeDefinition() " + url); + trace("getTypeDefinition() " + url); // try cache first: var cache = this.typeCache; var cachedTypeDef = this.typeCache.getType(typeId); @@ -274,7 +278,7 @@ function CmisSession(urlPrefix, reposito // call callback function with cached type return cbFct.call(this, cachedTypeDef); } - } + }; this.getTypeChildren = function(typeIdent, cbFct) { var url = this.getUrl(); @@ -286,9 +290,21 @@ function CmisSession(urlPrefix, reposito suppressResponseCodes: true }; - console.log("getTypeDefinition() " + url); + trace("getTypeDefinition() " + url); this.doJson(url, data, cbFct); - } + }; + + this.getObjectFromTransaction = function (transId, cbFct) { + var url = this.getUrl(); + var data = { + cmisselector: "lastResult", + transaction: transId, + suppressResponseCodes: true + }; + + trace("getObjectFromTransaction(): " + url + ", transaction-id: " + transId); + this.doJson(url, data, cbFct); + }; this.doJson = function(urlPrefix, params, cbFct) { $.ajax( { @@ -317,7 +333,7 @@ CmisSession.defaultErrorHandler = functi cmisError = new CmisError(jqXHR.status, cmisErr.message, cmisErr.exception, cmisErr.stacktrace); } catch (exc) { - console.log("Failed to parse Error as JSON: " + jqXHR.responseText); + trace("Failed to parse Error as JSON: " + jqXHR.responseText); cmisError = jqXHR.responseText; } } Modified: chemistry/playground/chemistry-opencmis-javascript-client/src/main/webapp/index.html URL: http://svn.apache.org/viewvc/chemistry/playground/chemistry-opencmis-javascript-client/src/main/webapp/index.html?rev=1297895&r1=1297894&r2=1297895&view=diff ============================================================================== --- chemistry/playground/chemistry-opencmis-javascript-client/src/main/webapp/index.html (original) +++ chemistry/playground/chemistry-opencmis-javascript-client/src/main/webapp/index.html Wed Mar 7 09:04:26 2012 @@ -44,7 +44,7 @@ } function createSession(connectionUrl, repoId) { - console.log("Initializing session to " + connectionUrl); + trace("Initializing session to " + connectionUrl); var factory = new CmisSessionFactory({ url : connectionUrl, repositoryId : repoId @@ -52,7 +52,7 @@ session = factory.createSession(); session.getRepositoryInfo(function(repoInfos) { - console.log("init(): getRepositoryInfo()"); + trace("init(): getRepositoryInfo()"); for (var repoInfo in repoInfos) { session.rootFolderId = repoInfos[repoInfo].rootFolderId; session.rootUrl = repoInfos[repoInfo].rootFolderUrl; @@ -114,7 +114,7 @@ text = "" + text + "" } row.append($('').html(text)); - console.log ("add col: " + prop.value); + trace ("add col: " + prop.value); } else row.append($(''));//.text("")); } @@ -125,7 +125,7 @@ } function getTypesRecursive(typeId, tbl) { - console.log("getTypesRecursive: " + typeId ); + trace("getTypesRecursive: " + typeId ); session.getTypeChildren(typeId, function(types) { if (!checkError(types, "#typessection")) { for (var i in types.types) { @@ -136,7 +136,7 @@ row.append($('').text( types.types[i].propertyDefinitions[key].id)); } for (var i in types.types) { - console.log("getTypeChildren() Found type definition: " + types.types[i].id ); + trace("getTypeChildren() Found type definition: " + types.types[i].id ); getTypesRecursive(types.types[i].id, tbl); } } @@ -156,25 +156,76 @@ } function checkError(jsonObj, domId) { - if (jsonObj != null && jsonObj.exception != null) { + if (jsonObj != null && jsonObj.exception) { var cmisError = session.createErrorFromErrorResponse(jsonObj); displayError(cmisError, domId); return cmisError; } else return null; } + function createRandomString() { + return Math.round(Math.random()*100000).toString(); + } + + function prepareCreate() { + // dynamically create an invisible iframe: + // + checkSession("#responsesection"); + if (!session) + return false; + +// $('#invisibleareaid').html($(' + + +

Create Folder (Ajax):

Modified: chemistry/playground/chemistry-opencmis-javascript-client/src/test/resources/testcmislib.js URL: http://svn.apache.org/viewvc/chemistry/playground/chemistry-opencmis-javascript-client/src/test/resources/testcmislib.js?rev=1297895&r1=1297894&r2=1297895&view=diff ============================================================================== --- chemistry/playground/chemistry-opencmis-javascript-client/src/test/resources/testcmislib.js (original) +++ chemistry/playground/chemistry-opencmis-javascript-client/src/test/resources/testcmislib.js Wed Mar 7 09:04:26 2012 @@ -23,7 +23,6 @@ function checkError(jsonObj) { function trace(text) { console.log(text); - } function getArraySize(obj) {