Changeset 17924

Show
Ignore:
Timestamp:
10/05/08 13:30:56 (2 months ago)
Author:
flack
Message:

show related projects

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/midcom/org.openpsa.relatedto/handler/relatedto.php

    r17922 r17924  
    158158            $this->_request_data['link_other_obj'] =& $linkdata['other_obj']; 
    159159            $this->_request_data['link_other_guid'] =& $linkdata['other_obj']->guid; 
    160             echo "            <a name=\"{$this->_request_data['link_other_guid']}\"></a>\n"; 
    161160            $this->_show_render_line(); 
    162161        } 
     
    193192            $this->_request_data['link_other_obj'] =& $linkdata['other_obj']; 
    194193            $this->_request_data['link_other_guid'] =& $linkdata['other_obj']->guid; 
    195             echo "            <a name=\"{$this->_request_data['link_other_guid']}\"></a>\n"; 
    196194            $this->_show_render_line(); 
    197195        } 
     
    251249                    $this->_show_render_line_task(); 
    252250                } 
    253                 // TODO: Show related projects too 
     251                else 
     252                { 
     253                    $this->_show_render_line_project(); 
     254                } 
    254255                break; 
    255256            case is_a($this->_request_data['link_other_obj'], 'org_openpsa_documents_document'): 
     
    558559        { 
    559560            //Calendar node found, render a better view 
    560             $event_url = "{$cal_node[MIDCOM_NAV_FULLURL]}event/{$event->guid}"; 
     561            $event_url = "{$cal_node[MIDCOM_NAV_FULLURL]}event/{$event->guid}/"; 
    561562            $event_js = org_openpsa_calendar_interface::calendar_editevent_js($event->guid, $cal_node); 
    562563            echo "                <span class=\"title\"><a href=\"{$event_url}\" onclick=\"{$event_js}\" target=\"event_{$event->guid}\">{$event->title}</a></span>\n"; 
     
    627628        if (!empty($proj_node)) 
    628629        { 
    629             $task_url = "{$proj_node[MIDCOM_NAV_FULLURL]}task/{$task->guid}"; 
     630            $task_url = "{$proj_node[MIDCOM_NAV_FULLURL]}task/{$task->guid}/"; 
    630631            echo "                <span class=\"title\"><a href=\"{$task_url}\" target=\"task_{$task->guid}\">{$task->title}</a></span>\n"; 
    631632            echo "                <ul class=\"metadata\">\n"; 
     
    662663 
    663664    /** 
     665     * Renders a project line 
     666     * 
     667     * See the _show_render documentation for details about styling 
     668     */ 
     669    function _show_render_line_project() 
     670    { 
     671        //Make sure we have the calendar classes available 
     672        $_MIDCOM->componentloader->load_graceful('org.openpsa.projects'); 
     673        //Fallback to default renderer if not 
     674        if (!class_exists('org_openpsa_projects_project')) 
     675        { 
     676            return $this->_show_render_line_default(); 
     677        } 
     678        $project = new org_openpsa_projects_project($this->_request_data['link_other_obj']->guid); 
     679        if (!is_object($project)) 
     680        { 
     681            //probably ACL prevents us from seeing anything about it 
     682            return; 
     683        } 
     684        echo "            <li class=\"task\" id=\"org_openpsa_relatedto_line_{$this->_request_data['link_obj']->guid}\">\n"; 
     685 
     686        $proj_node = false; 
     687        if (!array_key_exists('org_openpsa_relatedto_render_line_event_projnode', $GLOBALS)) 
     688        { 
     689            $GLOBALS['org_openpsa_relatedto_render_line_event_projnode'] = midcom_helper_find_node_by_component('org.openpsa.projects'); 
     690        } 
     691        $proj_node =& $GLOBALS['org_openpsa_relatedto_render_line_event_projnode']; 
     692        if (!empty($proj_node)) 
     693        { 
     694            $project_url = "{$proj_node[MIDCOM_NAV_FULLURL]}project/{$project->guid}/"; 
     695            echo "                <span class=\"title\"><a href=\"{$project_url}\" target=\"project_{$project->guid}\">{$project->title}</a></span>\n"; 
     696            echo "                <ul class=\"metadata\">\n"; 
     697 
     698            // Deadline 
     699            echo "                    <li>" . $_MIDCOM->i18n->get_string('deadline', 'org.openpsa.projects') . ": " . strftime('%x', $project->end) . "</li>"; 
     700 
     701            // Resources 
     702            echo "                    <li>" . $_MIDCOM->i18n->get_string('resources', 'org.openpsa.projects') . ": "; 
     703            foreach ($project->resources as $resource_id => $confirmed) 
     704            { 
     705                $resource = new midcom_db_person($resource_id); 
     706                $resource_card = new org_openpsa_contactwidget($resource); 
     707                echo $resource_card->show_inline() . " "; 
     708            } 
     709            echo "                    </li>\n"; 
     710            echo "                </ul>\n"; 
     711            echo "                <div id=\"org_openpsa_relatedto_details_{$project->guid}\" class=\"details hidden\" style=\"display: none;\">\n"; 
     712            echo "                </div>\n"; 
     713            //TODO: necessary JS stuff to load details (which should in turn include the tasks own relatedtos) via AHAH 
     714        } 
     715        else 
     716        { 
     717            echo "                <span class=\"title\">{$project->title}</span>\n"; 
     718            echo "                <div id=\"org_openpsa_relatedto_details_{$project->guid}\" class=\"details hidden\" style=\"display: none;\">\n"; 
     719            //TODO: Output some details ? 
     720            echo "                </div>\n"; 
     721            //TODO: necessary JS stuff to display/hide the div here 
     722        } 
     723 
     724        $this->_show_render_line_controls(); 
     725        echo "            </li>\n"; 
     726    } 
     727 
     728 
     729    /** 
    664730     * Renders a sales project line 
    665731     * 
     
    691757        if (!empty($sales_node)) 
    692758        { 
    693             $sales_url = "{$sales_node[MIDCOM_NAV_FULLURL]}salesproject/{$salesproject->guid}"; 
     759            $sales_url = "{$sales_node[MIDCOM_NAV_FULLURL]}salesproject/{$salesproject->guid}/"; 
    694760            echo "                <span class=\"title\"><a href=\"{$sales_url}\" target=\"task_{$salesproject->guid}\">{$salesproject->title}</a></span>\n"; 
    695761            echo "                <ul class=\"metadata\">\n"; 
     
    759825        if (!empty($invoices_node)) 
    760826        { 
    761             $invoice_url = "{$invoices_node[MIDCOM_NAV_FULLURL]}invoice/{$invoice->guid}"; 
     827            $invoice_url = "{$invoices_node[MIDCOM_NAV_FULLURL]}invoice/{$invoice->guid}/"; 
    762828            echo "                <span class=\"title\"><a href=\"{$invoice_url}\" target=\"task_{$invoice->guid}\">".$_MIDCOM->i18n->get_string('invoice', 'org.openpsa.invoices')." {$invoice->invoiceNumber}</a></span>\n"; 
    763829            echo "                <ul class=\"metadata\">\n";