Merge branch 'master' of disposed.de:scattport

This commit is contained in:
Karsten Heiken
2011-08-08 14:26:04 +02:00
49 changed files with 507 additions and 265 deletions

View File

@@ -1,18 +1,18 @@
<?php
/*
/*
* Copyright (c) 2011 Karsten Heiken <karsten@disposed.de>
*
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
@@ -24,19 +24,16 @@
/**
* Controller for Ajax requests.
*
*
* @author Karsten Heiken <karsten@disposed.de>
*/
class Ajax extends CI_Controller {
class Ajax extends MY_Controller {
/**
* Constructor.
*/
public function __construct() {
parent::__construct();
// load language file
$this->lang->load(strtolower($this->router->class));
}
/**

View File

@@ -27,14 +27,14 @@
*
* @author Karsten Heiken <karsten@disposed.de>
*/
class api extends CI_Controller {
class Api extends CI_Controller {
/**
* Update the state of a given job.
*
*
* Because we do not want any access from servers we do not trust,
* we need a special secret to authenticate the servers.
*
*
* @param type $secret The secret to authenticate the server.
* @param type $job_id The job id that is running on the server.
* @param type $state The state of the job.

View File

@@ -5,7 +5,7 @@
*
* @author Eike Foken <kontakt@eikefoken.de>
*/
class Auth extends CI_Controller {
class Auth extends MY_Controller {
/**
* Constructor.

View File

@@ -25,7 +25,7 @@
/**
* @author Karsten Heiken <karsten@disposed.de>
*/
class Dashboard extends CI_Controller {
class Dashboard extends MY_Controller {
/**
* Constructor.
@@ -35,9 +35,6 @@ class Dashboard extends CI_Controller {
$this->load->model('job');
$this->load->model('project');
$this->load->model('user');
// load language file
$this->lang->load(strtolower($this->router->class));
}
public function index() {

View File

@@ -25,7 +25,7 @@
/**
* @author Karsten Heiken <karsten@disposed.de>
*/
class Jobs extends CI_Controller {
class Jobs extends MY_Controller {
/**
* Constructor.
@@ -33,9 +33,6 @@ class Jobs extends CI_Controller {
public function __construct() {
parent::__construct();
$this->load->model('job');
// load language file
$this->lang->load(strtolower($this->router->class));
}
/**
@@ -45,11 +42,11 @@ class Jobs extends CI_Controller {
$query = $this->db->order_by('progress', 'desc')
->get_where('jobs', array('started_by' => $this->session->userdata('user_id')));
$jobs = $query->result_array();
for($i=0; $i<count($jobs); $i++) {
$jobs[$i]['project_name'] = $this->db->select('name')->get_where('projects', array('id' => $jobs[$i]['project_id']))->row()->name;
$progress = $jobs[$i]['progress'];
switch($progress) {
case -1:
$progress = lang('waiting');
@@ -64,9 +61,9 @@ class Jobs extends CI_Controller {
$progress = $progress . "%";
break;
}
$jobs[$i]['progress'] = $progress;
}
}
$this->output
->set_content_type('application/json')

View File

@@ -25,7 +25,7 @@
/**
* @author Karsten Heiken <karsten@disposed.de>
*/
class Programs extends CI_Controller {
class Programs extends MY_Controller {
/**
* Constructor.
@@ -33,9 +33,6 @@ class Programs extends CI_Controller {
public function __construct() {
parent::__construct();
$this->load->model('program');
// load language file
$this->lang->load(strtolower($this->router->class));
}
/**
@@ -43,19 +40,19 @@ class Programs extends CI_Controller {
*/
public function index() {
$programs = $this->program->getAll();
$tpl['programs'] = $programs;
$this->load->view('program/list', $tpl);
}
/**
* Show detailed information about a program.
*
*
* @param type $prg_id The program's id
*/
public function detail($prg_id) {
$program = $this->program->getById($prg_id);
$tpl['program'] = $program;
$this->load->view('program/detail', $tpl);
}

View File

@@ -25,7 +25,7 @@
/**
* @author Karsten Heiken <karsten@disposed.de>
*/
class Projects extends CI_Controller {
class Projects extends MY_Controller {
/**
* Constructor.
@@ -34,13 +34,20 @@ class Projects extends CI_Controller {
parent::__construct();
$this->load->model('project');
$this->load->model('trial');
// load language file
$this->lang->load(strtolower($this->router->class));
}
/**
* Create a new project.
* Shows a list of all projects.
*/
public function index() {
$projects = $this->project->getAll();
$tpl['projects'] = $projects;
$this->load->view('project/list', $tpl);
}
/**
* Allows users to create a new project.
*/
public function create() {
$this->load->library('form_validation');
@@ -101,18 +108,16 @@ class Projects extends CI_Controller {
}
}
public function index() {
$projects = $this->project->getAll();
$tpl['projects'] = $projects;
$this->load->view('project/list', $tpl);
}
/**
* Shows the project details
*
* @param integer $prj_id The ID of the project to show
*/
public function detail($prj_id) {
$project = $this->project->getById($prj_id);
if (!$project) {
$this->messages->add('Das Projekt konnte nicht geladen werden.', 'error');
redirect('/projects/', 301);
redirect('projects', 301);
}
$this->session->set_userdata('active_project', $prj_id);
@@ -124,4 +129,16 @@ class Projects extends CI_Controller {
$this->load->view('project/detail', $tpl);
}
/**
* Allows users to delete a project.
*
* @param unknown_type $projectId
*/
public function delete($projectId) {
$this->project->delete($projectId);
$this->session->unset_userdata('active_project');
$this->messages->add("Das Projekt wurde gelöscht.", 'notice');
redirect('projects');
}
}

View File

@@ -1,18 +1,18 @@
<?php
/*
/*
* Copyright (c) 2011 Karsten Heiken <karsten@disposed.de>
*
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
@@ -24,10 +24,10 @@
/**
* Result browser.
*
*
* @author Karsten Heiken <karsten@disposed.de>
*/
class Results extends CI_Controller {
class Results extends MY_Controller {
/**
* Constructor.
@@ -37,11 +37,8 @@ class Results extends CI_Controller {
$this->load->model('program');
$this->load->model('job');
$this->load->model('server');
// load language file
$this->lang->load(strtolower($this->router->class));
}
public function index() {
}

View File

@@ -25,7 +25,7 @@
/**
* @author Karsten Heiken <karsten@disposed.de>
*/
class Settings extends CI_Controller {
class Settings extends MY_Controller {
/**
* Constructor.
@@ -33,9 +33,6 @@ class Settings extends CI_Controller {
public function __construct() {
parent::__construct();
$this->load->model('program');
// load language file
$this->lang->load(strtolower($this->router->class));
}
/**

View File

@@ -27,7 +27,7 @@
*
* @author Karsten Heiken <karsten@disposed.de>
*/
class Trials extends CI_Controller {
class Trials extends MY_Controller {
/**
* Constructor.
@@ -37,9 +37,6 @@ class Trials extends CI_Controller {
$this->load->model('trial');
$this->load->model('program');
$this->load->model('project');
// load language file
// $this->lang->load(strtolower($this->router->class));
}
/**