Merge. Remove admin links from sidebar. They are in the footer now

Merge branch 'master' of disposed.de:scattport

Conflicts:
	application/views/header.php
This commit is contained in:
Karsten Heiken
2011-08-11 02:28:54 +02:00
8 changed files with 231 additions and 25 deletions

1
.gitignore vendored
View File

@@ -7,3 +7,4 @@ application/config/config.php
application/config/database.php
application/logs/*
uploads/*
*.mo

View File

@@ -67,7 +67,7 @@ class Users extends MY_Controller {
array(
'field' => 'phone',
'label' => 'lang:field_phone',
'rules' => 'trim|regex_match[/^\+\d{2,4}\w\d{2,4}\w\d{3,10}+$/i]',
'rules' => 'trim|regex_match[/^\+\d{2,4}\s\d{2,4}\s\d{3,10}+$/i]',
)
);
$this->form_validation->set_rules($config);
@@ -127,7 +127,7 @@ class Users extends MY_Controller {
array(
'field' => 'phone',
'label' => 'lang:field_phone',
//'rules' => 'trim|regex_match[/^\+\d{2,4}\w\d{2,4}\w\d{3,10}+$/i]',
'rules' => 'trim|regex_match[/^\+\d{2,4}\s\d{2,4}\s\d{3,10}+$/i]',
)
);
$this->form_validation->set_rules($config);
@@ -156,12 +156,14 @@ class Users extends MY_Controller {
* @param integer $id
*/
public function delete($id = '') {
if (!is_array($this->user->getUserByID())) {
show_404();
}
$user = $this->user->getUserByID($id);
$this->user->delete($id);
$this->messages->add('The selected user was deleted', 'success');
redirect('users', 200);
if (!isset($user) || !is_array($user) || !isset($user['id'])) {
show_404();
} else {
$this->user->delete($user['id']);
$this->messages->add('The selected user was deleted', 'success');
redirect('users', 200);
}
}
}

View File

@@ -7,11 +7,68 @@
*/
class MY_Lang extends CI_Lang {
var $_gettext_language;
var $_gettext_domain;
var $_gettext_path;
/**
* Calls the parent constructor.
*/
public function __construct() {
parent::__construct();
$this->_gettext_domain = 'lang';
log_message('debug', "Gettext Class Initialized");
$this->load_gettext();
}
/**
* This method overides the original load method. It's duty is loading the
* domain files by config or by default internal settings.
*
* @param string $user_lang
*/
public function load_gettext($user_lang = false) {
if ($user_lang) {
$this->_gettext_language = $user_lang;
} else {
$this->_gettext_language = 'en_US';
}
log_message('debug', 'The gettext language was set by parameter: ' . $this->_gettext_language);
putenv("LC_ALL=$this->_gettext_language");
setlocale(LC_ALL, $this->_gettext_language . ".utf8");
// set the path of .po files
$this->_gettext_path = APPPATH . 'language/locale';
log_message('debug', 'Gettext Class path chosen is: ' . $this->_gettext_path);
$filename = $this->_gettext_path . '/' . $this->_gettext_language . '/LC_MESSAGES/' . $this->_gettext_domain . '.mo';
$mtime = filemtime($filename);
$newFilename = $this->_gettext_path . '/' . $this->_gettext_language . '/LC_MESSAGES/' . $this->_gettext_domain . '_' . $mtime . '.mo';
if (!file_exists($newFilename)) {
$dir = scandir(dirname($filename));
foreach ($dir as $file) {
// remove all the old files
if (!in_array($file, array('.', '..', $this->_gettext_domain . '.po', $this->_gettext_domain . '.mo'))) {
@unlink(dirname($filename) . '/' . $file);
}
}
@copy($filename, $newFilename);
}
$newDomain = $this->_gettext_domain . '_' . $mtime;
bindtextdomain($newDomain, $this->_gettext_path);
bind_textdomain_codeset($newDomain, "UTF-8");
textdomain($newDomain);
log_message('debug', 'The gettext domain chosen is: '. $this->_gettext_domain);
return true;
}
/**
@@ -79,4 +136,7 @@ class MY_Lang extends CI_Lang {
log_message('debug', 'Language file loaded: language/' . $idiom . '/' . $langfile);
return true;
}
}
}
/* End of file MY_Lang.php */
/* Location: ./application/libraries/MY_Lang.php */

View File

@@ -0,0 +1,74 @@
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"

View File

@@ -0,0 +1,67 @@
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"

View File

@@ -3,7 +3,7 @@
<div id="content">
<div class="title">
<h2><?=lang('users');?></h2>
<h2><?=_('users');?></h2>
</div>
<div class="box">
@@ -17,15 +17,15 @@
</tr>
</thead>
<?php
foreach ($users as $user):
foreach ($users as $user):
?>
<tr>
<td><?=$user['username'];?></td>
<td><?=$user['firstname'];?> <?=$user['lastname'];?></td>
<td><?=anchor('users/edit/' . $user['id'], lang('user_edit'));?> | <?=anchor('users/delete/' . $user['id'], lang('user_delete'));?></td>
<td><?=anchor('users/edit/' . $user['id'], lang('user_edit'));?> | <a href="javascript:deleteConfirm('<?=site_url('users/delete/' . $user['id']);?>');"><?=lang('user_delete');?></a></td>
</tr>
<?php
endforeach;
endforeach;
?>
<tbody>
</tbody>

View File

@@ -59,17 +59,6 @@
<li><a href="<?=site_url('projects/create')?>" title="Neues Projekt anlegen">Neues Projekt</a></li>
</ul>
</li>
<?
if($this->session->userdata('group') == 'admins'):
?>
<li>Administration
<ul>
<li><a href="<?=site_url('admin/servers')?>" title="Berechnungsserver verwalten">Berechnungsserver</a></li>
</ul>
</li>
<?
endif;
?>
</ul>
</div>

View File

@@ -1,5 +1,5 @@
/**
*
* Gets the queued notifications.
*/
function getNotifications() {
$.get(SITE_URL + 'ajax/get_notifications', function(data) {
@@ -9,6 +9,19 @@ function getNotifications() {
});
}
/**
* Asks the user if he is sure to delete an item.
*
* @param url
*/
function deleteConfirm(url) {
var answer = confirm('Are you sure?');
if (answer) {
window.location = url;
}
}
/**
* Saves the changes done by in-place edit.
*