Changeset 26336


Ignore:
Timestamp:
06/12/10 20:24:00 (7 years ago)
Author:
rambo
Message:

initial CRUD handler and styles plus some schema changes

Location:
branches/ragnaroek/midcom/net.hurttakallio.library
Files:
10 added
4 edited

Legend:

Unmodified
Added
Removed
  • branches/ragnaroek/midcom/net.hurttakallio.library/config/mgdschema.xml

    r26335 r26336  
    5555        <property name="asin" type="string" dbtype="varchar(10)" index="true">
    5656            <description>
    57                 ASIN (http://en.wikipedia.org/wiki/Amazon_Standard_Identification_Number). Indexed.
     57                ASIN (http://en.wikipedia.org/wiki/Amazon_Standard_Identification_Number). Limited to 10 characters. Indexed.
     58            </description>
     59        </property>
     60
     61        <property name="ddc" type="string" dbtype="varchar(10)" index="true">
     62            <description>
     63                Dewey Decimal Classification. Limited to 10 characters. Indexed.
     64            </description>
     65        </property>
     66
     67        <property name="location" type="string" dbtype="varchar(25)" index="true">
     68            <description>
     69                Generic location identifier (in case one does not organize everything by DDC :).
     70
     71                Limited to 25 characters. Indexed.
    5872            </description>
    5973        </property>
     
    6175        <property name="extcode2" type="string" dbtype="varchar(15)" index="true">
    6276            <description>
    63                 External service identifier. Limited to 15 characters which should be plenty. Indexed.
     77                Generic External service identifier. Limited to 15 characters which should be plenty. Indexed.
    6478            </description>
    6579        </property>
     
    6781        <property name="extcode3" type="string" dbtype="varchar(15)" index="true">
    6882            <description>
    69                 External service identifier, third slot. Limited to 15 characters which should be plenty. Indexed.
     83                Generic External service identifier, another slot. Limited to 15 characters which should be plenty. Indexed.
    7084            </description>
    7185        </property>
  • branches/ragnaroek/midcom/net.hurttakallio.library/config/schemadb_base.inc

    r26332 r26336  
    4646            'widget' => 'image',
    4747        ),
     48        'published' => array
     49        (
     50            'title' => 'published',
     51            'storage' => 'metadata',
     52            'type' => 'date',
     53            'type_config' => array
     54            (
     55                // MidCOM DBA converts dates to/from unixtimes to MgdSchema's ISO format
     56                // Which bad for dates before the epoch but we'll deal with that later if needed
     57                'storage_type' => 'UNIXTIME',
     58            ),
     59            'widget' => 'jsdate',
     60        ),
    4861        'description' => array
    4962        (
     
    6174            'title' => 'ASIN (Amazon code)',
    6275            'storage' => 'asin',
     76            'required' => false,
     77            'type' => 'text',
     78            'widget' => 'text',
     79        ),
     80        'location' => array
     81        (
     82            'title' => 'storage location',
     83            'storage' => 'location',
    6384            'required' => false,
    6485            'type' => 'text',
  • branches/ragnaroek/midcom/net.hurttakallio.library/item.php

    r26332 r26336  
    8282        $img_url = "{$GLOBALS['midcom_config']['midcom_site_url']}midcom-serveattachmentguid-{$att->guid}/" . rawurlencode($att->name);
    8383        $img_size = $att->parameter('midcom.helper.datamanager2.type.blobs', 'size_line');
    84         $img_tag = "<img src=\"{$img_url}\" class=\"photo thumbnail\" {$img_size} />";
     84        $img_tag = "<img src=\"{$img_url}\" class=\"image thumbnail\" {$img_size} />";
    8585        $this->imgthumbnail_html = "<div class=\"net_hurttakallio_library_item_thumbnail\">\n    {$img_tag}\n    <span class=\"title\">{$this->title}</span>\n</div>";
    8686    }
  • branches/ragnaroek/midcom/net.hurttakallio.library/viewer.php

    r26332 r26336  
    4444            'handler' => array('net_hurttakallio_library_handler_index', 'index'),
    4545        );
     46
     47        // Handle /item/xxx
     48        $this->_request_switch['view-item'] = array
     49        (
     50            'handler' => array('net_hurttakallio_library_handler_item', 'read'),
     51            'fixed_args' => array('item'),
     52            'variable_args' => 1,
     53        );
     54
     55        // Handle /item/edit/xxx
     56        $this->_request_switch['edit-item'] = array
     57        (
     58            'handler' => array('net_hurttakallio_library_handler_item', 'update'),
     59            'fixed_args' => array('item', 'edit'),
     60            'variable_args' => 1,
     61        );
     62
     63        // Handle /item/delete/xxx
     64        $this->_request_switch['delete-item'] = array
     65        (
     66            'handler' => array('net_hurttakallio_library_handler_item', 'delete'),
     67            'fixed_args' => array('item', 'delete'),
     68            'variable_args' => 1,
     69        );
     70
     71        // Handle /item/create/<schemaname>
     72        $this->_request_switch['edit-item'] = array
     73        (
     74            'handler' => array('net_hurttakallio_library_handler_item', 'create'),
     75            'fixed_args' => array('item', 'create'),
     76            'variable_args' => 1,
     77        );
     78
     79
    4680    }
    4781
    4882    /**
    49      * Indexes an article.
     83     * Indexes an item.
    5084     *
    5185     * This function is usually called statically from various handlers.
     
    76110        $nav = new midcom_helper_nav();
    77111        $node = $nav->get_node($topic->id);
     112        // FIXME: Use the entities system (TBImplemented) to get author string
    78113        $author = $_MIDCOM->auth->get_user($dm->storage->object->creator);
    79114
     
    83118        $document->topic_url = $node[MIDCOM_NAV_FULLURL];
    84119        $document->read_metadata_from_object($dm->storage->object);
     120        $item =& $dm->storage->object;
     121        // Get just the thumbnail img tag
     122        $thumbnail_tag = preg_replace('%.*(<img.*?/>).*%msi', '\\1', $photo->thumbnail_html);
     123        // Prepend that to first 200 chars of description
     124        $desc_base = strip_tags($item->description);
     125        if (strlen($desc_base) > 200)
     126        {
     127            $abstract = substr($desc_base, 0, 200) . ' ...';
     128        }
     129        else
     130        {
     131            $abstract = $desc_base;
     132        }
     133        $document->abstract = "\n<div class='net_hurttakallio_library_indexed_abstract'>\n    <div class='thumbnail_container'>\n        <a href='{$document->document_url}'>{$thumbnail_tag}</a>\n    </div>\n    {$abstract}\n</div>";
    85134        $indexer->index($document);
    86135    }
     
    101150                    array
    102151                    (
    103                         MIDCOM_TOOLBAR_URL => "create/{$name}/",
     152                        MIDCOM_TOOLBAR_URL => "item/create/{$name}/",
    104153                        MIDCOM_TOOLBAR_LABEL => sprintf
    105154                        (
Note: See TracChangeset for help on using the changeset viewer.