Changeset 17937

Show
Ignore:
Timestamp:
10/05/08 22:06:04 (2 months ago)
Author:
flack
Message:

convert (most of) mypage to use structure cache

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/midcom/org.openpsa.core/structure.php

    r17936 r17937  
    2525    ( 
    2626        'org.openpsa.contacts' => 'org.openpsa.contacts', 
     27        'org.openpsa.calendar' => 'org.openpsa.calendar', 
    2728        'org.openpsa.invoices' => 'org.openpsa.invoices', 
    2829        'org.openpsa.projects' => 'org.openpsa.projects', 
     
    6364            $last = array_pop($parts); 
    6465            $node_guid = 'false'; 
    65             $node_url = 'false'; 
     66            $node_full_url = 'false'; 
    6667            if (is_array($node)) 
    6768            { 
    6869              $node_guid = "'" . $node[MIDCOM_NAV_OBJECT]->guid . "'"; 
    69               $node_url = "'" . $node[MIDCOM_NAV_FULLURL] . "'"; 
     70              $node_full_url = "'" . $node[MIDCOM_NAV_FULLURL] . "'"; 
     71              $node_relative_url = "'" . $node[MIDCOM_NAV_RELATIVEURL] . "'"; 
    7072            } 
    7173            $this->set_config_value($last . '_guid', $node_guid); 
    72             $this->set_config_value($last . '_url', $node_url); 
    73         } 
    74         //set auto_init to true to write only once 
     74            $this->set_config_value($last . '_full_url', $node_full_url); 
     75            $this->set_config_value($last . '_relative_url', $node_relative_url); 
     76        } 
     77        //set auto_init to true to write only once 
    7578        $this->set_config_value('auto_init', 'false'); 
    7679        $this->snippet->update(); 
     
    152155 
    153156    /** 
    154      * Helper function to retrieve the absolute URL for the first topic of a given component 
     157     * Helper function to retrieve the full URL for the first topic of a given component 
    155158     * 
    156159     * @param string $component the component to look for  
    157      * @return mixed the component URL or false 
    158      */ 
    159     function get_node_url($component) 
     160     * @return mixed The component URL or false 
     161     */ 
     162    function get_node_full_url($component) 
    160163    { 
    161164        if (!array_key_exists($component, $this->components)) 
     
    165168        $parts = explode('.', $component); 
    166169        $last = array_pop($parts); 
    167         return $this->_config->get($last . '_url'); 
    168     } 
    169  
     170        return $this->_config->get($last . '_full_url'); 
     171    } 
     172 
     173    /** 
     174     * Helper function to retrieve the relative URL for the first topic of a given component 
     175     * 
     176     * @param string $component The component to look for  
     177     * @return mixed the component URL or false 
     178     */ 
     179    function get_node_full_url($component) 
     180    { 
     181        if (!array_key_exists($component, $this->components)) 
     182        { 
     183            return false; 
     184        } 
     185        $parts = explode('.', $component); 
     186        $last = array_pop($parts); 
     187        return $this->_config->get($last . '_relative_url'); 
     188    } 
     189     
    170190    /** 
    171191     * Helper function to retrieve the GUID for the first topic of a given component 
  • trunk/midcom/org.openpsa.invoices/handler/list.php

    r17934 r17937  
    2424        // Locate Contacts node for linking 
    2525        $structure = new org_openpsa_core_structure(); 
    26         $this->_request_data['contacts_url'] = $structure->get_node_url('org.openpsa.contacts'); 
     26        $this->_request_data['contacts_url'] = $structure->get_node_full_url('org.openpsa.contacts'); 
    2727    } 
    2828 
  • trunk/midcom/org.openpsa.mypage/handler/today.php

    r17350 r17937  
    173173    function _show_today($handler_id, &$data) 
    174174    { 
    175         $data['calendar_node'] = midcom_helper_find_node_by_component('org.openpsa.calendar'); 
    176         $data['projects_node'] = midcom_helper_find_node_by_component('org.openpsa.projects'); 
    177         $data['wiki_node'] = midcom_helper_find_node_by_component('net.nemein.wiki'); 
     175        $structure = new org_openpsa_core_structure(); 
     176        $data['calendar_url'] = $structure->get_node_relative_url('org.openpsa.calendar'); 
     177        $data['projects_url'] = $structure->get_node_full_url('org.openpsa.projects'); 
     178        $data['wiki_url'] = $structure->get_node_relative_url('net.nemein.wiki'); 
    178179 
    179180        midcom_show_style('show-today'); 
  • trunk/midcom/org.openpsa.mypage/handler/weekreview.php

    r17917 r17937  
    281281    function _show_review($handler_id, &$data) 
    282282    { 
     283        $structure = new org_openpsa_core_structure(); 
    283284        $data['calendar_node'] = midcom_helper_find_node_by_component('org.openpsa.calendar'); 
    284         $data['projects_node'] = midcom_helper_find_node_by_component('org.openpsa.projects'); 
     285        $data['projects_url'] = $structure->get_node_full_url('org.openpsa.projects'); 
    285286 
    286287        $week_hours_invoiceable = 0; 
  • trunk/midcom/org.openpsa.mypage/style/show-today.php

    r17819 r17937  
    77    <?php 
    88     
    9     if ($data['calendar_node']) 
     9    if ($data['calendar_url']) 
    1010    { 
    1111        ?> 
    1212        <div class="agenda"> 
    1313            <?php 
    14             $_MIDCOM->dynamic_load($data['calendar_node'][MIDCOM_NAV_RELATIVEURL].'agenda/day/'.date('Y-m-d', $data['requested_time'])); 
     14            $_MIDCOM->dynamic_load($data['calendar_url'] . 'agenda/day/' . date('Y-m-d', $data['requested_time'])); 
    1515            ?> 
    1616        </div> 
     
    1818    } 
    1919     
    20     if ($data['wiki_node']) 
     20    if ($data['wiki_url']) 
    2121    { 
    2222        ?> 
    2323        <div class="wiki"> 
    2424            <?php 
    25             $_MIDCOM->dynamic_load($data['wiki_node'][MIDCOM_NAV_RELATIVEURL].'latest/'); 
     25            $_MIDCOM->dynamic_load($data['wiki_url'] . 'latest/'); 
    2626            ?> 
    2727        </div> 
     
    3333<div class="sidebar"> 
    3434    <?php 
    35     if ($data['projects_node']) 
     35    if ($data['projects_url']) 
    3636    { 
    3737        $tasks = org_openpsa_projects_task_resource::get_resource_tasks('guid'); 
     
    4242            <div class="org_openpsa_projects_workingon"> 
    4343                <h2><?php echo $_MIDCOM->i18n->get_string('now working on', 'org.openpsa.projects'); ?></h2> 
    44                 <form method="post" action="<?php echo $data['projects_node'][MIDCOM_NAV_FULLURL] . 'workingon/set/'; ?>"> 
     44                <form method="post" action="<?php echo $data['projects_url'] . 'workingon/set/'; ?>"> 
    4545                    <input type="hidden" name="url" value="&(prefix);" /> 
    4646                    <select name="task" onchange="this.form.submit();"> 
  • trunk/midcom/org.openpsa.mypage/style/weekreview-day-item-event.php

    r5048 r17937  
    1212        <?php 
    1313        $event_label = $event->title; 
    14         if ($data['calendar_node']) 
     14        if ($data['calendar_url']) 
    1515        { 
    1616            $event_url = "{$data['calendar_node'][MIDCOM_NAV_FULLURL]}event/{$event->guid}"; 
  • trunk/midcom/org.openpsa.mypage/style/weekreview-day-item-hour-report.php

    r5048 r17937  
    1313        <?php 
    1414        $task_label = $task->title; 
    15         if ($data['projects_node']) 
     15        if ($data['projects_url']) 
    1616        { 
    17             $task_label = "<a href=\"{$data['projects_node'][MIDCOM_NAV_FULLURL]}task/{$task->guid}\">{$task_label}</a>"; 
     17            $task_label = "<a href=\"{$data['projects_url']}task/{$task->guid}\">{$task_label}</a>"; 
    1818        } 
    1919        echo "{$task_label}, {$hour_report->description}: {$hour_report->hours}h"; 
  • trunk/midcom/org.openpsa.mypage/style/weekreview-day-item-task-status.php

    r5048 r17937  
    1313        <?php 
    1414        $task_label = $task->title; 
    15         if ($data['projects_node']) 
     15        if ($data['projects_url']) 
    1616        { 
    17             $task_label = "<a href=\"{$data['projects_node'][MIDCOM_NAV_FULLURL]}task/{$task->guid}\">{$task_label}</a>"; 
     17            $task_label = "<a href=\"{$data['projects_url']}task/{$task->guid}\">{$task_label}</a>"; 
    1818        } 
    1919