Changeset 5d708bf in iPeer


Ignore:
Timestamp:
2012-12-16T15:03:29-08:00 (6 years ago)
Author:
Compass <pan.luo@…>
Branches:
3.1.x, dev, hotfix, master, pagodabox, ticket463
Children:
fa62f3f
Parents:
316ecb7
Message:

Add login info header/footer feature

Two new sys parameters are added in order to display some information on
login page. This feature is for satisfying CWL integration.

Location:
app
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • app/app_controller.php

    r316ecb7 r5d708bf  
    186186            }
    187187        }
     188        $this->set('loginHeader', $this->SysParameter->get('display.login.header'));
     189        $this->set('loginFooter', $this->SysParameter->get('display.login.footer'));
    188190    }
    189191
  • app/config/sql/delta_5.sql

    r316ecb7 r5d708bf  
    380380
    381381ALTER TABLE  `sys_parameters` CHARACTER SET = utf8,  CHANGE  `created`  `created` DATETIME NULL DEFAULT NULL, CHANGE  `modified`  `modified` DATETIME NULL DEFAULT NULL ;
    382 INSERT INTO `sys_parameters` VALUES (NULL, 'system.version', '2.9.9', 'S', 'System version', 'A', 1, NOW(), 1, NOW());
     382INSERT INTO `sys_parameters` VALUES (NULL, 'system.version', '3.0.0', 'S', 'System version', 'A', 1, NOW(), 1, NOW()),
     383(NULL, 'display.login.header', '', 'S', 'Login Info Header', 'A', 0, NOW(), 0, NOW()),
     384(NULL, 'display.login.footer', '', 'S', 'Login Info Footer', 'A', 0, NOW(), 0, NOW());
    383385
    384386ALTER TABLE  `user_courses` CHANGE  `created`  `created` DATETIME NULL DEFAULT NULL, CHANGE  `modified`  `modified` DATETIME NULL DEFAULT NULL ;
  • app/config/sql/ipeer.sql

    r316ecb7 r5d708bf  
    10481048(23, 'email.username', '', 'S', 'username for email smtp option', 'A', '0', NOW(), NULL , NOW()),
    10491049(24, 'email.password', '', 'S', 'password for email smtp option', 'A', '0', NOW(), NULL , NOW()),
    1050 (25, 'display.contact_info', 'noreply@ipeer.ctlt.ubc.ca', 'S', 'Contact Info', 'A', 0, NOW(), 0, NOW());
     1050(25, 'display.contact_info', 'noreply@ipeer.ctlt.ubc.ca', 'S', 'Contact Info', 'A', 0, NOW(), 0, NOW()),
     1051(26, 'display.login.header', '', 'S', 'Login Info Header', 'A', 0, NOW(), 0, NOW()),
     1052(27, 'display.login.footer', '', 'S', 'Login Info Footer', 'A', 0, NOW(), 0, NOW());
    10511053
    10521054-- --------------------------------------------------------
  • app/config/sql/ipeer_samples_data.sql

    r316ecb7 r5d708bf  
    15351535(23, 'email.username', '', 'S', 'username for email smtp option', 'A', '0', NOW(), NULL , NOW()),
    15361536(24, 'email.password', '', 'S', 'password for email smtp option', 'A', '0', NOW(), NULL , NOW()),
    1537 (25, 'display.contact_info', 'noreply@ipeer.ctlt.ubc.ca', 'S', 'Contact Info', 'A', 0, NOW(), 0, NOW());
     1537(25, 'display.contact_info', 'noreply@ipeer.ctlt.ubc.ca', 'S', 'Contact Info', 'A', 0, NOW(), 0, NOW()),
     1538(26, 'display.login.header', '', 'S', 'Login Info Header', 'A', 0, NOW(), 0, NOW()),
     1539(27, 'display.login.footer', '', 'S', 'Login Info Footer', 'A', 0, NOW(), 0, NOW());
    15381540
    15391541-- --------------------------------------------------------
  • app/controllers/surveys_controller.php

    r316ecb7 r5d708bf  
    1313    public $uses =  array('SurveyQuestion', 'Course', 'Survey', 'User', 'Question', 'Response', 'Personalize', 'Event', 'EvaluationSubmission', 'UserEnrol', 'SurveyInput', 'SurveyGroupMember', 'SurveyGroupSet', 'SurveyGroup');
    1414    public $name = 'Surveys';
    15     public $show;
    16     public $sortBy;
    17     public $direction;
    18     public $page;
    19     public $order;
    20     public $Sanitize;
    2115    public $helpers = array('Html', 'Ajax', 'Javascript', 'Time');
    2216    public $components = array('AjaxList', 'Output', 'framework');
     
    3125    function __construct()
    3226    {
    33         $this->Sanitize = new Sanitize;
    34         $this->show = empty($_REQUEST['show'])? 'null': $this->Sanitize->paranoid($_REQUEST['show']);
    35         if ($this->show == 'all') {
    36             $this->show = 99999999;
    37         }
    38         $this->sortBy = empty($_GET['sort'])? 'Survey.created': $_GET['sort'];
    39         $this->direction = empty($_GET['direction'])? 'desc': $this->Sanitize->paranoid($_GET['direction']);
    40         $this->page = empty($_GET['page'])? '1': $this->Sanitize->paranoid($_GET['page']);
    41         $this->order = $this->sortBy.' '.strtoupper($this->direction);
    4227        $this->mine_only = (!empty($_REQUEST['show_my_tool']) && ('on' == $_REQUEST['show_my_tool'] || 1 == $_REQUEST['show_my_tool'])) ? true : false;
    4328        $this->set('title_for_layout', __('Surveys', true));
  • app/controllers/sysparameters_controller.php

    r316ecb7 r5d708bf  
    8585     * @return void
    8686     */
    87     function index($message='')
     87    function index()
    8888    {
    89         // Make sure the present user has permission
    90         if (!User::hasPermission('controllers/sysparameters')) {
    91             $this->Session->setFlash('You do not have permission to view system parameters', true);
    92             $this->redirect('/home');
    93         }
    94         // Set the top message
    95         $this->set('message', $message);
    9689        // Set up the basic static ajax list variables
    9790        $this->setUpAjaxList();
     
    141134    function add()
    142135    {
    143         if (empty($this->data)) {
    144             $this->render();
     136        if ($this->SysParameter->save($this->params['data'])) {
     137            $this->Session->setFlash(__('The record is saved successfully', true), 'good');
     138            $this->redirect('index');
    145139        } else {
    146             if ($this->SysParameter->save($this->params['data'])) {
    147                 $message = __('The record is saved successfully', true);
    148                 $this->redirect('sysparameters/index/'.$message);
    149             } else {
    150                 $this->set('data', $this->data);
    151                 $this->render('edit');
    152             }
     140            $this->Session->setFlash(__('Failed to save the record', true));
    153141        }
    154142    }
     
    162150     * @return void
    163151     */
    164     function edit($id=null)
     152    function edit($id)
    165153    {
    166154        if (empty($this->data)) {
     
    168156            $this->data = $this->SysParameter->read();
    169157            $this->set('data', $this->data);
    170             $this->render();
    171158        } else {
    172159            if ($this->SysParameter->save($this->data)) {
    173                 $this->Session->setFlash(__('The record is edited successfully.', true));
     160                $this->Session->setFlash(__('The record is edited successfully.', true), 'good');
    174161                $this->redirect('index');
    175162            } else {
    176163                $this->Session->setFlash($this->SysParameter->errorMessage, true);
    177164                $this->set('data', $this->data);
    178                 $this->render();
    179165            }
    180166        }
  • app/models/sys_parameter.php

    r316ecb7 r5d708bf  
    111111    function afterSave($created)
    112112    {
    113         Cache::write($this->data['SysParameter']['parameter_code'], $this->data['SysParameter'], 'configuration');
     113        if (empty($this->data['SysParameter']['parameter_value'])) {
     114            // cake cache doesn't allow storing empty value. so we have to remove
     115            // the old value instead of overwrite
     116            Cache::delete($this->data['SysParameter']['parameter_code'], 'configuration');
     117        } else {
     118            Cache::write($this->data['SysParameter']['parameter_code'], $this->data['SysParameter']['parameter_value'], 'configuration');
     119        }
    114120
    115121        return true;
  • app/views/plugins/guard/guard/login.ctp

    r316ecb7 r5d708bf  
    11<div align="center" class="login">
    2   <h4>iPeer Login</h4>
    3 <!-- begin login form -->
    4   <?php echo $this->element('login_' . Inflector::underscore($auth_module_name), array('login_url', $login_url, 'is_logged_in' => $is_logged_in))?>
    5 <!-- end login form -->
     2    <h4>iPeer Login</h4>
     3    <?php echo isset($loginHeader) ? $loginHeader : ''?>
     4    <!-- begin login form -->
     5    <?php echo $this->element('login_' . Inflector::underscore($auth_module_name), array('login_url', $login_url, 'is_logged_in' => $is_logged_in))?>
     6    <!-- end login form -->
     7    <?php echo isset($loginFooter) ? $loginFooter : ''?>
    68</div>
    79
    810<script type="text/javascript">
    9 console.log("blah");
    1011jQuery('#GuardUsername').focus();
    1112</script>
  • app/webroot/css/ipeer.css

    r316ecb7 r5d708bf  
    15311531    white-space:nowrap;
    15321532}
     1533
     1534.login-footer {
     1535    font-size: 0.8em;
     1536    margin: 0.5em 0 1em 0;
     1537}
     1538
     1539.login-footer a {
     1540    text-decoration: none;
     1541    color: black;
     1542}
Note: See TracChangeset for help on using the changeset viewer.