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
pull/85/head
Nikolai Onken 2015-03-27 09:50:09 +00:00
rodzic 8d01ba39ef
commit eaa97797ce
8 zmienionych plików z 97 dodań i 228 usunięć

Wyświetl plik

@ -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

Wyświetl plik

@ -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: {
}
});
}

Wyświetl plik

@ -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
});
}
});

Plik binarny nie jest wyświetlany.

Przed

Szerokość:  |  Wysokość:  |  Rozmiar: 191 B

Plik binarny nie jest wyświetlany.

Przed

Szerokość:  |  Wysokość:  |  Rozmiar: 530 B

Plik binarny nie jest wyświetlany.

Przed

Szerokość:  |  Wysokość:  |  Rozmiar: 386 B

Plik binarny nie jest wyświetlany.

Przed

Szerokość:  |  Wysokość:  |  Rozmiar: 3.8 KiB

Wyświetl plik

@ -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);