Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #26440: Edit Content Routing on Content search were broken #26593

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@

String structureSelected = null;
final String variableName = (String) request.getParameter("filter");
String velocityVarName = null;

if(UtilMethods.isSet(variableName)){
if (com.dotmarketing.beans.Host.HOST_VELOCITY_VAR_NAME.equals(variableName)){
Expand All @@ -68,7 +67,7 @@
try {
ContentType filterContentType = APILocator.getContentTypeAPI(user).find(variableName);
structureSelected = filterContentType != null ? filterContentType.id() : null;
velocityVarName = filterContentType.variable();

} catch (NotFoundInDbException e) {
structureSelected = null;
}
Expand All @@ -79,7 +78,6 @@
try {
ContentType contentType = APILocator.getContentTypeAPI(user).find(structureSelected);

velocityVarName = contentType.variable();

if (contentType != null && com.dotmarketing.beans.Host.HOST_VELOCITY_VAR_NAME.equals(contentType.variable()) ){
structureSelected = null;
Expand Down Expand Up @@ -572,7 +570,7 @@
label: "<%= UtilMethods.escapeSingleQuotes(LanguageUtil.get(pageContext, "Add-New-Content" )) %>",
iconClass: "plusIcon",
onClick: function() {
addNewContentlet(null, "<%= velocityVarName %>");
addNewContentlet(null);
}
});
menu.addChild(menuItem1);
Expand Down Expand Up @@ -781,7 +779,7 @@
}
</script>
<ul data-dojo-type="dijit/Menu" id="actionPrimaryMenu" style="display: none;">
<li data-dojo-type="dijit/MenuItem" data-dojo-props="onClick:function() {addNewContentlet('', '<%= velocityVarName %>')}"><%= UtilMethods.escapeSingleQuotes(LanguageUtil.get(pageContext, "Add-New-Content" )) %></li>
<li data-dojo-type="dijit/MenuItem" data-dojo-props="onClick:function() {addNewContentlet('')}"><%= UtilMethods.escapeSingleQuotes(LanguageUtil.get(pageContext, "Add-New-Content" )) %></li>
<li data-dojo-type="dijit/MenuItem" data-dojo-props="onClick:importContent">
<%= UtilMethods.escapeSingleQuotes(LanguageUtil.get(pageContext, "Import-Content" )) %>
</li>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -831,10 +831,13 @@ final String calendarEventInode = null!=calendarEventSt ? calendarEventSt.inode(
function updateSelectedStructAux(){
structureInode = dijit.byId('selectedStructAux').value;
addNewContentlet(structureInode);


}

function dispatchCreateContentletEvent(url, contentType) {
var customEvent = document.createEvent("CustomEvent");

customEvent.initCustomEvent("ng-event", false, false, {
name: "create-contentlet",
data: {
Expand All @@ -849,12 +852,30 @@ final String calendarEventInode = null!=calendarEventSt ? calendarEventSt.inode(


function addNewContentlet(structureInode, contentType){
if(structureInode == undefined || structureInode==""){
// This gets the catchall and opens the dialog to select a contentType, and also retrieves the content type when is a custom portlet

if(!contentType){

// This is the same way they get the current var name on downloadToExcel method

let structureVelraw = dojo.byId("structureVelocityVarNames").value;

let structInoderaw = dojo.byId("structureInodesList").value;

let structureVelArray = structureVelraw.split(";");

let structureInodeArray = structInoderaw.split(";");

let contentTypeInode = dijit.byId('structure_inode').value;

contentType = structureVelArray.find((varName, i) => structureInodeArray[i] === contentTypeInode)
}

if(structureInode == undefined || structureInode==""){
// This gets the catchall and opens the dialog to select a contentType, and also retrieves the content type when is a custom portlet
structureInode = dijit.byId('structure_inode').value;
}
if(structureInode == undefined || structureInode=="" || structureInode == "catchall"){
dijit.byId("selectStructureDiv").show();
dijit.byId("selectStructureDiv").show();
return;
}
else if(structureInode == '<%=calendarEventInode %>'){
Expand Down
Loading