示例#1
0
/**
 * Handle on prepare project overview event
 *
 * @param NamedList $tabs
 * @param User $logged_user
 * @param Project $project
 * @param array $tabs_settings
 * @param string $interface
 */
function frosso_project_tab_handle_on_project_tabs(&$tabs, &$logged_user, &$project, &$tabs_settings, $interface)
{
    if ($interface == AngieApplication::INTERFACE_DEFAULT && Tasks::canAccess($logged_user, $project, false) && in_array('fred_pt', $tabs_settings)) {
        $tabs->addBefore('fred_pt', array('text' => "Fred PT", 'url' => Router::assemble('frosso_tab_route', array('project_slug' => $project->getSlug())), 'icon' => $interface == AngieApplication::INTERFACE_DEFAULT ? AngieApplication::getImageUrl('icons/16x16/tasks-tab-icon.png', TASKS_MODULE) : AngieApplication::getImageUrl('icons/listviews/tasks.png', TASKS_MODULE, AngieApplication::INTERFACE_PHONE)), 'calendar');
    }
    // if
}
 /**
  * 
  * Display gitolite admin page
  * @return void
  */
 function index()
 {
     $this->wireframe->actions->add('need_help', lang('Need Help?'), Router::assemble('need_help_path'), array('onclick' => new FlyoutFormCallback('repository_created'), 'icon' => AngieApplication::getPreferedInterface() == AngieApplication::INTERFACE_DEFAULT ? AngieApplication::getImageUrl('icons/16X16-git.png', AC_GITOLITE_MODULE) : AngieApplication::getImageUrl('icons/16X16-git.png', AC_GITOLITE_MODULE, AngieApplication::INTERFACE_PHONE)));
     $gitoliteadminpath = GitoliteAdmin::get_admin_path();
     $settings = GitoliteAdmin::get_admin_settings();
     $gitoliteadminpath = $settings['gitoliteadminpath'] == "" ? "" : $settings['gitoliteadminpath'] . "gitolite-admin/";
     $domain_name = GitoliteAdmin::get_server_name();
     $server_name = $settings['gitoliteserveradd'] == "" ? $domain_name : $settings['gitoliteserveradd'];
     $git_server_location = $settings['git_server_location'] == "" ? "local" : $settings['git_server_location'];
     $git_ssh_port = !isset($settings['git_ssh_port']) || $settings['git_ssh_port'] == "" ? 22 : $settings['git_ssh_port'];
     //$is_auto = ($settings['initialize_repo'] == "") ? "No" : $settings['initialize_repo'];
     if ($settings['gitoliteuser'] == "") {
         $gitoliteuser = "";
         $is_enable = FALSE;
     } else {
         $gitoliteuser = $settings['gitoliteuser'];
         $is_enable = TRUE;
     }
     $setup_script = GitoliteAdmin::get_setup_path();
     $empty_repositories = GitoliteAdmin::get_empty_repositories();
     if (is_array($empty_repositories) && count($empty_repositories) > 0) {
         $i = 0;
         foreach ($empty_repositories as $key => $value) {
             $srcobj = new ProjectSourceRepository($value['obj_id']);
             $empty_repositories[$i]["view_url"] = $srcobj->getViewUrl();
             $i++;
         }
     }
     $delete_url = Router::assemble('delele_repo_url');
     $this->response->assign(array('settings' => $settings, 'empty_repositories' => $empty_repositories, 'setup_script' => $setup_script, 'gitoliteuser' => $gitoliteuser, 'gitoliteadminpath' => $gitoliteadminpath, 'server_name' => $server_name, 'git_server_location' => $git_server_location, 'delete_url' => $delete_url, 'git_ssh_port' => $git_ssh_port, 'is_enable' => $is_enable));
 }
 /**
  * List public keys in inline tabs
  * @return void
  */
 function getpublickeys()
 {
     $active_user = $this->active_user;
     $user_public_keys = GitoliteAc::fetch_keys($active_user->getId());
     $is_gitolite = GitoliteAdmin::is_gitolite();
     $this->smarty->assign(array('user_public_keys' => $user_public_keys, 'icon' => AngieApplication::getImageUrl('layout/button-add.png', ENVIRONMENT_FRAMEWORK, AngieApplication::getPreferedInterface()), 'delete_icon' => AngieApplication::getImageUrl('icons/12x12/delete.png', ENVIRONMENT_FRAMEWORK, AngieApplication::getPreferedInterface()), 'add_url' => Router::assemble('add_public_keys', array('company_id' => $active_user->getCompanyId(), 'user_id' => $active_user->getId())), 'del_url' => $this->active_user->getViewUrl(), 'is_gitolite' => $is_gitolite));
 }
示例#4
0
/**
 * Handle on_reports_panel event
 *
 * @param ReportsPanel $panel
 * @param IUser $user
 */
function frosso_estimated_cost_handle_on_reports_panel(ReportsPanel &$panel, IUser &$user)
{
    if ($user->isProjectManager()) {
        $panel->defineRow('remedia_reports', new ReportsPanelRow(lang('Milestone Reports')));
        $panel->addTo('remedia_reports', 'my_projects_report', lang('Milestone ETA Report'), Router::assemble('frosso_estimated_cost_report'), AngieApplication::getImageUrl('module.png', FROSSO_EC_MODULE, AngieApplication::INTERFACE_DEFAULT));
    }
    // if
}
/**
 * Add options to Home Screen
 *
 * @param NamedList $menu
 * @param User $user
 */
function timer_handle_on_phone_homescreen(NamedList &$items, IUser &$user)
{
    $items->add('timer', array('text' => lang('Timer'), 'url' => TimerModule::getTimerRoute(), 'icon' => AngieApplication::getImageUrl('module.png', TIMER_MODULE, AngieApplication::INTERFACE_PHONE)));
}
 /**
  * 
  * Add custom buttons on Admin Source page
  * @return void
  */
 function index()
 {
     parent::index();
     $this->wireframe->actions->add('add_source_gitolite_repository', lang('Add Gitolite Repository'), Router::assemble('add_source_gitolite_repository'), array('onclick' => new FlyoutFormCallback('repository_created', array('width' => 'narrow')), 'icon' => AngieApplication::getPreferedInterface() == AngieApplication::INTERFACE_DEFAULT ? AngieApplication::getImageUrl('icons/16X16-git.png', AC_GITOLITE_MODULE) : AngieApplication::getImageUrl('icons/16X16-git.png', AC_GITOLITE_MODULE, AngieApplication::INTERFACE_PHONE)));
     $this->wireframe->actions->add('clone_source_git', lang('Clone Remote Repository'), Router::assemble('clone_source_git_repository'), array('onclick' => new FlyoutFormCallback('repository_created', array('width' => '900')), 'icon' => AngieApplication::getPreferedInterface() == AngieApplication::INTERFACE_DEFAULT ? AngieApplication::getImageUrl('icons/16X16-git.png', AC_GITOLITE_MODULE) : AngieApplication::getImageUrl('icons/16X16-git.png', AC_GITOLITE_MODULE, AngieApplication::INTERFACE_PHONE)));
 }
 /**
  * Check repository access and add repository help on history page
  * @return void
  */
 function history()
 {
     //ProjectGitolite::delete_commits($this->active_repository->getId());
     /*         * $this->wireframe->actions->add('branches', lang('Branches'), '#', array(
               'subitems' => self::ac_gitolite_get_branches(),
               'icon' => AngieApplication::getPreferedInterface() == AngieApplication::INTERFACE_DEFAULT ? AngieApplication::getImageUrl('icons/16X16-git.png', AC_GITOLITE_MODULE) : AngieApplication::getImageUrl('icons/16X16-git.png', AC_GITOLITE_MODULE, AngieApplication::INTERFACE_PHONE),
               'id'=> 'branches_list'
               ));
     
               $this->wireframe->actions->add('tags', lang('Tags'), '#', array(
               'subitems' => self::ac_gitolite_get_tags(),
               'icon' => AngieApplication::getPreferedInterface() == AngieApplication::INTERFACE_DEFAULT ? AngieApplication::getImageUrl('icons/16X16-git.png', AC_GITOLITE_MODULE) : AngieApplication::getImageUrl('icons/16X16-git.png', AC_GITOLITE_MODULE, AngieApplication::INTERFACE_PHONE),
               'id'=> 'tags_list'
               ));
              */
     $repo_id = array_var($_GET, 'project_source_repository_id');
     //project objects id
     $project = $this->active_project;
     $repository = $this->active_repository;
     $repo_details = ProjectGitolite::get_repo_details($repo_id);
     if (is_array($repo_details) && count($repo_details) > 0) {
         //if ( $this->logged_user->isAdministrator () || $this->logged_user->isProjectManager () || $project->isLeader ( $this->logged_user ) ) {
         $this->wireframe->actions->add('manage_access', lang('Manage Access'), Router::assemble('edit_git_repository', array('project_slug' => $project->getSlug(), 'project_source_repository_id' => $repo_id)), array('id' => 'update_access_levels', 'onclick' => new FlyoutFormCallback("access_updated", array('width' => 'narrow')), 'icon' => AngieApplication::getPreferedInterface() == AngieApplication::INTERFACE_DEFAULT ? AngieApplication::getImageUrl('icons/16X16-git.png', AC_GITOLITE_MODULE) : AngieApplication::getImageUrl('icons/16X16-git.png', AC_GITOLITE_MODULE, AngieApplication::INTERFACE_PHONE)));
         //} //if
     }
     /*  Commented FTP section
          $this->wireframe->actions->add('add_ftp', 'FTP Connectiions', Router::assemble('add_ftp_conn',array('project_slug' => $this->active_project->getSlug(),
          'project_source_repository_id' => $repo_id)), array(
          'onclick' => new FlyoutFormCallback('ftps_updated', array('width' => '1100')),
          'icon' => AngieApplication::getPreferedInterface() == AngieApplication::INTERFACE_DEFAULT ? AngieApplication::getImageUrl('icons/16X16-git.png', AC_GITOLITE_MODULE) : AngieApplication::getImageUrl('icons/16X16-git.png', AC_GITOLITE_MODULE, AngieApplication::INTERFACE_PHONE))
          );
         */
     $this->wireframe->actions->add('add_hooks', 'Hooks', Router::assemble('add_hooks_git', array('project_slug' => $this->active_project->getSlug(), 'project_source_repository_id' => $repo_id)), array('onclick' => new FlyoutFormCallback('urls_updated', array('width' => '900')), 'icon' => AngieApplication::getPreferedInterface() == AngieApplication::INTERFACE_DEFAULT ? AngieApplication::getImageUrl('icons/16X16-git.png', AC_GITOLITE_MODULE) : AngieApplication::getImageUrl('icons/16X16-git.png', AC_GITOLITE_MODULE, AngieApplication::INTERFACE_PHONE)));
     $repo_path = $repository->getRepositoryPathUrl();
     $repo_fk = $repository->getId();
     $chk_gitolite = ProjectGitolite::is_gitolite_repo($repo_fk);
     if (is_array($chk_gitolite) && sizeof($chk_gitolite) > 0 && $chk_gitolite['chk_gitolite'] > 0) {
         $settings = GitoliteAdmin::get_admin_settings();
         $clone_url = $settings['git_clone_url'] . $this->active_repository->getName() . ".git";
         $permissions = @unserialize($chk_gitolite['permissions']);
         if ($permissions !== false || $permissions === 'b:0;') {
             $permissions_array = $permissions;
         } else {
             $permissions_array = array();
         }
         if (array_key_exists($this->logged_user->getId(), $permissions_array) && $permissions_array[$this->logged_user->getId()] > 1 || $this->logged_user->isAdministrator() || $this->logged_user->isProjectManager() || $this->active_project->isLeader($this->logged_user)) {
             $body = "<h2>Git Global Setup</h2>";
             $body .= "<code>";
             $body .= "git config --global user.name '" . $this->logged_user->getDisplayName() . "'" . "<br>";
             $body .= "git config --global user.email '" . $this->logged_user->getEmail() . "'" . "<br>";
             $body .= "</code>";
             $body .= "<h2>Create Repository:</h2>";
             $body .= "<code>";
             $body .= "mkdir " . $this->active_repository->getName() . "<br>";
             $body .= "cd " . $this->active_repository->getName() . "<br>";
             $body .= "git init" . "<br>";
             $body .= "touch README" . "<br>";
             $body .= "git add README" . "<br>";
             $body .= "git commit -m 'first commit'" . "<br>";
             $body .= "git remote add origin " . $clone_url . "<br>";
             $body .= "git push -u origin master" . "<br>";
             $body .= "</code>";
             $body .= "<h2>Existing Git Repo?</h2>";
             $body .= "<code>";
             $body .= "cd existing_git_repo" . "<br>";
             $body .= "git remote add origin " . $clone_url . "<br>";
             $body .= "git push -u origin master";
             $body .= "</code>";
             $body_text = $body;
         } else {
             $this->response->forbidden();
         }
     } else {
         $body_text = $repository->getFieldValue("repository_path_url");
     }
     parent::history();
     $this->response->assign(array('body_text' => $body_text, 'repo_path' => $repo_path, 'clone_url' => $clone_url));
 }
示例#8
0
/**
 * Register status bar items
 *
 * @param StatusBar $status_bar
 * @param IUser $logged_user
 */
function frosso_mail_notify_handle_on_status_bar(StatusBar &$status_bar, IUser &$user)
{
    $status_bar->add('frosso_mn_updates', lang('Notifications'), Router::assemble('frosso_mail_notify'), AngieApplication::getImageUrl('icons/12x12/my-subscriptions.png', FROSSO_MAILN_MODULE), array('group' => StatusBar::GROUP_RIGHT, 'badge' => NotificationsActivityLogs::countSinceLastVisit($user)));
}
/**
 * Add options to main menu
 *
 * @param MainMenu $menu
 * @param User $user
 */
function timer_handle_on_main_menu(MainMenu &$menu, User &$user)
{
    $menu->addBefore('timer', lang('Timer'), TimerModule::getTimerRoute(), AngieApplication::getImageUrl('module.png', TIMER_MODULE, AngieApplication::INTERFACE_DEFAULT), null, 'admin');
    // before admin
}
示例#10
0
/**
 * Handle on_admin_panel event
 *
 * @param AdminPanel $admin_panel
 */
function frosso_authentication_handle_on_admin_panel(AdminPanel &$admin_panel)
{
    $admin_panel->addToOther('frosso_authentication', lang('SSO Settings'), Router::assemble('auth_login_frosso_admin'), AngieApplication::getImageUrl('admin_panel/tasks.png', TASKS_MODULE), array('onclick' => new FlyoutFormCallback(array('success_event' => 'frosso_authentication_updated', 'success_message' => lang('SSO settings have been updated'), 'width' => 500))));
}
/**
 * Handle on_admin_panel event
 * 
 * @param AdminPanel $admin_panel
 */
function ac_gitolite_handle_on_admin_panel(AdminPanel &$admin_panel)
{
    $admin_panel->addToProjects("gitolite_admin_handler", lang("Gitolite Settings"), Router::assemble('gitolite_admin'), AngieApplication::getImageUrl('module.png', AC_GITOLITE_MODULE));
}