Merge branch 'master' of disposed.de:scattport
This commit is contained in:
@@ -1,45 +1,206 @@
|
|||||||
<?php defined('BASEPATH') || exit("No direct script access allowed");
|
<?php defined('BASEPATH') || exit("No direct script access allowed");
|
||||||
|
|
||||||
$config = array(
|
/**
|
||||||
'users' => array(
|
* Rules for login page.
|
||||||
array(
|
*
|
||||||
'field' => 'username',
|
* @var array
|
||||||
'label' => _('Username'),
|
*/
|
||||||
'rules' => 'trim|required|min_length[4]|max_length[20]|unique[users.username]',
|
$config['auth/login'] = array(
|
||||||
),
|
array(
|
||||||
array(
|
'field' => 'username',
|
||||||
'field' => 'password',
|
'label' => _('Username'),
|
||||||
'label' => _('Password'),
|
'rules' => 'required|trim',
|
||||||
'rules' => 'required|min_length[6]|matches[password_confirm]',
|
),
|
||||||
),
|
array(
|
||||||
array(
|
'field' => 'password',
|
||||||
'field' => 'password_confirm',
|
'label' => _('Password'),
|
||||||
'label' => _('Confirm password'),
|
'rules' => 'required|trim',
|
||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
'field' => 'firstname',
|
'field' => 'remember',
|
||||||
'label' => _('First name'),
|
'label' => _('Remember me on this computer'),
|
||||||
'rules' => 'trim|required|max_length[50]',
|
'rules' => 'integer',
|
||||||
),
|
),
|
||||||
array(
|
);
|
||||||
'field' => 'lastname',
|
|
||||||
'label' => _('Last name'),
|
/**
|
||||||
'rules' => 'trim|required|max_length[50]',
|
* Rules for forgotten password page.
|
||||||
),
|
*
|
||||||
array(
|
* @var array
|
||||||
'field' => 'email',
|
*/
|
||||||
'label' => _('Email address'),
|
$config['auth/forgot_password'] = array(
|
||||||
'rules' => 'trim|required|valid_email',
|
array(
|
||||||
),
|
'field' => 'email',
|
||||||
array(
|
'label' => _('Email address'),
|
||||||
'field' => 'institution',
|
'rules' => 'required|valid_email|trim',
|
||||||
'label' => _('Institution'),
|
),
|
||||||
'rules' => 'trim|max_length[100]',
|
);
|
||||||
),
|
|
||||||
array(
|
/**
|
||||||
'field' => 'phone',
|
* Rules for the settings page.
|
||||||
'label' => _('Phone number'),
|
*
|
||||||
'rules' => 'trim|regex_match[/^\+\d{2,4}\s\d{2,4}\s\d{3,10}+$/i]',
|
* @var array
|
||||||
)
|
*/
|
||||||
)
|
$config['auth/settings'] = array(
|
||||||
);
|
array(
|
||||||
|
'field' => 'firstname',
|
||||||
|
'label' => _('First name'),
|
||||||
|
'rules' => 'required|max_length[50]|trim',
|
||||||
|
),
|
||||||
|
array(
|
||||||
|
'field' => 'lastname',
|
||||||
|
'label' => _('Last name'),
|
||||||
|
'rules' => 'required|max_length[50]|trim',
|
||||||
|
),
|
||||||
|
array(
|
||||||
|
'field' => 'email',
|
||||||
|
'label' => _('Email address'),
|
||||||
|
'rules' => 'required|valid_email|trim',
|
||||||
|
),
|
||||||
|
array(
|
||||||
|
'field' => 'institution',
|
||||||
|
'label' => _('Institution'),
|
||||||
|
'rules' => 'max_length[100]|trim',
|
||||||
|
),
|
||||||
|
array(
|
||||||
|
'field' => 'phone',
|
||||||
|
'label' => _('Phone number'),
|
||||||
|
'rules' => 'regex_match[/^\+\d{2,4}\s\d{2,4}\s\d{3,10}+$/i]|trim',
|
||||||
|
),
|
||||||
|
array(
|
||||||
|
'field' => 'new_password',
|
||||||
|
'label' => _('New password'),
|
||||||
|
'rules' => 'min_length[6]|matches[new_password_confirm]',
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Rules for creating users.
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
$config['users/create'] = array(
|
||||||
|
array(
|
||||||
|
'field' => 'username',
|
||||||
|
'label' => _('Username'),
|
||||||
|
'rules' => 'required|min_length[4]|max_length[20]|unique[users.username]|trim',
|
||||||
|
),
|
||||||
|
array(
|
||||||
|
'field' => 'email',
|
||||||
|
'label' => _('Email address'),
|
||||||
|
'rules' => 'required|valid_email|trim',
|
||||||
|
),
|
||||||
|
array(
|
||||||
|
'field' => 'password',
|
||||||
|
'label' => _('Password'),
|
||||||
|
'rules' => 'required|min_length[6]|matches[password_confirm]',
|
||||||
|
),
|
||||||
|
array(
|
||||||
|
'field' => 'password_confirm',
|
||||||
|
'label' => _('Confirm password'),
|
||||||
|
'rules' => 'required',
|
||||||
|
),
|
||||||
|
array(
|
||||||
|
'field' => 'firstname',
|
||||||
|
'label' => _('First name'),
|
||||||
|
'rules' => 'required|max_length[50]|trim',
|
||||||
|
),
|
||||||
|
array(
|
||||||
|
'field' => 'lastname',
|
||||||
|
'label' => _('Last name'),
|
||||||
|
'rules' => 'required|max_length[50]|trim',
|
||||||
|
),
|
||||||
|
array(
|
||||||
|
'field' => 'institution',
|
||||||
|
'label' => _('Institution'),
|
||||||
|
'rules' => 'max_length[100]|trim',
|
||||||
|
),
|
||||||
|
array(
|
||||||
|
'field' => 'phone',
|
||||||
|
'label' => _('Phone number'),
|
||||||
|
'rules' => 'regex_match[/^\+\d{2,4}\s\d{2,4}\s\d{3,10}+$/i]|trim',
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Rules for editing users.
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
$config['users/edit'] = array(
|
||||||
|
array(
|
||||||
|
'field' => 'firstname',
|
||||||
|
'label' => _('First name'),
|
||||||
|
'rules' => 'required|max_length[50]|trim',
|
||||||
|
),
|
||||||
|
array(
|
||||||
|
'field' => 'lastname',
|
||||||
|
'label' => _('Last name'),
|
||||||
|
'rules' => 'required|max_length[50]|trim',
|
||||||
|
),
|
||||||
|
array(
|
||||||
|
'field' => 'email',
|
||||||
|
'label' => _('Email address'),
|
||||||
|
'rules' => 'required|valid_email|trim',
|
||||||
|
),
|
||||||
|
array(
|
||||||
|
'field' => 'institution',
|
||||||
|
'label' => _('Institution'),
|
||||||
|
'rules' => 'max_length[100]|trim',
|
||||||
|
),
|
||||||
|
array(
|
||||||
|
'field' => 'phone',
|
||||||
|
'label' => _('Phone number'),
|
||||||
|
'rules' => 'regex_match[/^\+\d{2,4}\s\d{2,4}\s\d{3,10}+$/i]|trim',
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Rules for editing programs.
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
$config['programs/edit'] = array(
|
||||||
|
array(
|
||||||
|
'field' => 'name',
|
||||||
|
'label' => _('Name of the program'),
|
||||||
|
'rules' => 'required|max_length[100]|trim',
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Rules for creating parameters.
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
$config['parameters/create'] = array(
|
||||||
|
array(
|
||||||
|
'field' => 'name',
|
||||||
|
'label' => _('Name'),
|
||||||
|
'rules' => 'required|max_length[255]|trim',
|
||||||
|
),
|
||||||
|
array(
|
||||||
|
'field' => 'readable',
|
||||||
|
'label' => _('Human-readable name'),
|
||||||
|
'rules' => 'required|max_length[100]|trim',
|
||||||
|
),
|
||||||
|
array(
|
||||||
|
'field' => 'unit',
|
||||||
|
'label' => _('Name'),
|
||||||
|
'rules' => 'max_length[20]|trim',
|
||||||
|
),
|
||||||
|
array(
|
||||||
|
'field' => 'default_value',
|
||||||
|
'label' => _('Default value'),
|
||||||
|
'rules' => 'max_length[255]|trim',
|
||||||
|
),
|
||||||
|
array(
|
||||||
|
'field' => 'type',
|
||||||
|
'label' => _('Type'),
|
||||||
|
'rules' => 'required|max_length[20]|trim',
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
|
/* End of file form_validation.php */
|
||||||
|
/* Location: ./application/config/form_validation.php */
|
||||||
|
|
||||||
|
|||||||
133
application/controllers/admin/parameters.php
Normal file
133
application/controllers/admin/parameters.php
Normal file
@@ -0,0 +1,133 @@
|
|||||||
|
<?php
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2011 Eike Foken <kontakt@eikefoken.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
|
||||||
|
* 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
|
||||||
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
* THE SOFTWARE.
|
||||||
|
*/
|
||||||
|
require_once APPPATH . 'core/Admin_Controller.php';
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Eike Foken <kontakt@eikefoken.de>
|
||||||
|
*/
|
||||||
|
class Parameters extends Admin_Controller {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Calls the parent constructor.
|
||||||
|
*/
|
||||||
|
public function __construct() {
|
||||||
|
parent::__construct();
|
||||||
|
$this->load->model('parameter');
|
||||||
|
$this->load->model('program');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Allows admins to create a new parameter.
|
||||||
|
*
|
||||||
|
* @param string $programId
|
||||||
|
*/
|
||||||
|
public function create($programId = '') {
|
||||||
|
$program = $this->program->getByID($programId);
|
||||||
|
|
||||||
|
if (empty($programId) || !isset($program['id'])) {
|
||||||
|
show_404();
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($this->form_validation->run('parameters/create') === true) {
|
||||||
|
$paramName = $this->input->post('name');
|
||||||
|
|
||||||
|
$data = array(
|
||||||
|
'program_id' => $program['id'],
|
||||||
|
'name' => $paramName,
|
||||||
|
'readable' => $this->input->post('readable'),
|
||||||
|
'unit' => $this->input->post('unit'),
|
||||||
|
'description' => $this->input->post('description'),
|
||||||
|
'type' => $this->input->post('type'),
|
||||||
|
'default_value' => $this->input->post('default_value'),
|
||||||
|
);
|
||||||
|
|
||||||
|
if ($this->parameter->create($data)) {
|
||||||
|
$this->messages->add(sprintf(_("The parameter '%s' has been successfully created."), $paramName), 'success');
|
||||||
|
redirect('admin/programs/edit/' . $program['id'], 303);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$data = array(); // empty the data array
|
||||||
|
$data['types'] = $this->parameter->getTypes();
|
||||||
|
$data['program'] = $program;
|
||||||
|
|
||||||
|
$this->load->view('admin/parameters/create', $data);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Allows admins to edit a parameter.
|
||||||
|
*
|
||||||
|
* @param string $id
|
||||||
|
*/
|
||||||
|
public function edit($id = '') {
|
||||||
|
$parameter = $this->parameter->getByID($id);
|
||||||
|
|
||||||
|
if (empty($id) || !isset($parameter['id'])){
|
||||||
|
show_404();
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($this->form_validation->run('parameters/create') === true) {
|
||||||
|
$data = array(
|
||||||
|
'name' => $this->input->post('name'),
|
||||||
|
'readable' => $this->input->post('readable'),
|
||||||
|
'unit' => $this->input->post('unit'),
|
||||||
|
'description' => $this->input->post('description'),
|
||||||
|
'type' => $this->input->post('type'),
|
||||||
|
'default_value' => $this->input->post('default_value'),
|
||||||
|
);
|
||||||
|
|
||||||
|
if ($this->parameter->update($data, $id)) {
|
||||||
|
$this->messages->add(sprintf(_("The parameter '%s' has been successfully updated."), $parameter['name']), 'success');
|
||||||
|
redirect('admin/programs/edit/' . $parameter['program_id'], 303);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$data = array(); // empty the data array
|
||||||
|
$data['types'] = $this->parameter->getTypes();
|
||||||
|
$data['parameter'] = $parameter;
|
||||||
|
|
||||||
|
$this->load->view('admin/parameters/edit', $data);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Allows admins to delete a parameter.
|
||||||
|
*
|
||||||
|
* @param string $id
|
||||||
|
*/
|
||||||
|
public function delete($id = '') {
|
||||||
|
$parameter = $this->parameter->getByID($id);
|
||||||
|
|
||||||
|
if (empty($id) || !isset($parameter['id'])) {
|
||||||
|
show_404();
|
||||||
|
} else {
|
||||||
|
if ($this->parameter->delete($parameter['id'])) {
|
||||||
|
$this->messages->add(_('The selected parameter has been successfully deleted.'), 'success');
|
||||||
|
}
|
||||||
|
redirect('admin/programs/edit/' . $parameter['program_id'], 303);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* End of file parameters.php */
|
||||||
|
/* Location: ./application/controllers/admin/parameters.php */
|
||||||
52
application/controllers/admin/programs.php
Normal file
52
application/controllers/admin/programs.php
Normal file
@@ -0,0 +1,52 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Eike Foken <kontakt@eikefoken.de>
|
||||||
|
*/
|
||||||
|
class Programs extends CI_Controller {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Calls the parent constructor.
|
||||||
|
*/
|
||||||
|
public function __construct() {
|
||||||
|
parent::__construct();
|
||||||
|
$this->load->library('form_validation');
|
||||||
|
$this->load->model('program');
|
||||||
|
$this->load->model('parameter');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Shows a list of all available programs.
|
||||||
|
*/
|
||||||
|
public function index() {
|
||||||
|
$data['programs'] = $this->program->getAll();
|
||||||
|
$this->load->view('admin/programs/list', $data);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Allows admins to edit a program.
|
||||||
|
*
|
||||||
|
* @param string $id
|
||||||
|
*/
|
||||||
|
public function edit($id = '') {
|
||||||
|
$program = $this->program->getByID($id);
|
||||||
|
|
||||||
|
if (!isset($program) || !is_array($program)){
|
||||||
|
show_404();
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($this->form_validation->run('programs/edit') === true) {
|
||||||
|
if ($this->program->update($this->input->post('name'), $id)) {
|
||||||
|
$this->messages->add(sprintf(_("The program '%s' has been updated successfully"), $this->input->post('name')), 'success');
|
||||||
|
redirect('admin/programs', 303);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$data['program'] = $program;
|
||||||
|
$data['parameters'] = $this->parameter->getAll($program['id']);
|
||||||
|
|
||||||
|
$this->load->view('admin/programs/edit', $data);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -22,56 +22,13 @@ class Users extends CI_Controller {
|
|||||||
*/
|
*/
|
||||||
public function index() {
|
public function index() {
|
||||||
$data['users'] = $this->user->getAll();
|
$data['users'] = $this->user->getAll();
|
||||||
$this->load->view('admin/users/index', $data);
|
$this->load->view('admin/users/list', $data);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Allows admins to create a new user.
|
* Allows admins to create a new user.
|
||||||
*/
|
*/
|
||||||
public function create() {
|
public function create() {
|
||||||
$config = array(
|
|
||||||
array(
|
|
||||||
'field' => 'username',
|
|
||||||
'label' => _('Username'),
|
|
||||||
'rules' => 'trim|required|min_length[4]|max_length[20]|unique[users.username]',
|
|
||||||
),
|
|
||||||
array(
|
|
||||||
'field' => 'password',
|
|
||||||
'label' => _('Password'),
|
|
||||||
'rules' => 'required|min_length[6]|matches[password_confirm]',
|
|
||||||
),
|
|
||||||
array(
|
|
||||||
'field' => 'password_confirm',
|
|
||||||
'label' => _('Confirm password'),
|
|
||||||
),
|
|
||||||
array(
|
|
||||||
'field' => 'firstname',
|
|
||||||
'label' => _('First name'),
|
|
||||||
'rules' => 'trim|required|max_length[50]',
|
|
||||||
),
|
|
||||||
array(
|
|
||||||
'field' => 'lastname',
|
|
||||||
'label' => _('Last name'),
|
|
||||||
'rules' => 'trim|required|max_length[50]',
|
|
||||||
),
|
|
||||||
array(
|
|
||||||
'field' => 'email',
|
|
||||||
'label' => _('Email address'),
|
|
||||||
'rules' => 'trim|required|valid_email',
|
|
||||||
),
|
|
||||||
array(
|
|
||||||
'field' => 'institution',
|
|
||||||
'label' => _('Institution'),
|
|
||||||
'rules' => 'trim|max_length[100]',
|
|
||||||
),
|
|
||||||
array(
|
|
||||||
'field' => 'phone',
|
|
||||||
'label' => _('Phone number'),
|
|
||||||
'rules' => 'trim|regex_match[/^\+\d{2,4}\s\d{2,4}\s\d{3,10}+$/i]',
|
|
||||||
)
|
|
||||||
);
|
|
||||||
$this->form_validation->set_rules($config);
|
|
||||||
|
|
||||||
if ($this->form_validation->run() === true) {
|
if ($this->form_validation->run() === true) {
|
||||||
$username = $this->input->post('username');
|
$username = $this->input->post('username');
|
||||||
|
|
||||||
@@ -83,7 +40,7 @@ class Users extends CI_Controller {
|
|||||||
);
|
);
|
||||||
|
|
||||||
if ($this->user->register($username, $this->input->post('password'), $this->input->post('email'), $data)) {
|
if ($this->user->register($username, $this->input->post('password'), $this->input->post('email'), $data)) {
|
||||||
$this->messages->add(sprintf(_("The user '%s' was created"), $username), 'success');
|
$this->messages->add(sprintf(_("The user '%s' has been created successfully"), $username), 'success');
|
||||||
redirect('admin/users', 303);
|
redirect('admin/users', 303);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -103,36 +60,7 @@ class Users extends CI_Controller {
|
|||||||
show_404();
|
show_404();
|
||||||
}
|
}
|
||||||
|
|
||||||
$config = array(
|
if ($this->form_validation->run('users/edit') === true) {
|
||||||
array(
|
|
||||||
'field' => 'firstname',
|
|
||||||
'label' => _('First name'),
|
|
||||||
'rules' => 'trim|required|max_length[50]',
|
|
||||||
),
|
|
||||||
array(
|
|
||||||
'field' => 'lastname',
|
|
||||||
'label' => _('Last name'),
|
|
||||||
'rules' => 'trim|required|max_length[50]',
|
|
||||||
),
|
|
||||||
array(
|
|
||||||
'field' => 'email',
|
|
||||||
'label' => _('Email address'),
|
|
||||||
'rules' => 'trim|required|valid_email',
|
|
||||||
),
|
|
||||||
array(
|
|
||||||
'field' => 'institution',
|
|
||||||
'label' => _('Institution'),
|
|
||||||
'rules' => 'trim|max_length[100]',
|
|
||||||
),
|
|
||||||
array(
|
|
||||||
'field' => 'phone',
|
|
||||||
'label' => _('Phone number'),
|
|
||||||
'rules' => 'trim|regex_match[/^\+\d{2,4}\s\d{2,4}\s\d{3,10}+$/i]',
|
|
||||||
)
|
|
||||||
);
|
|
||||||
$this->form_validation->set_rules($config);
|
|
||||||
|
|
||||||
if ($this->form_validation->run() === true) {
|
|
||||||
$data = array(
|
$data = array(
|
||||||
'email' => $this->input->post('email'),
|
'email' => $this->input->post('email'),
|
||||||
'firstname' => $this->input->post('firstname'),
|
'firstname' => $this->input->post('firstname'),
|
||||||
@@ -142,7 +70,7 @@ class Users extends CI_Controller {
|
|||||||
);
|
);
|
||||||
|
|
||||||
if ($this->user->update($user['id'], $data)) {
|
if ($this->user->update($user['id'], $data)) {
|
||||||
$this->messages->add(sprintf(_("The user '%s' was updated"), $user['username']), 'success');
|
$this->messages->add(sprintf(_("The user '%s' has been updated successfully"), $user['username']), 'success');
|
||||||
redirect('admin/users', 303);
|
redirect('admin/users', 303);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -162,7 +90,7 @@ class Users extends CI_Controller {
|
|||||||
show_404();
|
show_404();
|
||||||
} else {
|
} else {
|
||||||
$this->user->delete($user['id']);
|
$this->user->delete($user['id']);
|
||||||
$this->messages->add(_("The selected user was deleted"), 'success');
|
$this->messages->add(_("The selected user has been deleted successfully"), 'success');
|
||||||
redirect('admin/users', 303);
|
redirect('admin/users', 303);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -55,4 +55,13 @@ class Ajax extends CI_Controller {
|
|||||||
$data['description'] = $this->input->post('content');
|
$data['description'] = $this->input->post('content');
|
||||||
$this->project->update($this->session->userdata('active_project'), $data);
|
$this->project->update($this->session->userdata('active_project'), $data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sorts a programs parameters.
|
||||||
|
*/
|
||||||
|
public function sort_parameters() {
|
||||||
|
$this->load->model('parameter');
|
||||||
|
$this->parameter->sort($this->input->post('parameters'));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -33,30 +33,23 @@ class Auth extends CI_Controller {
|
|||||||
*/
|
*/
|
||||||
public function login() {
|
public function login() {
|
||||||
if ($this->access->loggedIn()) {
|
if ($this->access->loggedIn()) {
|
||||||
redirect();
|
redirect('dashboard');
|
||||||
}
|
}
|
||||||
|
|
||||||
// validate form input
|
$data['messages'] = $this->messages->get('success');
|
||||||
$this->form_validation->set_rules('username', _('Username'), 'required');
|
|
||||||
$this->form_validation->set_rules('password', _('Password'), 'required');
|
|
||||||
|
|
||||||
if ($this->form_validation->run() == true) {
|
if ($this->form_validation->run() === true) {
|
||||||
// check for "remember me"
|
// check for "remember me"
|
||||||
$remember = (boolean) $this->input->post('remember');
|
$remember = (boolean) $this->input->post('remember');
|
||||||
|
|
||||||
if ($this->access->login($this->input->post('username'), $this->input->post('password'), $remember)) {
|
if ($this->access->login($this->input->post('username'), $this->input->post('password'), $remember)) {
|
||||||
$this->data['success'] = true;
|
redirect('dashboard', 303);
|
||||||
redirect('dashboard', 'refresh');
|
|
||||||
} else { // if the login was un-successful
|
} else { // if the login was un-successful
|
||||||
$this->data['success'] = false;
|
$data['errors'] = $this->messages->get('error');
|
||||||
$this->data['message'] = $this->access->errors();
|
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
$this->data['message'] = validation_errors() ? validation_errors() : null;
|
|
||||||
$this->data['username'] = $this->form_validation->set_value('username');
|
|
||||||
|
|
||||||
$this->load->view('auth/login', $this->data);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$this->load->view('auth/login', $data);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -64,8 +57,7 @@ class Auth extends CI_Controller {
|
|||||||
*/
|
*/
|
||||||
public function logout() {
|
public function logout() {
|
||||||
$logout = $this->access->logout();
|
$logout = $this->access->logout();
|
||||||
|
redirect('auth/login');
|
||||||
redirect(base_url(), 'refresh');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -114,85 +106,66 @@ class Auth extends CI_Controller {
|
|||||||
* Allows users to edit their settings.
|
* Allows users to edit their settings.
|
||||||
*/
|
*/
|
||||||
public function settings() {
|
public function settings() {
|
||||||
if (!$this->access->loggedIn()) {
|
$user = $this->access->getCurrentUser();
|
||||||
redirect('auth/login', 'refresh');
|
|
||||||
}
|
|
||||||
|
|
||||||
// validate the form
|
if ($this->form_validation->run() === true) {
|
||||||
$this->form_validation->set_rules('new_password', _('New password'), 'min_length[' . $this->config->item('min_password_length', 'auth') . ']|max_length[' . $this->config->item('max_password_length', 'access') . ']|matches[new_password_confirm]');
|
|
||||||
|
|
||||||
if ($this->form_validation->run() == true) {
|
|
||||||
// change password if needed
|
// change password if needed
|
||||||
if ($this->input->post('new_password') != '') {
|
if ($this->input->post('new_password') != '') {
|
||||||
$username = $this->session->userdata('username');
|
$username = $this->session->userdata('username');
|
||||||
$change = $this->access->changePassword($username, $this->input->post('old_password'), $this->input->post('new_password'));
|
$change = $this->access->changePassword($username, $this->input->post('old_password'), $this->input->post('new_password'));
|
||||||
|
// if ($change) {
|
||||||
if ($change) {
|
// $this->logout();
|
||||||
$this->logout();
|
// }
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// update user
|
// update users table
|
||||||
$updateData = array(
|
$data = array(
|
||||||
'firstname' => $this->input->post('firstname'),
|
'email' => $this->input->post('email'),
|
||||||
'lastname' => $this->input->post('lastname'),
|
'firstname' => $this->input->post('firstname'),
|
||||||
'institution' => $this->input->post('institution'),
|
'lastname' => $this->input->post('lastname'),
|
||||||
'phone' => $this->input->post('phone'),
|
'institution' => $this->input->post('institution'),
|
||||||
'email' => $this->input->post('email'),
|
'phone' => $this->input->post('phone')
|
||||||
);
|
);
|
||||||
$this->access->updateUser($this->session->userdata('user_id'), $updateData);
|
|
||||||
|
|
||||||
// output JSON data
|
if ($this->user->update($user['id'], $data)) {
|
||||||
$this->output->set_content_type('application/json')
|
$this->messages->add(_("Settings saved successfully"), 'success');
|
||||||
->set_output(json_encode(array('success' => true)));
|
redirect('auth/settings', 303);
|
||||||
} else {
|
}
|
||||||
$data['success'] = true;
|
|
||||||
$data['data'] = $this->access->getCurrentUser();
|
|
||||||
|
|
||||||
// output JSON data
|
|
||||||
$this->output->set_content_type('application/json')
|
|
||||||
->set_output(json_encode($data));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$this->load->view('auth/settings', $user);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Allows users to request a new password.
|
* Allows users to request a new password.
|
||||||
*/
|
*/
|
||||||
public function forgot_password() {
|
public function forgot_password() {
|
||||||
$this->form_validation->set_rules('email', _('eMail address'), 'required');
|
if ($this->form_validation->run() === true) {
|
||||||
if ($this->form_validation->run() == false) {
|
// run the forgotten password method to email an activation code to the user
|
||||||
//setup the input
|
$forgotten = $this->access->forgottenPassword($this->input->post('email'));
|
||||||
$this->data['email'] = array('name' => 'email',
|
|
||||||
'id' => 'email',
|
|
||||||
);
|
|
||||||
//set any errors and display the form
|
|
||||||
$this->data['message'] = (validation_errors()) ? validation_errors() : $this->session->flashdata('message');
|
|
||||||
$this->load->view('auth/forgot_password', $this->data);
|
|
||||||
} else {
|
|
||||||
//run the forgotten password method to email an activation code to the user
|
|
||||||
$forgotten = $this->access->forgotten_password($this->input->post('email'));
|
|
||||||
|
|
||||||
if ($forgotten) { //if there were no errors
|
if ($forgotten) { // if there were no errors
|
||||||
$this->session->set_flashdata('message', $this->access->messages());
|
redirect('auth/login'); // TODO Display a confirmation page here instead of the login page
|
||||||
redirect("auth/login", 'refresh'); //we should display a confirmation page here instead of the login page
|
|
||||||
} else {
|
} else {
|
||||||
$this->session->set_flashdata('message', $this->access->errors());
|
redirect('auth/forgot_password');
|
||||||
redirect("auth/forgot_password", 'refresh');
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$data['messages'] = $this->messages->get('success');
|
||||||
|
$data['errors'] = $this->messages->get('error');
|
||||||
|
|
||||||
|
$this->load->view('auth/forgot_password', $data);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Final step for forgotten password.
|
* Final step for forgotten password.
|
||||||
*/
|
*/
|
||||||
public function reset_password($code) {
|
public function reset_password($code) {
|
||||||
$reset = $this->access->forgotten_password_complete($code);
|
$reset = $this->access->forgottenPasswordComplete($code);
|
||||||
|
|
||||||
if ($reset) { //if the reset worked then send them to the login page
|
if ($reset) { // if the reset worked then send them to the login page
|
||||||
$this->session->set_flashdata('message', $this->access->messages());
|
|
||||||
redirect('auth/login');
|
redirect('auth/login');
|
||||||
} else { //if the reset didnt work then send them back to the forgot password page
|
} else { // if the reset didn't work then send them back to the forgot password page
|
||||||
$this->session->set_flashdata('message', $this->access->errors());
|
|
||||||
redirect('auth/forgot_password');
|
redirect('auth/forgot_password');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,52 +0,0 @@
|
|||||||
<?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
|
|
||||||
* 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
|
|
||||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
||||||
* THE SOFTWARE.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Karsten Heiken <karsten@disposed.de>
|
|
||||||
*/
|
|
||||||
class Settings extends CI_Controller {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Constructor.
|
|
||||||
*/
|
|
||||||
public function __construct() {
|
|
||||||
parent::__construct();
|
|
||||||
$this->load->model('program');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Show a list of all available programs.
|
|
||||||
*/
|
|
||||||
public function index() {
|
|
||||||
$profile = $this->user->profile();
|
|
||||||
$profile_fields = array(
|
|
||||||
array('firstname', _('First name'), 'text'),
|
|
||||||
array('lastname', _('Last name'), 'text'),
|
|
||||||
array('intitution', _('Institution'), 'text'),
|
|
||||||
);
|
|
||||||
$tpl['profile'] = $profile;
|
|
||||||
$tpl['profile_fields'] = $profile_fields;
|
|
||||||
$this->load->view('user/settings', $tpl);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
44
application/core/Admin_Controller.php
Normal file
44
application/core/Admin_Controller.php
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
<?php defined('BASEPATH') || exit('No direct script access allowed');
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2011 Eike Foken <kontakt@eikefoken.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
|
||||||
|
* 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
|
||||||
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
* THE SOFTWARE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Simple controller for admin pages.
|
||||||
|
*
|
||||||
|
* @author Eike Foken <kontakt@eikefoken.de>
|
||||||
|
*/
|
||||||
|
class Admin_Controller extends CI_Controller {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Calls the parent constructor.
|
||||||
|
*/
|
||||||
|
public function __construct() {
|
||||||
|
parent::__construct();
|
||||||
|
|
||||||
|
if (!$this->access->isAdmin()) {
|
||||||
|
show_error(_('Shove off, this is for admins.'), 403);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* End of file Admin_Controller.php */
|
||||||
|
/* Location: ./application/core/Admin_Controller.php */
|
||||||
@@ -1,20 +0,0 @@
|
|||||||
<?php defined('BASEPATH') || exit("No direct script access allowed");
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Extends CI's controller class.
|
|
||||||
*
|
|
||||||
* @author Eike Foken <kontakt@eikefoken.de>
|
|
||||||
*/
|
|
||||||
class MY_Controller extends CI_Controller {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Calls the parent constructor and loads the relevant language file.
|
|
||||||
*/
|
|
||||||
public function __construct() {
|
|
||||||
parent::__construct();
|
|
||||||
|
|
||||||
// load relevant language file
|
|
||||||
$this->lang->load(strtolower($this->router->class));
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,43 +0,0 @@
|
|||||||
<?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
|
|
||||||
* 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
|
|
||||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
||||||
* THE SOFTWARE.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Headings
|
|
||||||
*/
|
|
||||||
$lang['location'] = 'Location';
|
|
||||||
$lang['owner'] = 'Owner';
|
|
||||||
$lang['actions'] = 'Actions';
|
|
||||||
$lang['technical_info'] = 'Technical information';
|
|
||||||
$lang['hardware_os'] = 'Hardware & OS';
|
|
||||||
$lang['scattport_stats'] = 'ScattPort statistics';
|
|
||||||
|
|
||||||
/*
|
|
||||||
* server status
|
|
||||||
*/
|
|
||||||
$lang['busy'] = 'busy';
|
|
||||||
$lang['offline'] = 'offline';
|
|
||||||
$lang['available'] = 'available';
|
|
||||||
|
|
||||||
$lang['workload'] = 'Workload';
|
|
||||||
$lang['completed_jobs'] = 'Completed jobs';
|
|
||||||
@@ -1,74 +0,0 @@
|
|||||||
msgid ""
|
|
||||||
msgstr ""
|
|
||||||
"Project-Id-Version: PACKAGE VERSION\n"
|
|
||||||
"Report-Msgid-Bugs-To: \n"
|
|
||||||
"POT-Creation-Date: 2011-08-10 21:25+0200\n"
|
|
||||||
"PO-Revision-Date: 2011-08-10 22:00+0200\n"
|
|
||||||
"Last-Translator: Karsten Heiken <karsten@disposed.de>\n"
|
|
||||||
"Language-Team: German <>\n"
|
|
||||||
"Language: \n"
|
|
||||||
"MIME-Version: 1.0\n"
|
|
||||||
"Content-Type: text/plain; charset=UTF-8\n"
|
|
||||||
"Content-Transfer-Encoding: 8bit\n"
|
|
||||||
"Plural-Forms: nplurals=2; plural=(n!=1);\n"
|
|
||||||
|
|
||||||
msgid "Users"
|
|
||||||
msgstr "Benutzer"
|
|
||||||
|
|
||||||
msgid "Available users"
|
|
||||||
msgstr "Alle verfügbaren Benutzer"
|
|
||||||
|
|
||||||
msgid "Username"
|
|
||||||
msgstr "Benutzername"
|
|
||||||
|
|
||||||
msgid "Full name"
|
|
||||||
msgstr "Vollständiger Name"
|
|
||||||
|
|
||||||
msgid "Actions"
|
|
||||||
msgstr "Aktionen"
|
|
||||||
|
|
||||||
msgid "Edit"
|
|
||||||
msgstr "Bearbeiten"
|
|
||||||
|
|
||||||
msgid "Delete"
|
|
||||||
msgstr "Löschen"
|
|
||||||
|
|
||||||
msgid "Create new user"
|
|
||||||
msgstr "Neuen Benutzer erstellen"
|
|
||||||
|
|
||||||
msgid "Edit user '%s'"
|
|
||||||
msgstr "Benutzer »%s« bearbeiten"
|
|
||||||
|
|
||||||
msgid "Required information"
|
|
||||||
msgstr "Erforderliche Angaben"
|
|
||||||
|
|
||||||
msgid "Optional information"
|
|
||||||
msgstr "Optionale Angaben"
|
|
||||||
|
|
||||||
msgid "Email address"
|
|
||||||
msgstr "E-Mail-Adresse"
|
|
||||||
|
|
||||||
msgid "First name"
|
|
||||||
msgstr "Vorname"
|
|
||||||
|
|
||||||
msgid "Last name"
|
|
||||||
msgstr "Nachname"
|
|
||||||
|
|
||||||
msgid "Institution"
|
|
||||||
msgstr "Institution"
|
|
||||||
|
|
||||||
msgid "Phone number"
|
|
||||||
msgstr "Telefonnummer"
|
|
||||||
|
|
||||||
msgid "Language"
|
|
||||||
msgstr "Sprache"
|
|
||||||
|
|
||||||
msgid "Example"
|
|
||||||
msgstr "Beispiel"
|
|
||||||
|
|
||||||
msgid "Save"
|
|
||||||
msgstr "Speichern"
|
|
||||||
|
|
||||||
msgid "Cancel"
|
|
||||||
msgstr "Abbrechen"
|
|
||||||
|
|
||||||
@@ -1,67 +0,0 @@
|
|||||||
msgid ""
|
|
||||||
msgstr ""
|
|
||||||
"Project-Id-Version: PACKAGE VERSION\n"
|
|
||||||
"Report-Msgid-Bugs-To: \n"
|
|
||||||
"POT-Creation-Date: 2011-08-10 21:25+0200\n"
|
|
||||||
"PO-Revision-Date: 2011-08-10 22:00+0200\n"
|
|
||||||
"Last-Translator: Karsten Heiken <karsten@disposed.de>\n"
|
|
||||||
"Language-Team: English <>\n"
|
|
||||||
"Language: \n"
|
|
||||||
"MIME-Version: 1.0\n"
|
|
||||||
"Content-Type: text/plain; charset=UTF-8\n"
|
|
||||||
"Content-Transfer-Encoding: 8bit\n"
|
|
||||||
"Plural-Forms: nplurals=2; plural=(n!=1);\n"
|
|
||||||
|
|
||||||
msgid "users"
|
|
||||||
msgstr "Users"
|
|
||||||
|
|
||||||
msgid "available_users"
|
|
||||||
msgstr "Available users"
|
|
||||||
|
|
||||||
msgid "username"
|
|
||||||
msgstr "Username"
|
|
||||||
|
|
||||||
msgid "realname"
|
|
||||||
msgstr "Name"
|
|
||||||
|
|
||||||
msgid "options"
|
|
||||||
msgstr "Options"
|
|
||||||
|
|
||||||
msgid "user_edit"
|
|
||||||
msgstr "Edit"
|
|
||||||
|
|
||||||
msgid "user_create"
|
|
||||||
msgstr "Create new user"
|
|
||||||
|
|
||||||
msgid "user_delete"
|
|
||||||
msgstr "Delete"
|
|
||||||
|
|
||||||
msgid "create_user"
|
|
||||||
msgstr "Create a new user"
|
|
||||||
|
|
||||||
msgid "edit_user"
|
|
||||||
msgstr "Edit user"
|
|
||||||
|
|
||||||
msgid "field_username"
|
|
||||||
msgstr "Username"
|
|
||||||
|
|
||||||
msgid "field_password"
|
|
||||||
msgstr "Password"
|
|
||||||
|
|
||||||
msgid "field_password_confirm"
|
|
||||||
msgstr "Confirm password"
|
|
||||||
|
|
||||||
msgid "field_firstname"
|
|
||||||
msgstr "First name"
|
|
||||||
|
|
||||||
msgid "field_lastname"
|
|
||||||
msgstr "Last name"
|
|
||||||
|
|
||||||
msgid "field_email"
|
|
||||||
msgstr "Email address"
|
|
||||||
|
|
||||||
msgid "field_institution"
|
|
||||||
msgstr "Institution"
|
|
||||||
|
|
||||||
msgid "field_phone"
|
|
||||||
msgstr "Phone number"
|
|
||||||
@@ -7,279 +7,240 @@
|
|||||||
*/
|
*/
|
||||||
class Access {
|
class Access {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Contains the CI instance.
|
* Contains the CI instance.
|
||||||
*/
|
*/
|
||||||
protected $ci;
|
protected $ci;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Contains occured messages (using the language file).
|
* Contains occured messages (using the language file).
|
||||||
*
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
protected $messages = array();
|
protected $messages = array();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Contains occured errors (using the language file).
|
* Contains occured errors (using the language file).
|
||||||
*
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
protected $errors = array();
|
protected $errors = array();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor.
|
* Constructor.
|
||||||
*/
|
*/
|
||||||
public function __construct() {
|
public function __construct() {
|
||||||
$this->ci =& get_instance();
|
$this->ci =& get_instance();
|
||||||
$this->ci->load->config('auth', true);
|
$this->ci->load->config('auth', true);
|
||||||
$this->ci->load->library('email');
|
$this->ci->load->library('email');
|
||||||
$this->ci->lang->load('auth');
|
$this->ci->lang->load('auth');
|
||||||
$this->ci->load->model('user');
|
$this->ci->load->model('user');
|
||||||
$this->ci->load->model('group');
|
$this->ci->load->model('group');
|
||||||
$this->ci->load->helper('cookie');
|
$this->ci->load->helper('cookie');
|
||||||
|
|
||||||
// auto-login the user if they are remembered
|
// auto-login the user if they are remembered
|
||||||
if (!$this->loggedIn() && get_cookie('username') && get_cookie('remember_code')) {
|
if (!$this->loggedIn() && get_cookie('username') && get_cookie('remember_code')) {
|
||||||
$this->ci->access = $this;
|
$this->ci->access = $this;
|
||||||
$this->ci->user->loginRememberedUser();
|
$this->ci->user->loginRememberedUser();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Changes a users password.
|
* Changes a users password.
|
||||||
*
|
*
|
||||||
* @return boolean
|
* @param string $username
|
||||||
*/
|
* @param string $old
|
||||||
public function changePassword($username, $old, $new) {
|
* @param string $new
|
||||||
if ($this->ci->user->changePassword($username, $old, $new)) {
|
* @return boolean
|
||||||
$this->setMessage(_('Password successfully changed'));
|
*/
|
||||||
return true;
|
public function changePassword($username, $old, $new) {
|
||||||
}
|
if ($this->ci->user->changePassword($username, $old, $new)) {
|
||||||
|
$this->ci->messages->add(_('Password successfully changed'), 'success');
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
$this->setError(_('Unable to change password'));
|
$this->ci->messages->add(_('Unable to change password'), 'error');
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* forgotten password feature
|
* forgotten password feature
|
||||||
*
|
*
|
||||||
* @return void
|
* @param string $email
|
||||||
*/
|
* @return void
|
||||||
public function forgottenPassword($username) {
|
*/
|
||||||
if ($this->ci->user->forgottenPassword($username)) {
|
public function forgottenPassword($email) {
|
||||||
// get user information
|
if ($this->ci->user->forgottenPassword($email)) {
|
||||||
$user = $this->getUserByUsername($username);
|
// get user information
|
||||||
|
$user = $this->ci->user->getUserByEmail($email);
|
||||||
|
|
||||||
$data = array(
|
$data = array(
|
||||||
'username' => $user['username'],
|
'username' => $user['username'],
|
||||||
'forgotten_password_code' => $user['forgotten_password_code']
|
'forgotten_password_code' => $user['forgotten_password_code'],
|
||||||
);
|
);
|
||||||
|
|
||||||
$message = $this->ci->load->view($this->ci->config->item('email_templates', 'auth') . $this->ci->config->item('email_forgot_password', 'auth'), $data, true);
|
$message = $this->ci->load->view('auth/email/forgot_password', $data, true);
|
||||||
$this->ci->email->clear();
|
$this->ci->email->clear();
|
||||||
$config['mailtype'] = $this->ci->config->item('email_type', 'auth');
|
$config['mailtype'] = $this->ci->config->item('email_type', 'auth');
|
||||||
$this->ci->email->initialize($config);
|
$this->ci->email->initialize($config);
|
||||||
$this->ci->email->set_newline("\r\n");
|
$this->ci->email->set_newline("\r\n");
|
||||||
$this->ci->email->from($this->ci->config->item('admin_email', 'auth'), 'Scattport');
|
$this->ci->email->from($this->ci->config->item('admin_email', 'auth'), 'Scattport');
|
||||||
$this->ci->email->to($user['email']);
|
$this->ci->email->to($user['email']);
|
||||||
$this->ci->email->subject('Scattport - Forgotten Password Verification');
|
$this->ci->email->subject('ScattPort - Forgotten Password Verification');
|
||||||
$this->ci->email->message($message);
|
$this->ci->email->message($message);
|
||||||
|
|
||||||
if ($this->ci->email->send()) {
|
if ($this->ci->email->send()) {
|
||||||
$this->setMessage(_('Password reset email sent'));
|
$this->ci->messages->add(_('Password reset email sent'), 'success');
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
$this->setError(_('Unable to reset password'));
|
$this->ci->messages->add(_('Unable to send password reset email'), 'error');
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$this->setError(_('Unable to reset password'));
|
$this->ci->messages->add(_('This email address is not registered'), 'error');
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* forgotten_password_complete
|
* forgotten_password_complete
|
||||||
*
|
*
|
||||||
* @return void
|
* @param string $code
|
||||||
*/
|
* @return void
|
||||||
public function forgottenPasswordComplete($code) {
|
*/
|
||||||
$profile = $this->ci->user->profile($code, true); // pass the code to profile
|
public function forgottenPasswordComplete($code) {
|
||||||
|
$profile = $this->ci->user->profile($code, true); // pass the code to profile
|
||||||
|
|
||||||
if (!is_object($profile)) {
|
if (!is_object($profile)) {
|
||||||
$this->setError(_('Unable to change password'));
|
$this->ci->messages->add(_('Unable to change password'), 'error');
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
$new_password = $this->ci->user->forgottenPasswordComplete($code, $profile->salt);
|
$new_password = $this->ci->user->forgottenPasswordComplete($code, $profile->salt);
|
||||||
|
|
||||||
if ($new_password) {
|
if ($new_password) {
|
||||||
$data = array(
|
$data = array(
|
||||||
'username' => $profile->username,
|
'username' => $profile->username,
|
||||||
'new_password' => $new_password
|
'new_password' => $new_password
|
||||||
);
|
);
|
||||||
|
|
||||||
$message = $this->ci->load->view($this->ci->config->item('email_templates', 'ion_auth').$this->ci->config->item('email_forgot_password_complete', 'ion_auth'), $data, true);
|
$message = $this->ci->load->view('auth/email/forgot_password_complete', $data, true);
|
||||||
|
|
||||||
$this->ci->email->clear();
|
$this->ci->email->clear();
|
||||||
$config['mailtype'] = $this->ci->config->item('email_type', 'ion_auth');
|
$config['mailtype'] = $this->ci->config->item('email_type', 'auth');
|
||||||
$this->ci->email->initialize($config);
|
$this->ci->email->initialize($config);
|
||||||
$this->ci->email->set_newline("\r\n");
|
$this->ci->email->set_newline("\r\n");
|
||||||
$this->ci->email->from($this->ci->config->item('admin_email', 'ion_auth'), $this->ci->config->item('site_title', 'ion_auth'));
|
$this->ci->email->from($this->ci->config->item('admin_email', 'auth'), $this->ci->config->item('site_title', 'auth'));
|
||||||
$this->ci->email->to($profile->email);
|
$this->ci->email->to($profile->email);
|
||||||
$this->ci->email->subject($this->ci->config->item('site_title', 'ion_auth') . ' - New Password');
|
$this->ci->email->subject('ScattPort - New Password');
|
||||||
$this->ci->email->message($message);
|
$this->ci->email->message($message);
|
||||||
|
|
||||||
if ($this->ci->email->send()) {
|
if ($this->ci->email->send()) {
|
||||||
$this->setMessage(_('Password successfully changed'));
|
$this->ci->messages->add(_('Password successfully changed'), 'success');
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
$this->setError(_('Unable to change password'));
|
$this->ci->messages->add(_('Unable to change password'), 'error');
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->setError(_('Unable to change password'));
|
$this->ci->messages->add(_('Unable to change password'), 'error');
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Logs the user in.
|
* Logs the user in.
|
||||||
*
|
*
|
||||||
* @return boolean
|
* @param string $username
|
||||||
*/
|
* @param string $password
|
||||||
public function login($username, $password, $remember = false) {
|
* @param boolean $remember
|
||||||
if ($this->ci->user->login($username, $password, $remember)) {
|
* @return boolean
|
||||||
$this->setMessage(_('Logged in successfully'));
|
*/
|
||||||
return true;
|
public function login($username, $password, $remember = false) {
|
||||||
} else {
|
if ($this->ci->user->login($username, $password, $remember)) {
|
||||||
$this->setError(_('Incorrect username or password'));
|
$this->ci->messages->add(_('Logged in successfully'), 'success');
|
||||||
return false;
|
return true;
|
||||||
}
|
} else {
|
||||||
}
|
$this->ci->messages->add(_('Incorrect username or password'), 'error');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Logs the user out.
|
* Logs the user out.
|
||||||
*
|
*
|
||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
public function logout() {
|
public function logout() {
|
||||||
$this->ci->session->unset_userdata('username');
|
$this->ci->session->unset_userdata('username');
|
||||||
$this->ci->session->unset_userdata('group');
|
$this->ci->session->unset_userdata('group');
|
||||||
$this->ci->session->unset_userdata('user_id');
|
$this->ci->session->unset_userdata('user_id');
|
||||||
|
|
||||||
// delete the remember cookies if they exist
|
// delete the remember cookies if they exist
|
||||||
if (get_cookie('username')) {
|
if (get_cookie('username')) {
|
||||||
delete_cookie('username');
|
delete_cookie('username');
|
||||||
} if (get_cookie('remember_code')) {
|
} if (get_cookie('remember_code')) {
|
||||||
delete_cookie('remember_code');
|
delete_cookie('remember_code');
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->ci->session->sess_destroy();
|
$this->ci->session->sess_destroy();
|
||||||
|
|
||||||
$this->setMessage(_('Logged out successfully'));
|
$this->ci->messages->add(_('Logged out successfully'), 'success');
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if the user is logged in.
|
* Checks if the user is logged in.
|
||||||
*
|
*
|
||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
public function loggedIn() {
|
public function loggedIn() {
|
||||||
return (boolean) $this->ci->session->userdata('username');
|
return (boolean) $this->ci->session->userdata('username');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if the user is an admin.
|
* Checks if the user is an admin.
|
||||||
*
|
*
|
||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
public function isAdmin() {
|
public function isAdmin() {
|
||||||
$adminGroup = 'admins';
|
$adminGroup = 'admins';
|
||||||
$userGroup = $this->ci->session->userdata('group');
|
$userGroup = $this->ci->session->userdata('group');
|
||||||
return $userGroup == $adminGroup;
|
return $userGroup == $adminGroup;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if the current user is assigned to the specified group.
|
* Checks if the current user is assigned to the specified group.
|
||||||
*
|
*
|
||||||
* @return boolean
|
* @param string $checkGroup
|
||||||
*/
|
* @return boolean
|
||||||
public function isGroup($checkGroup) {
|
*/
|
||||||
$userGroup = $this->ci->session->userdata('group');
|
public function isGroup($checkGroup) {
|
||||||
|
$userGroup = $this->ci->session->userdata('group');
|
||||||
|
|
||||||
if (is_array($checkGroup)) {
|
if (is_array($checkGroup)) {
|
||||||
return in_array($userGroup, $checkGroup);
|
return in_array($userGroup, $checkGroup);
|
||||||
}
|
}
|
||||||
return $userGroup == $checkGroup;
|
return $userGroup == $checkGroup;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the current logged in user.
|
* Gets the current logged in user.
|
||||||
*
|
*
|
||||||
* @return object
|
* @return object
|
||||||
*/
|
*/
|
||||||
public function getCurrentUser() {
|
public function getCurrentUser() {
|
||||||
return $this->ci->user->getUserByID($this->ci->session->userdata('user_id'));
|
return $this->ci->user->getUserByID($this->ci->session->userdata('user_id'));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the profile of the current user.
|
* Gets the profile of the current user.
|
||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function profile() {
|
public function profile() {
|
||||||
return $this->ci->user->profile($this->ci->session->userdata('username'));
|
return $this->ci->user->profile($this->ci->session->userdata('username'));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets a message.
|
|
||||||
*
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
public function setMessage($message) {
|
|
||||||
$this->messages[] = $message;
|
|
||||||
return $message;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets all messages.
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function messages() {
|
|
||||||
$output = '';
|
|
||||||
foreach ($this->messages as $message) {
|
|
||||||
$output .= $message . '<br />';
|
|
||||||
}
|
|
||||||
|
|
||||||
return $output;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets an error message.
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function setError($error) {
|
|
||||||
$this->errors[] = $error;
|
|
||||||
return $error;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets all error messages.
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function errors() {
|
|
||||||
$output = '';
|
|
||||||
foreach ($this->errors as $error) {
|
|
||||||
$output .= $error . '<br />';
|
|
||||||
}
|
|
||||||
|
|
||||||
return $output;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -23,6 +23,44 @@ class MY_Session extends CI_Session {
|
|||||||
return sha1(uniqid(microtime() . $this->CI->input->ip_address(), true));
|
return sha1(uniqid(microtime() . $this->CI->input->ip_address(), true));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Writes the session data.
|
||||||
|
*
|
||||||
|
* @see CI_Session::sess_write()
|
||||||
|
*/
|
||||||
|
public function sess_write() {
|
||||||
|
// are we saving custom data to the DB? If not, all we do is update the cookie
|
||||||
|
if ($this->sess_use_database === false) {
|
||||||
|
$this->_set_cookie();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// set the custom userdata, the session data we will set in a second
|
||||||
|
$customUserdata = $this->userdata;
|
||||||
|
$cookieUserdata = array();
|
||||||
|
|
||||||
|
// before continuing, we need to determine if there is any custom data to deal with.
|
||||||
|
foreach (array('session_id', 'user_id', 'ip_address', 'user_agent', 'last_activity') as $val) {
|
||||||
|
unset($customUserdata[$val]);
|
||||||
|
$cookieUserdata[$val] = $this->userdata[$val];
|
||||||
|
}
|
||||||
|
|
||||||
|
// did we find any custom data? If not, we turn the empty array into a string
|
||||||
|
if (count($customUserdata) === 0) {
|
||||||
|
$customUserdata = '';
|
||||||
|
} else {
|
||||||
|
// serialize the custom data array so we can store it
|
||||||
|
$customUserdata = $this->_serialize($customUserdata);
|
||||||
|
}
|
||||||
|
|
||||||
|
// run the update query
|
||||||
|
$this->CI->db->where('session_id', $this->userdata['session_id']);
|
||||||
|
$this->CI->db->update($this->sess_table_name, array('last_activity' => $this->userdata['last_activity'], 'user_id' => $this->userdata['user_id'], 'user_data' => $customUserdata));
|
||||||
|
|
||||||
|
// write the cookie.
|
||||||
|
$this->_set_cookie($cookieUserdata);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new session.
|
* Creates a new session.
|
||||||
*
|
*
|
||||||
@@ -33,7 +71,8 @@ class MY_Session extends CI_Session {
|
|||||||
'session_id' => $this->generateHash(),
|
'session_id' => $this->generateHash(),
|
||||||
'ip_address' => $this->CI->input->ip_address(),
|
'ip_address' => $this->CI->input->ip_address(),
|
||||||
'user_agent' => substr($this->CI->input->user_agent(), 0, 50),
|
'user_agent' => substr($this->CI->input->user_agent(), 0, 50),
|
||||||
'last_activity' => $this->now
|
'last_activity' => $this->now,
|
||||||
|
'user_id' => null,
|
||||||
);
|
);
|
||||||
|
|
||||||
// save data to the DB if needed
|
// save data to the DB if needed
|
||||||
@@ -61,6 +100,7 @@ class MY_Session extends CI_Session {
|
|||||||
|
|
||||||
$this->userdata['session_id'] = $newSessionID;
|
$this->userdata['session_id'] = $newSessionID;
|
||||||
$this->userdata['last_activity'] = $this->now;
|
$this->userdata['last_activity'] = $this->now;
|
||||||
|
$this->userdata['user_id'] = array_key_exists('user_id', $this->userdata) ? $this->userdata['user_id'] : null;
|
||||||
|
|
||||||
$cookieData = null;
|
$cookieData = null;
|
||||||
|
|
||||||
@@ -75,7 +115,7 @@ class MY_Session extends CI_Session {
|
|||||||
$this->CI->db->update($this->sess_table_name, array('last_activity' => $this->now, 'user_id' => $this->userdata['user_id'], 'session_id' => $newSessionID), array('session_id' => $oldSessionID));
|
$this->CI->db->update($this->sess_table_name, array('last_activity' => $this->now, 'user_id' => $this->userdata['user_id'], 'session_id' => $newSessionID), array('session_id' => $oldSessionID));
|
||||||
|
|
||||||
// update users table if user is logged in
|
// update users table if user is logged in
|
||||||
if (array_key_exists('user_id', $this->userdata) && $this->userdata['user_id'] > 0) {
|
if (array_key_exists('user_id', $this->userdata) && !is_null($this->userdata['user_id'])) {
|
||||||
$this->CI->db->update('users', array('last_activity' => $this->now), array('id' => $this->userdata['user_id']));
|
$this->CI->db->update('users', array('last_activity' => $this->now), array('id' => $this->userdata['user_id']));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,41 +8,40 @@
|
|||||||
class Group extends CI_Model {
|
class Group extends CI_Model {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor.
|
* Calls the parent constructor.
|
||||||
*/
|
*/
|
||||||
public function __construct() {
|
public function __construct() {
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* get
|
* Gets all groups.
|
||||||
*
|
*
|
||||||
* @return object
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function get() {
|
public function get() {
|
||||||
return $this->db->get('groups')->result_array();
|
return $this->db->get('groups')->result_array();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* getGroupByID
|
* Gets a specific group.
|
||||||
*
|
*
|
||||||
* @return object
|
* @param string $id
|
||||||
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function getGroupByID($id) {
|
public function getByID($id) {
|
||||||
$this->db->where('id', $id);
|
return $this->db->get_where('groups', array('id' => $id))->row_array();
|
||||||
return $this->db->get('groups')->row_array();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* getGroupByName
|
* Gets a specific group by it's name.
|
||||||
*
|
*
|
||||||
* @return object
|
* @param string $name
|
||||||
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function getGroupByName($name) {
|
public function getByName($name) {
|
||||||
$this->db->where('name', $name);
|
return $this->db->get_where('groups', array('name' => $name))->row_array();
|
||||||
return $this->db->get('groups')->row_array();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* End of file group.php */
|
/* End of file group.php */
|
||||||
|
|||||||
140
application/models/parameter.php
Normal file
140
application/models/parameter.php
Normal file
@@ -0,0 +1,140 @@
|
|||||||
|
<?php
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2011 Eike Foken <kontakt@eikefoken.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
|
||||||
|
* 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
|
||||||
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
* THE SOFTWARE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Model for parameters.
|
||||||
|
*
|
||||||
|
* Each program has many parameters used for configuration of trials.
|
||||||
|
*
|
||||||
|
* @author Eike Foken <kontakt@eikefoken.de>
|
||||||
|
*/
|
||||||
|
class Parameter extends CI_Model {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Contains the possible types for parameters.
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
private $availableTypes = array('boolean', 'integer', 'float', 'string', 'array');
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Calls the parent constructor.
|
||||||
|
*/
|
||||||
|
public function __construct() {
|
||||||
|
parent::__construct();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets all available parameters for a program.
|
||||||
|
*
|
||||||
|
* @param string $programId
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function getAll($programId) {
|
||||||
|
return $this->db->order_by('sort_number ASC')
|
||||||
|
->get_where('parameters', array('program_id' => $programId))->result_array();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets a specific parameter.
|
||||||
|
*
|
||||||
|
* @param string $id
|
||||||
|
*/
|
||||||
|
public function getById($id) {
|
||||||
|
return $this->db->get_where('parameters', array('id' => $id))->row_array();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the possible parameter types.
|
||||||
|
*/
|
||||||
|
public function getTypes() {
|
||||||
|
return $this->availableTypes;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a new parameter.
|
||||||
|
*
|
||||||
|
* @param array $data
|
||||||
|
* @return mixed Returns the ID of the created parameter, or FALSE if
|
||||||
|
* the insert was unsuccessful.
|
||||||
|
*/
|
||||||
|
public function create($data) {
|
||||||
|
$this->load->helper('hash');
|
||||||
|
|
||||||
|
if (!isset($data['program_id'])) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
do { // generate unique hash
|
||||||
|
$data['id'] = random_hash('16');
|
||||||
|
} while ($this->db->where('id', $data['id'])->from('parameters')->count_all_results() > 0);
|
||||||
|
|
||||||
|
// put new parameter to the end
|
||||||
|
$data['sort_number'] = $this->db->select_max('sort_number')
|
||||||
|
->get_where('parameters', array('program_id' => $data['program_id']))
|
||||||
|
->row()->sort_number + 1;
|
||||||
|
|
||||||
|
$this->db->insert('parameters', $data);
|
||||||
|
return $this->db->affected_rows() > 0 ? $data['id'] : false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Updates a parameter.
|
||||||
|
*
|
||||||
|
* @param array $data
|
||||||
|
* @param string $id
|
||||||
|
* @return boolean Returns TRUE if the update was successful.
|
||||||
|
*/
|
||||||
|
public function update($data, $id) {
|
||||||
|
$this->db->update('parameters', $data, array('id' => $id));
|
||||||
|
return $this->db->affected_rows() == 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Deletes a specified parameter.
|
||||||
|
*
|
||||||
|
* @param string $id
|
||||||
|
* @return boolean Returns TRUE if the deletion was successful.
|
||||||
|
*/
|
||||||
|
public function delete($id) {
|
||||||
|
$this->db->delete('parameters', array('id' => $id));
|
||||||
|
return $this->db->affected_rows() == 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Saves the order of an array of parameters.
|
||||||
|
*
|
||||||
|
* @param array $parameters
|
||||||
|
* @return boolean Returns TRUE if the new order was successfully saved.
|
||||||
|
*/
|
||||||
|
public function sort($parameters) {
|
||||||
|
foreach ($parameters as $number => $id) {
|
||||||
|
$this->db->update('parameters', array('sort_number' => $number), array('id' => $id));
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->db->affected_rows() > 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* End of file parameter.php */
|
||||||
|
/* Location: ./application/models/parameter.php */
|
||||||
@@ -1,5 +1,4 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2011 Karsten Heiken <karsten@disposed.de>
|
* Copyright (c) 2011 Karsten Heiken <karsten@disposed.de>
|
||||||
*
|
*
|
||||||
@@ -24,29 +23,58 @@
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Programs are used to do the actual calculation of a trial.
|
* Programs are used to do the actual calculation of a trial.
|
||||||
*
|
*
|
||||||
* @author Karsten Heiken <karsten@disposed.de>
|
* @author Karsten Heiken <karsten@disposed.de>
|
||||||
|
* @author Eike Foken <kontakt@eikefoken.de>
|
||||||
*/
|
*/
|
||||||
class Program extends CI_Model {
|
class Program extends CI_Model {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new program.
|
* Calls the parent constructor.
|
||||||
*
|
|
||||||
* @param array $data the data of the new program
|
|
||||||
* @return bool was the insert successful
|
|
||||||
*/
|
*/
|
||||||
public function create($data) {
|
public function __construct() {
|
||||||
// TODO: stub
|
parent::__construct();
|
||||||
return FALSE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Delete a program.
|
* Creates a new program.
|
||||||
* @param string the program id to delete
|
*
|
||||||
* @return bool was the deletion successful
|
* @param string $name The name of the new program
|
||||||
|
* @return string|boolean Returns the ID of the new program, or FALSE if
|
||||||
|
* the insert was unsuccessful.
|
||||||
*/
|
*/
|
||||||
public function delete($program_id) {
|
public function create($name) {
|
||||||
return $this->db->delete('programs', array('id' => $program_id));
|
$this->load->helper('hash');
|
||||||
|
|
||||||
|
do { // generate unique hash
|
||||||
|
$id = random_hash('16');
|
||||||
|
} while ($this->db->where('id', $id)->from('programs')->count_all_results() > 0);
|
||||||
|
|
||||||
|
$this->db->insert('programs', array('id' => $id, 'name' => $name));
|
||||||
|
|
||||||
|
return $this->db->affected_rows() > 0 ? $id : false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Updates a program.
|
||||||
|
*
|
||||||
|
* @param string $name The new name of the program
|
||||||
|
* @param string $id The ID of the program to update
|
||||||
|
* @return boolean Returns TRUE if the update was successful
|
||||||
|
*/
|
||||||
|
public function update($name, $id) {
|
||||||
|
$this->db->update('programs', array('name' => $name), array('id' => $id));
|
||||||
|
return $this->db->affected_rows() > 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Deletes a program.
|
||||||
|
*
|
||||||
|
* @param string $programId The program ID to delete
|
||||||
|
* @return boolean Returns TRUE if the deletion was successful
|
||||||
|
*/
|
||||||
|
public function delete($programId) {
|
||||||
|
return $this->db->delete('programs', array('id' => $programId));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -59,13 +87,13 @@ class Program extends CI_Model {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a specific program.
|
* Gets a specific program.
|
||||||
*
|
*
|
||||||
* @param string $prg_id The id of the program to get from the database
|
* @param string $id The id of the program to get from the database
|
||||||
* @return array Declarative array with all available information of the program.
|
* @return array Declarative array with all available information of the program.
|
||||||
*/
|
*/
|
||||||
public function getById($prg_id) {
|
public function getById($id) {
|
||||||
return $this->db->get_where('programs', array('id' => $prg_id))->row_array();
|
return $this->db->get_where('programs', array('id' => $id))->row_array();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -87,13 +115,13 @@ class Program extends CI_Model {
|
|||||||
* )
|
* )
|
||||||
* )
|
* )
|
||||||
*
|
*
|
||||||
* @param type $program_id The program for which we want to get the parameters.
|
* @param string $id The program for which we want to get the parameters.
|
||||||
* @return array The parameters
|
* @return array The parameters
|
||||||
*/
|
*/
|
||||||
public function getParameters($program_id) {
|
public function getParameters($id) {
|
||||||
$query = $this->db->select('id, fieldname, readable, unit, description, type')
|
$query = $this->db->order_by('sort_number ASC')
|
||||||
->get_where('configuration_fields', array('program_id' => $program_id));
|
->get_where('parameters', array('program_id' => $id));
|
||||||
|
|
||||||
return $query->result_array();
|
return $query->result_array();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
<?php defined('BASEPATH') || exit("No direct script access allowed");
|
<?php defined('BASEPATH') || exit('No direct script access allowed');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* User model.
|
* User model.
|
||||||
@@ -7,6 +7,20 @@
|
|||||||
*/
|
*/
|
||||||
class User extends CI_Model {
|
class User extends CI_Model {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Should the salt be stored in the database?
|
||||||
|
*
|
||||||
|
* @var boolean
|
||||||
|
*/
|
||||||
|
private $storeSalt;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Contains the salt length.
|
||||||
|
*
|
||||||
|
* @var integer
|
||||||
|
*/
|
||||||
|
private $saltLength;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Contains the forgotten password key.
|
* Contains the forgotten password key.
|
||||||
*
|
*
|
||||||
@@ -104,7 +118,7 @@ class User extends CI_Model {
|
|||||||
$new = $this->hashPassword($new, $result->salt);
|
$new = $this->hashPassword($new, $result->salt);
|
||||||
|
|
||||||
if ($dbPassword === $old) {
|
if ($dbPassword === $old) {
|
||||||
// store the new password and reset the remember code so all remembered instances have to re-login
|
// reset the remember code so all remembered instances have to re-login
|
||||||
$data = array('password' => $new, 'remember_code' => '');
|
$data = array('password' => $new, 'remember_code' => '');
|
||||||
|
|
||||||
$this->db->update('users', $data, array('username' => $username));
|
$this->db->update('users', $data, array('username' => $username));
|
||||||
@@ -117,6 +131,7 @@ class User extends CI_Model {
|
|||||||
/**
|
/**
|
||||||
* Checks entered usernames.
|
* Checks entered usernames.
|
||||||
*
|
*
|
||||||
|
* @param string $username
|
||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
public function checkUsername($username = '') {
|
public function checkUsername($username = '') {
|
||||||
@@ -129,6 +144,7 @@ class User extends CI_Model {
|
|||||||
/**
|
/**
|
||||||
* Checks entered emails.
|
* Checks entered emails.
|
||||||
*
|
*
|
||||||
|
* @param string $email
|
||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
public function checkEmail($email = '') {
|
public function checkEmail($email = '') {
|
||||||
@@ -141,6 +157,7 @@ class User extends CI_Model {
|
|||||||
/**
|
/**
|
||||||
* Inserts a forgotten password key.
|
* Inserts a forgotten password key.
|
||||||
*
|
*
|
||||||
|
* @param string $email
|
||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
public function forgottenPassword($email = '') {
|
public function forgottenPassword($email = '') {
|
||||||
@@ -158,8 +175,10 @@ class User extends CI_Model {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Forgotten Password Complete
|
* Completes the forgotten password procedure.
|
||||||
*
|
*
|
||||||
|
* @param string $code
|
||||||
|
* @param boolean $salt
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function forgottenPasswordComplete($code, $salt = false) {
|
public function forgottenPasswordComplete($code, $salt = false) {
|
||||||
@@ -174,7 +193,7 @@ class User extends CI_Model {
|
|||||||
|
|
||||||
$data = array(
|
$data = array(
|
||||||
'password' => $this->hashPassword($password, $salt),
|
'password' => $this->hashPassword($password, $salt),
|
||||||
'forgotten_password_code' => null
|
'forgotten_password_code' => null,
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->db->update('users', $data, array('forgotten_password_code' => $code));
|
$this->db->update('users', $data, array('forgotten_password_code' => $code));
|
||||||
@@ -185,15 +204,18 @@ class User extends CI_Model {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* profile
|
* Gets a users profile.
|
||||||
*
|
*
|
||||||
* @return boolean|object
|
* @param string $username
|
||||||
|
* @param boolean $isCode
|
||||||
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
public function profile($username = '', $isCode = false) {
|
public function profile($username = '', $isCode = false) {
|
||||||
if (empty($username)) {
|
if (empty($username)) {
|
||||||
@$username = $this->session->userdata('username');
|
@$username = $this->session->userdata('username');
|
||||||
if(empty($username))
|
if (empty($username)) {
|
||||||
return FALSE;
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->db->select('users.*, groups.name AS `group`, groups.description AS `group_description`');
|
$this->db->select('users.*, groups.name AS `group`, groups.description AS `group_description`');
|
||||||
@@ -207,7 +229,7 @@ class User extends CI_Model {
|
|||||||
|
|
||||||
$query = $this->db->limit(1)->get('users');
|
$query = $this->db->limit(1)->get('users');
|
||||||
|
|
||||||
return $query->num_rows > 0 ? $query->row() : false;
|
return $query->num_rows() > 0 ? $query->row_array() : false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -251,7 +273,6 @@ class User extends CI_Model {
|
|||||||
if ($this->storeSalt) {
|
if ($this->storeSalt) {
|
||||||
$data['salt'] = $salt;
|
$data['salt'] = $salt;
|
||||||
}
|
}
|
||||||
print_r($data);
|
|
||||||
|
|
||||||
$this->db->insert('users', array_merge($data, $additionalData));
|
$this->db->insert('users', array_merge($data, $additionalData));
|
||||||
|
|
||||||
@@ -259,8 +280,11 @@ class User extends CI_Model {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* login
|
* Validates the given password against the username.
|
||||||
*
|
*
|
||||||
|
* @param string $username
|
||||||
|
* @param string $password
|
||||||
|
* @param boolean $remember
|
||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
public function login($username, $password, $remember = false) {
|
public function login($username, $password, $remember = false) {
|
||||||
@@ -300,8 +324,11 @@ class User extends CI_Model {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* get
|
* Gets users.
|
||||||
*
|
*
|
||||||
|
* @param mixed $group
|
||||||
|
* @param integer $limit
|
||||||
|
* @param integer $offset
|
||||||
* @return object
|
* @return object
|
||||||
*/
|
*/
|
||||||
public function get($group = false, $limit = null, $offset = null) {
|
public function get($group = false, $limit = null, $offset = null) {
|
||||||
@@ -332,6 +359,7 @@ class User extends CI_Model {
|
|||||||
/**
|
/**
|
||||||
* Returns the number of users.
|
* Returns the number of users.
|
||||||
*
|
*
|
||||||
|
* @param mixed $group
|
||||||
* @return integer The number of users
|
* @return integer The number of users
|
||||||
*/
|
*/
|
||||||
public function count($group = false) {
|
public function count($group = false) {
|
||||||
@@ -346,6 +374,7 @@ class User extends CI_Model {
|
|||||||
/**
|
/**
|
||||||
* Gets a user by ID.
|
* Gets a user by ID.
|
||||||
*
|
*
|
||||||
|
* @param string $id
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function getUserByID($id = false) {
|
public function getUserByID($id = false) {
|
||||||
@@ -353,74 +382,72 @@ class User extends CI_Model {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->db->where('users.id', $id);
|
$this->db->where('users.id', $id)->limit(1);
|
||||||
$this->db->limit(1);
|
|
||||||
|
|
||||||
return $this->get()->row_array();
|
return $this->get()->row_array();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* getUserByEmail
|
* Gets a user by email.
|
||||||
*
|
*
|
||||||
* @return object
|
* @param string $email
|
||||||
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function getUserByEmail($email) {
|
public function getUserByEmail($email) {
|
||||||
$this->db->where('users.email', $email);
|
$this->db->where('users.email', $email)->limit(1);
|
||||||
$this->db->limit(1);
|
return $this->get()->row_array();
|
||||||
return $this->get();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* getUserByUsername
|
* Gets a user by username.
|
||||||
*
|
*
|
||||||
* @return object
|
* @param string $username
|
||||||
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function getUserByUsername($username) {
|
public function getUserByUsername($username) {
|
||||||
$this->db->where('users.username', $username);
|
$this->db->where('users.username', $username)->limit(1);
|
||||||
$this->db->limit(1);
|
return $this->get()->row_array();
|
||||||
return $this->get();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* getNewestUsers
|
* Gets a specified number of new users.
|
||||||
*
|
*
|
||||||
* @return object
|
* @param integer $limit
|
||||||
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function getNewestUsers($limit = 10) {
|
public function getNewestUsers($limit = 10) {
|
||||||
$this->db->order_by('users.created_on DESC');
|
$this->db->order_by('users.created_on DESC')->limit($limit);
|
||||||
$this->db->limit($limit);
|
return $this->get()->result_array();
|
||||||
return $this->get();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* getUsersGroup
|
* Gets a users group.
|
||||||
*
|
*
|
||||||
* @return object
|
* @param string $id
|
||||||
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function getUsersGroup($id = false) {
|
public function getUsersGroup($id = false) {
|
||||||
// if no ID was passed use the current users ID
|
// if no ID was passed use the current users ID
|
||||||
$id || $id = $this->session->userdata('user_id');
|
$id || $id = $this->session->userdata('user_id');
|
||||||
|
|
||||||
$user = $this->db->select('group_id')->where('id', $id)->get('users')
|
$user = $this->db->select('group_id')->where('id', $id)->get('users')->row();
|
||||||
->row();
|
|
||||||
|
|
||||||
return $this->db->select('name, description')
|
return $this->db->select('name, description')
|
||||||
->where('id', $user->group_id)->get('groups')->row();
|
->where('id', $user->group_id)->get('groups')->row_array();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* update
|
* Updates a user.
|
||||||
*
|
*
|
||||||
* @return boolean
|
* @param string $id
|
||||||
|
* @param array $data
|
||||||
|
* @return boolean Returns TRUE if the update was successful.
|
||||||
*/
|
*/
|
||||||
public function update($id, $data) {
|
public function update($id, $data) {
|
||||||
$user = $this->getUserByID($id);
|
$user = $this->getUserByID($id);
|
||||||
|
|
||||||
$this->db->trans_begin();
|
|
||||||
|
|
||||||
if (array_key_exists('username', $data) && $this->checkUsername($data['username']) && $user['username'] !== $data['username']) {
|
if (array_key_exists('username', $data) && $this->checkUsername($data['username']) && $user['username'] !== $data['username']) {
|
||||||
$this->db->trans_rollback();
|
$this->messages->add(_('The entered username is already in use.'), 'error');
|
||||||
$this->access->setError('account_creation_duplicate_username');
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -432,38 +459,25 @@ class User extends CI_Model {
|
|||||||
$this->db->update('users', $data, array('id' => $id));
|
$this->db->update('users', $data, array('id' => $id));
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->db->trans_status() === false) {
|
return $this->db->affected_rows() > 0;
|
||||||
$this->db->trans_rollback();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->db->trans_commit();
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Deletes the specified user.
|
* Deletes a specified user.
|
||||||
*
|
*
|
||||||
* @return boolean
|
* @param string $id
|
||||||
|
* @return boolean Returns TRUE if the deletion was successful.
|
||||||
*/
|
*/
|
||||||
public function delete($id) {
|
public function delete($id) {
|
||||||
$this->db->trans_begin();
|
|
||||||
|
|
||||||
$this->db->delete('users', array('id' => $id));
|
$this->db->delete('users', array('id' => $id));
|
||||||
|
return $this->db->affected_rows() > 0;
|
||||||
if ($this->db->trans_status() === false) {
|
|
||||||
$this->db->trans_rollback();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->db->trans_commit();
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* updateLastLogin
|
* Updates a users last login time.
|
||||||
*
|
*
|
||||||
* @return boolean
|
* @param string $id
|
||||||
|
* @return boolean Returns TRUE if the update was successful.
|
||||||
*/
|
*/
|
||||||
public function updateLastLogin($id) {
|
public function updateLastLogin($id) {
|
||||||
$this->db->update('users', array('last_login' => now()), array('id' => $id));
|
$this->db->update('users', array('last_login' => now()), array('id' => $id));
|
||||||
@@ -471,7 +485,7 @@ class User extends CI_Model {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* loginRemembedUser
|
* Logs a remembed user in.
|
||||||
*
|
*
|
||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
@@ -512,8 +526,9 @@ class User extends CI_Model {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* rememberUser
|
* Remembers a user.
|
||||||
*
|
*
|
||||||
|
* @param string $id
|
||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
private function rememberUser($id) {
|
private function rememberUser($id) {
|
||||||
@@ -542,7 +557,6 @@ class User extends CI_Model {
|
|||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* End of file user.php */
|
/* End of file user.php */
|
||||||
|
|||||||
73
application/views/admin/parameters/create.php
Normal file
73
application/views/admin/parameters/create.php
Normal file
@@ -0,0 +1,73 @@
|
|||||||
|
<?php $this->load->view('header');?>
|
||||||
|
|
||||||
|
<div id="content">
|
||||||
|
|
||||||
|
<div class="title">
|
||||||
|
<h2><?=_('Add a new parameter');?></h2>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="box">
|
||||||
|
<form name="addParameter" method="post" action="<?=site_url('admin/parameters/create/' . $program['id']);?>">
|
||||||
|
<ul>
|
||||||
|
<li>
|
||||||
|
<?=form_label(_('Name'), 'name');?>
|
||||||
|
<span class="req">*</span>
|
||||||
|
<div>
|
||||||
|
<input type="text" name="name" id="name" class="short text" value="<?=set_value('name');?>" />
|
||||||
|
<?=form_error('name');?>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<?=form_label(_('Human-readable name'), 'readable');?>
|
||||||
|
<span class="req">*</span>
|
||||||
|
<div>
|
||||||
|
<input type="text" name="readable" id="readable" class="medium text" value="<?=set_value('readable');?>" />
|
||||||
|
<?=form_error('readable');?>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<?=form_label(_('Unit'), 'unit');?>
|
||||||
|
<div>
|
||||||
|
<input type="text" name="unit" id="unit" class="short text" value="<?=set_value('unit');?>" />
|
||||||
|
<?=form_error('unit');?>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<?=form_label(_('Description'), 'description');?>
|
||||||
|
<div>
|
||||||
|
<textarea name="description" id="description" rows="6" cols="60" class="textarea"><?=set_value('description');?></textarea>
|
||||||
|
<?=form_error('description');?>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<?=form_label(_('Type'), 'type');?>
|
||||||
|
<span class="req">*</span>
|
||||||
|
<div>
|
||||||
|
<select name="type" id="type" class="drop">
|
||||||
|
<?php
|
||||||
|
foreach ($types as $type):
|
||||||
|
?>
|
||||||
|
<option value="<?=$type;?>" <?=set_select('type', $type);?>><?=$type;?></option>
|
||||||
|
<?php
|
||||||
|
endforeach;
|
||||||
|
?>
|
||||||
|
</select>
|
||||||
|
<?=form_error('type');?>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<?=form_label(_('Default value'), 'default_value');?>
|
||||||
|
<div>
|
||||||
|
<input type="text" name="default_value" id="default_value" class="short text" value="<?=set_value('default_value');?>" />
|
||||||
|
<?=form_error('default_value');?>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
<p>
|
||||||
|
<a class="button save" href="javascript:void(0);" onclick="$('form[name=addParameter]').submit();"><?=_('Save');?></a>
|
||||||
|
</p>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<?php $this->load->view('footer');?>
|
||||||
74
application/views/admin/parameters/edit.php
Normal file
74
application/views/admin/parameters/edit.php
Normal file
@@ -0,0 +1,74 @@
|
|||||||
|
<?php $this->load->view('header');?>
|
||||||
|
|
||||||
|
<div id="content">
|
||||||
|
|
||||||
|
<div class="title">
|
||||||
|
<h2><?php printf(_("Edit parameter '%s'"), $parameter['name']);?></h2>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="box">
|
||||||
|
<form name="editParameter" method="post" action="<?=site_url('admin/parameters/edit/' . $parameter['id']);?>">
|
||||||
|
<ul>
|
||||||
|
<li>
|
||||||
|
<?=form_label(_('Name'), 'name');?>
|
||||||
|
<span class="req">*</span>
|
||||||
|
<div>
|
||||||
|
<input type="text" name="name" id="name" class="short text" value="<?=set_value('name', $parameter['name']);?>" />
|
||||||
|
<?=form_error('name');?>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<?=form_label(_('Human-readable name'), 'readable');?>
|
||||||
|
<span class="req">*</span>
|
||||||
|
<div>
|
||||||
|
<input type="text" name="readable" id="readable" class="medium text" value="<?=set_value('readable', $parameter['readable']);?>" />
|
||||||
|
<?=form_error('readable');?>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<?=form_label(_('Unit'), 'unit');?>
|
||||||
|
<div>
|
||||||
|
<input type="text" name="unit" id="unit" class="short text" value="<?=set_value('unit', $parameter['unit']);?>" />
|
||||||
|
<?=form_error('unit');?>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<?=form_label(_('Description'), 'description');?>
|
||||||
|
<div>
|
||||||
|
<textarea name="description" id="description" rows="6" cols="60" class="textarea"><?=set_value('description', $parameter['description']);?></textarea>
|
||||||
|
<?=form_error('description');?>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<?=form_label(_('Type'), 'type');?>
|
||||||
|
<span class="req">*</span>
|
||||||
|
<div>
|
||||||
|
<select name="type" id="type" class="drop">
|
||||||
|
<?php
|
||||||
|
foreach ($types as $type):
|
||||||
|
?>
|
||||||
|
<option value="<?=$type;?>" <?=set_select('type', $type, $parameter['type'] == $type);?>><?=$type;?></option>
|
||||||
|
<?php
|
||||||
|
endforeach;
|
||||||
|
?>
|
||||||
|
</select>
|
||||||
|
<?=form_error('type');?>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<?=form_label(_('Default value'), 'default_value');?>
|
||||||
|
<div>
|
||||||
|
<input type="text" name="default_value" id="default_value" class="short text" value="<?=set_value('default_value', $parameter['default_value']);?>" />
|
||||||
|
<?=form_error('default_value');?>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
<p>
|
||||||
|
<a class="button save" href="javascript:void(0);" onclick="$('form[name=editParameter]').submit();"><?=_('Save');?></a>
|
||||||
|
<a class="button cancel" href="<?=site_url('admin/programs/edit/' . $parameter['program_id']);?>"><?=_('Cancel');?></a>
|
||||||
|
</p>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<?php $this->load->view('footer');?>
|
||||||
74
application/views/admin/programs/edit.php
Normal file
74
application/views/admin/programs/edit.php
Normal file
@@ -0,0 +1,74 @@
|
|||||||
|
<?php $this->load->view('header');?>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
$(document).ready(function() {
|
||||||
|
$('#parameters').tableDnD({
|
||||||
|
onDrop: function(table, row) {
|
||||||
|
$.post(SITE_URL + 'ajax/sort_parameters', $.tableDnD.serialize());
|
||||||
|
},
|
||||||
|
dragHandle: 'drag_handle'
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<div id="content">
|
||||||
|
|
||||||
|
<div id="debug"></div>
|
||||||
|
|
||||||
|
<div class="title">
|
||||||
|
<h2><?php printf(_("Edit program '%s'"), $program['name']);?></h2>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="box">
|
||||||
|
<form name="createUser" method="post" action="<?=site_url('admin/programs/edit/' . $program['id'])?>">
|
||||||
|
<h3><?=_('Required information');?></h3>
|
||||||
|
<ul>
|
||||||
|
<li>
|
||||||
|
<?=form_label(_('Name of the program'), 'name');?>
|
||||||
|
<span class="req">*</span>
|
||||||
|
<div>
|
||||||
|
<input type="text" name="name" id="name" class="medium text" value="<?=set_value('name', $program['name']);?>" />
|
||||||
|
<?=form_error('name')?>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
<p>
|
||||||
|
<a class="button save" href="javascript:void(0);" onclick="$('form[name=createUser]').submit();"><?=_('Save');?></a>
|
||||||
|
<a class="button cancel" href="<?=site_url('admin/programs');?>"><?=_('Cancel');?></a>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<h3><?=_('Parameters');?></h3>
|
||||||
|
<table class="tableList sortable" id="parameters">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th scope="col"> </th>
|
||||||
|
<th scope="col"><?=_('Readable name');?></th>
|
||||||
|
<th scope="col"><?=_('Unit');?></th>
|
||||||
|
<th scope="col"><?=_('Type');?></th>
|
||||||
|
<th scope="col"><?=_('Actions');?></th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<?php
|
||||||
|
foreach ($parameters as $parameter):
|
||||||
|
?>
|
||||||
|
<tr id="<?=$parameter['id'];?>">
|
||||||
|
<td class="drag_handle"></td>
|
||||||
|
<td><?=$parameter['readable'];?></td>
|
||||||
|
<td><?=$parameter['unit'];?></td>
|
||||||
|
<td><?=$parameter['type'];?></td>
|
||||||
|
<td><?=anchor('admin/parameters/edit/' . $parameter['id'], _('Edit'));?> | <a href="javascript:deleteConfirm('<?=site_url('admin/parameters/delete/' . $parameter['id']);?>');"><?=_('Delete');?></a></td>
|
||||||
|
</tr>
|
||||||
|
<?php
|
||||||
|
endforeach;
|
||||||
|
?>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
<p>
|
||||||
|
<a class="button add" href="<?=site_url('admin/parameters/create/' . $program['id']);?>"><?=_('Add new parameter');?></a>
|
||||||
|
</p>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<?php $this->load->view('footer');?>
|
||||||
36
application/views/admin/programs/list.php
Normal file
36
application/views/admin/programs/list.php
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
<?php $this->load->view('header');?>
|
||||||
|
|
||||||
|
<div id="content">
|
||||||
|
|
||||||
|
<div class="title">
|
||||||
|
<h2><?=_('Programs');?></h2>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="box">
|
||||||
|
<h3><?=_('Available programs');?></h3>
|
||||||
|
<table class="tableList paginated">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th scope="col"><?=_('Name');?></th>
|
||||||
|
<th scope="col"><?=_('Actions');?></th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<?php
|
||||||
|
foreach ($programs as $program):
|
||||||
|
?>
|
||||||
|
<tr>
|
||||||
|
<td><?=$program['name'];?></td>
|
||||||
|
<td><?=anchor('admin/programs/edit/' . $program['id'], _('Edit'));?> | <a href="javascript:deleteConfirm('<?=site_url('admin/programs/delete/' . $program['id']);?>');"><?=_('Delete');?></a></td>
|
||||||
|
</tr>
|
||||||
|
<?php
|
||||||
|
endforeach;
|
||||||
|
?>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
<p><a class="button add" href="<?=site_url('admin/programs/create')?>"><?=_('Add program')?></a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<?php $this->load->view('footer');?>
|
||||||
@@ -12,6 +12,7 @@
|
|||||||
<ul>
|
<ul>
|
||||||
<li>
|
<li>
|
||||||
<?=form_label(_('Username'), 'username');?>
|
<?=form_label(_('Username'), 'username');?>
|
||||||
|
<span class="req">*</span>
|
||||||
<div>
|
<div>
|
||||||
<input type="text" name="username" id="username" class="short text" value="<?=set_value('username');?>" />
|
<input type="text" name="username" id="username" class="short text" value="<?=set_value('username');?>" />
|
||||||
<?=form_error('username')?>
|
<?=form_error('username')?>
|
||||||
@@ -20,6 +21,7 @@
|
|||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<?=form_label(_('Email address'), 'email');?>
|
<?=form_label(_('Email address'), 'email');?>
|
||||||
|
<span class="req">*</span>
|
||||||
<div>
|
<div>
|
||||||
<input type="text" name="email" id="email" class="medium text" value="<?=set_value('email');?>" />
|
<input type="text" name="email" id="email" class="medium text" value="<?=set_value('email');?>" />
|
||||||
<?=form_error('email')?>
|
<?=form_error('email')?>
|
||||||
@@ -27,6 +29,7 @@
|
|||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<?=form_label(_('Password'), 'password');?>
|
<?=form_label(_('Password'), 'password');?>
|
||||||
|
<span class="req">*</span>
|
||||||
<div>
|
<div>
|
||||||
<input type="password" name="password" id="password" class="short text" />
|
<input type="password" name="password" id="password" class="short text" />
|
||||||
<?=form_error('password')?>
|
<?=form_error('password')?>
|
||||||
@@ -34,6 +37,7 @@
|
|||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<?=form_label(_('Confirm password'), 'password_confirm');?>
|
<?=form_label(_('Confirm password'), 'password_confirm');?>
|
||||||
|
<span class="req">*</span>
|
||||||
<div>
|
<div>
|
||||||
<input type="password" name="password_confirm" id="password_confirm" class="short text" />
|
<input type="password" name="password_confirm" id="password_confirm" class="short text" />
|
||||||
<?=form_error('password_confirm')?>
|
<?=form_error('password_confirm')?>
|
||||||
@@ -41,6 +45,7 @@
|
|||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<?=form_label(_('First name'), 'firstname');?>
|
<?=form_label(_('First name'), 'firstname');?>
|
||||||
|
<span class="req">*</span>
|
||||||
<div>
|
<div>
|
||||||
<input type="text" name="firstname" id="firstname" class="short text" value="<?=set_value('firstname');?>" />
|
<input type="text" name="firstname" id="firstname" class="short text" value="<?=set_value('firstname');?>" />
|
||||||
<?=form_error('firstname')?>
|
<?=form_error('firstname')?>
|
||||||
@@ -48,6 +53,7 @@
|
|||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<?=form_label(_('Last name'), 'lastname');?>
|
<?=form_label(_('Last name'), 'lastname');?>
|
||||||
|
<span class="req">*</span>
|
||||||
<div>
|
<div>
|
||||||
<input type="text" name="lastname" id="lastname" class="short text" value="<?=set_value('lastname');?>" />
|
<input type="text" name="lastname" id="lastname" class="short text" value="<?=set_value('lastname');?>" />
|
||||||
<?=form_error('lastname')?>
|
<?=form_error('lastname')?>
|
||||||
@@ -71,13 +77,6 @@
|
|||||||
</div>
|
</div>
|
||||||
<label class="note"><?=('Example');?>: +49 123 456789</label>
|
<label class="note"><?=('Example');?>: +49 123 456789</label>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
|
||||||
<?=form_label(_('Language'), 'language');?>
|
|
||||||
<div>
|
|
||||||
<?=form_dropdown('language', array('English'), null, 'id="language" class="drop"');?>
|
|
||||||
<?=form_error('language')?>
|
|
||||||
</div>
|
|
||||||
</li>
|
|
||||||
</ul>
|
</ul>
|
||||||
<p>
|
<p>
|
||||||
<a class="button save" href="javascript:void(0);" onclick="$('form[name=createUser]').submit();"><?=_('Save');?></a>
|
<a class="button save" href="javascript:void(0);" onclick="$('form[name=createUser]').submit();"><?=_('Save');?></a>
|
||||||
|
|||||||
@@ -12,6 +12,7 @@
|
|||||||
<ul>
|
<ul>
|
||||||
<li>
|
<li>
|
||||||
<?=form_label(_('Email address'), 'email');?>
|
<?=form_label(_('Email address'), 'email');?>
|
||||||
|
<span class="req">*</span>
|
||||||
<div>
|
<div>
|
||||||
<input type="text" name="email" id="email" class="medium text" value="<?=set_value('email', $user['email']);?>" />
|
<input type="text" name="email" id="email" class="medium text" value="<?=set_value('email', $user['email']);?>" />
|
||||||
<?=form_error('email')?>
|
<?=form_error('email')?>
|
||||||
@@ -19,6 +20,7 @@
|
|||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<?=form_label(_('First name'), 'firstname');?>
|
<?=form_label(_('First name'), 'firstname');?>
|
||||||
|
<span class="req">*</span>
|
||||||
<div>
|
<div>
|
||||||
<input type="text" name="firstname" id="firstname" class="short text" value="<?=set_value('firstname', $user['firstname']);?>" />
|
<input type="text" name="firstname" id="firstname" class="short text" value="<?=set_value('firstname', $user['firstname']);?>" />
|
||||||
<?=form_error('firstname')?>
|
<?=form_error('firstname')?>
|
||||||
@@ -26,6 +28,7 @@
|
|||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<?=form_label(_('Last name'), 'lastname');?>
|
<?=form_label(_('Last name'), 'lastname');?>
|
||||||
|
<span class="req">*</span>
|
||||||
<div>
|
<div>
|
||||||
<input type="text" name="lastname" id="lastname" class="short text" value="<?=set_value('lastname', $user['lastname']);?>" />
|
<input type="text" name="lastname" id="lastname" class="short text" value="<?=set_value('lastname', $user['lastname']);?>" />
|
||||||
<?=form_error('lastname')?>
|
<?=form_error('lastname')?>
|
||||||
@@ -49,13 +52,6 @@
|
|||||||
</div>
|
</div>
|
||||||
<label class="note"><?=_('Example');?>: +49 123 456789</label>
|
<label class="note"><?=_('Example');?>: +49 123 456789</label>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
|
||||||
<?=form_label(_('Language'), 'language');?>
|
|
||||||
<div>
|
|
||||||
<?=form_dropdown('language', array('English'), null, 'id="language" class="drop"');?>
|
|
||||||
<?=form_error('language')?>
|
|
||||||
</div>
|
|
||||||
</li>
|
|
||||||
</ul>
|
</ul>
|
||||||
<p>
|
<p>
|
||||||
<a class="button save" href="javascript:void(0);" onclick="$('form[name=createUser]').submit();"><?=_('Save');?></a>
|
<a class="button save" href="javascript:void(0);" onclick="$('form[name=createUser]').submit();"><?=_('Save');?></a>
|
||||||
|
|||||||
@@ -16,6 +16,7 @@
|
|||||||
<th scope="col"><?=_('Actions');?></th>
|
<th scope="col"><?=_('Actions');?></th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
|
<tbody>
|
||||||
<?php
|
<?php
|
||||||
foreach ($users as $user):
|
foreach ($users as $user):
|
||||||
?>
|
?>
|
||||||
@@ -27,7 +28,6 @@
|
|||||||
<?php
|
<?php
|
||||||
endforeach;
|
endforeach;
|
||||||
?>
|
?>
|
||||||
<tbody>
|
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
11
application/views/auth/email/forgot_password.php
Normal file
11
application/views/auth/email/forgot_password.php
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
<?=$username?>,
|
||||||
|
|
||||||
|
To reset your password, please go to the following page:
|
||||||
|
|
||||||
|
{unwrap}<?=site_url('auth/reset_password' . $forgotten_password_code);?>{/unwrap}
|
||||||
|
|
||||||
|
Your password will be automatically reset, and a new password will be emailed to you.
|
||||||
|
|
||||||
|
If you do not wish to reset your password, ignore this message. It will expire in 24 hours.
|
||||||
|
|
||||||
|
Thank you!
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
<?=$username?>,
|
||||||
|
|
||||||
|
Here is your new login information:
|
||||||
|
|
||||||
|
Username: <?=$username?>
|
||||||
|
Password: <?=$password?>
|
||||||
|
|
||||||
|
Thank you!
|
||||||
57
application/views/auth/forgot_password.php
Normal file
57
application/views/auth/forgot_password.php
Normal file
@@ -0,0 +1,57 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="<?=substr($this->config->item('language'), 0, 2);?>">
|
||||||
|
<head>
|
||||||
|
|
||||||
|
<meta charset="utf-8" />
|
||||||
|
|
||||||
|
<title>ScattPort | <?=_('Login');?></title>
|
||||||
|
|
||||||
|
<?=link_tag('assets/css/login.css');?>
|
||||||
|
<?=link_tag('assets/css/form.css');?>
|
||||||
|
|
||||||
|
<?=script_tag('assets/js/minmax.js');?>
|
||||||
|
<?=script_tag('https://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js');?>
|
||||||
|
<?=script_tag('assets/js/scattport.js');?>
|
||||||
|
<script type="text/javascript">
|
||||||
|
var SITE_URL = '<?=site_url()?>';
|
||||||
|
</script>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<div id="wrapper">
|
||||||
|
|
||||||
|
<div id="box">
|
||||||
|
<h2>Scattport <span class="light"><?=_('Login');?></span></h2>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
if (isset($errors) && is_array($errors)) {
|
||||||
|
foreach ($errors as $e) {
|
||||||
|
echo "<p class=\"error\"><strong>" . _('Error') . ":</strong> " . $e . "</p>";
|
||||||
|
}
|
||||||
|
} else if (isset($messages) && is_array($messages)) {
|
||||||
|
foreach ($messages as $m) {
|
||||||
|
echo "<p class=\"success\"><strong>" . _('Success') . ":</strong> " . $m . "</p>";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
<form name="password" action="<?= site_url('auth/forgot_password') ?>"
|
||||||
|
method="post">
|
||||||
|
<ul>
|
||||||
|
<li>
|
||||||
|
<label><?=form_label(_('Email address'), 'email');?></label>
|
||||||
|
<div>
|
||||||
|
<input type="text" name="email" id="email" class="text max" value="<?=set_value('email');?>" />
|
||||||
|
<?=form_error('email');?>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<div>
|
||||||
|
<input type="submit" class="button" name="forgot_password" value="<?=_('Submit');?>" />
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<p><?=anchor('auth/login', _('Back to login page'));?></p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
@@ -1,60 +1,72 @@
|
|||||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
<!DOCTYPE html>
|
||||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
<html lang="<?=substr($this->config->item('language'), 0, 2);?>">
|
||||||
<head>
|
<head>
|
||||||
|
|
||||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
<meta charset="utf-8" />
|
||||||
|
|
||||||
<title>ScattPort | Login</title>
|
<title>ScattPort | <?=_('Login');?></title>
|
||||||
|
|
||||||
<?= link_tag('assets/css/login.css'); ?>
|
<?= link_tag('assets/css/login.css'); ?>
|
||||||
<?= link_tag('assets/css/form.css'); ?>
|
<?= link_tag('assets/css/form.css'); ?>
|
||||||
|
|
||||||
<?= script_tag('assets/js/minmax.js'); ?>
|
|
||||||
<?= script_tag('https://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js'); ?>
|
|
||||||
<?= script_tag('assets/js/scattport.js'); ?>
|
|
||||||
|
|
||||||
|
<?= script_tag('assets/js/minmax.js'); ?>
|
||||||
|
<?= script_tag('https://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js'); ?>
|
||||||
|
<?= script_tag('assets/js/scattport.js'); ?>
|
||||||
|
<script type="text/javascript">
|
||||||
|
var SITE_URL = '<?=site_url()?>';
|
||||||
|
</script>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
<div id="wrapper">
|
<div id="wrapper">
|
||||||
|
|
||||||
<div id="box">
|
<div id="box">
|
||||||
<h2>Scattport <span class="light">Login</span></h2>
|
<h2>Scattport <span class="light"><?=_('Login');?></span></h2>
|
||||||
|
|
||||||
<p>
|
<?php
|
||||||
<?php
|
if (isset($errors)) {
|
||||||
if (isset($error))
|
foreach ($errors as $e) {
|
||||||
foreach ($error as $e)
|
echo "<p class=\"error\"><strong>" . _('Error') . ":</strong> " . $e . "</p>";
|
||||||
echo "<div class=\"error\">" . $e . "</div>";
|
}
|
||||||
if (isset($notice))
|
} else if (isset($messages) && is_array($messages)) {
|
||||||
foreach ($notice as $n)
|
foreach ($messages as $m) {
|
||||||
echo "<div class=\"notice\">" . $n . "</div>";
|
echo "<p class=\"success\"><strong>" . _('Success') . ":</strong> " . $m . "</p>";
|
||||||
if (isset($success))
|
}
|
||||||
foreach ($success as $s)
|
}
|
||||||
echo "<div class=\"success\">" . $s . "</div>";
|
?>
|
||||||
?>
|
<form action="<?= site_url('auth/login') ?>" method="post" name="loginform">
|
||||||
</p>
|
<ul>
|
||||||
|
<li>
|
||||||
|
<?=form_label(_('Username'), 'username');?>
|
||||||
|
<div>
|
||||||
|
<input type="text" name="username" id="username" class="text max" value="<?=set_value('username');?>" />
|
||||||
|
<?=form_error('username');?>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<?=form_label(_('Password'), 'password');?>
|
||||||
|
<div>
|
||||||
|
<input type="password" name="password" id="password" class="text max" />
|
||||||
|
<?=form_error('password');?>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<div>
|
||||||
|
<input type="checkbox" name="remember" id="remember" class="radio" value="1"<?=set_checkbox('remember', 1);?> />
|
||||||
|
<label for="remember" class="choice"><?=_('Remember me on this computer')?></label>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<div>
|
||||||
|
<input type="submit" class="button" name="login" value="<?=_('Log in');?>" />
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</form>
|
||||||
|
|
||||||
<form action="<?= site_url('auth/login') ?>" method="post" name="loginform">
|
<p><?=anchor('auth/forgot_password', _('Forgotten password?'));?></p>
|
||||||
<ul>
|
|
||||||
<li>
|
|
||||||
<label>Benutzername</label>
|
|
||||||
<div><input type="text" name="username" class="text medium" /></div>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<label>Passwort</label>
|
|
||||||
<div><input type="password" name="password" class="text medium" /></div>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<div>
|
|
||||||
<input type="submit" class="button" name="login" value="Einloggen" />
|
|
||||||
</div>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</form>
|
|
||||||
|
|
||||||
<p><a href="#">Passwort vergessen?</a></p>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
100
application/views/auth/settings.php
Normal file
100
application/views/auth/settings.php
Normal file
@@ -0,0 +1,100 @@
|
|||||||
|
<?php $this->load->view('header');?>
|
||||||
|
|
||||||
|
<div id="content">
|
||||||
|
<form name="settings" action="<?=site_url('auth/settings');?>" method="post">
|
||||||
|
<div class="title">
|
||||||
|
<h2><?=_('Settings');?></h2>
|
||||||
|
</div>
|
||||||
|
<ul class="tabs">
|
||||||
|
<li class="active"><a href="#personal"><?=_('Personal information');?></a></li>
|
||||||
|
<li><a href="#settings"><?=_('Settings');?></a></li>
|
||||||
|
<li><a href="#password"><?=_('Password');?></a></li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<div class="tab_container">
|
||||||
|
<div id="personal" class="tab_content">
|
||||||
|
<ul>
|
||||||
|
<li>
|
||||||
|
<?=form_label(_('First name'), 'firstname');?>
|
||||||
|
<span class="req">*</span>
|
||||||
|
<div>
|
||||||
|
<input type="text" name="firstname" id="firstname" class="short text" value="<?=set_value('firstname', $firstname);?>" />
|
||||||
|
<?=form_error('firstname');?>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<?=form_label(_('Last name'), 'lastname');?>
|
||||||
|
<span class="req">*</span>
|
||||||
|
<div>
|
||||||
|
<input type="text" name="lastname" id="lastname" class="short text" value="<?=set_value('lastname', $lastname);?>" />
|
||||||
|
<?=form_error('lastname');?>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<?=form_label(_('Email address'), 'email');?>
|
||||||
|
<span class="req">*</span>
|
||||||
|
<div>
|
||||||
|
<input type="text" name="email" id="email" class="medium text" value="<?=set_value('email', $email);?>" />
|
||||||
|
<?=form_error('email');?>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<?=form_label(_('Institution'), 'institution');?>
|
||||||
|
<div>
|
||||||
|
<input type="text" name="institution" id="institution" class="medium text" value="<?=set_value('institution', $institution);?>" />
|
||||||
|
<?=form_error('institution');?>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<?=form_label(_('Phone number'), 'phone');?>
|
||||||
|
<div>
|
||||||
|
<input type="text" name="phone" id="phone" class="short text" value="<?=set_value('phone', $phone);?>" />
|
||||||
|
<?=form_error('phone');?>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<div id="settings" class="tab_content">
|
||||||
|
<ul>
|
||||||
|
<li>
|
||||||
|
<input type="checkbox" id="projects_sortrecently" name="projects_sortrecently" value="1" class="checkbox"/>
|
||||||
|
<label for="projects_sortrecently"><?=_('Sort projects by date of the last access');?></label><br />
|
||||||
|
<label class="note"><?=_('If the projects are sorted by the data of the last access, the rarely used projects "slip" to the end of the list.');?></label>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<div id="password" class="tab_content">
|
||||||
|
<ul>
|
||||||
|
<li>
|
||||||
|
<?=form_label(_('Current password'), 'old_password');?>
|
||||||
|
<div>
|
||||||
|
<input type="password" name="old_password" id="old_password" class="short text" value="<?=set_value('old_password');?>" />
|
||||||
|
<?=form_error('old_password');?>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<?=form_label(_('New password'), 'new_password');?>
|
||||||
|
<div>
|
||||||
|
<input type="password" name="new_password" id="new_password" class="short text" />
|
||||||
|
<?=form_error('new_password');?>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<?=form_label(_('Confirm new password'), 'new_password_confirm');?>
|
||||||
|
<div>
|
||||||
|
<input type="password" name="new_password_confirm" id="new_password_confirm" class="short text" />
|
||||||
|
<?=form_error('new_password_confirm');?>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<div class="tab_buttons">
|
||||||
|
<p>
|
||||||
|
<a class="button save" href="javascript:void(0);" onclick="$('form[name=settings]').submit();"><?=_('Save settings');?></a>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<?php $this->load->view('footer'); ?>
|
||||||
@@ -21,7 +21,7 @@
|
|||||||
<div class="box">
|
<div class="box">
|
||||||
<h3><?=_('Administration');?></h3>
|
<h3><?=_('Administration');?></h3>
|
||||||
<p>
|
<p>
|
||||||
<a class="button left big" href="#"><?=_('Manage servers');?></a><a class="button middle big" href="#"><?=_('Manage applications');?></a><a class="button right big" href="<?=site_url('users');?>"><?=_('Manage users');?></a>
|
<a class="button left big" href="#"><?=_('Manage servers');?></a><a class="button middle big" href="<?=site_url('admin/programs');?>"><?=_('Manage programs');?></a><a class="button right big" href="<?=site_url('admin/users');?>"><?=_('Manage users');?></a>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
<div id="footer">
|
<div id="footer">
|
||||||
<?
|
<?
|
||||||
if($this->session->userdata('group') == 'admins'):
|
if ($this->access->isAdmin()):
|
||||||
?>
|
?>
|
||||||
<span class="left"><strong><?=_('Administration')?> - </strong>
|
<span class="left"><strong><?=_('Administration')?> - </strong>
|
||||||
<a href="<?=site_url('admin/settings')?>"><?=_('Global settings')?></a> |
|
<a href="<?=site_url('admin/settings')?>"><?=_('Global settings')?></a> |
|
||||||
<a href="<?=site_url('admin/servers')?>"><?=_('Manage calculation servers')?></a> |
|
<a href="<?=site_url('admin/servers')?>"><?=_('Manage calculation servers')?></a> |
|
||||||
<a href="<?=site_url('admin/users')?>"><?=_('Manage users')?></a> |
|
<a href="<?=site_url('admin/users')?>"><?=_('Manage users')?></a> |
|
||||||
<a href="<?=site_url('admin/programs')?>"><?=_('Manage applications')?></a>
|
<a href="<?=site_url('admin/programs')?>"><?=_('Manage programs')?></a>
|
||||||
</span>
|
</span>
|
||||||
<?
|
<?
|
||||||
endif;
|
endif;
|
||||||
|
|||||||
@@ -1,33 +1,16 @@
|
|||||||
<?
|
<?php
|
||||||
|
if (is_array($messages)):
|
||||||
/*
|
foreach ($messages as $type => $msgs):
|
||||||
* Copyright (c) 2011 Karsten Heiken <karsten@disposed.de>
|
if (count($msgs > 0)):
|
||||||
*
|
foreach ($msgs as $message):
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
?>
|
||||||
* of this software and associated documentation files (the "Software"), to deal
|
<div class="<?=$type;?>">
|
||||||
* in the Software without restriction, including without limitation the rights
|
<?=$message;?>
|
||||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
<a href="javascript:void(0);" onclick="$(this).parent().hide()" class="cross"><span>X</span></a>
|
||||||
* copies of the Software, and to permit persons to whom the Software is
|
</div>
|
||||||
* furnished to do so, subject to the following conditions:
|
<?php
|
||||||
*
|
endforeach;
|
||||||
* The above copyright notice and this permission notice shall be included in
|
endif;
|
||||||
* all copies or substantial portions of the Software.
|
endforeach;
|
||||||
*
|
endif;
|
||||||
* 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
|
|
||||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
||||||
* THE SOFTWARE.
|
|
||||||
*/
|
|
||||||
|
|
||||||
if (is_array($messages)):
|
|
||||||
foreach ($messages as $type => $msgs):
|
|
||||||
if (count($msgs > 0)):
|
|
||||||
foreach ($msgs as $message):
|
|
||||||
echo ('<div class="' . $type .'">' . $message . '</div>');
|
|
||||||
endforeach;
|
|
||||||
endif;
|
|
||||||
endforeach;
|
|
||||||
endif;
|
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
<!DOCTYPE html>
|
||||||
<html xmlns="http://www.w3.org/1999/xhtml"><head>
|
<html lang="<?=substr($this->config->item('language'), 0, 2);?>">
|
||||||
|
<head>
|
||||||
|
|
||||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
<meta charset="utf-8" />
|
||||||
|
|
||||||
<title>ScattPort</title>
|
<title>ScattPort</title>
|
||||||
|
|
||||||
@@ -13,10 +14,12 @@
|
|||||||
<?=script_tag('https://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js');?>
|
<?=script_tag('https://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js');?>
|
||||||
<?=script_tag('assets/js/scattport.js');?>
|
<?=script_tag('assets/js/scattport.js');?>
|
||||||
<?=script_tag('assets/js/tablednd.jquery.js');?>
|
<?=script_tag('assets/js/tablednd.jquery.js');?>
|
||||||
|
<?=script_tag('assets/js/jtip.js');?>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
var SITE_URL = '<?=site_url()?>';
|
var SITE_URL = '<?=site_url()?>';
|
||||||
</script>
|
</script>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
<div id="header">
|
<div id="header">
|
||||||
@@ -27,7 +30,7 @@
|
|||||||
<option value="<?=site_url('projects');?>">Projekte verwalten</option>
|
<option value="<?=site_url('projects');?>">Projekte verwalten</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
<div class="menu"><?= _('Hello,') ?> <a href="<?=site_url('');?>"><?=$this->user->profile()->firstname;?> <?=$this->user->profile()->lastname;?></a>! | <?=lang_select('assets/images');?> | <a href="#"><?=_('Help')?></a> | <?=anchor('settings', _('Settings'));?> | <?=anchor('auth/logout', _('Logout'));?></div>
|
<div class="menu"><?= _('Hello,') ?> <a href="<?=site_url('');?>"><?=$this->user->profile()->firstname;?> <?=$this->user->profile()->lastname;?></a>! | <?=lang_select('assets/images');?> | <a href="#"><?=_('Help')?></a> | <?=anchor('auth/settings', _('Settings'));?> | <?=anchor('auth/logout', _('Logout'));?></div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="wrapper">
|
<div id="wrapper">
|
||||||
|
|||||||
@@ -1,10 +0,0 @@
|
|||||||
<html>
|
|
||||||
<head>
|
|
||||||
<title>403 Forbidden</title>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
|
|
||||||
<p>Directory access is forbidden.</p>
|
|
||||||
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
@@ -1,48 +0,0 @@
|
|||||||
<?php $this->load->view('header');?>
|
|
||||||
|
|
||||||
<div id="content">
|
|
||||||
<form action="#" method="post">
|
|
||||||
<div class="title">
|
|
||||||
<h2><?=_('Settings');?></h2>
|
|
||||||
</div>
|
|
||||||
<ul class="tabs">
|
|
||||||
<li class="active"><a href="#personal"><?=_('Personal Information');?></a></li>
|
|
||||||
<li><a href="#settings"><?=_('Settings');?></a></li>
|
|
||||||
</ul>
|
|
||||||
|
|
||||||
<div class="tab_container">
|
|
||||||
<div id="personal" class="tab_content">
|
|
||||||
<ul>
|
|
||||||
<?php foreach($profile_fields as $field):?>
|
|
||||||
<li>
|
|
||||||
<label><?=$field[1]?></label>
|
|
||||||
<div>
|
|
||||||
<input type="<?=$field[2]?>" name="<?=$field[0]?>" class="short text" />
|
|
||||||
</div>
|
|
||||||
</li>
|
|
||||||
<?php endforeach;?>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
<div id="settings" class="tab_content">
|
|
||||||
<ul>
|
|
||||||
<li>
|
|
||||||
<label><?=_('Language');?></label>
|
|
||||||
<div>
|
|
||||||
<select id="language_select" name="language_select" class="drop">
|
|
||||||
<option value="de">Deutsch</option>
|
|
||||||
<option value="en">Englisch</option>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<input type="checkbox" id="projects_sortrecently" name="projects_sortrecently" value="1" class="checkbox"/>
|
|
||||||
<label for="projects_sortrecently"><?=_('Sort projects by date of the last access');?></label><br />
|
|
||||||
<label class="note"><?=_('If the projects are sorted by the data of the last access, the rarely used projects "slip" to the end of the list.');?></label>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<?php $this->load->view('footer'); ?>
|
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
/* Form Style */
|
@CHARSET "UTF-8";
|
||||||
|
/* Form styles */
|
||||||
|
|
||||||
form ul li {
|
form ul li {
|
||||||
margin: 0 0 15px;
|
margin: 0 0 15px;
|
||||||
@@ -50,16 +51,35 @@ select.drop {
|
|||||||
border: 1px solid #d2d2d2;
|
border: 1px solid #d2d2d2;
|
||||||
}
|
}
|
||||||
|
|
||||||
input.short { width: 20%;}
|
input.short {
|
||||||
input.medium { width: 45%;}
|
width: 20%;
|
||||||
input.long { width:70%;}
|
}
|
||||||
input.max { width: 95%;}
|
|
||||||
|
input.medium {
|
||||||
|
width: 45%;
|
||||||
|
}
|
||||||
|
|
||||||
|
input.long {
|
||||||
|
width: 70%;
|
||||||
|
}
|
||||||
|
|
||||||
|
input.max {
|
||||||
|
width: 95%;
|
||||||
|
}
|
||||||
|
|
||||||
|
table input {
|
||||||
|
margin: 0 !important;
|
||||||
|
}
|
||||||
|
|
||||||
p.success {
|
p.success {
|
||||||
color: #008000;
|
color: #008000;
|
||||||
}
|
}
|
||||||
|
|
||||||
p.error, p.req {
|
p.error, span.req {
|
||||||
color: #d8122d;
|
color: #d8122d;
|
||||||
font-weight: normal;
|
font-weight: normal;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
p.success strong, p.error strong, p.req strong {
|
||||||
|
text-transform: uppercase;
|
||||||
|
}
|
||||||
|
|||||||
@@ -12,11 +12,23 @@ body {
|
|||||||
background: #404040;
|
background: #404040;
|
||||||
}
|
}
|
||||||
|
|
||||||
a { color: #0088cc; text-decoration: none;}
|
a {
|
||||||
a:hover { text-decoration: underline;}
|
color: #08c;
|
||||||
a img { border: none;}
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
|
||||||
p { margin: 0px 0px 20px 0px; line-height: 18px;}
|
a:hover {
|
||||||
|
text-decoration: underline;
|
||||||
|
}
|
||||||
|
|
||||||
|
a img {
|
||||||
|
border: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
p {
|
||||||
|
margin: 0 0 20px 0;
|
||||||
|
line-height: 18px;
|
||||||
|
}
|
||||||
|
|
||||||
#box {
|
#box {
|
||||||
margin: 40px auto;
|
margin: 40px auto;
|
||||||
@@ -36,4 +48,4 @@ p { margin: 0px 0px 20px 0px; line-height: 18px;}
|
|||||||
.light {
|
.light {
|
||||||
color: #ccc;
|
color: #ccc;
|
||||||
text-transform: none;
|
text-transform: none;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
@CHARSET "UTF-8";
|
||||||
|
|
||||||
* {
|
* {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
@@ -12,47 +14,75 @@ body {
|
|||||||
|
|
||||||
/* Styles */
|
/* Styles */
|
||||||
|
|
||||||
a { color: #0088cc; text-decoration: none;}
|
a {
|
||||||
a:hover { text-decoration: underline;}
|
color: #0088cc;
|
||||||
a img { border: none;}
|
text-decoration: none;
|
||||||
|
|
||||||
p { margin: 0px 0px 20px 0px; line-height: 18px;}
|
|
||||||
|
|
||||||
ul { margin: 5px 0px 15px 0px; padding: 0px;}
|
|
||||||
li { margin-left: 20px;}
|
|
||||||
|
|
||||||
div.notice {
|
|
||||||
margin: 0 0 15px;
|
|
||||||
padding: 0 10px;
|
|
||||||
background: #fffbcc;
|
|
||||||
border: 1px solid #e6db55;
|
|
||||||
line-height: 25px;
|
|
||||||
color: #222;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
div.success {
|
a:hover {
|
||||||
margin: 0 0 15px;
|
text-decoration: underline;
|
||||||
padding: 0 10px;
|
|
||||||
background: #d1ecb8;
|
|
||||||
border: 1px solid #81c445;
|
|
||||||
line-height: 25px;
|
|
||||||
color: #222;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
div.error {
|
a img {
|
||||||
margin: 0 0 15px;
|
border: none;
|
||||||
padding: 0 10px;
|
}
|
||||||
background: #ffebe8;
|
|
||||||
border: 1px solid #f0baa2;
|
p {
|
||||||
line-height: 25px;
|
margin: 0 0 20px 0;
|
||||||
color: #222;
|
line-height: 18px;
|
||||||
|
}
|
||||||
|
|
||||||
|
ul {
|
||||||
|
margin: 5px 0 15px 0;
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
li {
|
||||||
|
margin-left: 20px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.editable {
|
.editable {
|
||||||
background: #fffbcc;
|
background: #fffbcc;
|
||||||
}
|
}
|
||||||
|
|
||||||
.clear { clear:both;}
|
.clear {
|
||||||
|
clear: both;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Notifications */
|
||||||
|
|
||||||
|
#notifications div {
|
||||||
|
margin: 0 0 15px;
|
||||||
|
padding: 0 10px;
|
||||||
|
line-height: 25px;
|
||||||
|
color: #222;
|
||||||
|
}
|
||||||
|
|
||||||
|
#notifications div a.cross {
|
||||||
|
float: right;
|
||||||
|
background: url(../images/icons/cross-small.png) right center no-repeat;
|
||||||
|
width: 16px;
|
||||||
|
height: 25px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#notifications div a.cross span {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
div.notice {
|
||||||
|
background: #fffbcc;
|
||||||
|
border: 1px solid #e6db55;
|
||||||
|
}
|
||||||
|
|
||||||
|
div.success {
|
||||||
|
background: #d1ecb8;
|
||||||
|
border: 1px solid #81c445;
|
||||||
|
}
|
||||||
|
|
||||||
|
div.error {
|
||||||
|
background: #ffebe8;
|
||||||
|
border: 1px solid #f0baa2;
|
||||||
|
}
|
||||||
|
|
||||||
/* Header */
|
/* Header */
|
||||||
|
|
||||||
@@ -78,7 +108,6 @@ div.error {
|
|||||||
#header .status {
|
#header .status {
|
||||||
float: left;
|
float: left;
|
||||||
line-height: 45px;
|
line-height: 45px;
|
||||||
padding: 12px 20px;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#header .menu {
|
#header .menu {
|
||||||
@@ -285,15 +314,22 @@ div.error {
|
|||||||
clear: both;
|
clear: both;
|
||||||
}
|
}
|
||||||
|
|
||||||
#footer .left { float: left;}
|
#footer .left {
|
||||||
#footer .right { float: right;}
|
float: left;
|
||||||
|
}
|
||||||
|
|
||||||
|
#footer .right {
|
||||||
|
float: right;
|
||||||
|
}
|
||||||
|
|
||||||
/* Buttons */
|
/* Buttons */
|
||||||
|
|
||||||
.buttons {
|
.buttons {
|
||||||
float: left;
|
float: left;
|
||||||
padding-bottom: 20px;
|
padding-bottom: 20px;
|
||||||
clear: both;
|
clear: both;
|
||||||
}
|
}
|
||||||
|
|
||||||
a.button {
|
a.button {
|
||||||
color: #6e6e6e;
|
color: #6e6e6e;
|
||||||
font: bold 12px Helvetica, Arial, sans-serif;
|
font: bold 12px Helvetica, Arial, sans-serif;
|
||||||
@@ -315,22 +351,28 @@ a.button {
|
|||||||
-moz-border-radius: 2px;
|
-moz-border-radius: 2px;
|
||||||
margin-right: 10px;
|
margin-right: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
a.button.locked {
|
a.button.locked {
|
||||||
color: #333;
|
color: #333;
|
||||||
border-color: #999;
|
border-color: #999;
|
||||||
-moz-box-shadow: 0 2px 0 rgba(0, 0, 0, 0.2) -webkit-box-shadow:0 2px 5px rgba(0, 0, 0, 0.2);
|
-moz-box-shadow: 0 2px 0 rgba(0, 0, 0, 0.2);
|
||||||
|
-webkit-box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
|
||||||
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
|
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
|
||||||
}
|
}
|
||||||
|
|
||||||
a.button:hover {
|
a.button:hover {
|
||||||
color: #333;
|
color: #333;
|
||||||
border-color: #999;
|
border-color: #999;
|
||||||
-moz-box-shadow: 0 2px 0 rgba(0, 0, 0, 0.2) -webkit-box-shadow:0 2px 5px rgba(0, 0, 0, 0.2);
|
-moz-box-shadow: 0 2px 0 rgba(0, 0, 0, 0.2);
|
||||||
|
-webkit-box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
|
||||||
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
|
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
|
||||||
}
|
}
|
||||||
|
|
||||||
a.button:active {
|
a.button:active {
|
||||||
color: #000;
|
color: #000;
|
||||||
border-color: #444;
|
border-color: #444;
|
||||||
}
|
}
|
||||||
|
|
||||||
a.left {
|
a.left {
|
||||||
-webkit-border-top-right-radius: 0;
|
-webkit-border-top-right-radius: 0;
|
||||||
-moz-border-radius-topright: 0;
|
-moz-border-radius-topright: 0;
|
||||||
@@ -340,6 +382,7 @@ a.left {
|
|||||||
border-bottom-right-radius: 0;
|
border-bottom-right-radius: 0;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
a.middle {
|
a.middle {
|
||||||
border-radius: 0;
|
border-radius: 0;
|
||||||
-webkit-border-radius: 0;
|
-webkit-border-radius: 0;
|
||||||
@@ -348,8 +391,12 @@ a.middle {
|
|||||||
margin: 0;
|
margin: 0;
|
||||||
border-left: solid 1px rgba(255, 255, 255, 0);
|
border-left: solid 1px rgba(255, 255, 255, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
a.middle:hover,
|
a.middle:hover,
|
||||||
a.right:hover { border-left: solid 1px #999 }
|
a.right:hover {
|
||||||
|
border-left: solid 1px #999;
|
||||||
|
}
|
||||||
|
|
||||||
a.right {
|
a.right {
|
||||||
-webkit-border-top-left-radius: 0;
|
-webkit-border-top-left-radius: 0;
|
||||||
-moz-border-radius-topleft: 0;
|
-moz-border-radius-topleft: 0;
|
||||||
@@ -360,68 +407,83 @@ a.right {
|
|||||||
border-left: solid 1px #f3f3f3;
|
border-left: solid 1px #f3f3f3;
|
||||||
border-left: solid 1px rgba(255, 255, 255, 0);
|
border-left: solid 1px rgba(255, 255, 255, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
a.big {
|
a.big {
|
||||||
font-size: 16px;
|
font-size: 16px;
|
||||||
padding: 10px 15px;
|
padding: 10px 15px;
|
||||||
}
|
}
|
||||||
|
|
||||||
a.supersize {
|
a.supersize {
|
||||||
font-size: 20px;
|
font-size: 20px;
|
||||||
padding: 15px 20px;
|
padding: 15px 20px;
|
||||||
}
|
}
|
||||||
|
|
||||||
a.save {
|
a.save {
|
||||||
background: url(../images/icons/tick.png) 10px center no-repeat #f3f3f3;
|
background: url(../images/icons/tick.png) 10px center no-repeat #f3f3f3;
|
||||||
padding-left: 30px;
|
padding-left: 30px;
|
||||||
}
|
}
|
||||||
|
|
||||||
a.add {
|
a.add {
|
||||||
background: url(../images/icons/plus-circle.png) 10px center no-repeat #f3f3f3;
|
background: url(../images/icons/plus-circle.png) 10px center no-repeat #f3f3f3;
|
||||||
padding-left: 30px;
|
padding-left: 30px;
|
||||||
}
|
}
|
||||||
|
|
||||||
a.delete {
|
a.delete {
|
||||||
background: url(../images/button-sprite.png) 10px -59px no-repeat #f3f3f3;
|
background: url(../images/button-sprite.png) 10px -59px no-repeat #f3f3f3;
|
||||||
padding-left: 30px;
|
padding-left: 30px;
|
||||||
}
|
}
|
||||||
|
|
||||||
a.flag {
|
a.flag {
|
||||||
background: url(../images/button-sprite.png) 10px -94px no-repeat #f3f3f3;
|
background: url(../images/button-sprite.png) 10px -94px no-repeat #f3f3f3;
|
||||||
padding-left: 30px;
|
padding-left: 30px;
|
||||||
}
|
}
|
||||||
|
|
||||||
a.cancel {
|
a.cancel {
|
||||||
background: url(../images/icons/slash.png) 10px center no-repeat #f3f3f3;
|
background: url(../images/icons/slash.png) 10px center no-repeat #f3f3f3;
|
||||||
padding-left: 30px;
|
padding-left: 30px;
|
||||||
}
|
}
|
||||||
|
|
||||||
a.up {
|
a.up {
|
||||||
background: url(../images/button-sprite.png) 13px -131px no-repeat #f3f3f3;
|
background: url(../images/button-sprite.png) 13px -131px no-repeat #f3f3f3;
|
||||||
width: 18px;
|
width: 18px;
|
||||||
}
|
}
|
||||||
|
|
||||||
a.down {
|
a.down {
|
||||||
background: url(../images/button-sprite.png) 13px -166px no-repeat #f3f3f3;
|
background: url(../images/button-sprite.png) 13px -166px no-repeat #f3f3f3;
|
||||||
width: 18px;
|
width: 18px;
|
||||||
}
|
}
|
||||||
|
|
||||||
a.save-big {
|
a.save-big {
|
||||||
background: url(../images/button-sprite.png) 15px 13px no-repeat #f3f3f3;
|
background: url(../images/button-sprite.png) 15px 13px no-repeat #f3f3f3;
|
||||||
font-size: 16px;
|
font-size: 16px;
|
||||||
padding: 10px 15px 10px 35px;
|
padding: 10px 15px 10px 35px;
|
||||||
}
|
}
|
||||||
|
|
||||||
a.add-big {
|
a.add-big {
|
||||||
background: url(../images/button-sprite.png) 15px -21px no-repeat #f3f3f3;
|
background: url(../images/button-sprite.png) 15px -21px no-repeat #f3f3f3;
|
||||||
font-size: 16px;
|
font-size: 16px;
|
||||||
padding: 10px 15px 10px 35px;
|
padding: 10px 15px 10px 35px;
|
||||||
}
|
}
|
||||||
|
|
||||||
a.delete-big {
|
a.delete-big {
|
||||||
background: url(../images/button-sprite.png) 15px -55px no-repeat #f3f3f3;
|
background: url(../images/button-sprite.png) 15px -55px no-repeat #f3f3f3;
|
||||||
font-size: 16px;
|
font-size: 16px;
|
||||||
padding: 10px 15px 10px 35px;
|
padding: 10px 15px 10px 35px;
|
||||||
}
|
}
|
||||||
|
|
||||||
a.flag-big {
|
a.flag-big {
|
||||||
background: url(../images/button-sprite.png) 15px -90px no-repeat #f3f3f3;
|
background: url(../images/button-sprite.png) 15px -90px no-repeat #f3f3f3;
|
||||||
font-size: 16px;
|
font-size: 16px;
|
||||||
padding: 10px 15px 10px 35px;
|
padding: 10px 15px 10px 35px;
|
||||||
}
|
}
|
||||||
|
|
||||||
a.up-big {
|
a.up-big {
|
||||||
background: url(../images/button-sprite.png) 15px -126px no-repeat #f3f3f3;
|
background: url(../images/button-sprite.png) 15px -126px no-repeat #f3f3f3;
|
||||||
width: 18px;
|
width: 18px;
|
||||||
font-size: 16px;
|
font-size: 16px;
|
||||||
padding: 10px 15px;
|
padding: 10px 15px;
|
||||||
}
|
}
|
||||||
|
|
||||||
a.down-big {
|
a.down-big {
|
||||||
background: url(../images/button-sprite.png) 15px -161px no-repeat #f3f3f3;
|
background: url(../images/button-sprite.png) 15px -161px no-repeat #f3f3f3;
|
||||||
width: 18px;
|
width: 18px;
|
||||||
@@ -436,24 +498,26 @@ ul.tabs {
|
|||||||
padding: 0;
|
padding: 0;
|
||||||
float: left;
|
float: left;
|
||||||
list-style: none;
|
list-style: none;
|
||||||
height: 27px; /*--Set height of tabs--*/
|
height: 27px; /* Set height of tabs */
|
||||||
border-bottom: 1px solid #e8e8e8;
|
border-bottom: 1px solid #e8e8e8;
|
||||||
border-left: 1px solid #e8e8e8;
|
border-left: 1px solid #e8e8e8;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
ul.tabs li {
|
ul.tabs li {
|
||||||
float: left;
|
float: left;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
height: 26px; /*--Subtract 1px from the height of the unordered list--*/
|
height: 26px; /* Subtract 1px from the height of the unordered list */
|
||||||
line-height: 26px; /*--Vertically aligns the text within the tab--*/
|
line-height: 26px; /* Vertically aligns the text within the tab */
|
||||||
border: 1px solid #e8e8e8;
|
border: 1px solid #e8e8e8;
|
||||||
border-left: none;
|
border-left: none;
|
||||||
margin-bottom: -1px; /*--Pull the list item down 1px--*/
|
margin-bottom: -1px; /* Pull the list item down 1px */
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
position: relative;
|
position: relative;
|
||||||
background: #e0e0e0 url('../images/navigation-off.gif');
|
background: #e0e0e0 url('../images/navigation-off.gif');
|
||||||
}
|
}
|
||||||
|
|
||||||
ul.tabs li a {
|
ul.tabs li a {
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
color: #000;
|
color: #000;
|
||||||
@@ -461,20 +525,121 @@ ul.tabs li a {
|
|||||||
padding: 1px 21px;
|
padding: 1px 21px;
|
||||||
outline: none;
|
outline: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
ul.tabs li a:hover {
|
ul.tabs li a:hover {
|
||||||
background: #f0f0f0;
|
background: #f0f0f0;
|
||||||
}
|
}
|
||||||
html ul.tabs li.active, html ul.tabs li.active a:hover { /*--Makes sure that the active tab does not listen to the hover properties--*/
|
|
||||||
|
html ul.tabs li.active,
|
||||||
|
html ul.tabs li.active a:hover {
|
||||||
background: #fff;
|
background: #fff;
|
||||||
border-bottom: 1px solid #fff; /*--Makes the active tab look like it's connected with its content--*/
|
border-bottom: 1px solid #fff; /* Makes the active tab look like it's connected with its content */
|
||||||
}
|
}
|
||||||
|
|
||||||
.tab_container {
|
.tab_container {
|
||||||
|
margin: 0 0 20px;
|
||||||
|
padding: 15px 15px 0 15px;
|
||||||
border: 1px solid #e8e8e8;
|
border: 1px solid #e8e8e8;
|
||||||
border-top: none;
|
border-top: none;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
background: #fff;
|
background: #fff;
|
||||||
}
|
}
|
||||||
|
|
||||||
.tab_content {
|
.tab_content {
|
||||||
padding: 20px;
|
padding: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tab_buttons {
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* JTip styles */
|
||||||
|
|
||||||
|
.form_info a,
|
||||||
|
.form_info a:active,
|
||||||
|
.form_info a:visited {
|
||||||
|
background-color: #d2d2d2;
|
||||||
|
font-size: 12px;
|
||||||
|
font-weight: bold;
|
||||||
|
margin-left: -3px;
|
||||||
|
padding: 4px;
|
||||||
|
color: #fff;
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.form_info a:hover {
|
||||||
|
color: #000;
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
#JT_arrow_left {
|
||||||
|
background: url(../images/arrow-left.gif) left top no-repeat;
|
||||||
|
position: absolute;
|
||||||
|
z-index: 101;
|
||||||
|
left: -11px;
|
||||||
|
height: 23px;
|
||||||
|
width: 10px;
|
||||||
|
top: -3px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#JT_arrow_right {
|
||||||
|
background: url(../images/arrow-right.gif) left top no-repeat;
|
||||||
|
position: absolute;
|
||||||
|
z-index: 101;
|
||||||
|
height: 23px;
|
||||||
|
width: 11px;
|
||||||
|
top: -2px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#JT {
|
||||||
|
position: absolute;
|
||||||
|
z-index: 100;
|
||||||
|
border: 1px solid #ccc;
|
||||||
|
background-color: #fff;
|
||||||
|
margin-top: 5px;
|
||||||
|
font-size: 85%;
|
||||||
|
}
|
||||||
|
|
||||||
|
#JT_copy {
|
||||||
|
padding: 5px;
|
||||||
|
color: #666;
|
||||||
|
}
|
||||||
|
|
||||||
|
.JT_loader {
|
||||||
|
background: url(../images/ajax-loader.gif) center center no-repeat;
|
||||||
|
width: 100%;
|
||||||
|
height: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#JT_close_left {
|
||||||
|
background-color: #ccc;
|
||||||
|
text-align: left;
|
||||||
|
padding-left: 4px;
|
||||||
|
padding-bottom: 2px;
|
||||||
|
padding-top: 1px;
|
||||||
|
font-weight: bold;
|
||||||
|
color: #000;
|
||||||
|
}
|
||||||
|
|
||||||
|
#JT_close_right {
|
||||||
|
background-color: #ccc;
|
||||||
|
text-align: left;
|
||||||
|
padding-left: 4px;
|
||||||
|
padding-bottom: 2px;
|
||||||
|
padding-top: 1px;
|
||||||
|
font-weight: bold;
|
||||||
|
color: #000;
|
||||||
|
}
|
||||||
|
|
||||||
|
#JT_copy p {
|
||||||
|
margin: 3px 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
#JT_copy img {
|
||||||
|
padding: 1px;
|
||||||
|
border: 1px solid #ccc;
|
||||||
|
}
|
||||||
|
|
||||||
|
.jTip {
|
||||||
|
cursor: help;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
/* Table Style */
|
@CHARSET "UTF-8";
|
||||||
|
/* Table styles */
|
||||||
|
|
||||||
table {
|
table {
|
||||||
width: 99%;
|
width: 99%;
|
||||||
@@ -26,9 +27,17 @@ table td {
|
|||||||
border-bottom: 1px solid #d2d2d2;
|
border-bottom: 1px solid #d2d2d2;
|
||||||
}
|
}
|
||||||
|
|
||||||
table td span.active { color: #55a34a;}
|
table td span.active {
|
||||||
table td span.pending { color: #c5a059;}
|
color: #55a34a;
|
||||||
table td span.closed { color: #a02b2b;}
|
}
|
||||||
|
|
||||||
|
table td span.pending {
|
||||||
|
color: #c5a059;
|
||||||
|
}
|
||||||
|
|
||||||
|
table td span.closed {
|
||||||
|
color: #a02b2b;
|
||||||
|
}
|
||||||
|
|
||||||
table .odd {
|
table .odd {
|
||||||
background: #f6f6f6;
|
background: #f6f6f6;
|
||||||
@@ -45,6 +54,16 @@ table .hover {
|
|||||||
table tbody tr:nth-child(even) {
|
table tbody tr:nth-child(even) {
|
||||||
background: #fff;
|
background: #fff;
|
||||||
}
|
}
|
||||||
|
|
||||||
table tbody tr:nth-child(odd) {
|
table tbody tr:nth-child(odd) {
|
||||||
background: #f6f6f6;
|
background: #f6f6f6;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
td.drag_handle {
|
||||||
|
width: 16px;
|
||||||
|
}
|
||||||
|
|
||||||
|
td.drag_handle-show {
|
||||||
|
background: url(../images/icons/arrow-resize-090.png) center center no-repeat;
|
||||||
|
cursor: move;
|
||||||
|
}
|
||||||
|
|||||||
BIN
assets/images/ajax-loader.gif
Normal file
BIN
assets/images/ajax-loader.gif
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.8 KiB |
BIN
assets/images/arrow-left.gif
Normal file
BIN
assets/images/arrow-left.gif
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 102 B |
BIN
assets/images/arrow-right.gif
Normal file
BIN
assets/images/arrow-right.gif
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 102 B |
158
assets/js/jtip.js
Normal file
158
assets/js/jtip.js
Normal file
@@ -0,0 +1,158 @@
|
|||||||
|
/*
|
||||||
|
* JTip
|
||||||
|
* By Cody Lindley (http://www.codylindley.com)
|
||||||
|
* Under an Attribution, Share Alike License
|
||||||
|
* JTip is built on top of the very light weight jquery library.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* On page load (as soon as it's ready) call JT_init
|
||||||
|
*/
|
||||||
|
$(document).ready(JT_init);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initializes JTip.
|
||||||
|
*/
|
||||||
|
function JT_init() {
|
||||||
|
$('a.jTip').hover(function() {
|
||||||
|
JT_show(this.href, this.id, this.name);
|
||||||
|
}, function() {
|
||||||
|
$('#JT').remove();
|
||||||
|
}).click(function() {
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Shows a tooltip.
|
||||||
|
*
|
||||||
|
* @param url
|
||||||
|
* @param linkId
|
||||||
|
* @param title
|
||||||
|
*/
|
||||||
|
function JT_show(url, linkId, title) {
|
||||||
|
if (title == false) title = ' ';
|
||||||
|
|
||||||
|
var de = document.documentElement;
|
||||||
|
var w = self.innerWidth || (de&&de.clientWidth) || document.body.clientWidth;
|
||||||
|
var hasArea = w - getAbsoluteLeft(linkId);
|
||||||
|
|
||||||
|
var clickElementY = getAbsoluteTop(linkId) - 3; // set y position
|
||||||
|
var clickElementX = 0;
|
||||||
|
|
||||||
|
var queryString = url.replace(/^[^\?]+\??/,'');
|
||||||
|
var params = parseQuery(queryString);
|
||||||
|
|
||||||
|
if (params['width'] === undefined) {
|
||||||
|
params['width'] = 250;
|
||||||
|
}
|
||||||
|
if (params['link'] !== undefined) {
|
||||||
|
$('#' + linkId).bind('click', function() {
|
||||||
|
window.location = params['link'];
|
||||||
|
});
|
||||||
|
$('#' + linkId).css('cursor','pointer');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (hasArea > (params['width'] * 1) + 75) {
|
||||||
|
$('body').append('<div id="JT" style="width: ' + params['width'] * 1 + 'px;"><div id="JT_arrow_left"></div><div id="JT_close_left">' + title + '</div><div id="JT_copy"><div class="JT_loader"><div></div></div>'); // right side
|
||||||
|
var arrowOffset = getElementWidth(linkId) + 11;
|
||||||
|
clickElementX = getAbsoluteLeft(linkId) + arrowOffset; // set x position
|
||||||
|
} else {
|
||||||
|
$('body').append('<div id="JT" style="width: ' + params['width'] * 1 + 'px;"><div id="JT_arrow_right" style="left: ' + ((params['width'] * 1) + 1) + 'px;"></div><div id="JT_close_right">' + title + '</div><div id="JT_copy"><div class="JT_loader"><div></div></div>'); // left side
|
||||||
|
clickElementX = getAbsoluteLeft(linkId) - ((params['width']*1) + 15); //set x position
|
||||||
|
}
|
||||||
|
|
||||||
|
$('#JT').css({ left: clickElementX + 'px', top: clickElementY + 'px' });
|
||||||
|
$('#JT').show();
|
||||||
|
$('#JT_copy').load(url);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the width of the tooltip.
|
||||||
|
*
|
||||||
|
* @param objectId
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
|
function getElementWidth(objectId) {
|
||||||
|
x = document.getElementById(objectId);
|
||||||
|
return x.offsetWidth;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* No description yet.
|
||||||
|
*
|
||||||
|
* @param objectId
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
|
function getAbsoluteLeft(objectId) {
|
||||||
|
// get an object left position from the upper left viewport corner
|
||||||
|
o = document.getElementById(objectId);
|
||||||
|
// get left position from the parent object
|
||||||
|
oLeft = o.offsetLeft;
|
||||||
|
// parse the parent hierarchy up to the document element
|
||||||
|
while (o.offsetParent != null) {
|
||||||
|
oParent = o.offsetParent; // get parent object reference
|
||||||
|
oLeft += oParent.offsetLeft; // add parent left position
|
||||||
|
o = oParent;
|
||||||
|
}
|
||||||
|
return oLeft;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* No description yet.
|
||||||
|
*
|
||||||
|
* @param objectId
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
|
function getAbsoluteTop(objectId) {
|
||||||
|
// get an object top position from the upper left viewport corner
|
||||||
|
o = document.getElementById(objectId);
|
||||||
|
// get top position from the parent object
|
||||||
|
oTop = o.offsetTop;
|
||||||
|
// parse the parent hierarchy up to the document element
|
||||||
|
while (o.offsetParent != null) {
|
||||||
|
oParent = o.offsetParent; // get parent object reference
|
||||||
|
oTop += oParent.offsetTop; // add parent top position
|
||||||
|
o = oParent;
|
||||||
|
}
|
||||||
|
return oTop;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* No description yet.
|
||||||
|
*
|
||||||
|
* @param query
|
||||||
|
*/
|
||||||
|
function parseQuery(query) {
|
||||||
|
var params = new Object();
|
||||||
|
if (!query) {
|
||||||
|
return params; // return empty object
|
||||||
|
}
|
||||||
|
var pairs = query.split(/[;&]/);
|
||||||
|
|
||||||
|
for (var i = 0; i < pairs.length; i++) {
|
||||||
|
var keyValue = pairs[i].split('=');
|
||||||
|
if (!keyValue || keyValue.length != 2) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
var key = unescape(keyValue[0]);
|
||||||
|
var val = unescape(keyValue[1]);
|
||||||
|
|
||||||
|
val = val.replace(/\+/g, ' ');
|
||||||
|
params[key] = val;
|
||||||
|
}
|
||||||
|
return params;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* No description yet.
|
||||||
|
*
|
||||||
|
* @param event
|
||||||
|
*/
|
||||||
|
function blockEvents(event) {
|
||||||
|
if (event.target) {
|
||||||
|
event.preventDefault();
|
||||||
|
} else {
|
||||||
|
event.returnValue = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -67,35 +67,35 @@ $.fn.nl2br = function() {
|
|||||||
return $(this).html().replace(/([^>\r\n]?)(\r\n|\n\r|\r|\n)/g, '$1'+ breakTag +'$2');
|
return $(this).html().replace(/([^>\r\n]?)(\r\n|\n\r|\r|\n)/g, '$1'+ breakTag +'$2');
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
|
||||||
* Tabs
|
|
||||||
*/
|
|
||||||
$(document).ready(function() {
|
|
||||||
$(".tab_content").hide(); // hide all content
|
|
||||||
$("ul.tabs li:first").addClass("active").show(); // activate first tab
|
|
||||||
$(".tab_content:first").show(); // show first tab content
|
|
||||||
|
|
||||||
// onClick event
|
|
||||||
$("ul.tabs li").click(function() {
|
|
||||||
|
|
||||||
$("ul.tabs li").removeClass("active"); // remove any "active" class
|
|
||||||
$(this).addClass("active"); // add "active" class to selected tab
|
|
||||||
$(".tab_content").hide(); // hide all tab content
|
|
||||||
|
|
||||||
var activeTab = $(this).find("a").attr("href");
|
|
||||||
$(activeTab).fadeIn(); // fade in the active tab content
|
|
||||||
return false;
|
|
||||||
});
|
|
||||||
|
|
||||||
$('#notifications').hide();
|
|
||||||
getNotifications();
|
|
||||||
setInterval('getNotifications()', '5000');
|
|
||||||
});
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Do some stuff if document is ready.
|
* Do some stuff if document is ready.
|
||||||
*/
|
*/
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
|
/*
|
||||||
|
* Tabs
|
||||||
|
*/
|
||||||
|
$('.tab_content').hide(); // hide all content
|
||||||
|
$('ul.tabs li:first').addClass('active').show(); // activate first tab
|
||||||
|
$('.tab_content:first').show(); // show first tab content
|
||||||
|
|
||||||
|
// onClick event
|
||||||
|
$('ul.tabs li').click(function() {
|
||||||
|
$('ul.tabs li').removeClass('active'); // remove any 'active' class
|
||||||
|
$(this).addClass('active'); // add 'active' class to selected tab
|
||||||
|
$('.tab_content').hide(); // hide all tab content
|
||||||
|
|
||||||
|
var activeTab = $(this).find('a').attr('href');
|
||||||
|
$(activeTab).fadeIn(); // fade in the active tab content
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Notification stuff
|
||||||
|
*/
|
||||||
|
$('#notifications').hide();
|
||||||
|
getNotifications();
|
||||||
|
setInterval('getNotifications()', '5000');
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Tables
|
* Tables
|
||||||
*/
|
*/
|
||||||
@@ -103,14 +103,14 @@ $(document).ready(function() {
|
|||||||
table_class : 'tableList'
|
table_class : 'tableList'
|
||||||
};
|
};
|
||||||
|
|
||||||
// add or delete "hover" class on mouseOver event
|
// add or delete 'hover' class on mouseOver event
|
||||||
$('.' + settings.table_class + ' tbody tr').hover(function() {
|
$('.' + settings.table_class + ' tbody tr').hover(function() {
|
||||||
$(this).addClass("hover");
|
$(this).addClass('hover');
|
||||||
}, function() {
|
}, function() {
|
||||||
$(this).removeClass("hover");
|
$(this).removeClass('hover');
|
||||||
});
|
});
|
||||||
|
|
||||||
// add or delete "selected" class if a row is selected via checkbox
|
// add or delete 'selected' class if a row is selected via checkbox
|
||||||
$('.' + settings.table_class + ' tbody input:checkbox').click(function() {
|
$('.' + settings.table_class + ' tbody input:checkbox').click(function() {
|
||||||
if ($(this).attr('checked') == true) {
|
if ($(this).attr('checked') == true) {
|
||||||
$(this).parent().parent().addClass('selected');
|
$(this).parent().parent().addClass('selected');
|
||||||
@@ -163,7 +163,18 @@ $(document).ready(function() {
|
|||||||
table.trigger('repaginate');
|
table.trigger('repaginate');
|
||||||
});
|
});
|
||||||
|
|
||||||
$('.sortable').tableDnD();
|
/*
|
||||||
|
* Sortable tables
|
||||||
|
*/
|
||||||
|
$('.sortable').tableDnD({
|
||||||
|
dragHandle: 'drag_handle'
|
||||||
|
});
|
||||||
|
|
||||||
|
$('.sortable tr').hover(function() {
|
||||||
|
$(this).find('td.drag_handle').addClass('drag_handle-show');
|
||||||
|
}, function() {
|
||||||
|
$(this).find('td.drag_handle').removeClass('drag_handle-show');
|
||||||
|
});
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* In-place editor
|
* In-place editor
|
||||||
@@ -187,6 +198,9 @@ $(document).ready(function() {
|
|||||||
$(this).removeClass('editable');
|
$(this).removeClass('editable');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Active project selection
|
||||||
|
*/
|
||||||
$('select[name="activeProject"]').bind('change', function () {
|
$('select[name="activeProject"]').bind('change', function () {
|
||||||
var url = $(this).val();
|
var url = $(this).val();
|
||||||
if (url) {
|
if (url) {
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
* Licensed like jQuery, see http://docs.jquery.com/License.
|
* Licensed like jQuery, see http://docs.jquery.com/License.
|
||||||
*
|
*
|
||||||
* Configuration options:
|
* Configuration options:
|
||||||
*
|
*
|
||||||
* onDragStyle
|
* onDragStyle
|
||||||
* This is the style that is assigned to the row during drag. There are limitations to the styles that can be
|
* This is the style that is assigned to the row during drag. There are limitations to the styles that can be
|
||||||
* associated with a row (such as you can't assign a border--well you can, but it won't be
|
* associated with a row (such as you can't assign a border--well you can, but it won't be
|
||||||
@@ -28,7 +28,7 @@
|
|||||||
* Pass a function that will be called when the user starts dragging. The function takes 2 parameters: the
|
* Pass a function that will be called when the user starts dragging. The function takes 2 parameters: the
|
||||||
* table and the row which the user has started to drag.
|
* table and the row which the user has started to drag.
|
||||||
* onAllowDrop
|
* onAllowDrop
|
||||||
* Pass a function that will be called as a row is over another row. If the function returns true, allow
|
* Pass a function that will be called as a row is over another row. If the function returns true, allow
|
||||||
* dropping on that row, otherwise not. The function takes 2 parameters: the dragged row and the row under
|
* dropping on that row, otherwise not. The function takes 2 parameters: the dragged row and the row under
|
||||||
* the cursor. It returns a boolean: true allows the drop, false doesn't allow it.
|
* the cursor. It returns a boolean: true allows the drop, false doesn't allow it.
|
||||||
* scrollAmount
|
* scrollAmount
|
||||||
@@ -40,7 +40,7 @@
|
|||||||
* specify this class, then you are responsible for setting cursor: move in the CSS and only these cells
|
* specify this class, then you are responsible for setting cursor: move in the CSS and only these cells
|
||||||
* will have the drag behaviour. If you do not specify a dragHandle, then you get the old behaviour where
|
* will have the drag behaviour. If you do not specify a dragHandle, then you get the old behaviour where
|
||||||
* the whole row is draggable.
|
* the whole row is draggable.
|
||||||
*
|
*
|
||||||
* Other ways to control behaviour:
|
* Other ways to control behaviour:
|
||||||
*
|
*
|
||||||
* Add class="nodrop" to any rows for which you don't want to allow dropping, and class="nodrag" to any rows
|
* Add class="nodrop" to any rows for which you don't want to allow dropping, and class="nodrag" to any rows
|
||||||
@@ -52,7 +52,7 @@
|
|||||||
*
|
*
|
||||||
* Other methods:
|
* Other methods:
|
||||||
*
|
*
|
||||||
* $("...").tableDnDUpdate()
|
* $("...").tableDnDUpdate()
|
||||||
* Will update all the matching tables, that is it will reapply the mousedown method to the rows (or handle cells).
|
* Will update all the matching tables, that is it will reapply the mousedown method to the rows (or handle cells).
|
||||||
* This is useful if you have updated the table rows using Ajax and you want to make the table draggable again.
|
* This is useful if you have updated the table rows using Ajax and you want to make the table draggable again.
|
||||||
* The table maintains the original configuration (so you don't have to specify it again).
|
* The table maintains the original configuration (so you don't have to specify it again).
|
||||||
@@ -63,7 +63,7 @@
|
|||||||
*
|
*
|
||||||
* Known problems:
|
* Known problems:
|
||||||
* - Auto-scoll has some problems with IE7 (it scrolls even when it shouldn't), work-around: set scrollAmount to 0
|
* - Auto-scoll has some problems with IE7 (it scrolls even when it shouldn't), work-around: set scrollAmount to 0
|
||||||
*
|
*
|
||||||
* Version 0.2: 2008-02-20 First public version
|
* Version 0.2: 2008-02-20 First public version
|
||||||
* Version 0.3: 2008-02-07 Added onDragStart option
|
* Version 0.3: 2008-02-07 Added onDragStart option
|
||||||
* Made the scroll amount configurable (default is 5 as before)
|
* Made the scroll amount configurable (default is 5 as before)
|
||||||
@@ -136,7 +136,7 @@ jQuery.tableDnD = {
|
|||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
})
|
});
|
||||||
} else {
|
} else {
|
||||||
// For backwards compatibility, we add the event to the whole row
|
// For backwards compatibility, we add the event to the whole row
|
||||||
var rows = jQuery("tr", table); // get all the rows as a wrapped set
|
var rows = jQuery("tr", table); // get all the rows as a wrapped set
|
||||||
@@ -167,7 +167,7 @@ jQuery.tableDnD = {
|
|||||||
if (this.tableDnDConfig) {
|
if (this.tableDnDConfig) {
|
||||||
jQuery.tableDnD.makeDraggable(this);
|
jQuery.tableDnD.makeDraggable(this);
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
/** Get the mouse coordinates from the event (allowing for browser differences) */
|
/** Get the mouse coordinates from the event (allowing for browser differences) */
|
||||||
@@ -241,7 +241,7 @@ jQuery.tableDnD = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mousePos.y-yOffset < config.scrollAmount) {
|
if (mousePos.y-yOffset < config.scrollAmount) {
|
||||||
window.scrollBy(0, -config.scrollAmount);
|
window.scrollBy(0, -config.scrollAmount);
|
||||||
} else {
|
} else {
|
||||||
@@ -371,12 +371,10 @@ jQuery.tableDnD = {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
};
|
||||||
|
|
||||||
jQuery.fn.extend(
|
jQuery.fn.extend({
|
||||||
{
|
tableDnD : jQuery.tableDnD.build,
|
||||||
tableDnD : jQuery.tableDnD.build,
|
tableDnDUpdate : jQuery.tableDnD.updateTables,
|
||||||
tableDnDUpdate : jQuery.tableDnD.updateTables,
|
tableDnDSerialize: jQuery.tableDnD.serializeTables
|
||||||
tableDnDSerialize: jQuery.tableDnD.serializeTables
|
});
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|||||||
Reference in New Issue
Block a user