Fixed URL generation for object lists and Content Item Summary. The WebContextPath was not used there therefore the URLs were incorrect if CCM is installed not in the root context.
git-svn-id: https://svn.libreccm.org/ccm/trunk@2878 8810af33-2d31-482b-a856-94f89814c4dfmaster
parent
b7ca4a6670
commit
7e646e8be6
|
|
@ -52,11 +52,13 @@ import com.arsdigita.toolbox.ui.FormatStandards;
|
||||||
import com.arsdigita.util.Assert;
|
import com.arsdigita.util.Assert;
|
||||||
import com.arsdigita.util.GraphSet;
|
import com.arsdigita.util.GraphSet;
|
||||||
import com.arsdigita.util.Graphs;
|
import com.arsdigita.util.Graphs;
|
||||||
|
import com.arsdigita.util.UncheckedWrapperException;
|
||||||
import com.arsdigita.versioning.Transaction;
|
import com.arsdigita.versioning.Transaction;
|
||||||
import com.arsdigita.versioning.TransactionCollection;
|
import com.arsdigita.versioning.TransactionCollection;
|
||||||
import com.arsdigita.versioning.Versions;
|
import com.arsdigita.versioning.Versions;
|
||||||
import com.arsdigita.web.RedirectSignal;
|
import com.arsdigita.web.RedirectSignal;
|
||||||
import com.arsdigita.web.Web;
|
import com.arsdigita.web.Web;
|
||||||
|
import com.arsdigita.web.WebContext;
|
||||||
import com.arsdigita.workflow.simple.Engine;
|
import com.arsdigita.workflow.simple.Engine;
|
||||||
import com.arsdigita.workflow.simple.Task;
|
import com.arsdigita.workflow.simple.Task;
|
||||||
import com.arsdigita.workflow.simple.TaskCollection;
|
import com.arsdigita.workflow.simple.TaskCollection;
|
||||||
|
|
@ -64,15 +66,18 @@ import com.arsdigita.workflow.simple.TaskComment;
|
||||||
import com.arsdigita.workflow.simple.Workflow;
|
import com.arsdigita.workflow.simple.Workflow;
|
||||||
import com.arsdigita.workflow.simple.WorkflowTemplate;
|
import com.arsdigita.workflow.simple.WorkflowTemplate;
|
||||||
import com.arsdigita.xml.Element;
|
import com.arsdigita.xml.Element;
|
||||||
|
import java.io.UnsupportedEncodingException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>This panel displays basic details about a content item such as
|
* <p>
|
||||||
* attributes and associations.</p>
|
* This panel displays basic details about a content item such as attributes and associations.</p>
|
||||||
*
|
*
|
||||||
* <p>Container: {@link com.arsdigita.cms.ui.ContentItemPage}
|
* <p>
|
||||||
|
* Container: {@link com.arsdigita.cms.ui.ContentItemPage}
|
||||||
*
|
*
|
||||||
* <p>This panel uses an {@link com.arsdigita.cms.dispatcher.XMLGenerator}
|
* <p>
|
||||||
* to convert content items into XML.</p>
|
* This panel uses an {@link com.arsdigita.cms.dispatcher.XMLGenerator} to convert content items
|
||||||
|
* into XML.</p>
|
||||||
*
|
*
|
||||||
* @author Michael Pih (pihman@arsdigita.com)
|
* @author Michael Pih (pihman@arsdigita.com)
|
||||||
* @version $Id: Summary.java 1940 2009-05-29 07:15:05Z terry $
|
* @version $Id: Summary.java 1940 2009-05-29 07:15:05Z terry $
|
||||||
|
|
@ -84,7 +89,6 @@ public class Summary extends CMSContainer {
|
||||||
|
|
||||||
private final ItemSelectionModel m_item;
|
private final ItemSelectionModel m_item;
|
||||||
|
|
||||||
|
|
||||||
public Summary(ItemSelectionModel m) {
|
public Summary(ItemSelectionModel m) {
|
||||||
super();
|
super();
|
||||||
|
|
||||||
|
|
@ -96,6 +100,7 @@ public class Summary extends CMSContainer {
|
||||||
*
|
*
|
||||||
* @param state The page state
|
* @param state The page state
|
||||||
* @param parent The parent DOM element
|
* @param parent The parent DOM element
|
||||||
|
*
|
||||||
* @pre ( state != null )
|
* @pre ( state != null )
|
||||||
* @pre ( parent != null )
|
* @pre ( parent != null )
|
||||||
*/
|
*/
|
||||||
|
|
@ -126,7 +131,6 @@ public class Summary extends CMSContainer {
|
||||||
// Take advantage of caching in the CMS Dispatcher.
|
// Take advantage of caching in the CMS Dispatcher.
|
||||||
// XMLGenerator xmlGenerator = section.getXMLGenerator();
|
// XMLGenerator xmlGenerator = section.getXMLGenerator();
|
||||||
// xmlGenerator.generateXML(state, parent, SUMMARY);
|
// xmlGenerator.generateXML(state, parent, SUMMARY);
|
||||||
|
|
||||||
String descriptionAttribute = "";
|
String descriptionAttribute = "";
|
||||||
if (objectType.equals("NewsItem") || objectType.equals("Article")) {
|
if (objectType.equals("NewsItem") || objectType.equals("Article")) {
|
||||||
descriptionAttribute = "lead";
|
descriptionAttribute = "lead";
|
||||||
|
|
@ -134,12 +138,14 @@ public class Summary extends CMSContainer {
|
||||||
descriptionAttribute = "description";
|
descriptionAttribute = "description";
|
||||||
} else if (objectType.equals("Job")) {
|
} else if (objectType.equals("Job")) {
|
||||||
descriptionAttribute = "jobDescription";
|
descriptionAttribute = "jobDescription";
|
||||||
} else if ( objectType.equals("MultiPartArticle") || objectType.equals("Agenda") || objectType.equals("PressRelease") || objectType.equals("Service") ) {
|
} else if (objectType.equals("MultiPartArticle") || objectType.equals("Agenda")
|
||||||
|
|| objectType.equals("PressRelease") || objectType.equals("Service")) {
|
||||||
descriptionAttribute = "summary";
|
descriptionAttribute = "summary";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!descriptionAttribute.equals("")) {
|
if (!descriptionAttribute.equals("")) {
|
||||||
itemElement.addAttribute("description",(String)DomainServiceInterfaceExposer.get(item,descriptionAttribute));
|
itemElement.addAttribute("description", (String) DomainServiceInterfaceExposer.get(
|
||||||
|
item, descriptionAttribute));
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
@ -163,9 +169,11 @@ public class Summary extends CMSContainer {
|
||||||
if (parents.next()) {
|
if (parents.next()) {
|
||||||
Category parentCategory = parents.getCategory();
|
Category parentCategory = parents.getCategory();
|
||||||
if (parentCategory.equals(subjectCategory)) {
|
if (parentCategory.equals(subjectCategory)) {
|
||||||
Element subjectElement = new Element("cms:subjectCategory",CMS.CMS_XML_NS);
|
Element subjectElement = new Element("cms:subjectCategory",
|
||||||
|
CMS.CMS_XML_NS);
|
||||||
subjectElement.addAttribute("name", category.getName());
|
subjectElement.addAttribute("name", category.getName());
|
||||||
subjectElement.setText(category.getPreferredQualifiedName(" -> ",true));
|
subjectElement.setText(category.getPreferredQualifiedName(" -> ",
|
||||||
|
true));
|
||||||
subjectsElement.addContent(subjectElement);
|
subjectsElement.addContent(subjectElement);
|
||||||
}
|
}
|
||||||
parents.close();
|
parents.close();
|
||||||
|
|
@ -175,8 +183,18 @@ public class Summary extends CMSContainer {
|
||||||
|
|
||||||
// URL
|
// URL
|
||||||
Element linkElement = new Element("cms:linkSummary", CMS.CMS_XML_NS);
|
Element linkElement = new Element("cms:linkSummary", CMS.CMS_XML_NS);
|
||||||
linkElement.addAttribute("url","/redirect?oid=" + URLEncoder.encode(item.getDraftVersion().getOID().toString()));
|
try {
|
||||||
|
linkElement.addAttribute("url",
|
||||||
|
String.format("%s/redirect?oid=%s",
|
||||||
|
Web.getWebappContextPath(),
|
||||||
|
URLEncoder.encode(item.getDraftVersion()
|
||||||
|
.getOID()
|
||||||
|
.toString(), "utf-8")));
|
||||||
|
} catch (UnsupportedEncodingException ex) {
|
||||||
|
throw new UncheckedWrapperException(ex);
|
||||||
|
}
|
||||||
|
|
||||||
|
//"/redirect?oid=" + URLEncoder.encode(item.getDraftVersion().getOID().toString()));
|
||||||
// WORKFLOW
|
// WORKFLOW
|
||||||
Element workflowElement = new Element("cms:workflowSummary", CMS.CMS_XML_NS);
|
Element workflowElement = new Element("cms:workflowSummary", CMS.CMS_XML_NS);
|
||||||
Workflow workflow = Workflow.getObjectWorkflow(item);
|
Workflow workflow = Workflow.getObjectWorkflow(item);
|
||||||
|
|
@ -251,7 +269,8 @@ public class Summary extends CMSContainer {
|
||||||
|
|
||||||
commentElement.addAttribute("author", authorName);
|
commentElement.addAttribute("author", authorName);
|
||||||
commentElement.addAttribute("comment", comment.getComment());
|
commentElement.addAttribute("comment", comment.getComment());
|
||||||
commentElement.addAttribute("date",FormatStandards.formatDate(comment.getDate()));
|
commentElement.addAttribute("date", FormatStandards.formatDate(comment
|
||||||
|
.getDate()));
|
||||||
|
|
||||||
taskElement.addContent(commentElement);
|
taskElement.addContent(commentElement);
|
||||||
}
|
}
|
||||||
|
|
@ -262,8 +281,10 @@ public class Summary extends CMSContainer {
|
||||||
|
|
||||||
// REVISION HISTORY
|
// REVISION HISTORY
|
||||||
Element transactionElement = new Element("cms:transactionSummary", CMS.CMS_XML_NS);
|
Element transactionElement = new Element("cms:transactionSummary", CMS.CMS_XML_NS);
|
||||||
transactionElement.addAttribute("creationDate",FormatStandards.formatDate(item.getCreationDate()));
|
transactionElement.addAttribute("creationDate", FormatStandards.formatDate(item
|
||||||
transactionElement.addAttribute("lastModifiedDate",FormatStandards.formatDate(item.getLastModifiedDate()));
|
.getCreationDate()));
|
||||||
|
transactionElement.addAttribute("lastModifiedDate", FormatStandards.formatDate(item
|
||||||
|
.getLastModifiedDate()));
|
||||||
|
|
||||||
TransactionCollection transactions = Versions.getTaggedTransactions(item.getOID());
|
TransactionCollection transactions = Versions.getTaggedTransactions(item.getOID());
|
||||||
while (transactions.next()) {
|
while (transactions.next()) {
|
||||||
|
|
@ -277,7 +298,9 @@ public class Summary extends CMSContainer {
|
||||||
}
|
}
|
||||||
element.addAttribute("author", authorName);
|
element.addAttribute("author", authorName);
|
||||||
|
|
||||||
String url = section.getItemResolver().generateItemURL(state,item,section,CMSDispatcher.PREVIEW) + "?transID=" + transaction.getID();
|
String url = section.getItemResolver().generateItemURL(state, item, section,
|
||||||
|
CMSDispatcher.PREVIEW)
|
||||||
|
+ "?transID=" + transaction.getID();
|
||||||
element.addAttribute("url", url);
|
element.addAttribute("url", url);
|
||||||
transactionElement.addContent(element);
|
transactionElement.addContent(element);
|
||||||
}
|
}
|
||||||
|
|
@ -305,18 +328,22 @@ public class Summary extends CMSContainer {
|
||||||
lifecycleElement.addAttribute("noLifecycle", "1");
|
lifecycleElement.addAttribute("noLifecycle", "1");
|
||||||
} else {
|
} else {
|
||||||
lifecycleElement.addAttribute("name", lifecycle.getLabel());
|
lifecycleElement.addAttribute("name", lifecycle.getLabel());
|
||||||
lifecycleElement.addAttribute("startDate",FormatStandards.formatDate(lifecycle.getStartDate()));
|
lifecycleElement.addAttribute("startDate", FormatStandards.formatDate(lifecycle
|
||||||
|
.getStartDate()));
|
||||||
|
|
||||||
java.util.Date endDate = lifecycle.getEndDate();
|
java.util.Date endDate = lifecycle.getEndDate();
|
||||||
if (endDate == null) {
|
if (endDate == null) {
|
||||||
lifecycleElement.addAttribute("endDateString", "last forever");
|
lifecycleElement.addAttribute("endDateString", "last forever");
|
||||||
} else {
|
} else {
|
||||||
lifecycleElement.addAttribute("endDateString","expire on " + FormatStandards.formatDate(endDate));
|
lifecycleElement.addAttribute("endDateString", "expire on " + FormatStandards
|
||||||
|
.formatDate(endDate));
|
||||||
lifecycleElement.addAttribute("endDate", FormatStandards.formatDate(endDate));
|
lifecycleElement.addAttribute("endDate", FormatStandards.formatDate(endDate));
|
||||||
}
|
}
|
||||||
|
|
||||||
lifecycleElement.addAttribute("hasBegun",(new Boolean(lifecycle.hasBegun())).toString());
|
lifecycleElement.addAttribute("hasBegun", (new Boolean(lifecycle.hasBegun()))
|
||||||
lifecycleElement.addAttribute("hasEnded",(new Boolean(lifecycle.hasEnded())).toString());
|
.toString());
|
||||||
|
lifecycleElement.addAttribute("hasEnded", (new Boolean(lifecycle.hasEnded()))
|
||||||
|
.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
parent.addContent(itemElement);
|
parent.addContent(itemElement);
|
||||||
|
|
@ -332,7 +359,9 @@ public class Summary extends CMSContainer {
|
||||||
* Fetch the selected content item.
|
* Fetch the selected content item.
|
||||||
*
|
*
|
||||||
* @param state The page state
|
* @param state The page state
|
||||||
|
*
|
||||||
* @return The selected item
|
* @return The selected item
|
||||||
|
*
|
||||||
* @pre ( state != null )
|
* @pre ( state != null )
|
||||||
*/
|
*/
|
||||||
protected ContentItem getContentItem(PageState state) {
|
protected ContentItem getContentItem(PageState state) {
|
||||||
|
|
@ -345,7 +374,9 @@ public class Summary extends CMSContainer {
|
||||||
* Fetch the current content section.
|
* Fetch the current content section.
|
||||||
*
|
*
|
||||||
* @param state The page state
|
* @param state The page state
|
||||||
|
*
|
||||||
* @return The content section
|
* @return The content section
|
||||||
|
*
|
||||||
* @pre ( state != null )
|
* @pre ( state != null )
|
||||||
*/
|
*/
|
||||||
protected ContentSection getContentSection(PageState state) {
|
protected ContentSection getContentSection(PageState state) {
|
||||||
|
|
@ -381,7 +412,9 @@ public class Summary extends CMSContainer {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
String redirectURL = Web.getConfig().getDispatcherServletPath() + item.getContentSection().getPath() + "/admin/item.jsp?item_id=" + item.getID() + "&set_tab=1";
|
String redirectURL = Web.getConfig().getDispatcherServletPath() + item
|
||||||
|
.getContentSection().getPath() + "/admin/item.jsp?item_id=" + item.getID()
|
||||||
|
+ "&set_tab=1";
|
||||||
throw new RedirectSignal(redirectURL, true);
|
throw new RedirectSignal(redirectURL, true);
|
||||||
} else {
|
} else {
|
||||||
throw new ServletException("Unknown control event: " + key);
|
throw new ServletException("Unknown control event: " + key);
|
||||||
|
|
@ -402,8 +435,8 @@ public class Summary extends CMSContainer {
|
||||||
canBeExtended = false;
|
canBeExtended = false;
|
||||||
} else {
|
} else {
|
||||||
TaskCollection templates = item.getContentSection().getWorkflowTemplates();
|
TaskCollection templates = item.getContentSection().getWorkflowTemplates();
|
||||||
Filter f = templates.addInSubqueryFilter
|
Filter f = templates.addInSubqueryFilter("id",
|
||||||
("id", "com.arsdigita.cms.getWorkflowTemplateUserFilter");
|
"com.arsdigita.cms.getWorkflowTemplateUserFilter");
|
||||||
f.set("userId", Web.getWebContext().getUser().getID());
|
f.set("userId", Web.getWebContext().getUser().getID());
|
||||||
templates.addEqualsFilter(ACSObject.ID, workflow.getWorkflowTemplate().getID());
|
templates.addEqualsFilter(ACSObject.ID, workflow.getWorkflowTemplate().getID());
|
||||||
|
|
||||||
|
|
@ -418,4 +451,5 @@ public class Summary extends CMSContainer {
|
||||||
|
|
||||||
return canBeExtended;
|
return canBeExtended;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -76,7 +76,7 @@ public class Navigation extends Application {
|
||||||
return new URL(here.getScheme(),
|
return new URL(here.getScheme(),
|
||||||
here.getServerName(),
|
here.getServerName(),
|
||||||
here.getServerPort(),
|
here.getServerPort(),
|
||||||
"",
|
Web.getWebappContextPath(),
|
||||||
"",
|
"",
|
||||||
"/redirect/", map).toString();
|
"/redirect/", map).toString();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue