Changeset 89 in ExiteCMS8


Ignore:
Timestamp:
09/07/11 16:10:31 (9 months ago)
Author:
WanWizard
Message:

reorganisation of global classes to avoid future name conflicts
removed our custom htmlentities method
progress on the page layout editor

Location:
trunk
Files:
3 added
35 edited
4 moved

Legend:

Unmodified
Added
Removed
  • trunk/exitecms/classes/controller/bootstrap.php

    r84 r89  
    9090        { 
    9191            // load the defined theme controller 
    92             static::$theme = \Theme::forge($layout['theme']); 
     92            static::$theme = \ExiteCMS_Themes::forge($layout['theme']); 
    9393 
    9494            // load the defined theme template 
     
    210210        // store the current URI in the session 
    211211        $session->set('last_uri', \Input::uri()); 
     212 
     213        return $this->response; 
    212214    } 
    213215 
     
    299301                if ( ! isset($config['404']) ) 
    300302                { 
    301                     throw new ExitecmsException('Unable to locate the requested page, and no 404 page has been defined'); 
     303                    throw new Exitecms_Exception('Unable to locate the requested page, and no 404 page has been defined'); 
    302304                } 
    303305                $layout = $config['404']; 
  • trunk/exitecms/classes/exitecms.php

    r79 r89  
    113113    // ----------------------------------------------------------------- 
    114114 
    115     public static function htmlentities($value) 
    116     { 
    117         static $already_cleaned = array(); 
    118  
    119         // Nothing to escape for non-string scalars, or for already processed values 
    120         if (is_bool($value) or is_int($value) or is_float($value) or in_array($value, $already_cleaned, true)) 
    121         { 
    122             return $value; 
    123         } 
    124  
    125         if (is_string($value)) 
    126         { 
    127             $value = htmlentities($value, ENT_NOQUOTES, \Fuel::$encoding, false); 
    128         } 
    129         elseif (is_array($value) || $value instanceof \Iterator) 
    130         { 
    131             foreach ($value as $k => $v) 
    132             { 
    133                 $value[$k] = static::htmlentities($v); 
    134             } 
    135  
    136             // Add to $already_cleaned variable when object 
    137             is_object($value) and $already_cleaned[] = $value; 
    138         } 
    139         elseif (is_object($value)) 
    140         { 
    141             // Check if the object is whitelisted and return when that's the case 
    142             foreach (\Config::get('security.whitelisted_classes') as $class) 
    143             { 
    144                 if (is_a($value, $class)) 
    145                 { 
    146                     // Add to $already_cleaned variable 
    147                     $already_cleaned[] = $value; 
    148  
    149                     return $value; 
    150                 } 
    151             } 
    152  
    153             // Throw exception when it wasn't whitelisted and can't be converted to String 
    154             if ( ! method_exists($value, '__toString')) 
    155             { 
    156                 throw new \RuntimeException('Object class "'.get_class($value).'" could not be converted to string or '. 
    157                     'sanitized as ArrayAcces. Whitelist it in security.whitelisted_classes in app/config/config.php '. 
    158                     'to allow it to be passed unchecked.'); 
    159             } 
    160  
    161             $value = static::htmlentities((string) $value); 
    162         } 
    163  
    164         return $value; 
    165     } 
    166  
    167     // ----------------------------------------------------------------- 
    168  
    169115    /* 
    170116     * TODO : has to move to a date or time class 
  • trunk/exitecms/classes/exitecms/exception.php

    r79 r89  
    11<?php 
    2 class ExitecmsException extends Exception { 
     2class Exitecms_Exception extends Exception { 
    33 
    44    /** 
  • trunk/exitecms/classes/exitecms/forms.php

    r79 r89  
    129129            try 
    130130            { 
    131                 // create the view object for this forms method 
    132                 empty($this->view) and $this->view = 'forms'.DS.$this->action; 
    133  
    134                 if ( ! $this->view instanceOf View and ! $this->view instanceOf ViewModel) 
    135                 { 
    136                     $this->set_view(\View::forge($this->view)); 
     131                // check if a view is disabled for this request 
     132                if ($this->view === false) 
     133                { 
     134                    // request has no output 
     135                    $this->view = ''; 
    137136                } 
    138137                else 
    139138                { 
    140                     $this->set_view($this->view); 
     139                    // create the view object for this forms method 
     140                    empty($this->view) and $this->view = 'forms'.DS.$this->action; 
     141 
     142                    if ( ! $this->view instanceOf View and ! $this->view instanceOf ViewModel) 
     143                    { 
     144                        $this->set_view(\View::forge($this->view)); 
     145                    } 
     146                    else 
     147                    { 
     148                        $this->set_view($this->view); 
     149                    } 
    141150                } 
    142151            } 
    143152            catch (Fuel_Exception $e) 
    144153            { 
    145                 $this->view = 'unable to locate the view'; 
     154                throw new \Exitecms_Exception('unable to locate the view: "'.$this->view.'".'); 
    146155            } 
    147156 
     
    155164            empty($this->response->body) and $this->response->body = $this->view; 
    156165        } 
     166 
     167        return $this->response; 
    157168    } 
    158169 
     
    550561        { 
    551562            // check for missing labels 
    552             ! isset($definition['label']) and $this->fields[$name]['label'] = \Lang::get('field.'.$name); 
     563            ! isset($definition['label']) and $this->fields[$name]['label'] = \Lang::get('field.'.$name, array(), '<span style="background-color:yellow;color:black;padding:4px 8px;">label?</span>'); 
    553564 
    554565            // check for missing help text 
    555             ! isset($definition['help']) and $this->fields[$name]['help'] = \Lang::get('help.'.$name); 
     566            ! isset($definition['help']) and $this->fields[$name]['help'] = \Lang::get('help.'.$name, array(), null); 
    556567 
    557568            // check for missing options array 
     
    575586     * @return  array 
    576587     */ 
    577     protected function get_record($new = false) 
     588    protected function get_record($new = false, $recnbr = null) 
    578589    { 
    579590        $record = $this->fields; 
     
    581592        if ( ! $new) 
    582593        { 
    583             $recnbr = $this->param(1); 
     594            is_null($recnbr) and $recnbr = $this->param(1); 
    584595            if ( ! empty($recnbr) and is_numeric($recnbr) and $recnbr >= 1) 
    585596            { 
  • trunk/exitecms/classes/exitecms/module.php

    r84 r89  
    133133            foreach ($moduleinfo['widgets'] as $name => $widget) 
    134134            { 
    135                 $tplobj = new \ExiteCMS\Model_ModuleItem(); 
     135                $tplobj = new \ExiteCMS\Model_ModuleWidget(); 
    136136                $tplobj->name = $name; 
    137137                $tplobj->description = $widget['description']; 
    138138                $tplobj->uri = $widget['uri']; 
    139139                $tplobj->type = 'WIDGET'; 
    140                 $model->moduleitem[] = $tplobj; 
     140                $tplobj->method = isset($widget['method']) ? $widget['method'] : null; 
     141                $model->modulewidget[] = $tplobj; 
    141142            } 
    142143        } 
     
    162163    } 
    163164 
     165    // ----------------------------------------------------------------- 
     166 
     167    /* 
     168     * run the options controller for a module widget 
     169     * 
     170     */ 
     171    public function options($method) 
     172    { 
     173        // check if the method exists 
     174        if ( ! method_exists($this, $method)) 
     175        { 
     176            throw new \Exitecms_Exception('Specified options method "'.$method.'" is not defined in '.get_class($this)); 
     177        } 
     178 
     179 
     180    } 
     181 
    164182} 
    165183 
  • trunk/exitecms/classes/exitecms/modules.php

    r84 r89  
    1313 */ 
    1414 
    15 class Module { 
     15class ExiteCMS_Modules { 
    1616 
    1717    /** 
     
    104104     * @return  array   array of module controller objects 
    105105     */ 
    106     public static function modules() 
     106    public static function get() 
    107107    { 
    108108        // module object storage 
  • trunk/exitecms/classes/exitecms/themes.php

    r84 r89  
    1313 */ 
    1414 
    15 class Theme { 
     15class ExiteCMS_Themes { 
    1616 
    1717    /** 
     
    138138     * @return  array   array of theme controller objects 
    139139     */ 
    140     public static function themes() 
     140    public static function get() 
    141141    { 
    142142        // theme object storage 
  • trunk/exitecms/config/config.php

    r79 r89  
    127127         * dependant on how much input data there is. 
    128128         */ 
    129         'output_filter'         => array('Exitecms::htmlentities'), 
     129        'output_filter'         => array('Security::htmlentities'), 
    130130 
    131131        /** 
  • trunk/exitecms/config/session.php

    r60 r89  
    3636    // cookie path  (optional, default = '/') 
    3737    'cookie_path'       => '/', 
     38 
     39    // cookie http_only flag  (optional, default = use the cookie class default) 
     40    'cookie_http_only'  => true, 
    3841 
    3942    // if true, the session expires when the browser is closed (optional, default = false) 
  • trunk/exitecms/config/version.php

    r84 r89  
    1414 
    1515/* 
    16  * revision number added by SubVersion on checkout/export ** 
     16 * revision number added by SubVersion on checkout/export * 
    1717 */ 
    1818$revision = explode(' ', "\$Rev$"); 
  • trunk/exitecms/views/exception.php

    r68 r89  
    44 */ 
    55$message = explode('|', $exception->getMessage()); 
     6 
     7if (empty($message[1])) 
     8{ 
     9    $message[1] = 'Exception generated on line '.$exception->getLine().' of '.str_replace(APPPATH, 'APPPATH/', $exception->getFile()); 
     10    if ($code = $exception->getCode()) 
     11    { 
     12        $message[1] .= '<br />The exception code is '. $code; 
     13    } 
     14} 
     15 
    616if (empty($message[0])) 
    717{ 
    8     $message[0] = 'Exception generated on line '.$exception->getLine().' of '.str_replace(APPPATH, 'APPPATH/', $exception->getFile()); 
    9     if ($code = $exception->getCode()) 
    10     { 
    11         $message[0] .= '<br />The exception code is '. $code; 
    12     } 
    13 } 
    14 if (empty($message[1])) 
    15 { 
    16     $message[1] = $message[0]; 
    1718    $message[0] = 'ExiteCMS does not know how to handle this situation.'; 
    1819} 
     
    3738 
    3839        <div id="content"> 
    39             <p><?php echo $message[0]; ?></p> 
     40            <h2><?php echo $message[0]; ?></h2> 
    4041 
    41             <pre><code><?php echo $message[1]; ?></code></pre> 
     42            <?php 
     43                if (ini_get('display_errors')) 
     44                { 
     45                    echo '<pre><code>', $message[1], '</code></pre>'; 
     46                } 
     47            ?> 
    4248 
    4349            <p></p> 
  • trunk/modules/exitecms/classes/controller/datetime.php

    r79 r89  
    220220     * @return  array 
    221221     */ 
    222     protected function get_record() 
     222    protected function get_record($new = false, $recnbr = null) 
    223223    { 
    224224        // initial values 
  • trunk/modules/exitecms/classes/controller/install.php

    r79 r89  
    252252     * @return  array 
    253253     */ 
    254     protected function get_record() 
     254    protected function get_record($new = false, $recnbr = null) 
    255255    { 
    256256        // initial values 
  • trunk/modules/exitecms/classes/controller/locales.php

    r79 r89  
    156156     * @return  array 
    157157     */ 
    158     protected function get_record() 
     158    protected function get_record($new = false, $recnbr = null) 
    159159    { 
    160160        // initial values 
  • trunk/modules/exitecms/classes/controller/modules.php

    r84 r89  
    4040        parent::__construct($request, $response); 
    4141 
    42         if ($this->action == 'remove') 
     42        if ($this->action == 'install') 
     43        { 
     44            // install doesn't use views, it redirects with a message 
     45            $this->view = false; 
     46        } 
     47        elseif ($this->action == 'remove') 
    4348        { 
    4449            $this->action = 'delete'; 
     
    116121        { 
    117122            // get the theme controller instance 
    118             $module = \Module::forge($this->param(1)); 
     123            $module = \ExiteCMS_Modules::forge($this->param(1)); 
    119124 
    120125            // fetch the entire info array 
     
    275280        { 
    276281            // get the module controller instance 
    277             $module = \Module::forge($this->param(1)); 
     282            $module = \ExiteCMS_Modules::forge($this->param(1)); 
    278283 
    279284            // start the installer 
     
    429434    protected function before_delete() 
    430435    { 
    431         // check if any of this module's items is used anywhere 
    432         foreach($this->model->moduleitem as $item) 
    433         { 
     436        // check if any of this module's widgets is used anywhere 
     437        foreach($this->model->modulewidget as $item) 
     438        { 
     439            // * TODO * 
     440        } 
     441 
     442        // check if any of this module's plugins is used anywhere 
     443        foreach($this->model->moduleplugin as $item) 
     444        { 
     445            // * TODO * 
    434446        } 
    435447 
     
    446458        { 
    447459            // get the module controller instance 
    448             $module = \Module::forge($this->param(1)); 
     460            $module = \ExiteCMS_Modules::forge($this->param(1)); 
    449461 
    450462            // start the remover 
     
    470482    { 
    471483        // get the available modules 
    472         $modules = \Module::modules(); 
     484        $modules = \ExiteCMS_Modules::get(); 
    473485 
    474486        $found = $results = array(); 
  • trunk/modules/exitecms/classes/controller/security.php

    r79 r89  
    254254     * @return  array 
    255255     */ 
    256     protected function get_record() 
     256    protected function get_record($new = false, $recnbr = null) 
    257257    { 
    258258        // initial values 
  • trunk/modules/exitecms/classes/controller/templates.php

    r79 r89  
    9494        ); 
    9595 
     96        // field: theme_template_id 
     97        $this->fields['theme_template_id'] = array( 
     98            'validation' => array( 
     99                'rules' => 'required', 
     100                'flags' => 'numeric' 
     101            ), 
     102            'type' => 'select', 
     103            'options' => array( 
     104                'style' => 'width: 95%;', 
     105            ), 
     106            'value' => 0, 
     107            'values' => Model_ThemeTemplate::templates_dropdown(), 
     108        ); 
     109 
    96110        // field: locale 
    97111        $this->fields['locale'] = array( 
     
    137151    // custom form buttons 
    138152    // ----------------------------------------------------------------- 
     153 
     154    /* 
     155     */ 
     156    protected function button_add() 
     157    { 
     158        \ExiteCMS::redirect(\ExiteCMS::baseurl(array_merge(array($this->baseurl, 'add' => 0), $this->param()))); 
     159    } 
    139160 
    140161    /* 
     
    303324        if ($recnbr = $this->param(2)) 
    304325        { 
    305             $this->root  = Model_Page::forge()->find() 
    306                 ->where($this->model->tree_get_property('tree_field'), $recnbr) 
    307                 ->where($this->model->tree_get_property('left_field'), 1) 
    308                 ->get_one(); 
    309         } 
    310         if (empty($this->root )) 
     326            $this->root  = Model_Site::forge()->find($recnbr); 
     327        } 
     328        if (empty($this->root)) 
    311329        { 
    312330            // if we didn't find the site root, redirect to sites 
     
    479497    public function action_layout() 
    480498    { 
     499        // get the layout record 
     500        $layout = false; 
     501        if ($recnbr = $this->param('layout')) 
     502        { 
     503            $layout = Model_Template::forge()->find($recnbr); 
     504        } 
     505        if (empty($layout)) 
     506        { 
     507            // if we didn't find the layout page, redirect to sites 
     508            is_null($layout) and \ExiteCMS_Messages::set(\Lang::get('message.notfound_template'), 'E'); 
     509            \ExiteCMS::redirect(\ExiteCMS::baseurl(array($this->baseurl, 'site' => $this->param('site')))); 
     510        } 
     511 
    481512        // set the form title 
    482513        $this->view->set('title', \Lang::get('action.layout.title'), false); 
     
    486517 
    487518        // define the form header 
    488         $this->view->set('header', array('title' => \Lang::get('action.layout.form'), 'options' => array('colspan' => 2))); 
     519        $this->view->set('header', 
     520            array( 
     521                'widgets' => \Lang::get('action.layout.form.1'), 
     522                'layout' => \Lang::get('action.layout.form.2', array('theme' => $layout->themetemplate->theme->name, 'template' => $layout->themetemplate->name)) 
     523            ) 
     524        ); 
     525 
     526        // fetch the already defined 
     527        $widgets = array(); 
     528        foreach($layout->templatesection as $widget) 
     529        { 
     530            if ( ! isset($widgets[$widget->section])) 
     531            { 
     532                $widgets[$widget->section] = array(); 
     533            } 
     534            $widgets[$widget->section][$widget->order] = $widget; 
     535        } 
    489536 
    490537        // define the theme page layout 
    491         $layout = \Theme::instance('exitecms')->layout('default'); 
     538        $layout = \ExiteCMS_Themes::instance('exitecms')->layout($layout->themetemplate->name); 
    492539 
    493540        // define the baseurl for the selectors 
     
    497544        $div = \View::forge('forms/layout_selector'); 
    498545        $areas = array(); 
    499         foreach (\Theme::instance('exitecms')->get_areas() as $name => $area) 
    500         { 
    501             // cloning is faster than recreating the view object 
    502             $div = clone $div; 
     546        foreach (\ExiteCMS_Themes::instance('exitecms')->get_areas() as $name => $area) 
     547        { 
    503548            $div->set('name', $name); 
    504549            $div->set('description', $area['layout']['description']); 
    505550            (! isset($area['layout']['height']) or $area['layout']['height'] < 65) and $area['layout']['height'] = 65; 
    506551            $div->set('height', $area['layout']['height']); 
    507             $url = array_merge(array('widgets' => $name), $this->params); 
    508             array_unshift($url, $this->baseurl); 
    509             $url = \ExiteCMS::baseurl($url); 
    510             $div->set('url', $url); 
    511             $div->set('type', 'add-type-here'); 
    512             $div->set('count', 'add-counter-here'); 
    513             $areas[$name] = $div; 
     552            $div->set('count', isset($widgets[$name]) ? count($widgets[$name]) : 0); 
     553            $div->set('total', isset($area['max']) ? $area['max'] : 0); 
     554            $div->set('widgets', isset($widgets[$name]) ? $widgets[$name] : array()); 
     555            $areas[$name] = $div->render(); 
    514556        } 
    515557 
     
    518560        // add the layout to the view 
    519561        $this->view->set('layout', $layout, false); 
     562 
     563        // add the widgets to the view 
     564        $this->view->set('widgets', Model_Module::find()->order_by(array('name' => 'asc'))->where('active','=', 1)->get()); 
    520565 
    521566        // buttons to be placed under the form 
  • trunk/modules/exitecms/classes/controller/themes.php

    r84 r89  
    116116        { 
    117117            // get the theme controller instance 
    118             $theme = \Theme::forge($this->param(1)); 
     118            $theme = \ExiteCMS_Themes::forge($this->param(1)); 
    119119 
    120120            // fetch the defined templates 
     
    273273        { 
    274274            // get the theme controller instance 
    275             $theme = \Theme::forge($this->param(1)); 
     275            $theme = \ExiteCMS_Themes::forge($this->param(1)); 
    276276 
    277277            // start the installer 
     
    454454        { 
    455455            // get the theme controller instance 
    456             $theme = \Theme::forge($this->param(1)); 
     456            $theme = \ExiteCMS_Themes::forge($this->param(1)); 
    457457 
    458458            // start the remover 
     
    478478    { 
    479479        // get the available themes 
    480         $themes = \Theme::themes(); 
     480        $themes = \ExiteCMS_Themes::get(); 
    481481 
    482482        $found = $results = array(); 
  • trunk/modules/exitecms/classes/model/module.php

    r84 r89  
    2626     */ 
    2727    protected static $_has_many = array( 
    28         'moduleitem' => array( 
     28        'modulewidget' => array( 
    2929            'key_from' => 'id', 
    3030            'key_to' => 'module_id', 
  • trunk/modules/exitecms/classes/model/moduleplugin.php

    r84 r89  
    3636} 
    3737 
    38 /* End of file moduleitem.php */ 
     38/* End of file moduleplugin.php */ 
  • trunk/modules/exitecms/classes/model/modulewidget.php

    r58 r89  
    1515namespace Exitecms; 
    1616 
    17 class Model_ModuleItem extends \Orm\Model { 
     17class Model_ModuleWidget extends \Orm\Model { 
    1818 
    1919    /* 
    2020     * @var string  name of the table 
    2121     */ 
    22     protected static $_table_name = 'module_items'; 
     22    protected static $_table_name = 'module_widgets'; 
    2323 
    2424    /* 
     
    3636} 
    3737 
    38 /* End of file moduleitem.php */ 
     38/* End of file modulewidget.php */ 
  • trunk/modules/exitecms/classes/model/page.php

    r79 r89  
    3838     */ 
    3939    protected static $_has_one = array( 
    40         'theme_template' => array( 
     40        'themetemplate' => array( 
    4141            'model_to' => 'Exitecms\\Model_Themetemplate', 
    4242            'key_from' => 'theme_template_id', 
     
    5757     */ 
    5858    protected static $_has_many = array( 
    59         'page_section' => array( 
     59        'pagesection' => array( 
    6060            'model_to' => 'Exitecms\\Model_Pagesection', 
    6161            'key_from' => 'id', 
  • trunk/modules/exitecms/classes/model/pagesection.php

    r58 r89  
    3333     */ 
    3434    protected static $_has_one = array( 
    35         'moduleitem' => array( 
    36             'key_from' => 'module_item_id', 
     35        'modulewidget' => array( 
     36            'key_from' => 'module_widget_id', 
    3737            'key_to' => 'id', 
    3838            'cascade_save' => true, 
  • trunk/modules/exitecms/classes/model/site.php

    r79 r89  
    2121     */ 
    2222    protected static $_has_one = array( 
    23         'theme_template' => array( 
     23        'themetemplate' => array( 
    2424            'model_to' => 'Exitecms\\Model_Themetemplate', 
    2525            'key_from' => 'theme_template_id', 
  • trunk/modules/exitecms/classes/model/template.php

    r79 r89  
    2323        'site' => array( 
    2424            'key_from' => 'site_id', 
     25            'key_to' => 'id', 
     26            'cascade_save' => true, 
     27            'cascade_delete' => false, 
     28        ), 
     29    ); 
     30 
     31    /* 
     32     * @var array   belongs_to relations of this model 
     33     */ 
     34    protected static $_has_one = array( 
     35        'themetemplate' => array( 
     36            'model_to' => 'Exitecms\\Model_Themetemplate', 
     37            'key_from' => 'theme_template_id', 
    2538            'key_to' => 'id', 
    2639            'cascade_save' => true, 
  • trunk/modules/exitecms/classes/model/templatesection.php

    r58 r89  
    3333     */ 
    3434    protected static $_has_one = array( 
    35         'moduleitem' => array( 
    36             'key_from' => 'module_item_id', 
     35        'modulewidget' => array( 
     36            'key_from' => 'module_widget_id', 
    3737            'key_to' => 'id', 
    3838            'cascade_save' => true, 
  • trunk/modules/exitecms/lang/en/templates.php

    r73 r89  
    1111        'header' => 'Available templates', 
    1212        'actions' => 'Options', 
     13        'theme_template_id' => 'Theme template used', 
    1314        'name' => 'Name', 
    1415        'title' => 'Template title', 
     
    4142        'add' => array( 
    4243            'title' => 'Templates', 
    43             'form' => 'Add a new page to site ":site"', 
     44            'form' => 'Add a new page template to site ":site"', 
    4445            'info' => 'Use this form to add a new page template to your website.<br /> 
    4546                        Please enter the name of this template, a title so you can identify the template, 
     
    6667        'layout' => array( 
    6768            'title' => 'Templates', 
    68             'form' => 'Edit the page template definition', 
    69             'info' => 'Use this form to edit a page template.<br /> 
    70                         Please enter the name of this template, a title so you can identify the template, 
    71                         and optionally default page description and default meta keywords.', 
     69            'form'  => array( 
     70                '1' => 'Available widgets', 
     71                '2' => 'Theme ":theme", template ":template"', 
     72            ), 
     73            'info' => 'Use this form to edit the sections of a page template.<br /> 
     74                        Below you see the layout of the selected theme template, with the defined widget sections, 
     75                        the name of each section, and the widget count.<br /> 
     76                        At the left is the list of defined module widgets. Use drag-and-drop to add widgets 
     77                        to, or remove them from the template. Refer to the theme template documentation to make 
     78                        sure the widgets you select are of the correct type, and will fit in the space allocated 
     79                        on the template.', 
    7280            'success' => 'The website template layout has been updated.', 
    7381            'failure' => 'Error updating the website template layout.', 
     
    107115    'other' => array( 
    108116        'layout' => array( 
    109             'title' => 'Click to define the widgets for &quot;:desc&quot;', 
    110             'supported' => 'Supports elements of type:', 
    111             'count' => 'Number of elements assigned:', 
     117            'module' => 'Module', 
     118            'widgets' => 'widgets', 
     119            'totalcount' => ':count of :total', 
    112120        ), 
    113121    ), 
  • trunk/modules/exitecms/views/forms/datetime.php

    r79 r89  
    11<?php 
    22// load the edit view for the datetime form 
    3 echo \View::forge('forms/edit')->set($view_data, null, false); 
     3echo \View::forge('forms/edit')->set($__data, null, false); 
    44?> 
    55<table style="font-size:10px;"> 
  • trunk/modules/exitecms/views/forms/layout.php

    r79 r89  
    44 */ 
    55\Asset::js('jquery.tipTip.minified.js', array(), 'footer'); 
     6\Asset::js('jquery-ui-1.8.16.custom.min.js', array(), 'header'); 
    67 
    7 // closure to generate a table header 
    8 $generate_header = function($header) { 
    9     echo "\t", '<tr>', html_tag('th', $header['options'], $header['title']), "\t", '</tr>', "\n"; 
    10     $header['options']['class'] = 'spacer'; 
    11     echo "\t", '<tr>', html_tag('td', $header['options'], '&nbsp;'), "\t", '</tr>', "\n"; 
    12 }; 
     8echo ' 
     9<h3 class="title">',$title, '</h3> 
    1310 
    14 // display the widget header 
    15 if ( ! empty($title)) 
     11<fieldset> 
     12    <legend>', \Lang::get('global.information'), '</legend> 
     13    <div class="info">', $info, '</div> 
     14</fieldset> 
     15 
     16<table id="template_table"> 
     17    <tr> 
     18        <th>',$header['widgets'],'</th> 
     19        <th>',$header['layout'],'</th> 
     20    </tr> 
     21    <tr> 
     22        <td> 
     23            <div id="template_widgets">'; 
     24if ($widgets) 
    1625{ 
    17     echo '<h3 class="title">',$title, '</h3>', "\n"; 
    18 } 
    19  
    20 // display the widget info text 
    21 if ( ! empty($info)) 
    22 { 
    23     echo '<fieldset>', "\n"; 
    24     echo "\t", '<legend>', \Lang::get('global.information'), '</legend>', "\n"; 
    25     echo "\t", '<div class="info">', $info, '</div>', "\n"; 
    26     echo '</fieldset>', "\n"; 
    27 } 
    28  
    29 // generate the form table 
    30 echo '<table id="layouttable">',"\n"; 
    31  
    32 // add the table header 
    33 if ( ! empty($header)) 
    34 { 
    35     if (isset($header['title']) and isset($header['options'])) 
     26    foreach($widgets as $module) 
    3627    { 
    37         $generate_header($header); 
    38     } 
    39     else 
    40     { 
    41         $in_form_headers = true; 
    42         foreach($header as $headerline) 
     28        if ($module->modulewidget) 
    4329        { 
    44             if (empty($headerline['before']) and empty($headerline['after'])) 
     30            echo '<ul><li title="',$module->description,'">', \Lang::get('other.layout.module'), ': ', strtoupper($module->name),'<ul>'; 
     31            foreach($module->modulewidget as $widget) 
    4532            { 
    46                 $generate_header($headerline); 
     33                echo '<li id="layout_widget_', $widget->id, '" class="layout_widget" title="',$widget->description,'">', $widget->name,'</li>'; 
    4734            } 
     35            echo '</ul></li></ul>'; 
    4836        } 
    4937    } 
    5038} 
    51 echo '</table>',"\n"; 
    5239 
    53 echo '<div id="template_layout">', "\n"; 
    54 echo $layout; 
    55 echo '</div>', "\n"; 
     40 
     41echo '          </div> 
     42        </td> 
     43        <td> 
     44        <div id="template_layout"> 
     45            ',$layout,' 
     46        </div> 
     47        </td> 
     48    </tr> 
     49</table>'; 
    5650 
    5751// widget buttons 
     
    6256    echo \Form::hidden('form_id', $form_id); 
    6357    echo \Form::hidden(\Config::get('security.csrf_token_key', 'fuel_csrf_token'), \Security::fetch_token()); 
     58    echo \Form::hidden('section_div_name', ''); 
     59    echo \Form::hidden('section_sort_order', ''); 
    6460 
    6561    echo '<div style="text-align:center;margin:20px 0px;">',"\n"; 
     
    7470    echo \Form::close(); 
    7571} 
     72 
     73?> 
     74 
     75<!-- Layout definition scripts --> 
     76<script type="text/javascript"> 
     77$(function() { 
     78    $('#template_widgets').css('height', $('#template_layout').css('height')); 
     79    $('li[class="layout_widget"]').draggable({ 
     80        helper: 'clone', 
     81        revert: 'invalid' 
     82    }); 
     83    $('.layout_fieldset').droppable({ 
     84        accept: ':not(.ui-sortable-helper) :not(.layout_widget_selected)', 
     85        drop: function( event, ui ) { 
     86            $('<div></div>').html(ui.draggable.html()).attr('id', ui.draggable.attr('id')).addClass('layout_widget_selected').appendTo( $(this).find('div:first') ); 
     87            alert(ui.draggable.attr('id')); 
     88            alert($(this).find('div:first').attr('id')); 
     89        } 
     90    }).sortable({ 
     91        items: 'div', 
     92        placeholder: 'layout_widget_placeholder', 
     93        sort: function(e,ui){ 
     94            $(ui.placeholder).html('&nbsp;').css('width', '50px'); 
     95            $('#template_widgets').css('height', $('#template_layout').css('height')); 
     96        }, 
     97        update: function(e,ui){ 
     98            alert($(this).find('div:first').attr('id')); 
     99            var order = $('#test-list').sortable('serialize'); 
     100        } 
     101    }); 
     102 
     103    $('li[class="layout_widget_selected"]').draggable({ 
     104        revert: 'invalid' 
     105    }); 
     106 
     107    $('#template_widgets').droppable({ 
     108        accept: ':not(.ui-sortable-helper)  :not(.layout_widget)', 
     109        drop: function( event, ui ) { 
     110            ui.draggable.remove(); 
     111        } 
     112    }); 
     113}); 
     114</script> 
  • trunk/modules/exitecms/views/forms/layout_selector.php

    r79 r89  
     1<?php 
     2    $numbers = empty($total) ? $count : \Lang::get('other.layout.totalcount', array('count' => $count, 'total' => $total)); 
     3?> 
    14<div class="layout_background" style="height:100%;"> 
    2     <fieldset class="layout_fieldset" title="<?php echo \Lang::get('other.layout.title', array('desc' => $description));?>" onclick="location.href='<?php echo $url;?>';" <?php if(isset($height)) echo 'style="height:',$height,'px;"';?>> 
    3         <legend class="layout_legend"><?php echo strtoupper($name);?></legend> 
    4         <div class="layout_section"><?php echo \Lang::get('other.layout.supported');?><span class="layout_info"> <?php echo $type;?></span>.</div> 
    5         <div class="layout_section"><?php echo \Lang::get('other.layout.count');?><span class="layout_info"> <?php echo $count;?></span>.</div> 
     5    <fieldset class="layout_fieldset" <?php if(isset($height)) echo 'style="min-height:',$height,'px;"';?>> 
     6        <legend class="layout_legend"><?php echo strtoupper($name),': <span>',$numbers;?></span> <?php echo \Lang::get('other.layout.widgets');?></legend> 
     7        <div id="layout_section_<?php echo strtolower($name);?>" > 
     8            <?php 
     9            ksort($widgets); 
     10            foreach($widgets as $widget) 
     11            { 
     12                echo '<div id="layout_section_',$widget->id,'_',$widget->modulewidget->id,'" class="layout_widget_selected" title="', $widget->modulewidget->description, '">',$widget->order, '.&nbsp;', $widget->modulewidget->name,'</div> '; 
     13            } 
     14            ?> 
     15        </div> 
    616    </fieldset> 
    717</div> 
  • trunk/modules/exitecms/views/forms/linkset.php

    r79 r89  
    1414 
    1515// load the edit view for the linkset form 
    16 echo \View::forge('forms/edit')->set($view_data, null, false); 
     16echo \View::forge('forms/edit')->set($__data, null, false); 
    1717?> 
    1818<script type="text/javascript"> 
  • trunk/modules/linksets/classes/controller/module.php

    r79 r89  
    1717class Controller_Module extends \Exitecms_Module { 
    1818 
     19    /* 
     20     * Widget options method: select_linkset 
     21     * 
     22     * Prompt for the linkset to be displayed in this widget 
     23     * 
     24     * @param   integer id of the page_section record for which options are set 
     25     * @return  void 
     26     */ 
     27     protected function select_linkset($page_section_id) 
     28     { 
     29     } 
     30 
    1931} 
    2032/* End of file module.php */ 
  • trunk/modules/linksets/classes/controller/multi.php

    r79 r89  
    3030    public function router() 
    3131    { 
    32         // start the unordered list 
    33         $this->response->body = "\n<ul>"; 
    34  
    3532        // load the model 
    3633        $this->model = \Exitecms\Model_Link::forge(); 
     
    4340            if ($root = $this->model->tree_get_root()) 
    4441            { 
     42                // start the unordered list 
     43                $this->response->body = "\n<ul>"; 
     44 
    4545                $this->response->body .= $this->menu($root); 
    4646            } 
    4747        } 
     48 
     49        return $this->response; 
    4850    } 
    4951 
  • trunk/modules/linksets/classes/controller/single.php

    r79 r89  
    2525    public function router() 
    2626    { 
    27         // start the unordered list 
    28         $this->response->body = "\n<ul>\n"; 
    29  
    3027        // load the model 
    3128        $model = \Exitecms\Model_Link::forge(); 
     
    4037                if ($child = $root->tree_get_first_child($root)) 
    4138                { 
     39                    // start the unordered list 
     40                    $this->response->body = "\n<ul>\n"; 
     41 
    4242                    do 
    4343                    { 
     
    6868        // close the unordered list 
    6969        $this->response->body .= "</ul>\n"; 
     70 
     71        return $this->response; 
    7072    } 
    7173 
  • trunk/modules/linksets/config/info.php

    r84 r89  
    115115        'single' => array( 
    116116            'uri' => 'single/index', 
    117             'description' => 'Linkset widget, displays an unordered list' 
     117            'description' => 'Linkset widget, displays an unordered list', 
     118            'method' => 'select_linkset' 
    118119        ), 
    119120 
    120121        'multi' => array( 
    121122            'uri' => 'multi/index', 
    122             'description' => 'Linkset widget, displays an multi-level unordered list' 
     123            'description' => 'Linkset widget, displays an multi-level unordered list', 
     124            'method' => 'select_linkset' 
    123125        ), 
    124126    ), 
  • trunk/modules/phpinfo/classes/view/phpinfo.php

    r81 r89  
    2626                elseif(isset($match[3])) 
    2727                { 
    28                     $phpinfo[end(array_keys($phpinfo))][$match[2]] = isset($match[4]) ? array($match[3], $match[4]) : $match[3]; 
     28                    $keys = array_keys($phpinfo); 
     29                    $phpinfo[end($keys)][$match[2]] = isset($match[4]) ? array($match[3], $match[4]) : $match[3]; 
    2930                } 
    3031                else 
    3132                { 
    32                     $phpinfo[end(array_keys($phpinfo))][] = $match[2]; 
     33                    $keys = array_keys($phpinfo); 
     34                    $phpinfo[end($keys)][] = $match[2]; 
    3335                } 
    3436            } 
  • trunk/themes/theme_exitecms/assets/css/default.css

    r84 r89  
    11/* default layout specific */ 
     2 
     3#template_table { 
     4} 
     5 
     6#template_table td { 
     7    border: none; 
     8} 
     9 
     10#template_widgets { 
     11    color: #000; 
     12    background-color: #bbb; 
     13    background-image:none; 
     14    padding: 10px; 
     15    border: 1px solid #000; 
     16    width:250px; 
     17    overflow-x: hidden; 
     18    overflow-y: scroll; 
     19} 
     20 
     21#template_widgets ul { 
     22    background-color: #eee; 
     23    list-style: none; 
     24    padding: 5px; 
     25    margin: 0; 
     26    margin-bottom: 5px; 
     27} 
     28 
     29#template_widgets ul li { 
     30    padding: 0; 
     31    font-weight: bold; 
     32} 
     33 
     34#template_widgets ul ul li { 
     35    padding: 5px; 
     36    margin: 2px; 
     37} 
     38 
     39#template_widgets .layout_widget { 
     40    border: 1px solid #b6001e; 
     41    background-color: #ddd; 
     42    font-weight: normal; 
     43    cursor: pointer; 
     44} 
    245 
    346#template_layout { 
     
    750    font-size: 90%; 
    851    line-height: 150%; 
    9     margin: 5px; 
    1052    padding: 10px; 
    1153    border: 1px solid #000; 
     54    width:600px; 
    1255 } 
    1356 
     
    3275} 
    3376 
     77#template_layout .layout_legend span { 
     78    color: #b6001e; 
     79    font-weight:bold; 
     80} 
     81 
    3482#template_layout .layout_fieldset { 
    3583    color: #000; 
    3684    background-color: #eee; 
    37     padding:5px; 
    3885    margin:0px; 
    3986    border:1px solid #fff; 
     
    4390} 
    4491 
    45 #template_layout .layout_fieldset:hover { 
    46     color: #000; 
    47     background-color: #ccc; 
    48     cursor:pointer; 
    49     cursor:hand; 
    50     border:1px solid #ccc; 
    51     border-bottom: 1px solid #333; 
    52     border-right: 1px solid #333; 
    53 } 
    54  
    55 #template_layout .layout_info { 
    56     color: #b6001e; 
    57     font-weight:bold; 
     92#template_layout .layout_widget, .layout_widget_selected { 
     93    float: left; 
     94    border: 1px solid #b6001e; 
     95    background-color: #ddd; 
     96    font-weight: normal; 
     97    padding: 5px; 
     98    margin: 5px; 
     99    cursor: pointer; 
     100} 
     101 
     102#template_layout .layout_widget_placeholder { 
     103    float: left; 
     104    background-color: #b6001e; 
     105    border: 1px solid #b6001e; 
     106    font-weight: normal; 
     107    padding: 5px; 
     108    margin: 5px; 
    58109} 
    59110 
  • trunk/themes/theme_exitecms/config/default.php

    r72 r89  
    3333                'widget' => false, 
    3434            ), 
     35            'max' => 1, 
    3536            'layout' => array( 
    3637                'description' => 'Header navigation', 
     
    5253                'widget' => false, 
    5354            ), 
     55            'max' => 1, 
    5456            'layout' => array( 
    5557                'description' => 'Main menu navigation', 
  • trunk/themes/theme_exitecms/views/templates/default.php

    r84 r89  
    1313 
    1414        <!-- Grab Google CDNs jQuery, fall back if necessary --> 
    15         <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js"></script> 
    16         <script type="text/javascript">!window.jQuery && document.write('<script src="/themes/exitecms/js/jquery-1.4.4.min.js"><\/script>');</script> 
     15        <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script> 
     16        <script type="text/javascript">!window.jQuery && document.write('<script src="/themes/exitecms/js/jquery-1.6.2.min.js"><\/script>');</script> 
    1717 
    1818        <!-- Form onsubmit function to populate the form with the current crsf token --> 
     
    3030            <div id="inner"> 
    3131                <div id="header-nav"> 
    32                     <?php echo \Theme::instance()->widgets('header-nav'); ?> 
     32                    <?php echo \ExiteCMS_Themes::instance()->widgets('header-nav'); ?> 
    3333                </div> 
    3434                <div id="header"></div> 
    3535                <div id="main-nav"> 
    36                     <?php echo \Theme::instance()->widgets('main-nav'); ?> 
     36                    <?php echo \ExiteCMS_Themes::instance()->widgets('main-nav'); ?> 
    3737                </div> 
    3838                <div id="body"> 
    3939                    <div id="wrapper"> 
    40                         <?php if ( \Theme::instance()->has_widgets('messages') ) { ?> 
    41                             <?php if ( $output = \Theme::instance()->widgets('messages') ) { ?> 
     40                        <?php if ( \ExiteCMS_Themes::instance()->has_widgets('messages') ) { ?> 
     41                            <?php if ( $output = \ExiteCMS_Themes::instance()->widgets('messages') ) { ?> 
    4242                            <div id="messages"> 
    4343                                <?php echo $output; ?> 
     
    4545                            <?php } ?> 
    4646                        <?php } ?> 
    47                         <?php echo \Theme::instance()->widgets('body', false); ?> 
     47                        <?php echo \ExiteCMS_Themes::instance()->widgets('body', false); ?> 
    4848                        <div id="content"> 
    49                             <?php echo \Theme::instance()->widgets('content'); ?> 
     49                            <?php echo \ExiteCMS_Themes::instance()->widgets('content'); ?> 
    5050                        </div> 
    5151                    </div> 
Note: See TracChangeset for help on using the changeset viewer.