- fixing edit form wizard to properly show when no default workflow is configured

- fixing row highlight bug in repeats when they're moved around
- attempt to fix move up move down issues for tinymce - but mce is really not behaving at all
- fix for folder icon in manage task screen, but doesn't really solve the problem that inappropriate actions are available.
- some minor fixes for create form wizard summary page.

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@4772 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Ariel Backenroth
2007-01-09 23:34:49 +00:00
parent 54fe924c27
commit 33ad926233
8 changed files with 178 additions and 57 deletions

View File

@@ -69,7 +69,7 @@ inherited=Inherited
search=Search search=Search
advanced_search=Advanced Search advanced_search=Advanced Search
value_not_set=not set value_not_set=not set
description_not_set=no description set description_not_set=No description set.
clear=Clear Results clear=Clear Results
results_contains=Results for ''{0}''. results_contains=Results for ''{0}''.
results_contains_filter=Results for ''{0}'' in ''{1}''. results_contains_filter=Results for ''{0}'' in ''{1}''.

View File

@@ -28,9 +28,11 @@ import org.alfresco.service.cmr.dictionary.DataTypeDefinition;
import org.alfresco.service.cmr.repository.Path; import org.alfresco.service.cmr.repository.Path;
import org.alfresco.service.namespace.QName; import org.alfresco.service.namespace.QName;
import org.alfresco.web.app.Application; import org.alfresco.web.app.Application;
import org.alfresco.web.bean.BrowseBean;
import org.alfresco.web.bean.repository.Node; import org.alfresco.web.bean.repository.Node;
import org.alfresco.web.bean.repository.NodePropertyResolver; import org.alfresco.web.bean.repository.NodePropertyResolver;
import org.alfresco.web.config.ClientConfigElement; import org.alfresco.web.config.ClientConfigElement;
import org.alfresco.web.ui.common.Utils;
/** /**
* Node class representing an AVM specific Node. * Node class representing an AVM specific Node.
@@ -91,6 +93,26 @@ public class AVMNode extends Node implements Map<String, Object>
} }
}; };
public final static NodePropertyResolver RESOLVER_FILE_TYPE_16 =
new NodePropertyResolver()
{
public Object get(final Node node)
{
if (! (node instanceof AVMNode))
{
return null;
}
if (((AVMNode)node).isDirectory())
{
return "/images/icons/" + BrowseBean.SPACE_SMALL_DEFAULT + ".gif";
}
else
{
return Utils.getFileTypeImage(node.getName(), true);
}
}
};
private AVMNodeDescriptor avmRef; private AVMNodeDescriptor avmRef;
private int version; private int version;

View File

@@ -41,6 +41,8 @@ import org.alfresco.web.forms.Form;
import org.alfresco.web.forms.FormsService; import org.alfresco.web.forms.FormsService;
import org.alfresco.web.forms.RenderingEngineTemplate; import org.alfresco.web.forms.RenderingEngineTemplate;
import org.alfresco.web.ui.common.Utils; import org.alfresco.web.ui.common.Utils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
/** /**
* Backing bean for the Edit Form wizard. * Backing bean for the Edit Form wizard.
@@ -50,6 +52,7 @@ import org.alfresco.web.ui.common.Utils;
public class EditFormWizard public class EditFormWizard
extends CreateFormWizard extends CreateFormWizard
{ {
private final static Log LOGGER = LogFactory.getLog(EditFormWizard.class);
private List<RenderingEngineTemplateData> removedRenderingEngineTemplates; private List<RenderingEngineTemplateData> removedRenderingEngineTemplates;
@@ -97,6 +100,10 @@ public class EditFormWizard
{ {
this.defaultWorkflowName = wf.getName(); this.defaultWorkflowName = wf.getName();
} }
else
{
this.applyDefaultWorkflow = false;
}
this.setOutputPathPatternForFormInstanceData(form.getOutputPathPattern()); this.setOutputPathPatternForFormInstanceData(form.getOutputPathPattern());
for (RenderingEngineTemplate ret : form.getRenderingEngineTemplates()) for (RenderingEngineTemplate ret : form.getRenderingEngineTemplates())
@@ -127,29 +134,36 @@ public class EditFormWizard
WCMAppModel.PROP_XML_SCHEMA_ROOT_ELEMENT_NAME, WCMAppModel.PROP_XML_SCHEMA_ROOT_ELEMENT_NAME,
this.getSchemaRootElementName()); this.getSchemaRootElementName());
final WorkflowDefinition wd = this.getDefaultWorkflowDefinition(); final WorkflowDefinition wd = this.getDefaultWorkflowDefinition();
if (wd != null) final List<ChildAssociationRef> workflowRefs =
this.nodeService.getChildAssocs(formNodeRef,
WCMAppModel.ASSOC_FORM_WORKFLOW_DEFAULTS,
RegexQNamePattern.MATCH_ALL);
if (wd != null && workflowRefs.size() == 0)
{ {
final List<ChildAssociationRef> workflowRefs = LOGGER.debug("adding workflow definition " + wd.getName() +
this.nodeService.getChildAssocs(formNodeRef, " to form " + this.getFormName());
WCMAppModel.ASSOC_FORM_WORKFLOW_DEFAULTS, final Map<QName, Serializable> props = new HashMap<QName, Serializable>(1, 1.0f);
RegexQNamePattern.MATCH_ALL); props.put(WCMAppModel.PROP_WORKFLOW_NAME, wd.getName());
if (workflowRefs.size() == 0) this.nodeService.createNode(formNodeRef,
{ WCMAppModel.ASSOC_FORM_WORKFLOW_DEFAULTS,
final Map<QName, Serializable> props = new HashMap<QName, Serializable>(1, 1.0f); WCMAppModel.ASSOC_FORM_WORKFLOW_DEFAULTS,
props.put(WCMAppModel.PROP_WORKFLOW_NAME, wd.getName()); WCMAppModel.TYPE_WORKFLOW_DEFAULTS,
this.nodeService.createNode(formNodeRef, props);
WCMAppModel.ASSOC_FORM_WORKFLOW_DEFAULTS,
WCMAppModel.ASSOC_FORM_WORKFLOW_DEFAULTS,
WCMAppModel.TYPE_WORKFLOW_DEFAULTS,
props);
}
else
{
this.nodeService.setProperty(workflowRefs.get(0).getChildRef(),
WCMAppModel.PROP_WORKFLOW_NAME,
wd.getName());
}
} }
else if (wd != null && workflowRefs.size() == 1)
{
LOGGER.debug("setting workflow definition " + wd.getName() +
" to form " + this.getFormName());
this.nodeService.setProperty(workflowRefs.get(0).getChildRef(),
WCMAppModel.PROP_WORKFLOW_NAME,
wd.getName());
}
else if (wd == null && workflowRefs.size() == 1)
{
LOGGER.debug("removing workflow definitions from form " + this.getFormName());
this.nodeService.removeChild(formNodeRef, workflowRefs.get(0).getChildRef());
}
if (this.getSchemaFile() != null) if (this.getSchemaFile() != null)
{ {

View File

@@ -28,6 +28,7 @@ import org.alfresco.service.namespace.RegexQNamePattern;
import org.alfresco.web.app.AlfrescoNavigationHandler; import org.alfresco.web.app.AlfrescoNavigationHandler;
import org.alfresco.web.app.Application; import org.alfresco.web.app.Application;
import org.alfresco.web.app.servlet.FacesHelper; import org.alfresco.web.app.servlet.FacesHelper;
import org.alfresco.web.bean.BrowseBean;
import org.alfresco.web.bean.dialog.BaseDialogBean; import org.alfresco.web.bean.dialog.BaseDialogBean;
import org.alfresco.web.bean.repository.MapNode; import org.alfresco.web.bean.repository.MapNode;
import org.alfresco.web.bean.repository.Node; import org.alfresco.web.bean.repository.Node;
@@ -691,11 +692,15 @@ public class ManageTaskDialog extends BaseDialogBean
protected void addAVMNode(final AVMNode node) protected void addAVMNode(final AVMNode node)
{ {
LOGGER.debug("adding node " + node);
node.getProperties().put("taskId", this.task.id); node.getProperties().put("taskId", this.task.id);
this.browseBean.setupCommonBindingProperties(node);
node.addPropertyResolver("path", AVMNode.RESOLVER_SANDBOX_RELATIVE_PATH); node.addPropertyResolver("path", AVMNode.RESOLVER_SANDBOX_RELATIVE_PATH);
node.addPropertyResolver("previewUrl", AVMNode.RESOLVER_PREVIEW_URL); node.addPropertyResolver("previewUrl", AVMNode.RESOLVER_PREVIEW_URL);
node.addPropertyResolver("fileType16", AVMNode.RESOLVER_FILE_TYPE_16);
node.addPropertyResolver("size", this.browseBean.resolverSize);
if (!node.isDirectory())
{
node.addPropertyResolver("url", this.browseBean.resolverUrl);
}
this.resources.add(node); this.resources.add(node);
} }

View File

@@ -27,7 +27,7 @@
<xs:complexType name="multi-input"> <xs:complexType name="multi-input">
<xs:sequence> <xs:sequence>
<xs:element name="string" type="xs:string"/> <xs:element name="string" type="xs:string"/>
<xs:element name="int" type="xs:anyType"/> <xs:element name="any" type="xs:anyType"/>
</xs:sequence> </xs:sequence>
</xs:complexType> </xs:complexType>
<xs:element name="repeat-components"> <xs:element name="repeat-components">

View File

@@ -87,6 +87,8 @@
font-weight: bold; font-weight: bold;
margin: 2px 5%; margin: 2px 5%;
text-align: center; text-align: center;
text-overflow: ellipsis;
overflow: hidden;
} }
.xformsFilePickerHeader .xformsFilePickerHeader

View File

@@ -63,11 +63,15 @@
</h:panelGrid> </h:panelGrid>
<h:panelGrid columns="1" cellpadding="3" cellspacing="3" border="0"> <h:panelGrid columns="1" cellpadding="3" cellspacing="3" border="0">
<h:outputText rendered="#{empty WizardManager.bean.renderingEngineTemplates}"
value="#{msg.no_selected_items}"/>
<a:selectList id="rendering-engine-template-list" <a:selectList id="rendering-engine-template-list"
multiSelect="false" multiSelect="false"
activeSelect="true" activeSelect="true"
style="width:100%" style="width:100%"
itemStyleClass="selectListItem"> itemStyleClass="selectListItem">
<c:forEach items="${WizardManager.bean.renderingEngineTemplates}" var="ret"> <c:forEach items="${WizardManager.bean.renderingEngineTemplates}" var="ret">
<a:listItem label="${msg.name}: ${ret.title}" <a:listItem label="${msg.name}: ${ret.title}"
value="${ret.name}" value="${ret.name}"
@@ -98,19 +102,17 @@
</h:panelGrid> </h:panelGrid>
<h:panelGrid columns="2" cellpadding="3" cellspacing="3" border="0"> <h:panelGrid columns="2" cellpadding="3" cellspacing="3" border="0">
<h:outputText value="#{msg.apply_default_workflow}:"/> <h:outputText value="#{msg.no_selected_items}"
<c:choose> rendered="#{WizardManager.bean.defaultWorkflowDefinition == null}"/>
<c:when test="${WizardManager.bean.defaultWorkflowDefinition != null}"> <a:selectList id="workflow-list"
<h:outputText value="#{msg.yes}"/> rendered="#{WizardManager.bean.defaultWorkflowDefinition != null}"
</c:when> multiSelect="false"
<c:otherwise> activeSelect="true"
<h:outputText value="#{msg.no}"/> style="width:100%"
</c:otherwise> itemStyleClass="selectListItem">
</c:choose> <a:listItem label="${msg.name}: ${WizardManager.bean.defaultWorkflowDefinition.title}"
<c:if test="${WizardManager.bean.defaultWorkflowDefinition != null}"> value="${WizardManager.bean.defaultWorkflowDefinition.name}"
<h:outputText value="#{msg.name}:"/> description="${msg.description}: ${WizardManager.bean.defaultWorkflowDefinition.description}"
<h:outputText value="#{WizardManager.bean.defaultWorkflowDefinition.title}"/> image="/images/icons/workflow_large.gif"/>
<h:outputText value="#{msg.description}:"/> </a:selectList>
<h:outputText value="#{WizardManager.bean.defaultWorkflowDefinition.description}"/>
</c:if>
</h:panelGrid> </h:panelGrid>

View File

@@ -235,6 +235,8 @@ dojo.declare("alfresco.xforms.Widget",
{ {
dojo.debug("destroying " + this.id); dojo.debug("destroying " + this.id);
}, },
_handlePrepareForMove: function() {},
_handleMoveComplete: function() {},
getRepeatIndices: function() getRepeatIndices: function()
{ {
function RepeatIndexData(repeat, index) function RepeatIndexData(repeat, index)
@@ -424,28 +426,48 @@ dojo.declare("alfresco.xforms.TextArea",
{ {
initializer: function(xform, xformsNode) initializer: function(xform, xformsNode)
{ {
// this.inherited("initializer", [ xform, xformsNode ]);
}, },
render: function(attach_point) render: function(attach_point)
{ {
attach_point.appendChild(this.domNode); attach_point.appendChild(this.domNode);
dojo.html.prependClass(this.domNode, "xformsTextArea"); dojo.html.prependClass(this.domNode, "xformsTextArea");
this.domNode.innerHTML = this.getInitialValue() || ""; this.widget = document.createElement("div");
tinyMCE.addMCEControl(this.domNode, this.id); this.domNode.appendChild(this.widget);
dojo.html.prependClass(this.widget, "xformsTextArea");
var editorDocument = tinyMCE.getInstanceById(this.id).getDoc(); this.widget.innerHTML = this.getInitialValue() || "";
editorDocument.widget = this; if (!this.isReadonly())
tinyMCE.addEvent(editorDocument, "blur", this._tinyMCE_blurHandler); {
this.widget = this.domNode; this._createTinyMCE();
}
}, },
setValue: function(value) setValue: function(value)
{ {
tinyMCE.selectedInstance = tinyMCE.getInstanceById(this.id); if (this.isReadonly())
tinyMCE.setContent(value); {
this.widget.innerHTML = value;
}
else
{
tinyMCE.selectedInstance = tinyMCE.getInstanceById(this.id);
tinyMCE.setContent(value);
}
}, },
getValue: function() getValue: function()
{ {
return tinyMCE.getContent(this.id); return this.isReadonly() ? this.widget.innerHTML : tinyMCE.getContent(this.id);
},
setReadonly: function(readonly)
{
this.inherited("setReadonly", [ readonly ]);
var mce = tinyMCE.getInstanceById(this.id);
if (readonly && mce)
{
this._removeTinyMCE();
}
else if (!readonly && !mce && this.widget)
{
this._createTinyMCE();
}
}, },
_tinyMCE_blurHandler: function(event) _tinyMCE_blurHandler: function(event)
{ {
@@ -455,8 +477,32 @@ dojo.declare("alfresco.xforms.TextArea",
_destroy: function() _destroy: function()
{ {
this.inherited("_destroy", []); this.inherited("_destroy", []);
dojo.debug("removing mce control " + this.id); if (!this.isReadonly())
{
dojo.debug("removing mce control " + this.id);
tinyMCE.removeMCEControl(this.id);
}
},
_handlePrepareForMove: function()
{
this._removeTinyMCE();
},
_handleMoveComplete: function()
{
this._createTinyMCE();
},
_removeTinyMCE: function()
{
var value = tinyMCE.getContent(this.id);
tinyMCE.removeMCEControl(this.id); tinyMCE.removeMCEControl(this.id);
},
_createTinyMCE:function()
{
tinyMCE.addMCEControl(this.widget, this.id);
var editorDocument = tinyMCE.getInstanceById(this.id).getDoc();
editorDocument.widget = this;
tinyMCE.addEvent(editorDocument, "blur", this._tinyMCE_blurHandler);
} }
}); });
@@ -465,7 +511,6 @@ dojo.declare("alfresco.xforms.AbstractSelectWidget",
{ {
initializer: function(xform, xformsNode) initializer: function(xform, xformsNode)
{ {
// this.inherited("initializer", [ xform, xformsNode ]);
}, },
getValues: function() getValues: function()
{ {
@@ -900,6 +945,30 @@ dojo.declare("alfresco.xforms.Group",
this.children[i]._destroy(); this.children[i]._destroy();
} }
}, },
_handlePrepareForMove: function()
{
this.inherited("_handlePrepareForMove", [ ]);
for (var i = 0; i < this.children.length; i++)
{
this.children[i]._handlePrepareForMove();
}
},
_handleMoveComplete: function()
{
this.inherited("_handleMoveComplete", [ ]);
for (var i = 0; i < this.children.length; i++)
{
this.children[i]._handleMoveComplete();
}
},
setReadonly: function(readonly)
{
this.inherited("setReadonly", [ readonly ]);
for (var i = 0; i < this.children.length; i++)
{
this.children[i].setReadonly(readonly);
}
},
render: function(attach_point) render: function(attach_point)
{ {
this.domNode.widget = this; this.domNode.widget = this;
@@ -1114,6 +1183,12 @@ dojo.declare("alfresco.xforms.Repeat",
this.inherited("_updateDisplay", []); this.inherited("_updateDisplay", []);
for (var i = 0; i < this.children.length; i++) for (var i = 0; i < this.children.length; i++)
{ {
if (dojo.html.hasClass(this.children[i].domContainer,
"xformsRow" + (i % 2 ? "Odd" : "Even")))
{
dojo.html.removeClass(this.children[i].domContainer,
"xformsRow" + (i % 2 ? "Odd" : "Even"));
}
dojo.html.addClass(this.children[i].domContainer, dojo.html.addClass(this.children[i].domContainer,
"xformsRow" + (i % 2 ? "Even" : "Odd")); "xformsRow" + (i % 2 ? "Even" : "Odd"));
} }
@@ -1218,12 +1293,14 @@ dojo.declare("alfresco.xforms.Repeat",
", " + toIndex + ")"); ", " + toIndex + ")");
var fromChild = this.getChildAt(fromIndex); var fromChild = this.getChildAt(fromIndex);
var toChild = this.getChildAt(toIndex); var toChild = this.getChildAt(toIndex);
fromChild._handlePrepareForMove();
toChild._handlePrepareForMove();
var swapNode = document.createElement("div"); var swapNode = document.createElement("div");
this.domNode.childContainerNode.replaceChild(swapNode, fromChild.domContainer); this.domNode.childContainerNode.replaceChild(swapNode, fromChild.domContainer);
this.domNode.childContainerNode.replaceChild(fromChild.domContainer, toChild.domContainer); this.domNode.childContainerNode.replaceChild(fromChild.domContainer, toChild.domContainer);
this.domNode.childContainerNode.replaceChild(toChild.domContainer, swapNode); this.domNode.childContainerNode.replaceChild(toChild.domContainer, swapNode);
fromChild._handleMoveComplete();
toChild._handleMoveComplete();
this.children[fromIndex] = toChild; this.children[fromIndex] = toChild;
this.children[toIndex] = fromChild; this.children[toIndex] = fromChild;
this._selectedIndex = toIndex; this._selectedIndex = toIndex;
@@ -2610,8 +2687,7 @@ _showAddContentPanel: function(addContentLink, currentPath)
}, },
_upload_completeHandler: function(fileName, webappRelativePath) _upload_completeHandler: function(fileName, webappRelativePath)
{ {
this._showStatus("Successfully uploaded " + fileName + this._showStatus("Successfully uploaded " + fileName + "."); // " into " + webappRelativePath);
" into " + webappRelativePath);
this._navigateToNode(webappRelativePath); this._navigateToNode(webappRelativePath);
}, },
_closeParentPathMenu: function() _closeParentPathMenu: function()