Skip to content

Commit dd8ddaa

Browse files
committed
new version of javascript console with
- upgraded to codemirror 3 - integration of tern.js for autocomplete - special jshint integration for alfresco (thx to fmaul!) - some editor improvements - templates - deleted the new javascript rootobjects-> will become a new project NOT refactored or cleaned. Will be done later...
1 parent 75ac294 commit dd8ddaa

File tree

153 files changed

+39789
-3531
lines changed

Some content is hidden

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

153 files changed

+39789
-3531
lines changed

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
/javascript-console-repo/bin
2+
/javascript-console-repo/build
3+
/javascript-console-share/build
4+
/javascript-console-share/bin

javascript-console-repo/.classpath

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,25 @@
2020
<classpathentry kind="var" path="ALFRESCO_SDK_412/lib/server/dependencies/spring-surf/spring-webscripts-1.2.0-SNAPSHOT.jar" sourcepath="/ALFRESCO_SDK_412/src/spring-webscripts-1.2.0-SNAPSHOT-sources.jar"/>
2121
<classpathentry kind="var" path="ALFRESCO_SDK_412/lib/server/dependencies/spring-surf/spring-webscripts-api-1.2.0-SNAPSHOT.jar" sourcepath="/ALFRESCO_SDK_412/src/spring-webscripts-api-1.2.0-SNAPSHOT-sources.jar"/>
2222
<classpathentry kind="lib" path="lib/javassist.jar"/>
23+
<classpathentry kind="lib" path="lib/org.eclipse.core.jobs_3.5.300.v20120912-155018.jar"/>
24+
<classpathentry kind="lib" path="lib/org.eclipse.core.runtime_3.8.0.v20120912-155025.jar"/>
25+
<classpathentry kind="lib" path="lib/org.eclipse.equinox.common_3.6.100.v20120522-1841.jar"/>
26+
<classpathentry kind="lib" path="lib/org.eclipse.equinox.preferences_3.5.1.v20121031-182809.jar"/>
27+
<classpathentry kind="lib" path="lib/org.eclipse.jdt.compiler.tool_1.0.200.v20130116-050536.jar"/>
28+
<classpathentry kind="lib" path="lib/org.eclipse.osgi_3.8.2.v20130124-134944.jar"/>
29+
<classpathentry kind="lib" path="lib/org.eclipse.jdt.core_3.8.3.v20130121-145325.jar"/>
30+
<classpathentry kind="lib" path="lib/org.eclipse.core.resources_3.8.1.v20121114-124432.jar"/>
31+
<classpathentry kind="lib" path="lib/org.eclipse.core.contenttype_3.4.200.v20120523-2004.jar"/>
32+
<classpathentry kind="lib" path="lib/gson-2.2.4.jar" sourcepath="lib/gson-2.2.4-sources.jar">
33+
<attributes>
34+
<attribute name="javadoc_location" value="jar:platform:/resource/javascript-console-repo/lib/gson-2.2.4-javadoc.jar!/"/>
35+
</attributes>
36+
</classpathentry>
2337
<classpathentry kind="var" path="ALFRESCO_SDK_412/lib/server/alfresco-enterprise-repo-4.1.2.jar" sourcepath="/ALFRESCO_SDK_412/src/alfresco-enterprise-repository-src.zip"/>
2438
<classpathentry kind="var" path="ALFRESCO_SDK_412/lib/server/dependencies/acegi-security-0.8.2_patched.jar"/>
39+
<classpathentry kind="var" path="ALFRESCO_SDK_412/lib/server/dependencies/quartz-1.8.3-patched.jar"/>
40+
<classpathentry kind="var" path="ALFRESCO_SDK_412/lib/server/dependencies/jackson-core-asl-1.8.3.jar"/>
41+
<classpathentry kind="var" path="ALFRESCO_SDK_412/lib/server/dependencies/jackson-mapper-asl-1.8.3.jar"/>
42+
<classpathentry kind="var" path="ALFRESCO_SDK_412/lib/server/dependencies/gdata-1.45.0/google-collect-1.0.jar"/>
2543
<classpathentry kind="output" path="bin"/>
2644
</classpath>

javascript-console-repo/build.properties

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,9 @@ jar.name=javascript-console-repo-0.6rc.jar
22
amp.name=javascript-console-repo-0.6.0.amp
33
src.zip.name=javascript-console-repo-src-0.5.1.zip
44
build.res.dir.name=alfresco
5+
56
alfresco.sdk.dir=c:/dev/alfresco/sdk/alfresco-enterprise-sdk-4.1.2
6-
tomcat.home=C:/DEV/alfresco/system/200408_phag_master_4.1.2/tomcat
7+
tomcat.home=C:/DEV/alfresco/system/200408_phag_master_4.1.2/tomcat
8+
9+
#alfresco.sdk.dir=c:/dev/alfresco/sdk/alfresco-enterprise-sdk-4.1.5
10+
#tomcat.home=C:/DEV/alfresco/system/200674_merck_ddocs_upgrade_4.1.5/tomcat

javascript-console-repo/config/alfresco/extension/fme-jsconsole-context.xml

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -16,27 +16,6 @@
1616
</list>
1717
</property>
1818
</bean>
19-
20-
<bean id="jmxClientSciptFacade" parent="baseJavaScriptExtension"
21-
class="de.fme.jsconsole.jmx.JmxClientScriptFacade">
22-
<property name="extensionName" value="jmx" />
23-
<property name="alfrescoMBeanServer" ref="alfrescoMBeanServer" />
24-
</bean>
25-
26-
<bean id="solrScriptFacade" parent="baseJavaScriptExtension"
27-
class="de.fme.jsconsole.jmx.SolrScriptFacade">
28-
<property name="extensionName" value="solr" />
29-
<property name="solrIndexCheckService" ref="search.solrIndexCheckService" />
30-
</bean>
31-
32-
<bean id="batchScriptFacade" parent="baseJavaScriptExtension"
33-
class="de.fme.jsconsole.batch.BatchScriptFacade">
34-
<property name="extensionName" value="batch" />
35-
<property name="transactionService" ref="transactionService" />
36-
<property name="searchService" ref="searchService" />
37-
<property name="scriptService" ref="scriptService" />
38-
<property name="serviceRegistry" ref="ServiceRegistry" />
39-
</bean>
4019

4120
</beans>
4221

javascript-console-repo/config/alfresco/extension/templates/webscripts/de/fme/jsconsole/apicommands.get.js

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -45,14 +45,6 @@
4545
}
4646
}
4747

48-
if (objectName === "jmx") {
49-
result["global"].push("jmxProps");
50-
var properties = jmx.getAllPropertyNames();
51-
for ( var i = 0; i < properties.length; i++) {
52-
result["methods"]["jmxProps"].push(properties[i]);
53-
}
54-
}
55-
5648
result["methods"][objectName].sort();
5749
}
5850
result["global"].sort();
@@ -61,6 +53,7 @@
6153
// add global scriptNodes document and space modelled by the companyhome
6254
result["global"].push("document");
6355
result["global"].push("space");
56+
result["global"].push("script");
6457
result["methods"]["document"] = result["methods"]["companyhome"];
6558
result["methods"]["space"] = result["methods"]["companyhome"];
6659

@@ -75,14 +68,13 @@
7568
result["methods"]["json"].push("isNull(fieldName)");
7669
result["methods"]["json"].push("getJSONArray(fieldName)");
7770

78-
// copy commands for all scriptnodes to a specific "node" property
79-
result["node"] = result["methods"]["companyhome"];
80-
8171
// Javascript Console specific commands
8272
result["global"].push("print");
8373
result["global"].push("recurse");
8474
result["methods"]["logger"].push("setLevel");
8575

76+
result["global"].push("Packages");
77+
result["global"].push("formdata");
8678
model.json = jsonUtils.toJSONString(result);
8779

8880
})(this, model);
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>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
var prepareOutput= function prepareOutput(folder) {
2+
var scriptlist = [];
3+
4+
var children = folder.children;
5+
6+
for (c in children) {
7+
var node = children[c];
8+
if(node.isDocument && node.mimetype='application/json'){
9+
scriptlist.push(node.content);
10+
}
11+
}
12+
13+
return scriptlist;
14+
}
15+
16+
var findAvailableSnippets= function findAvailableScripts(){
17+
var snippetsFolder = search.xpathSearch("/app:company_home/app:dictionary/cm:jsconsole/cm:snippets")[0];
18+
if (snippetsFolder) {
19+
model.scripts = jsonUtils.toJSONString(prepareOutput(snippetsFolder));
20+
}
21+
else {
22+
model.scripts = "[]";
23+
}
24+
}
25+
26+
findAvailableScripts();
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"scripts" : ${scripts}
3+
4+
}

javascript-console-repo/config/alfresco/extension/templates/webscripts/de/fme/jsconsole/saveScript.put.json.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,13 @@ var saveScript = function saveScript(){
66
var scriptFolder = search.xpathSearch("/app:company_home/app:dictionary/app:scripts")[0];
77
if (scriptFolder) {
88
var scriptNode;
9-
if(isUpdate){
9+
if(isUpdate && isUpdate=="true"){
1010
scriptNode = scriptFolder.childByNamePath(args.name);
1111
}else{
1212
scriptNode = scriptFolder.createFile(args.name);
1313
}
1414
scriptNode.content = json.get('jsScript');
15-
// scriptNode.properties["jsc:freemarkerScript"] = json.get('fmScript');
16-
logger.error("fmScript: "+json.get('fmScript'));
15+
scriptNode.properties["jsc:freemarkerScript"].content=json.get('fmScript');
1716
scriptNode.save();
1817
}else{
1918
logger.warn('No script folder');
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<webscript>
2+
<shortname>fme JSConsole read server information</shortname>
3+
<url>/de/fme/jsconsole/serverInfo</url>
4+
<authentication>admin</authentication>
5+
<format default="json">extension</format>
6+
</webscript>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
function getSearchCount(query){
2+
var paging =
3+
{
4+
maxItems: 1000000,
5+
skipCount: 0
6+
};
7+
8+
var def =
9+
{
10+
query: query,
11+
store: 'workspace://SpacesStore',
12+
language: 'fts-alfresco',
13+
page: paging
14+
};
15+
16+
return search.query(def).length;
17+
18+
}
19+
20+
21+
model.hostAddress = java.net.InetAddress.getLocalHost().getHostAddress();
22+
model.hostName = java.net.InetAddress.getLocalHost().getHostName();
23+
24+
model.edition = server.edition;
25+
model.schema = server.schema;
26+
model.version = server.version;
27+
model.sitesCount = siteService.listSites("", "").length;
28+
model.groupsCount = groups.getGroups("", utils.createPaging(100000, 0)).length;
29+
model.peopleCount = people.getPeople("", 100000).length;
30+
model.tagsCount = taggingService.getTags("workspace://SpacesStore").length;
31+
model.workflowDefinitions = workflow.getLatestDefinitions().length;
32+
model.folderCount = getSearchCount("TYPE:folder");
33+
model.docsCount = getSearchCount("TYPE:content");
34+
model.checkedOutCount = getSearchCount("ASPECT:checkedOut");
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"serverEdition" : "${edition}",
3+
"serverSchema" : "${schema}",
4+
"serverVersion" : "${version}",
5+
"hostAddress" : "${hostAddress}",
6+
"hostName" : "${hostName}",
7+
"sitesCount" : "${sitesCount}",
8+
"groupsCount" : "${groupsCount}",
9+
"peopleCount" : "${peopleCount}",
10+
"tagsCount" : "${tagsCount}",
11+
"wflDefinitionCount" : "${workflowDefinitions}",
12+
"folderCount" : "${folderCount}",
13+
"docsCount" : "${docsCount}",
14+
"checkedOutCount" : "${checkedOutCount}"
15+
}
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
/**
2+
*
3+
*/
4+
package de.fme.jsconsole.parsing;
5+
6+
import java.util.HashMap;
7+
import java.util.Map;
8+
9+
import org.eclipse.jdt.core.dom.TypeDeclaration;
10+
11+
/**
12+
* @author jgoldhammer
13+
*
14+
*/
15+
public class ParsingContext {
16+
17+
private Map<String, TypeDeclaration> rootTypes = new HashMap<String, TypeDeclaration>();
18+
private Map<String, TypeDeclaration> interestingTypes = new HashMap<String, TypeDeclaration>();
19+
private Map<String, String> packageDeclarations = new HashMap<String, String>();
20+
21+
public void putRootType(String key, TypeDeclaration value) {
22+
rootTypes.put(key, value);
23+
}
24+
25+
public Map<String, TypeDeclaration> getRootTypes() {
26+
return rootTypes;
27+
}
28+
29+
public void putInterestingTypes(String typeName, TypeDeclaration typeDeclaration) {
30+
interestingTypes.put(typeName, typeDeclaration);
31+
32+
}
33+
34+
public Map<String, TypeDeclaration> getInterestingTypes() {
35+
return interestingTypes;
36+
}
37+
38+
public void putPackageDeclaration(String typeName, String packageName) {
39+
packageDeclarations.put(typeName, packageName);
40+
}
41+
42+
public Map<String, String> getPackageDeclarations() {
43+
return packageDeclarations;
44+
}
45+
46+
public String getPackage(String key) {
47+
return packageDeclarations.get(key);
48+
}
49+
50+
}

0 commit comments

Comments
 (0)