public function _postSave($is_new) { if ($is_new) { TBGContext::setPermission("canseecomponent", $this->getID(), "core", 0, TBGContext::getUser()->getGroup()->getID(), 0, true); TBGEvent::createNew('core', 'TBGComponent::createNew', $this)->trigger(); } }
<?php } ?> <?php if ($tbg_user->hasPageAccess('project_roadmap', $project->getID()) || $tbg_user->hasPageAccess('project_allpages', $project->getID())) { ?> <?php echo link_tag(make_url('project_roadmap', array('project_key' => $project->getKey())), __('Show roadmap')); ?> <?php } ?> <?php TBGEvent::createNew('core', 'project_overview_item_links', $project)->trigger(); ?> </td> <td style="font-weight: normal; vertical-align: top; position: relative;"> <?php if ($tbg_user->canReportIssues($project)) { ?> <div class="nice_button report_button" style="float: right; overflow: visible;"> <input type="submit" value="<?php echo __('Report an issue'); ?> "> <div class="report_button_hover rounded_box green shadowed borderless"> <div class="tab_menu_dropdown"> <?php $cc = 1;
TBGEvent::createNew('core', 'viewissue_left_after_attachments', $issue)->trigger(); ?> <fieldset id="viewissue_related_information_container"> <legend> <?php echo image_tag('spinning_16.gif', array('style' => 'display: none;', 'id' => 'related_issues_indicator')) . __('Child issues (%count)', array('%count' => '<span id="viewissue_related_issues_count">' . count($issue->getChildIssues()) . '</span>')); ?> </legend> <div id="viewissue_related_information"> <?php include_component('main/relatedissues', array('issue' => $issue)); ?> </div> </fieldset> <fieldset id="viewissue_duplicate_issues_container"> <legend> <?php echo image_tag('spinning_16.gif', array('style' => 'display: none;', 'id' => 'duplicate_issues_indicator')) . __('Duplicate issues (%count)', array('%count' => '<span id="viewissue_duplicate_issues_count">' . $issue->getNumberOfDuplicateIssues() . '</span>')); ?> </legend> <div id="viewissue_duplicate_issues"> <?php include_component('main/duplicateissues', array('issue' => $issue)); ?> </div> </fieldset> <?php TBGEvent::createNew('core', 'viewissue_left_bottom', $issue)->trigger(); ?> <div style="clear: both; margin-bottom: 5px;"> </div>
if (TBGEvent::createNew('core', 'header_usermenu_decider')->trigger()->getReturnValue() !== false) { ?> <?php require THEBUGGENIE_CORE_PATH . 'templates/headerusermenu.inc.php'; ?> <?php } ?> </li> <?php TBGEvent::createNew('core', 'after_header_userinfo')->trigger(); ?> </ul> </nav> <?php if (TBGEvent::createNew('core', 'header_mainmenu_decider')->trigger()->getReturnValue() !== false) { ?> <?php require THEBUGGENIE_CORE_PATH . 'templates/submenu.inc.php'; ?> <?php } ?> <?php TBGEvent::createNew('core', 'header_menu_end')->trigger(); ?> <?php } ?> </header>
public function hasAccess() { $issue_ids = TBGIssueFilesTable::getTable()->getIssuesByFileID($this->getID()); foreach ($issue_ids as $issue_id) { $issue = new TBGIssue($issue_id); if ($issue->hasAccess()) { return true; } } $event = TBGEvent::createNew('core', 'TBGFile::hasAccess', $this); $event->setReturnValue(false); $event->triggerUntilProcessed(); return $event->getReturnValue(); }
><?php echo javascript_link_tag(__('Editions and components'), array('onclick' => "TBG.Main.Helpers.tabSwitcher('tab_hierarchy', 'project_config_menu');")); ?> </li> <li id="tab_developers"<?php if ($selected_tab == 'developers') { ?> class="selected"<?php } ?> ><?php echo javascript_link_tag(__('Team'), array('onclick' => "TBG.Main.Helpers.tabSwitcher('tab_developers', 'project_config_menu');")); ?> </li> <li id="tab_permissions"<?php if ($selected_tab == 'permissions') { ?> class="selected"<?php } ?> ><?php echo javascript_link_tag(__('Roles and permissions'), array('onclick' => "TBG.Main.Helpers.tabSwitcher('tab_permissions', 'project_config_menu');")); ?> </li> <?php TBGEvent::createNew('core', 'config_project_tabs')->trigger(array('selected_tab' => $selected_tab)); ?> </ul> <?php } }
} else { ?> <ul id="dashboard"> <?php foreach ($views as $id => $view) { ?> <li style="clear: none;" id="dashboard_container_<?php echo $id; ?> "> <?php include_component('main/dashboardview', array('view' => $view, 'show' => false)); ?> </li> <?php } ?> </ul> <?php include_template('main/dashboardjavascript'); ?> <?php } ?> <?php TBGEvent::createNew('core', 'project_dashboard_bottom')->trigger(); ?> </td> </tr> </table>
?> </a> <?php } else { ?> <span class="faded_out"><?php echo __('No documentation URL provided'); ?> </span> <?php } ?> </td> </tr> <?php TBGEvent::createNew('core', 'configuration/projectinfo', $project)->trigger(); if ($access_level == TBGSettings::ACCESS_FULL) { ?> <tr> <td colspan="2" style="padding: 10px 0 10px 10px; text-align: right;"> <div style="float: left; font-size: 13px; padding-top: 2px; font-style: italic;" class="config_explanation"><?php echo __('When you are done, click "%save%" to save your changes', array('%save%' => __('Save'))); ?> </div> <input type="submit" id="project_submit_settings_button" style="float: right; padding: 0 10px 0 10px; font-size: 14px; font-weight: bold;" value="<?php echo __('Save'); ?> "> <span id="project_info_indicator" style="display: none; float: right;"><?php echo image_tag('spinning_20.gif'); ?>
<br> <input type="submit" id="login_button" value="<?php echo __('Continue'); ?> "> <span id="login_indicator" style="display: none;"><?php echo image_tag('spinning_20.gif'); ?> </span> </div> </form> </div> </div> </div> <?php TBGEvent::createNew('core', 'login_form_pane')->trigger(array_merge(array('selected_tab' => $selected_tab), $options)); ?> <?php if (TBGSettings::get('allowreg') == true) { ?> <?php include_template('main/loginregister', array('selected_tab' => $selected_tab)); ?> <?php } ?> </div> <div id="backdrop_detail_indicator" style="text-align: center; padding: 50px; display: none;"> <?php echo image_tag('spinning_32.gif'); ?>
echo link_tag(make_url('switch_back_user'), image_tag('switchuser.png') . __('Switch back to original user')); ?> <?php } ?> <?php if ($tbg_user->canAccessConfigurationPage()) { ?> <?php echo link_tag(make_url('configure'), image_tag('tab_config.png') . __('Configure %thebuggenie_name', array('%thebuggenie_name' => TBGSettings::getTBGname()))); ?> <?php } ?> <?php TBGEvent::createNew('core', 'user_dropdown_reg')->trigger(); ?> <?php echo link_tag('http://www.thebuggenie.com/help/' . TBGContext::getRouting()->getCurrentRouteName(), image_tag('help.png') . __('Help for this page'), array('id' => 'global_help_link')); ?> <a href="<?php echo make_url('logout'); ?> " onclick="<?php if (TBGSettings::isPersonaAvailable()) { ?> if (navigator.id) { navigator.id.logout();return false; }<?php } ?> "><?php echo image_tag('logout.png') . __('Logout');
<div class="project_header"> <div class="project_header_right button-group"> <?php TBGEvent::createNew('core', 'project_header_buttons')->trigger(); ?> <?php if ($selected_project->hasDownloads() && $tbg_response->getPage() != 'project_releases') { ?> <?php echo link_tag(make_url('project_releases', array('project_key' => $selected_project->getKey())), image_tag('icon_download.png') . __('Download'), array('class' => 'button button-orange')); ?> <?php } ?> <?php if ($selected_project->hasParent()) { ?> <?php echo link_tag(make_url('project_dashboard', array('project_key' => $selected_project->getParent()->getKey())), image_tag($selected_project->getParent()->getSmallIconName(), array('style' => 'width: 16px; height: 16px;'), $selected_project->getParent()->hasSmallIcon()) . __('Up to %parent', array('%parent' => $selected_project->getParent()->getName())), array('class' => 'button button-silver')); ?> <?php } ?> </div> <div class="project_header_left"> <div id="project_name"> <?php echo image_tag($selected_project->getLargeIconName(), array('class' => 'logo', 'style' => 'width: 32px; height: 32px;'), $selected_project->hasLargeIcon()); ?> <span id="project_name_span"><?php echo $selected_project->getName();
<td> <select name="<?php echo TBGSettings::SETTING_RETURN_FROM_LOGOUT; ?> " id="returnfromlogout" style="width: 400px;"<?php if ($access_level != TBGSettings::ACCESS_FULL) { ?> disabled<?php } ?> > <?php $return_routes = array('home' => __('Frontpage')); ?> <?php $return_routes = TBGEvent::createNew('core', 'setting_returnfromlogout', null, array(), $return_routes)->trigger()->getReturnList(); ?> <?php foreach ($return_routes as $route => $description) { ?> <option value="<?php echo $route; ?> "<?php if (TBGSettings::getLogoutReturnRoute() == $route) { ?> selected<?php } ?> ><?php
echo __('%user_name posted a %comment on %article_name', array('%user_name' => get_component_html('main/userdropdown', array('user' => $notification->getTriggeredByUser())), '%comment' => link_tag(make_url('publish_article', array('article_name' => $notification->getTarget()->getTarget()->getName())) . '#comment_' . $notification->getTarget()->getID(), __('%username_posted_a comment %on_issue', array('%username_posted_a' => '', '%on_issue' => ''))), '%article_name' => link_tag(make_url('publish_article', array('article_name' => $notification->getTarget()->getTarget()->getName())), $notification->getTarget()->getTarget()->getName()))); ?> </h1> <?php break; case TBGNotification::TYPE_ARTICLE_UPDATED: ?> <h1> <time><?php echo tbg_formatTime($notification->getCreatedAt(), 20); ?> </time> <?php echo __('%user_name updated %article_name', array('%user_name' => get_component_html('main/userdropdown', array('user' => $notification->getTriggeredByUser())), '%article_name' => link_tag(make_url('publish_article', array('article_name' => $notification->getTarget()->getTarget()->getName())), $notification->getTarget()->getTarget()->getName()))); ?> </h1> <?php break; default: TBGEvent::createNew('core', '_notification_view', $notification)->trigger(); } ?> </li> <?php } ?> <?php } ?> </ul>
protected function _postSave($is_new) { if ($is_new) { TBGContext::setPermission("canseemilestone", $this->getID(), "core", 0, TBGContext::getUser()->getGroup()->getID(), 0, true); TBGEvent::createNew('core', 'TBGMilestone::_postSave', $this)->trigger(); } }
echo __('Loading, please wait'); ?> " style="cursor: pointer;" title="<?php echo __('Show details'); ?> "></td> <td style="width: 34%; padding: 1px;"><img src="#" onclick="TBG.Project.Statistics.toggleImage(3);" id="statistics_mini_image_3" alt="<?php echo __('Loading, please wait'); ?> " style="cursor: pointer;" title="<?php echo __('Show details'); ?> "></td> </tr> </table> <input type="hidden" id="statistics_mini_1_main" value=""> <input type="hidden" id="statistics_mini_2_main" value=""> <input type="hidden" id="statistics_mini_3_main" value=""> <?php TBGEvent::createNew('core', 'projectstatistics_image', $selected_project)->trigger(); ?> </div> <div class="rounded_box verylightgrey borderless" style="width: 690px; text-align: center; padding: 150px 5px 150px 5px; color: #AAA; font-size: 19px;" id="statistics_help"> <?php echo __('Select an item in the left menu to show more details'); ?> </div> </td> </tr> </table>
_link').show();$('<?php echo $customdatatype->getKey(); ?> _additional_div').hide();$('<?php echo $customdatatype->getKey(); ?> _id_additional').setValue(0);"><?php echo image_tag('undo.png', array('style' => 'float: none; margin-left: 5px;')); ?> </a> <?php } ?> </div> </li> <?php } ?> <?php TBGEvent::createNew('core', 'reportissue.listfields')->trigger(); ?> </ul> <div style="clear: both;"> </div> </div> </div> <?php } ?> </form> </div>
?> </div> <?php } ?> <div style="padding: 2px;"> <a href="javascript:void(0);" onclick="showFadedBackdrop('<?php echo make_url('get_partial_for_backdrop', array('key' => 'usercard', 'user_id' => $user->getID())); ?> ');$('bud_<?php echo $user->getUsername() . "_" . $rnd_no; ?> ').hide();"><?php echo __('Show user details'); ?> </a> </div> <?php TBGEvent::createNew('core', 'useractions_bottom', $user)->trigger(); ?> </div> <div style="text-align: right; padding: 3px; font-size: 9px;"><a href="javascript:void(0);" onclick="$('bud_<?php echo $user->getUsername() . "_" . $rnd_no; ?> ').toggle();"><?php echo __('Close this menu'); ?> </a></div> </div> <?php }
public function addScope(TBGScope $scope, $notify = true) { if (!$this->isMemberOfScope($scope)) { TBGUserScopesTable::getTable()->addUserToScope($this->getID(), $scope->getID()); if ($notify) { TBGEvent::createNew('core', 'TBGUser::addScope', $this, array('scope' => $scope))->trigger(); } $this->_scopes = null; $this->_unconfirmed_scopes = null; $this->_confirmed_scopes = null; } }
public static function getTemplates() { $templates = array('main/updateissueproperties' => 'Set issue properties or add comment'); $event = TBGEvent::createNew('core', 'workflow_templates', null, array(), $templates)->trigger(); return $event->getReturnList(); }
public function runAddUser(TBGRequest $request) { try { if (!TBGContext::getScope()->hasUsersAvailable()) { throw new Exception($this->getI18n()->__('This instance of The Bug Genie cannot add more users')); } if ($username = trim($request['username'])) { if (!TBGUser::isUsernameAvailable($username)) { if ($request->getParameter('mode') == 'import') { $user = TBGUser::getByUsername($username); $user->addScope(TBGContext::getScope()); return $this->renderJSON(array('imported' => true, 'message' => $this->getI18n()->__('The user was successfully added to this scope (pending user confirmation)'))); } elseif (TBGContext::getScope()->isDefault()) { throw new Exception($this->getI18n()->__('This username already exists')); } else { $this->getResponse()->setHttpStatus(400); return $this->renderJSON(array('allow_import' => true)); } } $user = new TBGUser(); $user->setUsername($username); $user->setRealname($request->getParameter('realname', $username)); $user->setBuddyname($request->getParameter('buddyname', $username)); $user->setEmail($request->getParameter('email')); $user->setGroup(TBGGroupsTable::getTable()->selectById((int) $request->getParameter('group_id', TBGSettings::get(TBGSettings::SETTING_USER_GROUP)))); $user->setEnabled(); $user->setActivated(); if ($request->hasParameter('password') && !(empty($request['password']) && empty($request['password_repeat']))) { if (empty($request['password']) || $request['password'] != $request['password_repeat']) { throw new Exception($this->getI18n()->__('Please enter the same password twice')); } $password = $request['password']; $user->setPassword($password); } else { $password = TBGUser::createPassword(); $user->setPassword($password); } $user->setJoined(); $user->save(); foreach ((array) $request['teams'] as $team_id) { $user->addToTeam(TBGTeamsTable::getTable()->selectById((int) $team_id)); } TBGEvent::createNew('core', 'config.createuser.save', $user, array('password' => $password))->trigger(); } else { throw new Exception($this->getI18n()->__('Please enter a username')); } $this->getResponse()->setTemplate('configuration/findusers'); $this->too_short = false; $this->created_user = true; $this->users = array($user); $this->total_results = 1; $this->title = $this->getI18n()->__('User %username created', array('%username' => $username)); $this->total_count = TBGUser::getUsersCount(); $this->more_available = TBGContext::getScope()->hasUsersAvailable(); } catch (Exception $e) { $this->getResponse()->setHttpStatus(400); return $this->renderJSON(array('error' => $e->getMessage())); } }
/** * Constructor function * * @param B2DBRow $row */ public function _construct(B2DBRow $row, $foreign_key = null) { TBGEvent::createNew('core', 'TBGProject::__construct', $this)->trigger(); }
public function loadArticles($namespace = '', $overwrite = true, $scope = null) { $scope = TBGContext::getScope()->getID(); $namespace = strtolower($namespace); $_path_handle = opendir(THEBUGGENIE_MODULES_PATH . 'publish' . DS . 'fixtures' . DS); while ($original_article_name = readdir($_path_handle)) { if (strpos($original_article_name, '.') === false) { $article_name = strtolower($original_article_name); $imported = false; $import = false; if ($namespace) { if (strpos(urldecode($article_name), "{$namespace}:") === 0 || strpos(urldecode($article_name), "category:") === 0 && strpos(urldecode($article_name), "{$namespace}:") === 9) { $import = true; } } else { if (strpos(urldecode($article_name), "category:help:") === 0) { $name_test = substr(urldecode($article_name), 14); } elseif (strpos(urldecode($article_name), "category:") === 0) { $name_test = substr(urldecode($article_name), 9); } else { $name_test = urldecode($article_name); } if (strpos($name_test, ':') === false) { $import = true; } } if ($import) { if (TBGContext::isCLI()) { TBGCliCommand::cli_echo('Saving ' . urldecode($original_article_name) . "\n"); } if ($overwrite) { TBGArticlesTable::getTable()->deleteArticleByName(urldecode($original_article_name)); } if (TBGArticlesTable::getTable()->getArticleByName(urldecode($original_article_name)) === null) { $content = file_get_contents(THEBUGGENIE_MODULES_PATH . 'publish' . DS . 'fixtures' . DS . $original_article_name); TBGWikiArticle::createNew(urldecode($original_article_name), $content, true, $scope, array('overwrite' => $overwrite, 'noauthor' => true)); $imported = true; } TBGEvent::createNew('publish', 'fixture_article_loaded', urldecode($original_article_name), array('imported' => $imported))->trigger(); } } } }
<?php include_component('dashboardview', array('view' => $view, 'show' => false)); ?> </li> <?php } ?> </ul> <?php include_template('main/dashboardjavascript'); ?> <?php } ?> <?php TBGEvent::createNew('core', 'dashboard_main_bottom')->trigger(); ?> </td> <td id="dashboard_righthand" class="side_bar<?php echo TBGSettings::getToggle('dashboard_righthand') ? ' collapsed' : ''; ?> "> <div class="collapser_link" onclick="TBG.Main.Dashboard.sidebar('<?php echo make_url('set_toggle_state', array('key' => 'dashboard_righthand', 'state' => '')); ?> ', 'dashboard_righthand');"> <a href="javascript:void(0);"> <?php echo image_tag('sidebar_expand.png', array('class' => 'collapser')); ?> <?php
public function doSave($options = array(), $reason = null) { if (TBGArticlesTable::getTable()->doesNameConflictExist($this->_name, $this->_id, TBGContext::getScope()->getID())) { if (!array_key_exists('overwrite', $options) || !$options['overwrite']) { throw new Exception(TBGContext::getI18n()->__('Another article with this name already exists')); } } $user_id = TBGContext::getUser() instanceof TBGUser ? TBGContext::getUser()->getID() : 0; if (!isset($options['revert']) || !$options['revert']) { $revision = TBGArticleHistoryTable::getTable()->addArticleHistory($this->_name, $this->_old_content, $this->_content, $user_id, $reason); } else { $revision = null; } TBGArticleLinksTable::getTable()->deleteLinksByArticle($this->_name); TBGArticleCategoriesTable::getTable()->deleteCategoriesByArticle($this->_name); $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) { TBGArticleLinksTable::getTable()->addArticleLink($this->_name, $link); } foreach ($categories as $category => $occurrences) { TBGArticleCategoriesTable::getTable()->addArticleCategory($this->_name, $category, $this->isCategory()); } $this->_history = null; TBGEvent::createNew('core', 'TBGWikiArticle::doSave', $this, compact('reason', 'revision', 'user_id'))->trigger(); return true; }
$link_text .= strlen($issue->getTitle()) > 43 ? substr($issue->getTitle(), 0, 40) . '...' : $issue->getTitle(); $classes = $issue->isClosed() ? 'issue_closed' : ''; ?> <?php echo link_tag(make_url('viewissue', array('project_key' => $issue->getProject()->getKey(), 'issue_no' => $issue->getFormattedIssueNo())), $link_text, array('class' => $classes)); ?> <?php } ?> <?php } ?> </div> </div> <?php TBGEvent::createNew('core', 'after_header_userinfo')->trigger(); ?> </div> </td> </tr> </table> <?php require THEBUGGENIE_CORE_PATH . 'templates/submenu.inc.php'; ?> <?php if (!TBGContext::isDebugMode()) { ?> <div class="rounded_box iceblue borderless infobox" style="margin: 5px; display: none;" id="firebug_warning"> <div style="padding: 5px;"> <?php echo image_tag('icon_info_big.png', array('style' => 'float: left; margin: 5px 5px 0 0;'));
public function getPredefinedBreadcrumbLinks($type, $project = null) { $i18n = TBGContext::getI18n(); $links = array(); switch ($type) { case 'main_links': $links[] = array('url' => TBGContext::getRouting()->generate('home'), 'title' => $i18n->__('Frontpage')); $links[] = array('url' => TBGContext::getRouting()->generate('dashboard'), 'title' => $i18n->__('Personal dashboard')); $links[] = array('title' => $i18n->__('Issues')); $links[] = array('title' => $i18n->__('Teams')); $links[] = array('title' => $i18n->__('Clients')); $links = TBGEvent::createNew('core', 'breadcrumb_main_links', null, array(), $links)->trigger()->getReturnList(); if (TBGContext::getUser()->canAccessConfigurationPage()) { $links[] = array('url' => make_url('configure'), 'title' => $i18n->__('Configure The Bug Genie')); } $links[] = array('url' => TBGContext::getRouting()->generate('about'), 'title' => $i18n->__('About %sitename%', array('%sitename%' => TBGSettings::getTBGname()))); $links[] = array('url' => TBGContext::getRouting()->generate('account'), 'title' => $i18n->__('Account details')); break; case 'project_summary': $links[] = array('url' => TBGContext::getRouting()->generate('project_dashboard', array('project_key' => $project->getKey())), 'title' => $i18n->__('Dashboard')); $links[] = array('url' => TBGContext::getRouting()->generate('project_scrum', array('project_key' => $project->getKey())), 'title' => $i18n->__('Sprint planning')); $links[] = array('url' => TBGContext::getRouting()->generate('project_roadmap', array('project_key' => $project->getKey())), 'title' => $i18n->__('Roadmap')); $links[] = array('url' => TBGContext::getRouting()->generate('project_team', array('project_key' => $project->getKey())), 'title' => $i18n->__('Team overview')); $links[] = array('url' => TBGContext::getRouting()->generate('project_statistics', array('project_key' => $project->getKey())), 'title' => $i18n->__('Statistics')); $links[] = array('url' => TBGContext::getRouting()->generate('project_timeline', array('project_key' => $project->getKey())), 'title' => $i18n->__('Timeline')); $links[] = array('url' => TBGContext::getRouting()->generate('project_reportissue', array('project_key' => $project->getKey())), 'title' => $i18n->__('Report an issue')); $links[] = array('url' => TBGContext::getRouting()->generate('project_issues', array('project_key' => $project->getKey())), 'title' => $i18n->__('Issues')); $links = TBGEvent::createNew('core', 'breadcrumb_project_links', null, array(), $links)->trigger()->getReturnList(); break; case 'client_list': foreach (TBGClient::getAll() as $client) { if ($client->hasAccess()) { $links[] = array('url' => TBGContext::getRouting()->generate('client_dashboard', array('client_id' => $client->getID())), 'title' => $client->getName()); } } break; case 'team_list': foreach (TBGTeam::getAll() as $team) { if ($team->hasAccess()) { $links[] = array('url' => TBGContext::getRouting()->generate('team_dashboard', array('team_id' => $team->getID())), 'title' => $team->getName()); } } break; } return $links; }
?> <?php echo $content; ?> <?php TBGLogging::log('done (rendering content)'); ?> </div> <?php TBGEvent::createNew('core', 'footer_begin')->trigger(); ?> <?php require THEBUGGENIE_CORE_PATH . 'templates/footer.inc.php'; ?> <?php TBGEvent::createNew('core', 'footer_end')->trigger(); ?> </div> <script type="text/javascript"> document.observe('dom:loaded', function() { var f_init = function() {TBG.initialize({ basepath: '<?php echo TBGContext::getTBGPath(); ?> ', data_url: '<?php echo make_url('userdata'); ?> ', autocompleter_url: '<?php echo TBGContext::isProjectContext() ? make_url('project_quicksearch', array('project_key' => TBGContext::getCurrentProject()->getKey())) : make_url('quicksearch'); ?> '})}; <?php
</span> <div class="hidden url"><?php echo TBGContext::isProjectContext() ? make_url('project_issues', array('project_key' => TBGContext::getCurrentProject()->getKey())) : make_url('search'); ?> ?fs[text][v]=<?php echo $searchterm; ?> &fs[text][o]=<?php echo urlencode('='); ?> </div> </li> <?php } ?> <?php } else { ?> <li class="disabled no_issues_found"> <?php echo __('No issues found matching your query'); ?> </li> <?php } ?> <?php TBGEvent::createNew('core', 'quicksearch_dropdown_founditems', $searchterm)->trigger(); ?> </ul>
echo __('Click "%save%" to save your profile settings', array('%save%' => __('Save'))); ?> </div> <input type="submit" id="submit_settings_button" style="float: right; padding: 0 10px 0 10px; font-size: 14px; font-weight: bold;" value="<?php echo __('Save'); ?> "> <span id="profile_settings_save_indicator" style="display: none; float: right;"><?php echo image_tag('spinning_20.gif'); ?> </span> </div> </form> </div> <?php TBGEvent::createNew('core', 'account_tab_panes')->trigger(); ?> <?php foreach (TBGContext::getModules() as $module_name => $module) { ?> <?php if ($module->hasAccountSettings()) { ?> <div id="tab_settings_<?php echo $module_name; ?> _pane" style="display: none;"> <form accept-charset="<?php echo TBGContext::getI18n()->getCharset(); ?> " action="<?php
public function runAddComment(TBGRequest $request) { $i18n = TBGContext::getI18n(); $comment_applies_type = $request['comment_applies_type']; try { if (!$this->getUser()->canPostComments()) { throw new Exception($i18n->__('You are not allowed to do this')); } if (!trim($request['comment_body'])) { throw new Exception($i18n->__('The comment must have some content')); } $comment = new TBGComment(); $comment->setTitle(''); $comment->setContent($request->getParameter('comment_body', null, false)); $comment->setPostedBy($this->getUser()->getID()); $comment->setTargetID($request['comment_applies_id']); $comment->setTargetType($request['comment_applies_type']); $comment->setReplyToComment($request['reply_to_comment_id']); $comment->setModuleName($request['comment_module']); $comment->setIsPublic((bool) $request['comment_visibility']); $comment->setSyntax($request['comment_body_syntax']); $comment->save(); if ($comment_applies_type == TBGComment::TYPE_ISSUE) { $issue = TBGIssuesTable::getTable()->selectById((int) $request['comment_applies_id']); if (!$request->isAjaxCall() || $request['comment_save_changes']) { $issue->setSaveComment($comment); $issue->save(); } else { TBGEvent::createNew('core', 'TBGComment::createNew', $comment, compact('issue'))->trigger(); } } elseif ($comment_applies_type == TBGComment::TYPE_ARTICLE) { $article = TBGArticlesTable::getTable()->selectById((int) $request['comment_applies_id']); TBGEvent::createNew('core', 'TBGComment::createNew', $comment, compact('article'))->trigger(); } switch ($comment_applies_type) { case TBGComment::TYPE_ISSUE: $comment_html = $this->getTemplateHTML('main/comment', array('comment' => $comment, 'issue' => TBGContext::factory()->TBGIssue($request['comment_applies_id']))); break; case TBGComment::TYPE_ARTICLE: $comment_html = $this->getTemplateHTML('main/comment', array('comment' => $comment)); break; default: $comment_html = 'OH NO!'; } } catch (Exception $e) { if ($request->isAjaxCall()) { $this->getResponse()->setHttpStatus(400); return $this->renderJSON(array('error' => $e->getMessage())); } else { TBGContext::setMessage('comment_error', $e->getMessage()); TBGContext::setMessage('comment_error_body', $request['comment_body']); TBGContext::setMessage('comment_error_title', $request['comment_title']); TBGContext::setMessage('comment_error_visibility', $request['comment_visibility']); } } if ($request->isAjaxCall()) { return $this->renderJSON(array('title' => $i18n->__('Comment added!'), 'comment_data' => $comment_html, 'continue_url' => $request['forward_url'], 'commentcount' => TBGComment::countComments($request['comment_applies_id'], $request['comment_applies_type']))); } if (isset($comment) && $comment instanceof TBGComment) { $this->forward($request['forward_url'] . "#comment_{$request['comment_applies_type']}_{$request['comment_applies_id']}_{$comment->getID()}"); } else { $this->forward($request['forward_url']); } }