Forum OpenACS Development: Any good reason content_item__move function only allows folders as parent?

Can anyone think of a good reason why content_item__move restricts moving to only a cr_folder? The content repository always supported any cr_item or even any acs_object as the parent item.
I'd favour getting rid of that restriction: had to work around it already on some occassions.

i think, it would be a good idea to remove this restriction. However, one has to deal with at least the following aspects:

  • folders have registered content-types to restrict the types of their children (cr_folder_type_map), other content-items/acs-objects do not have such a map. Not sure, how important the restriction is. i could live without it.
  • when the restriction is lifted, essentially, every move operation is potentially a move operation of a tree (like content_folder.move). However, since it is already possible to create children under arbitrary items, i would not be surprised, if there would be already some problems in the code (like operations on looping structures).
  • a content-item.copy becomes more or less a content-foder.copy
  • the content_folder.is_sub_folder logic has to be extended

Most likely, there will show up more tricky issues when one is working on an implementation.

Essentially, i would think that all logic should be moved from content-folder.* into content_item.* operations, content_folder.* could be more or less stubs for compatibility. I am not sure about the necessity for allowing/supporting arbitrary acs-object-ids as parent-ids, arbitrary cr-items definitely would make sense.

Gustaf,

"a content-item.copy becomes more or less a content-foder.copy"

Yes, and (potentially) copying any object could be (like) copying a folder as well.

What does it mean for an arbitrary acs_object which is not another item or a folder to have content_item children?

What does it mean, for example, for a content_revision to have content_item children?

It means you don't have to have a separate table to define a relationship between the object and the cr_item.

For a user, that might mean the user's file-storage root folder, and for a revision it could be a thumbnail image of that revision (which we do here).

This allows you to quickly get any items you need for an object in the context of a package, such as file-storage where you need to know which files to show for a specific user, or in a forum where you need to list available attachments.

-- NJL

Jim,

The content repository doesn't define any meaning to the parent_id relationship. The meaning is defined by the applications that use the content repository.

There isn't any restriction or problem to having a content_revision as a parent_id, although it could be confusing if the semantics were not documented in the package that used the content repository in that way.

OIC, no, I didn't mean what will it mean for the future of openacs, I meant, what do those relations mean/signify?

but as long as we're talking future of openacs, why have folders if any object can play that role?

or at least, why have folders other than "people are already using folders, so it would create a problem for those users if they were suddenly gone"?
Folders as parents serve a completely different role than other objects as parents. A folder is just a way for a user to categorize objects, but an object parent would indicate other roles depending on the package, such as getting all the items that belong to a user quickly instead of having to determine the root file-storage folder for a user, then getting items.

-- NJL