diff --git a/configs/client-default.js b/configs/client-default.js index 746f4a6b..943872fc 100644 --- a/configs/client-default.js +++ b/configs/client-default.js @@ -748,7 +748,10 @@ module.exports = function(options) { }); } if (!hosted) { - plugins.push("plugins/c9.ide.analytics/mock_analytics"); + plugins.push( + "plugins/c9.ide.analytics/mock_analytics", + "plugins/c9.ide.services/linked-services-mock" + ); } // Collab diff --git a/node_modules/vfs-local/localfs.js b/node_modules/vfs-local/localfs.js index f9376f77..1984e00d 100644 --- a/node_modules/vfs-local/localfs.js +++ b/node_modules/vfs-local/localfs.js @@ -350,7 +350,7 @@ module.exports = function setup(fsOptions) { // This helper function doesn't follow node conventions in the callback, // there is no err, only entry. - function createStatEntry(file, fullpath, callback) { + function createStatEntry(file, fullpath, callback, _loop) { fs.lstat(fullpath, function (err, stat) { var entry = { name: file @@ -378,26 +378,29 @@ module.exports = function setup(fsOptions) { return callback(entry); } fs.readlink(fullpath, function (err, link) { - if (entry.name == link) { - entry.linkStatErr = "ELOOP: recursive symlink"; - return callback(entry); - } - if (err) { entry.linkErr = err.stack; return callback(entry); } + var fullLinkPath = pathResolve(dirname(fullpath), link); + if (!_loop) { + _loop = {fullLinkPath: fullpath, max: 100}; + } + if (fullLinkPath.toLowerCase() == _loop.fullLinkPath.toLowerCase() || _loop.max --< 0) { + entry.linkErr = "ELOOP: recursive symlink"; + return callback(entry); + } entry.link = link; - resolvePath(pathResolve(dirname(fullpath), link), {alreadyRooted: true}, function (err, newpath) { - if (err) { - entry.linkStatErr = err; - return callback(entry); - } - createStatEntry(basename(newpath), newpath, function (linkStat) { - entry.linkStat = linkStat; - linkStat.fullPath = newpath.substr(base.length) || "/"; - return callback(entry); - }); + resolvePath(fullLinkPath, {alreadyRooted: true}, function (err, newpath) { + if (err) { + entry.linkErr = err; + return callback(entry); + } + createStatEntry(basename(newpath), newpath, function (linkStat) { + entry.linkStat = linkStat; + linkStat.fullPath = newpath.substr(base.length) || "/"; + return callback(entry); + }, _loop); }); }); } diff --git a/package.json b/package.json index 3ded882c..145d0b5a 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "c9", "description": "New Cloud9 Client", - "version": "3.1.176", + "version": "3.1.207", "author": "Ajax.org B.V. ", "private": true, "main": "bin/c9", diff --git a/plugins/c9.fs/fs.cache.xml.js b/plugins/c9.fs/fs.cache.xml.js index dda745dd..c9ad1844 100644 --- a/plugins/c9.fs/fs.cache.xml.js +++ b/plugins/c9.fs/fs.cache.xml.js @@ -561,8 +561,8 @@ define(function(require, exports, module) { node.size = stat.size; if (stat.mtime != undefined) node.mtime = stat.mtime; - if (original_stat) - node.link = stat.fullPath; + if (original_stat || stat.linkErr) + node.link = stat.fullPath || stat.linkErr; node.isFolder = isFolder; } diff --git a/plugins/c9.ide.clipboard/html5.js b/plugins/c9.ide.clipboard/html5.js index 61b157b2..e57b1f38 100644 --- a/plugins/c9.ide.clipboard/html5.js +++ b/plugins/c9.ide.clipboard/html5.js @@ -23,39 +23,17 @@ define(function(require, exports, module) { function main(options, imports, register) { var Plugin = imports.Plugin; - var showError = imports["dialog.error"].show; /***** Initialization *****/ var plugin = new Plugin("Ajax.org", main.consumes); - var requested, nativeObject; + var nativeObject; var loaded = false; function load(){ if (loaded) return false; loaded = true; - - // Chrome Specific - if (window.chrome && window.chrome.permissions) { - var chrome = window.chrome; - var permissions = { - permissions: ["clipboardRead", "clipboardWrite"], - origins: [location.origin] - }; - - chrome.permissions.contains(permissions, function(allowed) { - if (!allowed) { - chrome.permissions.request(permissions, function(result) { - if (result) { - showError("The browser has granted copy " - + "and paste permissions. Restart the " - + "browser to enable these permissions"); - } - }); - } - }); - } } /***** Methods *****/ @@ -94,10 +72,7 @@ define(function(require, exports, module) { }; document.addEventListener("copy", setData, true); - // @todo test if this is sync - requested = true; var result = execCommand("copy"); - requested = false; document.removeEventListener("copy", setData, true); @@ -123,10 +98,7 @@ define(function(require, exports, module) { }; document.addEventListener("paste", getData, true); - // @todo test if this is sync - requested = true; var result = execCommand("paste"); - requested = false; document.removeEventListener("paste", getData, true); @@ -173,6 +145,7 @@ define(function(require, exports, module) { }); plugin.on("unload", function(){ loaded = false; + nativeObject = null; }); /***** Register and define API *****/ diff --git a/plugins/c9.ide.editors/tab.js b/plugins/c9.ide.editors/tab.js index 11c18440..e841ebef 100644 --- a/plugins/c9.ide.editors/tab.js +++ b/plugins/c9.ide.editors/tab.js @@ -258,6 +258,8 @@ define(function(require, module, exports) { ); return; } + + var currentValue = plugin.document.value; editorType = type; amlTab.setAttribute("type", "editor::" + type); @@ -265,6 +267,11 @@ define(function(require, module, exports) { if (amlPane.getPage() == amlTab) { amlPane.activepage = -1; amlPane.set(amlTab); + + plugin.document.value = currentValue; + // TODO undo managers for different editors conflict + // however, resetting removes changed state + // plugin.document.undoManager.reset(); } callback(); diff --git a/plugins/c9.ide.services/linked-services-mock.js b/plugins/c9.ide.services/linked-services-mock.js new file mode 100644 index 00000000..8d9f8082 --- /dev/null +++ b/plugins/c9.ide.services/linked-services-mock.js @@ -0,0 +1,59 @@ +define(function(require, exports, module) { + "use strict"; + + main.consumes = ["Plugin"]; + main.provides = ["linked-services"]; + return main; + + function main(options, imports, register) { + var Plugin = imports.Plugin; + var plugin = new Plugin("Ajax.org", main.consumes); + + function getServices(callback) { + setTimeout(function() { + callback(null, options.services || { + "github": { + "visible": true, + "hasRepositories": true, + "service": "github", + "title": "GitHub", + "accounts": [], + "maxAccounts": 1, + "maxProjects": 100 + }, + "mbed": { + "visible": false, + "hasRepositories": false, + "service": "mbed", + "title": "Mbed", + "accounts": [{ + "id": "mbed:154229", + "login": "fjakobs", + "metadata": {}, + "projects": [] + }], + "maxAccounts": 1, + "maxProjects": 100 + } + }); + }, 0); + } + + function getAccessToken(serviceId, callback) { + callback(new Error("Not Implemented")); + } + + /** + * Provides client-side Salesforce API access + * @singleton + **/ + plugin.freezePublicAPI({ + getServices: getServices, + getAccessToken: getAccessToken + }); + + register(null, { + "linked-services": plugin + }); + } +}); diff --git a/plugins/c9.ide.ui/forms.js b/plugins/c9.ide.ui/forms.js index 471a9e4a..0ab3e6f8 100644 --- a/plugins/c9.ide.ui/forms.js +++ b/plugins/c9.ide.ui/forms.js @@ -456,20 +456,25 @@ define(function(require, exports, module) { case "dropdown": var dropdown = el.lastChild; - var data = item.items.map(function(item) { - return ""; - }).join(""); - if (data) { - setTimeout(function(){ - dropdown.$model.load("" + data + ""); - + if (item.items) { + var data = item.items.map(function(item) { + return ""; + }).join(""); + if (data) { setTimeout(function(){ - var value = item.value || dropdown.value; - dropdown.value = -999; - dropdown.setAttribute("value", value); + dropdown.$model.load("" + data + ""); + + setTimeout(function(){ + var value = item.value || dropdown.value; + dropdown.value = -999; + dropdown.setAttribute("value", value); + }); }); - }); + } + } + else if (item.value) { + dropdown.setAttribute("value", item.value); } break; default: diff --git a/server.js b/server.js index 61d0c5ba..f5537a91 100755 --- a/server.js +++ b/server.js @@ -41,10 +41,12 @@ function getDefaultSettings() { var suffix = hostname.trim().split("-").pop() || ""; var modes = { + "workflowstaging": "workflow-staging", "prod": "deploy", "beta": "beta", "dev": "devel", - "onlinedev": "onlinedev" + "onlinedev": "onlinedev", + "test": "test" }; return modes[suffix] || "devel"; }