Example #1
0
 public function setCurUserAsAnonymous($cookie_string = NULL)
 {
     measure_start('include Person');
     require_once confGet('DIR_STREBER') . "db/class_person.inc.php";
     measure_stop('include Person');
     global $PH;
     if (!($au = confGet('ANONYMOUS_USER'))) {
         return NULL;
     }
     if (!($user = Person::getById($au))) {
         new FeedbackMessage(__("Invalid anonymous user"));
         log_message(" Failed: setCurUserAsAnonymous::getById() without result", LOG_MESSAGE_DEBUG);
         return NULL;
     }
     if (!$user->can_login) {
         new FeedbackWarning(__("Anonymous account has been disabled. "));
         log_message(" Failed: Anonymous account disabled", LOG_MESSAGE_DEBUG);
         return false;
     }
     ### disable rendering for traffic exhaustive browsers ###
     if ($this->isUglyCrawler()) {
         exit;
     }
     ### success ###
     $this->cur_user = $user;
     $user->last_login = getGMTString();
     $this->cur_user->update(array('last_login'), false);
     return $user;
 }
function projViewFiles()
{
    global $PH;
    global $auth;
    require_once confGet('DIR_STREBER') . "render/render_wiki.inc.php";
    ### get current project ###
    $id = getOnePassedId('prj', 'projects_*');
    $project = Project::getVisibleById($id);
    if (!$project || !$project->id) {
        $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 = __("Downloads");
    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");
        }
    }
    ### render title ###
    echo new PageHeader();
    echo new PageContentOpen();
    measure_stop('init2');
    measure_start('info');
    $block = new PageBlock(array('id' => 'support'));
    $block->render_blockStart();
    echo "<div class=text>";
    if ($task = Task::getVisibleById(3645)) {
        echo wikifieldAsHtml($task, 'description');
    }
    echo "</div>";
    $block->render_blockEnd();
    echo new PageContentClose();
    echo new PageHtmlEnd();
}
Example #3
0
/**
* render and return a table with the measured ids
*/
function render_measures()
{
    global $measure_times;
    global $measure_counts;
    global $time_total;
    measure_stop('time_complete');
    $buffer = '<table>';
    foreach ($measure_times as $key => $time) {
        $width = round($time / $time_total * 100, 0) . "px";
        $time_ms = round($time * 1000, 0);
        $buffer .= "<tr>";
        $buffer .= "<td>{$key} </td>" . "<td>{$time_ms}</td>" . '<td><img src="themes/' . getCurTheme() . '/img/pixel.gif" style="height:3px;width:' . $width . '; background-color:#f00;"></td>';
        $buffer .= "</tr>";
    }
    $buffer .= '</table>';
    return $buffer;
}
Example #4
0
 static function renderLinkFromTargetName($target, $name)
 {
     measure_start("BlockLink::renderLinkFromTargetName");
     global $PH;
     global $g_replace_list;
     global $g_wiki_project;
     $html = "";
     /**
      * start with looking for tasks...
      */
     $decoded_name = strtr($target, array_flip(get_html_translation_table(HTML_SPECIALCHARS, ENT_QUOTES)));
     measure_start("BlockLink::renderLinkFromTargetName::getTasks");
     if ($g_wiki_project) {
         $tasks = Task::getAll(array('name' => $decoded_name, 'project' => $g_wiki_project->id, 'status_max' => STATUS_CLOSED));
     } else {
         $tasks = Task::getAll(array('name' => $decoded_name, 'status_max' => STATUS_CLOSED));
     }
     measure_stop("BlockLink::renderLinkFromTargetName::getTasks");
     if (count($tasks) == 1) {
         ### matches name ###
         if (!strcasecmp(asHtml($tasks[0]->name), $target)) {
             $style_isdone = $tasks[0]->status >= STATUS_COMPLETED ? 'isDone' : '';
             if ($name) {
                 $html = "<a  class='item task {$style_isdone}' href='" . $PH->getUrl('taskView', array('tsk' => intval($tasks[0]->id))) . "'>" . asHtml($name) . "</a>";
                 global $g_replace_list;
                 $g_replace_list[$target] = '#' . $tasks[0]->id . '|' . $name;
             } else {
                 $html = "<a  class='item task {$style_isdone}' href='" . $PH->getUrl('taskView', array('tsk' => intval($tasks[0]->id))) . "'>" . asHtml($tasks[0]->name) . "</a>";
                 global $g_replace_list;
                 $g_replace_list[$target] = '#' . $tasks[0]->id . '|' . $tasks[0]->name;
             }
         } else {
             if (!strcasecmp($tasks[0]->short, $target)) {
                 $style_isdone = $tasks[0]->status >= STATUS_COMPLETED ? 'isDone' : '';
                 if ($name) {
                     $html = "<a  class='item task {$style_isdone}' href='" . $PH->getUrl('taskView', array('tsk' => intval($tasks[0]->id))) . "'>" . asHtml($name) . "</a>";
                     global $g_replace_list;
                     $g_replace_list[$target] = '#' . $tasks[0]->id . '|' . $name;
                 } else {
                     $html = "<a  class='item task {$style_isdone}' href='" . $PH->getUrl('taskView', array('tsk' => intval($tasks[0]->id))) . "'>" . asHtml($tasks[0]->name) . "</a>";
                     global $g_replace_list;
                     $g_replace_list[$target] = '#' . $tasks[0]->id . '|' . $tasks[0]->short;
                 }
             } else {
                 $title = __('No task matches this name exactly');
                 $title2 = __('This task seems to be related');
                 $html = "<span title='{$title}' class=not_found>{$name}</span>" . "<a href='" . $PH->getUrl('taskView', array('tsk' => intval($tasks[0]->id))) . "' title='{$title2}'>?</a>";
             }
         }
     } else {
         if (count($tasks) > 1) {
             measure_start("BlockLink::renderLinkFromTargetName::iterateSeveralTasks");
             $matches = array();
             $best = -1;
             $best_rate = 0;
             foreach ($tasks as $t) {
                 if (!strcasecmp($t->name, $target) && $g_wiki_project && $t->project == $g_wiki_project->id) {
                     $matches[] = $t;
                 } else {
                     if (!strcasecmp($t->short, $target)) {
                         $matches[] = $t;
                     }
                 }
             }
             if (count($matches) == 1) {
                 $html = "<a href='" . $PH->getUrl('taskView', array('tsk' => intval($matches[0]->id))) . "'>" . $matches[0]->name . "</a>";
             } else {
                 if (count($matches) > 1) {
                     $title = __('No item excactly matches this name.');
                     $title2 = sprintf(__('List %s related tasks'), count($tasks));
                     $html = "<a class=not_found title= '{$title2}' href='" . $PH->getUrl('search', array('search_query' => $target)) . "'> " . $target . " (" . count($matches) . ' ' . __('identical') . ")</a>";
                 } else {
                     if ($g_wiki_project) {
                         $title = __('No item matches this name. Create new task with this name?');
                         $url = $PH->getUrl('taskNew', asHtml($target), array('prj' => $g_wiki_project->id));
                         $html = "<a href='{$url}' title='{$title}' class=not_found>{$target}</a>";
                     } else {
                         $title = __('No item matches this name...');
                         $html = "<span title='{$title}' class=not_found>{$target}</span>";
                     }
                 }
             }
             measure_stop("BlockLink::renderLinkFromTargetName::iterateSeveralTasks");
         } else {
             if (0 == count($tasks)) {
                 measure_start("BlockLink::renderLinkFromTargetName::notATaskItem");
                 /**
                  * now check for team-members...
                  */
                 if ($g_wiki_project) {
                     $people = Person::getPeople(array('project' => $g_wiki_project->id, 'search' => $target));
                     if (count($people) == 1) {
                         return "<a class='item person' title= '" . asHtml($people[0]->name) . "' href='" . $PH->getUrl('personView', array('person' => $people[0]->id)) . "'>" . asHtml($target) . "</a>";
                     }
                     measure_stop("BlockLink::renderLinkFromTargetName::getPeople");
                 }
                 /**
                  * Link to create new task or topic
                  */
                 if ($g_wiki_project) {
                     $title = __('No item matches this name. Create new task with this name?');
                     global $g_wiki_task;
                     if (isset($g_wiki_task) && $g_wiki_task->type == ITEM_TASK) {
                         if ($g_wiki_task->category == TCATEGORY_FOLDER) {
                             $parent_task = $g_wiki_task->id;
                         } else {
                             $parent_task = $g_wiki_task->parent_task;
                         }
                     } else {
                         $parent_task = 0;
                     }
                     $url = $PH->getUrl('taskNew', array('prj' => $g_wiki_project->id, 'new_name' => urlencode($target), 'parent_task' => $parent_task));
                     $html = "<a href='{$url}' title='{$title}' class=not_found>{$target}</a>";
                 } else {
                     $title = __('No item matches this name');
                     $html = "<span title='{$title}' class=not_found>{$target}</span>";
                     trigger_error('g_wiki_project was not defined. Could not provide create-link.', E_USER_NOTICE);
                 }
                 measure_stop("BlockLink::renderLinkFromTargetName::notATaskItem");
             }
         }
     }
     measure_stop("BlockLink::renderLinkFromTargetName");
     return $html;
 }
Example #5
0
 /**
  * render links to parent objects (including project, if given)
  */
 function getFolderLinks($shortnames = true, $project = NULL)
 {
     measure_start('col_TaskFolderlinks');
     global $PH;
     $link_list = array();
     if ($project) {
         $link_list[] = "<b>" . $project->getLink() . "</b>";
     }
     foreach ($this->getFolder() as $f) {
         if ($shortnames) {
             $link_list[] = $PH->getLink('taskView', $f->getShort(), array('tsk' => $f->id));
         } else {
             $link_list[] = $PH->getLink('taskView', $f->name, array('tsk' => $f->id));
         }
     }
     measure_stop('col_TaskFolderlinks');
     return implode('<em> &gt; </em>', $link_list);
 }
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();
}
Example #7
0
    if (isset($auth->cur_user->language) && $auth->cur_user->language != "" && $auth->cur_user->language != "en") {
        setLang($auth->cur_user->language);
        Person::initFields();
    }
} else {
    setLang(confGet('DEFAULT_LANGUAGE'));
    Person::initFields();
}
measure_stop('language');
/** include framework */
measure_start('plugins');
require_once confGet('DIR_STREBER') . "std/constant_names.inc.php";
require_once confGet('DIR_STREBER') . "render/render_page.inc.php";
require_once confGet('DIR_STREBER') . "pages/_handles.inc.php";
# already requires language-support
measure_stop('plugins');
if (function_exists('postInitCustomize')) {
    postInitCustomize();
}
measure_start('init2');
global $PH;
if ($g_tags_removed) {
    new FeedbackWarning(__('For security reasons html tags were removed from passed variables') . " " . sprintf(__("Read more about %s."), $PH->getWikiLink('security settings')));
}
/********************************************************************************
* route to pages
********************************************************************************/
### if index.php was called without target, check environment ###
$requested_page = $PH->getRequestedPage();
### pages with http auth ###
if ($requested_page->http_auth) {
Example #8
0
/**
* playground @ingroup pages
*/
function playground()
{
    global $PH;
    global $auth;
    if (!isset($_SERVER['REMOTE_USER']) && !isset($_SERVER['REDIRECT_REDIRECT_REMOTE_USER']) && !isset($_SERVER['PHP_AUTH_USER']) && !get('HTTP_AUTHORIZATION')) {
        header('WWW-Authenticate: Basic realm="blabl"');
        header('HTTP/1.0 401 Unauthorized');
        echo 'Sorry. You need to authenticate';
        print "<pre>";
        print_r($_SERVER);
        print "</pre>";
        exit;
    } else {
        $username = '';
        $password = '';
        if (isset($_SERVER['PHP_AUTH_USER'])) {
            $username = asCleanString($_SERVER['PHP_AUTH_USER']);
            if (isset($_SERVER['PHP_AUTH_PW'])) {
                $password = asCleanString($_SERVER['PHP_AUTH_PW']);
            }
        } else {
            $ha = '';
            if (isset($_SERVER['REDIRECT_REDIRECT_REMOTE_USER'])) {
                $ha = $_SERVER['REDIRECT_REDIRECT_REMOTE_USER'];
            } else {
                if (isset($_SERVER['REMOTE_USER'])) {
                    $ha = $_SERVER['REMOTE_USER'];
                }
            }
            $tmp = base64_decode(substr($ha, 6));
            list($username, $password) = explode(':', $tmp);
        }
        print "<br>username='******'";
        print "<br>password='******'";
        print "<pre>";
        print_r($_SERVER);
        print "</pre>";
    }
    ### create from handle ###
    $PH->defineFromHandle(array());
    $page = new Page();
    $page->cur_tab = 'home';
    $page->options = array(new NaviOption(array('target_id' => 'home', 'name' => __('Today'))));
    $page->title = __("Today");
    # $auth->cur_user->name;
    $page->type = __("At Home");
    $page->title_minor = renderTitleDate(time());
    echo new PageHeader();
    echo new PageContentOpen_Columns();
    measure_stop('init2');
    echo "Column-Right";
    echo new PageContentNextCol();
    ?>
        <div id="pm3">

        <style type="text/css">

        .form_tabgroup {
         display:table;
        }
        .form_tabgroup UL {
         margin:0;
         padding:0;
         list-style:none;
        }
        .form_tabgroup LI.form_tab A {
         color:#777;
         border:0;
         display:block;
         padding:.3em .6em;
        }
        .form_tabgroup LI.form_tab {
         background-color:#eee;
         float:left;
         margin-right:.3em;
        }
        .form_tabgroup LI.Active {
         background-color:#ddd;
        }
        .form_tabgroup LI.Active A {
         color:#000;
        }
        .form_tabgroup DIV {
         padding:.5em .7em;
         background-color:#ddd;
         clear:both;
        }
        </style>

          <div class="form_tabgroup">
            <ul>
              <li class="form_tab" id="tab1"><a href="#">One</a></li>
              <li class="form_tab" id="tab2"><a href="#">Two</a></li>
              <li class="form_tab" id="tab3"><a href="#">Three</a></li>
            </ul>
            <div id="tab1-body">I'm the one's tab content.</div>
            <div id="tab2-body">I'm the two's tab content<br />and a 2nd line.</div>
            <div id="tab3-body">Guess who am I -- says the three's tab content.</div>
          </div>
          <div class="form_tabgroup">
            <ul>
              <li class="form_tab" id="tab1a"><a href="#">One</a></li>
              <li class="form_tab" id="tab2a"><a href="#">Two</a></li>
              <li class="form_tab" id="tab3a"><a href="#">Three</a></li>
            </ul>
            <div id="tab1a-body">I'm the one's tab content.</div>
            <div id="tab2a-body">I'm the two's tab content<br />and a 2nd line.</div>
            <div id="tab3a-body">Guess who am I -- says the three's tab content.</div>
          </div>
        </div>


    <?php 
    echo new PageContentClose();
    echo new PageHtmlEnd();
}
Example #9
0
 function render_tr(&$task, $style = "nowrap")
 {
     global $PH;
     if (!isset($task) || !$task instanceof Task) {
         return;
     }
     ### task with zero-id is project-root ###
     if (!$task->id) {
         $link = $PH->getLink('projView', "...project...", array('prj' => $task->project));
         echo '<td><b>' . $link . "</b></td>";
     } else {
         $name = $task->name;
         if (!$name) {
             $name = __("- no name -", "in task lists");
         }
         $html_details = '';
         if ($this->parent_block->show_project_folder && ($project = Project::getVisibleById($task->project))) {
             if ($tmp = $task->getFolderLinks(true, $project)) {
                 $html_details .= __('in', 'very short for IN folder...') . ' ' . $tmp;
             }
         } else {
             if ($tmp = $task->getFolderLinks()) {
                 $html_details .= __('in', 'very short for IN folder...') . ' ' . $tmp;
             }
         }
         $isDone = $task->status >= STATUS_COMPLETED ? 'isDone' : '';
         $link = $PH->getLink('taskView', $name, array('tsk' => $task->id));
         #echo "<td class=taskwithfolder><span class='name $isDone'>{$link}</span><br><span class=sub>$html_details</span></td>";
         echo "<td class=taskwithfolder><span class='{$isDone}'>{$link}</span><br><span class=sub>{$html_details}</span></td>";
     }
     measure_stop('col_taskname');
 }
Example #10
0
/**
* render bookmarks @ingroup pages
*/
function homeBookmarks()
{
    global $PH;
    global $auth;
    ### create from handle ###
    $PH->defineFromHandle(array());
    $page = new Page();
    $page->cur_tab = 'home';
    $page->options = build_home_options();
    $page->title = __("Your Bookmarks");
    # $auth->cur_user->name;
    $page->type = __("At Home");
    echo new PageHeader();
    echo new PageContentOpen();
    measure_stop('init2');
    require_once confGet('DIR_STREBER') . 'lists/list_bookmarks.inc.php';
    $list_bookmarks = new ListBlock_bookmarks();
    $list_bookmarks->print_automatic();
    ### list forwarded tasks ###
    #{
    #   require_once(confGet('DIR_STREBER') . 'lists/list_forwardedtasks.inc.php');
    #    $list_forwarded_tasks = new ListBlock_forwarded_tasks();
    #    $list_forwarded_tasks->print_automatic();
    #
    echo new PageContentClose();
    echo new PageHtmlEnd();
}
Example #11
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();
}