changes for menu management and N3 Refactoring
This commit is contained in:
parent
2e283c18a4
commit
dca2cd4a42
16 changed files with 1965 additions and 304 deletions
|
@ -293,4 +293,5 @@ p.no-individuals {
|
|||
-moz-border-radius: 3px;
|
||||
-webkit-border-radius: 3px;
|
||||
border-radius: 3px;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
4
webapp/web/css/menupage/testmenupage.css
Normal file
4
webapp/web/css/menupage/testmenupage.css
Normal file
|
@ -0,0 +1,4 @@
|
|||
/**Added by Huda for demonstration so feel free to edit/remove**/
|
||||
.hide {
|
||||
display:none;
|
||||
}
|
|
@ -27,6 +27,13 @@
|
|||
<vitro:confirmAuthorization />
|
||||
|
||||
<%
|
||||
//Check if special model, in which case forward
|
||||
if(request.getParameter("switchToDisplayModel") != null) {
|
||||
//forward to Edit Request Dispatch Controller
|
||||
String queryString = request.getQueryString();
|
||||
response.sendRedirect("http://localhost:8080/vivo/editRequestDispatch?" + queryString);
|
||||
}
|
||||
|
||||
// Decide which form to forward to, set subjectUri, subjectUriJson, predicateUri, predicateUriJson in request
|
||||
// Also get the Individual for the subjectUri and put it in the request scope
|
||||
// If a datapropKey is sent it as an http parameter, then set datapropKey and datapropKeyJson in request, and
|
||||
|
|
|
@ -29,7 +29,9 @@ public static Log log = LogFactory.getLog("edu.cornell.mannlib.vitro.webapp.jsp.
|
|||
if(request.getParameter("switchToDisplayModel") != null) {
|
||||
//forward to Edit Request Dispatch Controller
|
||||
String queryString = request.getQueryString();
|
||||
response.sendRedirect("http://localhost:8080/vivo/editRequestDispatch?" + queryString);
|
||||
//Instead of edit request which is what we'll do later, here we'll forward to Menu Management Controller
|
||||
//response.sendRedirect("http://localhost:8080/vivo/editRequestDispatch?" + queryString);
|
||||
response.sendRedirect("http://localhost:8080/vivo/editDisplayModel?" + queryString);
|
||||
}
|
||||
/*
|
||||
Decide which form to forward to, set subjectUri, subjectUriJson, predicateUri, and predicateUriJson in request.
|
||||
|
|
92
webapp/web/js/menupage/menumanagement_edit.js
Normal file
92
webapp/web/js/menupage/menumanagement_edit.js
Normal file
|
@ -0,0 +1,92 @@
|
|||
/* $This file is distributed under the terms of the license in /doc/license.txt$ */
|
||||
|
||||
var menuManagementEdit = {
|
||||
onLoad: function() {
|
||||
this.initObjects();
|
||||
this.bindEventListeners();
|
||||
},
|
||||
initObjects: function() {
|
||||
this.changeContentType = $('#changeContentType');
|
||||
this.selectContentType = $('#selectContentType');
|
||||
this.existingContentType = $('#existingContentType');
|
||||
this.selectClassGroupDropdown = $('#selectClassGroup');
|
||||
this.classesForClassGroup = $('#classesInSelectedGroup');
|
||||
this.selectedGroupForPage = $('#selectedContentTypeValue');
|
||||
this.selectClassesMessage = $('#selectClassesMessage');
|
||||
|
||||
},
|
||||
bindEventListeners: function() {
|
||||
// Listeners for vClass switching
|
||||
this.changeContentType.click(function() {
|
||||
alert("change content type");
|
||||
menuManagementEdit.showClassGroups();
|
||||
return false;
|
||||
});
|
||||
this.selectClassGroupDropdown.change(function() {
|
||||
alert("select class group dropdown");
|
||||
chooseClassGroup();
|
||||
return false;
|
||||
});
|
||||
},
|
||||
showClassGroups: function() {
|
||||
if(!this.existingContentType.hasClass("hide")) {
|
||||
this.existingContentType.addClass("hide");
|
||||
this.selectClassesMessage.addClass("hide");
|
||||
this.classesForClassGroup.addClass("hide");
|
||||
}
|
||||
this.selectContentType.removeClass("hide");
|
||||
|
||||
},
|
||||
hideClassGroups: function() {
|
||||
if(!this.selectContentType.hasClass("hide")) {
|
||||
|
||||
this.selectContentType.addClass("hide");
|
||||
}
|
||||
this.existingContentType.removeClass("hide");
|
||||
this.selectClassesMessage.removeClass("hide");
|
||||
this.classesForClassGroup.removeClass("hide");
|
||||
}
|
||||
,
|
||||
chooseClassGroup: function() {
|
||||
|
||||
var uri = "/dataservice?getSolrIndividualsByVClass=1&vclassId=";
|
||||
var vclassUri = this.selectClassGroupDropdown.val();
|
||||
uri += encodeURIComponent(vclassUri);
|
||||
alert("URI for class group " + uri);
|
||||
//Make ajax call to retrieve vclasses
|
||||
$.getJSON(url, function(results) {
|
||||
|
||||
if ( results.classes.length == 0 ) {
|
||||
|
||||
} else {
|
||||
//update existing content type with correct class group name and hide class group select again
|
||||
this.hideClassGroups();
|
||||
|
||||
this.selectedGroupForPage.html(results.classGroupName);
|
||||
//retrieve classes for class group and display with all selected
|
||||
this.classesForClassGroup.empty();
|
||||
this.classesForClassGroup.append("<ul id='selectedClasses' name='selectedClasses'>");
|
||||
this.classesForClassGroup.append('<li class="ui-state-default">' +
|
||||
'<input type="checkbox" name="allSelected" id="allSelected" value="all" checked</#if>' +
|
||||
'<label class="inline" for="All"> All</label>' +
|
||||
'</li>');
|
||||
$.each(results.classes, function(i, item) {
|
||||
var thisClass = results.classes[i];
|
||||
var thisClassName = thisClass.name;
|
||||
this.classesForClassGroup.append(' <li class="ui-state-default">' +
|
||||
'<input type="checkbox" name="classInClassGroup" value="' + thisClass.URI + '" />' +
|
||||
'<label class="inline" for="' + thisClassName + '"> ' + thisClassName + '</label>' +
|
||||
'</li>');
|
||||
});
|
||||
this.classesForClassGroup.append("</ul>");
|
||||
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
$(document).ready(function() {
|
||||
menuManagementEdit.onLoad();
|
||||
});
|
|
@ -55,7 +55,7 @@
|
|||
<label class="inline" for="custom"> Custom template</label>
|
||||
|
||||
<#if selectedTemplateType = "custom">
|
||||
<input type="text" name="customTemplate" />*
|
||||
<input type="text" name="customTemplate" value="${customTemplate}"/>*
|
||||
</#if>
|
||||
|
||||
<p>Select content type for the associated page</p>
|
||||
|
|
|
@ -0,0 +1,101 @@
|
|||
<#-- $This file is distributed under the terms of the license in /doc/license.txt$ -->
|
||||
|
||||
<#--Since we are going to use one template for adding and editing a menu item,
|
||||
it will be necessary to provide a freemarker variable that lets us know if you are in edit or add mode. bThis is up
|
||||
to you Huda the way you implement it. -->
|
||||
|
||||
<#-- some additional processing here which shows or hides the class group selection and classes based on initial action-->
|
||||
<#assign existingClassGroupStyle = " " />
|
||||
<#assign selectClassGroupStyle = 'class="hide"' />
|
||||
<#if menuAction = "Add">
|
||||
<#assign existingClassGroupStyle = 'class="hide"' />
|
||||
<#assign selectClassGroupStyle = " " />
|
||||
</#if>
|
||||
|
||||
<h3>${menuAction} menu item</h3>
|
||||
|
||||
<section>
|
||||
<form method="POST" action="${formUrls}">
|
||||
<input type="hidden" name="cmd" id="cmd" value="${menuAction}"/>
|
||||
<legend>${menuAction} menu item</legend>
|
||||
|
||||
<label for="menu-name">Name *</label>
|
||||
<input type="text" name="menuName" value="${menuName}" />
|
||||
|
||||
<label for="pretty-url">Pretty URL *</label>
|
||||
<input type="text" name="prettyUrl" value="${prettyUrl}" />
|
||||
<p>(Format: /<prettyURL> - ie. /people)</p>
|
||||
|
||||
<#--Commented out for now -->
|
||||
|
||||
|
||||
<p>Template *</p>
|
||||
|
||||
<input type="radio" name="selectedTemplate" value="default" <#if selectedTemplateType = "default">checked</#if> />
|
||||
<label class="inline" for="default"> Default</label>
|
||||
|
||||
<br />
|
||||
|
||||
<input type="radio" name="selectedTemplate" value="custom" <#if selectedTemplateType = "custom">checked</#if> />
|
||||
<label class="inline" for="custom"> Custom template</label>
|
||||
|
||||
<#if selectedTemplateType = "custom">
|
||||
<input type="text" name="customTemplate" value="${customTemplate}"/>*
|
||||
</#if>
|
||||
|
||||
<div id="existingContentType" name="existingContentType" ${existingClassGroupStyle}>
|
||||
<p>Selected content type for the associated page</p>
|
||||
<p ><span id="selectedContentTypeValue" name="selectedContentTypeValue">${associatedPage}</span> <a id="changeContentType" name="changeContentType" href="#">Change content type</a></p>
|
||||
</div>
|
||||
|
||||
|
||||
<div id="selectContentType" name="selectContentType" ${selectClassGroupStyle}>
|
||||
<label for="selectClassGroup">Select content type for the associated page *</label>
|
||||
<select name="selectClassGroup" id="selectClassGroup">
|
||||
<option value="-1"> </option>
|
||||
|
||||
<#list classGroups as aClassGroup>
|
||||
<option value="${aClassGroup.URI}"
|
||||
<#if aClassGroup.URI = associatedPageURI>
|
||||
selected
|
||||
</#if>
|
||||
>${aClassGroup.publicName}</option>
|
||||
</#list>
|
||||
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<p id="selectClassesMessage" name="selectClassesMessage">Select content to display</p>
|
||||
<section id="classesInSelectedGroup" name="classesInSelectedGroup">
|
||||
|
||||
<ul id="selectedClasses" name="selectedClasses">
|
||||
<#--Adding a default class for "ALL" in case all classes selected-->
|
||||
<li class="ui-state-default">
|
||||
<input type="checkbox" name="allSelected" id="allSelected" value="all" <#if isClassGroupPage = true || includeAllClasses = true>checked</#if>
|
||||
<label class="inline" for="All"> All</label>
|
||||
</li>
|
||||
<#list classGroup as classInClassGroup>
|
||||
<li class="ui-state-default">
|
||||
<input type="checkbox" name="classInClassGroup" value="${classInClassGroup.URI}"
|
||||
<#if includeAllClasses = true>checked</#if> />
|
||||
<label class="inline" for="${classInClassGroup.name}"> ${classInClassGroup.name}</label>
|
||||
<span class="ui-icon-sortable"></span> <#--sortable icon for dragging and dropping menu items-->
|
||||
</li>
|
||||
</#list>
|
||||
</ul>
|
||||
</section>
|
||||
|
||||
<input type="submit" name="submit-${menuAction}" value="Save changes" class="submit" /> or <a class="cancel" href="${formUrls}">Cancel</a>
|
||||
|
||||
<p>* required fields</p>
|
||||
</form>
|
||||
</section>
|
||||
|
||||
|
||||
<#-- Add necessary css files associated with this page
|
||||
${stylesheets.add('<link rel="stylesheet" href="${urls.base}/css/menupage/menupage.css" />')}-->
|
||||
${stylesheets.add('<link rel="stylesheet" href="${urls.base}/css/menupage/testmenupage.css" />')}
|
||||
${stylesheets.add('<link rel="stylesheet" href="${urls.base}/edit/forms/css/customForm.css" />')}
|
||||
|
||||
<#-- Add necessary javascript files associated with this page -->
|
||||
${scripts.add('<script type="text/javascript" src="${urls.base}/js/menupage/menumanagement_edit.js"></script>')}
|
Loading…
Add table
Add a link
Reference in a new issue