diff --git a/.gitignore b/.gitignore index 38886f4..6f0d8d6 100644 --- a/.gitignore +++ b/.gitignore @@ -2,5 +2,6 @@ .project .settings/ .htaccess +*.xcf application/config/config.php application/config/database.php diff --git a/application/config/autoload.php b/application/config/autoload.php index 6c96dc7..9791f0a 100755 --- a/application/config/autoload.php +++ b/application/config/autoload.php @@ -64,7 +64,7 @@ $autoload['libraries'] = array('database','session'); | $autoload['helper'] = array('url', 'file'); */ -$autoload['helper'] = array('url', 'html', 'script'); +$autoload['helper'] = array('url', 'html', 'script', 'language'); /* diff --git a/application/controllers/projects.php b/application/controllers/projects.php index 3f7e631..7687493 100644 --- a/application/controllers/projects.php +++ b/application/controllers/projects.php @@ -2,53 +2,65 @@ class Projects extends CI_Controller { + /** + * Constructor. + */ + public function __construct() { + parent::__construct(); + $this->load->model('project'); + $this->load->helper('tree'); + + // load language file + $this->lang->load(strtolower($this->router->class)); + } + /** - * List all projects the user has access to. + * Lists all projects the user has access to. */ public function getAvailable() { - $this->load->model('Project'); - $path = $this->input->get_post('node'); - - + switch($path) { case '/projects/own': - $projects = $this->Project->getOwn(); + $projects = $this->project->getOwn(); + array_walk($projects, 'set_tree_icons', base_url() . 'assets/images/icons/document.png'); break; case '/projects/shared': - $projects = $this->Project->getShared(); + $projects = $this->project->getShared(); + array_walk($projects, 'set_tree_icons', base_url() . 'assets/images/icons/document.png'); break; case '/projects/public': - $projects = $this->Project->getPublic(); + $projects = $this->project->getPublic(); + array_walk($projects, 'set_tree_icons', base_url() . 'assets/images/icons/document.png'); break; default: $projects = array( array( 'id' => '/projects/own', 'cls' => 'folder', - 'text' => 'Eigene Projekte', - 'icon' => '/ScattPort/assets/images/icons/folder.png',), + 'text' => lang('projects_own'), + 'icon' => base_url() . 'assets/images/icons/folder.png',), array( 'id' => '/projects/shared', 'cls' => 'leaf', - 'text' => 'Für mich freigegeben', - 'icon' => '/ScattPort/assets/images/icons/folder-share.png', + 'text' => lang('projects_shared'), + 'icon' => base_url() . 'assets/images/icons/folder-share.png', ), array( 'id' => '/projects/public', 'cls' => 'folder', - 'text' => 'Öffentliche Projekte', - 'icon' => '/ScattPort/assets/images/icons/folder-network.png', + 'text' => lang('projects_public'), + 'icon' => base_url() . 'assets/images/icons/folder-network.png', ), ); } - + $this->output ->set_content_type('application/json') ->set_output(json_encode($projects)); // ->set_output(json_encode(array('count' => $count, 'projects' => $projects))); } - + public function detail($projects, $area, $id) { $result = $this->db->get_where('projects', array('id' => $id))->row_array(); $this->output diff --git a/application/helpers/tree_helper.php b/application/helpers/tree_helper.php new file mode 100644 index 0000000..f28808d --- /dev/null +++ b/application/helpers/tree_helper.php @@ -0,0 +1,9 @@ + + + 403 Forbidden + + + +

Directory access is forbidden.

+ + + \ No newline at end of file diff --git a/application/language/german/projects_lang.php b/application/language/german/projects_lang.php new file mode 100644 index 0000000..f14197b --- /dev/null +++ b/application/language/german/projects_lang.php @@ -0,0 +1,11 @@ + + */ +class MY_Form_validation extends CI_Form_validation { + + /** + * Calls the parent constructor. + */ + public function __construct() { + parent::__construct(); + } + + /** + * Checks if a username or email is unique. + * + * @param string $value + * @param string $params + */ + function unique($value, $params) { + $CI =& get_instance(); + + $CI->form_validation->set_message('unique', 'The %s is already being used.'); + + list($table, $field) = explode(".", $params, 2); + + $query = $CI->db->select($field)->from($table)->where($field, $value)->limit(1)->get(); + + if ($query->row()) { + return false; + } else { + return true; + } + } + +} + +/* End of file MY_Form_validation.php */ +/* Location: ./application/libraries/MY_Form_validation.php */ diff --git a/application/models/project.php b/application/models/project.php index d8e48c7..e25a2ef 100644 --- a/application/models/project.php +++ b/application/models/project.php @@ -1,7 +1,7 @@ db->where(array('owner' => '215cd70f310ae6ae')) ->order_by('lastaccess', 'desc') @@ -15,18 +15,17 @@ class Project extends CI_Model { $ownProjects[$i]['cls'] = 'folder'; $ownProjects[$i]['text'] = $project['name']; $ownProjects[$i]['leaf'] = true; - $ownProjects[$i]['icon'] = "/ScattPort/assets/images/icons/document.png"; $i++; } - + return $ownProjects; } - + public function getShared() { $this->db->select('*')->from('shares')->order_by('lastaccess', 'desc')->where(array('user_id' => '215cd70f310ae6ae')); $this->db->join('projects', 'projects.id = shares.project_id'); $query = $this->db->get(); - + $projects = $query->result_array(); $sharedCount = $query->num_rows(); @@ -36,13 +35,12 @@ class Project extends CI_Model { $sharedProjects[$i]['cls'] = 'folder'; $sharedProjects[$i]['text'] = $project['name']; $sharedProjects[$i]['leaf'] = true; - $sharedProjects[$i]['icon'] = "/ScattPort/assets/images/icons/document.png"; $i++; } - + return $sharedProjects; } - + public function getPublic() { $query = $this->db->where(array('public' => '1')) ->order_by('name', 'asc') @@ -56,10 +54,9 @@ class Project extends CI_Model { $publicProjects[$i]['cls'] = 'folder'; $publicProjects[$i]['text'] = $project['name']; $publicProjects[$i]['leaf'] = true; - $publicProjects[$i]['icon'] = "/ScattPort/assets/images/icons/document.png"; $i++; } - + return $publicProjects; } } \ No newline at end of file diff --git a/application/views/header.php b/application/views/header.php index c7578da..eb12c08 100644 --- a/application/views/header.php +++ b/application/views/header.php @@ -17,6 +17,8 @@ $(document).ready(function() { Ext.QuickTips.init(); + + }); @@ -29,4 +31,5 @@ 'padding: 5px;'));?> | 'padding: 5px;'));?> + 'assets/images/lang_de.png', 'style' => 'float: right; margin-top: 18px; margin-right: 5px;'));?> diff --git a/application/views/index.php b/application/views/index.php index 8dc3d8a..05eaaa0 100644 --- a/application/views/index.php +++ b/application/views/index.php @@ -9,6 +9,8 @@ var projectTree = new Ext.tree.TreePanel({ autoScroll: true, enableDD: false, rootVisible: false, + lines: false, + useArrows: true, id: 'treePanel', tbar: [{ icon: BASE_PATH + 'assets/images/icons/box--plus.png', @@ -31,15 +33,6 @@ var projectTree = new Ext.tree.TreePanel({ projectTree.on('click', loadProjectInfo); -var infoPanel = new Ext.Panel({ - region: 'west', - margin: '10 0 0 0', - autoScroll: true, - bodyStyle: 'padding: 10px; background: #eee;', - html: 'Test' -}); - - var tabPanel = new Ext.TabPanel({ xtype: 'tabpanel', resizeTabs: false, @@ -108,9 +101,9 @@ function loadProjectInfo(n) { url: BASE_URL + 'projects/detail' + n.id, method: 'get', success: function ( result, request ) { - + var theResponse = Ext.util.JSON.decode(result.responseText); - + tabPanel.add({ title: 'New Tab ', html: 'Lade Projekt...', @@ -122,7 +115,7 @@ function loadProjectInfo(n) { '

ID: {id}

', '

Name: {name}

' ); - + tpl.overwrite(this.html, data); } }).show(); @@ -140,7 +133,7 @@ function loadProjectInfo(n) { } } }); - + } } diff --git a/assets/css/main.css b/assets/css/main.css index 432b250..05db6be 100644 --- a/assets/css/main.css +++ b/assets/css/main.css @@ -28,3 +28,11 @@ a:hover { .x-viewport body { background: #ededed url('../images/back.png') repeat-x !important; } + +.x-tree-node-el { + padding: 2px; +} + +.x-tree-node-icon { + height: 16px !important; +} diff --git a/assets/images/lang_de.png b/assets/images/lang_de.png new file mode 100755 index 0000000..ac4a977 Binary files /dev/null and b/assets/images/lang_de.png differ diff --git a/assets/images/lang_us.png b/assets/images/lang_us.png new file mode 100755 index 0000000..10f451f Binary files /dev/null and b/assets/images/lang_us.png differ diff --git a/assets/images/logo.png b/assets/images/logo.png index b626fc4..397e5f2 100644 Binary files a/assets/images/logo.png and b/assets/images/logo.png differ diff --git a/system/language/german/calendar_lang.php b/system/language/german/calendar_lang.php new file mode 100755 index 0000000..fc29ff4 --- /dev/null +++ b/system/language/german/calendar_lang.php @@ -0,0 +1,50 @@ + + + 403 Forbidden + + + +

Directory access is forbidden.

+ + + \ No newline at end of file diff --git a/system/language/german/number_lang.php b/system/language/german/number_lang.php new file mode 100755 index 0000000..83c6c45 --- /dev/null +++ b/system/language/german/number_lang.php @@ -0,0 +1,10 @@ +