Changeset 11036

Show
Ignore:
Timestamp:
06/26/07 22:59:20 (3 years ago)
Author:
rambo
Message:

Started work on feed creation, the viewer now autogenerates some
request switches it considers likely to be usefull and passes them on
to a dispatcher that will then call corresponding handler to see if we
can get an array of photos.

Making an actual feed from those with feedcreator is next up.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/MidCOM_2_8/org.routamc.photostream/viewer.php

    r10969 r11036  
    329329            ), 
    330330        ); 
     331 
     332        $this->_register_feed_handlers(); 
     333    } 
     334 
     335    function _register_feed_handlers() 
     336    { 
     337        debug_push_class(__CLASS__, __FUNCTION__); 
     338        debug_print_r('$this->_request_switch is now: ', $this->_request_switch); 
     339        debug_add('Start'); 
     340        foreach ($this->_request_switch as $handler_id => $switch_data) 
     341        { 
     342            debug_add("Checking id '{$handler_id}', it has handler class '{$switch_data['handler'][0]}'"); 
     343            if ($switch_data['handler'][0] !== 'org_routamc_photostream_handler_list') 
     344            { 
     345                debug_add('Not interested, next!'); 
     346                // We only care about the list views 
     347                continue; 
     348            } 
     349            $new_id = "feed:{$handler_id}"; 
     350            debug_add("Creating new switch with id '{$new_id}'"); 
     351            // PHP5-TODO: Must be copy-by-value 
     352            $new_switch = $switch_data; 
     353            // switch handler to the feed dispatcher 
     354            $new_switch['handler'] = array('org_routamc_photostream_handler_feed', 'dispatcher'); 
     355            // add a variable arg to end of list for feed type 
     356            if (!isset($new_switch['variable_args'])) 
     357            { 
     358                $new_switch['variable_args'] = 0; 
     359            } 
     360            $new_switch['variable_args']++; 
     361             
     362            /* OTOH the variable_args increment server the same purpose and it's easier to just add rss.xml/atom.xml to the url... 
     363            // Prepend /feed/ to list fixed args 
     364            array_unshift($new_switch['fixed_args'], 'feed'); 
     365            */ 
     366 
     367            // Add the new switch 
     368            debug_print_r("Setting \$this->_request_switch['{$new_id}'] to: ", $new_switch); 
     369            $this->_request_switch[$new_id] = $new_switch; 
     370            unset($new_id, $new_switch); 
     371        } 
     372        debug_add('Done.'); 
     373        debug_print_r('$this->_request_switch is now: ', $this->_request_switch); 
     374        debug_pop(); 
    331375    } 
    332376 
     
    442486        ); 
    443487 
     488        // the feed dispatcher needs this information, it might be available otherwisely but I couldn't find it 
     489        $this->_request_data['request_switch'] =& $this->_request_switch; 
    444490        return true; 
    445491    }