Changeset 2878

Show
Ignore:
Timestamp:
11/25/08 06:22:49 (6 weeks ago)
Author:
MattRead
Message:

branch:adminhandler organize adminpage things and use actions

Location:
branches/adminhandler/htdocs
Files:
1 added
2 modified
17 moved

Legend:

Unmodified
Added
Removed
  • branches/adminhandler/htdocs/index.php

    r2852 r2878  
    7474    if( empty($files) ) { 
    7575        $files = array(); 
    76         $dirs= array( HABARI_PATH . '/system', HABARI_PATH . '/user' ); 
     76        $dirs= array( HABARI_PATH . '/system', HABARI_PATH . '/system/admin', HABARI_PATH . '/user' ); 
    7777 
    7878        // For each directory, save the available files in the $files array. 
  • branches/adminhandler/htdocs/system/admin/classes/adminpage.php

  • branches/adminhandler/htdocs/system/admin/classes/commentadminpage.php

    r2870 r2878  
    33class CommentAdminPage extends AdminPage 
    44{ 
    5     public function act_request_get($update = FALSE) { 
     5    public function act_request_get($update = FALSE) 
     6    { 
    67        if ( isset( $this->handler_vars['id'] ) && $comment = Comment::get( $this->handler_vars['id'] ) ) { 
    78            $this->theme->comment = $comment; 
     
    6768    } 
    6869 
    69     public function act_request_post() { 
     70    public function act_request_post() 
     71    { 
    7072        $this->act_request_get(true); 
    7173    } 
    7274     
    73         public function ajax_update_comment( $handler_vars ) 
     75    public function act_ajax_update_comment( $handler_vars ) 
    7476    { 
    7577        // check WSSE authentication 
  • branches/adminhandler/htdocs/system/admin/classes/commentsadminpage.php

  • branches/adminhandler/htdocs/system/admin/classes/dashboardadminpage.php

  • branches/adminhandler/htdocs/system/admin/classes/groupadminpage.php

  • branches/adminhandler/htdocs/system/admin/classes/groupsadminpage.php

  • branches/adminhandler/htdocs/system/admin/classes/importadminpage.php

  • branches/adminhandler/htdocs/system/admin/classes/logsadminpage.php

  • branches/adminhandler/htdocs/system/admin/classes/mediaadminpage.php

  • branches/adminhandler/htdocs/system/admin/classes/optionsadminpage.php

    r2870 r2878  
    44{ 
    55    /** 
    6      * Handles get requests from the options admin page 
     6     * Handles get requests from the options admin page. 
     7     * Send all POST request to GET so FormUI can proccess them. 
    78     */ 
    89    public function act_request_post() 
     
    158159     * @param FormUI $form The successfully submitted form 
    159160     */ 
    160     public function form_options_success($form) 
     161    public function form_options_success( FormUI $form ) 
    161162    { 
    162163        $wsse = Utils::WSSE( $form->nonce->value, $form->timestamp->value ); 
     
    165166            $form->save(); 
    166167        } 
    167         Session::error( _t('WSSE Authentication Failed') ); 
     168        else { 
     169            Session::error( _t('WSSE authentication failed. Could not update options.') ); 
     170        } 
    168171    } 
    169172} 
  • branches/adminhandler/htdocs/system/admin/classes/pluginsadminpage.php

  • branches/adminhandler/htdocs/system/admin/classes/postsadminpage.php

  • branches/adminhandler/htdocs/system/admin/classes/publishadminpage.php

  • branches/adminhandler/htdocs/system/admin/classes/tagsadminpage.php

  • branches/adminhandler/htdocs/system/admin/classes/themesadminpage.php

  • branches/adminhandler/htdocs/system/admin/classes/useradminpage.php

  • branches/adminhandler/htdocs/system/admin/classes/usersadminpage.php

  • branches/adminhandler/htdocs/system/classes/adminhandler.php

    r2872 r2878  
    7070    public function act_admin() 
    7171    { 
    72         $page = ( isset( $this->handler_vars['page'] ) && !empty( $this->handler_vars['page'] ) ) ? $this->handler_vars['page'] : 'dashboard'; 
    73         $type = ( isset( $this->handler_vars['content_type'] ) && !empty( $this->handler_vars['content_type'] ) ) ? $this->handler_vars['content_type'] : ''; 
    74         $theme_dir = Plugins::filter( 'admin_theme_dir', Site::get_dir( 'admin_theme', TRUE ) ); 
    75         $this->theme = Themes::create( 'admin', 'RawPHPEngine', $theme_dir ); 
    76  
    77         // Add some default stylesheets 
    78         Stack::add('admin_stylesheet', array(Site::get_url('admin_theme') . '/css/admin.css', 'screen'), 'admin'); 
    79  
    80         // Add some default template variables 
    81         $this->set_admin_template_vars( $this->theme ); 
    82         $this->theme->admin_type = $type; 
    83         $this->theme->admin_page = $page; 
    84         $this->theme->page = $page; 
    85         $this->theme->admin_title = ucwords($page) . ( $type != '' ? ' ' . ucwords($type) : '' ); 
     72        $page = ( !empty($this->handler_vars['page']) ) ? $this->handler_vars['page'] : 'dashboard'; 
     73        $this->theme = $this->get_admin_theme($page); 
    8674         
    8775        $request_method = strtolower($_SERVER['REQUEST_METHOD']); 
    8876        $admin_page = $page . 'AdminPage'; 
    8977        Plugins::act("admin_theme_{$request_method}_{$page}", $this, $this->theme); 
     78         
    9079        if ( class_exists($admin_page) ) { 
    9180            $admin_page = new $admin_page( $request_method, $this, $this->theme ); 
     
    117106            _e('Page Not Found'); 
    118107        } 
     108    } 
     109     
     110    protected function get_admin_theme( $page ) 
     111    { 
     112        $type = ( isset( $this->handler_vars['content_type'] ) && !empty( $this->handler_vars['content_type'] ) ) ? $this->handler_vars['content_type'] : ''; 
     113        $theme_dir = Plugins::filter( 'admin_theme_dir', Site::get_dir( 'admin_theme', TRUE ) ); 
     114        $theme = Themes::create( 'admin', 'RawPHPEngine', $theme_dir ); 
     115 
     116        // Add some default stylesheets 
     117        Stack::add('admin_stylesheet', array(Site::get_url('admin_theme') . '/css/admin.css', 'screen'), 'admin'); 
     118 
     119        // Add some default template variables 
     120        $this->get_main_menu( $theme ); 
     121        $theme->admin_type = $type; 
     122        $theme->admin_page = $page; 
     123        $theme->page = $page; 
     124        $theme->admin_title = ucwords($page) . ( $type != '' ? ' ' . ucwords($type) : '' ); 
     125         
     126        return $theme; 
    119127    } 
    120128 
     
    216224 
    217225    /** 
    218      * Assigns the main menu to $mainmenu into the theme. 
    219         */ 
    220     protected function set_admin_template_vars( $theme ) 
    221     { 
    222         $this->get_main_menu( $theme ); 
    223     } 
    224  
    225     /** 
    226226     * Setup the default admin javascript stack here so that it can be called 
    227227     * from plugins, etc. This is not an ideal solution, but works for now. 
     
    229229     */ 
    230230    public static function setup_stacks() { 
    231         Stack::add( 'admin_header_javascript', Site::get_url('scripts') . "/jquery.js" ); 
    232         Stack::add( 'admin_header_javascript', Site::get_url('scripts') . "/ui.core.js" ); 
    233         Stack::add( 'admin_header_javascript', Site::get_url('scripts') . "/ui.slider.js" ); 
    234         Stack::add( 'admin_header_javascript', Site::get_url('scripts') . "/ui.tabs.js" ); 
    235         Stack::add( 'admin_header_javascript', Site::get_url('scripts') . "/ui.sortable.js" ); 
    236         Stack::add( 'admin_header_javascript', Site::get_url('scripts') . "/ui.resizable.js" ); 
    237         Stack::add( 'admin_header_javascript', Site::get_url('scripts') . "/jquery.spinner.js" ); 
    238         Stack::add( 'admin_header_javascript', Site::get_url('scripts') . "/jquery.color.js" ); 
    239         Stack::add( 'admin_header_javascript', Site::get_url('habari') . "/3rdparty/humanmsg/humanmsg.js" ); 
    240         Stack::add( 'admin_header_javascript', Site::get_url('habari') . "/3rdparty/hotkeys/jquery.hotkeys.js" ); 
    241         Stack::add( 'admin_header_javascript', Site::get_url('admin_theme') . "/js/media.js" ); 
    242         Stack::add( 'admin_header_javascript', Site::get_url('admin_theme') . "/js/admin.js" ); 
     231        Stack::add( 'admin_header_javascript', Site::get_url('scripts') . "/jquery.js", 'jquery' ); 
     232        Stack::add( 'admin_header_javascript', Site::get_url('scripts') . "/ui.core.js", 'ui.core', 'jquery' ); 
     233        Stack::add( 'admin_header_javascript', Site::get_url('scripts') . "/ui.slider.js", 'ui.slider', array('jquery', 'ui.core') ); 
     234        Stack::add( 'admin_header_javascript', Site::get_url('scripts') . "/ui.tabs.js", 'ui.tabs', array('jquery', 'ui.core') ); 
     235        Stack::add( 'admin_header_javascript', Site::get_url('scripts') . "/ui.sortable.js", 'ui.sortable', array('jquery', 'ui.core') ); 
     236        Stack::add( 'admin_header_javascript', Site::get_url('scripts') . "/ui.resizable.js", 'ui.resizable', array('jquery', 'ui.core') ); 
     237        Stack::add( 'admin_header_javascript', Site::get_url('scripts') . "/jquery.spinner.js", 'jquery.spinner', 'jquery' ); 
     238        Stack::add( 'admin_header_javascript', Site::get_url('scripts') . "/jquery.color.js", 'jquery.color', 'jquery' ); 
     239        Stack::add( 'admin_header_javascript', Site::get_url('habari') . "/3rdparty/humanmsg/humanmsg.js", 'humanmsg', 'jquery' ); 
     240        Stack::add( 'admin_header_javascript', Site::get_url('habari') . "/3rdparty/hotkeys/jquery.hotkeys.js", 'jquery.hotkeys', 'jquery' ); 
     241        Stack::add( 'admin_header_javascript', Site::get_url('admin_theme') . "/js/media.js", 'media', 'jquery' ); 
     242        Stack::add( 'admin_header_javascript', Site::get_url('admin_theme') . "/js/admin.js", 'admin', 'jquery' ); 
    243243    } 
    244244}