Dead Project?

Jul 12, 2011 at 4:28 PM

Such an excellent project but sadly seems to be dead... Anyone going to pick this up?

Coordinator
Jul 18, 2011 at 3:25 PM

It's not dead, it's just resting! (http://www.youtube.com/watch?v=4vuW6tQ0218) :)

Sorry about the late reply, I've been on vacation in Italy. Now about DEWD, it really isn't that dead, we still use it for various projects at Eksponent, but it has definitely been neglected in terms of new features. The reason for this is quite simply, that I haven't been involved directly in projects using it, so it's been hard to find the time to work on it. However it will remain working on any Umbraco 4.x version and any bugs will be fixed (upon request at least). If you need something fixed, I'll look into it, just let me know (and keep letting me know daily, if nothing happens ;).

About Umbraco v5, I will most likely make a new version, when we get closer to a stable release, even though Hive and its very pluggable arcitecture makes it very easy to integrate other data sources directly into the main content tree (and thereby making packages such as DEWD superfluous). Any thoughts on this would be appreciated.

- Sune

Jul 20, 2011 at 5:17 PM

Not clear yet to me how Hive will work, but Dewd is awesome. What I wish I could do is create multiple Dewd sections AND have some sort of event model, like after a record is saved... Oh, and also user level security to filter only to records a particular user should see... Basically, I want it all. ;-)

Coordinator
Jul 25, 2011 at 9:58 AM

Okay, that's very fair questions and some of it should be possible already :)

Sections:
As far as I know, Umbraco wasn't really build to handle this. The problem is that the umbracoApp and umbracoAppTree tables which are used for custom sections doesn't support parameters, making it hard to vary what happens when you click on the section. It might be possible to do some trickery with appAlias, but I haven't had time to look into this.

Events:
This is supported. You need to inherit a new class from TableEditor (if this is the implementation you use) and change the type-attribute on the editor-node in your config-file to point to the new class. An example of hooking of events this way:

        public TestEditor(XElement editorElement, IRepository repos) : base(editorElement, repos)
        {
            BeforeSave += (obj, args) =>
            {
                args.Result = new Editors.SaveResult() {
                    ErrorMessage = "This editor will NOT do your bidding.",
                    Success = false
                };
                args.Cancel = true;
            };
        }

 and in the config-file:
<editor tableName="myTable" type="TestEditor,App_Code">

The following events are supported: BeforeSave, AfterSave, BeforeDelete, AfterDelete, PagePreInit, PageInit, PageLoad.

Also a lot of methods are virtual on the Editor and TableEditor, so you can override those for better control over eg. the SQL executed against the DB.

Filtering of records based on user level security:
This is a bit more tricky, but it should be possible as well. I'm assuming you mean the filtering should be applied to a View.

      <view name="Filtered items">
        <columns>
          <column field="Title" />
        </columns>
        <sql>
          <![CDATA[
            SELECT * FROM MyTable WHERE @userId in (SELECT UserID FROM MyTableUserAccess)
          ]]>
        </sql>
        <parameter name="@userId" type="UserIdGetter,App_Code" />
      </view>

And UserGroupGetter.cs should contain a class inheriting from IValueGetter:

    public class UserGroupGetter : IValueGetter
    {
        public object GetValue(XElement valueElement)
        {            
            // do something to get user id, group membership etc.
            return return Int32.Parse(HttpContext.Current.User.Identity.Name);
        }
    }

An alternative method could be to inherit from TableView and filter directly on the DataTable (which is used internally) with the data from the DB. DataTable has quite good filtering functionality.

Hope this helps. If anything is unclear, just ask :)

- Sune