Merge branch 'feature-projectmanagement' of disposed.de:scattport
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -5,3 +5,4 @@
|
|||||||
*.xcf
|
*.xcf
|
||||||
application/config/config.php
|
application/config/config.php
|
||||||
application/config/database.php
|
application/config/database.php
|
||||||
|
application/logs/*
|
||||||
|
|||||||
13
application/controllers/web/configurations/fields.php
Normal file
13
application/controllers/web/configurations/fields.php
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
class Fields extends CI_Controller {
|
||||||
|
|
||||||
|
public function __construct() {
|
||||||
|
parent::__construct();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function upload_csv() {
|
||||||
|
$this->load-view('web/configurations/upload_csv');
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
31
application/controllers/web/configurations/index.php
Normal file
31
application/controllers/web/configurations/index.php
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Configurations are used to store different variations of the same project.
|
||||||
|
*
|
||||||
|
* @author Karsten Heiken, karsten@disposed.de
|
||||||
|
*/
|
||||||
|
class Configurations extends CI_Controller {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor.
|
||||||
|
*/
|
||||||
|
public function __construct() {
|
||||||
|
parent::__construct();
|
||||||
|
$this->load->model('configuration');
|
||||||
|
|
||||||
|
// load language file
|
||||||
|
// $this->lang->load(strtolower($this->router->class));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get a specific configuration from the database.
|
||||||
|
*
|
||||||
|
* @param string $config_id The configuration id to get.
|
||||||
|
*/
|
||||||
|
public function detail($config_id) {
|
||||||
|
$configs = $this->configuration->get($config_id);
|
||||||
|
|
||||||
|
$this->load->view('web/configurations/detail', $configs);
|
||||||
|
}
|
||||||
|
}
|
||||||
83
application/controllers/web/projects.php
Normal file
83
application/controllers/web/projects.php
Normal file
@@ -0,0 +1,83 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Karsten Heiken, karsten@disposed.de
|
||||||
|
*/
|
||||||
|
class Projects extends CI_Controller {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor.
|
||||||
|
*/
|
||||||
|
public function __construct() {
|
||||||
|
parent::__construct();
|
||||||
|
$this->load->model('project');
|
||||||
|
$this->load->helper('tree');
|
||||||
|
|
||||||
|
// load language file
|
||||||
|
$this->lang->load(strtolower($this->router->class));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Lists all projects the user has access to.
|
||||||
|
*/
|
||||||
|
public function getAll() {
|
||||||
|
|
||||||
|
$projects = $this->db->get('projects')->result_array();
|
||||||
|
$this->load->view('web/projects/list',
|
||||||
|
array('projects' => $projects));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function detail($project_id) {
|
||||||
|
$project = $this->project->get($project_id);
|
||||||
|
$project['configs'] = $this->project->getConfigurations($project_id);
|
||||||
|
|
||||||
|
$this->load->view('web/projects/detail', $project);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function create() {
|
||||||
|
$this->load->library('form_validation');
|
||||||
|
$this->load->helper('date');
|
||||||
|
$this->form_validation->set_rules('f_name', "Projektname",
|
||||||
|
'required|max_length[100]|xss_clean|callback_unique');
|
||||||
|
$this->form_validation->set_rules('f_description', "Beschreibung", 'required|xss_clean');
|
||||||
|
|
||||||
|
if ($this->form_validation->run() == true) {
|
||||||
|
|
||||||
|
// populate fields for the new project
|
||||||
|
$project['name'] = $this->form_validation->set_value('f_name');
|
||||||
|
$project['description'] = $this->form_validation->set_value('f_description');
|
||||||
|
$foo = $this->project->create($project);
|
||||||
|
|
||||||
|
redirect('web/projects/getAll', 'refresh');
|
||||||
|
|
||||||
|
} else {
|
||||||
|
$this->data['message'] = validation_errors() ? validation_errors() : null;
|
||||||
|
$this->data['name'] = $this->form_validation->set_value('f_name');
|
||||||
|
$this->data['description'] = $this->form_validation->set_value('f_description');
|
||||||
|
|
||||||
|
$this->load->view('web/projects/create', $this->data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks if the user already has a project with the given name.
|
||||||
|
*
|
||||||
|
* It's okay if different users have the same project - even if that
|
||||||
|
* will complicate sharing.
|
||||||
|
*
|
||||||
|
* @param string $project_name
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
|
function unique($project_name) {
|
||||||
|
$query = $this->db->get_where('projects',
|
||||||
|
array(
|
||||||
|
'name' => $project_name,
|
||||||
|
'owner' => $this->session->userdata('user_id'))
|
||||||
|
);
|
||||||
|
if($query->num_rows() > 0)
|
||||||
|
return false;
|
||||||
|
else
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
6
application/language/english/form_validation_lang.php
Normal file
6
application/language/english/form_validation_lang.php
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
$lang['unique'] = "A project with this name already exists.";
|
||||||
|
|
||||||
|
/* End of file projects_lang.php */
|
||||||
|
/* Location: ./application/language/english/form_validation_lang.php */
|
||||||
6
application/language/german/form_validation_lang.php
Normal file
6
application/language/german/form_validation_lang.php
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
$lang['unique'] = "Ein Projekt mit diesem Namen existiert bereits";
|
||||||
|
|
||||||
|
/* End of file projects_lang.php */
|
||||||
|
/* Location: ./application/language/german/form_validation_lang.php */
|
||||||
37
application/views/web/configurations/detail.php
Normal file
37
application/views/web/configurations/detail.php
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||||
|
<title>Configuration <?=$name?></title>
|
||||||
|
<link rel="stylesheet" href="<?=base_url()?>/assets/css/inuit.css" />
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div class="grids">
|
||||||
|
<div class="grid grid-10">
|
||||||
|
<table>
|
||||||
|
<tr>
|
||||||
|
<th colspan="2">
|
||||||
|
Konfigurationsdetails
|
||||||
|
</th>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>ID</td><td><?=$id?></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>Name</td><td><?=$name?></td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
<div class="grid grid-6">
|
||||||
|
<table>
|
||||||
|
<tr>
|
||||||
|
<th>Beschreibung</th>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td><?=nl2br($description)?></td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
4
application/views/web/configurations/upload_csv.php
Normal file
4
application/views/web/configurations/upload_csv.php
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
<?php echo $this->load->view('web/header'); ?>
|
||||||
|
|
||||||
|
<?=form_open_multipart();?>
|
||||||
|
<?=form_close();?>
|
||||||
8
application/views/web/header.php
Normal file
8
application/views/web/header.php
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8" />
|
||||||
|
<title>Scattport</title>
|
||||||
|
<?=link_tag('assets/css/inuit.css');?>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
40
application/views/web/projects/create.php
Normal file
40
application/views/web/projects/create.php
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
<!DOCTYPE html5>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||||
|
<title>Create Project</title>
|
||||||
|
<link rel="stylesheet" href="/ScattPort/assets/css/inuit.css" />
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div class="grids">
|
||||||
|
<div class="grid grid-8">
|
||||||
|
<?=form_open('web/projects/create')?>
|
||||||
|
<table>
|
||||||
|
<tr><th colspan="2">Create a new project</th></tr>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
Name:
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<input type="text" name="f_name" value="<?=$name?>"/><?=form_error('f_name')?>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
Beschreibung:
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<input type="text" name="f_description" value="<?=$description?>"/><?=form_error('description')?>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td align="right" colspan="2">
|
||||||
|
<input type="submit" />
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<?=form_close()?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
41
application/views/web/projects/detail.php
Normal file
41
application/views/web/projects/detail.php
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
<!--
|
||||||
|
To change this template, choose Tools | Templates
|
||||||
|
and open the template in the editor.
|
||||||
|
-->
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||||
|
<title>Project <?=$name?></title>
|
||||||
|
<link rel="stylesheet" href="<?=base_url();?>/assets/css/inuit.css" />
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div class="grids">
|
||||||
|
<div class="grid grid-8">
|
||||||
|
<table>
|
||||||
|
<tr><th colspan="2">Projektdetails</th></tr>
|
||||||
|
<tr>
|
||||||
|
<td>ID</td>
|
||||||
|
<td><?=$id?></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>Name</td>
|
||||||
|
<td><?=$name?></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>Beschreibung</td>
|
||||||
|
<td><?=$description?></td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
<div class="grid grid-8">
|
||||||
|
<table>
|
||||||
|
<tr><th>Konfigurationen</th></tr>
|
||||||
|
<? foreach($configs as $config): ?>
|
||||||
|
<tr><td><?=anchor('web/configurations/detail/'.$config['id'], $config['name'])?></td></tr>
|
||||||
|
<? endforeach; ?>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
24
application/views/web/projects/list.php
Normal file
24
application/views/web/projects/list.php
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
<!DOCTYPE html5>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||||
|
<title>List of projects</title>
|
||||||
|
<link rel="stylesheet" href="<?=base_url();?>/assets/css/inuit.css" />
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<table>
|
||||||
|
<tr>
|
||||||
|
<td><b>id</b></td>
|
||||||
|
<td><b>name</b></td>
|
||||||
|
<td><b>owner</b></td>
|
||||||
|
</tr>
|
||||||
|
<? foreach($projects as $project): ?>
|
||||||
|
<tr>
|
||||||
|
<td><?=anchor('web/projects/detail/'.$project['id'], $project['id'])?></td>
|
||||||
|
<td><?=$project['name']?></td>
|
||||||
|
<td><?=$project['owner']?></td>
|
||||||
|
</tr>
|
||||||
|
<? endforeach; ?>
|
||||||
|
</table>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
1071
assets/css/inuit.css
Normal file
1071
assets/css/inuit.css
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user