FAQ Bug Darstellung korrigiert, diverse Formatierungen und Doku Ergänzung.

git-svn-id: https://svn.libreccm.org/ccm/trunk@1564 8810af33-2d31-482b-a856-94f89814c4df
master
pb 2012-03-31 12:06:46 +00:00
parent ac746fde45
commit 355f54236f
15 changed files with 75 additions and 112 deletions

View File

@ -44,6 +44,7 @@ public class Loader extends PackageLoader {
private static final Logger s_log = Logger.getLogger(Loader.class);
/**
* Run script invoked by com.arsdigita.packing loader script.
*
* @param ctx
*/
@ -104,10 +105,10 @@ public class Loader extends PackageLoader {
/* Determine a parent application. Bookmarks admin page will be
* installed beyond the admin's applications URL. */
Application admin = Application.retrieveApplicationForPath("/admin/");
Application parent = Application.retrieveApplicationForPath("/admin/");
// create application instance
Bookmarks app = Bookmarks.create("bookmarks", "Bookmarks", admin);
Bookmarks app = Bookmarks.create("bookmarks", "Bookmarks", parent);
s_log.debug("Bookmarks instance " + " created.");
}

View File

@ -3,7 +3,6 @@
version="1.0">
<xsl:param name="context-prefix"/>
<xsl:param name="static-prefix"/>
<xsl:param name="dispatcher-prefix"/>
<xsl:variable name="legacy-asset-prefix" select="//@assets"/>

View File

@ -15,7 +15,6 @@
<xsl:import href="admin/cms-admin.xsl"/>
<xsl:param name="context-prefix"/>
<xsl:param name="static-prefix"/>
<xsl:param name="internal-theme"/>
<!-- GENERAL CMS ADMIN STYLING -->

View File

@ -126,16 +126,6 @@ public class PageTransformer implements PresentationManager {
}
});
registerXSLParameterGenerator("static-prefix",
new XSLParameterGenerator() {
@Override
public String generateValue(HttpServletRequest request) {
return Web.getContext().getRequestURL().getContextPath()
+ com.arsdigita.web.URL.STATIC_DIR;
}
});
registerXSLParameterGenerator("dispatcher-prefix",
new XSLParameterGenerator() {

View File

@ -133,20 +133,7 @@ import org.apache.log4j.Logger;
public class URL {
private static final Logger s_log = Logger.getLogger(URL.class);
/**
* @deprecated
*/
private static final String INTERNAL_DIR = "/__ccm__";
/**
* The standard location for JSP files.
* @deprecated
*/
public static final String JSP_DIR = INTERNAL_DIR + "/jsp";
/**
* The standard location for static files.
* @deprecated
*/
public static final String STATIC_DIR = INTERNAL_DIR + "/static";
/**
* The standard location for XSL files.
* No longer in use.

View File

@ -183,9 +183,9 @@ public class Faq extends Application {
*
* 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) you may use a
* standard location.
* package (application) along with others in one context. If you install
* it into its own context (no longer recommended) 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:
@ -199,7 +199,12 @@ public class Faq extends Application {
* <url-pattern>/faq/*</url-pattern>
* </servlet-mapping>
*
* The appended "/*" ensures BaseServlet will find additional JSP's.
* The appended "/*" ensures BaseServlet will find additional JSP's (located
* in URL.TEMPLATE_DIR/ccm-faq/*).
*
* Ensure the url-pattern does NOT have a real counterpart in the file
* system! For virtual locations you may use URL.SERVLET_DIR as base
* directory.
*
* @return path name to the applications servlet/JSP
*/

View File

@ -29,6 +29,9 @@ import javax.servlet.ServletException;
import org.apache.log4j.Logger;
/**
* FAQ Application Servlet class, central entry point to
* create and process the applications UI.
*
*
* @author pb
*/
@ -38,6 +41,10 @@ public class FaqServlet extends BebopApplicationServlet {
private static final Logger s_log = Logger.getLogger(FaqServlet.class);
/**
*
* @throws ServletException
*/
@Override
public void init() throws ServletException {
super.init();
@ -48,10 +55,9 @@ public class FaqServlet extends BebopApplicationServlet {
put("/", index);
put("/index.jsp", index);
put("/one.jsp", index);
// put("admin", admin);
// put("admin/index.jsp", admin);
put("/admin", admin);
put("/admin/index.jsp", admin);
}
@ -60,6 +66,7 @@ public class FaqServlet extends BebopApplicationServlet {
* @return
*/
private FaqPage buildIndexPage() {
FaqPage p = new FaqPage();
p.add(new FaqUserView());

View File

@ -24,12 +24,15 @@ import com.arsdigita.kernel.KernelExcursion;
import com.arsdigita.loader.PackageLoader;
import com.arsdigita.portal.apportlet.AppPortletType;
import com.arsdigita.runtime.ScriptContext;
import com.arsdigita.web.Application;
import com.arsdigita.web.ApplicationType;
import org.apache.log4j.Logger;
/**
* FAQ Application Loader
* FAQ Application Loader executes nonrecurring at install time and loads
* (installs and initializes) the FAQ application type, portlet type and
* default application instance persistently into database.
*
* @author pboy &lt;pboy@barkhof.uni-bremen.de&gt;
* @version $Id: Loader.java $
@ -37,7 +40,7 @@ import org.apache.log4j.Logger;
public class Loader extends PackageLoader {
/** Logger instance for debugging */
/** Creates a s_logging category with name = full name of class */
private static final Logger s_log = Logger.getLogger(Loader.class);
/**
@ -52,9 +55,9 @@ public class Loader extends PackageLoader {
setEffectiveParty(Kernel.getSystemParty());
loadFAQApplicationType();
setupFaqQuestionsPortlet(null);
loadFaqQuestionsPortletType(null);
setupDefaultFaq();
setupDefaultFaqInstance();
}
}.run();
@ -70,33 +73,19 @@ public class Loader extends PackageLoader {
/**
* Creates a FAQ application type, the domain class of the
* FAQ package, as a legacy-compatible type of application.
*
* Creates an entry in table application_types and a corresponding entry in
* apm_package_types
*
* TODO: migrate to a new style, legacy free application type.
* FAQ package.
*/
private void loadFAQApplicationType() {
// /* Setup a new style legacy compatible application type. */
// ApplicationType type = ApplicationType.createApplicationType(
// "faq",
// "Frequently Asked Questions",
// Faq.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.faq.FaqDispatcher");
/* Setup as new stype legacy free aplcation */
// NOTE: The title "FAQ" is used to retrieve the application's
// name to determine the location of xsl files (by url-izing it). So
// DON'T modify it without synchronizing web directory tree accordingly!
ApplicationType type = new ApplicationType("FAQ",
Faq.BASE_DATA_OBJECT_TYPE);
// set.Description is independent from application type:
type.setDescription
("Frequently Asked Questions empower users to share knowledge.");
type.save();
}
@ -112,9 +101,22 @@ public class Loader extends PackageLoader {
* Creates a default FAQ application instance at address /faq/
*
*/
private void setupDefaultFaq() {
private void setupDefaultFaqInstance() {
s_log.debug("About to create FAQ application instance ...");
Faq faq = Faq.create("faq", "Default FAQ", null);
/* Determine a parent application. */
Application parent;
/* For now we install FAQ as an root application.
* If admin needs to install several FAQ instances this decision may
* become inappropriate. It may be better to either not install any
* default application and leave it to the admin to install proper
* instances or try to find a more flexible solution which better fits
* to many instances. */
// parent = Application.retrieveApplicationForPath("/admin/");
parent=null;
Faq faq = Faq.create("faq", "Default FAQ", parent);
faq.setDescription("The default ccm-faq instance.");
faq.save();
}
@ -134,28 +136,9 @@ public class Loader extends PackageLoader {
* Instances (Portlets) are created by user interface or programmatically
* by configuration.
*/
private void setupFaqQuestionsPortlet(ApplicationType provider) {
private void loadFaqQuestionsPortletType(ApplicationType provider) {
// Create the FAQ questions portlet
/* Copied from docfrepo as an example
AppPortletSetup setup = new AppPortletSetup(s_log);
setup.setPortletObjectType(RecentUpdatedDocsPortlet.BASE_DATA_OBJECT_TYPE);
setup.setTitle("Recently Updated Documents");
setup.setDescription(
"Displays the most recent documents in the document repository.");
setup.setProfile(PortletType.WIDE_PROFILE);
// setup.setProviderApplicationType(provider);
setup.setProviderApplicationType(Repository.BASE_DATA_OBJECT_TYPE);
setup.setInstantiator(new ACSObjectInstantiator() {
@Override
protected DomainObject doNewInstance(DataObject dataObject) {
return new RecentUpdatedDocsPortlet(dataObject);
}
});
setup.run();
*/
AppPortletType portletType = AppPortletType.createAppPortletType
("Faq Questions Portlet", AppPortletType.WIDE_PROFILE,
FaqQuestionsPortlet.BASE_DATA_OBJECT_TYPE);

View File

@ -33,8 +33,11 @@ import com.arsdigita.util.LockableImpl;
import java.math.BigDecimal;
/**
*
* @version $Id: AdminQuestionTable.java#3 2004/08/17 23:26:27 $
*/
class AdminQuestionTable extends Table {
public static final String versionId = "$Id: //apps/faq/dev/src/com/arsdigita/faq/ui/AdminQuestionTable.java#3 $ by $Author: dennis $, $DateTime: 2004/08/17 23:26:27 $";
private final static String[] HEADERS = {"#", "Question"};

View File

@ -34,7 +34,6 @@ import com.arsdigita.bebop.event.PrintEvent;
import com.arsdigita.bebop.event.PrintListener;
import com.arsdigita.web.Application;
import com.arsdigita.kernel.Kernel;
import com.arsdigita.faq.ApplicationAuthenticationListener;
import com.arsdigita.kernel.permissions.PermissionDescriptor;
import com.arsdigita.kernel.permissions.PermissionService;
import com.arsdigita.kernel.permissions.PrivilegeDescriptor;
@ -62,8 +61,7 @@ public class FaqBasePage extends Page {
public static final String FAQ_HEADER_ELEMENT = "faq:header";
public static final String FAQ_BODY_ELEMENT = "faq:body";
public static final String FAQ_FOOTER_ELEMENT = "faq:footer";
public static final String FAQ_XML_NS =
"http://www.redhat.com/faq/1.0";
public static final String FAQ_XML_NS = "http://www.redhat.com/faq/1.0";
private static final Logger s_log = Logger.getLogger(FaqBasePage.class);
@ -78,6 +76,9 @@ public class FaqBasePage extends Page {
private boolean CHECK_PERMISSION = true;
/**
* Default Constructor
*/
public FaqBasePage() {
this(null);
}
@ -120,6 +121,7 @@ public class FaqBasePage extends Page {
}
@Override
public void lock() {
buildPage();
@ -176,7 +178,9 @@ public class FaqBasePage extends Page {
}
protected void buildGlobal(Container global) {
Link link = new Link( new Label(GlobalizationUtil.globalize("cw.workspace.sign_out")), "/register/logout");
Link link = new Link( new Label(GlobalizationUtil
.globalize("cw.workspace.sign_out")),
"/register/logout");
link.setClassAttr("signoutLink");
@ -186,13 +190,17 @@ public class FaqBasePage extends Page {
protected void buildHeader(Container header) {
if (m_view != null) {
if (m_view.equals("user")) {
m_viewLink = new Link
( new Label(GlobalizationUtil.globalize("cw.faq.ui.admin_view")), "./admin/index.jsp") {
public boolean isVisible(PageState ps) {
return userIsAdmin(ps);
}};
m_viewLink = new Link( new Label(GlobalizationUtil
.globalize("cw.faq.ui.admin_view")),
"./admin/index.jsp") {
@Override
public boolean isVisible(PageState ps) {
return userIsAdmin(ps);
}};
} else if (m_view.equals("admin")) {
m_viewLink = new Link( new Label(GlobalizationUtil.globalize("cw.faq.ui.user_view")), "../index.jsp");
m_viewLink = new Link( new Label(GlobalizationUtil
.globalize("cw.faq.ui.user_view")),
"../index.jsp");
}
}
@ -214,6 +222,7 @@ public class FaqBasePage extends Page {
private class Panel extends SimpleContainer {
@Override
public void generateXML(PageState ps, Element p) {
Component selected = getSelected(ps);
if (selected == null) {

View File

@ -43,12 +43,11 @@ import java.math.BigDecimal;
*
* @author <a href="mailto:teadams@arsdigita.com">Tracy Adams</a>
* @version $Revision: #4 $ $Date: 2004/08/17 $
* @version $Id: FaqPage.java#4 $
*/
public class FaqPage extends FaqBasePage {
public static final String versionId = "$Id: //apps/faq/dev/src/com/arsdigita/faq/ui/FaqPage.java#4 $ by $Author: dennis $, $DateTime: 2004/08/17 23:26:27 $";
private static final org.apache.log4j.Logger log =
org.apache.log4j.Logger.getLogger(FaqPage.class);

View File

@ -33,7 +33,7 @@ import com.arsdigita.globalization.GlobalizedMessage;
public class GlobalizationUtil implements Globalized {
private static final String BUNDLE_NAME = "com.arsdigita.faq.ui.FaqResources";
private static final String BUNDLE_NAME = "com.arsdigita.faq.FaqResources";
public static GlobalizedMessage globalize(String key) {
return new GlobalizedMessage(key, BUNDLE_NAME);

View File

@ -11,7 +11,7 @@
<!-- The order of imports below is important. Please don't change
them without appropriate testing. -->
<xsl:import href="../../acs-admin/xsl/admin_en.xsl"/>
<xsl:import href="../../admin/xsl/admin_en.xsl"/>
<xsl:import href="../../categorization/xsl/categorization.xsl"/>
<xsl:import href="../../bebop/xsl/DimensionalNavbar.xsl"/>
<xsl:import href="../../toolbox/xsl/ControlBar.xsl"/>

View File

@ -109,13 +109,9 @@ public class Loader extends PackageLoader {
setupDigestUser();
setupForumAppType( (String[]) get(m_forumInstances) );
//setupInboxAppType(); //TODO: why it is commented out?
setupRecentPostingsPortletType();
setupMyForumsPortletType();
// moved upwards
// setupDigestUser();
SessionManager.getSession().flushAll();
}
}.run();
@ -131,8 +127,7 @@ public class Loader extends PackageLoader {
*/
private static void setupForumAppType(String[] forumNames) {
/* Create legacy-free application type
* NOTE: The wording in the title parameter of ApplicationType
/* 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
@ -157,20 +152,6 @@ public class Loader extends PackageLoader {
return ;
}
/**
* TODO: What is it for? Execution is currently commented out.
* Referenced class com.arsdigita.forum.Inbox does not exist.
* @return
*/
private static ApplicationType setupInboxAppType() {
ApplicationType type = ApplicationType
.createApplicationType(Forum.PACKAGE_TYPE,
"Inbox",
"com.arsdigita.forum.Inbox");
type.setDescription("Inbox");
return type;
}
/**
*
* @return