Changeset 692
- Timestamp:
- 03/05/10 13:30:58 (6 months ago)
- Location:
- trunk/src/com/calenco
- Files:
-
- 5 edited
- 1 moved
-
CalencoV2App.java (modified) (2 diffs)
-
Content.java (modified) (1 diff)
-
addon/AddOnsManager.java (modified) (2 diffs)
-
resource/workspace/ContentResource.java (modified) (1 diff)
-
resource/workspace/ContentStylesheetsResource.java (moved) (moved from trunk/src/com/calenco/resource/workspace/ContentStylesheetResource.java) (4 diffs)
-
staticres/workspace-html.ftl (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/com/calenco/CalencoV2App.java
r690 r692 44 44 import com.calenco.resource.workspace.ContentResource; 45 45 import com.calenco.resource.workspace.ContentRevhistoryResource; 46 import com.calenco.resource.workspace.ContentStylesheet Resource;46 import com.calenco.resource.workspace.ContentStylesheetsResource; 47 47 import com.calenco.resource.workspace.DepsTreeResource; 48 48 import com.calenco.resource.workspace.LanguageResource; … … 126 126 wrouter.attach("/{wksp}/content/{langOrFile}/revhistory", ContentRevhistoryResource.class); 127 127 wrouter.attach("/{wksp}/content/{lang}/{file}/revhistory", ContentRevhistoryResource.class); 128 wrouter.attach("/{wksp}/content/{langOrFile}/stylesheets", ContentStylesheet Resource.class);129 wrouter.attach("/{wksp}/content/{lang}/{file}/stylesheets", ContentStylesheet Resource.class);128 wrouter.attach("/{wksp}/content/{langOrFile}/stylesheets", ContentStylesheetsResource.class); 129 wrouter.attach("/{wksp}/content/{lang}/{file}/stylesheets", ContentStylesheetsResource.class); 130 130 wrouter.attach("/{wksp}/content", ContentResource.class); 131 131 wrouter.attach("/{wksp}/content/{langOrFile}", ContentResource.class); -
trunk/src/com/calenco/Content.java
r625 r692 48 48 49 49 public String getFname() { 50 return fname ;50 return fname.startsWith("/") ? fname.substring(1) : fname; // NOI18N 51 51 } 52 52 -
trunk/src/com/calenco/addon/AddOnsManager.java
r620 r692 146 146 */ 147 147 public AddOn getAddOn(String type) { 148 if (type == null) { 149 return null; 150 } 148 151 Class<AddOn> clazz = addons.get(type); 149 152 if (clazz != null) { … … 189 192 */ 190 193 public List<Toolchain> getToolchains(String type) { 194 List<Toolchain> result = new ArrayList<Toolchain>(); 191 195 AddOn addon = getAddOn(type); 192 196 if (addon != null) { 193 return new ArrayList<Toolchain>(addon.getToolchains().values()); 194 } else { 195 return null; 196 } 197 Map<String, Toolchain> toolChains = addon.getToolchains(); 198 if (toolChains != null) { 199 result.addAll(toolChains.values()); 200 } 201 } 202 return result; 197 203 } 198 204 -
trunk/src/com/calenco/resource/workspace/ContentResource.java
r690 r692 1194 1194 Association hasToolchain = new Association(Association.HAS_TOOLCHAIN); 1195 1195 hasToolchain.setFrom(href); 1196 hasToolchain.setTo( xsltype.getTcName());1196 hasToolchain.setTo(String.format("%s|%s", xsltype.getAddOnName(), xsltype.getTcName())); 1197 1197 adao.add(hasToolchain); 1198 1198 } -
trunk/src/com/calenco/resource/workspace/ContentStylesheetsResource.java
r690 r692 26 26 import com.calenco.Content; 27 27 import com.calenco.Language; 28 import com.calenco.addon.AddOn;29 28 import com.calenco.addon.AddOnsManager; 29 import com.calenco.addon.Toolchain; 30 30 import com.calenco.repository.ContentDAO; 31 31 import com.calenco.repository.dao.AssociationDAO; … … 50 50 * @author fabman 51 51 */ 52 public class ContentStylesheet Resource extends AbstractWorkspaceResource {52 public class ContentStylesheetsResource extends AbstractWorkspaceResource { 53 53 String langOrFile = null; 54 54 String lang = null; … … 89 89 AssociationDAO adao = new AssociationDAO(session, workspace); 90 90 String cco_xmlType = null; 91 List<Toolchain> toolchains = null; 91 92 try { 92 93 cco_xmlType = dao.getProperty(path, "cco_xmltype").getString(); // NOI18N 93 94 } catch (Exception ignored) { 94 95 } 95 AddOn addOn = null; 96 try { 97 addOn = AddOnsManager.getInstance().getAddOn(cco_xmlType); 98 } catch (Exception ignoredToo) { 99 } 100 if (cco_xmlType != null && addOn != null) { 101 Set<Association> xslAssocs = adao.findByKindTo(Association.HAS_TOOLCHAIN, addOn.getType()); 102 getLogger().info("*+*+*+*DBG: Got XSL assocs: " + xslAssocs); 103 for (Association xslAssoc: xslAssocs) { 104 Content xsl = dao.retrieve(xslAssoc.getFrom(), null); 105 if (xsl != null) { 106 stylesheets.add(xsl); 96 if (cco_xmlType != null) { 97 AddOnsManager aom = AddOnsManager.getInstance(); 98 toolchains = aom.getToolchains(cco_xmlType); 99 for (Toolchain toolchain: toolchains) { 100 String to = String.format("%s|%s", aom.getAddOn(cco_xmlType).getType(), toolchain.getName()); 101 Set<Association> xslAssocs = adao.findByKindTo(Association.HAS_TOOLCHAIN, to); 102 for (Association xslAssoc: xslAssocs) { 103 Content xsl = dao.retrieve(xslAssoc.getFrom(), null); 104 if (xsl != null) { 105 stylesheets.add(xsl); 106 } 107 107 } 108 108 } 109 109 } 110 110 JSONObject xsls = new JSONObject(); 111 xsls.put("count", stylesheets.size() + 1); // NOI18N112 111 xsls.put("identifier", "href"); // NOI18N 113 112 xsls.put("label", "name"); // NOI18N 114 113 JSONArray xsla = new JSONArray(); 115 xsla.put(new JSONObject().put("name", "[ DEFAULT ]").put("href", "DEFAULT")); // NOI18N 114 if (cco_xmlType != null && toolchains != null && !toolchains.isEmpty()) { 115 xsla.put(new JSONObject().put("name", "[ DEFAULT ]").put("href", "DEFAULT")); // NOI18N 116 } 116 117 for (Content stylesheet: stylesheets) { 117 118 JSONObject xsl = new JSONObject(); … … 121 122 } 122 123 xsls.put("items", xsla); // NOI18N 124 xsls.put("count", xsla.length()); // NOI18N 123 125 return new JsonRepresentation(xsls); 124 126 } else { -
trunk/src/com/calenco/staticres/workspace-html.ftl
r687 r692 1574 1574 1575 1575 function fillXsl(/* String */selId) { 1576 var xslStore = new dojo.data.ItemFileReadStore({url: "/workspaces/${wksp}/stylesheets"});1576 var xslStore = new dojo.data.ItemFileReadStore({url: selectedFile + "/stylesheets"}); 1577 1577 xslStore.fetch({ 1578 1578 query: {}, start: 0, count: 1, onComplete: function(res) {
Note: See TracChangeset
for help on using the changeset viewer.
