Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge branch 'master' of github.com:ajaxorg/cloud9 into bdwci

  • Loading branch information...
commit 438a34f6841d946683c8a100ef8ad3a85b52fc83 2 parents eface94 + a90a6bf
@basdewachter basdewachter authored
Showing with 10,402 additions and 4,939 deletions.
  1. +1 −1  .gitignore
  2. +0 −1  .npmignore
  3. +5 −1 Makefile
  4. +2 −1  Makefile.dryice.js
  5. +7 −6 README.md
  6. +7 −1 build/app.build.tmpl.js
  7. +30 −4 build/core.build.js
  8. +13 −3 configs/default.js
  9. +3 −1 configs/local.js
  10. +3 −2 configs/packed.js
  11. +13 −13 package.json
  12. +28 −19 plugins-client/cloud9.core/www/core/ext.js
  13. +67 −155 plugins-client/cloud9.core/www/core/ide.js
  14. +0 −2  plugins-client/cloud9.core/www/core/settings.js
  15. +70 −142 plugins-client/cloud9.core/www/core/util.js
  16. +24 −30 plugins-client/ext.anims/anims.js
  17. +22 −52 plugins-client/ext.autosave/autosave.js
  18. +3 −2 plugins-client/ext.clipboard/clipboard.js
  19. +1 −1  plugins-client/ext.closeconfirmation/closeconfirmation.js
  20. +59 −23 plugins-client/ext.code/code.js
  21. +0 −3  plugins-client/ext.code/code.xml
  22. +1 −1  plugins-client/ext.code/settings.xml
  23. +8 −1 plugins-client/ext.codecomplete/snippet_completer.js
  24. +1 −1  plugins-client/ext.codetools/codetools.js
  25. +5 −1 plugins-client/ext.colorpicker/colorpicker.js
  26. +0 −4 plugins-client/ext.colorpicker/colorpicker.xml
  27. +13 −18 plugins-client/ext.colorpicker/colorpicker_test.js
  28. +97 −161 plugins-client/ext.console/console.js
  29. +1 −1  plugins-client/ext.console/console.xml
  30. +26 −20 plugins-client/ext.console/logger.js
  31. +3 −3 plugins-client/ext.console/logger_test.js
  32. +2 −2 plugins-client/ext.console/parser_test.js
  33. +31 −25 plugins-client/ext.consolehints/consolehints.js
  34. +110 −150 plugins-client/ext.dbg-node/dbg-node.js
  35. +53 −0 plugins-client/ext.dbg-node/service.js
  36. +14 −11 plugins-client/ext.debugger/apfhook.js
  37. +17 −12 plugins-client/ext.debugger/breakpoints.js
  38. +149 −0 plugins-client/ext.debugger/debug_handler.js
  39. +66 −26 plugins-client/ext.debugger/debugger.js
  40. +2 −2 plugins-client/ext.debugger/debugger.xml
  41. +1 −1  plugins-client/ext.debugger/inspector.js
  42. +18 −13 plugins-client/ext.debugger/sources.js
  43. +25 −0 plugins-client/ext.dockpanel/dockpanel.js
  44. +50 −50 plugins-client/ext.dragdrop/dragdrop.js
  45. +37 −41 plugins-client/ext.editors/editors.js
  46. +71 −42 plugins-client/ext.extmgr/extmgr.js
  47. +5 −3 plugins-client/ext.filelist/filelist.js
  48. +61 −56 plugins-client/ext.filesystem/filesystem.js
  49. +10 −10 plugins-client/ext.ftp/ftp.js
  50. +14 −6 plugins-client/ext.gitblame/blame_gutter.js
  51. +1 −9 plugins-client/ext.githistory/githistory.js
  52. +122 −113 plugins-client/ext.gotofile/gotofile.js
  53. +4 −4 plugins-client/ext.gotofile/gotofile.xml
  54. +83 −0 plugins-client/ext.gotofile/heap.js
  55. +44 −0 plugins-client/ext.gotofile/heap_test.js
  56. +114 −46 plugins-client/ext.gotofile/search.js
  57. +32 −5 plugins-client/ext.gotofile/search_test.js
  58. +36 −34 plugins-client/ext.gotoline/gotoline.js
  59. +64 −64 plugins-client/ext.guidedtour/guidedtour.js
  60. +1 −1  plugins-client/ext.guidedtour/tour.js
  61. +3 −3 plugins-client/ext.help/help.js
  62. +1 −1  plugins-client/ext.imgview/imgview.js
  63. +10 −1 plugins-client/ext.jslanguage/jshint.js
  64. +2 −1  plugins-client/ext.jslanguage/outline.js
  65. +4 −1 plugins-client/ext.jslanguage/parse.js
  66. +2 −1  plugins-client/ext.jslanguage/parse_test.js
  67. +94 −21 plugins-client/ext.jslanguage/scope_analyzer.js
  68. +198 −1 plugins-client/ext.jslanguage/scope_analyzer_test.js
  69. +26 −0 plugins-client/ext.keybindings_default/keybindings_default.js
  70. +11 −2 plugins-client/ext.language/base_handler.js
  71. +53 −14 plugins-client/ext.language/complete.js
  72. +126 −0 plugins-client/ext.language/jumptodef.js
  73. +19 −12 plugins-client/ext.language/language.js
  74. +1 −1  plugins-client/ext.language/language.xml
  75. +1 −1  plugins-client/ext.language/liveinspect.xml
  76. +1 −1  plugins-client/ext.language/outline.js
  77. +16 −2 plugins-client/ext.language/skin.xml
  78. +90 −22 plugins-client/ext.language/worker.js
  79. +92 −0 plugins-client/ext.linereport/linereport.js
  80. +140 −0 plugins-client/ext.linereport/linereport_base.js
  81. +39 −0 plugins-client/ext.linereport/linereport_test.js
  82. +14 −0 plugins-client/ext.linereport/package.json
  83. +40 −0 plugins-client/ext.linereport_php/linereport_php.js
  84. +45 −0 plugins-client/ext.linereport_php/linereport_php_worker.js
  85. +50 −0 plugins-client/ext.linereport_php/linereport_php_worker_wrapped.js
  86. +14 −0 plugins-client/ext.linereport_php/package.json
  87. +14 −0 plugins-client/ext.linereport_php/wrap-in-js.sh
  88. +26 −28 plugins-client/ext.log/log.js
  89. +0 −5 plugins-client/ext.main/main.js
  90. +3 −3 plugins-client/ext.main/main.xml
  91. BIN  plugins-client/ext.main/style/icons/terminal_tab_icon.png
  92. BIN  plugins-client/ext.main/style/images/loaderide.gif
  93. BIN  plugins-client/ext.main/style/images/loading-your-editor.png
  94. +32 −24 plugins-client/ext.main/style/skins.xml
  95. +30 −1 plugins-client/ext.main/style/style.css
  96. +79 −79 plugins-client/ext.menus/menus.js
  97. +30 −31 plugins-client/ext.noderunner/noderunner.js
  98. +19 −16 plugins-client/ext.nodeunit/nodeunit.js
  99. +1 −15 plugins-client/ext.offline/offline.js
  100. +23 −27 plugins-client/ext.openfiles/openfiles.js
  101. +72 −71 plugins-client/ext.panels/panels.js
  102. +10 −0 plugins-client/ext.preview/preview.js
  103. +6 −15 plugins-client/ext.quicksearch/quicksearch.js
  104. +1 −1  plugins-client/ext.quickwatch/quickwatch.xml
  105. +8 −6 plugins-client/ext.recentfiles/recentfiles.js
  106. +19 −19 plugins-client/ext.remotecontrol/remotecontrol.js
  107. +105 −48 plugins-client/ext.revisions/revisions.js
  108. +1 −2  plugins-client/ext.revisions/revisions.xml
  109. +1 −1  plugins-client/ext.revisions/revisions_worker.js
  110. +48 −8 plugins-client/ext.runpanel/runpanel.js
  111. +7 −4 plugins-client/ext.runpanel/runpanel.xml
  112. +123 −20 plugins-client/ext.save/save.js
  113. +119 −119 plugins-client/ext.searchinfiles/searchinfiles.js
  114. +47 −85 plugins-client/ext.searchreplace/libsearch.js
  115. +13 −12 plugins-client/ext.searchreplace/searchreplace.js
  116. +28 −53 plugins-client/ext.settings/settings.js
  117. +1 −1  plugins-client/ext.statusbar/statusbar.xml
  118. +4 −3 plugins-client/ext.stripws/stripws.js
  119. +17 −7 plugins-client/ext.tabbehaviors/tabbehaviors.js
  120. +2 −6 plugins-client/ext.tabsessions/tabsessions.js
  121. +81 −80 plugins-client/ext.testpanel/testpanel.js
  122. +66 −54 plugins-client/ext.themes/themes.js
  123. +24 −12 plugins-client/ext.themes_default/themes_default.js
  124. +54 −54 plugins-client/ext.tooltip/tooltip.js
  125. +24 −30 plugins-client/ext.tree/tree.js
  126. +18 −20 plugins-client/ext.tree/tree.xml
  127. +145 −142 plugins-client/ext.uploadfiles/uploadfiles.js
  128. +29 −29 plugins-client/ext.uploadfiles/uploadfiles.xml
  129. +24 −22 plugins-client/ext.watcher/watcher.js
  130. +1 −2  plugins-client/lib.ace/ace-lib.js
  131. +25 −32 plugins-client/lib.ace/www/mode/mode-c9search.js
  132. +73 −58 plugins-client/lib.ace/www/mode/mode-c_cpp.js
  133. +104 −121 plugins-client/lib.ace/www/mode/mode-clojure.js
  134. +183 −82 plugins-client/lib.ace/www/mode/mode-coffee.js
  135. +120 −235 plugins-client/lib.ace/www/mode/mode-coldfusion.js
  136. +8 −22 plugins-client/lib.ace/www/mode/mode-csharp.js
  137. +37 −79 plugins-client/lib.ace/www/mode/mode-css.js
  138. +28 −34 plugins-client/lib.ace/www/mode/mode-diff.js
  139. +834 −0 plugins-client/lib.ace/www/mode/mode-glsl.js
  140. +16 −23 plugins-client/lib.ace/www/mode/mode-golang.js
  141. +103 −183 plugins-client/lib.ace/www/mode/mode-groovy.js
  142. +32 −41 plugins-client/lib.ace/www/mode/mode-haxe.js
  143. +123 −237 plugins-client/lib.ace/www/mode/mode-html.js
  144. +2,153 −0 plugins-client/lib.ace/www/mode/mode-jade.js
  145. +94 −176 plugins-client/lib.ace/www/mode/mode-java.js
  146. +100 −179 plugins-client/lib.ace/www/mode/mode-javascript.js
  147. +26 −33 plugins-client/lib.ace/www/mode/mode-json.js
  148. +1,664 −0 plugins-client/lib.ace/www/mode/mode-jsp.js
  149. +25 −33 plugins-client/lib.ace/www/mode/mode-less.js
  150. +236 −359 plugins-client/lib.ace/www/mode/mode-liquid.js
  151. +76 −103 plugins-client/lib.ace/www/mode/mode-lua.js
  152. +145 −269 plugins-client/lib.ace/www/mode/mode-luapage.js
Sorry, we could not display the entire diff because it was too big.
View
2  .gitignore
@@ -38,7 +38,7 @@ plugins-client/cloud9.core/www/js/
plugins-client/ext.jsinfer
node_modules/
deps/ace/
-plugins-server/fixtures/node_env/hello.js
+plugins-server/fixtures/
npm-debug.log
plugins-client/lib.apf/www/apf-packaged/apf_debug.js
.sessions/
View
1  .npmignore
@@ -19,6 +19,5 @@ support/connect/support/expresso
support/connect/support/less
support/connect/support/sass
support/connect/support/coffee-script
-support/socket.io/support/expresso
support/gnu-builds
*.psd
View
6 Makefile
@@ -47,8 +47,11 @@ ext:
# calls dryice on worker & packages it
worker: plugins-client/lib.ace/www/worker/worker-language.js
-plugins-client/lib.ace/www/worker/worker-language.js : $(wildcard plugins-client/ext.language/*) \
+plugins-client/lib.ace/www/worker/worker-language.js plugins-client/lib.ace/www/worker/worker-javascript.js : \
+ $(wildcard node_modules/ace/*) $(wildcard node_modules/ace/*/*) $(wildcard node_modules/ace/*/*/mode/*) \
+ $(wildcard plugins-client/ext.language/*) \
$(wildcard plugins-client/ext.language/*/*) \
+ $(wildcard plugins-client/ext.linereport/*) \
$(wildcard plugins-client/ext.codecomplete/*) \
$(wildcard plugins-client/ext.codecomplete/*/*) \
$(wildcard plugins-client/ext.jslanguage/*) \
@@ -66,6 +69,7 @@ plugins-client/lib.ace/www/worker/worker-language.js : $(wildcard plugins-client
ln -s `pwd`/plugins-client/ext.language /tmp/c9_worker_build/ext/language
ln -s `pwd`/plugins-client/ext.codecomplete /tmp/c9_worker_build/ext/codecomplete
ln -s `pwd`/plugins-client/ext.jslanguage /tmp/c9_worker_build/ext/jslanguage
+ ln -s `pwd`/plugins-client/ext.linereport /tmp/c9_worker_build/ext/linereport
node Makefile.dryice.js worker
cp node_modules/ace/build/src/worker* plugins-client/lib.ace/www/worker
View
3  Makefile.dryice.js
@@ -68,7 +68,8 @@ function worker(project) {
'ext/jslanguage/scope_analyzer',
'ext/jslanguage/jshint',
'ext/jslanguage/debugger',
- 'ext/jslanguage/outline'
+ 'ext/jslanguage/outline',
+ 'ext/linereport/linereport_base',
]
})
],
View
13 README.md
@@ -36,7 +36,7 @@ We support the newer versions of Chrome, Firefox and Safari.
Requirements:
- * NodeJS `>= 0.6.16` (node 0.8.x will *not work* at the moment!)
+ * NodeJS `>= 0.6.16`
* NPM `>= 1.1.16`
Install:
@@ -133,7 +133,8 @@ Main projects that we use as building blocks:
* [async.js] by [fjakobs]
* [jsDAV] by [mikedeboer]
* [connect] by [senchalabs](http://github.com/senchalabs)
- * [socket.io] by [LearnBoost](http://github.com/LearnBoost)
+ * [engine.io] by [LearnBoost](http://github.com/LearnBoost)
+ * [smith.io](http://github.com/c9/smith.io) by [creationix](http://github.com/creationix) & [cadorn](http://github.com/cadorn)
* [ace](http://github.com/ajaxorg/ace) by [fjakobs]
* [apf](http://www.ajax.org) by [ajax.org]
* and of course [Node.JS]!
@@ -147,7 +148,7 @@ Thanks to all developers and contributors of these projects!
[async.js]: http://github.com/fjakobs/async.js
[jsDAV]: http://github.com/mikedeboer/jsdav
[connect]: http://github.com/senchalabs/connect
-[socket.io]: http://github.com/LearnBoost/Socket.IO-node.git
+[engine.io]: http://github.com/LearnBoost/engine.io
[requireJS]: http://requirejs.org/
[Node.JS]: http://nodejs.org/
@@ -162,13 +163,13 @@ Cloud9 wouldn't be where it is now without contributions. Feel free to fork and
1. [The Individual CLA](https://github.com/ajaxorg/cloud9/raw/master/doc/Contributor_License_Agreement-v2.pdf): use this version if you're working on an ajax.org project in your spare time, or can clearly claim ownership of copyright in what you'll be submitting.
2. [The Corporate CLA](https://github.com/ajaxorg/cloud9/raw/master/doc/Corporate_Contributor_License_Agreement-v2.pdf): have your corporate lawyer review and submit this if your company is going to be contributing to ajax.org projects
-If you want to contribute to an ajax.org project please print the CLA and fill it out and sign it. Then either send it by snail mail or fax us or send it back scanned (or as a photo) by email.
+If you want to contribute to an ajax.org project please print the CLA and fill it out and sign it. Then either send it by snail mail or fax us or send it back scanned (or as a photo) by email. Please indicate a contact person or pull request your CLA relates to so we can quickly process and handle your agreement. Once you've submitted it, you no longer need to send one for subsequent submissions.
-Email: info@ajax.org
+Email: cla@c9.io
Fax: +31 (0) 206388953
-Address: Ajax.org B.V.
+Address: Cloud9 IDE
Keizersgracht 241
1016 EA, Amsterdam
the Netherlands
View
8 build/app.build.tmpl.js
@@ -10,6 +10,12 @@
"ext/commands" : "%d/ext.commands",
"apf" : "empty:",
"treehugger" : "empty:",
+ "debug": "empty:",
+ "engine.io": "empty:",
+ "smith.io": "empty:",
+ "smith": "empty:",
+ "events-amd": "empty:",
+ "msgpack-js": "empty:",
"v8debug": "empty:",
"apf/elements": "%d/lib.apf/www/apf/elements",
"ace/worker": "%a",
@@ -27,4 +33,4 @@
optimizeAllPluginResources: false,
useStrict: true,
wrap: true
-})
+})
View
34 build/core.build.js
@@ -8,8 +8,34 @@
"treehugger" : "node_modules/treehugger/lib/treehugger",
"v8debug": "node_modules/v8debug/lib/v8debug",
"ext/main": "plugins-client/ext.main",
- "apf-packaged": "plugins-client/lib.apf/www/apf-packaged"
+ "apf-packaged": "plugins-client/lib.apf/www/apf-packaged",
+
+ // Needed because `r.js` has a bug based on packages config below:
+ // `Error evaluating module "undefined" at location "~/cloud9infra/node_modules/cloud9/events-amd.js"`
+ "events-amd": "empty:"
},
+ packages: [
+ {
+ "name": "engine.io",
+ "location": "node_modules/smith.io/node_modules/engine.io/node_modules/engine.io-client/dist",
+ "main": "engine.io-dev.js"
+ },
+ {
+ "name": "smith.io",
+ "location": "node_modules/smith.io/server-plugin/www",
+ "main": "client.js"
+ },
+ {
+ "name": "smith",
+ "location": "node_modules/smith",
+ "main": "smith.js"
+ },
+ {
+ "name": "msgpack-js",
+ "location": "node_modules/smith.io/node_modules/msgpack-js-browser",
+ "main": "msgpack.js"
+ }
+ ],
include: [
"node_modules/ace/build/src/ace",
"node_modules/ace/build/src/theme-chrome",
@@ -37,9 +63,9 @@
"node_modules/ace/build/src/theme-twilight",
"node_modules/ace/build/src/theme-vibrant_ink",
"apf-packaged/apf_release",
- "core/document",
- "core/ext",
- "core/ide",
+ "core/document",
+ "core/ext",
+ "core/ide",
"core/settings",
"core/util",
"ext/main/main",
View
16 configs/default.js
@@ -32,7 +32,7 @@ var config = [
prefix: "/static/bundles",
plugins: clientExtensions
}, {
- packagePath: "./cloud9.static",
+ packagePath: "connect-architect/connect.static",
prefix: "/static"
},
"./cloud9.alive",
@@ -45,6 +45,11 @@ var config = [
"./../plugins-client/lib.treehugger",
"./../plugins-client/lib.v8debug",
"./../plugins-client/lib.requirejs",
+ {
+ packagePath: "smith.io/server-plugin",
+ messagePath: "/smith.io/server",
+ debug: true
+ },
// server plugins
{
packagePath: "./cloud9.sandbox",
@@ -57,8 +62,11 @@ var config = [
packagePath: "./cloud9.core",
debug: false,
fsUrl: fsUrl,
+ smithIo: {
+ port: port,
+ prefix: "/smith.io/server"
+ },
hosted: false,
- socketIoTransports: ["websocket", "htmlfile", "xhr-multipart", "xhr-polling"],
bundledPlugins: [
"helloworld"
],
@@ -88,6 +96,7 @@ var config = [
"ext/preview/preview",
"ext/log/log",
"ext/help/help",
+ "ext/linereport/linereport",
//"ext/ftp/ftp",
"ext/code/code",
"ext/statusbar/statusbar",
@@ -153,7 +162,8 @@ var config = [
packagePath: "connect-architect/connect.session",
key: "cloud9.sid." + port,
secret: "v1234"
- }, {
+ },
+ {
packagePath: "connect-architect/connect.session.file",
sessionsPath: __dirname + "/../.sessions"
},
View
4 configs/local.js
@@ -1,12 +1,14 @@
var plugins = require("./default");
+/*
plugins.forEach(function(plugin) {
if (plugin.packagePath) {
if (/\/cloud9.core$/.test(plugin.packagePath)) {
- plugin.socketIoTransports = ["websocket", "htmlfile", "xhr-multipart", "xhr-polling"];
+
}
}
});
+*/
module.exports = plugins;
View
5 configs/packed.js
@@ -1,15 +1,16 @@
var plugins = require("./default");
+/*
plugins.forEach(function(plugin) {
if (plugin.packagePath) {
if (/\/cloud9.core$/.test(plugin.packagePath)) {
- plugin.socketIoTransports = ["websocket", "htmlfile", "xhr-multipart", "xhr-polling"];
}
}
});
+*/
plugins = plugins.filter(function(plugin) {
- // returns false of any of these plugins are detected; lib.packed will emit them
+ // returns false if any of these plugins are detected; lib.packed will emit them
return !(/\/plugins-client\/cloud9.core$/.test(plugin) ||
/\/plugins-client\/lib.ace$/.test(plugin) ||
/\/plugins-client\/lib.apf$/.test(plugin) ||
View
26 package.json
@@ -12,7 +12,7 @@
"pm": "sm",
"dependencies": {
- "connect": "1.8.x",
+ "connect": "1.8.7",
"sourcemint-loader-js": "0.x",
"sourcemint-platform-nodejs": "0.x",
@@ -27,29 +27,29 @@
"async": "0.1.21",
"netutil": "0.0.1",
"architect": "0.1.4",
- "connect-architect": "0.0.3"
+ "connect-architect": "0.0.6",
+
+ "smith": "0.1.9",
+ "smith.io": "0.0.32",
+ "vfs-architect": "0.0.2",
+ "jsDAV": "0.1.7"
},
"devDependencies": {
"nodeunit": "0.7.4",
"sinon": "1.3.4",
"rimraf": "2.0.1",
- "vfs-local": "0.1.6",
- "vfs-nodefs-adapter": "0.0.4"
+ "vfs-local": "~0.3.4",
+ "vfs-nodefs-adapter": "~0.3.0"
},
"mappings": {
- "ace": ["npm", "https://github.com/ajaxorg/ace/tarball/7c30de155eff4692d281b95b305e751a245d7454"],
- "apf": ["npm", "https://github.com/ajaxorg/apf/tarball/ca9053b1a9a499d587063f04cc02acf091d44b28"],
+ "ace": ["npm", "https://github.com/ajaxorg/ace/tarball/999bf92801dc0d860698306b9e399a21e064132a"],
+ "apf": ["npm", "https://github.com/ajaxorg/apf/tarball/8ae38f8dcd948aded2eff7698d0d7705aeaf6e61"],
"asyncjs": ["npm", "https://github.com/ajaxorg/async.js/tarball/0b4ed5608a32c280a7690b5f52883d8d1fc0de08"],
- "jsDAV": ["npm", "https://github.com/ajaxorg/jsDAV/tarball/53818b85736cbe12f63a7cd46e4cbc4214d1c64c"],
"v8debug": ["npm", "https://github.com/ajaxorg/lib-v8debug/tarball/d2fac9b09724cb2e75e2807191eace9bc27d3b52"],
- "packager": ["npm", "https://github.com/ajaxorg/packager/tarball/01597eacd22ad660977d43c44b4001107117b8ea"],
- "vfs": ["npm", "https://github.com/c9/vfs/tarball/61841e99eda6ea9a8b801fd145b9a0af286ad324"],
- "vfs-architect":["npm", "https://github.com/c9/vfs-architect/tarball/43bd19b9e7b2ddb95bdc1116143ce7fb22c6a5d3"],
- "treehugger": ["npm", "https://github.com/ajaxorg/treehugger/tarball/d7ab6ada6ec802f8d4107dae038327c7fa9c5601"],
- "socket.io": ["npm", "https://github.com/ajaxorg/socket.io/tarball/7aa252bab49e6bbc314dc2678b108b6e0876007a"],
- "socket.io-client": ["npm", "https://github.com/ajaxorg/socket.io-client/tarball/35f0763ffcaa7ccc3c664460667577e77da82b10"]
+ "packager": ["npm", "https://github.com/ajaxorg/packager/tarball/bee2a82c6d5e2875024bfdc83937e98092ccf04f"],
+ "treehugger": ["npm", "https://github.com/ajaxorg/treehugger/tarball/b22d7ad712f76a7e7b1070ab339d567dfbf059b1"]
},
"repository" : {
View
47 plugins-client/cloud9.core/www/core/ext.js
@@ -28,7 +28,7 @@ var util = require("core/util");
// apf.nameserver.register(this.localName, value, this);
// apf.nameserver.register("all", value, this);
// //#endif
-//
+//
// this.name = value;
//};
@@ -81,12 +81,16 @@ module.exports = ext = {
if (!this.model.data)
this.model.load("<plugins />");
- if (!this.model.queryNode("plugin[@path='" + path + "']"))
- this.model.appendXml('<plugin type="' + this.typeLut[oExtension.type]
- + '" name="' + (oExtension.name || "") + '" path="' + path
- + '" dev="' + (oExtension.dev || "") + '" enabled="1" userext="0" />');
+ if (!this.model.queryNode("plugin[@path=" + util.escapeXpathString(path) + "]"))
+ this.model.appendXml(apf.n("<plugin/>")
+ .attr("type", this.typeLut[oExtension.type])
+ .attr("name", oExtension.name || "")
+ .attr("path", path)
+ .attr("dev", oExtension.dev || "")
+ .attr("enabled", "1")
+ .attr("userext", "0").node());
else
- this.model.setQueryValue("plugin[@path='" + path + "']/@enabled", 1);
+ this.model.setQueryValue("plugin[@path=" + util.escapeXpathString(path) + "]/@enabled", 1);
//Don't init general extensions that cannot live alone
if (!force && oExtension.type == this.GENERAL && !oExtension.alone) {
@@ -104,7 +108,7 @@ module.exports = ext = {
if (oExtension.hook) {
oExtension.hook();
-
+
ide.addEventListener("$event.hook." + oExtension.path, function(callback){
callback.call(this, {ext : oExtension});
});
@@ -112,9 +116,10 @@ module.exports = ext = {
ext : oExtension
});
}
-
- var initTime = parseInt(this.model.queryValue("plugin[@path='" + path + "']/@init") || 0);
- this.model.queryNode("plugin[@path='" + path + "']").setAttribute("hook", Number(new Date() - dt) - initTime);
+
+ var escapedPath = util.escapeXpathString(path);
+ var initTime = parseInt(this.model.queryValue("plugin[@path=" + escapedPath + "]/@init") || 0);
+ this.model.queryNode("plugin[@path=" + escapedPath + "]").setAttribute("hook", Number(new Date() - dt) - initTime);
return oExtension;
},
@@ -167,7 +172,7 @@ module.exports = ext = {
this.extHandlers[oExtension.type].unregister(oExtension);
- this.model.setQueryValue("plugin[@path='" + oExtension.path + "']/@enabled", 0);
+ this.model.setQueryValue("plugin[@path=" + util.escapeXpathString(oExtension.path) + "]/@enabled", 0);
if (oExtension.inited) {
oExtension.destroy();
@@ -177,12 +182,16 @@ module.exports = ext = {
return true;
},
+ getExtension : function(extension) {
+ return this.extLut[extension];
+ },
+
initExtension : function(oExtension, amlParent) {
if (oExtension.inited)
return;
-
+
var dt = new Date();
-
+
oExtension.inited = true; // Prevent Re-entry
var skin = oExtension.skin;
@@ -195,7 +204,7 @@ module.exports = ext = {
//Load markup
var markup = oExtension.markup;
- if (markup)
+ if (markup)
(oExtension.markupInsertionPoint || amlParent || apf.document.documentElement).insertMarkup(markup);
var deps = oExtension.deps;
@@ -217,15 +226,15 @@ module.exports = ext = {
}
oExtension.init(amlParent);
-
+
ide.addEventListener("$event.init." + oExtension.path, function(callback){
callback.call(this, {ext : oExtension});
});
ide.dispatchEvent("init." + oExtension.path, {
ext : oExtension
});
-
- this.model.queryNode("plugin[@path='" + oExtension.path + "']").setAttribute("init", Number(new Date() - dt));
+
+ this.model.queryNode("plugin[@path=" + util.escapeXpathString(oExtension.path) + "]").setAttribute("init", Number(new Date() - dt));
},
enableExt : function(path) {
@@ -234,7 +243,7 @@ module.exports = ext = {
return;
ext.enable();
- this.model.setQueryValue("plugin[@path='" + path + "']/@enabled", 1);
+ this.model.setQueryValue("plugin[@path=" + util.escapeXpathString(path) + "]/@enabled", 1);
},
disableExt : function(path) {
@@ -243,7 +252,7 @@ module.exports = ext = {
return;
ext.disable();
- this.model.setQueryValue("plugin[@path='" + path + "']/@enabled", 0);
+ this.model.setQueryValue("plugin[@path=" + util.escapeXpathString(path) + "]/@enabled", 0);
},
execCommand: function(cmd, data) {
View
222 plugins-client/cloud9.core/www/core/ide.js
@@ -9,6 +9,7 @@ var ide; //Global on purpose!!!!
define(function(require, exports, module) {
var Document = require("core/document");
var util = require("core/util");
+ var SMITH_IO = require("smith.io");
ide = new apf.Class().$init();
@@ -30,7 +31,7 @@ define(function(require, exports, module) {
this.env = window.cloud9config.env;
this.local = window.cloud9config.local;
- this.loggedIn = parseInt(this.uid) > 0;
+ this.loggedIn = parseInt(this.uid, 10) > 0;
this.onLine = false;
this.offlineFileSystemSupport = false;
@@ -79,181 +80,92 @@ define(function(require, exports, module) {
ide.start();
// fire up the socket connection:
- var options = {
- "remember transport": false,
- transports: window.cloud9config.socketIoTransports,
- reconnect: false,
- resource: window.cloud9config.socketIoUrl,
- "connect timeout": 500,
- "try multiple transports": true,
- "transport options": {
- "xhr-polling": {
- timeout: 60000
- },
- "jsonp-polling": {
- timeout: 60000
- }
- }
- };
+ if (window.cloud9config.debug)
+ console.info("Connecting", JSON.parse(window.cloud9config.smithIo));
+
+ SMITH_IO.connect(JSON.parse(window.cloud9config.smithIo), function(err, connection) {
+ if (err)
+ return console.error(err);
+
+ ide.connection = connection;
+
+ connection.on("connect", function() {
+ if (window.cloud9config.debug)
+ console.info("Connected");
- var retries = 0;
- ide.socketConnect = function() {
- // NOTE: This is a workaround for an init bug in socket.io
- // @see https://github.com/LearnBoost/socket.io-client/issues/390
- if (!ide.socket.socket.transport) {
- // Try and connect until we succeed.
- // NOTE: This may log a connection error to the error console but will recover gracefully and eventually connect.
- ide.socketDisconnect();
- } else {
- retries = 0;
-
ide.connecting = true;
- ide.socket.json.send({
+ // send over the internal method, otherwise it'll be queued
+ // because we aren't fully attached to the server yet
+ connection.send({
command: "attach",
sessionId: ide.sessionId,
workspaceId: ide.workspaceId
});
- }
- };
-
- ide.socketDisconnect = function() {
- //Do Nothing
- };
-
- ide.reconnectIfNeeded = function(){
- var sock = ide.socket.socket;
- if (!sock.connected && !sock.connecting && !sock.reconnecting) { //ide.loggedIn
- retries++;
- if (retries < 10 || retries < 60 && retries % 10 == 0 || retries % 50 == 0) {
- sock.disconnect();
- sock.remainingTransports = null;
- sock.connect();
-
- if (retries == 5) {
- ide.dispatchEvent("socketDisconnect");
- ide.connected = false;
- }
- }
- }
- }
-
- ide.socketMessage = function(message) {
- if (typeof message == "string") {
- try {
- message = JSON.parse(message);
- }
- catch(e) {
- window.console && console.error("Error parsing socket message", e, "message:", message);
- return;
- }
- }
-
- if (message.type == "attached") {
- ide.connecting = false;
- ide.connected = true;
- ide.dispatchEvent("socketConnect"); //This is called too often!!
- }
-
- if (message.type === "error") {
- // TODO: Don't display all errors?
- if (ide.dispatchEvent("showerrormessage", message) !== false) {
- util.alert(
- "Error on server",
- "Received following error from server:",
- JSON.stringify(message.message)
- );
- }
- }
+ });
+ connection.on("disconnect", function(reason) {
+ if (window.cloud9config.debug)
+ console.info("Disconnected");
- ide.dispatchEvent("socketMessage", {
- message: message
+ ide.connected = false;
+ ide.dispatchEvent("socketDisconnect");
});
- };
- // for unknown reasons io is sometimes undefined
- try {
- ide.socket = io.connect(null, options);
-
- var transportReadyHandler = function(){
- setInterval(ide.reconnectIfNeeded, 100);
-
- ide.socket.removeListener("connect_failed", transportReadyHandler);
- ide.socket.removeListener("error", transportReadyHandler);
- ide.socket.removeListener("connecting", transportReadyHandler);
- }
-
- ide.socket.on("connect_failed", transportReadyHandler);
- ide.socket.on("error", transportReadyHandler);
- ide.socket.on("connecting", transportReadyHandler);
-
- ide.socket.on("message", ide.socketMessage);
- ide.socket.on("connect", ide.socketConnect);
- ide.socket.on("disconnect", ide.socketDisconnect);
- }
- catch (e) {
- util.alert(
- "Error starting up",
- "Error starting up the IDE",
- "There was an error starting up the IDE.<br>Please clear your browser cache and reload the page.",
- function() {
- window.location.reload();
+ connection.on("message", function(message) {
+ if (typeof message == "string") {
+ try {
+ message = JSON.parse(message);
+ }
+ catch(e) {
+ window.console && console.error("Error parsing socket message", e, "message:", message);
+ return;
+ }
}
- );
- var socketIoScriptEl = Array.prototype.slice.call(
- document.getElementsByTagName("script")).filter(function(script) {
- return script.src && script.src.indexOf("socket.io.js") >= 0;
+ if (message.type == "attached") {
+ ide.connecting = false;
+ ide.connected = true;
+ ide.dispatchEvent("socketConnect");
}
- )[0];
- var status;
- if (socketIoScriptEl) {
- apf.ajax(socketIoScriptEl.src, {
- callback: function(data, state, extra) {
- try {
- status = parseInt(extra.http.status, 10);
- } catch(ex) {}
-
- apf.dispatchEvent("error", {
- message: "socket.io client lib not loaded",
- error: {
- status: status,
- state: state,
- data: data,
- extra: extra
- }
- });
+ if (message.type === "error") {
+ // TODO: Don't display all errors?
+ if (ide.dispatchEvent("showerrormessage", message) !== false) {
+ util.alert(
+ "Error on server",
+ "Received following error from server:",
+ JSON.stringify(message.message)
+ );
}
+ }
+
+ ide.dispatchEvent("socketMessage", {
+ message: message
});
- } else {
- apf.dispatchEvent("error", {
- message: "socket.io client lib not loaded",
- error: e
- });
- }
- return;
- }
+ });
- this.inited = true;
+ connection.on("away", function() {
+ if (window.cloud9config.debug) console.info("Away");
+ });
+ connection.on("back", function() {
+ if (window.cloud9config.debug) console.info("Back");
+ });
- ide.$msgQueue = [];
- ide.addEventListener("socketConnect", function() {
- while(ide.$msgQueue.length) {
- var q = ide.$msgQueue;
- ide.$msgQueue = [];
- q.forEach(function(msg) {
- ide.socket.json.send(msg);
- });
- }
});
+ this.inited = true;
+
ide.send = function(msg) {
- if (!ide.socket || !ide.socket.socket.connected) {
- ide.$msgQueue.push(msg);
- return;
+ // if we're already connected, then do an action
+ if (ide.connected === true) {
+ ide.connection.send(msg);
+ }
+ else {
+ // otherwise execute when we're done
+ ide.addEventListener("socketConnect", function onConnect() {
+ ide.removeEventListener("socketConnect", onConnect);
+ ide.connection.send(msg);
+ });
}
-
- ide.socket.json.send(msg);
};
ide.getActivePageModel = function() {
View
2  plugins-client/cloud9.core/www/core/settings.js
@@ -145,11 +145,9 @@ module.exports = {
if (resetSettings)
xml = template;
-
// Load from local storage
else if (localStorage[sIdent])
xml = localStorage[sIdent];
-
// Load from template
else if (!cloud9config.settings || cloud9config.settings == "defaults")
xml = template;
View
212 plugins-client/cloud9.core/www/core/util.js
@@ -1,4 +1,4 @@
-/*global tabEditors:true, winQuestion:true, winAlert:true, winAlertHeader:true
+/*global tabEditors:true, winQuestion:true, winAlert:true, winAlertHeader:true
winAlertMsg:true, winConfirm:true */
/**
@@ -17,7 +17,7 @@ exports.escapeXpathString = function(name){
var out = [];
var parts = name.split('"');
parts.each(function(part) {
- out.push(part == '' ? "'\"'" : '"' + part + '"');
+ out.push(part == "" ? "'\"'" : '"' + part + '"');
});
return "concat(" + out.join(", ") + ")";
}
@@ -33,9 +33,9 @@ exports.alert = function(title, header, msg, onhide) {
apf.document.documentElement.insertMarkup(markup);
winAlert.show();
- winAlert.setAttribute('title', title);
- winAlertHeader.$ext.innerHTML = header;
- winAlertMsg.$ext.innerHTML = msg;
+ winAlert.setAttribute("title", title);
+ winAlertHeader.$ext.innerHTML = exports.escapeXml(header);
+ winAlertMsg.$ext.innerHTML = exports.escapeXml(msg);
if (onhide)
winAlert.onhide = function() {
winAlertMsg.onhide = null;
@@ -51,8 +51,8 @@ exports.confirm = function(title, header, msg, onconfirm, oncancel) {
winConfirm.show();
winConfirm.setAttribute("title", title);
- winConfirmHeader.$ext.innerHTML = header;
- winConfirmMsg.$ext.innerHTML = msg;
+ winConfirmHeader.$ext.innerHTML = exports.escapeXml(header);
+ winConfirmMsg.$ext.innerHTML = exports.escapeXml(msg);
btnConfirmOk.onclick = onconfirm;
btnConfirmCancel.onclick = oncancel;
};
@@ -63,8 +63,8 @@ exports.question = function(title, header, msg, onyes, onyestoall, onno, onnotoa
winQuestion.show();
winQuestion.setAttribute("title", title);
- winQuestionHeader.$ext.innerHTML = header;
- winQuestionMsg.$ext.innerHTML = msg;
+ winQuestionHeader.$ext.innerHTML = exports.escapeXml(header);
+ winQuestionMsg.$ext.innerHTML = exports.escapeXml(msg);
btnQuestionYes.onclick = onyes;
btnQuestionYesToAll.onclick = onyestoall;
btnQuestionNo.onclick = onno;
@@ -84,11 +84,12 @@ exports.removeInteractive = function (amlNode) {
function confirm(file) {
var name = file.getAttribute("name");
var type = file.getAttribute("type");
- require("core/util").question(
+ exports.question(
"Confirm Remove",
"You are about to remove the " + (type || "item") + " " + name,
"Do you want continue? (This change cannot be undone)",
function () { // Yes
+ file.setAttribute("deleted", true);
amlNode.confirmed = true;
amlNode.remove(file);
amlNode.confirmed = false;
@@ -101,6 +102,7 @@ exports.removeInteractive = function (amlNode) {
amlNode.confirmed = true;
amlNode.remove(file);
files.forEach(function (file) {
+ file.setAttribute("deleted", true);
amlNode.remove(file);
});
amlNode.confirmed = false;
@@ -127,32 +129,32 @@ exports.removeInteractive = function (amlNode) {
};
var SupportedIcons = {
- "application/xhtml+xml":'html',
+ "application/xhtml+xml":"html",
"text/css": "css",
"text/x-scss": "css",
"text/x-sass": "css",
- "text/html":'html',
- "application/pdf":'page_white_acrobat',
- "image":'image',
- "application/xml":'page_white_code_red',
+ "text/html":"html",
+ "application/pdf":"page_white_acrobat",
+ "image":"image",
+ "application/xml":"page_white_code_red",
"image/svg+xml": "page_white_picture",
- "text/plain": 'page_white_text',
- "application/javascript": 'page_white_code',
- "application/json": 'page_white_code',
- "text/x-script.python": 'page_white_code',
- "text/x-script.ocaml": 'page_white_code',
- "text/x-script.clojure": 'page_white_code',
- "application/x-httpd-php": 'page_white_php',
+ "text/plain": "page_white_text",
+ "application/javascript": "page_white_code",
+ "application/json": "page_white_code",
+ "text/x-script.python": "page_white_code",
+ "text/x-script.ocaml": "page_white_code",
+ "text/x-script.clojure": "page_white_code",
+ "application/x-httpd-php": "page_white_php",
"application/x-sh": "page_white_wrench",
- "text/x-coldfusion": 'page_white_coldfusion',
+ "text/x-coldfusion": "page_white_coldfusion",
"text/x-script.ruby": "page_white_ruby",
- "text/x-script.coffeescript": 'page_white_cup',
- "text/cpp": 'page_white_cplusplus',
- "text/x-c": 'page_white_c',
- "text/x-csharp": 'page_white_csharp',
- "text/text/x-java-source": 'page_white_cup',
- "text/x-markdown": 'page_white_text',
- "text/x-xquery": 'page_white_code'
+ "text/x-script.coffeescript": "page_white_cup",
+ "text/cpp": "page_white_cplusplus",
+ "text/x-c": "page_white_c",
+ "text/x-csharp": "page_white_csharp",
+ "text/text/x-java-source": "page_white_cup",
+ "text/x-markdown": "page_white_text",
+ "text/x-xquery": "page_white_code"
};
var contentTypes = {
@@ -222,11 +224,13 @@ var contentTypes = {
"sh": "application/x-sh",
"bash": "application/x-sh",
- "xq": "text/x-xquery"
+ "xq": "text/x-xquery",
+
+ "terminal": "terminal"
};
exports.getFileIcon = function(xmlNode) {
- var name = xmlNode.getAttribute('name');
+ var name = xmlNode.getAttribute("name");
var icon = "page_white_text";
var ext;
@@ -239,123 +243,18 @@ exports.getFileIcon = function(xmlNode) {
exports.getContentType = function(filename) {
- var type = filename.split(".").pop().toLowerCase() || "";
+ var type = filename.split(".").pop().split("!").pop().toLowerCase() || "";
return contentTypes[type] || "text/plain";
};
-exports.xmlEntityMap = {
- "quot": "34", "amp": "38", "apos": "39", "lt": "60", "gt": "62",
- "nbsp": "160", "iexcl": "161", "cent": "162", "pound": "163", "curren": "164",
- "yen": "165", "brvbar": "166", "sect": "167", "uml": "168", "copy": "169",
- "ordf": "170", "laquo": "171", "not": "172", "shy": "173", "reg": "174",
- "macr": "175", "deg": "176", "plusmn": "177", "sup2": "178", "sup3": "179",
- "acute": "180", "micro": "181", "para": "182", "middot": "183", "cedil": "184",
- "sup1": "185", "ordm": "186", "raquo": "187", "frac14": "188", "frac12": "189",
- "frac34": "190", "iquest": "191", "agrave": "192", "aacute": "193",
- "acirc": "194", "atilde": "195", "auml": "196", "aring": "197", "aelig": "198",
- "ccedil": "199", "egrave": "200", "eacute": "201", "ecirc": "202",
- "euml": "203", "igrave": "204", "iacute": "205", "icirc": "206", "iuml": "207",
- "eth": "208", "ntilde": "209", "ograve": "210", "oacute": "211", "ocirc": "212",
- "otilde": "213", "ouml": "214", "times": "215", "oslash": "216", "ugrave": "217",
- "uacute": "218", "ucirc": "219", "uuml": "220", "yacute": "221", "thorn": "222",
- "szlig": "223", "agrave": "224", "aacute": "225", "acirc": "226", "atilde": "227",
- "auml": "228", "aring": "229", "aelig": "230", "ccedil": "231", "egrave": "232",
- "eacute": "233", "ecirc": "234", "euml": "235", "igrave": "236", "iacute": "237",
- "icirc": "238", "iuml": "239", "eth": "240", "ntilde": "241", "ograve": "242",
- "oacute": "243", "ocirc": "244", "otilde": "245", "ouml": "246", "divide": "247",
- "oslash": "248", "ugrave": "249", "uacute": "250", "ucirc": "251", "uuml": "252",
- "yacute": "253", "thorn": "254", "yuml": "255", "oelig": "338", "oelig": "339",
- "scaron": "352", "scaron": "353", "yuml": "376", "fnof": "402", "circ": "710",
- "tilde": "732", "alpha": "913", "beta": "914", "gamma": "915", "delta": "916",
- "epsilon": "917", "zeta": "918", "eta": "919", "theta": "920", "iota": "921",
- "kappa": "922", "lambda": "923", "mu": "924", "nu": "925", "xi": "926",
- "omicron": "927", "pi": "928", "rho": "929", "sigma": "931", "tau": "932",
- "upsilon": "933", "phi": "934", "chi": "935", "psi": "936", "omega": "937",
- "alpha": "945", "beta": "946", "gamma": "947", "delta": "948", "epsilon": "949",
- "zeta": "950", "eta": "951", "theta": "952", "iota": "953", "kappa": "954",
- "lambda": "955", "mu": "956", "nu": "957", "xi": "958", "omicron": "959",
- "pi": "960", "rho": "961", "sigmaf": "962", "sigma": "963", "tau": "964",
- "upsilon": "965", "phi": "966", "chi": "967", "psi": "968", "omega": "969",
- "thetasym": "977", "upsih": "978", "piv": "982", "ensp": "8194", "emsp": "8195",
- "thinsp": "8201", "zwnj": "8204", "zwj": "8205", "lrm": "8206", "rlm": "8207",
- "ndash": "8211", "mdash": "8212", "lsquo": "8216", "rsquo": "8217",
- "sbquo": "8218", "ldquo": "8220", "rdquo": "8221", "bdquo": "8222",
- "dagger": "8224", "dagger": "8225", "bull": "8226", "hellip": "8230",
- "permil": "8240", "prime": "8242", "prime": "8243", "lsaquo": "8249",
- "rsaquo": "8250", "oline": "8254", "frasl": "8260", "euro": "8364",
- "image": "8465", "weierp": "8472", "real": "8476", "trade": "8482",
- "alefsym": "8501", "larr": "8592", "uarr": "8593", "rarr": "8594",
- "darr": "8595", "harr": "8596", "crarr": "8629", "larr": "8656", "uarr": "8657",
- "rarr": "8658", "darr": "8659", "harr": "8660", "forall": "8704", "part": "8706",
- "exist": "8707", "empty": "8709", "nabla": "8711", "isin": "8712",
- "notin": "8713", "ni": "8715", "prod": "8719", "sum": "8721", "minus": "8722",
- "lowast": "8727", "radic": "8730", "prop": "8733", "infin": "8734",
- "ang": "8736", "and": "8743", "or": "8744", "cap": "8745", "cup": "8746",
- "int": "8747", "there4": "8756", "sim": "8764", "cong": "8773", "asymp": "8776",
- "ne": "8800", "equiv": "8801", "le": "8804", "ge": "8805", "sub": "8834",
- "sup": "8835", "nsub": "8836", "sube": "8838", "supe": "8839", "oplus": "8853",
- "otimes": "8855", "perp": "8869", "sdot": "8901", "lceil": "8968",
- "rceil": "8969", "lfloor": "8970", "rfloor": "8971", "lang": "9001",
- "rang": "9002", "loz": "9674", "spades": "9824", "clubs": "9827",
- "hearts": "9829", "diams": "9830"
-};
-
-/**
- * Escape an xml string making it ascii compatible.
- * @param {String} str the xml string to escape.
- * @param {Boolean} noQuotes do not escape quotes.
- * @return {String} the escaped string.
- */
-exports.escapeXml = function(str, noQuotes) {
- str = (String(str) || "")
- .replace(/&/g, "&#38;")
- .replace(/</g, "&#60;")
- .replace(/>/g, "&#62;");
- if (!noQuotes) {
- str = str.replace(/"/g, "&#34;")
- .replace(/'/g, "&#39;");
- }
- return str.replace(/&([a-z]+);/gi, function(a, m) {
- if (exports.xmlEntityMap[(m = m.toLowerCase())])
- return "&#" + exports.xmlEntityMap[m] + ";";
- return a;
- });
-};
-
// taken from http://xregexp.com/
exports.escapeRegExp = function(str) {
return str.replace(/[-[\]{}()*+?.,\\^$|#\s"']/g, "\\$&");
-}
-
-/**
- * Determines whether a string is true in the html attribute sense.
- * @param {mixed} value the variable to check
- * Possible values:
- * true The function returns true.
- * 'true' The function returns true.
- * 'on' The function returns true.
- * 1 The function returns true.
- * '1' The function returns true.
- * @return {Boolean} whether the string is considered to imply truth.
- */
-exports.isTrue = function(c){
- return (c === true || c === "true" || c === "on" || typeof c == "number" && c > 0 || c === "1");
};
-/**
- * Determines whether a string is false in the html attribute sense.
- * @param {mixed} value the variable to check
- * Possible values:
- * false The function returns true.
- * 'false' The function returns true.
- * 'off' The function returns true.
- * 0 The function returns true.
- * '0' The function returns true.
- * @return {Boolean} whether the string is considered to imply untruth.
- */
-exports.isFalse = function(c){
- return (c === false || c === "false" || c === "off" || c === 0 || c === "0");
-};
+exports.escapeXml = apf.escapeXML;
+exports.isTrue = apf.isTrue;
+exports.isFalse = apf.isFalse;
exports.replaceStaticPrefix = function (string) {
return string.replace(new RegExp("{ide.staticPrefix}", "g"), window.cloud9config.staticUrl);
@@ -384,7 +283,7 @@ exports.pageIsCode = function(page) {
if (!page) {
throw new Error("Page object parameter missing");
}
-
+
return page.type === "ext/code/code";
};
@@ -406,4 +305,33 @@ exports.getDocPath = function(page) {
return exports.stripWSFromPath(page.name);
};
+/**
+ * Generate an XML tag that contains properties according to a property-map defined
+ * in `attrs`.
+ *
+ * @param {String} tag Name of the XML tag
+ * @param {Object} attrs Map of name-value pairs of XML properties
+ * @param {Boolean} noclose If TRUE, the XML tag will be returned UNclosed. Defaults to FALSE.
+ * @type {String}
+ */
+exports.toXmlTag = function (tag, attrs, noclose) {
+ return "<" + tag + " " + exports.toXmlAttributes(attrs) + (noclose ? ">" : " />");
+};
+
+/**
+ * Converts a map of name-value pairs to XML properties.
+ *
+ * @param {Object} obj Map of name-value pairs of XML properties
+ * @type {String}
+ */
+exports.toXmlAttributes = function(obj) {
+ var xml = Object.keys(obj)
+ .map(function (k) {
+ return k + '="' + apf.escapeXML(obj[k]) + '"';
+ })
+ .join(" ");
+
+ return xml;
+};
+
});
View
54 plugins-client/ext.anims/anims.js
@@ -18,13 +18,13 @@ module.exports = ext.register("ext/anims/anims", {
dev : "Ajax.org",
alone : true,
type : ext.GENERAL,
-
+
animateMultiple : function(tweens, finish) {
var shouldAnimate = apf.isTrue(settings.model.queryValue("general/@animateui"));
-
+
if (shouldAnimate) {
var duration = 0;
- tweens.forEach(function(options) {
+ tweens.forEach(function(options) {
var node = options.node;
Firmin.animate(node.$ext || node, options, options.duration || 0.2, function() {
(node.$ext || node).style[apf.CSSPREFIX + "TransitionDuration"] = "";
@@ -32,62 +32,59 @@ module.exports = ext.register("ext/anims/anims", {
});
duration = Math.max(duration, options.duration || 0.2);
});
-
+
setTimeout(function(){
finish && finish();
}, (duration * 1000) + 50);
}
else {
//@todo set value
-
+
finish && finish();
}
},
-
+
animate : function(aNode, options, finish){
var shouldAnimate = apf.isTrue(settings.model.queryValue("general/@animateui"));
-
+
if (shouldAnimate) {
Firmin.animate(aNode.$ext || aNode, options, options.duration || 0.2, function() {
(aNode.$ext || aNode).style[apf.CSSPREFIX + "TransitionDuration"] = "";
- //apf.layout.forceResize();
-
finish && finish(); //setTimeout(finish, 30);
});
}
else {
//@todo set value
-
finish && finish();
}
},
-
+
animateSplitBoxNode : function(aNode, options, finish){
var shouldAnimate = apf.isTrue(settings.model.queryValue("general/@animateui"));
-
+
var pNode = aNode.parentNode;
var firstChild = pNode.getFirstChild();
var lastChild = pNode.getSecondChild();
var isFirst, oNode = (isFirst = aNode == firstChild) ? lastChild : firstChild;
if (oNode == aNode || !oNode.visible)
throw new Error("animating object that has no partner");
-
+
var to2;
if (pNode.$vbox) {
to2 = { timingFunction : options.timingFunction };
if (isFirst)
- to2.top = (parseInt(options.height) + pNode.$edge[0] + pNode.padding) + "px";
+ to2.top = (parseInt(options.height, 10) + pNode.$edge[0] + pNode.padding) + "px";
else
- to2.bottom = (parseInt(options.height) + pNode.$edge[2] + pNode.padding) + "px";
+ to2.bottom = (parseInt(options.height, 10) + pNode.$edge[2] + pNode.padding) + "px";
}
else {
to2 = { timingFunction : options.timingFunction };
if (isFirst)
- to2.left = (parseInt(options.width) + pNode.$edge[3] + pNode.padding) + "px";
+ to2.left = (parseInt(options.width, 10) + pNode.$edge[3] + pNode.padding) + "px";
else
- to2.right = (parseInt(options.width) + pNode.$edge[1] + pNode.padding) + "px";
+ to2.right = (parseInt(options.width, 10) + pNode.$edge[1] + pNode.padding) + "px";
}
-
+
if (shouldAnimate && !options.immediate) {
ide.dispatchEvent("animate", {
type: "splitbox",
@@ -96,23 +93,20 @@ module.exports = ext.register("ext/anims/anims", {
options: options,
options2: to2
});
-
+
Firmin.animate(aNode.$ext, options, options.duration || 0.2, function() {
aNode.$ext.style[apf.CSSPREFIX + "TransitionDuration"] = "";
- //apf.layout.forceResize();
});
Firmin.animate(oNode.$ext, to2, options.duration || 0.2, function() {
oNode.$ext.style[apf.CSSPREFIX + "TransitionDuration"] = "";
- //apf.layout.forceResize();
-
-
+
if (aNode.parentNode) {
if (pNode.$vbox)
- aNode.setHeight(parseInt(options.height));
+ aNode.setHeight(parseInt(options.height, 10));
else
- aNode.setWidth(parseInt(options.width));
+ aNode.setWidth(parseInt(options.width, 10));
}
-
+
finish && finish(); //setTimeout(finish, 30);
});
}
@@ -126,15 +120,15 @@ module.exports = ext.register("ext/anims/anims", {
var dir = isFirst ? "left" : "right";
}
oNode.$ext.style[dir] = to2[dir];
-
+
finish && finish();
}
},
-
+
init : function(){
-
+
},
-
+
enable : function(){
},
View
74 plugins-client/ext.autosave/autosave.js
@@ -1,4 +1,4 @@
-/*global btnSave:true, tabEditors:true, saveStatus:true*/
+/*global btnSave:true, tabEditors:true */
/*
* Autosave Module for the Cloud9 IDE
*
@@ -10,7 +10,7 @@ define(function(require, exports, module) {
var ide = require("core/ide");
var ext = require("core/ext");
-var Util = require("core/util");
+var Util = require("core/util");
var Save = require("ext/save/save");
var settings = require("ext/settings/settings");
@@ -27,24 +27,30 @@ module.exports = ext.register("ext/autosave/autosave", {
alone: true,
type: ext.GENERAL,
offline: true,
- nodes: [],
-
+ nodes: [ ],
+
docChangeTimeout: null,
docChangeListeners: {},
hook: function() {
- var self = this;
+ var _self = this;
settings.addSettings("General", markupSettings);
ide.addEventListener("settings.load", function(e){
e.ext.setDefaults("general", [["autosaveenabled", "false"]]);
- self.isAutoSaveEnabled = apf.isTrue(e.model.queryValue("general/@autosaveenabled")) || self.tempEnableAutoSave;
+ _self.isAutoSaveEnabled = apf.isTrue(e.model.queryValue("general/@autosaveenabled")) || _self.tempEnableAutoSave;
});
ide.addEventListener("settings.save", function(e) {
if (!e.model.data)
return;
- self.isAutoSaveEnabled = apf.isTrue(e.model.queryValue("general/@autosaveenabled")) || self.tempEnableAutoSave;
+ _self.isAutoSaveEnabled = apf.isTrue(e.model.queryValue("general/@autosaveenabled")) || _self.tempEnableAutoSave;
+ });
+
+ // when we're back online we'll trigger an autosave if enabled
+ ide.addEventListener("afteronline", function() {
+ // the autosave thing will update the UI
+ _self.doAutoSave();
});
btnSave.setAttribute("caption", "");
@@ -62,7 +68,7 @@ module.exports = ext.register("ext/autosave/autosave", {
width : "250px",
hideonclick : true
});
-
+
this.$onOpenFileFn = this.onOpenFile.bind(this);
this.$onCloseFileFn = this.onCloseFile.bind(this);
this.$onBeforeSaveWarning = this.onBeforeSaveWarning.bind(this);
@@ -104,18 +110,12 @@ module.exports = ext.register("ext/autosave/autosave", {
};
}
- if (!Util.isNewPage(page)) {
- this.setSaveButtonCaption();
- }
-
(doc.acedoc || doc).addEventListener("change", this.docChangeListeners[path]);
},
onCloseFile: function(e) {
if (tabEditors.getPages().length == 1)
btnSave.hide();
- else
- this.setSaveButtonCaption(e.page);
this.save(e.page);
},
@@ -125,46 +125,12 @@ module.exports = ext.register("ext/autosave/autosave", {
if (page && this.isAutoSaveEnabled && !Util.isNewPage(page)) {
clearTimeout(this.docChangeTimeout);
this.docChangeTimeout = setTimeout(function(self) {
- self.setSaveButtonCaption();
stripws.disable();
self.save(page);
}, CHANGE_TIMEOUT, this);
}
},
- setSaveButtonCaption: function(page) {
- if (!self.btnSave)
- return;
-
- var SAVING = 0;
- var SAVED = 1;
-
- btnSave.show();
- var page = page || tabEditors.getPage();
- if (page) {
- var hasChanged = Util.pageHasChanged(page);
- if (this.isAutoSaveEnabled && hasChanged) {
- if (btnSave.currentState !== SAVING) {
- apf.setStyleClass(btnSave.$ext, "saving", ["saved"]);
- apf.setStyleClass(saveStatus, "saving", ["saved"]);
- btnSave.currentState = SAVING;
- btnSave.setCaption("Saving");
- }
- }
- else if (!hasChanged) {
- if (btnSave.currentState !== SAVED) {
- apf.setStyleClass(btnSave.$ext, "saved", ["saving"]);
- apf.setStyleClass(saveStatus, "saved", ["saving"]);
- btnSave.currentState = SAVED;
- btnSave.setCaption("Changes saved");
- }
- }
- }
- else {
- btnSave.setCaption("");
- }
- },
-
doAutoSave: function() {
// Take advantage of the interval and dump our offlineQueue into
// localStorage.
@@ -176,7 +142,6 @@ module.exports = ext.register("ext/autosave/autosave", {
this.save(tabEditors.getPage());
},
-
/**
* Autosave#save([page])
* - page(Object): Page that contains the document to be saved. In case it is
@@ -185,6 +150,8 @@ module.exports = ext.register("ext/autosave/autosave", {
* Prompts a save of the desired document.
**/
save: function(page, forceSave) {
+ var _self = this;
+
if (!page || !page.$at)
page = tabEditors.getPage();
@@ -193,15 +160,19 @@ module.exports = ext.register("ext/autosave/autosave", {
if ((forceSave !== true) && (!Util.pageHasChanged(page) || !Util.pageIsCode(page)))
return;
+
+ // not online? then we're not going to save it
+ if (ide.onLine === false) {
+ Save.setUiStateOffline();
+ return;
+ }
var node = page.$doc.getNode();
if (node.getAttribute("newfile") || node.getAttribute("debug"))
return;
- var _self = this;
Save.quicksave(page, function() {
stripws.enable();
- _self.setSaveButtonCaption(page);
}, true);
},
@@ -248,7 +219,6 @@ module.exports = ext.register("ext/autosave/autosave", {
},
disable: function() {
- this.hide();
this.nodes.each(function(item){
item.disable();
});
View
5 plugins-client/ext.clipboard/clipboard.js
@@ -9,6 +9,7 @@ define(function(require, exports, module) {
"use strict";
+var ide = require("core/ide");
var ext = require("core/ext");
var menus = require("ext/menus/menus");
var commands = require("ext/commands/commands");
@@ -31,9 +32,9 @@ module.exports = ext.register("ext/clipboard/clipboard", {
var isAvailable = function(editor, event){
if (apf.activeElement && apf.activeElement.localName == "codeeditor")
- return !(event instanceof KeyboardEvent);
+ return !(event instanceof KeyboardEvent) && !ide.readonly;
- return self.trFiles && apf.activeElement == trFiles && !trFiles.renaming;
+ return self.trFiles && apf.activeElement == trFiles && !trFiles.renaming && !ide.readonly;
};
commands.addCommand({
View
2  plugins-client/ext.closeconfirmation/closeconfirmation.js
@@ -43,7 +43,7 @@ module.exports = ext.register("ext/closeconfirmation/closeconfirmation", {
var changed = false;
tabEditors.getPages().forEach(function(page){
var node = page.$doc.getNode();
- if (node && node.getAttribute("changed") == 1 && page.$doc.getValue())
+ if (node && node.getAttribute("changed") == 1 && page.$doc.getValue() && !node.getAttribute("deleted"))
changed = true;
});
View
82 plugins-client/ext.code/code.js
@@ -39,58 +39,72 @@ apf.actiontracker.actions.aceupdate = function(undoObj, undo){
q[1].redoChanges(q[0]);
};
-// name: ["Caption", "extension", "content-type"]
+// name: ["Menu caption", "extensions", "content-type", "hidden|other"]
var SupportedModes = {
- c9search: ["C9Search", "c9search", "text/x-c9search"],
+ asciidoc: ["AsciiDoc", "asciidoc", "text/x-asciidoc", "other"],
+ c9search: ["C9Search", "c9search", "text/x-c9search", "hidden"],
+ c_cpp: ["C, C++", "c|cc|cpp|cxx|h|hh|hpp", "text/x-c"],
+ clojure: ["Clojure", "clj", "text/x-script.clojure"],
coffee: ["CoffeeScript", "coffee|*Cakefile", "text/x-script.coffeescript"],
- coldfusion: ["ColdFusion", "cfm", "text/x-coldfusion"],
+ coldfusion: ["ColdFusion", "cfm", "text/x-coldfusion", "other"],
csharp: ["C#", "cs", "text/x-csharp"],
css: ["CSS", "css", "text/css"],
+ diff: ["Diff", "diff|patch", "text/x-diff", "other"],
+ glsl: ["Glsl", "glsl|frag|vert", "text/x-glsl", "other"],
golang: ["Go", "go", "text/x-go"],
- groovy: ["Groovy", "groovy", "text/x-groovy"],
- haxe: ["haXe", "hx", "text/haxe"],
+ groovy: ["Groovy", "groovy", "text/x-groovy", "other"],
+ haxe: ["haXe", "hx", "text/haxe", "other"],
html: ["HTML", "htm|html|xhtml", "text/html"],
- c_cpp: ["C/C++", "c|cc|cpp|cxx|h|hh|hpp", "text/x-c"],
- clojure: ["Clojure", "clj", "text/x-script.clojure"],
+ jade: ["Jade", "jade", "text/x-jade"],
java: ["Java", "java", "text/x-java-source"],
+ jsp: ["JSP", "jsp", "text/x-jsp", "other"],
javascript: ["JavaScript", "js", "application/javascript"],
json: ["JSON", "json", "application/json"],
- latex: ["LaTeX", "latex|tex|ltx|bib", "application/x-latex"],
+ jsx: ["JSX", "jsx", "text/x-jsx", "other"],
+ latex: ["LaTeX", "latex|tex|ltx|bib", "application/x-latex", "other"],
less: ["LESS", "less", "text/x-less"],
- liquid: ["Liquid", "liquid", "text/x-liquid"],
+ liquid: ["Liquid", "liquid", "text/x-liquid", "other"],
lua: ["Lua", "lua", "text/x-lua"],
- markdown: ["Markdown", "md|markdown", "text/x-markdown"],
- ocaml: ["OCaml", "ml|mli", "text/x-script.ocaml"],
+ luapage: ["LuaPage" , "lp", "text/x-luapage", "other"],
+ markdown: ["Markdown", "md|markdown", "text/x-markdown", "other"],
+ ocaml: ["OCaml", "ml|mli", "text/x-script.ocaml", "other"],
perl: ["Perl", "pl|pm", "text/x-script.perl"],
- pgsql: ["pgSQL", "pgsql", "text/x-pgsql"],
+ pgsql: ["pgSQL", "pgsql", "text/x-pgsql", "other"],
php: ["PHP", "php|phtml", "application/x-httpd-php"],
- powershell: ["Powershell", "ps1", "text/x-script.powershell"],
+ powershell: ["Powershell", "ps1", "text/x-script.powershell", "other"],
python: ["Python", "py", "text/x-script.python"],
ruby: ["Ruby", "ru|gemspec|rake|rb", "text/x-script.ruby"],
- scad: ["OpenSCAD", "scad", "text/x-scad", "hidden"],
+ scad: ["OpenSCAD", "scad", "text/x-scad", "other"],
scala: ["Scala", "scala", "text/x-scala"],
scss: ["SCSS", "scss|sass", "text/x-scss"],
sh: ["SH", "sh|bash|bat", "application/x-sh"],
sql: ["SQL", "sql", "text/x-sql"],
- svg: ["SVG", "svg", "image/svg+xml"],
+ svg: ["SVG", "svg", "image/svg+xml", "other"],
+ tcl: ["Tcl" , "tcl", "text/x-tcl", "other"],
text: ["Text", "txt", "text/plain", "hidden"],
- textile: ["Textile", "textile", "text/x-web-textile"],
+ textile: ["Textile", "textile", "text/x-web-textile", "other"],
+ typescript: ["Typescript", "ts|str", "text/x-typescript"],
xml: ["XML", "xml|rdf|rss|wsdl|xslt|atom|mathml|mml|xul|xbl", "application/xml"],
xquery: ["XQuery", "xq", "text/x-xquery"],
yaml: ["YAML", "yaml", "text/x-yaml"]
};
-var fileExtensions = {}, ModesCaption = {}, contentTypes = {};
+var fileExtensions = {}, ModesCaption = {}, contentTypes = {}, hiddenMode = {}, otherMode = {};
Object.keys(SupportedModes).forEach(function(name) {
var mode = SupportedModes[name];
mode.caption = mode[0];
mode.mime = mode[2];
- mode.hidden = !!mode[3];
+ mode.hidden = mode[3] == "hidden" ? true : false;
+ mode.other = mode[3] == "other" ? true : false;
mode.ext = mode[1];
mode.ext.split("|").forEach(function(ext) {
fileExtensions[ext] = name;
});
ModesCaption[mode.caption] = name;
+
+ hiddenMode[mode.caption] = mode.hidden;
+ otherMode[mode.caption] = mode.other;
+
contentTypes[mode.mime] = name;
});
@@ -106,6 +120,7 @@ module.exports = ext.register("ext/code/code", {
fileExtensions : Object.keys(fileExtensions),
supportedModes : Object.keys(SupportedModes),
+ prevSelection : null,
getState : function(doc) {
doc = doc ? doc.acesession : this.getDocument();
@@ -546,8 +561,8 @@ module.exports = ext.register("ext/code/code", {
addEditorMenu("Selection/Select to Line Start", "selecttolinestart"),
menus.addItemByPath("Selection/~", new apf.divider(), c += 100),
- addEditorMenu("Selection/Select to Document Start", "selecttostart"),
- addEditorMenu("Selection/Select to Document End", "selecttoend")
+ addEditorMenu("Selection/Select to Document End", "selecttoend"),
+ addEditorMenu("Selection/Select to Document Start", "selecttostart")
);
c = 0;
@@ -674,17 +689,38 @@ module.exports = ext.register("ext/code/code", {
group : grpSyntax
}), c += 100),
+ otherGrpSyntax = new apf.group({
+ type : ""
+ }),
+
+ menus.addItemByPath("View/Syntax/Other", new apf.item({
+ group : otherGrpSyntax
+ }), c + 90000),
+
menus.addItemByPath("View/Syntax/~", new apf.divider(), c += 100)
);
for (var mode in ModesCaption) {
- if (ModesCaption[mode][3] == "hidden")
+ var path;
+ if (hiddenMode[mode])
continue;
+
this.menus.push(
- menus.addItemByPath("View/Syntax/" + mode, new apf.item({
+ menus.addItemByPath("View/Syntax/" + (otherMode[mode] ? "Other/" + mode : mode), new apf.item({
type: "radio",
value: ModesCaption[mode],
- group : grpSyntax
+ group : otherMode[mode] ? otherGrpSyntax : grpSyntax,
+ onclick : function (e) {
+ if (_self.prevSelection == null)
+ _self.prevSelection = this;
+ else {
+ _self.prevSelection.uncheck();
+ if (_self.prevSelection.group.selectedItem.caption == "Other") {
+ _self.prevSelection.group.selectedItem.$ext.setAttribute("class", "menu_item submenu")
+ }
+ _self.prevSelection = this;
+ }
+ }
}), c += 100)
);
}
View
3  plugins-client/ext.code/code.xml
@@ -38,9 +38,6 @@
/>
<a:menu id="mnuCtxEditor">
- <a:item command="undo">Undo</a:item>
- <a:item command="redo">Redo</a:item>
- <a:divider />
<a:item id="mnuCtxEditorCut" command="cut">Cut</a:item>
<a:item command="copy">Copy</a:item>
<a:item command="paste">Paste</a:item>
View
2  plugins-client/ext.code/settings.xml
@@ -6,7 +6,7 @@
<a:checkbox position="4000" class="underlined" label="Highlight Gutter Line" value="[editors/code/@gutterline]" skin="checkbox_grey" />
<a:checkbox position="5000" class="underlined" id="cbsh" label="Show Invisible Characters" value="[editors/code/@showinvisibles]" skin="checkbox_grey" />
<a:checkbox position="6000" class="underlined" label="Show Gutter" value="[editors/code/@gutter]" skin="checkbox_grey" />
- <a:checkbox position="6500" class="underlined" label="Show IndentGuides" value="[editors/code/@showindentguides]" skin="checkbox_grey" />
+ <a:checkbox position="6500" class="underlined" label="Show Indent Guides" value="[editors/code/@showindentguides]" skin="checkbox_grey" />
<a:checkbox position="7000" class="underlined" label="Highlight Selected Word" value="[editors/code/@highlightselectedword]" skin="checkbox_grey" />
<a:checkbox position="8000" class="underlined" label="Auto-hide Horizontal Scrollbar" value="[editors/code/@autohidehorscrollbar]" skin="checkbox_grey" />
<a:checkbox position="9000" class="underlined" label="Fade Fold Widgets" value="[editors/code/@fadefoldwidgets]" skin="checkbox_grey" />
View
9 plugins-client/ext.codecomplete/snippet_completer.js
@@ -16,7 +16,14 @@ completer.handlesLanguage = function(language) {
completer.fetchText = function(staticPrefix, path) {
var xhr = new XMLHttpRequest();
xhr.open('GET', staticPrefix + "/" + path, false);
- xhr.send();
+ try {
+ xhr.send();
+ }
+ // Likely we got a cross-script error (equivalent with a 404 in our cloud setup)
+ catch(e) {
+ return false;
+ }
+
if(xhr.status === 200)
return xhr.responseText;
else
View
2  plugins-client/ext.codetools/codetools.js
@@ -22,7 +22,7 @@ module.exports = ext.register("ext/codetools/codetools", {
register: function(plugin) {
var _self = this;
- if (ceEditor)
+ if (typeof ceEditor !== "undefined")
return attachCE();
ide.addEventListener("init.ext/code/code", attachCE);
View
6 plugins-client/ext.colorpicker/colorpicker.js
@@ -69,7 +69,11 @@ module.exports = ext.register("ext/colorpicker/colorpicker", {
name : "Colorpicker Code Tool",
alone : true,
type : ext.GENERAL,
- skin : skin,
+ skin : {
+        id   : "colorpicker",
+        data : skin,
+        "media-path" : ide.staticPrefix + "/ext/colorpicker/images/"
+    },
nodes : [],
View
4 plugins-client/ext.colorpicker/colorpicker.xml
@@ -1,8 +1,4 @@
<a:application xmlns:a="http://ajax.org/2005/aml">
- <a:skin id="colorpicker"
- src = "{require('ext/colorpicker/colorpicker').skin}"
- media-path = "{ide.staticPrefix}/ext/colorpicker/images/" />
-
<a:menu id="mnuColorPicker" skin=