Example #1
0
 public function runProjectCommitsMore(framework\Request $request)
 {
     $this->forward403unless($request->isPost());
     $this->selected_project = Project::getByKey($request['project_key']);
     framework\Context::setCurrentProject($this->selected_project);
     if (framework\Context::getModule('vcs_integration')->getSetting('vcs_mode_' . framework\Context::getCurrentProject()->getID()) == Vcs_integration::MODE_DISABLED) {
         return $this->return404(framework\Context::getI18n()->__('VCS Integration has been disabled for this project'));
     }
     $offset = $request->getParameter('offset', 0);
     $this->commits = Commit::getByProject($this->selected_project->getID(), 40, $offset, $request->getParameter('branchname'), $request->getParameter('gitlab_repos_nss'));
     return $this->renderJSON(array('content' => $this->getComponentHTML('vcs_integration/projectcommits', array('commits' => $this->commits, 'selected_project' => $this->selected_project)), 'offset' => $offset + 40));
 }
Example #2
0
 public function runReleaseCenter(framework\Request $request)
 {
     $this->forward403if(framework\Context::getCurrentProject()->isArchived() || !$this->getUser()->canManageProjectReleases(framework\Context::getCurrentProject()));
     $this->build_error = framework\Context::getMessageAndClear('build_error');
 }
Example #3
0
 public static function extractIssues($matches)
 {
     $issue = Issue::getIssueFromLink($matches["issues"]);
     if ($issue instanceof Issue) {
         if (!framework\Context::isProjectContext() || framework\Context::isProjectContext() && $issue->getProjectID() == framework\Context::getCurrentProject()->getID()) {
             $this->_quickfound_issues[] = $issue;
         }
     }
 }
<div class="article">
    <div class="header">Special:<?php 
echo $projectnamespace != '' ? "<span class='faded_out'>{$projectnamespace}</span>" : '';
?>
All Pages</div>
        <div class="greybox" style="margin: 15px 0;">
            <?php 
if (\thebuggenie\core\framework\Context::isProjectContext()) {
    ?>
                <?php 
    echo __('Note: This page lists all articles for "%project_name". For a list of global articles, see %all_pages', array('%project_name' => \thebuggenie\core\framework\Context::getCurrentProject()->getName(), '%all_pages' => link_tag(make_url('publish_article', array('article_name' => "Special:AllPages")), 'Special:AllPages')));
    ?>
            <?php 
} else {
    ?>
                <?php 
    echo __('Note: This page lists all articles in the global scope. For a list of project articles, see the corresponding "All pages" for that specific project');
    ?>
            <?php 
}
?>
        </div>
    <p>
        <?php 
echo __('Below is a listing of all pages.');
?>
    </p>
    <?php 
include_component('publish/articleslist', compact('articles'));
?>
</div>
Example #5
0
        </div>
    <?php 
} else {
    ?>
    <?php 
    if ($article->getArticleType() == \thebuggenie\modules\publish\entities\Article::TYPE_MANUAL) {
        echo get_spaced_name($article->getManualName());
    } else {
        $namespaces = explode(':', $article_name);
        if (count($namespaces) > 1 && $namespaces[0] == 'Category') {
            array_shift($namespaces);
            echo '<span class="faded_out blue">Category:</span>';
        }
        if (\thebuggenie\core\framework\Context::isProjectContext() && count($namespaces) > 1 && mb_strtolower($namespaces[0]) == \thebuggenie\core\framework\Context::getCurrentProject()->getKey()) {
            array_shift($namespaces);
            echo '<span>', \thebuggenie\core\framework\Context::getCurrentProject()->getName(), ':</span>';
        }
        echo \thebuggenie\core\framework\Settings::get('allow_camelcase_links', 'publish', \thebuggenie\core\framework\Context::getScope()->getID(), 0) ? get_spaced_name(implode(':', $namespaces)) : implode(':', $namespaces);
    }
    ?>
    <?php 
}
?>
    <?php 
if ($article->getID() && $mode) {
    switch ($mode) {
        /* case 'edit':
           ?><span class="faded_out"><?php echo __('%article_name ~ Edit', array('%article_name' => '')); ?></span><?php
           break; */
        case 'history':
            ?>
<div class="article">
    <div class="header">Special:<?php 
echo $projectnamespace != '' ? "<span class='faded_out'>{$projectnamespace}</span>" : '';
?>
Uncategorized Categories</div>
    <?php 
if (\thebuggenie\core\framework\Context::isProjectContext()) {
    ?>
        <div class="greybox" style="margin: 15px 0;">
            <?php 
    echo __('Note: This page lists all categories without any parent categories in "%project_name". For a list of global categories with no parent categories, see %uncategorized_categories', array('%project_name' => \thebuggenie\core\framework\Context::getCurrentProject()->getName(), '%uncategorized_categories' => link_tag(make_url('publish_article', array('article_name' => "Special:UncategorizedCategories")), 'Special:UncategorizedCategories')));
    ?>
        </div>
    <?php 
}
?>
    <p>
        <?php 
echo __('Below is a listing of categories that have no parent categories.');
?>
    </p>
    <?php 
include_component('publish/articleslist', array('articles' => $articles, 'include_redirects' => false));
?>
</div>
 /**
  * Setup the parser object
  *
  * @param string $text The text to be parsed
  * @param boolean $use_toc [optional] Whether to use a TOC if found
  * @param string $toc_base_id [optional] Base id to use for the TOC element
  */
 public function __construct($text, $use_toc = false, $toc_base_id = null)
 {
     $this->text = str_replace("\r\n", "\n", $text);
     $this->use_toc = $use_toc;
     $this->toc_base_id = $toc_base_id;
     if (framework\Context::isProjectContext()) {
         $this->namespace = framework\Context::getCurrentProject()->getKey();
     }
     if (!framework\Context::isCLI()) {
         framework\Context::loadLibrary('ui');
     }
 }
Example #8
0
 /**
  * Assign a user story to a milestone id
  *
  * @Route(url="/assign/issue/milestone/:milestone_id")
  *
  * @param framework\Request $request
  */
 public function runAssignMilestone(framework\Request $request)
 {
     $this->forward403if(framework\Context::getCurrentProject()->isArchived());
     $this->forward403unless($this->_checkProjectPageAccess('project_scrum') && framework\Context::getUser()->canAssignScrumUserStories($this->selected_project));
     try {
         $issue = \thebuggenie\core\entities\Issue::getB2DBTable()->selectById((int) $request['issue_id']);
         $milestone = \thebuggenie\core\entities\tables\Milestones::getTable()->selectById($request['milestone_id']);
         if (!$issue instanceof \thebuggenie\core\entities\Issue) {
             throw new \Exception($this->getI18n()->__('This is not a valid issue'));
         }
         $issue->setMilestone($milestone);
         $issue->save();
         foreach ($issue->getChildIssues() as $child_issue) {
             $child_issue->setMilestone($milestone);
             $child_issue->save();
         }
         $new_issues = $milestone instanceof \thebuggenie\core\entities\Milestone ? $milestone->countIssues() : 0;
         $new_e_points = $milestone instanceof \thebuggenie\core\entities\Milestone ? $milestone->getPointsEstimated() : 0;
         $new_e_hours = $milestone instanceof \thebuggenie\core\entities\Milestone ? $milestone->getHoursEstimated() : 0;
         return $this->renderJSON(array('issue_id' => $issue->getID(), 'issues' => $new_issues, 'points' => $new_e_points, 'hours' => $new_e_hours));
     } catch (\Exception $e) {
         $this->getResponse()->setHttpStatus(400);
         return $this->renderJSON(array('error' => $e->getMessage()));
     }
 }
?>
</td>
        <td class="faded_out" title="<?php 
echo __('%count issues open of %total_count issues total', array('%count' => $counts[0]['open'], '%total_count' => $counts[0]['open'] + $counts[0]['closed']));
?>
"><?php 
echo $counts[0]['open'];
?>
&nbsp;<span style="font-weight: normal;">/&nbsp;<?php 
echo $counts[0]['open'] + $counts[0]['closed'];
?>
 (<?php 
echo (int) $counts[0]['percentage'];
?>
%)</span></td>
        <td class="faded_out"><?php 
include_component('main/percentbar', array('percent' => 100 - $counts[0]['percentage'], 'height' => 14));
?>
</td>
    </tr>
</table>
<?php 
echo link_tag(make_url('project_statistics', array('project_key' => \thebuggenie\core\framework\Context::getCurrentProject()->getKey())), __('Show more statistics'), array('class' => 'button button-silver dash', 'title' => __('More statistics')));
if ($key != 'workflowstep') {
    ?>
    <?php 
    echo link_tag(make_url('project_issues', array('project_key' => \thebuggenie\core\framework\Context::getCurrentProject()->getKey(), 'search' => true, 'fs[state]' => array('o' => '=', 'v' => \thebuggenie\core\entities\Issue::STATE_OPEN), 'groupby' => $key, 'grouporder' => 'desc')) . "?sortfields=issues.{$key}=asc", __('Show details'), array('class' => 'button button-silver dash', 'title' => __('Show more issues')));
}
?>
<br style="clear: both;">
if ($include_buttons) {
    ?>
        <div class="settings_container">
            <?php 
    echo image_tag('icon-mono-settings.png', array('class' => 'dropper dropdown_link'));
    ?>
            <ul class="popup_box milestone_moreactions more_actions_dropdown" id="milestone_<?php 
    echo $milestone->getID();
    ?>
_moreactions" style="display: none;">
                <li><?php 
    echo link_tag(make_url('project_milestone_details', array('project_key' => $milestone->getProject()->getKey(), 'milestone_id' => $milestone->getID())), __('Show overview'));
    ?>
</li>
                <?php 
    if ($tbg_user->canEditProjectDetails(\thebuggenie\core\framework\Context::getCurrentProject())) {
        ?>
                    <li class="separator"></li>
                    <li><?php 
        echo javascript_link_tag(__('Mark as finished'), array('onclick' => "TBG.Main.Helpers.Backdrop.show('" . make_url('get_partial_for_backdrop', array('key' => 'milestone_finish', 'project_id' => $milestone->getProject()->getId(), 'milestone_id' => $milestone->getID(), 'board_id' => isset($board) ? $board->getID() : '')) . "');"));
        ?>
</li>
                    <li class="separator"></li>
                    <li><?php 
        echo javascript_link_tag(__('Edit'), array('onclick' => "TBG.Main.Helpers.Backdrop.show('" . make_url('get_partial_for_backdrop', array('key' => 'agilemilestone', 'project_id' => $milestone->getProject()->getId(), 'milestone_id' => $milestone->getID(), 'board_id' => isset($board) ? $board->getID() : '')) . "');"));
        ?>
</li>
                    <li><?php 
        if (isset($board)) {
            switch ($board->getType()) {
                case AgileBoard::TYPE_GENERIC:
Example #11
0
 public function componentSpecialAllTemplates()
 {
     $this->articles = Articles::getTable()->getAllTemplates(framework\Context::getCurrentProject());
 }
Example #12
0
 public function runProjectIssueCommitsMore(framework\Request $request)
 {
     $this->forward403unless($request->isPost());
     $this->selected_project = Project::getByKey($request['project_key']);
     framework\Context::setCurrentProject($this->selected_project);
     if (framework\Context::getModule('vcs_integration')->getSetting('vcs_mode_' . framework\Context::getCurrentProject()->getID()) == Vcs_integration::MODE_DISABLED) {
         return $this->return404(framework\Context::getI18n()->__('VCS Integration has been disabled for this project'));
     }
     $issue = Issues::getTable()->getByProjectIDAndIssueNo($this->selected_project->getID(), $request['issue_no']);
     $links = IssueLink::getCommitsByIssue($issue, $request->getParameter('limit', 0), $request->getParameter('offset', 0));
     return $this->renderJSON(array('content' => $this->getComponentHTML('vcs_integration/issuecommits', array("projectId" => $this->selected_project->getID(), "links" => $links))));
 }
    echo link_tag(make_url('publish_article', array('article_name' => "OpenidIntro")), __('OpenID login introduction header'), array('title' => "OpenidIntro"));
    ?>
</li>
        <li><?php 
    echo link_tag(make_url('publish_article', array('article_name' => "RegistrationIntro")), __('Registration introduction header'), array('title' => "RegistrationIntro"));
    ?>
</li>
        <li><?php 
    echo link_tag(make_url('publish_article', array('article_name' => "ForgottenPasswordIntro")), __('Forgotten password introduction header'), array('title' => "ForgottenPasswordIntro"));
    ?>
</li>
    <?php 
} else {
    ?>
        <li><?php 
    echo link_tag(make_url('publish_article', array('article_name' => \thebuggenie\core\framework\Context::getCurrentProject()->getKey() . ":MainPage")), __('Project wiki frontpage'), array('title' => \thebuggenie\core\framework\Context::getCurrentProject()->getKey() . ":MainPage"));
    ?>
</li>
    <?php 
}
?>
    </ul>
    <br style="clear: both;">
    <br style="clear: both;">
    <h3><?php 
echo __('Wiki maintenance');
?>
</h3>
    <ul class="category_list">
        <li><?php 
echo link_tag(make_url('publish_article', array('article_name' => "Special:{$projectnamespace}DeadEndPages")), __('Dead end pages'), array('title' => "Special:{$projectnamespace}DeadEndPages"));
$milestone_cc = 0;
foreach (\thebuggenie\core\framework\Context::getCurrentProject()->getUpcomingMilestones(21) as $milestone) {
    ?>
    <?php 
    if ($milestone->isScheduled()) {
        ?>
        <?php 
        include_component('main/milestonedashboardbox', array('milestone' => $milestone));
        ?>
        <?php 
        $milestone_cc++;
        ?>
    <?php 
    }
}
foreach (\thebuggenie\core\framework\Context::getCurrentProject()->getStartingMilestones(21) as $milestone) {
    ?>
    <?php 
    if ($milestone->isStarting()) {
        ?>
        <?php 
        include_component('main/milestonedashboardbox', array('milestone' => $milestone));
        ?>
        <?php 
        $milestone_cc++;
        ?>
    <?php 
    }
}
?>
</div>
 public function listen_viewissue_panel(framework\Event $event)
 {
     if (framework\Context::getModule('vcs_integration')->getSetting('vcs_mode_' . framework\Context::getCurrentProject()->getID()) == self::MODE_DISABLED) {
         return;
     }
     $links = IssueLink::getCommitsByIssue($event->getSubject());
     include_component('vcs_integration/viewissue_commits', array('links' => $links, 'projectId' => $event->getSubject()->getProject()->getID()));
 }
<?php

if ($filter instanceof \thebuggenie\core\entities\SearchFilter) {
    ?>
    <?php 
    switch ($filter->getFilterKey()) {
        case 'project_id':
            ?>
                <?php 
            if (\thebuggenie\core\framework\Context::isProjectContext()) {
                ?>
                    <input type="hidden" name="fs[project_id][o]" value="=">
                    <input type="hidden" name="fs[project_id][v]" value="<?php 
                echo \thebuggenie\core\framework\Context::getCurrentProject()->getID();
                ?>
" id="filter_project_id_value_input">
                <?php 
            } else {
                ?>
                    <div class="filter interactive_dropdown" data-filterkey="project_id" data-value="<?php 
                echo $filter->getValue();
                ?>
" data-all-value="<?php 
                echo __('All');
                ?>
">
                        <input type="hidden" name="fs[project_id][o]" value="<?php 
                echo $filter->getOperator();
                ?>
">
                        <input type="hidden" name="fs[project_id][v]" value="" id="filter_project_id_value_input">
Example #17
0
    ?>
                <div class="greenbox" style="margin: 0 0 5px 5px; font-size: 14px;">
                    <b><?php 
    echo $message;
    ?>
</b>
                </div>
            <?php 
}
?>
            <h2><?php 
echo __('Find articles');
?>
</h2>
            <form action="<?php 
echo \thebuggenie\core\framework\Context::isProjectContext() ? make_url('publish_find_project_articles', array('project_key' => \thebuggenie\core\framework\Context::getCurrentProject()->getKey())) : make_url('publish_find_articles');
?>
" method="get" accept-charset="<?php 
echo \thebuggenie\core\framework\Context::getI18n()->getCharset();
?>
">
                <label for="find_article_name" style="font-size: 1.1em; float: left;"><?php 
echo __('Find articles by name');
?>
</label><input type="text" name="articlename" id="find_article_name" value="<?php 
echo \thebuggenie\core\framework\Context::getI18n()->__e($articlename);
?>
" style="width: 400px; float: left; margin-left: 5px; padding: 2px; font-size: 1.3em;">
                <input type="submit" value="<?php 
echo __('Find');
?>
    $tbg_response->setTitle(\thebuggenie\core\framework\Context::isProjectContext() ? __('Find issues for %project_name', array('%project_name' => \thebuggenie\core\framework\Context::getCurrentProject()->getName())) : __('Find issues'));
}
if (\thebuggenie\core\framework\Context::isProjectContext()) {
    $tbg_response->addBreadcrumb(__('Issues'), make_url('project_issues', array('project_key' => \thebuggenie\core\framework\Context::getCurrentProject()->getKey())), tbg_get_breadcrumblinks('project_summary', \thebuggenie\core\framework\Context::getCurrentProject()));
    $tbg_response->addFeed(make_url('project_open_issues', array('project_key' => \thebuggenie\core\framework\Context::getCurrentProject()->getKey(), 'format' => 'rss')), __('Open issues for %project_name', array('%project_name' => \thebuggenie\core\framework\Context::getCurrentProject()->getName())));
    $tbg_response->addFeed(make_url('project_allopen_issues', array('project_key' => \thebuggenie\core\framework\Context::getCurrentProject()->getKey(), 'format' => 'rss')), __('Open issues for %project_name (including subprojects)', array('%project_name' => \thebuggenie\core\framework\Context::getCurrentProject()->getName())));
    $tbg_response->addFeed(make_url('project_closed_issues', array('project_key' => \thebuggenie\core\framework\Context::getCurrentProject()->getKey(), 'format' => 'rss')), __('Closed issues for %project_name', array('%project_name' => \thebuggenie\core\framework\Context::getCurrentProject()->getName())));
    $tbg_response->addFeed(make_url('project_allclosed_issues', array('project_key' => \thebuggenie\core\framework\Context::getCurrentProject()->getKey(), 'format' => 'rss')), __('Closed issues for %project_name (including subprojects)', array('%project_name' => \thebuggenie\core\framework\Context::getCurrentProject()->getName())));
    $tbg_response->addFeed(make_url('project_wishlist_issues', array('project_key' => \thebuggenie\core\framework\Context::getCurrentProject()->getKey(), 'format' => 'rss')), __('Wishlist for %project_name', array('%project_name' => \thebuggenie\core\framework\Context::getCurrentProject()->getName())));
    $tbg_response->addFeed(make_url('project_milestone_todo_list', array('project_key' => \thebuggenie\core\framework\Context::getCurrentProject()->getKey(), 'format' => 'rss')), __('Milestone todo-list for %project_name', array('%project_name' => \thebuggenie\core\framework\Context::getCurrentProject()->getName())));
    $tbg_response->addFeed(make_url('project_month_issues', array('project_key' => \thebuggenie\core\framework\Context::getCurrentProject()->getKey(), 'format' => 'rss')), __('Issues reported for %project_name this month', array('%project_name' => \thebuggenie\core\framework\Context::getCurrentProject()->getName())));
    $tbg_response->addFeed(make_url('project_last_issues', array('project_key' => \thebuggenie\core\framework\Context::getCurrentProject()->getKey(), 'format' => 'rss', 'units' => 30, 'time_unit' => 'days')), __('Issues reported for %project_name last 30 days', array('%project_name' => \thebuggenie\core\framework\Context::getCurrentProject()->getName())));
    if (!\thebuggenie\core\entities\User::isThisGuest()) {
        $tbg_response->addFeed(make_url('project_my_reported_issues', array('project_key' => \thebuggenie\core\framework\Context::getCurrentProject()->getKey(), 'format' => 'rss')), __('Issues reported by me') . ' (' . \thebuggenie\core\framework\Context::getCurrentProject()->getName() . ')');
        $tbg_response->addFeed(make_url('project_my_assigned_issues', array('project_key' => \thebuggenie\core\framework\Context::getCurrentProject()->getKey(), 'format' => 'rss')), __('Open issues assigned to me') . ' (' . \thebuggenie\core\framework\Context::getCurrentProject()->getName() . ')');
        $tbg_response->addFeed(make_url('project_my_teams_assigned_issues', array('project_key' => \thebuggenie\core\framework\Context::getCurrentProject()->getKey(), 'format' => 'rss')), __('Open issues assigned to my teams') . ' (' . \thebuggenie\core\framework\Context::getCurrentProject()->getName() . ')');
    }
} else {
    $tbg_response->addBreadcrumb(__('Issues'), make_url('search'), tbg_get_breadcrumblinks('main_links'));
    if (!\thebuggenie\core\entities\User::isThisGuest()) {
        $tbg_response->addFeed(make_url('my_reported_issues', array('format' => 'rss')), __('Issues reported by me'));
        $tbg_response->addFeed(make_url('my_assigned_issues', array('format' => 'rss')), __('Open issues assigned to you'));
        $tbg_response->addFeed(make_url('my_teams_assigned_issues', array('format' => 'rss')), __('Open issues assigned to your teams'));
    }
}
?>
<table style="width: 100%; height: 100;" cellpadding="0" cellspacing="0">
    <tr>
        <?php 
include_component('search/sidebar', array('hide' => $show_results && $resultcount));
?>
<?php

if ($issue instanceof \thebuggenie\core\entities\Issue) {
    ?>
    <?php 
    $tbg_response->addBreadcrumb(__('Issues'), make_url('project_issues', array('project_key' => \thebuggenie\core\framework\Context::getCurrentProject()->getKey())), tbg_get_breadcrumblinks('project_summary', \thebuggenie\core\framework\Context::getCurrentProject()));
    $tbg_response->addBreadcrumb($issue->getFormattedIssueNo(true, true), make_url('viewissue', array('project_key' => $issue->getProject()->getKey(), 'issue_no' => $issue->getFormattedIssueNo())));
    $tbg_response->setTitle('[' . ($issue->isClosed() ? mb_strtoupper(__('Closed')) : mb_strtoupper(__('Open'))) . '] ' . $issue->getFormattedIssueNo(true) . ' - ' . tbg_decodeUTF8($issue->getTitle()));
    ?>
    <?php 
    \thebuggenie\core\framework\Event::createNew('core', 'viewissue_top', $issue)->trigger();
    ?>
    <div id="issuetype_indicator_fullpage" style="display: none;" class="fullpage_backdrop">
        <div style="position: absolute; top: 45%; left: 40; z-index: 100001; color: #FFF; font-size: 15px; font-weight: bold;">
            <?php 
    echo image_tag('spinning_32.gif');
    ?>
<br>
            <?php 
    echo __('Please wait while updating issue type');
    ?>
...
        </div>
    </div>
    <div id="issue_<?php 
    echo $issue->getID();
    ?>
" class="viewissue_container <?php 
    if ($issue->isBlocking()) {
        echo ' blocking';
    }
Example #20
0
 /**
  *
  * @param \b2db\Criteria $crit
  * @param array|\thebuggenie\core\entities\SearchFilter $filters
  * @param \b2db\Criterion $ctn
  * @return null
  */
 public function addToCriteria($crit, $filters, $ctn = null)
 {
     $filter_key = $this->getFilterKey();
     if (in_array($this['operator'], array('=', '!=', '<=', '>=', '<', '>'))) {
         if ($filter_key == 'text') {
             if ($this['value'] != '') {
                 $searchterm = mb_strpos($this['value'], '%') !== false ? $this['value'] : "%{$this['value']}%";
                 $issue_no = Issue::extractIssueNoFromNumber($this['value']);
                 if ($this['operator'] == '=') {
                     if ($ctn === null) {
                         $ctn = $crit->returnCriterion(tables\Issues::TITLE, $searchterm, Criteria::DB_LIKE);
                     }
                     $ctn->addOr(tables\Issues::DESCRIPTION, $searchterm, Criteria::DB_LIKE);
                     $ctn->addOr(tables\Issues::REPRODUCTION_STEPS, $searchterm, Criteria::DB_LIKE);
                     $ctn->addOr(tables\IssueCustomFields::OPTION_VALUE, $searchterm, Criteria::DB_LIKE);
                     if (is_numeric($issue_no)) {
                         $ctn->addOr(tables\Issues::ISSUE_NO, $issue_no, Criteria::DB_EQUALS);
                     }
                     $ctn->addOr(tables\IssueCustomFields::OPTION_VALUE, $searchterm, Criteria::DB_LIKE);
                     if (is_numeric($issue_no)) {
                         $ctn->addOr(tables\Issues::ISSUE_NO, $issue_no, Criteria::DB_EQUALS);
                     }
                     // $ctn->addOr(tables\IssueCustomFields::OPTION_VALUE, $searchterm, Criteria::DB_LIKE);
                 } else {
                     if ($ctn === null) {
                         $ctn = $crit->returnCriterion(tables\Issues::TITLE, $searchterm, Criteria::DB_NOT_LIKE);
                     }
                     $ctn->addWhere(tables\Issues::DESCRIPTION, $searchterm, Criteria::DB_NOT_LIKE);
                     $ctn->addWhere(tables\Issues::REPRODUCTION_STEPS, $searchterm, Criteria::DB_NOT_LIKE);
                     $ctn->addOr(tables\IssueCustomFields::OPTION_VALUE, $searchterm, Criteria::DB_NOT_LIKE);
                     if (is_numeric($issue_no)) {
                         $ctn->addWhere(tables\Issues::ISSUE_NO, $issue_no, Criteria::DB_EQUALS);
                     }
                     $ctn->addOr(tables\IssueCustomFields::OPTION_VALUE, $searchterm, Criteria::DB_NOT_LIKE);
                     if (is_numeric($issue_no)) {
                         $ctn->addWhere(tables\Issues::ISSUE_NO, $issue_no, Criteria::DB_EQUALS);
                     }
                     // $ctn->addOr(tables\IssueCustomFields::OPTION_VALUE, $searchterm, Criteria::DB_NOT_LIKE);
                 }
                 return $ctn;
             }
         } elseif (in_array($filter_key, self::getValidSearchFilters())) {
             if ($filter_key == 'subprojects') {
                 if (framework\Context::isProjectContext()) {
                     if ($ctn === null) {
                         $ctn = $crit->returnCriterion(tables\Issues::PROJECT_ID, framework\Context::getCurrentProject()->getID());
                     }
                     if ($this->hasValue()) {
                         foreach ($this->getValues() as $value) {
                             switch ($value) {
                                 case 'all':
                                     $subprojects = Project::getIncludingAllSubprojectsAsArray(framework\Context::getCurrentProject());
                                     foreach ($subprojects as $subproject) {
                                         if ($subproject->getID() == framework\Context::getCurrentProject()->getID()) {
                                             continue;
                                         }
                                         $ctn->addOr(tables\Issues::PROJECT_ID, $subproject->getID());
                                     }
                                     break;
                                 case 'none':
                                 case '':
                                     break;
                                 default:
                                     $ctn->addOr(tables\Issues::PROJECT_ID, (int) $value);
                                     break;
                             }
                         }
                     }
                     return $ctn;
                 }
             } elseif (in_array($filter_key, array('build', 'edition', 'component'))) {
                 switch ($filter_key) {
                     case 'component':
                         $tbl = tables\IssueAffectsComponent::getTable();
                         $fk = tables\IssueAffectsComponent::ISSUE;
                         break;
                     case 'edition':
                         $tbl = tables\IssueAffectsEdition::getTable();
                         $fk = tables\IssueAffectsEdition::ISSUE;
                         break;
                     case 'build':
                         $tbl = tables\IssueAffectsBuild::getTable();
                         $fk = tables\IssueAffectsBuild::ISSUE;
                         break;
                 }
                 $crit->addJoin($tbl, $fk, tables\Issues::ID, array(array($tbl->getB2DBAlias() . '.' . $filter_key, $this->getValues())), \b2db\Criteria::DB_INNER_JOIN);
                 return null;
             } else {
                 if ($filter_key == 'project_id' && in_array('subprojects', $filters)) {
                     return null;
                 }
                 $values = $this->getValues();
                 $num_values = 0;
                 if ($filter_key == 'status') {
                     if ($this->hasValue('open')) {
                         $c = $crit->returnCriterion(tables\Issues::STATE, Issue::STATE_OPEN);
                         $num_values++;
                     }
                     if ($this->hasValue('closed')) {
                         $num_values++;
                         if (isset($c)) {
                             $c->addWhere(tables\Issues::STATE, Issue::STATE_CLOSED);
                         } else {
                             $c = $crit->returnCriterion(tables\Issues::STATE, Issue::STATE_CLOSED);
                         }
                     }
                     if (isset($c)) {
                         if (count($values) == $num_values) {
                             return $c;
                         } else {
                             $crit->addWhere($c);
                         }
                     }
                 }
                 $dbname = tables\Issues::getTable()->getB2DBName();
                 foreach ($values as $value) {
                     $operator = $this['operator'];
                     $or = true;
                     if ($filter_key == 'status' && in_array($value, array('open', 'closed'))) {
                         continue;
                     } else {
                         $field = $dbname . '.' . $filter_key;
                         if ($operator == '!=' || in_array($filter_key, array('posted', 'last_updated'))) {
                             $or = false;
                         }
                     }
                     if ($ctn === null) {
                         $ctn = $crit->returnCriterion($field, $value, urldecode($operator));
                     } elseif ($or) {
                         $ctn->addOr($field, $value, urldecode($operator));
                     } else {
                         $ctn->addWhere($field, $value, urldecode($operator));
                     }
                 }
                 return $ctn;
             }
         } elseif (CustomDatatype::doesKeyExist($filter_key)) {
             $customdatatype = CustomDatatype::getByKey($filter_key);
             if (in_array($this->getFilterType(), CustomDatatype::getInternalChoiceFieldsAsArray())) {
                 $tbl = clone tables\IssueCustomFields::getTable();
                 $crit->addJoin($tbl, tables\IssueCustomFields::ISSUE_ID, tables\Issues::ID, array(array($tbl->getB2DBAlias() . '.customfields_id', $customdatatype->getID()), array($tbl->getB2DBAlias() . '.customfieldoption_id', $this->getValues())), \b2db\Criteria::DB_INNER_JOIN);
                 return null;
             } else {
                 foreach ($this->getValues() as $value) {
                     if ($customdatatype->hasCustomOptions()) {
                         if ($ctn === null) {
                             $ctn = $crit->returnCriterion(tables\IssueCustomFields::CUSTOMFIELDS_ID, $customdatatype->getID());
                             $ctn->addWhere(tables\IssueCustomFields::CUSTOMFIELDOPTION_ID, $value, $this['operator']);
                         } else {
                             $ctn->addOr(tables\IssueCustomFields::CUSTOMFIELDOPTION_ID, $value, $this['operator']);
                         }
                     } else {
                         if ($ctn === null) {
                             $ctn = $crit->returnCriterion(tables\IssueCustomFields::CUSTOMFIELDS_ID, $customdatatype->getID());
                             $ctn->addWhere(tables\IssueCustomFields::OPTION_VALUE, $value, $this['operator']);
                         } else {
                             $ctn->addOr(tables\IssueCustomFields::OPTION_VALUE, $value, $this['operator']);
                         }
                     }
                 }
                 return $ctn;
             }
         }
     }
 }
            <?php 
        }
        ?>
        <?php 
    }
    ?>
        <?php 
    if (!$search_object->hasQuickfoundIssues() && $search_object->getTotalNumberOfIssues() > $search_object->getNumberOfIssues()) {
        ?>
            <li class="find_more_issues last">
                <span class="informal"><?php 
        echo __('See %num more issues ...', array('%num' => $search_object->getTotalNumberOfIssues() - $search_object->getNumberOfIssues()));
        ?>
</span>
                <div class="hidden url"><?php 
        echo \thebuggenie\core\framework\Context::isProjectContext() ? make_url('project_issues', array('project_key' => \thebuggenie\core\framework\Context::getCurrentProject()->getKey())) : make_url('search');
        ?>
?fs[text][v]=<?php 
        echo $searchterm;
        ?>
&fs[text][o]=<?php 
        echo urlencode('=');
        ?>
</div>
            </li>
        <?php 
    }
    ?>
    <?php 
} else {
    ?>
Example #22
0
 public function runFindArticles(framework\Request $request)
 {
     $this->articlename = $request['articlename'];
     if ($this->articlename) {
         list($this->resultcount, $this->articles) = Article::findArticlesByContentAndProject($this->articlename, framework\Context::getCurrentProject(), 10);
     }
 }
<?php

$article_name = isset($article_name) ? $article_name : '';
if (!\thebuggenie\core\framework\Context::isProjectContext() || \thebuggenie\core\framework\Context::isProjectContext() && mb_strtolower($article_name) != mb_strtolower(\thebuggenie\core\framework\Context::getCurrentProject()->getKey() . ':mainpage')) {
    if (\thebuggenie\core\framework\Context::isProjectContext()) {
        $tbg_response->addBreadcrumb(\thebuggenie\core\framework\Context::getModule('publish')->getMenuTitle(), make_url('publish_article', array('article_name' => \thebuggenie\core\framework\Context::getCurrentProject()->getKey() . ':MainPage')));
    } else {
        $tbg_response->addBreadcrumb(\thebuggenie\core\framework\Context::getModule('publish')->getMenuTitle(), make_url('publish_article', array('article_name' => 'MainPage')));
    }
    $items = explode(':', $article_name);
    $bcpath = array_shift($items);
    if (mb_strtolower($bcpath) == 'category') {
        $tbg_response->addBreadcrumb(__('Categories'));
        if (\thebuggenie\core\framework\Context::isProjectContext()) {
            $bcpath .= ":" . array_shift($items);
        }
    } elseif (!\thebuggenie\core\framework\Context::isProjectContext() && mb_strtolower($bcpath) != 'mainpage') {
        $tbg_response->addBreadcrumb($bcpath, make_url('publish_article', array('article_name' => $bcpath)));
    }
    foreach ($items as $bc_name) {
        $bcpath .= ":" . $bc_name;
        $tbg_response->addBreadcrumb($bc_name, make_url('publish_article', array('article_name' => $bcpath)));
    }
} else {
    $tbg_response->addBreadcrumb(\thebuggenie\core\framework\Context::getModule('publish')->getMenuTitle(), make_url('publish_article', array('article_name' => \thebuggenie\core\framework\Context::getCurrentProject()->getKey() . ':MainPage')));
}
function tbg_get_pagename($page)
{
    $links = tbg_get_breadcrumblinks('project_summary', \thebuggenie\core\framework\Context::getCurrentProject());
    return isset($links[$page]) && $page != 'project_issues' ? $links[$page]['title'] : __('Dashboard');
}
        }
        ?>
                        <?php 
        echo link_tag(make_url('client_dashboard', array('client_id' => $client->getID())), image_tag('tab_clients.png') . $client->getName());
        ?>
                    <?php 
    }
    ?>
                </div>
            </li>
        <?php 
}
?>
        <?php 
framework\Event::createNew('core', 'templates/headermainmenu::projectmenulinks', framework\Context::getCurrentProject())->trigger();
?>
    </ul>
    <?php 
if (framework\Context::isProjectContext() && !framework\Context::getCurrentProject()->isArchived() && !framework\Context::getCurrentProject()->isLocked() && ($tbg_user->canReportIssues() || $tbg_user->canReportIssues(framework\Context::getCurrentProject()->getID()))) {
    ?>
        <div class="reportissue_button_container">
        <?php 
    echo javascript_link_tag(image_tag('icon-mono-add.png') . __('Report an issue'), array('onclick' => "TBG.Issues.Add('" . make_url('get_partial_for_backdrop', array('key' => 'reportissue', 'project_id' => framework\Context::getCurrentProject()->getId())) . "');", 'class' => 'button button-lightblue', 'id' => 'reportissue_button'));
    ?>
        </div>
    <?php 
}
framework\Event::createNew('core', 'before_header_userinfo')->trigger();
?>
</nav>
                    <li class="separator"></li>
                    <li><?php 
        echo javascript_link_tag(__('Delete'), array('onclick' => "TBG.Main.Helpers.Dialog.show('" . __('Do you really want to delete this milestone?') . "', '" . __('Removing this milestone will unassign all issues from this milestone and remove it from all available lists. This action cannot be undone.') . "', {yes: {click: function() { TBG.Project.Milestone.remove('" . make_url('project_milestone', array('project_key' => $milestone->getProject()->getKey(), 'milestone_id' => $milestone->getID())) . "', " . $milestone->getID() . "); } }, no: {click: TBG.Main.Helpers.Dialog.dismiss} });"));
        ?>
</li>
                </ul>
            </div>
        <?php 
    }
    ?>
        <div class="button-group" style="float: right;">
            <?php 
    if ($milestone->getID()) {
        ?>
                <?php 
        echo link_tag(make_url('project_issues', array('project_key' => \thebuggenie\core\framework\Context::getCurrentProject()->getKey(), 'search' => true, 'fs[milestone]' => array('o' => '=', 'v' => $milestone->getId()))) . "?sortfields=issues.last_updated=asc", __('Show issues'), array('class' => 'button button-silver', 'title' => __('Show issues')));
        ?>
            <?php 
    }
    ?>
        </div>
    <?php 
}
?>
    <div class="milestone_description">
        <?php 
echo $milestone->getDescription();
?>
    </div>
</div>
Example #27
0
 public function doSave($options = array(), $reason = null)
 {
     if (tables\Articles::getTable()->doesNameConflictExist($this->_name, $this->_id, framework\Context::getScope()->getID())) {
         if (!array_key_exists('overwrite', $options) || !$options['overwrite']) {
             throw new \Exception(framework\Context::getI18n()->__('Another article with this name already exists'));
         }
     }
     $user_id = framework\Context::getUser() instanceof User ? framework\Context::getUser()->getID() : 0;
     if (!isset($options['revert']) || !$options['revert']) {
         $revision = tables\ArticleHistory::getTable()->addArticleHistory($this->_name, $this->_old_content, $this->_content, $user_id, $reason);
     } else {
         $revision = null;
     }
     tables\ArticleLinks::getTable()->deleteLinksByArticle($this->_name);
     ArticleCategories::getTable()->deleteCategoriesByArticle($this->_name);
     if ($this->getArticleType() == self::TYPE_MANUAL && isset($options['article_prev_name']) && $this->_name != $options['article_prev_name']) {
         $manual_articles = Articles::getTable()->getManualSidebarArticles(framework\Context::getCurrentProject(), $options['article_prev_name']);
         foreach ($manual_articles as $manual_article) {
             $manual_article->setName(str_replace($options['article_prev_name'], $this->_name, $manual_article->getName()));
             $manual_article->doSave();
         }
     }
     $this->save();
     $this->_old_content = $this->_content;
     if (mb_substr($this->getContent(), 0, 10) == "#REDIRECT ") {
         $content = explode("\n", $this->getContent());
         preg_match('/(\\[\\[([^\\]]*?)\\]\\])$/im', mb_substr(array_shift($content), 10), $matches);
         if (count($matches) == 3) {
             return;
         }
     }
     list($links, $categories) = $this->_retrieveLinksAndCategoriesFromContent($options);
     foreach ($links as $link => $occurrences) {
         tables\ArticleLinks::getTable()->addArticleLink($this->_name, $link);
     }
     foreach ($categories as $category => $occurrences) {
         ArticleCategories::getTable()->addArticleCategory($this->_name, $category, $this->isCategory());
     }
     $this->_history = null;
     \thebuggenie\core\framework\Event::createNew('core', 'thebuggenie\\modules\\publish\\entities\\Article::doSave', $this, compact('reason', 'revision', 'user_id'))->trigger();
     return true;
 }
Example #28
0
                                <?php 
    echo __('Comments (%count)', array('%count' => '<span id="viewissue_comment_count"></span>'));
    ?>
                                <div class="dropper_container">
                                    <?php 
    echo image_tag('icon-mono-settings.png', array('class' => 'dropper'));
    ?>
                                    <ul class="more_actions_dropdown dropdown_box popup_box leftie">
                                        <li><a href="javascript:void(0);" id="comments_show_system_comments_toggle" onclick="$$('#comments_box .system_comment').each(function (elm) { $(elm).toggle(); });" /><?php 
    echo __('Toggle system-generated comments');
    ?>
</a></li>
                                    </ul>
                                </div>
                                <?php 
    if ($tbg_user->canPostComments() && (\thebuggenie\core\framework\Context::isProjectContext() && !\thebuggenie\core\framework\Context::getCurrentProject()->isArchived() || !\thebuggenie\core\framework\Context::isProjectContext())) {
        ?>
                                    <ul class="simple_list button_container" id="add_comment_button_container">
                                        <li id="comment_add_button"><input class="button button-silver first last" type="button" onclick="TBG.Main.Comment.showPost();" value="<?php 
        echo __('Post comment');
        ?>
"></li>
                                    </ul>
                                <?php 
    }
    ?>
                            </legend>
                            <div id="viewissue_comments">
                                <?php 
    include_component('main/comments', array('target_id' => $issue->getID(), 'mentionable_target_type' => 'issue', 'target_type' => \thebuggenie\core\entities\Comment::TYPE_ISSUE, 'show_button' => false, 'comment_count_div' => 'viewissue_comment_count', 'save_changes_checked' => $issue->hasUnsavedChanges(), 'issue' => $issue, 'forward_url' => make_url('viewissue', array('project_key' => $issue->getProject()->getKey(), 'issue_no' => $issue->getFormattedIssueNo()), false)));
    ?>
    ?>
">
                </form>
            </div>
            <?php 
    if (count(\thebuggenie\core\entities\Project::getAll()) > (int) \thebuggenie\core\framework\Context::isProjectContext()) {
        ?>
                <div class="header"><?php 
        echo __('Project wikis');
        ?>
</div>
                <?php 
        foreach (\thebuggenie\core\entities\Project::getAll() as $project) {
            ?>
                    <?php 
            if (!$project->hasAccess() || isset($project_url) && $project->getID() == \thebuggenie\core\framework\Context::getCurrentProject()->getID()) {
                continue;
            }
            ?>
                    <?php 
            if (!$project->hasWikiURL()) {
                ?>
                        <?php 
                echo link_tag(make_url('publish_article', array('article_name' => ucfirst($project->getKey()) . ':MainPage')), $project->getName());
                ?>
                    <?php 
            } else {
                ?>
                        <?php 
                echo link_tag($project->getWikiURL(), $project->getName(), array('target' => 'blank'));
                ?>
Example #30
0
 protected function _populateOptions()
 {
     if ($this->_options === null) {
         if ($this->hasCustomOptions()) {
             $this->_b2dbLazyload('_options');
         } else {
             switch ($this->getType()) {
                 case self::RELEASES_CHOICE:
                     $this->_options = framework\Context::isProjectContext() ? framework\Context::getCurrentProject()->getBuilds() : \thebuggenie\core\entities\tables\Builds::getTable()->selectAll();
                     break;
                 case self::COMPONENTS_CHOICE:
                     $this->_options = framework\Context::isProjectContext() ? framework\Context::getCurrentProject()->getComponents() : \thebuggenie\core\entities\tables\Components::getTable()->selectAll();
                     break;
                 case self::EDITIONS_CHOICE:
                     $this->_options = framework\Context::isProjectContext() ? framework\Context::getCurrentProject()->getEditions() : \thebuggenie\core\entities\tables\Editions::getTable()->selectAll();
                     break;
                 case self::MILESTONE_CHOICE:
                     $this->_options = framework\Context::isProjectContext() ? framework\Context::getCurrentProject()->getMilestonesForIssues() : \thebuggenie\core\entities\tables\Milestones::getTable()->selectAll();
                     break;
                 case self::STATUS_CHOICE:
                     $this->_options = \thebuggenie\core\entities\Status::getAll();
                     break;
             }
         }
     }
 }