diff --git a/ccm-docrepo/CHANGELOG b/ccm-docrepo/CHANGELOG
index 89ba7cf3c..3f4facb86 100644
--- a/ccm-docrepo/CHANGELOG
+++ b/ccm-docrepo/CHANGELOG
@@ -1,4 +1,11 @@
+February 27, 2012
+=================
+
+Package ccm-docrepo is now initialized as a new style, legacy free application.
+An update is not necessary because has not been part of distribution yet.
+
April 14, 2011
+==============
Package ccm-docmgr from Byline repository copied and integrated in ccm/aplaws
as an test environment.
diff --git a/ccm-docrepo/application.xml b/ccm-docrepo/application.xml
index 3ae958a09..cff5a8226 100644
--- a/ccm-docrepo/application.xml
+++ b/ccm-docrepo/application.xml
@@ -3,7 +3,7 @@
@@ -16,6 +16,9 @@
+ The document repository is an online file storage system for
+ collaborative file sharing within groups.
+
diff --git a/ccm-docrepo/etc/enterprise.init.in b/ccm-docrepo/etc/enterprise.init.in
deleted file mode 100644
index 89eb21c1a..000000000
--- a/ccm-docrepo/etc/enterprise.init.in
+++ /dev/null
@@ -1 +0,0 @@
-init com.arsdigita.docrepo.installer.Initializer { }
diff --git a/ccm-docrepo/pdl/com/arsdigita/docrepo/query-getRepositoriesView.pg.pdl b/ccm-docrepo/pdl/com/arsdigita/docrepo/query-getRepositoriesView.pg.pdl
index 3a72b69ad..a09820028 100644
--- a/ccm-docrepo/pdl/com/arsdigita/docrepo/query-getRepositoriesView.pg.pdl
+++ b/ccm-docrepo/pdl/com/arsdigita/docrepo/query-getRepositoriesView.pg.pdl
@@ -26,7 +26,7 @@ query getRepositoriesView {
select distinct
dr_repositories.repository_id,
coalesce(dm.repository_id, null, 0, 1) as mounted,
- dr_repository_num_files(docs_repositories.root_id) as num_files
+ dr_repository_num_files(dr_repositories.root_id) as num_files
from dr_repositories
left join (select repository_id from docs_mounted
where party_id = :userID) dm
diff --git a/ccm-docrepo/src/com/arsdigita/docrepo/Loader.java b/ccm-docrepo/src/com/arsdigita/docrepo/Loader.java
index 793268dc4..ca32ba4e2 100644
--- a/ccm-docrepo/src/com/arsdigita/docrepo/Loader.java
+++ b/ccm-docrepo/src/com/arsdigita/docrepo/Loader.java
@@ -86,17 +86,31 @@ public class Loader extends PackageLoader {
*/
private void loadDocRepositoryApplicationType() {
- ApplicationType type = ApplicationType.createApplicationType(
- "docrepo",
- "Document Repository",
- Repository.BASE_DATA_OBJECT_TYPE);
- type.setDescription
- ("The document repository empowers users to share documents.");
+ /* Legacy compatible initialization */
+ // ApplicationType type = ApplicationType.createApplicationType(
+ // "docrepo",
+ // "Document Repository",
+ // Repository.BASE_DATA_OBJECT_TYPE);
// Current code requires an apps specific dispatcher class. Has to be
// modified to be able to create a legacy free app type.
- type.setDispatcherClass
- ("com.arsdigita.docrepo.ui.DRDispatcher");
+ // type.setDispatcherClass
+ // ("com.arsdigita.docrepo.ui.DRDispatcher");
+ /* 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".
+ */
+ ApplicationType type = new
+ ApplicationType("DocRepo",
+ Repository.BASE_DATA_OBJECT_TYPE );
+
+ type.setDescription
+ ("The document repository empowers users to share documents.");
+
}
diff --git a/ccm-docrepo/src/com/arsdigita/docrepo/Repository.java b/ccm-docrepo/src/com/arsdigita/docrepo/Repository.java
index 91f5eb523..8417dfd66 100644
--- a/ccm-docrepo/src/com/arsdigita/docrepo/Repository.java
+++ b/ccm-docrepo/src/com/arsdigita/docrepo/Repository.java
@@ -104,7 +104,7 @@ public class Repository extends Application {
}
/**
- * Retreives a repository from the database usings its OID.
+ * Constructor retrieves a repository from the database usings its OID.
*
* @param oid the OID of the repository
*/
@@ -324,4 +324,33 @@ 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:
+ *
+ * docrepo
+ * com.arsdigita.docrepo.RepositoryServlet
+ *
+ *
+ *
+ * docrepo
+ * /docrepo/*
+ *
+ *
+ * @return ServelPath of the applications servlet
+ */
+ @Override
+ public String getServletPath() {
+ return "/docrepo/";
+ }
+
}
diff --git a/ccm-docrepo/src/com/arsdigita/docrepo/RepositoryServlet.java b/ccm-docrepo/src/com/arsdigita/docrepo/RepositoryServlet.java
deleted file mode 100644
index 5addd1577..000000000
--- a/ccm-docrepo/src/com/arsdigita/docrepo/RepositoryServlet.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- * Copyright (C) 2011 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.docrepo;
-
-import com.arsdigita.bebop.ActionLink;
-import com.arsdigita.bebop.Label;
-import com.arsdigita.bebop.Page;
-import com.arsdigita.bebop.PageState;
-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.page.BebopApplicationServlet;
-import com.arsdigita.bebop.page.BebopMapDispatcher;
-import com.arsdigita.dispatcher.DispatcherHelper;
-import com.arsdigita.dispatcher.ObjectNotFoundException;
-import com.arsdigita.dispatcher.RequestContext;
-import com.arsdigita.docrepo.File;
-import com.arsdigita.kernel.permissions.PrivilegeDescriptor;
-import com.arsdigita.domain.DataObjectNotFoundException;
-import com.arsdigita.web.Web;
-import com.arsdigita.persistence.Session;
-import com.arsdigita.persistence.SessionManager;
-import com.arsdigita.persistence.DataQuery;
-import com.arsdigita.util.UncheckedWrapperException;
-import org.apache.log4j.Category;
-
-import java.io.*;
-import java.math.BigDecimal;
-
-import javax.servlet.ServletException;
-import org.apache.log4j.Logger;
-
-/**
- *
- * @author pb
- */
-public class RepositoryServlet extends BebopApplicationServlet {
-
- /** Private logger instance to faciliate debugging procedures */
- private static final Logger s_log = Logger.getLogger(RepositoryServlet.class);
-
-
- /**
- * Servlet Initialisation, builds the UI elements (various panes)
- * @throws ServletException
- */
- @Override
- public void init() throws ServletException {
- super.init();
- s_log.debug("creating DocRepo page");
-
-
-// Page index = buildIndexPage();
-// Page admin = buildAdminIndexPage();
-
-// put("/", index);
-// put("/index.jsp", index);
-// put("/one.jsp", index);
-
- // put("admin", admin);
- // put("admin/index.jsp", admin);
-
- }
-
-
-
-
-}
diff --git a/ccm-docrepo/doc/package.html b/ccm-docrepo/src/com/arsdigita/docrepo/package.html
similarity index 80%
rename from ccm-docrepo/doc/package.html
rename to ccm-docrepo/src/com/arsdigita/docrepo/package.html
index 6b6a107e0..36e9d28fa 100644
--- a/ccm-docrepo/doc/package.html
+++ b/ccm-docrepo/src/com/arsdigita/docrepo/package.html
@@ -1,4 +1,3 @@
-
com.arsdigita.docrepo
diff --git a/ccm-docrepo/src/com/arsdigita/docrepo/ui/BrowsePane.java b/ccm-docrepo/src/com/arsdigita/docrepo/ui/BrowsePane.java
index 8fd8f98d5..b0358e8a3 100644
--- a/ccm-docrepo/src/com/arsdigita/docrepo/ui/BrowsePane.java
+++ b/ccm-docrepo/src/com/arsdigita/docrepo/ui/BrowsePane.java
@@ -65,7 +65,7 @@ import java.util.ArrayList;
* @author Stefan Deusch
*/
class BrowsePane extends ModalContainer
- implements DRConstants, ChangeListener, RequestListener {
+ implements DRConstants, ChangeListener, RequestListener {
private Component m_folderContent;
private Component m_destinationFolderPanel;
@@ -76,7 +76,7 @@ class BrowsePane extends ModalContainer
private ErrorMessageLabel m_errorMsgLabel;
private Container m_mainBrowseContainer;
- private TabbedPane m_mainTabPane;
+// private TabbedPane m_mainTabPane;
private Tree m_tree;
@@ -92,11 +92,11 @@ class BrowsePane extends ModalContainer
public BrowsePane() {
- m_mainTabPane = new TabbedPane();
+ // m_mainTabPane = new TabbedPane();
m_mainBrowseContainer = new BoxPanel();
- m_mainTabPane.addTab(WS_BROWSE_TITLE,
- m_mainBrowseContainer);
+ // m_mainTabPane.addTab(WS_BROWSE_TITLE,
+ // m_mainBrowseContainer);
m_mainBrowseContainer.setClassAttr("sidebarNavPanel");
//m_mainBrowseContainer.setAttribute("navbar-title", "Folders");
@@ -120,7 +120,8 @@ class BrowsePane extends ModalContainer
m_mainBrowseContainer.add(rightSide);
- add(m_mainTabPane);
+ // add(m_mainTabPane);
+ add(m_mainBrowseContainer);
m_newFileForm = makeFileUploadForm();
add(m_newFileForm);
@@ -344,7 +345,8 @@ class BrowsePane extends ModalContainer
}
public void displayFolderContentPanel(PageState state) {
- setVisibleComponent(state, m_mainTabPane);
+ // setVisibleComponent(state, m_mainTabPane);
+ setVisibleComponent(state, m_mainBrowseContainer);
}
public void displayDestinationFolderPanel(PageState state,
diff --git a/ccm-docrepo/src/com/arsdigita/docrepo/ui/DRConstants.java b/ccm-docrepo/src/com/arsdigita/docrepo/ui/DRConstants.java
index e523ab59c..be982fe0f 100644
--- a/ccm-docrepo/src/com/arsdigita/docrepo/ui/DRConstants.java
+++ b/ccm-docrepo/src/com/arsdigita/docrepo/ui/DRConstants.java
@@ -29,7 +29,7 @@ import com.arsdigita.globalization.GlobalizedMessage;
* @author Stefan Deusch
*/
-public interface DRConstants {
+interface DRConstants {
// PDL vars
String FOLDER_ID = "folderID";
diff --git a/ccm-docrepo/src/com/arsdigita/docrepo/ui/DRDispatcher.java b/ccm-docrepo/src/com/arsdigita/docrepo/ui/DRDispatcher.java.nolongerInUse
similarity index 99%
rename from ccm-docrepo/src/com/arsdigita/docrepo/ui/DRDispatcher.java
rename to ccm-docrepo/src/com/arsdigita/docrepo/ui/DRDispatcher.java.nolongerInUse
index 42560843e..c63ad33e9 100644
--- a/ccm-docrepo/src/com/arsdigita/docrepo/ui/DRDispatcher.java
+++ b/ccm-docrepo/src/com/arsdigita/docrepo/ui/DRDispatcher.java.nolongerInUse
@@ -209,7 +209,7 @@ public class DRDispatcher extends BebopMapDispatcher implements DRConstants {
public void dispatch(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse resp,
RequestContext ctx)
- throws IOException, javax.servlet.ServletException {
+ throws IOException, javax.servlet.ServletException {
String url = req.getRequestURI();
int index = url.lastIndexOf("/download/");
diff --git a/ccm-docrepo/src/com/arsdigita/docrepo/ui/DRServlet.java b/ccm-docrepo/src/com/arsdigita/docrepo/ui/DRServlet.java
new file mode 100644
index 000000000..819155960
--- /dev/null
+++ b/ccm-docrepo/src/com/arsdigita/docrepo/ui/DRServlet.java
@@ -0,0 +1,383 @@
+/*
+ * Copyright (C) 2011 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.docrepo.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.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.dispatcher.DispatcherHelper;
+import com.arsdigita.dispatcher.ObjectNotFoundException;
+import com.arsdigita.docrepo.File;
+// import com.arsdigita.docrepo.ui.BrowsePane;
+// import com.arsdigita.docrepo.ui.DocrepoBasePage;
+// import com.arsdigita.docrepo.ui.DRConstants;
+// import com.arsdigita.docrepo.ui.DRUtils;
+// import com.arsdigita.docrepo.ui.FileInfoHistoryPane;
+// import com.arsdigita.docrepo.ui.FileInfoPropertiesPane;
+// import com.arsdigita.docrepo.ui.RepositoryPane;
+import com.arsdigita.domain.DataObjectNotFoundException;
+import com.arsdigita.kernel.permissions.PrivilegeDescriptor;
+import com.arsdigita.persistence.DataQuery;
+import com.arsdigita.persistence.Session;
+import com.arsdigita.persistence.SessionManager;
+import com.arsdigita.templating.PresentationManager;
+import com.arsdigita.templating.Templating;
+import com.arsdigita.util.Assert;
+import com.arsdigita.util.UncheckedWrapperException;
+import com.arsdigita.web.Application;
+import com.arsdigita.web.BaseApplicationServlet;
+import com.arsdigita.xml.Document;
+
+import com.arsdigita.web.Web;
+import java.io.*;
+
+import java.math.BigDecimal;
+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 the ccm-docrepo application, serves all request made
+ * for the application's UI.
+ *
+ * URLs of the available services are stored in a XML file which is processed
+ * into a cache of services on a request by request basis (lazy loading).
+ *
+ * ServiceServlet is called by BaseApplicationServlet which has determined that
+ * ServiceServlet is associated with a request URL.
+ *
+ * The CMS Service determines whether a Page has been registered to
+ * the URL and if so passes the request to that page.
+ *
+ * If no Page is registered to the URL, then the CMS Service hands
+ * the request to the TemplateResolver to find an appropriate JSP file.
+ *
+ * @author Stefan Deusch
+ * @author Peter Boy
+ * @version $Id: DRServlet.java 2161 2012-02-26 00:16:13Z pboy $
+ */
+public class DRServlet extends BaseApplicationServlet
+ implements DRConstants {
+
+ /** Private logger instance to faciliate debugging procedures */
+ private static final Logger s_log = Logger.getLogger(DRServlet.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() {
+ if (s_log.isDebugEnabled()) {
+ s_log.info("starting RepositoryServlet doInit method ...");
+ }
+
+ addPage("/", buildDMIndexPage());
+ addPage("/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 */
+ s_log.debug("Downloading");
+ String str = sreq.getParameter(FILE_ID_PARAM.getName());
+ if (str != null) {
+ BigDecimal id = new BigDecimal(str);
+
+ File file = null;
+ try {
+ file = new File(id);
+ } catch(DataObjectNotFoundException nfe) {
+ throw new ObjectNotFoundException(
+ "The requested file no longer exists.");
+ }
+
+ //Check to see if current user is allowed to read this file
+ file.assertPrivilege(PrivilegeDescriptor.READ);
+
+ String mimetype = file.getContentType();
+ if (mimetype == null) {
+ mimetype = File.DEFAULT_MIME_TYPE;
+ }
+
+
+ sresp.setContentType(mimetype);
+
+ InputStream is;
+ final String transaction = sreq.getParameter("trans_id");
+ if (transaction == null || transaction.equals("current")) {
+ is = file.getInputStream();
+ } else {
+ is = getFileRevision(transaction);
+ }
+
+ sendToOutput(is, sresp.getOutputStream());
+
+ }
+ } else {
+ /* Show the repository page */
+ s_log.debug("show repository page");
+ // super.dispatch(req, resp, ctx);
+
+ 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 Document doc = page.buildDocument(sreq, sresp);
+
+ PresentationManager pm = Templating.getPresentationManager();
+ pm.servePage(doc, sreq, sresp);
+
+ } else {
+
+ sresp.sendError(404, "No such page for path " + pathInfo);
+
+ }
+
+ }
+
+ }
+
+ /**
+ * 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
+ */
+ private 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 repository,
+ */
+
+ private Page buildDMIndexPage() {
+
+ Page page = new DocrepoBasePage();
+
+ /**
+ * Create main administration tab.
+ */
+ TabbedPane tabbedPane = new TabbedPane();
+ tabbedPane.setIdAttr("page-body");
+ tabbedPane.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.*/
+ // tabbedPane.addTab(WS_REPOSITORIES_TITLE, new RepositoryPane());
+
+ //p.add(new BrowsePane());
+ page.add(tabbedPane);
+ page.lock();
+
+ return page;
+ }
+
+ /**
+ * Build page for the administration of one file.
+ * (Implementation according to wireframes at)
+ */
+ private Page buildFileInfoPage() {
+
+ DocrepoBasePage p = new DocrepoBasePage() {
+ // 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(FILE_ID_PARAM);
+ if (fid!=null) {
+ t.setLabel
+ (DRUtils.getFile(fid).getName());
+ }
+ }
+ });
+ setTitle(title);
+ }
+ };
+
+ /* 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 = GO_BACK_LABEL;
+ 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(FILE_ID_PARAM);
+
+ if (fid != null) {
+ url = url + "?d_id="+fid;
+ }
+ /*
+ BigDecimal pid = null;
+ BigDecimal fid = (BigDecimal) state.getValue(FILE_ID_PARAM);
+ if (fid!=null) {
+ pid = DRUtils.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));
+ tb.addTab(FILE_INFO_HISTORY_TITLE, new FileInfoHistoryPane());
+
+ /*
+ * 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;
+ }
+
+
+ /**
+ *
+ * @param is
+ * @param os
+ */
+ private static void sendToOutput(InputStream is, OutputStream os) {
+ byte[] buf = new byte[8192]; // 8k buffer
+
+ try {
+ int sz = 0;
+ while ((sz = is.read(buf, 0 , 8192)) != -1) {
+ os.write(buf, 0, sz);
+ }
+ } catch (IOException iox) {
+ iox.printStackTrace();
+ throw new UncheckedWrapperException("IO Error streaming file", iox);
+ } finally {
+ try {
+ is.close();
+ os.close();
+ } catch(IOException iox2) { }
+ }
+
+ }
+
+ /**
+ *
+ * @param transaction
+ * @return
+ */
+ private static InputStream getFileRevision(String transaction) {
+ BigDecimal transactionID = new BigDecimal(transaction);
+
+ Session session = SessionManager.getSession();
+ DataQuery query = session.retrieveQuery
+ ("com.arsdigita.docrepo.getFileRevisionBlob");
+ query.setParameter("transactionID", transactionID);
+ InputStream is = null;
+ if (query.next()) {
+ Object blob = query.get("content");
+ is = new ByteArrayInputStream((byte[]) blob);
+ }
+
+ return is;
+ }
+
+}
diff --git a/ccm-docrepo/src/com/arsdigita/docrepo/ui/DRUtils.java b/ccm-docrepo/src/com/arsdigita/docrepo/ui/DRUtils.java
index 00b9c2aca..88438af11 100644
--- a/ccm-docrepo/src/com/arsdigita/docrepo/ui/DRUtils.java
+++ b/ccm-docrepo/src/com/arsdigita/docrepo/ui/DRUtils.java
@@ -48,7 +48,7 @@ import java.util.Locale;
* @author Stefan Deusch
* @version $Id: DRUtils.java pboy $
*/
-public class DRUtils implements DRConstants {
+class DRUtils implements DRConstants {
private static final Logger s_log = Logger.getLogger(DRUtils.class);
diff --git a/ccm-docrepo/src/com/arsdigita/docrepo/ui/DocrepoBasePage.java b/ccm-docrepo/src/com/arsdigita/docrepo/ui/DocrepoBasePage.java
index 1f30d1bf8..afd5781ab 100644
--- a/ccm-docrepo/src/com/arsdigita/docrepo/ui/DocrepoBasePage.java
+++ b/ccm-docrepo/src/com/arsdigita/docrepo/ui/DocrepoBasePage.java
@@ -48,7 +48,7 @@ import org.apache.log4j.Logger;
* @author Jim Parsons
*/
-public class DocrepoBasePage extends Page {
+class DocrepoBasePage extends Page {
private final Container m_global;
private final Container m_header;
@@ -131,7 +131,11 @@ public class DocrepoBasePage extends Page {
// override this method.
protected final void buildPage() {
buildTitle();
- buildContextBar();
+ // Context Byr temporarily deactivated until the functionality to
+ // to create multiple repositories (table docs_mounted) is restored.
+ // Because currently there is only one repository mounted there is
+ // no relevant context
+ /* buildContextBar(); */
buildGlobal(getGlobal());
buildHeader(getHeader());
buildBody(getBody());
diff --git a/ccm-docrepo/src/com/arsdigita/docrepo/ui/RepositoriesTable.java b/ccm-docrepo/src/com/arsdigita/docrepo/ui/RepositoriesTable.java
index a7a51ce35..e1f61b5b9 100644
--- a/ccm-docrepo/src/com/arsdigita/docrepo/ui/RepositoriesTable.java
+++ b/ccm-docrepo/src/com/arsdigita/docrepo/ui/RepositoriesTable.java
@@ -56,10 +56,9 @@ import java.util.Vector;
class RepositoriesTable implements DRConstants {
- private static String REPOSITORIES_IDS
- = "repositories-ids";
+ private static String REPOSITORIES_IDS = "repositories-ids";
private static String REPOSITORIES_SUBSCRIBED_IDS =
- "repositories-subscribed-ids";
+ "repositories-subscribed-ids";
static String[] s_tableHeaders = {
"",
@@ -87,6 +86,7 @@ class RepositoriesTable implements DRConstants {
// store query result once
m_query = new RequestLocal() {
+ @Override
protected Object initialValue(PageState s) {
User viewer = DRUtils.getUser(s);
Session session = SessionManager.getSession();
diff --git a/ccm-docrepo/web/WEB-INF/web.ccm-docrepo.xml b/ccm-docrepo/web/WEB-INF/web.ccm-docrepo.xml
new file mode 100644
index 000000000..c18b29193
--- /dev/null
+++ b/ccm-docrepo/web/WEB-INF/web.ccm-docrepo.xml
@@ -0,0 +1,18 @@
+
+
+
+
+
+ docrepo
+ com.arsdigita.docrepo.ui.DRServlet
+
+
+
+ docrepo
+ /docrepo/*
+
+
+
\ No newline at end of file