Changeset 43

Show
Ignore:
Timestamp:
10/02/07 06:34:55 (3 years ago)
Author:
bermi
Message:

Added settings for currently enabled languages. Closes #7, #9, #5 and #2

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/src/config/DEFAULT-config.php

    r11 r43  
    4747defined('AK_ENVIRONMENT') ? null : define('AK_ENVIRONMENT', 'development'); 
    4848 
    49 defined('AK_FRAMEWORK_DIR') ? null : define('AK_FRAMEWORK_DIR', '/home2/akeloso/akelosframework'); 
     49// defined('AK_FRAMEWORK_DIR') ? null : define('AK_FRAMEWORK_DIR', '/path/to/your/akelos'); 
    5050 
    5151include_once(dirname(__FILE__).DIRECTORY_SEPARATOR.'boot.php'); 
  • trunk/src/includes/editam/controllers/page_controller.php

    r15 r43  
    156156        $is_new_page = !(!empty($this->params['id']) && $this->Page->id == $this->params['id']); 
    157157        $this->is_homepage = !empty($this->params['is_first']) || !$is_new_page && $this->Page->isHomepage(); 
     158 
     159        if(!$this->is_homepage && empty($this->ParentPage)){ 
     160            if($this->ParentPage = $this->Page->nested_set->getRoot()){ 
     161                $this->params['page']['parent_id'] = $this->ParentPage->getId(); 
     162            } 
     163        } 
     164         
    158165        if(!empty($this->params['page'])){ 
    159166            $this->Page->setAttributes($this->params['page']); 
     
    175182                    (empty($this->params['next']) || $this->params['next'] != 'child') ? 
    176183                    array('action' => 'edit', 'id' => $this->Page->getId()) : 
    177                     array('action' => 'add_child', 'parent_id' => $this->Page->getId())  
     184                    array('action' => 'add_child', 'parent_id' => $this->Page->getId()) 
    178185                    ) 
    179186                    ); 
    180187                    return ; 
    181188                } 
    182             } 
    183         }elseif(!$this->is_homepage && empty($this->ParentPage)){ 
    184             if($this->ParentPage = $this->Page->nested_set->getRoot()){ 
    185                 $this->params['page']['parent_id'] = $this->ParentPage->getId(); 
    186189            } 
    187190        } 
     
    221224    { 
    222225        $this->layout = false; 
    223          
     226 
    224227        if(!empty($this->params['content'])){ 
    225228            $from = empty($this->params['from']) ? 'html' : $this->params['from']; 
     
    272275        $Page->layout->load(); 
    273276        $results[$Page->layout->getId()] = $Page->layout->getAttributes()." -- {%= pages_list :first = '/docs', :id = 'menu', :class = 'menu docs' %}"; 
    274 */ 
     277        */ 
    275278        $this->layout = false; 
    276279 
  • trunk/src/includes/editam/helpers/layout_helper.php

    r2 r43  
    5252    function language_switch_list($langs = array(), $list_html_options = array(), $list_item_html_options = array()) 
    5353    { 
    54         $default_list_html_options = array('class'=>'language_switch'); 
     54        $default_list_html_options = array('class'=>'language_switch user_actions'); 
    5555        $list_html_options = array_merge($default_list_html_options, $list_html_options); 
    5656         
     
    7171    { 
    7272        return $this->_controller->url_helper->link_to($description, 
    73         $this->_controller->url_helper->modify_current_url(array('lang'=>$language), array('ak',AK_SESSION_NAME,'AK_SESSID','PHPSESSID'), false), 
     73        $this->_controller->url_helper->modify_current_url(array('lang'=>$language), array('ak',AK_SESSION_NAME,'AK_SESSID','PHPSESSID','is_first'), false), 
    7474        $html_options); 
    7575    } 
  • trunk/src/includes/editam/installers/editam_1/profiles/sample_website/profile.php

    r17 r43  
    8080            'filter' => 'markdown', 
    8181            'content' =>  
    82                 "Please login <a href='{base}/admin'>login</a> using *admin* as your username and password to administer your website
     82                "Please login <a href='{base}/admin'>login</a> using the username and password you provided when you installed Editam
    8383 
    8484Editam is a content management platform based in these core principles and objectives 
  • trunk/src/includes/editam/models/page.php

    r35 r43  
    5757    var $acts_as = array('nested_set' => array('order' => 'virtual DESC, title ASC','scope' => "locale = ?")); 
    5858 
    59 /* 
    60     function __construct() 
    61     { 
    62         $attributes = (array)func_get_args(); 
    63         $Page = $this->init($attributes); 
    64         $Page->_fixed_locale = $Page->get('locale'); 
    65     } 
    66 */     
    67  
    6859    function getLocale() 
    6960    { 
    7061        $default_lang = Ak::lang(); 
    71         $lang = empty($this->locale) ? $default_lang : $this->locale; 
     62        $lang = !isset($this->_original_locale) || empty($this->locale) ? $default_lang : $this->locale; 
    7263        $locale = in_array($lang, Ak::langs()) ? $lang : $default_lang; 
    7364        $this->_original_locale = empty($this->_original_locale) ? $locale : $this->_original_locale; 
    7465        return $locale; 
     66    } 
     67     
     68    function forceSetLocale($locale) 
     69    { 
     70        $this->_forced_locale = $locale; 
    7571    } 
    7672 
  • trunk/src/includes/editam/models/preferences/core_preferences.php

    r41 r43  
    7272            if($config_file != $new_config_file){ 
    7373                Ak::file_put_contents(AK_CONFIG_DIR.DS.'config.php', $new_config_file); 
     74                 
     75                foreach (Ak::toArray($new_langs) as $lang){ 
     76                    $lang = Ak::sanitize_include($lang,'paranoid'); 
     77                    $locale_file = AK_CONFIG_DIR.DS.'locales'.DS.$lang.'.php'; 
     78                    if(!file_exists($locale_file) && !empty($base_locale_file)){ 
     79                        $base_locale = preg_replace('/(\$locale\[[\r\n\s\t]*[\'"]description[\'"][\r\n\s\t]*][\r\n\s\t]*=[\r\n\s\t]*[\'"])(.+)([\'"][\r\n\s\t]*;)/','$1'.$lang.'$3', Ak::file_get_contents($base_locale_file)); 
     80                        Ak::file_put_contents($locale_file, $base_locale); 
     81                    }elseif (empty($base_locale_file)){ 
     82                        $base_locale_file = $locale_file; 
     83                    } 
     84                } 
    7485            } 
    7586        } 
  • trunk/src/includes/editam/views/admin/_user_menu.tpl

    r2 r43  
    33  <li><%= link_to _"preferences", :controller => 'preferences', :action => 'setup' %></li> 
    44</ul> 
     5  <%= language_switch_list %> 
  • trunk/src/stylesheets/editam.css

    r2 r43  
    267267} 
    268268 
    269 .language_switch li a{ color:#777; } 
    270  
    271 .language_switch li{ 
    272     font-size:70%; 
    273     float:right; 
    274     padding:0 3px 0 3px; 
    275 } 
    276269 
    277270ul.language_switch{ 
    278     display:block; 
    279     height:14px; 
    280     margin:-5px 0 0 0; 
     271    margin:0 15px 0 0; 
    281272} 
    282273