提交 5151c187 编写于 作者: N nilspreusker

added tree images and modified css so the images aren't loaded from...

added tree images and modified css so the images aren't loaded from developer.yahoo.com anymore, modified loading gif in tree, renamed tree.get webscript to child-nodes.get and refactored GUI accordingly, small layout fix in content representation view
上级 5a29d63a
<script type="text/javascript" src="${url.context}/res/components/tree/repo-tree.js"></script>
<link rel="stylesheet" type="text/css" href="${url.context}/res/components/tree/repo-tree.css">
<link rel="stylesheet" type="text/css" href="http://developer.yahoo.com/yui/examples/treeview/assets/css/folders/tree.css">
<link rel="stylesheet" type="text/css" href="${url.context}/res/components/tree/repo-tree.css">
\ No newline at end of file
......@@ -13,8 +13,8 @@
background: none repeat scroll 0 0 #F9F9F9;
}
#artifact-image, #artifact-source {
overflow: auto;
artifact-image, artifact-html, artifact-binary, artifact-code, artifact-text-plain {
overflow: auto;
}
.artifact-code, .artifact-text-plain, .artifact-html {
......
......@@ -41,4 +41,69 @@
.icon-code-page-blue { display:block; height: 16px; padding-left: 20px; white-space: nowrap; background: transparent url("/activiti-cycle/res/images/doctype-icons.png") 0 -416px no-repeat; }
.icon-code-red { display:block; height: 16px; padding-left: 20px; white-space: nowrap; background: transparent url("/activiti-cycle/res/images/doctype-icons.png") 0 -432px no-repeat; }
.icon-code-blue { display:block; height: 16px; padding-left: 20px; white-space: nowrap; background: transparent url("/activiti-cycle/res/images/doctype-icons.png") 0 -448px no-repeat; }
.htmlnodelabel { margin-left: 20px; }
\ No newline at end of file
.htmlnodelabel { margin-left: 20px; }
/* Folder style for tree */
#treeDiv1 a:hover {
text-decoration: none;
}
/* first or middle sibling, no children */
.ygtvtn { background: url("/activiti-cycle/res/images/folder/tn.gif") 0 0 no-repeat; width:17px; height:22px; }
/* first or middle sibling, collapsable */
.ygtvtm { background: url("/activiti-cycle/res/images/folder/tm.gif") 0 0 no-repeat; width:34px; height:22px; cursor:pointer }
/* first or middle sibling, collapsable, hover */
.ygtvtmh { background: url("/activiti-cycle/res/images/folder/tmh.gif") 0 0 no-repeat; width:34px; height:22px; cursor:pointer }
/* first or middle sibling, expandable */
.ygtvtp { background: url("/activiti-cycle/res/images/folder/tp.gif") 0 0 no-repeat; width:34px; height:22px; cursor:pointer }
/* first or middle sibling, expandable, hover */
.ygtvtph { background: url("/activiti-cycle/res/images/folder/tph.gif") 0 0 no-repeat; width:34px; height:22px; cursor:pointer }
/* last sibling, no children */
.ygtvln { background: url("/activiti-cycle/res/images/folder/ln.gif") 0 0 no-repeat; width:17px; height:22px; }
/* Last sibling, collapsable */
.ygtvlm { background: url("/activiti-cycle/res/images/folder/lm.gif") 0 0 no-repeat; width:34px; height:22px; cursor:pointer }
/* Last sibling, collapsable, hover */
.ygtvlmh { background: url("/activiti-cycle/res/images/folder/lmh.gif") 0 0 no-repeat; width:34px; height:22px; cursor:pointer }
/* Last sibling, expandable */
.ygtvlp { background: url("/activiti-cycle/res/images/folder/lp.gif") 0 0 no-repeat; width:34px; height:22px; cursor:pointer }
/* Last sibling, expandable, hover */
.ygtvlph { background: url("/activiti-cycle/res/images/folder/lph.gif") 0 0 no-repeat; width:34px; height:22px; cursor:pointer }
/* Loading icon */
.ygtvloading { background: url("/activiti-cycle/res/images/folder/loading.gif") no-repeat scroll 0 3px transparent }
/* the style for the empty cells that are used for rendering the depth
* of the node */
.ygtvdepthcell { background: url("/activiti-cycle/res/images/folder/vline.gif") 0 0 no-repeat; width:17px; height:22px; }
.ygtvblankdepthcell { width:17px; height:22px; }
/* the style of the div around each node */
.ygtvitem { }
.ygtvitem table{
margin-bottom:0;
}
.ygtvitem td {
border:none;padding:0;
}
/* the style of the div around each node's collection of children */
.ygtvchildren { }
* html .ygtvchildren { height:1%; }
/* the style of the text label in ygTextNode */
.ygtvlabel, .ygtvlabel:link, .ygtvlabel:visited, .ygtvlabel:hover {
margin-left:2px;
text-decoration: none;
}
......@@ -54,7 +54,7 @@
* @param response {object} The callback response
* @param obj {object} Helper object
*/
onLoadTreeSuccess: function RepoTree_RepositoryService_onLoadTreeSuccess(response, obj)
onLoadTreeSuccess: function RepoTree_RepositoryService_onLoadTreeSuccess(response)
{
var me = this;
......@@ -166,17 +166,15 @@
onUpdateArtifactView: function Artifact_onUpdateArtifactView(event, args)
{
if(!this._treeView._nodes) {
// tree is not initialized yet, we are coming from an external URL
// tree is not yet initialized, we are coming from an external URL
} else {
// Check, whether the tree contains the node that was selected, otherwise we will have to request it from the REST API
var nodeExists = false;
for(var i=0; i<this._treeView._nodes.length; i++) {
if(this._treeView._nodes && this._treeView._nodes[i] && (this._treeView._nodes[i].data.id === args[1].value.repositoryNodeId) ) {
nodeExists = true;
}
// tree is initialized, this is either a regular click on the tree or an event from the browser history manager
var node = this._treeView.getNodeByProperty("id", args[1].value.repositoryNodeId);
if(node && (node != this._treeView.currentFocus) ) {
// if the node isn't already focused this is a browser history event and we manually set focus to the current node
node.focus();
}
//alert("Node is there:" + nodeExists);
}
}
......
......@@ -43,11 +43,10 @@
* Loads the repository tree
*
* @method loadTree
* @param obj {Object} Helper object to be sent to the callback
*/
loadTree: function RepositoryService_loadTree(obj)
loadTree: function RepositoryService_loadTree()
{
this.jsonGet(this.loadTreeURL(), obj, "loadTree");
this.jsonGet(this.loadTreeURL(), null, "loadTree");
},
/**
......@@ -58,7 +57,7 @@
*/
loadTreeURL: function RepositoryService_loadTreeURL()
{
return Activiti.service.REST_PROXY_URI_RELATIVE + "repo-tree?id=/&folder=true";
return Activiti.service.REST_PROXY_URI_RELATIVE + "child-nodes?artifactId=/";
},
/**
......@@ -68,7 +67,7 @@
loadNodeData: function RepositoryService_loadNodeData(node, fnLoadComplete)
{
var obj = [node, fnLoadComplete];
this.jsonGet(this.loadNodeURL(node.data.id, node.data.folder), obj, "loadNodeData");
this.jsonGet(this.loadNodeURL(node.data.id), obj, "loadNodeData");
},
/**
......@@ -78,12 +77,12 @@
* @method loadTreeURL
* @return {string} The url
*/
loadNodeURL: function RepositoryService_loadNodeURL(nodeid, folder)
loadNodeURL: function RepositoryService_loadNodeURL(nodeid)
{
return Activiti.service.REST_PROXY_URI_RELATIVE + "repo-tree?id=" + encodeURIComponent(nodeid) + "&folder=" + folder;
return Activiti.service.REST_PROXY_URI_RELATIVE + "child-nodes?artifactId=" + encodeURIComponent(nodeid);
},
/**
/**
* Loads an artifact (id and url)
*
* @method loadArtifact
......
......@@ -33,9 +33,9 @@ import org.springframework.extensions.webscripts.Status;
/**
* @author Nils Preusker
*/
public class TreeGet extends ActivitiWebScript {
public class ChildNodesGet extends ActivitiWebScript {
private static Logger log = Logger.getLogger(TreeGet.class.getName());
private static Logger log = Logger.getLogger(ChildNodesGet.class.getName());
// private CycleService cycleService;
private RepositoryConnector repositoryConnector;
......@@ -47,29 +47,27 @@ public class TreeGet extends ActivitiWebScript {
// this.cycleService = SessionUtil.getCycleService();
this.repositoryConnector = CycleServiceDbXStreamImpl.getRepositoryConnector(cuid, session);
}
@Override
protected void executeWebScript(ActivitiRequest req, Status status, Cache cache, Map<String, Object> model) {
init(req);
String id = req.getString("id");
boolean folder = Boolean.parseBoolean(req.getString("folder"));
if (folder) {
try {
RepositoryNodeCollection children = this.repositoryConnector.getChildren(id);
String artifactId = req.getMandatoryString("artifactId");
try {
RepositoryNodeCollection children = this.repositoryConnector.getChildren(artifactId);
model.put("files", children.getArtifactList());
model.put("folders", children.getFolderList());
return;
model.put("files", children.getArtifactList());
model.put("folders", children.getFolderList());
return;
} catch (RepositoryException e) {
log.log(Level.SEVERE, "Cannot load children for id '" + id + "'", e);
// TODO: how can we let the user know what went wrong without breaking the tree?
// throwing a HTTP 500 here will cause the tree to load the node for ever.
// throw new WebScriptException(Status.STATUS_INTERNAL_SERVER_ERROR,
// "exception.message");
} catch (RepositoryException e) {
log.log(Level.SEVERE, "Cannot load children for id '" + artifactId + "'", e);
// TODO: how can we let the user know what went wrong without breaking the
// tree?
// throwing a HTTP 500 here will cause the tree to load the node for ever.
// throw new WebScriptException(Status.STATUS_INTERNAL_SERVER_ERROR,
// "exception.message");
}
}
// provide empty list as default
......
<webscript>
<shortname>Child nodes</shortname>
<description>Returns a json representation of tree nodes starting at the node identified by the nodeId parameter</description>
<url>/child-nodes?artifactId={artifactId}</url>
<authentication>user</authentication>
<format default="json">argument</format>
</webscript>
\ No newline at end of file
<webscript>
<shortname>Repository Tree</shortname>
<description>Returns a json string that represents a content repository</description>
<url>/repo-tree</url>
<authentication>user</authentication>
<format default="json">argument</format>
</webscript>
\ No newline at end of file
......@@ -181,8 +181,8 @@
parent="activitiWebScript">
</bean>
<bean id="webscript.org.activiti.rest.api.cycle.tree.get"
class="org.activiti.rest.api.cycle.TreeGet"
<bean id="webscript.org.activiti.rest.api.cycle.child-nodes.get"
class="org.activiti.rest.api.cycle.ChildNodesGet"
parent="activitiWebScript">
</bean>
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册