Пример #1
0
function ProjView()
{
    global $PH;
    global $auth;
    require_once confGet('DIR_STREBER') . "render/render_wiki.inc.php";
    ### get current project ###
    $id = getOnePassedId('prj', 'projects_*');
    if ($project = Project::getEditableById($id)) {
        $editable = true;
    } else {
        if ($project = Project::getVisibleById($id)) {
            $editable = false;
        } else {
            $PH->abortWarning(__("invalid project-id"));
            return;
        }
    }
    ### define from-handle ###
    $PH->defineFromHandle(array('prj' => $project->id));
    ## is viewed by user ##
    $project->nowViewedByUser();
    ## next milestone ##
    $next = $project->getNextMilestone();
    $page = new Page();
    $page->crumbs = build_project_crumbs($project);
    $page->options = build_projView_options($project);
    $page->cur_tab = 'projects';
    $page->title = $project->name;
    $page->title_minor = __("Project overview");
    if ($project->status == STATUS_TEMPLATE) {
        $page->type = __("Project Template");
    } else {
        if ($project->status >= STATUS_COMPLETED) {
            $page->type = __("Inactive Project");
        } else {
            $page->type = __("Project", "Page Type");
        }
    }
    ### page functions ###
    if ($project->isPersonVisibleTeamMember($auth->cur_user)) {
        if ($editable) {
            $page->add_function(new PageFunction(array('target' => 'projEdit', 'params' => array('prj' => $project->id), 'icon' => 'edit', 'tooltip' => __('Edit this project'), 'name' => __('Edit project'))));
        }
        /*
        $item = ItemPerson::getAll(array(
            'person'=>$auth->cur_user->id,
            'item'=>$project->id
        ));
        if((!$item) || ($item[0]->is_bookmark == 0)){
            $page->add_function(new PageFunction(array(
                'target'    =>'itemsAsBookmark',
                'params'    =>array('proj'=>$project->id),
                'tooltip'   =>__('Mark this project as bookmark'),
                'name'      =>__('Bookmark'),
            )));
        }
        else{
            $page->add_function(new PageFunction(array(
                'target'    =>'itemsRemoveBookmark',
                'params'    =>array('proj'=>$project->id),
                'tooltip'   =>__('Remove this bookmark'),
                'name'      =>__('Remove Bookmark'),
            )));
        }
        */
        /*
        if($project->state == 1) {
                $page->add_function(new PageFunction(array(
                    'target'=>'projDelete',
                    'params'=>array('prj'=>$project->id),
                    'icon'=>'delete',
                    'tooltip'=>__('Delete this project'),
                    'name'=>__('Delete')
                )));
        }
        */
        #$page->add_function(new PageFunctionGroup(array(
        #    'name'      => __('new')
        #)));
        /*
        $page->add_function(new PageFunction(array(
            'target'    =>'projAddPerson',
            'params'    =>array('prj'=>$project->id),
            'icon'      =>'add',
            'tooltip'   =>__('Add person as team-member to project'),
            'name'      =>__('Team member')
        )));
        */
        if ($project->settings & PROJECT_SETTING_ENABLE_TASKS) {
            $page->add_function(new PageFunction(array('target' => 'taskNew', 'params' => array('prj' => $project->id), 'icon' => 'new', 'tooltip' => __('Create task'), 'name' => __('New task'))));
        }
        if ($project->settings & PROJECT_SETTING_ENABLE_BUGS) {
            $page->add_function(new PageFunction(array('target' => 'taskNewBug', 'params' => array('prj' => $project->id, 'add_issue' => 1), 'icon' => 'new', 'tooltip' => __('Create task with issue-report'), 'name' => __('New bug'))));
        }
        $page->add_function(new PageFunction(array('target' => 'taskNewDocu', 'params' => array('prj' => $project->id), 'icon' => 'new', 'tooltip' => __('Create wiki documentation page or start discussion topic'), 'name' => __('New topic'))));
        if ($project->settings & PROJECT_SETTING_ENABLE_EFFORTS && $auth->cur_user->settings & USER_SETTING_ENABLE_EFFORTS) {
            $page->add_function(new PageFunction(array('target' => 'effortNew', 'params' => array('prj' => $project->id), 'icon' => 'loghours', 'tooltip' => __('Book effort for this project'), 'name' => __('Book effort'))));
        }
    }
    $url = $PH->getUrl("projViewAsRSS", array('prj' => $project->id));
    $page->extra_header_html .= '<link rel="alternate" type="application/rss+xml" title="' . asHtml($project->name) . ' ' . __("News") . '"' . ' href="' . $url . '" />';
    ### render title ###
    echo new PageHeader();
    echo new PageContentOpen_Columns();
    measure_stop('current milestone');
    require_once confGet('DIR_STREBER') . 'blocks/current_milestone_block.inc.php';
    $block = new CurrentMilestoneBlock($project);
    $block->render();
    measure_stop('current milestone');
    measure_start('team');
    require_once confGet('DIR_STREBER') . 'lists/list_docustructure.inc.php';
    if (Task::getDocuTasks($project->id, 0)) {
        $list = new Block_DocuNavigation(array('project_id' => $project->id));
        $list->print_all();
    }
    #--- list team -----------------------------------------------------------
    /*
    {
    
        $list= new ListBlock_projectTeam();
        $list->title= __('Team members');
        $list->show_icons=true;
        $list->active_block_function = 'list';
        $list->print_automatic($project);
    }
    measure_stop('team');
    */
    echo new PageContentNextCol();
    echo "<div class=description>";
    echo wikifieldAsHtml($project, 'description', array('empty_text' => "[quote]" . __("This project does not have any text yet.\nDoubleclick here to add some.") . "[/quote]"));
    echo "</div>";
    #--- news -----------------------------------------------------------
    if ($project->settings & PROJECT_SETTING_ENABLE_NEWS) {
        require_once confGet('DIR_STREBER') . './blocks/project_news_block.inc.php';
        print new ProjectNewsBlock($project);
    }
    require_once confGet('DIR_STREBER') . './lists/list_recentchanges.inc.php';
    printRecentChanges(array($project), false);
    /*
    measure_start('changes');
    {
        require_once(confGet('DIR_STREBER') . './lists/list_changes.inc.php');
    
        $list= new ListBlock_changes();
        $list->query_options['date_min']= $auth->cur_user->last_logout;
        $list->query_options['not_modified_by']= $auth->cur_user->id;
        $list->query_options['project']= $project->id;
        //$list->print_automatic($project);
        $list->print_automatic();
    }
    measure_stop('changes');
    */
    echo "<br><br>";
    # @@@ hack for firefox overflow problems
    ### HACKING: 'add new task'-field ###
    $PH->go_submit = 'taskNew';
    echo '<input type="hidden" name="prj" value="' . $project->id . '">';
    #$rss_url = confGet('SELF_PROTOCOL').'://'.confGet('SELF_URL');
    #$rss_url = str_replace("index.php", "rss/", $rss_url);
    #$prj_id  = $this->page->options[0]->target_params['prj'];
    $url = $PH->getUrl('projViewAsRSS', array('prj' => $project->id));
    echo "<a style='margin:0px; border-width:0px;' href='{$url}' target='_blank'>" . "<img style='margin:0px; border-width:0px;' src='" . getThemeFile("icons/rss_icon.gif") . "'>" . "</a>";
    echo new PageContentClose();
    echo new PageHtmlEnd();
}
Пример #2
0
/**
* view task a documentation page @ingroup pages
*/
function taskViewAsDocu()
{
    global $PH;
    global $auth;
    require_once confGet('DIR_STREBER') . 'render/render_wiki.inc.php';
    require_once confGet('DIR_STREBER') . 'db/db_itemperson.inc.php';
    ### get task ####
    $tsk = get('tsk');
    $editable = false;
    # flag, if this task can be edited
    if ($task = Task::getEditableById($tsk)) {
        $editable = true;
    } else {
        if (!($task = Task::getVisibleById($tsk))) {
            $PH->abortWarning("invalid task-id", ERROR_FATAL);
        }
    }
    if (!($project = Project::getVisibleById($task->project))) {
        $PH->abortWarning("this task has an invalid project id", ERROR_DATASTRUCTURE);
    }
    ### create from handle ###
    $from_handle = $PH->defineFromHandle(array('tsk' => $task->id));
    global $g_wiki_task;
    $g_wiki_task = $task;
    ### set up page and write header ####
    measure_start("page_render");
    $page = new Page();
    $page->use_autocomplete = true;
    initPageForTask($page, $task, $project);
    $page->title_minor_html = $PH->getLink('taskView', sprintf('#%d', $task->id), array('tsk' => $task->id));
    if ($task->state == -1) {
        $page->title_minor_html .= ' ' . sprintf(__('(deleted %s)', 'page title add on with date of deletion'), renderTimestamp($task->deleted));
    }
    ### page functions ###
    if ($project->isPersonVisibleTeamMember($auth->cur_user)) {
        ### edit ###
        if ($editable) {
            $page->add_function(new PageFunction(array('target' => 'taskEdit', 'params' => array('tsk' => $task->id), 'icon' => 'edit', 'tooltip' => __('Edit this task'), 'name' => __('Edit'))));
            $page->add_function(new PageFunction(array('target' => 'tasksMoveToFolder', 'params' => array('tsk' => $task->id), 'icon' => 'edit', 'name' => __('Move', 'page function to move current task'))));
            if ($task->state == 1) {
                $page->add_function(new PageFunction(array('target' => 'tasksDelete', 'params' => array('tsk' => $task->id), 'icon' => 'delete', 'tooltip' => __('Delete this task'), 'name' => __('Delete'))));
            } else {
                if ($task->state == -1) {
                    $page->add_function(new PageFunction(array('target' => 'tasksUndelete', 'params' => array('tsk' => $task->id), 'icon' => 'undelete', 'tooltip' => __('Restore this task'), 'name' => __('Undelete'))));
                }
            }
        }
        if ($auth->cur_user->settings & USER_SETTING_ENABLE_EFFORTS && $project->settings & PROJECT_SETTING_ENABLE_EFFORTS) {
            $page->add_function(new PageFunction(array('target' => 'effortNew', 'params' => array('parent_task' => $task->id), 'icon' => 'effort', 'name' => __('Book Effort'))));
        }
        ### new ###
        if ($task->category == TCATEGORY_FOLDER) {
            $page->add_function(new PageFunction(array('target' => 'taskNew', 'params' => array('parent_task' => $task->id, 'task_category' => TCATEGORY_DOCU, 'task_show_folder_as_documentation' => 1), 'icon' => 'edit', 'name' => __('New topic'))));
        } else {
            if ($task->parent_task) {
                $page->add_function(new PageFunction(array('target' => 'taskNew', 'params' => array('parent_task' => $task->parent_task, 'task_category' => TCATEGORY_DOCU, 'task_show_folder_as_documentation' => 1), 'icon' => 'edit', 'name' => __('New topic'))));
            } else {
                $page->add_function(new PageFunction(array('target' => 'taskNew', 'params' => array('prj' => $task->project, 'task_category' => TCATEGORY_DOCU), 'icon' => 'edit', 'name' => __('New topic'))));
            }
        }
        if ($auth->cur_user->settings & USER_SETTING_ENABLE_BOOKMARKS) {
            require_once confGet('DIR_STREBER') . 'db/db_itemperson.inc.php';
            $item = ItemPerson::getAll(array('person' => $auth->cur_user->id, 'item' => $task->id));
            if (!$item || $item[0]->is_bookmark == 0) {
                $page->add_function(new PageFunction(array('target' => 'itemsAsBookmark', 'params' => array('task' => $task->id), 'tooltip' => __('Mark this task as bookmark'), 'name' => __('Bookmark'))));
            } else {
                $page->add_function(new PageFunction(array('target' => 'itemsRemoveBookmark', 'params' => array('task' => $task->id), 'tooltip' => __('Remove this bookmark'), 'name' => __('Remove Bookmark'))));
            }
        }
    }
    ### render title ###
    echo new PageHeader();
    echo new PageContentOpen_Columns();
    require_once confGet('DIR_STREBER') . 'lists/list_docustructure.inc.php';
    $list = new Block_DocuNavigation(array('current_task' => $task));
    $list->print_all();
    $block = new PageBlock(array('id' => 'summary', 'reduced_header' => true));
    $block->render_blockStart();
    echo "<div class=text>";
    if ($person_creator = Person::getVisibleById($task->created_by)) {
        echo "<div class=labeled><label>" . __("Created", "Label in Task summary") . "</label>" . renderDateHtml($task->created) . ' / ' . $person_creator->getLink() . '</div>';
    }
    if ($person_modify = Person::getVisibleById($task->modified_by)) {
        echo "<div class=labeled><label>" . __("Modified", "Label in Task summary") . "</label>" . renderDateHtml($task->modified) . ' / ' . $person_modify->getLink() . '</div>';
    }
    require_once confGet('DIR_STREBER') . "db/db_itemchange.inc.php";
    $versions = ItemVersion::getFromItem($task);
    if (count($versions) > 1) {
        $str_version = $PH->getLink('itemViewDiff', sprintf(__("View previous %s versions"), count($versions)), array('item' => $task->id));
        echo "<div class=labeled><label></label>{$str_version}</div>";
    }
    ### publish to ###
    global $g_pub_level_names;
    if ($task->pub_level != PUB_LEVEL_OPEN && isset($g_pub_level_names[$task->pub_level])) {
        echo "<div class=labeled><label>" . __("Publish to", "Label in Task summary") . "</label>" . $g_pub_level_names[$task->pub_level];
        if ($editable) {
            echo '<br>(' . $PH->getLink('itemsSetPubLevel', __('Set to Open'), array('item' => $task->id, 'item_pub_level' => PUB_LEVEL_OPEN)) . ')';
        }
        echo "</div>";
    }
    echo "</div>";
    $block->render_blockEnd();
    require_once confGet('DIR_STREBER') . 'blocks/files_attached_to_item.inc.php';
    print new FilesAttachedToItemBlock($task);
    echo new PageContentNextCol();
    require_once confGet('DIR_STREBER') . 'db/db_itemperson.inc.php';
    if ($view = ItemPerson::getAll(array('person' => $auth->cur_user->id, 'item' => $task->id, 'feedback_requested_by' => true))) {
        if ($requested_by = Person::getPeople(array('id' => $view[0]->feedback_requested_by))) {
            echo "<div class=item_notice>";
            echo "<h3>" . sprintf(__("Your feedback is requested by %s."), asHtml($requested_by[0]->nickname)) . "</h3>";
            echo __("Please edit or comment this item.");
            echo "</div>";
        }
    }
    #$descriptionWithUpdates= $task->getTextfieldWithUpdateNotes('description');
    echo "<div class=description>";
    echo wikifieldAsHtml($task, 'description', array('empty_text' => "[quote]" . __("This topic does not have any text yet.\nDoubleclick here to add some.") . "[/quote]"));
    echo "</div>";
    ### Apply automatic link conversions
    if (checkAutoWikiAdjustments()) {
        $task->description = applyAutoWikiAdjustments($task->description);
        $task->update(array('description'), false);
    }
    require_once confGet('DIR_STREBER') . 'blocks/comments_on_item_block.inc.php';
    print new CommentsOnItemBlock($task);
    echo new PageContentClose();
    echo new PageHtmlEnd();
    measure_stop("page_render");
    $task->nowViewedByUser();
}