From eaa97797cec1458032eabb147e33f791472dd7d6 Mon Sep 17 00:00:00 2001 From: Nikolai Onken Date: Fri, 27 Mar 2015 09:50:09 +0000 Subject: [PATCH] Merge branch 'master' of github.com:c9/newclient into merge-account-profile Conflicts: plugins/c9.account.billing/component/PaymentMethod.js plugins/c9.account.billing/component/PaymentMethod.jsx plugins/c9.account.billing/components/paymentmethod/Create.js plugins/c9.account.billing/jsx/paymentmethod/Create.jsx plugins/c9.account.billing/style.css plugins/c9.account.provisioning/subscription/normalizeSubscriptionData.js plugins/c9.account.react/less/billing.less --- .eslintrc | 1 - configs/api.standalone.js | 226 ------------------ plugins/c9.ide.download/download.js | 94 ++++++++ .../images/rightclickmenu_background.png | Bin 191 -> 0 bytes .../images/rightclickmenu_bottom.png | Bin 530 -> 0 bytes .../images/rightclickmenu_top.png | Bin 386 -> 0 bytes .../c9.ide.layout.classic/images/rundebug.png | Bin 3869 -> 0 bytes plugins/c9.ide.tree/favorites.js | 4 +- 8 files changed, 97 insertions(+), 228 deletions(-) delete mode 100644 configs/api.standalone.js create mode 100644 plugins/c9.ide.download/download.js delete mode 100755 plugins/c9.ide.layout.classic/images/rightclickmenu_background.png delete mode 100755 plugins/c9.ide.layout.classic/images/rightclickmenu_bottom.png delete mode 100755 plugins/c9.ide.layout.classic/images/rightclickmenu_top.png delete mode 100755 plugins/c9.ide.layout.classic/images/rundebug.png diff --git a/.eslintrc b/.eslintrc index b9137a94..e6595427 100644 --- a/.eslintrc +++ b/.eslintrc @@ -23,7 +23,6 @@ rules: no-irregular-whitespace: 3 no-negated-in-lhs: 1 no-regex-spaces: 3 - no-reserved-keys: 3 no-unreachable: 1 use-isnan: 2 valid-typeof: 1 diff --git a/configs/api.standalone.js b/configs/api.standalone.js deleted file mode 100644 index c36cdca8..00000000 --- a/configs/api.standalone.js +++ /dev/null @@ -1,226 +0,0 @@ -#!/usr/bin/env node -"use strict"; - -module.exports.addApi = function(plugins, config) { - config.apiUrl = ""; - var apiPlugins = [{ - setup: function(options, imports, register) { - mockRedis(options, imports, register); - }, - provides: ["mq", "db", "mailer"], - consumes: ["api"] - }, { - packagePath: "./c9.logtimestamp/logtimestamp", - mode: config.mode - }, - "./c9.error/logger.raygun_mock", - "./c9.api/ping", - { - packagePath: "./c9.api/health", - revision: config.manifest.revision, - version: config.manifest.version, - }, - "./c9.api/user", - "./c9.api/project", - "./c9.api/applications", - "./c9.api/session", - "./c9.api/collab", - "./c9.api/settings", - "./c9.api/vfs", - "./c9.api/preview", - "connect-architect/connect.bodyparser", - "connect-architect/connect.query", - "./c9.passport/passport", - "./c9.passport/bearer", - "./c9.passport/basic"]; - - return plugins.concat(apiPlugins); -}; - -function mockRedis(options, imports, register) { - var api = imports.api; - if (api.bindUser) - return; - - api.bindUser = function(call) { - return function(req, res, next) { - call(req.user, req.params, function(err, json) { - if (err) return next(err); - res.json(json); - }); - }; - }; - api.authenticate = function() { - return function(req, res, next) { - req.user = new User(req.query.access_token); - next(); - }; - }; - var users = { - "-1": { - name: "John Doe", email: "johndoe@example.org", - } - }; - - var projects = [{ - owner: -1, members: ["rw", -1, 1, 2, 3, "r", 4, 5] - }]; - - function User(id) { - if (typeof id == "object") - id = id.id; - if (!/^\d+/.test(id)) - id = -1; - var u = users[id]; - if (!u) { - u = users[id] = { - name: "user" + id, - email: "user" + id + "@c9.io", - fullname: "User " + id - }; - } - - u.id = id; - return { - name: u.name, - fullname: u.fullname, - email: u.email, - id: id - }; - } - - function Project(id) { - if (typeof id == "object") - id = id.id; - var p = projects[id]; - if (!p) - return console.log(id); - return { - isPrivate: function() { - return false; - }, - owner: new User(p.owner), - getMembers: function(cb) { - var memebers = [], acl; - var ownerId = this.owner.id; - p.members.forEach(function(memberId) { - if (typeof memberId == "string") - return (acl = memberId); - memebers.push(new Member(memberId, acl, ownerId)); - }); - cb && cb(null, memebers); - return memebers; - }, - id: id - }; - } - - function Member(id, acl, ownerId) { - return { - user: id, - status: "", - acl: acl, - role: id == ownerId ? "a" : "c", - save: function(project, cb) { - cb(); - }, - remove: function(project, cb) { - var p = projects[project.id]; - var i = p.members.indexOf(id); - if (i != -1) - p.members.splice(i, 1); - cb(); - } - }; - } - - function DB(type) { - var key, query; - var dbApi = { - findOne: function(keyv, cb) { - key = keyv; - if (cb) - return dbApi.exec(cb); - return dbApi; - }, - populate: function(queryV) { - query = queryV; - return dbApi; - }, - exec: function(cb) { - var result; - switch (type) { - case "Project": - result = new Project(0); - break; - case "User": - result = new User(key.uid); - break; - case "AccessToken": - if (query == "user") { - var id = /\d/.test(key.token) ? key.token : -1; - result = {user: new User(id)}; - } - break; - case "WorkspaceMember": - var p = key.project; - var user = new User(key.user); - result = p.getMembers().filter(function(m) { - return m.user == user.id; - })[0]; - break; - default: - console.log(":((("); - } - cb(null, result); - return dbApi; - }, - }; - dbApi.ROLE_NONE = "n"; - dbApi.ROLE_VISITOR = "v"; // @deprecated - dbApi.ROLE_COLLABORATOR = "c"; - dbApi.ROLE_ADMIN = "a"; - dbApi.ACL_RW = "rw"; - dbApi.ACL_R = "r"; - dbApi.COLLABSTATE_PENDING_ADMIN = "pending-admin"; - dbApi.COLLABSTATE_PENDING_USER = "pending-user"; // @deprecated - dbApi.COLLABSTATE_PENDING_NONE = "pending-none"; - return dbApi; - } - - var pubsub = { - publish: function() { - - } - }; - - function noop() { return {}; } - - register(null, { - "mq": { - connection: noop, - close: noop, - onReady: noop, - onceReady: noop, - }, - "db": { - User: new DB("User"), - Project: new DB("Project"), - Remote: new DB("Remote"), - AccessToken: new DB("AccessToken"), - WorkspaceMember: new DB("WorkspaceMember"), - Vfs: new DB("Vfs"), - DockerHost: new DB("DockerHost"), - Container: new DB("Container"), - Image: new DB("Image"), - Lock: new DB("Lock"), - Nonce: new DB("Nonce"), - // PubSub as part of the database infrastructure - getSubscriber: function() { return pubsub }, - getPublisher: function() { return pubsub }, - }, - mailer: { - - } - }); -} diff --git a/plugins/c9.ide.download/download.js b/plugins/c9.ide.download/download.js new file mode 100644 index 00000000..05c3fdfa --- /dev/null +++ b/plugins/c9.ide.download/download.js @@ -0,0 +1,94 @@ +define(function(require, exports, module) { + "use strict"; + + main.consumes = [ + "Plugin", "c9", "ui", "menus", "tree", "info", "vfs" + ]; + main.provides = ["download"]; + return main; + + function main(options, imports, register) { + var Plugin = imports.Plugin; + var ui = imports.ui; + var c9 = imports.c9; + var menus = imports.menus; + var tree = imports.tree; + var vfs = imports.vfs; + var info = imports.info; + + /***** Initialization *****/ + + var plugin = new Plugin("Ajax.org", main.consumes); + + var loaded = false; + function load(){ + if (loaded) return false; + loaded = true; + + menus.addItemByPath("File/Download Project", new ui.item({ + onclick: downloadProject + }), 1300, plugin); + + // Context Menu + tree.getElement("mnuCtxTree", function(mnuCtxTree) { + menus.addItemToMenu(mnuCtxTree, new ui.item({ + match: "folder|project", + isAvailable: function(){ + return tree.selectedNode; + }, + caption: "Download", + onclick: download + }), 140, plugin); + }); + } + + function download() { + if (!c9.has(c9.STORAGE)) + return; + + var node = tree.selectedNode; + if (!node) return; + + var paths = tree.selectedNodes.map(function(node) { + return node.path; + }); + if (node.isFolder && node.path == "/") + downloadProject(); + else if (paths.length > 1) + vfs.download(paths); + else if (node.isFolder) + downloadFolder(node.path); + else + downloadFile(node.path); + + } + + function downloadProject() { + vfs.download("/", info.getWorkspace().name + ".tar.gz"); + } + + function downloadFolder(path) { + vfs.download(path.replace(/\/*$/, "/")); + } + + function downloadFile(path) { + vfs.download(path.replace(/\/*$/, ""), null, true); + } + + /***** Lifecycle *****/ + + plugin.on("load", function(){ + load(); + }); + + /***** Register and define API *****/ + + plugin.freezePublicAPI({ + + }); + + register(null, { + download: plugin + }); + } +}); \ No newline at end of file diff --git a/plugins/c9.ide.layout.classic/images/rightclickmenu_background.png b/plugins/c9.ide.layout.classic/images/rightclickmenu_background.png deleted file mode 100755 index 9a02e18e0b8de606e0f1e085c0b9411599359d9b..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 191 zcmeAS@N?(olHy`uVBq!ia0vp^CxMuegAGWQ)OOtgQj#UE5hcO-X(i=}MX3yqDfvmM z3ZA)%>8U}fi7AzZCsS>JiV{6t978H@y*YD{v%!GJ^ei(e0i!~1Txqps^l zhY&`$`)cQE2?&~}a?Ugi!__gy(e=9Td)n{!Z{@L%;#2V#`&>L!d#k2!!V*LOKuPWU zI|TuTh9osej>jXG5n4MW$$(_Mc5E-=R`pZy3wz6MF>J$db^JSzHHH=fL5)w5qg0Dk zC-x`%o4;>yD}{+-t)MLG#WRC|1Oo{)`?17;q&bScF899~x3W?2EMU-p01{}4kVsG- zx`yH)OGrq~A+3<-0u7Les0FPgaz)imqUt8s*(Bs5cR9n&iZ~~_#9(v~ubzRRId_t5 zj1p%7OH|!tgrxEzCk#7a%c0EZeE<0j|N%Z|T+ zB0GgM?g0t3bV$hP8g~Qxb(2d-6ezy|0XU#F!9rFCnS?~k;T2zK?bQ4M!H)m~0Kr%a Un7C|zv;Y7A07*qoM6N<$g3KD~F#rGn diff --git a/plugins/c9.ide.layout.classic/images/rightclickmenu_top.png b/plugins/c9.ide.layout.classic/images/rightclickmenu_top.png deleted file mode 100755 index b51256ceb7a31729435f0cf6689b78aafb1e5a44..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 386 zcmV-|0e$|7P)xpxEpI}DoKPO zR)}C5bI1aEkRyta^GX!21d$?;kb}{gd9QmP(<;K5{rZww65zD`wMzz zS(b+oq{zZvuqa+-1(`WG952lCY@Bl`y!R>coCCc*`0>Wv9LG^&-}e+e-nPx;b1pKA zmDxv2LP`*iEd~S7I_E)4qI;1n$b|g^12A3mFYH6~jTo`9+Sqt*FE}S+$UWP%ye?v$73AdQU~&pDc?DT{Rk)%8Tuu)B&jX=l zBYIqeTN_^ZCl@W!f_RZg1UL*97#Ii*RD|M*o-lcJb@gKn1qE3eLe?(`M?#WiaegAd z6b#XRC?bYH!r*b>V@0Gp-k+oep;h{yEno@%%HsU~X%nqsFfx(=lZVP3Z|N5hf%yNS zSnR)OKaw^2zxDo~!hW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TRg0KGkkr0Q0>vwhs8UNPR@h( eO#2U|n*ozMLQIovP9w)ZtR_b0hGqJ0QU3$&SJ)u{ diff --git a/plugins/c9.ide.tree/favorites.js b/plugins/c9.ide.tree/favorites.js index 01f112af..bd430aec 100644 --- a/plugins/c9.ide.tree/favorites.js +++ b/plugins/c9.ide.tree/favorites.js @@ -93,7 +93,8 @@ define(function(require, exports, module) { status: "loaded", map: {}, children: [], - noSelect: true + noSelect: true, + $sorted: true }] }; @@ -230,6 +231,7 @@ define(function(require, exports, module) { favRoot.children.splice(index, 0, favNode); fsCache.refresh(favRoot); emit("favoriteReorder"); + update(favNode); } }, true);