You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lenya.apache.org by an...@apache.org on 2005/02/14 11:21:56 UTC
svn commit: r153767 -
lenya/trunk/src/webapp/lenya/pubs/default/config/menus/generic.xsp
Author: andreas
Date: Mon Feb 14 02:21:55 2005
New Revision: 153767
URL: http://svn.apache.org/viewcvs?view=rev&rev=153767
Log:
check if current URL represents document before accessing document
Modified:
lenya/trunk/src/webapp/lenya/pubs/default/config/menus/generic.xsp
Modified: lenya/trunk/src/webapp/lenya/pubs/default/config/menus/generic.xsp
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/webapp/lenya/pubs/default/config/menus/generic.xsp?view=diff&r1=153766&r2=153767
==============================================================================
--- lenya/trunk/src/webapp/lenya/pubs/default/config/menus/generic.xsp (original)
+++ lenya/trunk/src/webapp/lenya/pubs/default/config/menus/generic.xsp Mon Feb 14 02:21:55 2005
@@ -42,30 +42,24 @@
String documentId = <input:get-attribute module="page-envelope" as="string" name="context-prefix"/> + "/" + <input:get-attribute module="page-envelope" as="string" name="publication-id"/> + "/authoring" + <input:get-attribute module="page-envelope" as="string" name="document-id"/> + "_" + <input:get-attribute module="page-envelope" as="string" name="document-language"/>;
String urisParameter = "uris=" + <input:get-attribute module="page-envelope" as="string" name="context-prefix"/> + "/" + <input:get-attribute module="page-envelope" as="string" name="publication-id"/> + "/live" + <input:get-attribute module="page-envelope" as="string" name="document-url"/>;
String area = <input:get-attribute module="page-envelope" as="string" name="area"/>;
+
+ Object documentObject = <input:get-attribute as="object" module="page-envelope" name="document"/>;
+ Document document = null;
+ if (documentObject != null && !"".equals(documentObject)) {
+ document = (Document) documentObject;
+ }
+ boolean isDocument = false;
String docType = "";
try {
- Document document = (Document) <input:get-attribute as="object" module="page-envelope" name="document"/>;
- if (document.exists()) {
+ if (document != null && document.exists()) {
+ isDocument = true;
docType = <input:get-attribute as="string" module="page-envelope" name="document-type"/>;
}
}
catch (Exception e) {
throw new ProcessingException(e);
}
-
- boolean isDocument = false;
- {
- Object document = <input:get-attribute module="page-envelope" as="object" name="document"/>;
- try {
- if (document != "" && ((Document) document).exists()) {
- isDocument = true;
- }
- }
- catch (Exception e) {
- throw new ProcessingException(e);
- }
- }
</xsp:logic>
<menus>
@@ -74,27 +68,27 @@
<xsp:logic>
{
- if (Publication.ARCHIVE_AREA.equals(area) || Publication.TRASH_AREA.equals(area)) {
- <item><i18n:text>XHTML Document</i18n:text></item>
- <item><i18n:text>Links Document</i18n:text></item>
- }
- else {
- <item uc:usecase="site.create" href="?doctype=xhtml"><i18n:text>XHTML Document</i18n:text></item>
- <item uc:usecase="site.create" href="?doctype=links"><i18n:text>Links Document</i18n:text></item>
- }
+ if (Publication.ARCHIVE_AREA.equals(area) || Publication.TRASH_AREA.equals(area)) {
+ <item><i18n:text>XHTML Document</i18n:text></item>
+ <item><i18n:text>Links Document</i18n:text></item>
+ }
+ else {
+ <item uc:usecase="site.create" href="?doctype=xhtml"><i18n:text>XHTML Document</i18n:text></item>
+ <item uc:usecase="site.create" href="?doctype=links"><i18n:text>Links Document</i18n:text></item>
+ }
}
</xsp:logic>
</block>
<block>
<xsp:logic>
{
-
- String[] availableLanguages = (String[]) <input:get-attribute module="page-envelope" as="object" name="document-languages"/>;
- if (isDocument
- && Publication.AUTHORING_AREA.equals(area)
- ) {
-
- Document document = (Document) <input:get-attribute as="object" module="page-envelope" name="document"/>;
+
+ String[] availableLanguages = { };
+ if (isDocument) {
+ availableLanguages = (String[]) <input:get-attribute module="page-envelope" as="object" name="document-languages"/>;
+ }
+
+ if (isDocument && Publication.AUTHORING_AREA.equals(area)) {
String[] allLanguages = document.getPublication().getLanguages();
if (availableLanguages.length < allLanguages.length) {
@@ -109,10 +103,7 @@
}
}
- if (isDocument
- && Publication.AUTHORING_AREA.equals(area)
- && availableLanguages.length > 1
- ) {
+ if (isDocument && Publication.AUTHORING_AREA.equals(area) && availableLanguages.length > 1) {
<xsp:content>
<item uc:usecase="site.deleteLanguage" href="?"><i18n:text>Remove Language Version</i18n:text></item>
</xsp:content>
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@lenya.apache.org
For additional commands, e-mail: commits-help@lenya.apache.org