Skip to content

Commit 8b2186d

Browse files
author
svuillet
committed
Fix #14353
1 parent 2b962b2 commit 8b2186d

File tree

6 files changed

+62
-52
lines changed

6 files changed

+62
-52
lines changed

mobile-war/src/main/java/org/silverpeas/mobile/client/apps/workflow/WorkflowApp.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
import com.google.gwt.core.client.GWT;
2828
import com.google.gwt.core.client.JavaScriptObject;
2929
import com.google.gwt.http.client.RequestException;
30+
import com.google.gwt.user.client.Window;
3031
import org.fusesource.restygwt.client.Method;
3132
import org.silverpeas.mobile.client.SpMobil;
3233
import org.silverpeas.mobile.client.apps.navigation.events.app.external.AbstractNavigationEvent;

mobile-war/src/main/java/org/silverpeas/mobile/client/apps/workflow/pages/WorkflowPage.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,7 @@ private void creationGesture() {
141141
ActionButton act = new ActionButton();
142142
act.setId(ACTION_CREATE);
143143
act.init(instanceId, "create", msg.create(), null);
144+
act.addClass("add-workflow-demand");
144145
addActionShortcut(act);
145146
//addActionMenu(act);
146147
} else {

mobile-war/src/main/java/org/silverpeas/mobile/client/apps/workflow/pages/WorkflowPresentationPage.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
import com.google.gwt.dom.client.HeadingElement;
2929
import com.google.gwt.uibinder.client.UiBinder;
3030
import com.google.gwt.uibinder.client.UiField;
31+
import com.google.gwt.user.client.Window;
3132
import com.google.gwt.user.client.ui.Widget;
3233
import org.silverpeas.mobile.client.apps.workflow.pages.widgets.ActionButton;
3334
import org.silverpeas.mobile.client.apps.workflow.pages.widgets.Field;

mobile-war/src/main/java/org/silverpeas/mobile/client/apps/workflow/pages/widgets/ActionButton.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ public void init(String instanceId, String actionCode, String actionLabel, Strin
6363
this.actionLabel = actionLabel;
6464
this.state = state;
6565
action.setTitle(actionLabel);
66+
action.setText(actionLabel);
6667
}
6768

6869
@UiHandler("action")
@@ -76,4 +77,8 @@ void executeAction(ClickEvent event){
7677
ActionsMenu.close(getElement());
7778
}
7879

80+
public void addClass(String className) {
81+
container.getElement().addClassName(className);
82+
action.setText("");
83+
}
7984
}

mobile-war/src/main/java/org/silverpeas/mobile/client/apps/workflow/pages/widgets/ActionButton.ui.xml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,7 @@
2626
xmlns:g='urn:import:com.google.gwt.user.client.ui'>
2727

2828
<ui:with field='msg' type='org.silverpeas.mobile.client.apps.workflow.resources.WorkflowMessages'/>
29-
30-
<g:HTMLPanel tag="li" ui:field="container" styleName="add-workflow-demand">
29+
<g:HTMLPanel tag="li" ui:field="container">
3130
<g:Anchor styleName="" ui:field="action"/>
3231
</g:HTMLPanel>
3332
</ui:UiBinder>

mobile-war/src/main/java/org/silverpeas/mobile/server/services/ServiceWorkflow.java

Lines changed: 53 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,11 @@
3939
import org.silverpeas.core.contribution.content.form.Form;
4040
import org.silverpeas.core.contribution.content.form.RecordTemplate;
4141
import org.silverpeas.core.contribution.content.form.field.MultipleUserField;
42+
import org.silverpeas.core.contribution.content.form.record.GenericDataRecord;
4243
import org.silverpeas.core.util.DateUtil;
4344
import org.silverpeas.core.util.file.FileRepositoryManager;
45+
import org.silverpeas.core.workflow.api.event.TaskDoneEvent;
46+
import org.silverpeas.core.workflow.api.model.Action;
4447
import org.silverpeas.kernel.logging.SilverLogger;
4548
import org.silverpeas.core.web.rs.annotation.Authorized;
4649
import org.silverpeas.core.workflow.api.Workflow;
@@ -409,66 +412,66 @@ public WorkflowFormActionDTO getActionForm(@PathParam("instanceId") String insta
409412
} else {
410413
ProcessInstance instance =
411414
Workflow.getProcessInstanceManager().getProcessInstance(instanceId);
412-
413415
form = instance.getProcessModel().getActionForm(action);
414416
data = instance.getFolder();
415417
dto.setId(instance.getInstanceId());
416418
}
417-
418-
for (Input input : form.getInputs()) {
419-
WorkflowFieldDTO fdto = new WorkflowFieldDTO();
420-
fdto.setId(getComponentId());
421-
fdto.setDisplayerName(input.getDisplayerName());
422-
fdto.setMandatory(input.isMandatory());
423-
fdto.setReadOnly(input.isReadonly());
424-
fdto.setName(input.getItem().getName());
425-
fdto.setActionName(action);
426-
fdto.setLabel(
427-
input.getItem().getLabel(role, getUser().getUserPreferences().getLanguage()));
428-
fdto.setValue(input.getValue());
429-
if (!action.equals("create")) {
430-
Field f = data.getField(input.getItem().getName());
431-
if (f.getValue() != null && !f.getValue().isEmpty()) {
432-
if (input.getItem().getType().equalsIgnoreCase("date")) {
433-
fdto.setValue(f.getValue().replaceAll("/", "-"));
434-
//TODO : user, multipleUser, group data
435-
} else if (input.getItem().getType().equalsIgnoreCase("user")) {
436-
UserDetail u = (UserDetail) f.getObjectValue();
437-
fdto.setValueId(u.getId());
438-
fdto.setValue(f.getValue());
439-
} else if (input.getItem().getType().equalsIgnoreCase("multipleUser")) {
440-
String[] usersId = ((MultipleUserField) f).getUserIds();
441-
if (usersId.length > 0) {
442-
String ids = Arrays.toString(usersId);
443-
ids = ids.substring(1, ids.length() - 1);
444-
fdto.setValueId(ids);
445-
String value = "";
446-
for (String id : usersId) {
447-
value += Administration.get().getUserDetail(id).getDisplayedName() + ",";
419+
if (form != null) {
420+
for (Input input : form.getInputs()) {
421+
WorkflowFieldDTO fdto = new WorkflowFieldDTO();
422+
fdto.setId(getComponentId());
423+
fdto.setDisplayerName(input.getDisplayerName());
424+
fdto.setMandatory(input.isMandatory());
425+
fdto.setReadOnly(input.isReadonly());
426+
fdto.setName(input.getItem().getName());
427+
fdto.setActionName(action);
428+
fdto.setLabel(
429+
input.getItem().getLabel(role, getUser().getUserPreferences().getLanguage()));
430+
fdto.setValue(input.getValue());
431+
if (!action.equals("create")) {
432+
Field f = data.getField(input.getItem().getName());
433+
if (f.getValue() != null && !f.getValue().isEmpty()) {
434+
if (input.getItem().getType().equalsIgnoreCase("date")) {
435+
fdto.setValue(f.getValue().replaceAll("/", "-"));
436+
//TODO : user, multipleUser, group data
437+
} else if (input.getItem().getType().equalsIgnoreCase("user")) {
438+
UserDetail u = (UserDetail) f.getObjectValue();
439+
fdto.setValueId(u.getId());
440+
fdto.setValue(f.getValue());
441+
} else if (input.getItem().getType().equalsIgnoreCase("multipleUser")) {
442+
String[] usersId = ((MultipleUserField) f).getUserIds();
443+
if (usersId.length > 0) {
444+
String ids = Arrays.toString(usersId);
445+
ids = ids.substring(1, ids.length() - 1);
446+
fdto.setValueId(ids);
447+
String value = "";
448+
for (String id : usersId) {
449+
value += Administration.get().getUserDetail(id).getDisplayedName() + ",";
450+
}
451+
value = value.substring(0, value.length() - 1);
452+
fdto.setValue(value);
448453
}
449-
value = value.substring(0, value.length() - 1);
450-
fdto.setValue(value);
454+
} else if (input.getItem().getType().equalsIgnoreCase("group")) {
455+
GroupDetail g = (GroupDetail) f.getObjectValue();
456+
fdto.setValueId(g.getId());
457+
fdto.setValue(f.getValue());
458+
} else if (input.getItem().getType().equalsIgnoreCase("file")) {
459+
SimpleDocument doc = AttachmentServiceProvider.getAttachmentService()
460+
.searchDocumentById(new SimpleDocumentPK(f.getValue()),
461+
getUser().getUserPreferences().getLanguage());
462+
fdto.setValue(doc.getTitle());
463+
fdto.setValueId(doc.getId());
464+
} else {
465+
fdto.setValue(f.getValue());
451466
}
452-
} else if (input.getItem().getType().equalsIgnoreCase("group")) {
453-
GroupDetail g = (GroupDetail) f.getObjectValue();
454-
fdto.setValueId(g.getId());
455-
fdto.setValue(f.getValue());
456-
} else if (input.getItem().getType().equalsIgnoreCase("file")) {
457-
SimpleDocument doc = AttachmentServiceProvider.getAttachmentService()
458-
.searchDocumentById(new SimpleDocumentPK(f.getValue()),
459-
getUser().getUserPreferences().getLanguage());
460-
fdto.setValue(doc.getTitle());
461-
fdto.setValueId(doc.getId());
462-
} else {
463-
fdto.setValue(f.getValue());
464467
}
465468
}
469+
fdto.setType(input.getItem().getType());
470+
fdto.setValues(input.getItem().getKeyValuePairs());
471+
dto.addField(fdto);
466472
}
467-
fdto.setType(input.getItem().getType());
468-
fdto.setValues(input.getItem().getKeyValuePairs());
469-
dto.addField(fdto);
473+
dto.setTitle(form.getTitle(role, getUser().getUserPreferences().getLanguage()));
470474
}
471-
dto.setTitle(form.getTitle(role, getUser().getUserPreferences().getLanguage()));
472475
} catch (Exception e) {
473476
SilverLogger.getLogger(this).error(e);
474477
throw e;

0 commit comments

Comments
 (0)