Andreas Hartmann wrote:
Jörn Nettingsmeier wrote:
hi!

i'm playing around a bit to implement my suggestions for a new workflow menu. i figured the easiest thing to start with would be a per-user "notify submitter" preference.

i read ChangeVisiblity.java and copied it's structure. in pubs/default/config/menus/generic.xsp i added

<menu i18n:attr="name" name="Workflow">
  <block>
...
  </block>
  <block>
<item uc:usecase="site.changeNotification"><xsp:expr>notificationChar</xsp:expr><i18n:text>Notify submitter</i18n:text></item>
  </block>
</menu>

and declared a dummy notificationChar that is always "x" for a start.

then i created a file src/java/org/apache/lenya/cms/site/usecases/ChangeNotification.java.

Just a note - that should go into the notification module.

ok. so i create src/modules/notification/java/src/org/apache/lenya/cms/site/usecases/ChangeNotification.java ? does that path make sense? or should it rather be in src/modules/notification/java/src/org/apache/lenya/notification ?

when i do "./build.sh --noconfig" it seems to be built along with the rest. it does nothing so far but implements the same methods as ChangeVisibility.

now when i restart lenya and look at the workflow menu, the new option appears to be grayed out. do i need to register this new usecase somewhere?

Yes, use a patch file

modules/notification/config/cocoon-xconf/usecase-changeNotification.xconf

i tried that, and it does not change anything. still grayed out. my patchfile says:

[EMAIL PROTECTED]:/local/lenya-build/lenya_1_4_X/src/modules/notification/config/cocoon-xconf> cat usecase-site-changeNotification.xconf
<?xml version="1.0"?>
<xconf xpath="/cocoon/usecases" unless="/cocoon/usecases/[EMAIL PROTECTED] = 'site.changeNotification']"> <component-instance name="site.changeNotification" logger="lenya.site" class="org.apache.lenya.cms.site.usecases.ChangeNotification"/>
  </xconf>


and the (dummy) implementation is

[EMAIL PROTECTED]:/local/lenya-build/lenya_1_4_X/src/modules/notification> cat java/src/org/apache/lenya/cms/site/usecases/ChangeNotification.java
package org.apache.lenya.cms.site.usecases;

import org.apache.avalon.framework.service.ServiceSelector;
import org.apache.lenya.cms.publication.Document;
import org.apache.lenya.cms.repository.Node;
import org.apache.lenya.cms.site.SiteManager;
import org.apache.lenya.cms.site.SiteStructure;
import org.apache.lenya.cms.site.SiteUtil;
import org.apache.lenya.cms.usecase.DocumentUsecase;
import org.apache.lenya.cms.usecase.UsecaseException;

/**
 * Switch submitter notification (per session)
 */
public class ChangeNotification extends DocumentUsecase {

    protected void doExecute() throws Exception {

        super.doExecute();

    }

    /**
     * @see org.apache.lenya.cms.usecase.AbstractUsecase#getNodesToLock()
     */

    protected Node[] getNodesToLock() throws UsecaseException {
        try {
SiteStructure structure = SiteUtil.getSiteStructure(this.manager, getSourceDocument());
            Node[] objects = { structure.getRepositoryNode() };
            return objects;
        } catch (Exception e) {
            throw new UsecaseException(e);
        }
    }

}

http://wiki.apache.org/avalon/IntroductionToAvalon
http://excalibur.apache.org/framework/index.html

thanks for those pointers.

anyway, that's a little out of scope for now. how should i proceed to add a per-user two-state setting for notification? modify the user interface and everything above? or is there a more idiomatic way to do it?

Actually I'd just add the information to the session for the moment.

sounds reasonable.

--
"Open source takes the bullshit out of software."
        - Charles Ferguson on TechnologyReview.com

--
Jörn Nettingsmeier, EDV-Administrator
Institut für Politikwissenschaft
Universität Duisburg-Essen, Standort Duisburg
Mail: [EMAIL PROTECTED], Telefon: 0203/379-2736

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to