updates to page management, breaking out main template into templates based on content type, to allow for easier overriding in other products such as VIVO

This commit is contained in:
hjkhjk54 2012-06-06 18:40:00 +00:00
parent 57ffa0096f
commit 1bda8d6174
7 changed files with 124 additions and 102 deletions

View file

@ -0,0 +1,66 @@
<#-- $This file is distributed under the terms of the license in /doc/license.txt$ -->
<#--Browse Class Groups Section-->
<#-----------Variable assignment-------------->
<#--Requires Menu action be defined in parent template-->
<#assign classGroup = pageData.classGroup />
<#assign classGroups = pageData.classGroups />
<#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)-->
<#-- Menu action needs to be sent from main template-->
<#if menuAction == "Add" || !classGroup?has_content>
<#assign existingClassGroupStyle = 'class="hidden"' />
<#assign selectClassGroupStyle = " " />
</#if>
<#--HTML Portion-->
<section id="browseClassGroup" 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>
<span class="ui-icon-sortable"></span>
</li>
</#list>
</ul>
</section>
</section>
<#--Include JavaScript specific to the types of data getters related to this content-->
<#include "pageManagement--browseClassGroupsScripts.ftl">

View file

@ -0,0 +1,4 @@
<#-- $This file is distributed under the terms of the license in /doc/license.txt$ -->
<#-- Scripts for class group browsing -->
${scripts.add('<script type="text/javascript" src="${urls.base}/js/menupage/processClassGroupDataGetterContent.js"></script>')}
${scripts.add('<script type="text/javascript" src="${urls.base}/js/menupage/processIndividualsForClassesDataGetterContent.js"></script>')}

View file

@ -0,0 +1,5 @@
<#-- $This file is distributed under the terms of the license in /doc/license.txt$ -->
<#--These are the different content templates that will be cloned and used within page management-->
<#include "pageManagement--browseClassGroups.ftl">
<#include "pageManagement--sparqlQuery.ftl">
<#include "pageManagement--fixedHtml.ftl">

View file

@ -0,0 +1,16 @@
<#-- $This file is distributed under the terms of the license in /doc/license.txt$ -->
<#--Sets up script for custom form data. Including here instead of as separate javascript
file to ensure this script is always loaded first. Can also make sure placed first in
scripts list.-->
<script type="text/javascript">
var customFormData = {
dataGetterLabelToURI:{
//maps labels to URIs
"browseClassGroup": "java:edu.cornell.mannlib.vitro.webapp.utils.dataGetter.ClassGroupPageData",
"individualsForClasses": "java:edu.cornell.mannlib.vitro.webapp.utils.dataGetter.IndividualsForClassesDataGetter",
"sparqlQuery":"java:edu.cornell.mannlib.vitro.webapp.utils.dataGetter.SparqlQueryDataGetter",
"fixedHtml":"java:edu.cornell.mannlib.vitro.webapp.utils.dataGetter.FixedHTMLDataGetter"
}
};
</script>

View file

@ -0,0 +1,10 @@
<#-- $This file is distributed under the terms of the license in /doc/license.txt$ -->
<#--This contains the template for the fixed HTML content type that is to be cloned and used in page management-->
<section id="fixedHtml" style="background-color:#f9f9f9;padding-left:6px;padding-top:2px;border-width:1px;border-style:solid;border-color:#ccc;">
<label id="fixedHTMLVariableLabel" for="fixedHTMLVariable">Variable Name<span class="requiredHint"> *</span></label>
<input type="text" name="saveToVar" size="20" value="" id="fixedHTMLSaveToVar" role="input" />
<label id="fixedHTMLValueLabel" for="fixedHTMLValue">Enter fixed HTML here<span id="fixedHTMLValueSpan"></span><span class="requiredHint"> *</span></label>
<textarea id="fixedHTMLValue" name="htmlValue" cols="70" rows="15" style="margin-bottom:7px"></textarea>
</section>
${scripts.add('<script type="text/javascript" src="${urls.base}/js/menupage/processFixedHTMLDataGetterContent.js"></script>')}

View file

@ -0,0 +1,11 @@
<#-- $This file is distributed under the terms of the license in /doc/license.txt$ -->
<#--This contains the template for the Sparql Query content type that is to be cloned and used in page management-->
<section id="sparqlQuery" 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="saveToVar" size="20" value="" id="saveToVar" role="input" />
<label id="queryModelLabel" for="queryModel">Query Model</label>
<input type="text" name="queryModel" size="20" value="" id="queryModel" role="input" />
<label id="queryLabel" for="queryLabel"><span id="querySpan">Enter SPARQL query here</span><span class="requiredHint"> *</span></label>
<textarea id="query" name="query" cols="70" rows="15" style="margin-bottom:7px"></textarea>
</section>
${scripts.add('<script type="text/javascript" src="${urls.base}/js/menupage/processSparqlDataGetterContent.js"></script>')}

View file

@ -1,27 +1,16 @@
<#-- $This file is distributed under the terms of the license in /doc/license.txt$ -->
<#--Set up variables-->
<#--------Set up variables-------->
<#assign pageData = editConfiguration.pageData />
<#assign menuAction = pageData.menuAction />
<#assign classGroup = pageData.classGroup />
<#assign classGroups = pageData.classGroups />
<#assign pageName = "" />
<#assign selectedTemplateType = "default" />
<#assign prettyUrl = ""/>
<#assign associatedPage = ""/>
<#assign associatedPageURI = ""/>
<#assign menuItem = ""/>
<#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>
<#------------HTML Portion------------->
<section id="error-alert" role="alert" class="hidden">
<img src="${urls.images}/iconAlert.png" width="24" height="24" alert="Error alert icon" />
<p></p>
@ -35,6 +24,7 @@
<input type="hidden" id="editKey" name="editKey" value="${editKey}" />
<input type="hidden" id="menuItem" name="menuItem" value="${menuItem}"/>
<h2>Add Page</h2>
<!--Drop down for the types of content possible-->
<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">
@ -51,69 +41,10 @@
<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="browseClassGroup" 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>
<!--Broken fixed html and sparql content into separate portions-->
<!--This content will be copied/shown for these particular content types, so any fields for n3 editing need to be included
<#--This include file contains links to the templates that will be cloned and used for the different content types-->
<!--This content will be copied/shown for these particular content types, so any fields for n3 editing need to be included
here that correspond to a specific content type. These are related to specific "data getters" on the server side. -->
<section id="fixedHtml" style="background-color:#f9f9f9;padding-left:6px;padding-top:2px;border-width:1px;border-style:solid;border-color:#ccc;">
<label id="fixedHTMLVariableLabel" for="fixedHTMLVariable">Variable Name<span class="requiredHint"> *</span></label>
<input type="text" name="saveToVar" size="20" value="" id="fixedHTMLSaveToVar" role="input" />
<label id="fixedHTMLValueLabel" for="fixedHTMLValue">Enter fixed HTML here<span id="fixedHTMLValueSpan"></span><span class="requiredHint"> *</span></label>
<textarea id="fixedHTMLValue" name="htmlValue" cols="70" rows="15" style="margin-bottom:7px"></textarea>
</section>
<section id="sparqlQuery" 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="saveToVar" size="20" value="" id="saveToVar" role="input" />
<label id="queryModelLabel" for="queryModel">Query Model</label>
<input type="text" name="queryModel" size="20" value="" id="queryModel" role="input" />
<label id="queryLabel" for="queryLabel"><span id="querySpan">Enter SPARQL query here</span><span class="requiredHint"> *</span></label>
<textarea id="query" name="query" cols="70" rows="15" style="margin-bottom:7px"></textarea>
</section>
<#include "pageManagement--contentTemplates.ftl">
<input type="button" id="moreContent" name="moreContent" value="Add More Content" class="delete" style="margin-top:8px" />
</div>
</section>
@ -158,43 +89,22 @@
<!-
<!--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",
"individualsForClasses": "java:edu.cornell.mannlib.vitro.webapp.utils.dataGetter.IndividualsForClassesDataGetter",
"sparqlQuery":"java:edu.cornell.mannlib.vitro.webapp.utils.dataGetter.SparqlQueryDataGetter",
"fixedHtml":"java:edu.cornell.mannlib.vitro.webapp.utils.dataGetter.FixedHTMLDataGetter"
},
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",
"java:edu.cornell.mannlib.vitro.webapp.utils.dataGetter.FixedHTMLDataGetter": "Fixed HTML Page"}
};
</script>
<!--Hardcoding for now but should be retrieved from generator: Custom data-->
<#include "pageManagement--customDataScript.ftl">
${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/jquery.fix.clone.js"></script>')}
${scripts.add('<script type="text/javascript" src="${urls.base}/js/json2.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>')}
<#--Include additional templates here to allow for additional data getters etc. for other products-->
${scripts.add('<script type="text/javascript" src="${urls.base}/js/menupage/processFixedHTMLDataGetterContent.js"></script>')}
${scripts.add('<script type="text/javascript" src="${urls.base}/js/menupage/processClassGroupDataGetterContent.js"></script>')}
${scripts.add('<script type="text/javascript" src="${urls.base}/js/menupage/processSparqlDataGetterContent.js"></script>')}
${scripts.add('<script type="text/javascript" src="${urls.base}/js/menupage/processIndividualsForClassesDataGetterContent.js"></script>')}
<#--Process Data Getter Utils will refer to the various content type specific javascript files that should
already have been added within the template section for each content type-->
${scripts.add('<script type="text/javascript" src="${urls.base}/js/menupage/processDataGetterUtils.js"></script>')}
<#--Page management is used on page load and utilizes processDataGetterUtils as well as the custom data from the custom data script-->
${scripts.add('<script type="text/javascript" src="${urls.base}/js/menupage/pageManagementUtils.js"></script>')}