Merge lp:~c11emian/lenasys/1171772 into lp:lenasys

Proposed by Emil Andersson
Status: Merged
Merged at revision: 116
Proposed branch: lp:~c11emian/lenasys/1171772
Merge into: lp:lenasys
Diff against target: 59 lines (+24/-26)
1 file modified
codeigniter/application/controllers/codeviewer.php (+24/-26)
To merge this branch: bzr merge lp:~c11emian/lenasys/1171772
Reviewer Review Type Date Requested Status
lenasysmaint Pending
Review via email: mp+166042@code.launchpad.net

Description of the change

Fixed bug #1171772 by setting default arguments and redirecting to the startpage if no other arguments are supplied.

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'codeigniter/application/controllers/codeviewer.php'
2--- codeigniter/application/controllers/codeviewer.php 2013-05-28 09:08:10 +0000
3+++ codeigniter/application/controllers/codeviewer.php 2013-05-28 12:50:38 +0000
4@@ -19,31 +19,29 @@
5 /**
6 * This shows the codeviewer page
7 */
8- public function show($cid, $category, $subcategory, $example){
9- $headTagData['cssFiles'] = array('headTag', 'header', 'codeviewer');
10- $headTagData['jsFiles'] = array('ace/ace', 'header');
11-
12- $this->load->model('codeviewer/Codeviewer_model');
13-
14- $editorHTML = $this->Codeviewer_model->getCode($cid, $category, $subcategory, $example);
15-
16- $this->load->model('user');
17-
18- $userInfo = array(
19- 'userType' => $this->user->getUserType(),
20- 'userName' => $this->user->getUserName()
21- );
22-
23- $this->load->helper('form');
24-
25- // $doc = $this->Codeviewer_model->getDoc($cid, $category, $subcategory, $example);
26-
27- // This loads the view. It's stored in application/views/codeviewer/codeviewer.php
28- // Do note that application/views should not be in the first argument of view()
29- // The second argument is data to be shown in the view. "editors" => "test" would
30- // generate an $editors variable in the view containing "test"
31- $this->load->view('headTag', array('headTagData' => $headTagData));
32- $this->load->view('header', $userInfo);
33- $this->load->view('codeviewer/codeviewer', array("editors" => $editorHTML));
34+ public function show($cid = null, $category = null, $subcategory = null, $example = null){
35+ if(!is_null($cid) && !is_null($category) && !is_null($subcategory) && !is_null($example)){
36+ $headTagData['cssFiles'] = array('headTag', 'header', 'codeviewer');
37+ $headTagData['jsFiles'] = array('ace/ace', 'header');
38+ $this->load->model('user');
39+ $userInfo = array(
40+ 'userType' => $this->user->getUserType(),
41+ 'userName' => $this->user->getUserName()
42+ );
43+ $this->load->view('headTag', array('headTagData' => $headTagData));
44+ $this->load->view('header', $userInfo);
45+ $this->load->model('codeviewer/Codeviewer_model');
46+ $editorHTML = $this->Codeviewer_model->getCode($cid, $category, $subcategory, $example);
47+ $this->load->helper('form');
48+ // $doc = $this->Codeviewer_model->getDoc($cid, $category, $subcategory, $example);
49+ // This loads the view. It's stored in application/views/codeviewer/codeviewer.php
50+ // Do note that application/views should not be in the first argument of view()
51+ // The second argument is data to be shown in the view. "editors" => "test" would
52+ // generate an $editors variable in the view containing "test"
53+ $this->load->view('codeviewer/codeviewer', array("editors" => $editorHTML));
54+ } else {
55+ /*Redirects to the startpage if no arguments are supplied.*/
56+ redirect('/');
57+ }
58 }
59 }

Subscribers

People subscribed via source and target branches

to all changes: