updates for page management

This commit is contained in:
hjkhjk54 2012-05-16 21:13:33 +00:00
parent e3158dadaa
commit 8e98850493
11 changed files with 888 additions and 1 deletions

View file

@ -0,0 +1,5 @@
.menuFlag {
width:67px;
height:18px;
background: url("../../images/checkMark.png") no-repeat left center;
}

View file

@ -0,0 +1,19 @@
/* $This file is distributed under the terms of the license in /doc/license.txt$ */
.pageContent {"background-color":"","padding-left":"","padding-top":"","border-width":"","border-style":"","border-color":"#ccc"}
.pageContentContainer {background-color:#f5f5f5;border-color:#ccc;border-width:1px;border-style:solid;margin-bottom:4px;}
.pageContentTypeLabel {padding-left:6px;}
.pageContentWrapper {background-color:#f9f9f9;padding-left:6px;padding-top:2px;border-top-width:1px;border-style:solid;border-color:#ccc;}
.pageContentExpand {float:right;padding-right:5px;}
.arrow {
width:13px; height:9px; display:block;
}
.expandArrow {background-image:url(../../images/individual/arrow-down.gif);}
.collapseArrow {background-image:url(../../images/individual/arrow-up.gif);}
.deleteButton{margin-bottom:5px;}

Binary file not shown.

After

Width:  |  Height:  |  Size: 283 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 179 B

View file

@ -0,0 +1,295 @@
/* $This file is distributed under the terms of the license in /doc/license.txt$ */
var pageManagementUtils = {
// on initial page setup
onLoad:function(){
if (this.disableFormInUnsupportedBrowsers()) {
return;
}
this.mixIn();
this.initObjects();
this.bindEventListeners();
this.initDisplay();
},
disableFormInUnsupportedBrowsers: function() {
var disableWrapper = $('#ie67DisableWrapper');
// Check for unsupported browsers only if the element exists on the page
if (disableWrapper.length) {
if (vitro.browserUtils.isIELessThan8()) {
disableWrapper.show();
$('.noIE67').hide();
return true;
}
}
return false;
},
mixIn: function() {
// Mix in the custom form utility methods
$.extend(this, vitro.customFormUtils);
// Get the custom form data from the page
$.extend(this, customFormData);
},
initObjects:function(){
this.counter = 0;
this.contentTypeSelect = $("#typeSelect");
//list of options
this.contentTypeSelectOptions = $('select#typeSelect option');
this.classGroupSection = $("section#classGroup");
this.nonClassGroupSection = $("section#nonClassGroup");
},
initDisplay: function(){
//right side components
this.contentTypeSelectOptions.eq(0).attr('selected', 'selected');
$('select#selectClassGroup option').eq(0).attr('selected', 'selected');
//Why would you want to hide this? This hides everything
// $("section#pageDetails").hide();
$("section#headerBar").hide();
this.classGroupSection.hide();
this.nonClassGroupSection.hide();
$("section#classesInSelectedGroup").addClass('hidden');
$("input#moreContent").hide();
//left side components
$("input.default-template").attr('checked',true);
$("input#menuCheckbox").attr('checked',false);
$("section#menu").hide();
},
bindEventListeners:function(){
$("input.default-template").click( function() {
$("section#custom-template").addClass('hidden');
});
$("input.custom-template").click( function() {
$("section#custom-template").removeClass('hidden');
});
$("input#menuCheckbox").click( function() {
if ( $("section#menu").is(':hidden') ) {
$("section#menu").show();
}
else {
$("section#menu").hide();
}
});
$("input#submit").click( function() {
$("section#pageDetails").show();
});
//Collapses the current content and creates a new section of content
//Resets the content to be cloned to default settings
$("input#moreContent").click( function() {
var selectedType = pageManagementUtils.contentTypeSelect.val();
var selectedTypeText = $("#typeSelect :select").text();
//Not sure why selected group here? This won't always be true for more content
//var selectedGroup = $('select#selectClassGroup').val();
//Aren't these already hidden?
//Hide both sections
$("section#classGroup").hide();
$("section#nonClassGroup").hide();
//Reset class group
pageManagementUtils.resetClassGroupSection();
pageManagementUtils.contentTyeSelectOptions.eq(0).attr('selected', 'selected');
$("input#moreContent").hide();
if ( $("div#leftSide").css("height") != undefined ) {
$("div#leftSide").css("height","");
if ( $("div#leftSide").height() < $("div#rightSide").height() ) {
$("div#leftSide").css("height",$("div#rightSide").height() + "px");
}
}
$("section#headerBar").hide();
$("section#headerBar").text("");
//pageManagementUtils.cloneContentArea(selectedType,selectedGroup);
pageManagementUtils.cloneContentArea(selectedType, selectedTypeText);
pageManagementUtils.contentTypeSelect.focus();
});
$("select#selectClassGroup").change( function() {
if ( $("select#selectClassGroup").val() == "" ) {
$("section#classesInSelectedGroup").addClass('hidden');
$("div#leftSide").css("height","");
$("input#moreContent").hide();
}
else {
$("section#classesInSelectedGroup").removeClass('hidden');
$("input#moreContent").show();
if ( $("div#leftSide").height() < $("div#rightSide").height() ) {
$("div#leftSide").css("height",$("div#rightSide").height() + "px");
}
}
});
$("select#typeSelect").change( function() {
$('input#variable').val("");
$('textarea#textArea').val("");
if ( $("#typeSelect").val() == "Browse Class Group" ) {
$("section#classGroup").show();
$("section#nonClassGroup").hide();
$("input#moreContent").hide();
$("section#headerBar").text("Browse Class Group - ");
$("section#headerBar").show();
}
if ( $("#typeSelect").val() == "Fixed HTML" || $("#typeSelect").val() == "SPARQL Query Results" ) {
$("section#classGroup").hide();
if ( $("#typeSelect").val() == "Fixed HTML" ) {
$('span#taSpan').text("Enter fixed HTML here");
$("section#headerBar").text("Fixed HTML - ");
}
else {
$('span#taSpan').text("Enter SPARQL query here");
$("section#headerBar").text("SPARQL Query Results - ");
}
$("section#nonClassGroup").show();
$("section#headerBar").show();
$('select#selectClassGroup option').eq(0).attr('selected', 'selected');
$("section#classesInSelectedGroup").addClass('hidden');
$("input#moreContent").show();
}
if ( $("#typeSelect").val() == "" ) {
$("section#classGroup").hide();
$("section#nonClassGroup").hide();
$("input#moreContent").hide();
$('select#selectClassGroup option').eq(0).attr('selected', 'selected');
$("section#classesInSelectedGroup").addClass('hidden');
$("section#headerBar").hide();
$("section#headerBar").text("");
}
pageManagementUtils.adjustSaveButtonHeight();
});
},
//Clone content area
cloneContentArea: function(contentType, contentTypeLabel) {
var ctr = pageManagementUtils.counter;
var counter = pageManagementUtils.counter;
var varOrClas;
if ( contentType == "fixedHTML" || contentType == "sparqlResults" ) {
var $newContentObj = $('section#nonClassGroup').clone();
$newContentObj.addClass("pageContent");
varOrClass = $newContentObj.find('input').val();
$newContentObj.show();
//Save content type
$newContentObj.attr("contentType", contentType);
$newContentObj.attr("id", contentType + counter);
$newContentObj.find('input#variable').attr("id","variable" + counter);
$newContentObj.find('textarea#textArea').attr("id","textArea" + counter);
$newContentObj.find('input#variable').attr("name","variable" + counter);
$newContentObj.find('textarea#textArea').attr("name","textArea" + counter);
$newContentObj.find('label#variableLabel').attr("id","variableLabel" + counter);
$newContentObj.find('label#taLabel').attr("id","taLabel" + counter);
// There's a jquery bug when cloning textareas: the value doesn't
// get cloned. So
// copy the value "manually."
var taValue = $('textarea#textArea').val();
$newContentObj.find('textarea').val(taValue);
}
else if ( contentType == "browseClassGroup" ) {
var $newContentObj = $('section#classGroup').clone();
$newContentObj.addClass("pageContent");
$newContentObj.show();
$newContentObj.attr("contentType", contentType);
$newContentObj.attr("id", "classGroup" + counter);
$newContentObj.find('section#selectContentType').attr("id", "selectContentType" + counter);
$newContentObj.find('select#selectClassGroup').val(groupValue);
$newContentObj.find('select#selectClassGroup').attr("id","selectClassGroup" + counter);
$newContentObj.find('select#selectClassGroup' + counter).attr("name","selectClassGroup" + counter);
$newContentObj.find('section#classesInSelectedGroup').attr("id","classesInSelectedGroup" + counter);
$newContentObj.find('section#classesInSelectedGroup' + counter).removeClass('hidden');
$newContentObj.find('p#selectClassesMessage').attr("id","selectClassesMessage" + counter);
// Will need to uncomment this and find a way to apply the css style
// $newContentObj.find('section#internal-class').attr("id","internal-class" +
// counter);
$newContentObj.find("input[name='display-internalClass']").attr("name","display-internalClass" + counter);
$newContentObj.find('ul#selectedClasses').attr("id","selectedClasses" + counter);
$newContentObj.find('ul#selectedClasses' + counter).attr("name","selectedClasses" + counter);
$newContentObj.find('ul#selectedClasses' + counter).children("li").each( function(i,abc) {
var $theCheckbox = $(this).find('input');
$theCheckbox.attr("name", $theCheckbox.attr("name") + counter);
});
varOrClass = $newContentObj.find('select#selectClassGroup' + counter + ' option:selected').text();
}
//Create the container for the new content
$newDivContainer = $("<div></div>", {
id: "divContainer" + counter,
"class": "pageContentContainer",
html: "<span class='pageContentTypeLabel'>" + contentTypeLabel + " - " + varOrClass
+ "</span><span id='clickable" + counter
+ "' class='pageContentExpand'><div class='arrow expandArrow'></div></span><div id='innerContainer" + counter
+ "' class='pageContentWrapper'><input id='remove" + counter
+ "' type='button' class='delete' value='Delete' class='deleteButton' /></div>"
});
var $clickableSpan = $newDivContainer.children('span#clickable' + counter);
var $innerDiv = $newDivContainer.children('div#innerContainer' + counter);
$innerDiv.hide();
//Expand/collapse toggle
$clickableSpan.click(function() {
if ( $innerDiv.is(':visible') ) {
$innerDiv.slideUp(222);
//$clickableSpan.find('img').attr("src","arrow-down.gif");
var arrowDiv = $clickableSpan.find('div.arrow');
arrowDiv.removeClass("collapseArrow");
arrowDiv.addClass("expandArrow");
}
else {
$innerDiv.slideDown(222);
//$clickableSpan.find('img').attr("src","arrow-up.gif");
var arrowDiv = $clickableSpan.find('div.arrow');
arrowDiv.removeClass("expandArrow");
arrowDiv.addClass("collapseArrow");
}
window.setTimeout('pageManagementUtils.adjustSaveButtonHeight()', 223);
});
$newRemoveButton = $innerDiv.find('input#remove' + counter);
// this will have to disable submitted fields as well as hide them.
$newRemoveButton.click(function() {
$innerDiv.parent("div").css("display","none");
pageManagementUtils.adjustSaveButtonHeight();
});
$newDivContainer.appendTo($('section#contentDivs'));
$newContentObj.prependTo($innerDiv);
counter = counter + 10;
},
resetClassGroupSection:function() {
$('select#selectClassGroup option').eq(0).attr('selected', 'selected');
$("section#classesInSelectedGroup").addClass('hidden');
},
//finalize later, but basically use same attribute across page content and use attribute instead of id
//Attribute would be what keeps track of content, so contentCounter or something like that
toggleArrow:function() {
},
//Adjust save button height
adjustSaveButtonHeight:function() {
if ( $("div#leftSide").css("height") != undefined ) {
$("div#leftSide").css("height","");
if ( $("div#leftSide").height() < $("div#rightSide").height() ) {
$("div#leftSide").css("height",$("div#rightSide").height() + "px");
}
}
}
};
$(document).ready(function() {
pageManagementUtils.onLoad();
});

View file

@ -0,0 +1,32 @@
<#-- $This file is distributed under the terms of the license in /doc/license.txt$ -->
<div>
<#if pages?has_content >
<table>
<th>Title</th><th>URI</th>
<#list pages as pagex>
<tr>
<td>${(pagex.title)!'-untitled-'}</td>
<#if pagex.pageUri??>
<td><a href="${urls.base}/individual?uri=${pagex.pageUri?url}&switchToDisplayModel=1">${pagex.pageUri}</a></td>
<#else>
<td>URI for page not defined</td>
</#if>
</tr>
</#list>
</table>
<#else>
<p>There are no pages defined yet.</p>
</#if>
<form id="addIndividualClass" action="${urls.base}/editRequestDispatch" method="get">
<input type="hidden" name="typeOfNew" value="http://vitro.mannlib.cornell.edu/ontologies/display/1.1#Page">
<input type="hidden" name="switchToDisplayModel" value="1">
<input type="hidden" name="editForm" value="edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.generators.NewIndividualFormGenerator" role="input">
<input type="submit" id="submit" value="Add Page" role="button">
</form>
</div>

View file

@ -0,0 +1,63 @@
<#-- $This file is distributed under the terms of the license in /doc/license.txt$ -->
<section id="pageList">
<div class="tab">
<h2>Page Management</h2>
</div>
<div>
<#if pages?has_content >
<table id="account" style="margin-bottom:2px"> <caption>Page Management</caption>
<thead>
<tr>
<th scope="col" style="background-color:#F7F9F9">Title</th>
<!--th scope="col" style="background-color:#F7F9F9">Type</th-->
<th scope="col" style="background-color:#F7F9F9">URL</th>
<th scope="col" style="background-color:#F7F9F9">Template</th>
<th scope="col" style="background-color:#F7F9F9">Menu Page</th>
</tr>
</thead>
<tbody>
<#list pages as pagex>
<tr>
<td>
<#if pagex.pageUri?has_content>
<a href="${urls.base}/individual?uri=${pagex.pageUri?url}&switchToDisplayModel=1">${(pagex.title)!'-untitled-'}</a>
<#else>
No URI defined for page.
</#if>
</td>
<!--td> {pagex.dataGetterLabel}</td-->
<td>${pagex.urlMapping}</td>
<td>${(pagex.template)!''}</td>
<td style="text-align:center">
<#if pagex.menuItem?has_content>
<div class="menuFlag"></div>
</#if>
</td>
</tr>
</#list>
</tbody>
</table>
<#else>
<p>There are no pages defined yet.</p>
</#if>
<form id="addIndividualClass" action="${urls.base}/editRequestDispatch" method="get">
<input type="hidden" name="typeOfNew" value="http://vitro.mannlib.cornell.edu/ontologies/display/1.1#Page">
<input type="hidden" name="switchToDisplayModel" value="1">
<input type="hidden" name="editForm" value="edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.generators.ManagePageGenerator" role="input">
<input id="submit" value="Add Page" role="button" type="submit" >
</form>
<p style="margin-top:10px">Use <a id="menuMgmtLink" href="#">Menu Management</a> to set the order of menu items.</p>
</section>
${stylesheets.add('<link rel="stylesheet" href="${urls.base}/css/menupage/pageList.css" />')}

View file

@ -13,7 +13,11 @@
<#if siteConfig.manageProxies?has_content>
<li role="listitem"><a href="${siteConfig.manageProxies}" title="Manage profile editing">Manage profile editing</a></li>
</#if>
</#if>
<#if siteConfig.pageManagement?has_content>
<li role="listitem"><a href="${siteConfig.pageManagement}" title="Page management">Page management</a></li>
</#if>
<#if siteConfig.menuManagement?has_content>
<li role="listitem"><a href="${siteConfig.menuManagement}" title="Menu management">Menu management</a></li>

View file

@ -0,0 +1,157 @@
<#-- $This file is distributed under the terms of the license in /doc/license.txt$ -->
<#--Set up variables-->
<#assign pageData = editConfiguration.pageData />
<#assign menuAction = pageData.menuAction />
<#assign classGroup = pageData.classGroup />
<#assign classGroups = pageData.classGroups />
<#assign selectedTemplateType = "default" />
<#assign menuItem = ""/>
<#assign menuName = ""/>
<#assign prettyUrl = ""/>
<#assign associatedPage = ""/>
<#assign associatedPageURI = ""/>
<#assign isClassGroupPage = false/>
<#assign includeAllClasses = false/>
<#-- some additional processing here which shows or hides the class group selection and classes based on initial action-->
<#assign existingClassGroupStyle = " " />
<#assign selectClassGroupStyle = 'class="hidden"' />
<#-- Reveal the class group and hide the class selects if adding a new menu item or editing an existing menu item with an empty class group (no classes)-->
<#if menuAction == "Add" || !classGroup?has_content>
<#assign existingClassGroupStyle = 'class="hidden"' />
<#assign selectClassGroupStyle = " " />
</#if>
<section id="error-alert" role="alert" class="hidden">
<img src="${urls.images}/iconAlert.png" width="24" height="24" alert="Error alert icon" />
<p></p>
</section>
<#--class group section has associated page uri, but that depends on editing a current page or if one is selected later-->
<section id="pageDetails">
<h2>Add Page</h2>
<section id="floatRight" style="margin-top:0px;float:right;background-color:#fff;width:580px;margin-right:-4px">
<div id="rightSide">
<section id="addPageOne" role="region">
<label for="last-name">Content Type<span class="requiredHint"> *</span></label>
<select id="typeSelect" name="typeSelect">
<option value="" selected="selected">Select one</option>
<option value="browseClassGroup">Browse Class Group</option>
<option value="fixedHtml">Fixed HTML</option>
<option value="sparqlQuery">SPARQL Query Results</option>
</select>
<input type="button" id="defineType" name="defineType" value="Define" class="delete" role="input" style="display:none"/>
</section>
<section id="contentDivs"></section>
<section id="headerBar" style="background-color:#f5f5f5;border-color:#ccc;border-width:1px;border-style:solid;border-bottom-width:0px;padding-left:6px">
</section>
<section id="classGroup" style="background-color:#f9f9f9;padding-left:6px;padding-top:2px;border-width:1px;border-style:solid;border-color:#ccc;">
<section id="selectContentType" name="selectContentType" ${selectClassGroupStyle} role="region">
<label for="selectClassGroup">Class Group<span class="requiredHint"> *</span></label>
<select name="selectClassGroup" id="selectClassGroup" role="combobox">
<option value="-1" role="option">Select one</option>
<#list classGroups as aClassGroup>
<option value="${aClassGroup.URI}" <#if aClassGroup.URI = associatedPageURI>selected</#if> role="option">${aClassGroup.publicName}</option>
</#list>
</select>
</section>
<section id="classesInSelectedGroup" name="classesInSelectedGroup" ${existingClassGroupStyle}>
<#-- Select classes in a class group -->
<p id="selectClassesMessage" name="selectClassesMessage">Select content to display<span class="requiredHint"> *</span></p>
<#include "pageManagement--classIntersections.ftl">
<ul id="selectedClasses" name="selectedClasses" role="menu">
<#--Adding a default class for "ALL" in case all classes selected-->
<li class="ui-state-default" role="menuitem">
<input type="checkbox" name="allSelected" id="allSelected" value="all" <#if !isIndividualsForClassesPage?has_content>checked</#if> />
<label class="inline" for="All"> All</label>
</li>
<#list classGroup as classInClassGroup>
<li class="ui-state-default" role="menuitem">
<input type="checkbox" id="classInClassGroup" name="classInClassGroup" value="${classInClassGroup.URI}"
<#if includeAllClasses = true>checked</#if>
<#if isIndividualsForClassesPage?has_content>
<#list includeClasses as includeClass>
<#if includeClass = classInClassGroup.URI>
checked
</#if>
</#list>
</#if> />
<label class="inline" for="${classInClassGroup.name}"> ${classInClassGroup.name}</label>
<#-- PLACEHOLDER - not yet implemented) -->
<span class="ui-icon-sortable"></span> <#--sortable icon for dragging and dropping menu items-->
</li>
</#list>
</ul>
</section>
</section>
<section id="nonClassGroup" style="background-color:#f9f9f9;padding-left:6px;padding-top:2px;border-width:1px;border-style:solid;border-color:#ccc;">
<label id="variableLabel" for="variable">Variable Name<span class="requiredHint"> *</span></label>
<input type="text" name="variable" size="20" value="" id="variable" role="input" />
<label id="taLabel" for="selectClassGroup"><span id="taSpan"></span><span class="requiredHint"> *</span></label>
<textarea id="textArea" name="textArea" cols="70" rows="15" style="margin-bottom:7px"></textarea>
</section>
<input type="button" id="moreContent" name="moreContent" value="Add More Content" class="delete" style="margin-top:8px" />
</div>
</section>
<div id="leftSide">
<section id="addPageOne" role="region" style="background-color:#fff;">
<label for="page-name">Title<span class="requiredHint"> *</span></label>
<input type="text" name="pageName" value="${pageName!''}" role="input" />
<label for="pretty-url">Pretty URL<span class="requiredHint"> *</span></label>
<input type="text" name="prettyUrl" value="${prettyUrl!''}" role="input" />
<p class="note">Must begin with a leading forward slash: / (e.g., /people)</p>
<p style="margin-top:8px;margin-bottom:2px">Template<span class="requiredHint"> *</span></p>
<input type="radio" class="default-template" name="selectedTemplate" value="default" <#if selectedTemplateType = "default">checked</#if> role="radio" />
<label class="inline" for="default"> Default</label>
<br />
<input type="radio" name="selectedTemplate" class="custom-template" value="custom" <#if selectedTemplateType = "custom">checked</#if> role="input" />
<label class="inline" for="custom"> Custom template</label>
<section id="custom-template" <#if selectedTemplateType != 'custom'>class="hidden" </#if>role="region">
<input type="text" name="customTemplate" value="${customTemplate!}" size="40" role="input" /><span class="requiredHint"> *</span>
</section>
<p style="margin-top:10px;margin-bottom:0px"><input id="menuCheckbox" type="checkbox" name="menuCheckbox"> This is a menu page</p>
<section id="menu" role="region" style="margin-top:10px">
<label for="default">Menu Item Name</label>
<input type="text" id="menuLinkText" name="menuLinkText" value="" size="28" role="input" />
<input type="text" id="menuPosition" name="menuPosition" value="6" />
<p class="note">If left blank, the page title will be used.</p>
</section>
<br />
</section>
</div>
<section >
<span id="saveButton" ><input id="pageSave" type="submit" name="submit-Add" value="Save changes" class="submit" role="input" /> or </span>
<a class="cancel" href="#" id="cancelPage" style="color:#f70">Cancel</a>
<br />
<p class="requiredHint">* required fields</p>
</section>
</section>
<!--Hardcoding for now but should be retrieved from generator-->
<script type="text/javascript">
var customFormData = {
dataGetterLabelToURI:{
//maps labels to URIs
"browseClassGroup": "java:edu.cornell.mannlib.vitro.webapp.utils.dataGetter.ClassGroupPageData",
"sparqlDataGetter":"java:edu.cornell.mannlib.vitro.webapp.utils.dataGetter.SparqlQueryDataGetter"
},
dataGetterMap:{"java:edu.cornell.mannlib.vitro.webapp.utils.dataGetter.ClassGroupPageData": "Class Group Page",
"java:edu.cornell.mannlib.vitro.webapp.utils.dataGetter.BrowseDataGetter": "Browse Page",
"java:edu.cornell.mannlib.vitro.webapp.utils.dataGetter.IndividualsForClassesDataGetter": "Class Group Page - Selected Classes",
"java:edu.cornell.mannlib.vitro.webapp.utils.dataGetter.SparqlQueryDataGetter": "Sparql Query Results" }
};
</script>
${stylesheets.add('<link rel="stylesheet" href="${urls.base}/js/jquery-ui/css/smoothness/jquery-ui-1.8.9.custom.css" />')}
${stylesheets.add('<link rel="stylesheet" href="${urls.base}/css/menupage/menuManagement.css" />')}
${stylesheets.add('<link rel="stylesheet" href="${urls.base}/css/menupage/pageManagement.css" />')}
${scripts.add('<script type="text/javascript" src="${urls.base}/js/jquery-ui/js/jquery-ui-1.8.9.custom.min.js"></script>')}
${scripts.add('<script type="text/javascript" src="${urls.base}/js/customFormUtils.js"></script>')}
${scripts.add('<script type="text/javascript" src="${urls.base}/js/browserUtils.js"></script>')}
${scripts.add('<script type="text/javascript" src="${urls.base}/js/menupage/pageManagementUtils.js"></script>')}