1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.exoplatform.wcm.webui.fastcontentcreator;
18
19 import org.exoplatform.ecm.resolver.JCRResourceResolver;
20 import org.exoplatform.ecm.webui.form.UIDialogForm;
21 import org.exoplatform.ecm.webui.selector.ComponentSelector;
22 import org.exoplatform.ecm.webui.selector.UISelectable;
23 import org.exoplatform.ecm.webui.tree.selectone.UIOneNodePathSelector;
24 import org.exoplatform.ecm.webui.tree.selectone.UIOneTaxonomySelector;
25 import org.exoplatform.ecm.webui.utils.DialogFormUtil;
26 import org.exoplatform.portal.webui.util.Util;
27 import org.exoplatform.resolver.ResourceResolver;
28 import org.exoplatform.services.cms.BasePath;
29 import org.exoplatform.services.cms.CmsService;
30 import org.exoplatform.services.cms.impl.DMSConfiguration;
31 import org.exoplatform.services.cms.taxonomy.TaxonomyService;
32 import org.exoplatform.services.cms.templates.TemplateService;
33 import org.exoplatform.services.jcr.RepositoryService;
34 import org.exoplatform.services.jcr.ext.common.SessionProvider;
35 import org.exoplatform.services.jcr.ext.hierarchy.NodeHierarchyCreator;
36 import org.exoplatform.services.wcm.utils.WCMCoreUtils;
37 import org.exoplatform.upload.UploadService;
38 import org.exoplatform.wcm.webui.Utils;
39 import org.exoplatform.web.application.ApplicationMessage;
40 import org.exoplatform.web.application.RequireJS;
41 import org.exoplatform.webui.application.WebuiRequestContext;
42 import org.exoplatform.webui.application.portlet.PortletRequestContext;
43 import org.exoplatform.webui.config.annotation.ComponentConfig;
44 import org.exoplatform.webui.config.annotation.ComponentConfigs;
45 import org.exoplatform.webui.config.annotation.EventConfig;
46 import org.exoplatform.webui.core.UIApplication;
47 import org.exoplatform.webui.core.UIComponent;
48 import org.exoplatform.webui.core.lifecycle.UIFormLifecycle;
49 import org.exoplatform.webui.event.Event;
50 import org.exoplatform.webui.event.Event.Phase;
51 import org.exoplatform.webui.event.EventListener;
52 import org.exoplatform.webui.form.UIFormInput;
53 import org.exoplatform.webui.form.UIFormInputBase;
54 import org.exoplatform.webui.form.UIFormMultiValueInputSet;
55 import org.exoplatform.webui.form.UIFormStringInput;
56 import org.exoplatform.webui.form.input.UIUploadInput;
57
58 import javax.jcr.AccessDeniedException;
59 import javax.jcr.ItemExistsException;
60 import javax.jcr.Node;
61 import javax.jcr.NodeIterator;
62 import javax.jcr.PathNotFoundException;
63 import javax.jcr.Session;
64 import javax.jcr.Value;
65 import javax.jcr.lock.LockException;
66 import javax.jcr.version.VersionException;
67 import javax.portlet.PortletPreferences;
68 import java.security.AccessControlException;
69 import java.util.ArrayList;
70 import java.util.List;
71 import java.util.Map;
72
73
74
75
76
77
78
79
80 @ComponentConfigs( {
81 @ComponentConfig(type = UIFormMultiValueInputSet.class, id = "WYSIWYGRichTextMultipleInputset", events = {
82 @EventConfig(listeners = UIDialogForm.AddActionListener.class, phase = Phase.DECODE),
83 @EventConfig(listeners = UIFormMultiValueInputSet.RemoveActionListener.class, phase = Phase.DECODE) }),
84 @ComponentConfig(lifecycle = UIFormLifecycle.class, events = {
85 @EventConfig(listeners = UIFCCForm.SaveActionListener.class),
86 @EventConfig(listeners = UIFCCForm.AddActionListener.class, phase = Phase.DECODE),
87 @EventConfig(listeners = UIFCCForm.RemoveActionListener.class, phase = Phase.DECODE),
88 @EventConfig(listeners = UIFCCForm.ShowComponentActionListener.class, phase = Phase.DECODE),
89 @EventConfig(listeners = UIFCCForm.RemoveReferenceActionListener.class,
90 confirm = "DialogFormField.msg.confirm-delete",
91 phase = Phase.DECODE) }) })
92 public class UIFCCForm extends UIDialogForm implements UISelectable {
93
94
95 final static public String FIELD_TAXONOMY = "categories";
96
97
98 final static public String POPUP_TAXONOMY = "UIPopupTaxonomy";
99
100
101 private List<String> listTaxonomy = new ArrayList<String>();
102
103
104 private List<String> listTaxonomyName = new ArrayList<String>();
105
106
107 private String documentType_ ;
108
109
110 private JCRResourceResolver jcrTemplateResourceResolver_ ;
111
112
113
114
115
116
117 public UIFCCForm() throws Exception {
118 PortletPreferences preferences = UIFCCUtils.getPortletPreferences() ;
119 String custom_save_button = preferences.getValue(UIFCCConstant.PREFERENCE_SAVE_BUTTON, "");
120 setActions(new String[]{custom_save_button}) ;
121
122 }
123 public String event(String name) throws Exception
124 {
125
126 StringBuilder b = new StringBuilder();
127 b.append("javascript:eXo.webui.UIForm.submitForm('").append(getFormId()).append("','");
128 b.append("Save").append("',true)");
129 return b.toString();
130 }
131 private String getFormId()
132 {
133 WebuiRequestContext context = WebuiRequestContext.getCurrentInstance();
134 if (context instanceof PortletRequestContext)
135 {
136 return ((PortletRequestContext)context).getWindowId() + "#" + getId();
137 }
138 return getId();
139 }
140
141
142
143
144
145 public List<String> getListTaxonomy() {
146 return listTaxonomy;
147 }
148
149
150
151
152
153
154 public List<String> getlistTaxonomyName() {
155 return listTaxonomyName;
156 }
157
158
159
160
161
162
163 public void setListTaxonomy(List<String> listTaxonomyNew) {
164 listTaxonomy = listTaxonomyNew;
165 }
166
167
168
169
170
171
172 public void setListTaxonomyName(List<String> listTaxonomyNameNew) {
173 listTaxonomyName = listTaxonomyNameNew;
174 }
175
176
177
178
179 public String getTemplate() {
180 TemplateService templateService = getApplicationComponent(TemplateService.class) ;
181 String userName = Util.getPortalRequestContext().getRemoteUser() ;
182 try {
183 if(userName == null) {
184 return templateService.getTemplatePathByAnonymous(true, documentType_);
185 }
186 return templateService.getTemplatePathByUser(true, documentType_, userName) ;
187 } catch (Exception e) {
188 UIApplication uiApp = getAncestorOfType(UIApplication.class) ;
189 Object[] arg = { documentType_ } ;
190 uiApp.addMessage(new ApplicationMessage("UIFCCForm.msg.not-support", arg, ApplicationMessage.ERROR)) ;
191 return null ;
192 }
193 }
194
195
196
197
198 @SuppressWarnings("unchecked")
199 public void doSelect(String selectField, Object value) throws Exception {
200 this.isUpdateSelect = true;
201 UIFormInput formInput = getUIInput(selectField);
202 if(formInput instanceof UIFormInputBase) {
203 ((UIFormInputBase)formInput).setValue(value.toString());
204 }else if(formInput instanceof UIFormMultiValueInputSet) {
205 UIFormMultiValueInputSet inputSet = (UIFormMultiValueInputSet) formInput;
206 String valueTaxonomy = String.valueOf(value).trim();
207 List taxonomylist = inputSet.getValue();
208 if (!taxonomylist.contains(valueTaxonomy)) {
209 listTaxonomy.add(valueTaxonomy);
210 listTaxonomyName.add(valueTaxonomy);
211 taxonomylist.add(valueTaxonomy);
212 }
213 inputSet.setValue(taxonomylist);
214 }
215 UIFCCPortlet uiContainer = getParent();
216 uiContainer.removeChildById("PopupComponent");
217 }
218
219
220
221
222
223
224
225
226 public Node getCurrentNode() throws Exception {
227 RepositoryService repositoryService = getApplicationComponent(RepositoryService.class) ;
228 PortletPreferences preferences = UIFCCUtils.getPortletPreferences() ;
229 Session session = WCMCoreUtils.getUserSessionProvider()
230 .getSession(preferences.getValue(UIFCCConstant.PREFERENCE_WORKSPACE,
231 ""),
232 repositoryService.getCurrentRepository());
233 return (Node) session.getItem(preferences.getValue("path", ""));
234 }
235
236
237
238
239
240
241 public void setTemplateNode(String type) { documentType_ = type ; }
242
243
244
245
246 public boolean isEditing() { return false ; }
247
248
249
250
251
252
253
254 public ResourceResolver getTemplateResourceResolver(WebuiRequestContext context, String template) {
255 if(jcrTemplateResourceResolver_ == null) newJCRTemplateResourceResolver() ;
256 return jcrTemplateResourceResolver_;
257 }
258
259
260
261
262 public void newJCRTemplateResourceResolver() {
263 try {
264 jcrTemplateResourceResolver_ = new JCRResourceResolver(getDMSWorkspace()) ;
265 } catch(Exception e) {
266 Utils.createPopupMessage(this, "UIFCCForm.msg.new-jcr-template", null, ApplicationMessage.ERROR);
267 }
268 }
269
270
271
272
273
274
275 private String getDMSWorkspace() {
276 DMSConfiguration dmsConfiguration = getApplicationComponent(DMSConfiguration.class);
277 return dmsConfiguration.getConfig().getSystemWorkspace();
278 }
279
280 @Override
281 public void processRender(WebuiRequestContext context) throws Exception {
282 context.getJavascriptManager().loadScriptResource("wcm-webui-extension");
283 context.getJavascriptManager().addCustomizedOnLoadScript("changeWarning();");
284 super.processRender(context);
285 }
286
287
288
289
290
291
292
293
294
295
296 static public class SaveActionListener extends EventListener<UIFCCForm> {
297
298
299
300
301 public void execute(Event<UIFCCForm> event) throws Exception {
302 UIFCCForm fastContentCreatorForm = event.getSource() ;
303 UIApplication uiApp = fastContentCreatorForm.getAncestorOfType(UIApplication.class);
304 PortletPreferences preferences = UIFCCUtils.getPortletPreferences();
305 String preferencePath = preferences.getValue(UIFCCConstant.PREFERENCE_PATH, "") ;
306 String preferenceType = preferences.getValue(UIFCCConstant.PREFERENCE_TYPE, "") ;
307 String preferenceWorkspace = preferences.getValue(UIFCCConstant.PREFERENCE_WORKSPACE, "") ;
308
309 RepositoryService repositoryService = fastContentCreatorForm.getApplicationComponent(RepositoryService.class);
310 SessionProvider sessionProvider = WCMCoreUtils.getUserSessionProvider();
311 Session session = sessionProvider.getSession(preferenceWorkspace, repositoryService.getCurrentRepository());
312 CmsService cmsService = fastContentCreatorForm.getApplicationComponent(CmsService.class) ;
313 TaxonomyService taxonomyService = fastContentCreatorForm.getApplicationComponent(TaxonomyService.class);
314 boolean hasCategories = false;
315 StringBuffer sb = new StringBuffer();
316 String categoriesPath = "";
317 String[] categoriesPathList = null;
318 List inputs = fastContentCreatorForm.getChildren();
319 for (int i = 0; i < inputs.size(); i++) {
320 UIFormInput input = (UIFormInput) inputs.get(i);
321 if((input.getName() != null) && input.getName().equals("name")) {
322 String valueName = input.getValue().toString().trim();
323 if (!org.exoplatform.ecm.webui.utils.Utils.isNameValid(valueName,
324 org.exoplatform.ecm.webui.utils.Utils.SPECIALCHARACTER)) {
325 uiApp.addMessage(new ApplicationMessage("UIFCCForm.msg.name-not-allowed", null, ApplicationMessage.WARNING));
326
327 return;
328 }
329 }
330 }
331 if(fastContentCreatorForm.isReference) {
332 UIFormMultiValueInputSet uiSet = fastContentCreatorForm.getChild(UIFormMultiValueInputSet.class);
333 if((uiSet != null) && (uiSet.getName() != null) && uiSet.getName().equals("categories")) {
334 hasCategories = true;
335 List<UIComponent> listChildren = uiSet.getChildren();
336 for (UIComponent component : listChildren) {
337 UIFormStringInput uiStringInput = (UIFormStringInput)component;
338 if(uiStringInput.getValue() != null) {
339 String value = uiStringInput.getValue().trim();
340 sb.append(value).append(",");
341 }
342 }
343 categoriesPath = sb.toString();
344 if (categoriesPath.endsWith(",")) categoriesPath = categoriesPath.substring(0, categoriesPath.length()-1).trim();
345 categoriesPathList = categoriesPath.split(",");
346 if ((categoriesPathList == null) || (categoriesPathList.length == 0)) {
347 uiApp.addMessage(new ApplicationMessage("UISelectedCategoriesGrid.msg.non-categories", null,
348 ApplicationMessage.WARNING));
349
350 return;
351 }
352
353 for(String categoryPath : categoriesPathList) {
354 if((categoryPath != null) && (categoryPath.trim().length() > 0)){
355 if (categoryPath.indexOf("/") == -1) {
356 uiApp.addMessage(new ApplicationMessage("UISelectedCategoriesGrid.msg.non-categories", null,
357 ApplicationMessage.WARNING));
358
359 return;
360 }
361 }
362 }
363 }
364 }
365 Map inputProperties = DialogFormUtil.prepareMap(fastContentCreatorForm.getChildren(),
366 fastContentCreatorForm.getInputProperties(),
367 fastContentCreatorForm.getInputOptions());
368 Node homeNode = null;
369 Node newNode = null ;
370 try {
371 homeNode = (Node) session.getItem(preferencePath);
372 } catch (AccessDeniedException ade){
373 Object[] args = { preferencePath } ;
374 uiApp.addMessage(new ApplicationMessage("UIFCCForm.msg.access-denied", args,
375 ApplicationMessage.WARNING)) ;
376
377 return;
378 } catch(PathNotFoundException pnfe) {
379 Object[] args = { preferencePath } ;
380 uiApp.addMessage(new ApplicationMessage("UIFCCForm.msg.path-not-found", args,
381 ApplicationMessage.WARNING)) ;
382
383 return;
384 }
385 try {
386 String addedPath = cmsService.storeNode(preferenceType, homeNode, inputProperties, true);
387 homeNode.getSession().save() ;
388 int index = 0;
389 if(homeNode.hasNode(addedPath.substring(addedPath.lastIndexOf("/") + 1))) {
390 newNode = homeNode.getNode(addedPath.substring(addedPath.lastIndexOf("/") + 1));
391 if (hasCategories && (newNode != null) && ((categoriesPath != null) && (categoriesPath.length() > 0))){
392 for(String categoryPath : categoriesPathList) {
393 index = categoryPath.indexOf("/");
394 taxonomyService.addCategory(newNode, categoryPath.substring(0, index), categoryPath.substring(index + 1));
395 }
396 }
397 event.getRequestContext().setAttribute("nodePath", newNode.getPath());
398 }
399 fastContentCreatorForm.reset() ;
400 fastContentCreatorForm.setIsResetForm(true) ;
401 for(UIComponent uiChild : fastContentCreatorForm.getChildren()) {
402 if(uiChild instanceof UIFormMultiValueInputSet) {
403 ((UIFormMultiValueInputSet)uiChild).setValue(new ArrayList<Value>()) ;
404 } else if(uiChild instanceof UIUploadInput) {
405 UploadService uploadService = fastContentCreatorForm.getApplicationComponent(UploadService.class) ;
406 uploadService.removeUploadResource(((UIUploadInput)uiChild).getUploadIds()[0]) ;
407 }
408 }
409 session.save() ;
410 session.refresh(false) ;
411 homeNode.getSession().refresh(false) ;
412
413 boolean preferenceIsRedirect = Boolean.parseBoolean(preferences.getValue(UIFCCConstant.PREFERENCE_IS_REDIRECT, "")) ;
414 String preferenceRedirectPath = preferences.getValue(UIFCCConstant.PREFERENCE_REDIRECT_PATH, "") ;
415 if (preferenceIsRedirect && preferenceRedirectPath != null) {
416 RequireJS requireJS = event.getRequestContext().getJavascriptManager().getRequireJS();
417 requireJS.require("SHARED/ecm-utils", "ecmutil").addScripts("ecmutil.ECMUtils.ajaxRedirect('" + preferenceRedirectPath
418 + "');");
419 } else {
420 String saveMessage = preferences.getValue(UIFCCConstant.PREFERENCE_SAVE_MESSAGE, "") ;
421 if (saveMessage == null) saveMessage = "saved-successfully";
422 Object[] args = { saveMessage } ;
423 ApplicationMessage appMessage = new ApplicationMessage("UIFCCForm.msg.saved-successfully", args);
424 appMessage.setArgsLocalized(false);
425 uiApp.addMessage(appMessage) ;
426
427 }
428 event.getRequestContext().addUIComponentToUpdateByAjax(fastContentCreatorForm.getParent()) ;
429 } catch (AccessControlException ace) {
430 throw new AccessDeniedException(ace.getMessage());
431 } catch(VersionException ve) {
432 uiApp.addMessage(new ApplicationMessage("UIFCCForm.msg.in-versioning", null,
433 ApplicationMessage.WARNING)) ;
434
435 return;
436 } catch(AccessDeniedException e) {
437 Object[] args = { preferencePath } ;
438 String key = "UIFCCForm.msg.access-denied" ;
439 uiApp.addMessage(new ApplicationMessage(key, args, ApplicationMessage.WARNING)) ;
440
441 return;
442 } catch(LockException lock) {
443 Object[] args = { preferencePath } ;
444 String key = "UIFCCForm.msg.node-locked" ;
445 uiApp.addMessage(new ApplicationMessage(key, args, ApplicationMessage.WARNING)) ;
446
447 return;
448 } catch(ItemExistsException item) {
449 Object[] args = { preferencePath } ;
450 String key = "UIFCCForm.msg.node-isExist" ;
451 uiApp.addMessage(new ApplicationMessage(key, args, ApplicationMessage.WARNING)) ;
452
453 }
454 }
455 }
456
457
458
459
460
461
462
463
464
465
466 @SuppressWarnings("unchecked")
467 static public class ShowComponentActionListener extends EventListener<UIFCCForm> {
468
469
470
471
472 public void execute(Event<UIFCCForm> event) throws Exception {
473 UIFCCForm fastContentCreatorForm = event.getSource() ;
474 UIFCCPortlet fastContentCreatorPortlet = fastContentCreatorForm.getParent() ;
475 fastContentCreatorForm.isShowingComponent = true;
476 String fieldName = event.getRequestContext().getRequestParameter(OBJECTID) ;
477 Map fieldPropertiesMap = fastContentCreatorForm.componentSelectors.get(fieldName) ;
478 String classPath = (String)fieldPropertiesMap.get("selectorClass") ;
479 String rootPath = (String)fieldPropertiesMap.get("rootPath") ;
480 ClassLoader cl = Thread.currentThread().getContextClassLoader() ;
481 Class clazz = Class.forName(classPath, true, cl) ;
482 UIComponent component = fastContentCreatorPortlet.createUIComponent(clazz, null, null);
483 NodeHierarchyCreator nodeHierarchyCreator = fastContentCreatorForm.getApplicationComponent(NodeHierarchyCreator.class);
484 SessionProvider sessionProvider = WCMCoreUtils.getUserSessionProvider();
485 String selectorParams = (String)fieldPropertiesMap.get("selectorParams") ;
486 if(component instanceof UIOneNodePathSelector) {
487 String repositoryName = UIFCCUtils.getPreferenceRepository() ;
488 String wsFieldName = (String)fieldPropertiesMap.get("workspaceField") ;
489 String wsName = "";
490 if(wsFieldName != null && wsFieldName.length() > 0) {
491 wsName = (String)fastContentCreatorForm.<UIFormInputBase>getUIInput(wsFieldName).getValue() ;
492 ((UIOneNodePathSelector)component).setIsDisable(wsName, true) ;
493 }
494 if(selectorParams != null) {
495 String[] arrParams = selectorParams.split(",") ;
496 if(arrParams.length == 4) {
497 ((UIOneNodePathSelector)component).setAcceptedNodeTypesInPathPanel(new String[] {"nt:file"}) ;
498 wsName = arrParams[1];
499 rootPath = arrParams[2];
500 ((UIOneNodePathSelector)component).setIsDisable(wsName, true) ;
501 if(arrParams[3].indexOf(";") > -1) {
502 ((UIOneNodePathSelector)component).setAcceptedMimeTypes(arrParams[3].split(";")) ;
503 } else {
504 ((UIOneNodePathSelector)component).setAcceptedMimeTypes(new String[] {arrParams[3]}) ;
505 }
506 }
507 }
508 if(rootPath == null) rootPath = "/";
509 ((UIOneNodePathSelector)component).setRootNodeLocation(repositoryName, wsName, rootPath) ;
510 ((UIOneNodePathSelector)component).setShowRootPathSelect(true);
511 ((UIOneNodePathSelector)component).init(sessionProvider);
512 } else if (component instanceof UIOneTaxonomySelector) {
513 String workspaceName = fastContentCreatorForm.getDMSWorkspace();
514 ((UIOneTaxonomySelector)component).setIsDisable(workspaceName, false);
515 String rootTreePath = nodeHierarchyCreator.getJcrPath(BasePath.TAXONOMIES_TREE_STORAGE_PATH);
516 RepositoryService repositoryService = fastContentCreatorForm.getApplicationComponent(RepositoryService.class);
517 Session session = sessionProvider.getSession(workspaceName,
518 repositoryService.getCurrentRepository());
519 Node rootTree = (Node) session.getItem(rootTreePath);
520 NodeIterator childrenIterator = rootTree.getNodes();
521 while (childrenIterator.hasNext()) {
522 Node childNode = childrenIterator.nextNode();
523 rootTreePath = childNode.getPath();
524 break;
525 }
526
527 ((UIOneTaxonomySelector) component).setRootNodeLocation(fastContentCreatorForm.repositoryName,
528 workspaceName,
529 rootTreePath);
530 ((UIOneTaxonomySelector)component).init(sessionProvider);
531 }
532 Utils.createPopupWindow(fastContentCreatorForm, component, UIFCCConstant.TAXONOMY_POPUP_WINDOW, 640);
533 String param = "returnField=" + fieldName ;
534 String[] params = selectorParams == null ? new String[] { param } : new String[] { param,
535 "selectorParams=" + selectorParams };
536 ((ComponentSelector)component).setSourceComponent(fastContentCreatorForm, params) ;
537 event.getRequestContext().addUIComponentToUpdateByAjax(fastContentCreatorPortlet) ;
538 }
539 }
540
541
542
543
544
545
546
547
548
549
550 static public class RemoveReferenceActionListener extends EventListener<UIFCCForm> {
551
552
553
554
555 public void execute(Event<UIFCCForm> event) throws Exception {
556 UIFCCForm fastContentCreatorForm = event.getSource() ;
557 fastContentCreatorForm.isRemovePreference = true;
558 String fieldName = event.getRequestContext().getRequestParameter(OBJECTID) ;
559 fastContentCreatorForm.getUIStringInput(fieldName).setValue(null) ;
560 event.getRequestContext().addUIComponentToUpdateByAjax(fastContentCreatorForm.getParent()) ;
561 }
562 }
563
564
565
566
567
568
569
570
571
572
573 static public class AddActionListener extends EventListener<UIFCCForm> {
574
575
576
577
578 public void execute(Event<UIFCCForm> event) throws Exception {
579 UIFCCForm uiFCCForm = event.getSource();
580 UIFCCPortlet fastContentCreatorPortlet = uiFCCForm.getParent();
581 String clickedField = event.getRequestContext().getRequestParameter(OBJECTID);
582 if (uiFCCForm.isReference) {
583 UIFormMultiValueInputSet uiSet = uiFCCForm.getChildById(FIELD_TAXONOMY);
584 if((uiSet != null) && (uiSet.getName() != null) && uiSet.getName().equals(FIELD_TAXONOMY)) {
585 if ((clickedField != null) && (clickedField.equals(FIELD_TAXONOMY))){
586 NodeHierarchyCreator nodeHierarchyCreator = uiFCCForm.getApplicationComponent(NodeHierarchyCreator.class);
587 if(uiSet.getValue().size() == 0) uiSet.setValue(new ArrayList<Value>());
588 String workspaceName = uiFCCForm.getDMSWorkspace();
589 UIOneTaxonomySelector uiOneTaxonomySelector = uiFCCForm.createUIComponent(UIOneTaxonomySelector.class,
590 null,
591 null);
592 uiOneTaxonomySelector.setIsDisable(workspaceName, false);
593 String rootTreePath = nodeHierarchyCreator.getJcrPath(BasePath.TAXONOMIES_TREE_STORAGE_PATH);
594 RepositoryService repositoryService = uiFCCForm.getApplicationComponent(RepositoryService.class);
595 SessionProvider sessionProvider = WCMCoreUtils.getUserSessionProvider();
596 Session session = sessionProvider.getSession(workspaceName,
597 repositoryService.getCurrentRepository());
598 Node rootTree = (Node) session.getItem(rootTreePath);
599 NodeIterator childrenIterator = rootTree.getNodes();
600 while (childrenIterator.hasNext()) {
601 Node childNode = childrenIterator.nextNode();
602 rootTreePath = childNode.getPath();
603 break;
604 }
605 uiOneTaxonomySelector.setRootNodeLocation(uiFCCForm.repositoryName, workspaceName, rootTreePath);
606 uiOneTaxonomySelector.init(WCMCoreUtils.getUserSessionProvider());
607 String param = "returnField=" + FIELD_TAXONOMY;
608 uiOneTaxonomySelector.setSourceComponent(uiFCCForm, new String[]{param});
609 Utils.createPopupWindow(uiFCCForm, uiOneTaxonomySelector, UIFCCConstant.TAXONOMY_POPUP_WINDOW, 640);
610 }
611 }
612 event.getRequestContext().addUIComponentToUpdateByAjax(fastContentCreatorPortlet);
613 } else {
614 event.getRequestContext().addUIComponentToUpdateByAjax(uiFCCForm.getParent());
615 }
616 }
617 }
618
619
620
621
622
623
624
625
626
627
628 static public class RemoveActionListener extends EventListener<UIFCCForm> {
629
630
631
632
633 public void execute(Event<UIFCCForm> event) throws Exception {
634 event.getRequestContext().addUIComponentToUpdateByAjax(event.getSource().getParent()) ;
635 }
636 }
637 }