Skip to content

Commit 186fb45

Browse files
committed
Merge branch 'master' of https://github.com/jgoldhammer/js-console into jgoldhammer-master
Conflicts: .gitignore javascript-console-repo/.classpath javascript-console-repo/.project javascript-console-repo/build.properties javascript-console-repo/build.xml javascript-console-repo/config/alfresco/extension/templates/webscripts/de/fme/jsconsole/createscript.put.desc.xml javascript-console-repo/config/alfresco/extension/templates/webscripts/de/fme/jsconsole/saveScript.put.desc.xml javascript-console-repo/src/main/amp/config/alfresco/extension/templates/webscripts/de/fme/jsconsole/createscript.put.desc.xml javascript-console-repo/src/main/amp/config/alfresco/extension/templates/webscripts/de/fme/jsconsole/createscript.put.json.ftl javascript-console-repo/src/main/amp/config/alfresco/extension/templates/webscripts/de/fme/jsconsole/listscripts.get.js javascript-console-repo/src/main/java/de/fme/jsconsole/ExecuteWebscript.java javascript-console-share/.classpath javascript-console-share/build.properties javascript-console-share/build.xml javascript-console-share/source/web/fme/components/jsconsole/codemirror/javascript.js javascript-console-share/source/web/fme/components/jsconsole/codemirror/mode/freemarker/parsefreemarker.js javascript-console-share/source/web/fme/components/jsconsole/codemirror/mode/javascript/javascript.js javascript-console-share/source/web/fme/components/jsconsole/codemirror/parsefreemarker.js javascript-console-share/src/main/amp/config/alfresco/site-webscripts/de/fme/components/jsconsole/javascript-console.get.html.ftl javascript-console-share/src/main/amp/config/alfresco/site-webscripts/de/fme/components/jsconsole/javascript-console.get.properties javascript-console-share/src/main/amp/config/alfresco/site-webscripts/de/fme/components/jsconsole/javascript-console.get_en.properties javascript-console-share/src/main/amp/web/fme/components/jsconsole/codemirror/codemirror.css javascript-console-share/src/main/amp/web/fme/components/jsconsole/codemirror/codemirror.js javascript-console-share/src/main/amp/web/fme/components/jsconsole/codemirror/htmlmixed.js javascript-console-share/src/main/amp/web/fme/components/jsconsole/codemirror/javascript.js javascript-console-share/src/main/amp/web/fme/components/jsconsole/codemirror/parsefreemarker.js javascript-console-share/src/main/amp/web/fme/components/jsconsole/codemirror/xml.js
2 parents 958dbc9 + dd8ddaa commit 186fb45

File tree

169 files changed

+54498
-694
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

169 files changed

+54498
-694
lines changed

README.md

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,39 @@
1-
21
Javascript Console Admin Console component for Alfresco 3.4/4.0
32
===============================================================
43

5-
Author: Florian Maul (fme AG)
4+
Author: Florian Maul (fme AG)
5+
            Jens Goldhammer (fme AG)
66

77
This project contains a Javascript Console component for the Alfresco Share's
88
Administration Console, that enables the execution of arbitrary javascript code
99
in the repository.
1010

11+
Download newest rc version for Alfresco 4.x
12+
--------------------------------------------
13+
14+
[Share Jar for 4.x](https://github.com/jgoldhammer/js-console/raw/5d083f5c594f679dc015c9dc1b0dd9132f5a4a9b/javascript-console-dist/javascript-console-share-0.6rc.jar)
15+
[Repo Jar for 4.x](https://github.com/jgoldhammer/js-console/raw/5d083f5c594f679dc015c9dc1b0dd9132f5a4a9b/javascript-console-dist/javascript-console-repo-0.6rc.jar)
16+
17+
New Features
18+
--------
19+
20+
+ new json output view for validation and formatting json from the freemarker template processing
21+
![JSONView](https://raw.github.com/jgoldhammer/js-console/master/javascript-console-share/screenshots/json_output_view.png)
22+
23+
+ JSHint integration in javascript editor- it validates input on the fly and integrates the alfresco root objects like search, node...
24+
![JSHINT](https://raw.github.com/jgoldhammer/js-console/master/javascript-console-share/screenshots/jshint_live_integration.png)
25+
26+
+ performance statistics - displays overall time, time for javascript and freemarker processing, time for network and time for rest of the server side processing
27+
![PERFORMANCE](https://raw.github.com/jgoldhammer/js-console/master/javascript-console-share/screenshots/performance_stats.png)
28+
29+
+ Editor Theming - allows you to theme the javascript and freemarker codemirror editor
30+
![Editor themes](https://raw.github.com/jgoldhammer/js-console/master/javascript-console-share/screenshots/editor_themes.png)
31+
32+
+ better error marking of server runtime errors in the editors
33+
![Error](https://raw.github.com/jgoldhammer/js-console/master/javascript-console-share/screenshots/js_error_detection_and_marking.png)
34+
35+
+ update codemirror to version 3 and enabling many codemirror addons(activeline, hightlight selection, new autocomplete module)
36+
1137

1238
Installation
1339
------------
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
XDOCLETBUILDERACTIVE=true
2+
XDOCLETHOME=
3+
XDOCLETUSEGLOBAL=true
4+
XDOCLETVERSION=1.2.1
5+
eclipse.preferences.version=1
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
eclipse.preferences.version=1
2+
org.eclipse.ltk.core.refactoring.enable.project.refactoring.history=false
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<faceted-project>
3+
<installed facet="java" version="1.6"/>
4+
</faceted-project>

javascript-console-repo/README.txt

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
2+
Javascript Console Admin Console component for Alfresco Share
3+
=============================================================
4+
5+
Author: Florian Maul
6+
7+
This project defines a Javascript Console component for Share's Administration Console,
8+
that enables the execution of arbitrary javascript code in the repository.
9+
10+
11+
Installation
12+
------------
13+
14+
The component has been developed to install on top of an existing Alfresco
15+
3.4 or 4.0 installation. There are two different version in this archive with
16+
a specific folder for each of the Alfresco version.
17+
18+
When you have chosen the correct folder (3.4.x or 4.0.x) for your Alfresco version
19+
you'll find two jar files within that folder. The javascript-console-repo.jar needs
20+
to be copied into the Alfresco repository:
21+
22+
tomcat/webapps/alfresco/WEB-INF/lib/
23+
24+
The other file javascript-console-share.jar needs to be copied to the
25+
corresponding folder in the Share webapp:
26+
27+
tomcat/webapps/share/WEB-INF/lib/
28+
29+
The deployment location has changed recently (with Javascript Console 0.5)
30+
because the Javascript Console now uses Java classes that have to be deployed
31+
to these locations and can NOT reside in tomcat/shared/lib anymore.
32+
33+
34+
Building
35+
--------
36+
37+
To build the individual JAR files, run the following command from the base
38+
project directory.
39+
40+
ant -Dalfresco.sdk.dir=c:\dev\sdks\alfresco-enterprise-sdk-4.0.0 clean dist-jar
41+
42+
The command should build a JAR file named javascript-console-repo.jar or
43+
javascript-console-share.jar in the 'dist' directory within your project.
44+
45+
There also is the javascript-console-dist which builds both jar files and
46+
creates a patched version for Alfresco 3.4.x which does not support all the
47+
features of the version for 4.0.x
48+
49+
To deploy the extension files into a local Tomcat instance for testing, you can
50+
use the hotcopy-tomcat-jar task. You will need to set the tomcat.home
51+
property in Ant.
52+
53+
ant -Dtomcat.home=C:/Alfresco/tomcat clean hotcopy-tomcat-jar
54+
55+
Once you have run this you will need to restart Tomcat so that the classpath
56+
resources in the JAR file are picked up.
57+
58+
59+
Using the component
60+
-------------------
61+
62+
Log in to Alfresco Share as an admin user and navigate to the Administration
63+
page. Click 'Javascript Console' in the left hand side navigation.
64+
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
3+
<model name="jsc:jsconsole-model" xmlns="http://www.alfresco.org/model/dictionary/1.0">
4+
5+
<description>Javascript Console Model </description>
6+
<version>1.0</version>
7+
8+
<imports>
9+
<!-- Import Alfresco Dictionary Definitions -->
10+
<import uri="http://www.alfresco.org/model/dictionary/1.0" prefix="d" />
11+
<!-- Import Alfresco Content Domain Model Definitions -->
12+
<import uri="http://www.alfresco.org/model/content/1.0" prefix="cm" />
13+
</imports>
14+
15+
<namespaces>
16+
<!-- namespace for visible aspects -->
17+
<namespace uri="http://www.fme.de/alfresco/models/jsconsole" prefix="jsc"/>
18+
</namespaces>
19+
20+
<aspects>
21+
<aspect name="jsc:scriptContext">
22+
<properties>
23+
<property name="jsc:freemarkerScript">
24+
<type>d:content</type>
25+
</property>
26+
</properties>
27+
</aspect>
28+
</aspects>
29+
30+
</model>
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<webscript>
2+
<shortname>fme JSConsole read existing javascript and freemarker</shortname>
3+
<url>/de/fme/jsconsole/readScript?nodeRef={nodeRef}</url>
4+
<authentication>admin</authentication>
5+
<format default="json">extension</format>
6+
</webscript>
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"scripts" : ${scripts}
3+
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
2+
var nodeRef= args.nodeRef;
3+
4+
var readScript = function saveScript(){
5+
var scriptFolder = search.xpathSearch("/app:company_home/app:dictionary/app:scripts")[0];
6+
if (scriptFolder) {
7+
var scriptNode;
8+
if(isUpdate){
9+
scriptNode = scriptFolder.childByNamePath(args.name);
10+
}else{
11+
scriptNode = scriptFolder.createFile(args.name);
12+
}
13+
scriptNode.content = json.get('jsScript');
14+
scriptNode.properties["jsc:freemarkerScript"] = json.get('fmScript');
15+
scriptNode.save();
16+
}else{
17+
logger.warn('No script folder');
18+
}
19+
}
20+
21+
saveScript();
22+
23+
// from listScripts.get.js
24+
findAvailableScripts();
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<webscript>
2+
<shortname>fme JSConsole List Javascript Files</shortname>
3+
<url>/de/fme/jsconsole/readsnippets</url>
4+
<authentication>admin</authentication>
5+
<format default="json">extension</format>
6+
</webscript>

0 commit comments

Comments
 (0)