Skip to content

Commit

Permalink
Merge pull request #803 from fbarthez/pr/ERMODEditableListTemplate-v2
Browse files Browse the repository at this point in the history
Adds ERMODEditableListTemplate for editing all items in a list
  • Loading branch information
hprange authored Jan 17, 2022
2 parents 87766da + 01fcb74 commit 0b46666
Show file tree
Hide file tree
Showing 15 changed files with 411 additions and 19 deletions.
2 changes: 1 addition & 1 deletion Frameworks/D2W/ERModernDefaultSkin/Resources/d2w.d2wmodel
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
{"author" = "20"; "class" = "com.webobjects.directtoweb.Rule"; "lhs" = {"class" = "com.webobjects.eocontrol.EOKeyValueQualifier"; "key" = "pageConfiguration"; "selectorName" = "isLike"; "value" = "*Embedded*"; }; "rhs" = {"class" = "com.webobjects.directtoweb.Assignment"; "keyPath" = "printerButtonComponentName"; "value" = "ERXEmptyComponent"; }; },
{"author" = "20"; "class" = "com.webobjects.directtoweb.Rule"; "rhs" = {"class" = "com.webobjects.directtoweb.Assignment"; "keyPath" = "defaultMainPrintStylesheet"; "value" = {"filename" = "default_print_stylesheet.css"; "media" = "print"; }; }; },
{"author" = "20"; "class" = "com.webobjects.directtoweb.Rule"; "rhs" = {"class" = "com.webobjects.directtoweb.Assignment"; "keyPath" = "defaultMainScreenStylesheet"; "value" = {"filename" = "default_screen_stylesheet.css"; "media" = "screen"; }; }; },
{"author" = "20"; "class" = "com.webobjects.directtoweb.Rule"; "lhs" = {"class" = "com.webobjects.eocontrol.EOAndQualifier"; "qualifiers" = ({"class" = "com.webobjects.eocontrol.EOKeyValueQualifier"; "key" = "pageConfiguration"; "selectorName" = "isLike"; "value" = "*Embedded*"; }, {"class" = "com.webobjects.eocontrol.EOKeyValueQualifier"; "key" = "task"; "selectorName" = "isNotEqualTo"; "value" = "editRelationship"; }, {"class" = "com.webobjects.eocontrol.EOKeyValueQualifier"; "key" = "task"; "selectorName" = "isNotEqualTo"; "value" = "list"; }); }; "rhs" = {"class" = "com.webobjects.directtoweb.BooleanAssignment"; "keyPath" = "showHeader"; "value" = "true"; }; },
{"author" = "20"; "class" = "com.webobjects.directtoweb.Rule"; "lhs" = {"class" = "com.webobjects.eocontrol.EOAndQualifier"; "qualifiers" = ({"class" = "com.webobjects.eocontrol.EOKeyValueQualifier"; "key" = "pageConfiguration"; "selectorName" = "isLike"; "value" = "*Embedded*"; }, {"class" = "com.webobjects.eocontrol.EOKeyValueQualifier"; "key" = "task"; "selectorName" = "isNotEqualTo"; "value" = "editRelationship"; }, {"class" = "com.webobjects.eocontrol.EOKeyValueQualifier"; "key" = "task"; "selectorName" = "isNotEqualTo"; "value" = "list"; }, {"class" = "com.webobjects.eocontrol.EOAndQualifier"; "qualifiers" = ({"class" = "com.webobjects.eocontrol.EOKeyValueQualifier"; "key" = "task"; "selectorName" = "isNotEqualTo"; "value" = "edit"; }, {"class" = "com.webobjects.eocontrol.EOKeyValueQualifier"; "key" = "subTask"; "selectorName" = "isNotEqualTo"; "value" = "list"; }); }); }; "rhs" = {"class" = "com.webobjects.directtoweb.BooleanAssignment"; "keyPath" = "showHeader"; "value" = "true"; }; },
{"author" = "30"; "class" = "com.webobjects.directtoweb.Rule"; "lhs" = {"class" = "com.webobjects.eocontrol.EOKeyValueQualifier"; "key" = "pageConfiguration"; "selectorName" = "isLike"; "value" = "*Embedded*"; }; "rhs" = {"class" = "com.webobjects.directtoweb.BooleanAssignment"; "keyPath" = "showBottomBatchCount"; "value" = "true"; }; },
{"author" = "30"; "class" = "com.webobjects.directtoweb.Rule"; "lhs" = {"class" = "com.webobjects.eocontrol.EOAndQualifier"; "qualifiers" = ({"class" = "com.webobjects.eocontrol.EOKeyValueQualifier"; "key" = "pageConfiguration"; "selectorName" = "isLike"; "value" = "*Embedded*"; }, {"class" = "com.webobjects.eocontrol.EOKeyValueQualifier"; "key" = "parentPageConfiguration"; "selectorName" = "isNotEqualTo"; "value" = {"class" = "com.webobjects.foundation.NSKeyValueCoding$Null"; }; }); }; "rhs" = {"class" = "com.webobjects.directtoweb.BooleanAssignment"; "keyPath" = "showBottomActionBlock"; "value" = "true"; }; }
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
20 : pageConfiguration like '*Embedded*' => printerButtonComponentName = "ERXEmptyComponent" [com.webobjects.directtoweb.Assignment],
20 : *true* => defaultMainPrintStylesheet = {"filename" = "default_print_stylesheet.css"; "media" = "print"; } [com.webobjects.directtoweb.Assignment],
20 : *true* => defaultMainScreenStylesheet = {"filename" = "default_screen_stylesheet.css"; "media" = "screen"; } [com.webobjects.directtoweb.Assignment],
20 : (pageConfiguration like '*Embedded*' and task != 'editRelationship' and task != 'list') => showHeader = "true" [com.webobjects.directtoweb.BooleanAssignment],
20 : (pageConfiguration like '*Embedded*' and task != 'editRelationship' and task != 'list' and (task != 'edit' and subTask != 'list')) => showHeader = "true" [com.webobjects.directtoweb.BooleanAssignment],
30 : pageConfiguration like '*Embedded*' => showBottomBatchCount = "true" [com.webobjects.directtoweb.BooleanAssignment],
30 : (pageConfiguration like '*Embedded*' and parentPageConfiguration != null) => showBottomActionBlock = "true" [com.webobjects.directtoweb.BooleanAssignment]
)
Original file line number Diff line number Diff line change
Expand Up @@ -795,6 +795,14 @@ a.date-picker-control {
color: #d60000;
}

/* with EditList the lable is in the table header */
.EditListObjTableHd .Label abbr {
position: relative;
left: auto;
border-bottom: none;
color: #d60000;
}

label.ErrorLabel,
span.ErrorLabel {
/*color: #d60000;*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,8 @@ public String pageType(D2WContext c) {
_type = "ConfirmCancel";
} else if (pageConfig.contains("EditWizard")) {
_type = "EditWizard";
} else if (pageConfig.contains("EditList")) {
_type = "EditList";
} else if (pageConfig.contains("InspectWizard")) {
_type = "InspectWizard";
} else if (pageConfig.contains("Create")) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ public class ERMDDefaultConfigurationNameAssignment extends ERDDefaultConfigurat
new NSArray<String>(new String[] {"propertyKey", "object.entityName", "entity.name"}), "createEmbeddedConfigurationName",
new NSArray<String>(new String[] {"propertyKey", "object.entityName", "entity.name"}), "selectEmbeddedConfigurationName",
new NSArray<String>(new String[] {"propertyKey", "object.entityName", "entity.name"}), "pickEmbeddedConfigurationName",
new NSArray<String>(new String[] {"propertyKey", "subTask", "object.entityName", "entity.name"}), "editListEmbeddedConfigurationName",
new NSArray<String>(new String[] {"propertyKey", "object.entityName", "entity.name"}), "editRelationshipEmbeddedConfigurationName",
new NSArray<String>(new String[] {"propertyKey", "object.entityName", "entity.name", "inlineTask"}), "inlineConfigurationName"
});
Expand Down Expand Up @@ -100,6 +101,17 @@ public Object selectEmbeddedConfigurationName(D2WContext c) {
return "SelectEmbedded" + entityNameForContext(c);
}

/**
* Generates a default embedded edit list page configuration
* based on the current entity name. Default format
* is 'EditListEmbedded' + entity name.
* @param c current D2W context
* @return default edit list page configuration name
*/
public Object editListEmbeddedConfigurationName(D2WContext c) {
return "EditListEmbedded" + entityNameForContext(c);
}

/**
* Generates a default embedded create page configuration
* based on the current entity name. Default format
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@ public String localizedTitle() {
@Override
public boolean isEditing() {
String task = d2wContext().task();
return "edit".equals(task) || "query".equals(task);
String subTask = (String) d2wContext().valueForKey("subTask");
return ("edit".equals(task) && !"list".equals(subTask)) || "query".equals(task);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,18 @@
<webobject name = "ShowTopBatchCount">
<webobject name = "TopNavBatchSize"><webobject name = "BatchSizeControl" /></webobject>
</webobject>
<webobject name = "ToManyListRepetition" />
<webobject name = "ShowBottomBatchNavBar">
<webobject name = "BottomNavBar"> <webobject name = "NavigationBar" /> </webobject>
</webobject>
<webobject name = "ShowBottomBatchCount">
<webobject name = "BottomNavBatchSize"><webobject name = "BatchSizeControl" /></webobject>
</webobject>
<webobject name = "IsNotEditList">
<webobject name = "ToManyListRepetition" />
<webobject name = "ShowBottomBatchNavBar">
<webobject name = "BottomNavBar"> <webobject name = "NavigationBar" /> </webobject>
</webobject>
<webobject name = "ShowBottomBatchCount">
<webobject name = "BottomNavBatchSize"><webobject name = "BatchSizeControl" /></webobject>
</webobject>
</webobject>
<webobject name = "IsEditList">
<webobject name = "EditListComponent" />
</webobject>
</webobject>
</div>
</webobject>
Expand All @@ -42,6 +47,9 @@
<webobject name = "IsEntityWritable">
<li><webobject name = "NewButton" /></li>
</webobject>
<webobject name = "ShowEditList">
<li><webobject name = "EditListButton"/></li>
</webobject>
</ul>
</webobject>
</webobject>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@ IsEntityWritable: WOConditional {
condition = isEntityCreatable;
}

ShowEditList: WOConditional {
_unroll = true;
condition = shouldShowEditListButton;
}

IsToMany: WOConditional {
condition = isRelationshipToMany;
}
Expand Down Expand Up @@ -63,6 +68,16 @@ NewButton: CCSmartAjaxButton {
dontSubmitForm = true;
}

EditListButton: CCSmartAjaxButton {
alt = "Enables editing of the list of relationship objects";
action = editListAction;
class = "Button PageButton EditListPageButton";
value = "Edit list";
useAjax = true;
updateContainerID = d2wContext.idForMainContainer;
dontSubmitForm = true;
}

PageWrapper: WOSwitchComponent {
WOComponentName = pageWrapperName;
_componentUnroll = true;
Expand Down Expand Up @@ -105,14 +120,23 @@ RequiredWrapper : ERMODRequiredWrapper {
}

ShowBottomActionBlock : WOConditional {
condition = d2wContext.showBottomActionBlock;
condition = showBottomActionBlock;
}

InnerWrapper : WOGenericContainer {
elementName = "div";
class = d2wContext.classForInnerWrapper;
}

IsNotEditList : WOConditional {
condition = displayEditList;
negate = true;
}

IsEditList : WOConditional {
condition = displayEditList;
}

RepetitionUpdateContainer : AjaxUpdateContainer {
elementName = "div";
id = idForRepetitionContainer;
Expand All @@ -130,6 +154,13 @@ ToManyListRepetition: WOSwitchComponent {
updateContainerID = idForRepetitionContainer;
}

EditListComponent: ERXD2WList {
pageConfiguration = d2wContext.editListEmbeddedConfigurationName;
action = saveAction;
dataSource = editListDataSource;
settings = settings;
}

ToOneListRepetition: WOSwitchComponent {
WOComponentName = d2wContext.toOneRepetitionComponentName;
d2wContext = localContext;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<webobject name = "PageWrapper">
<webobject name = "RequiredWrapper">
<webobject name = "ShowTopActionBlock">
<webobject name = "TopActionBlock">
<webobject name = "ShouldShowDefaultPageButtons">
<webobject name = "ShowCancel">
<ul class = "ActionList">
<li><webobject name = "ReturnButton" /></li>
</ul>
</webobject>
</webobject>
<webobject name = "SecondaryActionBlock" />
</webobject>
</webobject>
<webobject name = "InnerWrapper">
<webobject name = "ErrorBlock" />
<webobject name = "ListNotEmpty">
<webobject name = "RepetitionUpdateContainer">
<webobject name = "ObserveEditList">
<webobject name = "ListPageRepetition" />
</webobject>
<webobject name = "ShowBottomBatchNavBar">
<webobject name = "BottomNavBar"> <webobject name = "NavigationBar" /> </webobject>
</webobject>
<webobject name = "ShowBottomBatchCount">
<webobject name = "BottomNavBatchSize"><webobject name = "BatchSizeControl" /></webobject>
</webobject>
<webobject name = "ShowBottomActionBlock">
<webobject name = "BottomActionBlock">
<webobject name = "ShouldShowDefaultPageButtons">
<ul class = "ActionList">
<li><webobject name = "CancelButton" /></li>
<li><webobject name = "SubmitChanges" /></li>
</ul>
</webobject>
<webobject name = "SecondaryActionBlock" />
</webobject>
</webobject>
</webobject>
</webobject>
<webobject name = "ListEmpty"><webobject name = "EmptyMessageComponent" /> </webobject>
</webobject>
</webobject>
</webobject>
Original file line number Diff line number Diff line change
@@ -0,0 +1,145 @@
PageWrapper: WOSwitchComponent {
WOComponentName = d2wContext.pageWrapperName;
_componentUnroll = true;
_unroll = true;
}

RequiredWrapper : ERMODRequiredWrapper {
d2wContext = d2wContext;
watchedContainerID = d2wContext.idForRepetitionContainer;
}


ShowTopActionBlock : WOConditional {
condition = d2wContext.showTopActionBlock;
}


TopActionBlock : WOGenericContainer {
elementName = "div";
class = d2wContext.classForTopActionBlock;
}


ShouldShowDefaultPageButtons : WOConditional {
condition = d2wContext.shouldShowDefaultPageButtons;
}

ShowCancel: WOConditional {
condition = showCancel;
}

ReturnButton: CCSmartAjaxButton {
alt = "Returns to the previous page";
value = d2wContext.returnButtonLabel;
action = backAction;
class = "Button PageButton ReturnPageButton";
useAjax = d2wContext.useAjaxControlsWhenEmbedded;
updateContainerID = d2wContext.idForParentMainContainer;
}

SecondaryActionBlock: ERMODSecondaryActionButtons {
d2wContext = d2wContext;
dataSource = dataSource;
displayGroup = displayGroup;
}

InnerWrapper : WOGenericContainer {
elementName = "div";
class = d2wContext.classForInnerWrapper;
}

ErrorBlock : ERMODErrorBlock {
d2wContext = d2wContext;
errorMessage = errorMessage;
errorMessages = errorMessages;
}

RepetitionUpdateContainer : AjaxUpdateContainer {
elementName = "div";
id = d2wContext.idForRepetitionContainer;
onSuccess = updateBottomActionBlock;
}

ObserveEditList : AjaxObserveField {
updateContainerID = d2wContext.idforRepetitionContainer;
}

ShowBottomActionBlock : WOConditional {
condition = d2wContext.showBottomActionBlock;
}

BottomActionBlock : AjaxUpdateContainer {
class = d2wContext.classForBottomActionBlock;
id = idForBottomActionBlock;
}

CancelButton: CCSmartAjaxButton {
alt = "Reverts your changes";
value = d2wContext.cancelButtonLabel;
action = cancel;
dontSubmitForm = true;
class = "Button PageButton CancelPageButton";
useAjax = false;
updateContainerID = d2wContext.idForParentMainContainer;
}

SubmitChanges: CCSmartAjaxButton {
action = saveAction;
alt = "Saves your changes";
value = d2wContext.saveButtonLabel;
class = "Button PageButton SubmitPageButton";
useAjax = false;
updateContainerID = d2wContext.idForParentMainContainer;
}

ShowBottomBatchNavBar : WOConditional {
condition = d2wContext.showBottomBatchNavBar;
}

ShowBottomBatchCount : WOConditional {
condition = d2wContext.showBottomBatchCount;
}

BottomNavBar : WOGenericContainer {
elementName = "div";
class = d2wContext.classForBottomNavBar;
}

BottomNavBatchSize : WOGenericContainer {
elementName = "div";
class = d2wContext.classForBottomBatchSize;
}

BatchSizeControl : ERMDBatchSizeControl {
displayGroup = displayGroup;
updateContainerID = d2wContext.idForRepetitionContainer;
d2wContext = d2wContext;
}

NavigationBar: WOSwitchComponent {
WOComponentName = d2wContext.batchNavigationBarComponentName;
displayGroup = displayGroup;
d2wContext = d2wContext;
updateContainerID = d2wContext.idForRepetitionContainer;
}

EmptyMessageComponent: WOSwitchComponent {
WOComponentName = d2wContext.emptyListComponentName;
d2wContext = d2wContext;
}

ListEmpty: WOConditional {
condition = isListEmpty;
}

ListNotEmpty: WOConditional {
condition = isListEmpty;
negate = true;
}

ListPageRepetition: WOSwitchComponent {
WOComponentName = d2wContext.repetitionComponentName;
d2wContext = d2wContext;
displayGroup = displayGroup;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"WebObjects Release" = "WebObjects 5.0"; encoding = "UTF-8"; variables = {}; }
Loading

0 comments on commit 0b46666

Please sign in to comment.