diff --git a/ccm-docmgr/src/ccm-docmgr.load b/ccm-docmgr/src/ccm-docmgr.load
index a8a58e227..0df807610 100755
--- a/ccm-docmgr/src/ccm-docmgr.load
+++ b/ccm-docmgr/src/ccm-docmgr.load
@@ -6,15 +6,15 @@
-
-
-
+
+
+
-
+
diff --git a/ccm-docmgr/src/com/arsdigita/cms/docmgr/installer/DocFolderInitializer.java b/ccm-docmgr/src/com/arsdigita/cms/docmgr/DocFolderInitializer.java
similarity index 95%
rename from ccm-docmgr/src/com/arsdigita/cms/docmgr/installer/DocFolderInitializer.java
rename to ccm-docmgr/src/com/arsdigita/cms/docmgr/DocFolderInitializer.java
index 8316b87ba..0fa8484cf 100755
--- a/ccm-docmgr/src/com/arsdigita/cms/docmgr/installer/DocFolderInitializer.java
+++ b/ccm-docmgr/src/com/arsdigita/cms/docmgr/DocFolderInitializer.java
@@ -1,4 +1,4 @@
-package com.arsdigita.cms.docmgr.installer;
+package com.arsdigita.cms.docmgr;
import com.arsdigita.cms.ContentType;
import com.arsdigita.cms.docmgr.DocFolder;
diff --git a/ccm-docmgr/src/com/arsdigita/cms/docmgr/installer/DocLinkInitializer.java b/ccm-docmgr/src/com/arsdigita/cms/docmgr/DocLinkInitializer.java
similarity index 97%
rename from ccm-docmgr/src/com/arsdigita/cms/docmgr/installer/DocLinkInitializer.java
rename to ccm-docmgr/src/com/arsdigita/cms/docmgr/DocLinkInitializer.java
index c2f25deff..b9529af0b 100755
--- a/ccm-docmgr/src/com/arsdigita/cms/docmgr/installer/DocLinkInitializer.java
+++ b/ccm-docmgr/src/com/arsdigita/cms/docmgr/DocLinkInitializer.java
@@ -1,4 +1,4 @@
-package com.arsdigita.cms.docmgr.installer;
+package com.arsdigita.cms.docmgr;
import org.apache.log4j.Category;
diff --git a/ccm-docmgr/src/com/arsdigita/cms/docmgr/DocumentCategoryBrowserApplication.java b/ccm-docmgr/src/com/arsdigita/cms/docmgr/DocumentCategoryBrowserApplication.java
index 14d23c1bd..f30fdd0e6 100755
--- a/ccm-docmgr/src/com/arsdigita/cms/docmgr/DocumentCategoryBrowserApplication.java
+++ b/ccm-docmgr/src/com/arsdigita/cms/docmgr/DocumentCategoryBrowserApplication.java
@@ -33,16 +33,18 @@ import com.arsdigita.web.Application;
*/
public class DocumentCategoryBrowserApplication extends Application {
- public static final String BASE_DATA_OBJECT_TYPE =
- "com.arsdigita.cms.docmgr.DocumentCategoryBrowserApplication";
-
- protected String getBaseDataObjectType() {
- return BASE_DATA_OBJECT_TYPE;
- }
private static Logger s_log =
Logger.getLogger(DocumentCategoryBrowserApplication.class);
+ public static final String BASE_DATA_OBJECT_TYPE =
+ "com.arsdigita.cms.docmgr.DocumentCategoryBrowserApplication";
+
+ @Override
+ protected String getBaseDataObjectType() {
+ return BASE_DATA_OBJECT_TYPE;
+ }
+
// pdl constants
private static final String OWNER = "ownerID";
private static final String ROOT = "rootID";
@@ -101,5 +103,34 @@ public class DocumentCategoryBrowserApplication extends Application {
// set("name", name);
//}
+ /**
+ * Returns the servletPath part of the URL to the application servlet.
+ * (see Servlet API specification or web.URL for more information)
+ *
+ * The method overwrites the super class to provide an application specific
+ * location for servlets/JSP. This is necessary if you whish to install the
+ * module (application) along with others in one context. If you install the
+ * module into its own context (no longer recommended for versions newer
+ * than 1.0.4) you may use a standard location.
+ *
+ * Usually it is a symbolic name/path, which will be mapped in the web.xml
+ * to the real location in the file system. Example:
+ *
+ * docmgr-categorybrowser
+ * com.arsdigita.cms.docmgr.ui.CategoryBrowserServlet
+ *
+ *
+ *
+ * docmgr-categorybrowser
+ * /docmgr-cat/*
+ *
+ *
+ * @return ServelPath of the applications servlet
+ */
+ @Override
+ public String getServletPath() {
+ return "/docmgr-cat";
+ }
+
}
diff --git a/ccm-docmgr/src/com/arsdigita/cms/docmgr/installer/DocumentInitializer.java b/ccm-docmgr/src/com/arsdigita/cms/docmgr/DocumentInitializer.java
similarity index 96%
rename from ccm-docmgr/src/com/arsdigita/cms/docmgr/installer/DocumentInitializer.java
rename to ccm-docmgr/src/com/arsdigita/cms/docmgr/DocumentInitializer.java
index c7cc5da0f..65037c10b 100755
--- a/ccm-docmgr/src/com/arsdigita/cms/docmgr/installer/DocumentInitializer.java
+++ b/ccm-docmgr/src/com/arsdigita/cms/docmgr/DocumentInitializer.java
@@ -1,4 +1,4 @@
-package com.arsdigita.cms.docmgr.installer;
+package com.arsdigita.cms.docmgr;
import org.apache.log4j.Category;
diff --git a/ccm-docmgr/src/com/arsdigita/cms/docmgr/installer/Initializer.java b/ccm-docmgr/src/com/arsdigita/cms/docmgr/Initializer.java
similarity index 99%
rename from ccm-docmgr/src/com/arsdigita/cms/docmgr/installer/Initializer.java
rename to ccm-docmgr/src/com/arsdigita/cms/docmgr/Initializer.java
index 0af1ffd83..597dd0b9e 100755
--- a/ccm-docmgr/src/com/arsdigita/cms/docmgr/installer/Initializer.java
+++ b/ccm-docmgr/src/com/arsdigita/cms/docmgr/Initializer.java
@@ -13,7 +13,7 @@
*
*/
-package com.arsdigita.cms.docmgr.installer;
+package com.arsdigita.cms.docmgr;
import org.apache.log4j.Logger;
diff --git a/ccm-docmgr/src/com/arsdigita/cms/docmgr/LegacyCategoryBrowserApplication.java b/ccm-docmgr/src/com/arsdigita/cms/docmgr/LegacyCategoryBrowserApplication.java
index a7237f914..67ff36a3f 100755
--- a/ccm-docmgr/src/com/arsdigita/cms/docmgr/LegacyCategoryBrowserApplication.java
+++ b/ccm-docmgr/src/com/arsdigita/cms/docmgr/LegacyCategoryBrowserApplication.java
@@ -31,6 +31,10 @@ import com.arsdigita.web.Application;
*/
public class LegacyCategoryBrowserApplication extends Application {
+
+ private static Logger s_log =
+ Logger.getLogger(LegacyCategoryBrowserApplication.class);
+
public static final String BASE_DATA_OBJECT_TYPE =
"com.arsdigita.cms.docmgr.LegacyCategoryBrowserApplication";
@@ -38,9 +42,6 @@ public class LegacyCategoryBrowserApplication extends Application {
return BASE_DATA_OBJECT_TYPE;
}
- private static Logger s_log =
- Logger.getLogger(LegacyCategoryBrowserApplication.class);
-
// pdl constants
private static final String OWNER = "ownerID";
private static final String ROOT = "rootID";
@@ -99,5 +100,33 @@ public class LegacyCategoryBrowserApplication extends Application {
// set("name", name);
//}
+ /**
+ * Returns the servletPath part of the URL to the application servlet.
+ * (see Servlet API specification or web.URL for more information)
+ *
+ * The method overwrites the super class to provide an application specific
+ * location for servlets/JSP. This is necessary if you whish to install the
+ * module (application) along with others in one context. If you install the
+ * module into its own context (no longer recommended for versions newer
+ * than 1.0.4) you may use a standard location.
+ *
+ * Usually it is a symbolic name/path, which will be mapped in the web.xml
+ * to the real location in the file system. Example:
+ *
+ * docmgr-categorybrowser
+ * com.arsdigita.cms.docmgr.ui.CategoryBrowserServlet
+ *
+ *
+ *
+ * docmgr-categorybrowser
+ * /docmgr-cat/*
+ *
+ *
+ * @return ServelPath of the applications servlet
+ */
+ @Override
+ public String getServletPath() {
+ return "/docmgr-cat";
+ }
}
diff --git a/ccm-docmgr/src/com/arsdigita/cms/docmgr/installer/MimeIconInitializer.java b/ccm-docmgr/src/com/arsdigita/cms/docmgr/MimeIconInitializer.java
similarity index 98%
rename from ccm-docmgr/src/com/arsdigita/cms/docmgr/installer/MimeIconInitializer.java
rename to ccm-docmgr/src/com/arsdigita/cms/docmgr/MimeIconInitializer.java
index 7a10ecec3..9cab2023a 100755
--- a/ccm-docmgr/src/com/arsdigita/cms/docmgr/installer/MimeIconInitializer.java
+++ b/ccm-docmgr/src/com/arsdigita/cms/docmgr/MimeIconInitializer.java
@@ -13,7 +13,7 @@
*
*/
-package com.arsdigita.cms.docmgr.installer;
+package com.arsdigita.cms.docmgr;
import java.util.HashMap;
import java.util.Iterator;
diff --git a/ccm-docmgr/src/com/arsdigita/cms/docmgr/Repository.java b/ccm-docmgr/src/com/arsdigita/cms/docmgr/Repository.java
index 80cc97b83..f82dce159 100755
--- a/ccm-docmgr/src/com/arsdigita/cms/docmgr/Repository.java
+++ b/ccm-docmgr/src/com/arsdigita/cms/docmgr/Repository.java
@@ -346,4 +346,34 @@ public class Repository extends Application {
}
return null;
}
+
+ /**
+ * Returns the servletPath part of the URL to the application servlet.
+ * (see Servlet API specification or web.URL for more information)
+ *
+ * The method overwrites the super class to provide an application specific
+ * location for servlets/JSP. This is necessary if you whish to install the
+ * module (application) along with others in one context. If you install the
+ * module into its own context (no longer recommended for versions newer
+ * than 1.0.4) you may use a standard location.
+ *
+ * Usually it is a symbolic name/path, which will be mapped in the web.xml
+ * to the real location in the file system. Example:
+ *
+ * docmgr-repository
+ * com.arsdigita.cms.docmgr.ui.RepositoryServlet
+ *
+ *
+ *
+ * docmgr-repository
+ * /docmgr-repo/*
+ *
+ *
+ * @return ServelPath of the applications servlet
+ */
+ @Override
+ public String getServletPath() {
+ return "/docmgr-repo";
+ }
+
}
diff --git a/ccm-docmgr/src/com/arsdigita/cms/docmgr/Loader.java b/ccm-docmgr/src/com/arsdigita/cms/docmgr/RepositoryLoader.java
similarity index 59%
rename from ccm-docmgr/src/com/arsdigita/cms/docmgr/Loader.java
rename to ccm-docmgr/src/com/arsdigita/cms/docmgr/RepositoryLoader.java
index 335501e15..46849a79a 100644
--- a/ccm-docmgr/src/com/arsdigita/cms/docmgr/Loader.java
+++ b/ccm-docmgr/src/com/arsdigita/cms/docmgr/RepositoryLoader.java
@@ -26,13 +26,11 @@ import com.arsdigita.kernel.ACSObjectInstantiator;
import com.arsdigita.kernel.Kernel;
import com.arsdigita.kernel.KernelExcursion;
import com.arsdigita.loader.PackageLoader;
-// import com.arsdigita.mimetypes.*;
import com.arsdigita.persistence.DataObject;
import com.arsdigita.portal.PortletType;
import com.arsdigita.portal.apportlet.AppPortletSetup;
import com.arsdigita.portal.apportlet.AppPortletType;
import com.arsdigita.runtime.ScriptContext;
-import com.arsdigita.web.ApplicationSetup;
import com.arsdigita.web.ApplicationType;
import org.apache.log4j.Logger;
@@ -41,22 +39,23 @@ import org.apache.log4j.Logger;
// ///////////////////////////////////////////////////////////////////////////
// Project: Migrate to new style legacy free type of application.
//
-// Step 1: Copy from Initializer all data base / applicationtype
-// related code to LOADER and use Loader for data loading.
+// Step 1: Copy from Initializer all data base / applicationtype *DONE*
+// related code to LOADER and use RepositoryLoader for
+// data loading.
//
-// Step 2: Remove usage of ApplicationSetup and switch to legacy
+// Step 2: Remove usage of ApplicationSetup and switch to legacy *DONE*
// compativle AppType xxx = new AppType.create(......)
// Move setInstantiator back to Initializer as required.
//
// Step 3: Move to legacy free app type
-// (a) modify new App.Tpye.....
-// (b) create AppServlet from Dispatcher
+// (a) modify new App.Tpye..... *DONE*
+// (b) create AppServlet from Dispatcher *DONE*
//
//
// TESTS:
-// (a) Try to instantiate an instance of each type and check the UI
-// produced by the dispatcher / servlet
-// (b) Instantiate the porlets and try to reproduce the behaviour
+// (a) Try to instantiate an instance of each type and check *MOSTLY
+// the UI produced by the dispatcher / servlet DONE
+// (b) Instantiate the portlets and try to reproduce the behaviour
// (probably reproduce the error showing up originally)
//
//
@@ -65,17 +64,17 @@ import org.apache.log4j.Logger;
/**
- * CMS Document Manager (DocMgr) Loader
+ * CMS Document Manager (DocMgr) RepositoryLoader
*
* @author pboy <pboy@barkhof.uni-bremen.de>
- * @version $Id: Loader.java $
+ * @version $Id: RepositoryLoader.java $
**/
-public class Loader extends PackageLoader {
+public class RepositoryLoader extends PackageLoader {
/** Logger instance for debugging */
- private static final Logger s_log = Logger.getLogger(Loader.class);
+ private static final Logger s_log = Logger.getLogger(RepositoryLoader.class);
/**
* Run script invoked by com.arsdigita.packing loader script.
@@ -88,14 +87,14 @@ public class Loader extends PackageLoader {
public void excurse() {
setEffectiveParty(Kernel.getSystemParty());
- loadDocRepositoryApplicationType(); //former setupDocs
- setupDocRepositoryPortlet(null); //former setupDocManagerPortlet
+ loadRepositoryApplicationType(); //former setupDocs
+ loadRepositoryPortletType(null); //former setupDocManagerPortlet
- ApplicationType categoryBrowseDocsAppType = setupCategoryBrowsing();
+ ApplicationType categoryBrowseDocsAppType = loadCategoryBrowserType();
setupCategoryDocsPortlet(categoryBrowseDocsAppType);
ApplicationType legacyCategoryBrowseDocsAppType =
- setupLegacyCategoryBrowsing();
+ loadLegacyCategoryBrowserType();
setupLegacyCategoryDocsPortlet(legacyCategoryBrowseDocsAppType);
// de-activate search for now
@@ -127,107 +126,47 @@ public class Loader extends PackageLoader {
*
* TODO: migrate to a new style, legacy free application type.
*/
- // formerly setupDocs()
- private ApplicationType loadDocRepositoryApplicationType() {
-
-/* ApplicationSetup setup = new ApplicationSetup(s_log);
- setup.setApplicationObjectType(Repository.BASE_DATA_OBJECT_TYPE);
- setup.setKey("cmsdocs");
- setup.setTitle("Document Manager (CMS) Application");
- setup.setSingleton(false);
- setup.setDescription
- ("The document manager empowers users to share documents.");
- setup.setDispatcherClass("com.arsdigita.cms.docmgr.ui.DMDispatcher");
- setup.setInstantiator(new ACSObjectInstantiator() {
- @Override
- public DomainObject doNewInstance(DataObject dataObject) {
- return new Repository(dataObject);
- }
- });
-
- return setup.run();
-*/
- /* Create new type legacy compatible application type */
- ApplicationType type = ApplicationType
- .createApplicationType("cmsdocs",
- "DocRepo",
- Repository.BASE_DATA_OBJECT_TYPE);
- type.setDispatcherClass("com.arsdigita.cms.docmgr.ui.DMDispatcher");
- type.setDescription("The document manager empowers users to share documents.");
-
+ private ApplicationType loadRepositoryApplicationType() {
/* Legacy free initialization
- * NOTE: The wording in the title parameter of ApplicationType determines
- * the name of the subdirectory for the XSL stylesheets.
- * It gets "urlized", i.e. trimming leading and trailing blanks and replacing
- * blanks between words and illegal characters with an hyphen and converted
- * to lower case.
- * Example: "DocRepo" will become "docrepo".
+ * NOTE: The wording in the title parameter of ApplicationType determines
+ * the name of the subdirectory for the XSL stylesheets.
+ * It gets "urlized", i.e. trimming leading and trailing blanks and
+ * replacing blanks between words and illegal characters with an hyphen
+ * and converted to lower case.
+ * Example: "DocRepo" will become "docrepo".
*/
- // ApplicationType type = new
- // ApplicationType("DocRepo",
- // Repository.BASE_DATA_OBJECT_TYPE );
-
- // type.setDescription
- // ("The document repository empowers users to share documents.");
+ ApplicationType type = new ApplicationType(
+ "CMSDocs",
+ Repository.BASE_DATA_OBJECT_TYPE );
+ type.setDescription
+ ("The document repository empowers users to share documents.");
return type;
}
- private ApplicationType setupCategoryBrowsing() {
-/* ApplicationSetup setup = new ApplicationSetup(s_log);
- setup.setApplicationObjectType(DocumentCategoryBrowserApplication
- .BASE_DATA_OBJECT_TYPE);
- setup.setKey("cmsdocs-categories");
- setup.setTitle("Browse Documents Application");
- setup.setSingleton(true);
- setup.setDescription
- ("Browse documents by category.");
- setup.setDispatcherClass("com.arsdigita.cms.docmgr.ui.DCNDispatcher");
- setup.setInstantiator(new ACSObjectInstantiator() {
- @Override
- public DomainObject doNewInstance(DataObject dataObject) {
- return new DocumentCategoryBrowserApplication(dataObject);
- }
- });
- return setup.run();
-*/
- /* Create new type legacy compatible application type */
- ApplicationType type = ApplicationType
- .createApplicationType("cmsdocs-categories",
- "Browse Documents Application",
- DocumentCategoryBrowserApplication.BASE_DATA_OBJECT_TYPE);
- type.setDispatcherClass("com.arsdigita.cms.docmgr.ui.DCNDispatcher");
+ private ApplicationType loadCategoryBrowserType() {
+
+ ApplicationType type = new ApplicationType(
+ "cmsdocs-categories",
+ DocumentCategoryBrowserApplication
+ .BASE_DATA_OBJECT_TYPE );
type.setDescription("Browse documents by category.");
return type;
}
- private ApplicationType setupLegacyCategoryBrowsing() {
-/* ApplicationSetup setup = new ApplicationSetup(s_log);
- setup.setApplicationObjectType(LegacyCategoryBrowserApplication
- .BASE_DATA_OBJECT_TYPE);
- setup.setKey("cmsdocs-categories-legacy");
- setup.setTitle("Taxonomy Browser");
- setup.setSingleton(true);
- setup.setDescription
- ("Browse documents by category.");
- setup.setDispatcherClass("com.arsdigita.cms.docmgr.ui.DCNDispatcher");
- setup.setInstantiator(new ACSObjectInstantiator() {
- @Override
- public DomainObject doNewInstance(DataObject dataObject) {
- return new LegacyCategoryBrowserApplication(dataObject);
- }
- });
- return setup.run();
-*/
- /* Create new type legacy compatible application type */
- ApplicationType type = ApplicationType
- .createApplicationType("cmsdocs-categories-legacy",
- "Taxonomy Browser",
- LegacyCategoryBrowserApplication.BASE_DATA_OBJECT_TYPE);
- type.setDispatcherClass("com.arsdigita.cms.docmgr.ui.DCNDispatcher");
- type.setDescription("Browse documents by category.");
+
+ /**
+ *
+ * @return
+ */
+ private ApplicationType loadLegacyCategoryBrowserType() {
+
+ ApplicationType type = new ApplicationType("cmsdocs-categories-legacy",
+ LegacyCategoryBrowserApplication
+ .BASE_DATA_OBJECT_TYPE );
+ type.setDescription("Browse documents by legacy category (Taxonomie Browser).");
return type;
@@ -246,7 +185,7 @@ public class Loader extends PackageLoader {
// SiteNode sn = SiteNode.getSiteNode("/administration", false);
// if (!"administration".equals(sn.getName())) {
Repository repo = Repository
- .create( "docrepo",
+ .create( "cmsdocs-repo",
"Default DocumentMgr Repository",
null);
repo.save();
@@ -273,7 +212,7 @@ public class Loader extends PackageLoader {
* by configuration.
*/
//former setupDocManagerPortlet
- private void setupDocRepositoryPortlet(ApplicationType provider) {
+ private void loadRepositoryPortletType(ApplicationType provider) {
// Create the document repository portlet
/* AppPortletSetup setup = new AppPortletSetup(s_log);
@@ -350,5 +289,4 @@ public class Loader extends PackageLoader {
}
-
}
diff --git a/ccm-docmgr/src/com/arsdigita/cms/docmgr/ui/CategoryBrowserServlet.java b/ccm-docmgr/src/com/arsdigita/cms/docmgr/ui/CategoryBrowserServlet.java
new file mode 100644
index 000000000..b739897bb
--- /dev/null
+++ b/ccm-docmgr/src/com/arsdigita/cms/docmgr/ui/CategoryBrowserServlet.java
@@ -0,0 +1,89 @@
+/*
+ * Copyright (C) 2012 Peter boy (pboy@barkhof.uni-bremen.de
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+package com.arsdigita.cms.docmgr.ui;
+
+import com.arsdigita.bebop.Page;
+import com.arsdigita.bebop.TabbedPane;
+
+import org.apache.log4j.Logger;
+
+/**
+ * Application servlet for ccm-docmgr's DocumentCategoryBrowser and
+ * LegacyCategoryBrowser application which serves all request made for
+ * the application's UI.
+ *
+ * CagtegoryBrowserServlet is called by BaseApplicationServlet which has
+ * determined that it is associated with a request URL.
+ *
+ * The servlet has to be included in servlet container's deployment descriptor,
+ * see teh domain classes' getServletPath() method for details
+ * about web.xml record. It is NOT directly referenced by any other class.
+ *
+ * It determines whether a Page has been registered to the URL and
+ * if so passes the request to that page. Otherwise it hands the request
+ * to the TemplateResolver to find an appropriate JSP file.
+ *
+ * @author Stefan Deusch
+ * @author Peter Boy
+ * @version $Id: RepositoryServlet.java 2161 2012-02-26 00:16:13Z pboy $
+ */
+public class CategoryBrowserServlet extends RepositoryServlet
+ implements DMConstants {
+
+ /** Private logger instance to faciliate debugging procedures */
+ private static final Logger s_log = Logger.getLogger(
+ CategoryBrowserServlet.class);
+
+
+ /**
+ * Use parent's class initialization extension point to perform additional
+ * initialisation tasks. Here: build the UI pages.
+ */
+ @Override
+ public void doInit() {
+
+ addPage( "/", buildCategoryBrowserIndexPage() );
+ addPage( "/file", buildFileInfoPage());
+ // search is a tab, for now.
+ //addPage("/search", buildSearchPage());
+ //addPage("/search/file", buildFileInfoPage());
+
+ }
+
+
+ /**
+ * Build index page to browse documents by category
+ */
+ private Page buildCategoryBrowserIndexPage() {
+
+ Page p = new DocmgrBasePage();
+
+ /* Create main administration tab. */
+ TabbedPane tb = new TabbedPane();
+ tb.setIdAttr("page-body");
+
+ p.add(new BrowseCatDocsPane());
+ p.lock();
+
+ return p;
+
+ }
+
+}
diff --git a/ccm-docmgr/src/com/arsdigita/cms/docmgr/ui/CreateDocLinkPane.java b/ccm-docmgr/src/com/arsdigita/cms/docmgr/ui/CreateDocLinkPane.java
index 94a788e80..82a584ccc 100755
--- a/ccm-docmgr/src/com/arsdigita/cms/docmgr/ui/CreateDocLinkPane.java
+++ b/ccm-docmgr/src/com/arsdigita/cms/docmgr/ui/CreateDocLinkPane.java
@@ -61,7 +61,7 @@ import com.arsdigita.cms.ContentSectionCollection;
import com.arsdigita.cms.docmgr.DocFolder;
import com.arsdigita.cms.docmgr.DocMgr;
import com.arsdigita.cms.docmgr.DocLink;
-import com.arsdigita.cms.docmgr.installer.Initializer;
+import com.arsdigita.cms.docmgr.Initializer;
import com.arsdigita.cms.docmgr.search.SearchResults;
import com.arsdigita.cms.docmgr.search.SearchUtils;
import com.arsdigita.dispatcher.ObjectNotFoundException;
diff --git a/ccm-docmgr/src/com/arsdigita/cms/docmgr/ui/DCNDispatcher.java b/ccm-docmgr/src/com/arsdigita/cms/docmgr/ui/DCNDispatcher.java.nolongerInUse
similarity index 100%
rename from ccm-docmgr/src/com/arsdigita/cms/docmgr/ui/DCNDispatcher.java
rename to ccm-docmgr/src/com/arsdigita/cms/docmgr/ui/DCNDispatcher.java.nolongerInUse
diff --git a/ccm-docmgr/src/com/arsdigita/cms/docmgr/ui/DMDispatcher.java b/ccm-docmgr/src/com/arsdigita/cms/docmgr/ui/DMDispatcher.java.nolongerInUse
similarity index 100%
rename from ccm-docmgr/src/com/arsdigita/cms/docmgr/ui/DMDispatcher.java
rename to ccm-docmgr/src/com/arsdigita/cms/docmgr/ui/DMDispatcher.java.nolongerInUse
index a29637d34..5e524301e 100755
--- a/ccm-docmgr/src/com/arsdigita/cms/docmgr/ui/DMDispatcher.java
+++ b/ccm-docmgr/src/com/arsdigita/cms/docmgr/ui/DMDispatcher.java.nolongerInUse
@@ -15,14 +15,6 @@
package com.arsdigita.cms.docmgr.ui;
-import java.io.IOException;
-import java.io.OutputStream;
-import java.math.BigDecimal;
-import java.math.BigInteger;
-import java.net.URLDecoder;
-
-import org.apache.log4j.Category;
-
import com.arsdigita.bebop.ActionLink;
import com.arsdigita.bebop.page.BebopMapDispatcher;
import com.arsdigita.bebop.Label;
@@ -50,6 +42,14 @@ import com.arsdigita.util.Assert;
import com.arsdigita.versioning.Versions;
import com.arsdigita.web.Web;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.math.BigDecimal;
+import java.math.BigInteger;
+import java.net.URLDecoder;
+
+import org.apache.log4j.Category;
+
/**
* Dispatcher for document manager application.
*
diff --git a/ccm-docmgr/src/com/arsdigita/cms/docmgr/ui/FileEditForm.java b/ccm-docmgr/src/com/arsdigita/cms/docmgr/ui/FileEditForm.java
index 4bdd75918..5668bb957 100755
--- a/ccm-docmgr/src/com/arsdigita/cms/docmgr/ui/FileEditForm.java
+++ b/ccm-docmgr/src/com/arsdigita/cms/docmgr/ui/FileEditForm.java
@@ -47,7 +47,7 @@ import com.arsdigita.cms.ContentBundle;
import com.arsdigita.cms.ContentSection;
import com.arsdigita.cms.ContentSectionCollection;
import com.arsdigita.cms.FileAsset;
-import com.arsdigita.cms.docmgr.installer.Initializer;
+import com.arsdigita.cms.docmgr.Initializer;
import com.arsdigita.cms.docmgr.DocFolder;
import com.arsdigita.cms.docmgr.DocMgr;
import com.arsdigita.cms.docmgr.Document;
diff --git a/ccm-docmgr/src/com/arsdigita/cms/docmgr/ui/RepositoryServlet.java b/ccm-docmgr/src/com/arsdigita/cms/docmgr/ui/RepositoryServlet.java
new file mode 100644
index 000000000..21a177540
--- /dev/null
+++ b/ccm-docmgr/src/com/arsdigita/cms/docmgr/ui/RepositoryServlet.java
@@ -0,0 +1,403 @@
+/*
+ * Copyright (C) 2012 Peter boy (pboy@barkhof.uni-bremen.de
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+package com.arsdigita.cms.docmgr.ui;
+
+import com.arsdigita.bebop.ActionLink;
+import com.arsdigita.bebop.Label;
+import com.arsdigita.bebop.Page;
+import com.arsdigita.bebop.PageState;
+import com.arsdigita.bebop.RequestLocal;
+import com.arsdigita.bebop.TabbedPane;
+import com.arsdigita.bebop.event.ActionEvent;
+import com.arsdigita.bebop.event.ActionListener;
+import com.arsdigita.bebop.event.PrintEvent;
+import com.arsdigita.bebop.event.PrintListener;
+import com.arsdigita.bebop.parameters.BigDecimalParameter;
+import com.arsdigita.cms.FileAsset;
+import com.arsdigita.cms.docmgr.Document;
+import com.arsdigita.dispatcher.DispatcherHelper;
+import com.arsdigita.globalization.GlobalizedMessage;
+import com.arsdigita.kernel.Kernel;
+import com.arsdigita.kernel.permissions.PrivilegeDescriptor;
+import com.arsdigita.persistence.AbstractTransactionListener;
+import com.arsdigita.persistence.Session;
+import com.arsdigita.persistence.SessionManager;
+import com.arsdigita.persistence.TransactionContext;
+import com.arsdigita.templating.PresentationManager;
+import com.arsdigita.templating.Templating;
+import com.arsdigita.util.Assert;
+import com.arsdigita.versioning.Versions;
+import com.arsdigita.web.Application;
+import com.arsdigita.web.BaseApplicationServlet;
+import com.arsdigita.web.Web;
+
+import java.io.IOException;
+import java.io.OutputStream;
+import java.math.BigDecimal;
+import java.math.BigInteger;
+import java.net.URLDecoder;
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.log4j.Logger;
+
+
+/**
+ * Application servlet for ccm-docmgr's Repository application, the main
+ * package application, serves all request made for the application's UI.
+ *
+ * RepositporyServlet is called by BaseApplicationServlet which has determined
+ * that RepositoryServlet is associated with a request URL.
+ *
+ * The servlet has to be included in servlet container's deployment descriptor,
+ * see {@see com.arsdigita.cms.docmgr.Repository#getServletPath()} for details
+ * about web.xml record. It is NOT directly referenced by any other class.
+ *
+ * It determines whether a Page has been registered to the URL and
+ * if so passes the request to that page. Otherwise it hands the request
+ * to the TemplateResolver to find an appropriate JSP file.
+ *
+ * @author Stefan Deusch
+ * @author Peter Boy
+ * @version $Id: RepositoryServlet.java 2161 2012-02-26 00:16:13Z pboy $
+ */
+public class RepositoryServlet extends BaseApplicationServlet
+ implements DMConstants {
+
+ /** Private logger instance to faciliate debugging procedures */
+ private static final Logger s_log = Logger.getLogger(RepositoryServlet.class);
+
+ /** URL (pathinfo) -> Page object mapping. Based on it (and the http
+ * request url) the doService method selects a page to display */
+ private final Map m_pages = new HashMap();
+
+
+ /**
+ * Use parent's class initialization extension point to perform additional
+ * initialisation tasks. Here: build the UI pages.
+ */
+ @Override
+ public void doInit() {
+
+ addPage( "/", buildRepositoryIndexPage() );
+ addPage( "/file", buildFileInfoPage());
+ // search is a tab, for now.
+ //addPage("/search", buildSearchPage());
+ //addPage("/search/file", buildFileInfoPage());
+
+ }
+
+ /**
+ * Implements the (abstract) doService method of BaseApplicationServlet to
+ * perform the services.
+ * @see com.arsdigita.web.BaseApplicationServlet#doService
+ * (HttpServletRequest, HttpServletResponse, Application)
+ */
+ protected void doService( HttpServletRequest sreq,
+ HttpServletResponse sresp,
+ Application app)
+ throws ServletException, IOException {
+ if (s_log.isDebugEnabled()) {
+ s_log.info("starting doService method");
+ }
+
+
+ String url = sreq.getRequestURI();
+
+ int index = url.lastIndexOf("/download/");
+ if (index > 0) {
+ /* Download requested, handle the download */
+ String str = sreq.getParameter(FILE_ID_PARAM_NAME);
+ s_log.debug("Downloading");
+ if (str != null) {
+ BigDecimal id = new BigDecimal(str);
+ s_log.debug("requesting file for id: "+str);
+ Document doc = new Document(id);
+ sresp.setHeader("Content-Disposition", "attachment; filename=" +
+ URLDecoder.decode(doc.getName()));
+ doc.assertPrivilege(PrivilegeDescriptor.READ);
+
+ // if the user has requested an earlier revision, get
+ // that revision and serve it
+ String param = sreq.getParameter("transID");
+ if (param != null) {
+ Session ssn = SessionManager.getSession();
+ TransactionContext txn = ssn.getTransactionContext();
+ txn.addTransactionListener(new AbstractTransactionListener() {
+ @Override
+ public void beforeCommit(TransactionContext txn) {
+ Assert.fail("uncommittable transaction");
+ }
+ });
+
+ Kernel.getContext().getTransaction().setCommitRequested(false);
+
+ BigInteger transID = new BigInteger(param);
+ Versions.rollback(doc.getOID(), transID);
+ }
+
+ FileAsset file = doc.getFile();
+ sresp.setContentType( null != file.getMimeType() ?
+ file.getMimeType().getMimeType() : "text/plain" );
+ OutputStream os = null;
+
+ try {
+ os = sresp.getOutputStream();
+ file.writeBytes(os);
+ } catch (IOException iox) {
+ iox.printStackTrace();
+ throw new RuntimeException(iox.getMessage());
+ } finally {
+ try {
+ //is.close();
+ os.close();
+ } catch(IOException iox2) { }
+ }
+ }
+
+ } else {
+ /* No download, show the repository index page */
+ s_log.debug("show repository page");
+
+ String pathInfo = sreq.getPathInfo();
+ Assert.exists(pathInfo, "String pathInfo");
+ if (pathInfo.length() > 1 && pathInfo.endsWith("/")) {
+ /* NOTE: ServletAPI specifies, pathInfo may be empty or will
+ * start with a '/' character. It currently carries a
+ * trailing '/' if a "virtual" page, i.e. not a real jsp, but
+ * result of a servlet mapping. But Application requires url
+ * NOT to end with a trailing '/' for legacy free applications.*/
+ pathInfo = pathInfo.substring(0, pathInfo.length()-1);
+ }
+
+ final Page page = (Page) m_pages.get(pathInfo);
+
+ if (page != null) {
+
+ final com.arsdigita.xml.Document doc = page.buildDocument(sreq,
+ sresp);
+
+ PresentationManager pm = Templating.getPresentationManager();
+ pm.servePage(doc, sreq, sresp);
+
+ } else {
+
+ // TODO: Check JSP's first (cf. cms content-section servlet)
+ sresp.sendError(404, "No such page for path " + pathInfo);
+
+ }
+
+ }
+
+
+ if (s_log.isDebugEnabled()) s_log.info("completed doService method");
+ }
+
+ /**
+ * Adds one Url-Page mapping to the internal mapping table.
+ *
+ * @param pathInfo url stub for a page to display
+ * @param page Page object to display
+ */
+ protected void addPage(final String pathInfo, final Page page) {
+
+ Assert.exists(pathInfo, String.class);
+ Assert.exists(page, Page.class);
+ // Current Implementation requires pathInfo to start with a leading '/'
+ // SUN Servlet API specifies: "PathInfo *may be empty* or will start
+ // with a '/' character."
+ Assert.isTrue(pathInfo.startsWith("/"), "path starts not with '/'");
+
+ m_pages.put(pathInfo, page);
+ }
+
+
+ /**
+ * Build index page for the document manager,
+ */
+ private Page buildRepositoryIndexPage() {
+
+ Page p = new DocmgrBasePage();
+
+ /* Create main administration tab. */
+ TabbedPane tb = new TabbedPane();
+ tb.setIdAttr("page-body");
+
+ //tb.addTab(WS_BROWSE_TITLE, new BrowsePane());
+ /*
+ * Disable Repositories tab because
+ * Still need to decide what to do with mounting
+ * repository, since repository are now application.
+ *
+ tb.addTab(WS_REPOSITORIES_TITLE, new RepositoryPane());
+ */
+
+ p.add(new BrowsePane());
+ p.lock();
+
+ return p;
+ }
+
+ /**
+ * Build page for the administration of one file.
+ */
+ protected Page buildFileInfoPage() {
+
+ final BigDecimalParameter fileIDParam = new
+ BigDecimalParameter(FILE_ID_PARAM_NAME);
+
+ DocmgrBasePage p = new DocmgrBasePage(fileIDParam) {
+ // need to override this to show the File name
+ @Override
+ protected void buildTitle() {
+ Label title = new Label();
+ title.addPrintListener(new
+ com.arsdigita.bebop.event.PrintListener() {
+ public void prepare(PrintEvent e) {
+ PageState state = e.getPageState();
+ Label t = (Label) e.getTarget();
+ BigDecimal fid =
+ (BigDecimal) state.getValue(fileIDParam);
+ if (fid!=null) {
+ t.setLabel(DMUtils.getFile(fid).getTitle());
+ }
+ }
+ });
+ setTitle(title);
+ }
+
+ @Override
+ protected void buildContextBar() {
+ FileDimensionalNavbar navbar = new FileDimensionalNavbar(
+ new RequestLocal() {
+ @Override
+ protected Object initialValue(PageState state) {
+ BigDecimal id = (BigDecimal) state.getValue(fileIDParam);
+ return new Document(id);
+ }
+ });
+ navbar.setClassAttr("portalNavbar");
+ getHeader().add(navbar);
+ }
+
+ };
+
+ // need to add the file parameter to the page
+ //BigDecimalParameter FILE_ID_PARAM = new BigDecimalParameter(FILE_ID_PARAM_NAME);
+ //p.addGlobalStateParam(fileIDParam);
+
+ /* Temporary fix to sdm #204233, NavBar of Application allows only
+ one URL per application, so here we add a Link back to the parent folder
+ */
+ Label backLinkLabel = new Label
+ (new GlobalizedMessage("ui.fileinfo.goback.label", BUNDLE_NAME));
+ backLinkLabel.addPrintListener(new PrintListener() {
+ public void prepare(PrintEvent e) {
+ PageState state = e.getPageState();
+
+ Label t= (Label) e.getTarget();
+ String fixed = t.getLabel(e.getPageState());
+ String url = Web.getContext().getApplication().getTitle();
+
+ t.setLabel(fixed + " " + url);
+ }});
+ ActionLink backLink = new ActionLink(backLinkLabel);
+ backLink.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ PageState state = e.getPageState();
+ String url = Web.getContext().getApplication().getPath();
+ BigDecimal fid = (BigDecimal) state.getValue(fileIDParam);
+
+ if (fid != null) {
+ url = url + "?d_id="+fid;
+ }
+ /*
+ BigDecimal pid = null;
+ BigDecimal fid = (BigDecimal) state.getValue(FILE_ID_PARAM);
+ if (fid!=null) {
+ pid = DMUtils.getFile(fid).getParentResource().getID();
+ }
+ */
+ try {
+ DispatcherHelper.sendRedirect(state.getRequest(),
+ state.getResponse(),
+ url);
+ } catch (IOException iox) {
+ throw new RuntimeException("Redirect to Application failed"
+ +iox);
+ }
+ }});
+ backLink.setClassAttr("actionLink");
+ p.add(backLink);
+
+ // create main File-Info tabs
+ TabbedPane tb = new TabbedPane();
+ tb.setIdAttr("page-body");
+
+ tb.addTab(FILE_INFO_PROPERTIES_TITLE, new FileInfoPropertiesPane(p));
+ // TODO - comment in
+ tb.addTab(FILE_INFO_HISTORY_TITLE, new FileInfoHistoryPane(p));
+
+ /*
+ * Disable Links tab because we have not
+ * decided how to link other KnItems to a document.
+ * 01/04/02 Stefan Deusch
+ *
+ tb.addTab(FILE_INFO_LINKS_TITLE, new FileInfoLinksPane());
+ */
+ p.add(tb);
+ p.lock();
+
+ return p;
+ }
+
+ /**
+ * Build search page for the document manager,
+ */
+ protected Page buildSearchPage() {
+ Page p = new DocmgrBasePage();
+
+ /**
+ * Create main administration tab.
+ */
+ TabbedPane tb = new TabbedPane();
+ tb.setIdAttr("page-body");
+
+ //tb.addTab(WS_BROWSE_TITLE, new BrowsePane());
+
+ /*
+ * Disable Repositories tab because
+ * Still need to decide what to do with mounting
+ * repository, since repository are now application.
+ *
+ tb.addTab(WS_REPOSITORIES_TITLE, new RepositoryPane());
+ */
+
+ p.add(new SearchPane());
+ p.lock();
+
+ return p;
+ }
+
+}
diff --git a/ccm-docmgr/web/WEB-INF/web.ccm-docmgr.xml b/ccm-docmgr/web/WEB-INF/web.ccm-docmgr.xml
new file mode 100644
index 000000000..40c9fe7f1
--- /dev/null
+++ b/ccm-docmgr/web/WEB-INF/web.ccm-docmgr.xml
@@ -0,0 +1,28 @@
+
+
+
+
+
+ docmgr-repository
+ com.arsdigita.cms.docmgr.ui.RepositoryServlet
+
+
+
+ docmgr-categorybrowser
+ com.arsdigita.cms.docmgr.ui.CategoryBrowserServlet
+
+
+
+ docmgr-repository
+ /docmgr-repo/*
+
+
+
+ docmgr-categorybrowser
+ /docmgr-cat/*
+
+
+
\ No newline at end of file
diff --git a/ccm-docmgr/web/packages/docmgr/xsl/docs.xsl b/ccm-docmgr/web/packages/docmgr/xsl/docs.xsl
index 53963f87b..bb66daa63 100755
--- a/ccm-docmgr/web/packages/docmgr/xsl/docs.xsl
+++ b/ccm-docmgr/web/packages/docmgr/xsl/docs.xsl
@@ -9,7 +9,7 @@
-
+