Skip to:
Content
Pages
Categories
Search
Top
Bottom

bpContents 0.1X Core Code – Dev Sneak Peek

  • Avatar of Burt Adsit
    Burt Adsit
    Participant

    @burtadsit

    bpContents is a BuddyPress sitewide and external content aggregation and categorization plugin. It allows any type of content to be organized into a hierarchy. Think of it as a virtual file system implemented with SQL tables and relationships. Each path in the tree can have it’s own set of categories and tags.

    These paths in the tree might be:

    /members/waldowarp/profile

    /members/burtadsit/profile

    Those two paths represent two containers for content. In those containers we can build an entire collection of categories, tags and content items. The tree would look like this with both Waldo and I having tags for ‘transformers’ and ‘restaurants’.

    site

    –members

    —-waldowarp


    profile


    transformers


    restaurants

    —-burtadsit


    profile


    transformers


    restaurants

    I wanted to put some documentation for this project out there. That’s what is here:

    The core of this project is undergoing testing now.

    See here: http://code.ourcommoninterest.org/2009/05/02/bpcontents-01-core-code-dev-sneak-peek/ for the latest zip

Viewing 22 replies - 1 through 22 (of 22 total)
  • Avatar of Timothy West
    trcwest
    Participant

    @trcwest

    sounds pretty sweet.. when its all working ill try impliment it.. cheers

    Will spend some time this weekend to read over this.

    Avatar of Jeff Sayre
    Jeff Sayre
    Participant

    @jeffsayre

    Burt, like Andy, I too will look at this over the next several days.

    My immediate reaction–okay, we’ve talked a little about this in IRC :) –is that this component will be a great tool for media management. I’d love to see BP’s photo album component evolve into an overall media component. Your component will go a long way into helping make that a reality.

    My more detailed thoughts and comments will follow!

    Avatar of Burt Adsit
    Burt Adsit
    Participant

    @burtadsit

    For those following along from home, the OCI_Item_Listener class will get derived classes other than the current OCI_Item_Blog_Post_Listener. That monitors blog post create/updated/delete activities in wp and dispatches item create/update/delete actions to any container in the tree that cares to listen for such things.

    I\’ve got an OCI_Item_XMLRPC_Listener class half built. Along with that I\’ll release a OCI_Item_RSS_Listener class.

    I\’m testing the OCI_Item_Blog_Post_Listener/OCI_Item_Listener classes now. That\’s the only thing holding back the release of the core code right now. I made some changes in the code when I was doing that \’Burt is talking to himself again\” thing that I call docs. Guess what? I broke things.

    Avatar of Burt Adsit
    Burt Adsit
    Participant

    @burtadsit

    The OCI_Item_RSS_Listener class will obviously only handle *new* content items coming in from any RSS feed.

    * A site designer could hook up a variety of feeds and have them go to a particular container like /feeds.

    * A group admin could hook up group specific feeds to automatically create items in the group tree.

    * I could have feeds that I’m interested in go to /members/burtadsit/profile

    The OCI_Item_XMLRPC_Listener class will respond to all the usual suspect actions – create/update/delete from an external source. The requirement will be that the external site be running a subset of the bpContents plugin. An external site can run all the normal listener derived classes like OCI_Item_Blog_Post_Listener and instead of stuffing the OCI_Items into a local content tree it packages the items up and sends them off to a remote site.

    Avatar of Burt Adsit
    Burt Adsit
    Participant

    @burtadsit

    I’ve posted the 0.1 alpha core code here: http://ourcommoninterest.org/downloads/bpcontents.zip

    Avatar of Hyrxx
    hyrxx
    Participant

    @hyrxx

    @jeff – i plan on making an albums component for my site for audio video and images (ie the user can mix content into ‘media albums’)

    so it will be interesting to see how this evolves

    i would like to be able to tag everything on my site ie members photos blogs groups etc so maybe this will help

    Avatar of Nicola Greco
    nicolagreco
    Participant

    @nicolagreco

    That’s too cool Burt!

    Avatar of Burt Adsit
    Burt Adsit
    Participant

    @burtadsit

    New version bpContents http://ourcommoninterest.org/downloads/bpcontents011.zip

    Changes 0.11

    - Reworked the OCI_Container class to be easier to use and less confusing.

    - Added explicit support for ‘tags’ as a container type OCI_TAG

    - Added a new table ‘oci_tree_meta’. Node meta table. Visit the back end as site admin to add the new table.

    Three new functions for node class: get_node_meta(), update_node_meta(), delete_node_meta(). Now any node can have meta data associated with it. Planning on using this for things like item sequencing for user defined sequencing of items within a tag. Item counts in tags for tag cloud generation. Etc…

    - Started to split up functions and classes: new file bpcontents-functions.php

    Avatar of John James Jacoby
    John James Jacoby
    Keymaster

    @johnjamesjacoby

    Checking it out now!

    Avatar of Burt Adsit
    Burt Adsit
    Participant

    @burtadsit

    I love it when a project finally starts to come together and I can add features without worrying too much about “Is it the new code or is the old code not working”. Things are beginning to accelerate.

    http://ourcommoninterest.org/downloads/bpcontents012.zip

    Changes 0.12

    - Added OCI_Term, OCI_Item delete rec prohibition to not allow deletion of a term or item if instances exist in the tree.

    - Added term, item delete record with deletion of all instances as well: $this->delete_instances_also()

    - Changed OCI_Item_Listener to delete the item and all instances on delete_item()

    - Removed the overly paranoid and incorrect assumption that mptt get() ops requires a table lock. Doing a table write lock when changing the table suspends all threads until that op is complete. Duh.

    - Added OCI_Walker_Container class derived from wp’s tree Walker class. Replaces the print_tree() guts with something useful and configurable down the road.

    - Added OCI_Container::print_tag_cloud() , generate_tag_cloud() both blatantly stolen from wp.

    Avatar of Burt Adsit
    Burt Adsit
    Participant

    @burtadsit

    http://ourcommoninterest.org/downloads/bpcontents013.zip

    Changes 0.13

    - Added OCI_Container::delete() to delete the current container and all it’s children

    - Removed OCI_Tree::tree_get_containers($node), added tree_get_children($node, $type)

    - Changing thing to remove php 5 dependencies.

    - Made all class methods static where possible, yes Andy it’s better this way

    - Added OCI_Template_Items class for container template loops in themes, no pretty bells and whistles yet. I cut out all non-essential things to understand it better.

    - Added a few oci_get_the_item_xxx(), oci_the_item_xxx() template tag functions to test the template class.

    - Added a oci-test-template.php file for testing the template class and template tags. I drop it into the bp home theme dir and create a wp page using that as a template for the page. It’ll show up as “OCI Test Template” in the wp back end.

    - To use the template you need to point the loop start tag to an existing container like “/recent” if you are testing using blog posts.

    <?php if ( oci_has_items(“/recent”)) : ?>

    Point it to where ever you are sending blog posts. The following in oci_contents_setup_globals() sends blog posts from any blog to /recent and /other/place

    $recent = new OCI_Container(“/recent”, true);

    $other = new OCI_Container(“/other/place”, true);

    $oci->listeners->blog_posts = new OCI_Item_Blog_Post_Listener();

    $oci->listeners->blog_posts->add_destination(“/recent”);

    $oci->listeners->blog_posts->add_destination(“/other/place”);

    So you can change the loop start tag to:

    <?php if ( oci_has_items(“/other/place”)) : ?>

    Then browse to your new test template page to view the results instead of using oci_test_print_tree.php to just dump the tree.

    Avatar of Burt Adsit
    Burt Adsit
    Participant

    @burtadsit

    Changes 0.14

    - Fixed terms coming in from blog posts with only ‘names’ and not ‘slugs’ also. Propagating that fact down to term creation in bpcontents.

    - Added getting terms by array of ids in OCI_Term with one query like getting an array of items in OCI_Items

    - Removed the method OCI_Container::get_containers() as containers should manage tags and items only. Makes things simpler. Use the tree functions for container management and info.

    - Added OCI_Container::get() and get_by_meta() to allow quick path lookups of node id from node meta to eliminate mult queries when parsing the path

    - Nobody reads this stuff. I like cats more than I like dogs. Cats fend for themselves and enjoy killing small animals. I do too.

    - Added OCI_Item_User class. This allows users to be treated like content items. Bagged, tagged and categorized.

    - Created bpContents as a member theme component. Add a crude component function to the member theme. Same functionality as the oci-test-template.php. Just dumps the /recent container.

    - Testing the OCI_Item_User class by creating new user items, based on the content author, for each new content item created.

    - Reverted back to the oci-content directory structure. Still distributing as bpcontents.zip

    http://ourcommoninterest.org/downloads/bpcontents014.zip

    Avatar of Burt Adsit
    Burt Adsit
    Participant

    @burtadsit

    http://code.ourcommoninterest.org/2009/05/02/bpcontents-01-core-code-dev-sneak-peek/

    Changes 0.15

    - Added oci_the_tag_cloud() template tag. Accepts the usual wp tag cloud args.

    - Added OCI_Item_Group as derived OCI_Item class to enable treating groups as content items. For bagging and tagging.

    - Nobody reads this stuff. Small animals are best served raw.

    - Added OCI_Item get_from_source() which instantiates an object of type $this->item_type and returns the original source record

    and get_source_obj() which is a $this->item_type object factory.

    - Added an $args interface to containers. Typical wp args string ‘path=xxx&create=true’ type stuff.

    - Dropped OCI_Container::print_tree and added a wp_list_categories like, get_container_tree() with all the wp_list_categories() args.

    - Added url parsing interface for containers. Responds to urls for tree node selection. In other words the tag cloud works in the profile.

    http://ourcommoninterest.org/downloads/bpcontents015.zip

    I like mine medium-rare.

    Avatar of Burt Adsit
    Burt Adsit
    Participant

    @burtadsit

    lol

    Well. Somebody does read those things.

    Avatar of Burt Adsit
    Burt Adsit
    Participant

    @burtadsit

    Changes 0.16

    - Dropped some irrelevent indexes in a few tables. ** Drop all your tables and let them be recreated again. **

    - Added profile create manual item UI. Title, Link, Description, Tags. Goes to the user’s profile container.

    http://code.ourcommoninterest.org/2009/05/02/bpcontents-01-core-code-dev-sneak-peek/

    Avatar of Burt Adsit
    Burt Adsit
    Participant

    @burtadsit

    Changes 0.17

    - Added a content browsing thoughout the entire tree. Manual item and container creation. Tree path breadcrumbs, container cloud.

    http://code.ourcommoninterest.org/2009/05/02/bpcontents-01-core-code-dev-sneak-peek/

    Avatar of Burt Adsit
    Burt Adsit
    Participant

    @burtadsit

    Changes 0.18

    - Pulled breadcrumbs and tag cloud out of the OCI_Container class. Made them independent template tags.

    - Dropped the use of the OCI_TAG container type. Everything is either a container or an item. Tags and Categories can be simulated with out having them be explicit node types.

    - Forcing containers used in templates to have a base path of some sort based on the context of the template. Profile containers would be /members/user. Group containers would be /groups/groupslug.

    - Eliminated the url action vars to have a full path. /tag is used instead of /members/user/tag

    - Containers, clouds and crumbs respond to two parts of the url. The ‘context’ part and the ‘parameter’ part

    Ex: ‘http://mysite.org/members/user/contents/browse/tag1/tag2′

    ‘http://mysite.org’ is tossed by bp as irrelevent trash. Which it is.

    ‘/members/user’ is the context found with oci_get_the_context() which returns a path string

    ‘/tag1/tag2′ are the parameters found with oci_get_the_context_parameters() which returns a path string

    ‘contents’ in bp is the $bp->current_component

    ‘browse’ is the $bp->current_action

    By combining ‘context’ and ‘parameters’ we get the full container path in the tree ‘/members/user/tag1/tag2′.

    - Fixed the new item and browse templates so that the breadcrumbs and cloud track properly.

    - Fixed the new item ‘new container’ and ‘new item’ forms submit and redisplay, so that the path currently being viewed is redisplayed again.

    - Added an ‘action’ parameter to the crumbs and cloud args list so that urls can be built properly based on the form they are in or where we want urls to link to.

    ‘http://mysite.org/members/user/contents/ *browse* /tag1/tag2′

    In the url above *browse* is the action that will be triggered in the component ‘contents’. It allows the next menu item to be chosen by the template when the cloud builds the tag links.

    http://code.ourcommoninterest.org/2009/05/02/bpcontents-01-core-code-dev-sneak-peek/

    Avatar of Burt Adsit
    Burt Adsit
    Participant

    @burtadsit

    Changes 0.19

    - Added template tag oci_the_tree() by pulling the container tree function out and making it a standalone template tag.

    The index.php template is setup to force the tree to stay in context, displaying the current context always.

    It will track the url params if you change the:

    oci_the_tree(‘path=’ . oci_get_the_context() . ‘&show_items=0′)

    call to be:

    oci_the_tree(‘show_items=0′)

    - Removed print_tree() and get_container_tree() from OCI_Container

    - oci_test_print_tree.php is down to using a template tag to dump the tree

    http://code.ourcommoninterest.org/2009/05/02/bpcontents-01-core-code-dev-sneak-peek/

    Avatar of Burt Adsit
    Burt Adsit
    Participant

    @burtadsit

    Yes I know it’s been several days since an update to bp contents. The core is working and I’m struggling with getting this up and running in the member theme properly.

    Avatar of Burt Adsit
    Burt Adsit
    Participant

    @burtadsit

    Yes I know it’s been several days since an update to bp contents. The core is working and I’m struggling with getting this up and running in the member theme properly.

Viewing 22 replies - 1 through 22 (of 22 total)

You must be logged in to reply to this topic.