Changeset 239


Ignore:
Timestamp:
03/17/09 14:07:03 (3 years ago)
Author:
aarkerio
Message:

New files

Location:
trunk
Files:
4 added
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/controllers/confirms_controller.php

    r238 r239  
    2222   $this->pageTitle = 'Centauro Confirm'; 
    2323   $this->layout    = 'portal';    
    24    $conditions      = array('secret'=>trim($secret));    
     24   $conditions      = array('Confirm.secret'=>trim($secret));    
    2525   $fields          = array('Confirm.id', 'Confirm.user_id'); 
    2626   $data            = $this->Confirm->find($conditions, $fields); 
     
    2929      $this->Confirm->User->id = (int) $data['Confirm']['user_id']; 
    3030 
    31       if ( $this->Confirm->User->saveField('status', 1) ): 
     31      if ( $this->Confirm->User->saveField('active', 1) ): 
     32           $this->Confirm->del($data['Confirm']['id']); 
    3233           $msg = 'The registration process has finished succesfully'; 
    3334      else: 
    3435           $msg = 'The registration process has failed miserably'; 
    3536          endif; 
    36       $this->Confirm->del($data['Confirm']['id']); 
    3737   endif; 
    3838             
  • trunk/controllers/helps_controller.php

    r137 r239  
    22/** 
    33*  Chipotle Software 
    4 *  Manuel Montoya 2002-2007  
     4*  Manuel Montoya 2002-2009  
    55*  GPL manuel<at>mononeurona<dot>org 
    66*/  
     
    1010class HelpsController extends AppController 
    1111 
    12  public $helpers       = array('Javascript', 'Ajax', 'Form', 'Fck'); 
     12 public $helpers       = array('Javascript', 'Fck'); 
    1313    
    14  public $components    = array('Security'); 
     14 public $components    = array('Email'); 
    1515 
    1616 public function beforeFilter()  
    1717 { 
    1818   parent::beforeFilter(); 
    19    $this->Auth->allow(array('display', 'view', 'tour')); 
     19   $this->Auth->allow(array('display', 'view', 'tour', 'index')); 
    2020 } 
    21     
    2221    
    2322 public function tour()  
     
    2625   $this->pageTitle = 'Tu portal::MonoNeurona'; 
    2726 } 
     27 
     28 public function display($a, $b, $c) 
     29 { 
     30   $url  = '/'.$a .'/'.$b .'/'.$c; 
     31   $lang =  $this->Auth->user('lang'); 
     32    
     33   $lang = !$lang ? 'en' : 'es'; 
     34    
     35   $this->layout    = 'help'; 
     36   $this->pageTitle = 'Karamelo ' . __('Help', true); 
     37   $conditions      = array('url'=>$url, 'lang'=> $lang); 
     38   $fields          = array('help', 'title', 'url', 'lang');   
     39   $this->set('data', $this->Help->find($conditions, $fields)); 
     40 } 
     41 
     42 public function index($set=null)  
     43 { 
     44  $lang = (Configure::read('Config.language')) ?  Configure::read('Config.language') : 'en'; 
     45  $this->layout    = ( isset($set) ) ? 'admin' : 'help'; //small window or admin panel? 
     46  $this->pageTitle = 'Karamelo '. __('Help', true); 
     47  $conditions      = array('lang'=>$lang); 
     48  $fields          = array('id','title','url');   
     49  $order           = 'title'; 
     50  $this->set('data', $this->Help->findAll($conditions, $fields, $order)); 
     51 } 
     52 
     53 public function view($help_id, $set = null)  
     54 { 
     55  $lang = (Configure::read('Config.language')) ?  Configure::read('Config.language') : 'en'; 
     56  $this->layout    = ( $set !==  null) ? 'admin' : 'help'; //small window or admin panel? 
     57  $this->pageTitle = 'Karamelo '. __('Help', true); 
     58  $conditions      = array('Help.id'=>$help_id); 
     59  $fields          = array('id','title', 'help', 'lang'); 
     60  $this->set('data', $this->Help->find($conditions, $fields)); 
     61 } 
     62 
    2863     
    2964 /***=== ADMIN SECTION===**/      
     65 //bug report 
     66 public function admin_newticket()  
     67 { 
     68  $this->layout    = 'admin'; 
     69  $this->pageTitle = 'Centauro Bug Report'; 
     70  $conditions      = array('lang'=>'en'); 
     71  $fields          = array('help', 'url', 'lang');   
     72  $this->set('data', $this->Help->findAll($conditions, $fields)); 
     73 } 
     74 
     75 public function admin_submit() 
     76 {   
     77   if ( !empty( $this->data['Help'] ) ): 
     78    $this->data['Help']['report'] = Sanitize::paranoid($this->data['Help']['report']); 
     79    $report  = $this->Auth->user('username') .' with email '. $this->Auth->user('email') .', wrote: '; 
     80 
     81    $report .= $this->data['Help']['report'] .'.  Kind: ' . $this->data['Help']['kind']; 
     82 
     83    if ( $this->__sendNewReport( $report ) ): 
     84            $this->msgFlash(__('Email sent, Thanks!', true), '/admin/entries/start');  
     85    endif; 
     86  endif; 
     87 } 
     88 
    3089 public function admin_display($path = null)  
    3190 { 
     
    3998 } 
    4099    
    41  public function admin_add()  
    42  {    
    43 // adds new classroom to database 
    44         if (!empty($this->params['data'])) 
    45         { 
    46          
    47          
    48        Sanitize::clean($this->params['data']); //Hopefully this is enough 
    49          
    50           if ($this->Help->save($this->params['data'])) 
    51           { 
    52              //$this->set('data', $this->Help->index()); 
    53               $this->flash('Your classroom has been saved.','/vclassrooms/listing'); 
    54            } 
    55         }  
    56         else  
    57         { 
    58         $this->layout = 'admin'; 
    59          
    60         $this->Subject     = new Subject; 
    61          
    62         $this->set('subjects', $this->Subject->generateList(null, 'title'));             
    63          
    64         $conditions = array("status"=>1); 
    65          
    66         $order      = "order DESC"; 
    67          
    68         $O = $this->Help->field('order', $conditions, $order); 
    69          
    70         $Order = $O + 1; 
    71          
    72         $this->set('Order', $Order); 
    73     } 
    74          
     100 public function admin_edit($help_id = null) 
     101 { 
     102   $this->__chkGroup(); // admin user? 
     103   $this->layout = 'admin';  
     104   if (!empty($this->data['Help'])): 
     105     $this->data['Help']['url']   = Sanitize::paranoid($this->data['Help']['url'], $this->para_allowed); 
     106     $this->data['Help']['title'] = Sanitize::paranoid($this->data['Help']['title'], $this->para_allowed); 
     107 
     108     if ( $this->Help->save($this->data) ): 
     109        if ($this->data['Help']['end'] == 0 && !isset($this->data['Help']['id'])): 
     110             $id = $this->Help->getLastInsertID(); 
     111             $return = '/admin/helps/edit/'.$id; 
     112        elseif ($this->data['Help']['end'] == 0 && isset($this->data['Help']['id'])): 
     113             $return = '/admin/helps/edit/'.$this->data['Help']['id']; 
     114        elseif($this->data['Help']['end'] == 1): 
     115             $return = '/admin/helps/listing';  
     116        endif; 
     117        $this->msgFlash(__('Data saved', true), $return);     
     118     endif; 
     119    elseif($help_id != null && intval($help_id)):         
     120        $this->data = $this->Help->read(null, $help_id); 
     121    endif; 
    75122 } 
    76123  
    77   public function admin_edit($id = null) 
    78   { 
    79       
    80     if (empty($this->data)) 
    81     { 
    82         $this->layout = 'admin'; 
    83          
    84         $this->Help->id = $id; 
    85          
    86         $this->Subject     = new Subject; 
    87          
    88         $this->set('subjects', $this->Subject->generateList());                  
    89          
    90         $this->data = $this->Help->read(); 
    91     } 
    92     else 
    93     { 
    94         if ($this->Help->save($this->data['Vclassroom'])) 
    95         { 
    96             $this->flash('Your virtual classroom  has been updated.','/vclassrooms/listing'); 
    97         } 
    98     } 
    99 } 
    100    
    101   public function admin_delete($id) 
    102   { 
    103                 // deletes task from database 
    104                 $this->Help->del($id); 
    105                 $this->flash('Your virtual classroom  has been updated.','/vclassrooms/listing'); 
    106   } 
     124 public function admin_delete($help_id) 
     125 { 
     126   if ( $this->Help->del($help_id) ): 
     127           $this->msgFlash(__('Data removed', true),'/admin/helps/listing'); 
     128   endif; 
     129 } 
     130 
     131 // deliver a bug report   
     132 private function __sendNewReport($report)  
     133 { 
     134    $this->Email->to       = 'mmontoya@gmail.com'; 
     135    $this->Email->bcc      = array('contact@chipotle-software.com');  // note 
     136    // this could be just a string too 
     137    $this->Email->subject  = 'Karamelo e-Learning:: bug report'; 
     138    $this->Email->replyTo  = 'support@karamelo.org'; 
     139    $this->Email->from     = 'Chipotle-software.com'; 
     140    $this->Email->template = 'report'; // note no '.ctp' 
     141    //Send as 'html', 'text' or 'both' (default is 'text') 
     142    $this->Email->sendAs   = 'text'; // because we like to send pretty mail 
     143    //Set view variables as normal 
     144    $this->set('report', $report); 
     145    //Do not pass any args to send()  
     146    if ( $this->Email->send() ): 
     147            return true;  
     148    else: 
     149            return false; 
     150    endif; 
     151 } 
    107152   
    108153} 
  • trunk/controllers/users_controller.php

    r238 r239  
    7272 public function register()  
    7373 { 
     74  if ( $this->Auth->user('id')): 
     75      $this->msgFlash('You are already logged in', '/'); 
     76  endif; 
    7477  $this->layout    = 'portal'; 
     78   
    7579 } 
    7680    
  • trunk/views/elements/themes_top.ctp

    r178 r239  
    88                                                               $html->link(__('Quotes', true), '/admin/quotes/listing'), 
    99                                                               $html->link(__('Images', true), '/admin/images/listing'), 
    10                                                                $html->link(__('Shares', true), '/admin/shares/listing') 
     10                                                               $html->link(__('Shares', true), '/admin/shares/listing'), 
     11                                                               $html->link(__('Logout', true), '/users/logout') 
    1112                                                                          )); 
    1213else: 
  • trunk/views/layouts/admin.ctp

    r213 r239  
    4545?>        
    4646</div> 
     47<div style="margin:0 0 0 60px;text-align:left;"> 
     48   <?php echo $this->element('admin_menu'); ?> 
     49</div> 
    4750<div id="container"> 
    4851           <div id="main-section" class="clearfix"> 
    49                 <?php echo $content_for_layout ?> 
     52                <?php  
     53                   echo $content_for_layout; 
     54                ?> 
    5055           </div> 
    5156 <div style="clear:both"></div> 
     
    5661</body> 
    5762</html> 
    58  
  • trunk/views/layouts/portal.ctp

    r225 r239  
    2424</head> 
    2525<body> 
     26<?php $session->flash(); ?> 
     27 <script type="text/javascript"> 
     28   window.onload = timedMsg; 
     29</script> 
    2630<?php echo  $this->element('themes_top');  ?> 
    2731<table id="maintable"> 
  • trunk/webroot/css/cpanel.css

    r213 r239  
    988988} 
    989989 
     990/* NAVIGATION MENU  */ 
     991 
     992/* Root = Horizontal, Secondary = Vertical */ 
     993ul#navmenu { 
     994  margin: 0; 
     995  border: 0 none; 
     996  padding: 0; 
     997  width: 800px; /*For KHTML*/ 
     998  list-style: none; 
     999  height: 24px; 
     1000} 
     1001 
     1002ul#navmenu li { 
     1003  margin: 0; 
     1004  border: 0 none; 
     1005  padding: 0; 
     1006  float: left; /*For Gecko*/ 
     1007  display: inline; 
     1008  list-style: none; 
     1009  position: relative; 
     1010  height: 24px; 
     1011} 
     1012 
     1013ul#navmenu ul { 
     1014  margin: 0; 
     1015  border: 0 none; 
     1016  padding: 0; 
     1017  width: 160px; 
     1018  list-style: none; 
     1019  display: none; 
     1020  position: absolute; 
     1021  top: 24px; 
     1022  left: 0; 
     1023} 
     1024 
     1025ul#navmenu ul:after /*From IE 7 lack of compliance*/{ 
     1026  clear: both; 
     1027  display: block; 
     1028  font: 1px/0px serif; 
     1029  content: "."; 
     1030  height: 0; 
     1031  visibility: hidden; 
     1032} 
     1033 
     1034ul#navmenu ul li { 
     1035  width: 160px; 
     1036  float: left; /*For IE 7 lack of compliance*/ 
     1037  display: block !important; 
     1038  display: inline; /*For IE*/ 
     1039} 
     1040 
     1041/* Root Menu */ 
     1042ul#navmenu a { 
     1043  border: 1px solid #FFF; 
     1044  border-right-color: #CCC; 
     1045  border-bottom-color: #CCC; 
     1046  padding: 0 6px; 
     1047  float: none !important; /*For Opera*/ 
     1048  float: left; /*For IE*/ 
     1049  display: block; 
     1050  background: #EEE; 
     1051  color: #666; 
     1052  font: bold 10px/22px Verdana, Arial, Helvetica, sans-serif; 
     1053  text-decoration: none; 
     1054  height: auto !important; 
     1055  height: 1%; /*For IE*/ 
     1056} 
     1057 
     1058/* Root Menu Hover Persistence */ 
     1059ul#navmenu a:hover, 
     1060ul#navmenu li:hover a, 
     1061ul#navmenu li.iehover a { 
     1062  background: #CCC; 
     1063  color: #FFF; 
     1064} 
     1065 
     1066/* 2nd Menu */ 
     1067ul#navmenu li:hover li a, 
     1068ul#navmenu li.iehover li a { 
     1069  float: none; 
     1070  background: #EEE; 
     1071  color: #666; 
     1072} 
     1073 
     1074/* 2nd Menu Hover Persistence */ 
     1075ul#navmenu li:hover li a:hover, 
     1076ul#navmenu li:hover li:hover a, 
     1077ul#navmenu li.iehover li a:hover, 
     1078ul#navmenu li.iehover li.iehover a { 
     1079  background: #CCC; 
     1080  color: #FFF; 
     1081} 
     1082 
     1083/* 3rd Menu */ 
     1084ul#navmenu li:hover li:hover li a, 
     1085ul#navmenu li.iehover li.iehover li a { 
     1086  background: #EEE; 
     1087  color: #666; 
     1088} 
     1089 
     1090/* 3rd Menu Hover Persistence */ 
     1091ul#navmenu li:hover li:hover li a:hover, 
     1092ul#navmenu li:hover li:hover li:hover a, 
     1093ul#navmenu li.iehover li.iehover li a:hover, 
     1094ul#navmenu li.iehover li.iehover li.iehover a { 
     1095  background: #CCC; 
     1096  color: #FFF; 
     1097} 
     1098 
     1099/* 4th Menu */ 
     1100ul#navmenu li:hover li:hover li:hover li a, 
     1101ul#navmenu li.iehover li.iehover li.iehover li a { 
     1102  background: #EEE; 
     1103  color: #666; 
     1104} 
     1105 
     1106/* 4th Menu Hover */ 
     1107ul#navmenu li:hover li:hover li:hover li a:hover, 
     1108ul#navmenu li.iehover li.iehover li.iehover li a:hover { 
     1109  background: #CCC; 
     1110  color: #FFF; 
     1111} 
     1112 
     1113ul#navmenu ul ul, 
     1114ul#navmenu ul ul ul { 
     1115  display: none; 
     1116  position: absolute; 
     1117  top: 0; 
     1118  left: 160px; 
     1119} 
     1120 
     1121/* Do Not Move - Must Come Before display:block for Gecko */ 
     1122ul#navmenu li:hover ul ul, 
     1123ul#navmenu li:hover ul ul ul, 
     1124ul#navmenu li.iehover ul ul, 
     1125ul#navmenu li.iehover ul ul ul { 
     1126  display: none; 
     1127} 
     1128 
     1129ul#navmenu li:hover ul, 
     1130ul#navmenu ul li:hover ul, 
     1131ul#navmenu ul ul li:hover ul, 
     1132ul#navmenu li.iehover ul, 
     1133ul#navmenu ul li.iehover ul, 
     1134ul#navmenu ul ul li.iehover ul { 
     1135  display: block; 
     1136} 
  • trunk/webroot/js/admin.js

    r173 r239  
    9595    var t=setTimeout("document.getElementById('flashMessage').style.display = 'none'", 2000); 
    9696} 
    97  
  • trunk/webroot/js/myfunctions.js

    r139 r239  
    22window.onload = init; 
    33var logged = false; 
     4 
     5function timedMsg() 
     6{ 
     7  if (document.getElementById('flashMessage')) 
     8    var t=setTimeout("document.getElementById('flashMessage').style.display = 'none'", 2000); 
     9} 
    410 
    511function init() { 
Note: See TracChangeset for help on using the changeset viewer.