Plugin Directory

Changeset 1237087


Ignore:
Timestamp:
09/03/2015 10:35:26 AM (11 years ago)
Author:
AeonOfTime
Message:

Started implementing themes.

Location:
eve-shipinfo/trunk
Files:
4 added
7 edited

Legend:

Unmodified
Added
Removed
  • eve-shipinfo/trunk/classes/EVEShipInfo.php

    r1236586 r1237087  
    342342        $this->handle_initRewriteRules();
    343343        $this->handle_initShortcodes();
     344        $this->handle_initThemes();
    344345        $this->handle_initScripts();
     346    }
     347   
     348    public function getThemeID()
     349    {
     350        return $this->getOption('theme', 'Light');
     351    }
     352   
     353    public function setThemeID($id)
     354    {
     355        $this->setOption('theme', $id);
     356    }
     357   
     358    public function getThemeLabel()
     359    {
     360        $id = $this->getThemeID();
     361        return $this->themes[$id]['label'];
     362    }
     363   
     364   /**
     365    * Initializes the plugin's themes. A theme is only a single CSS file,
     366    * (for ex. ThemeLight.css) which extends the base CSS file,
     367    * EVEShipInfo.css, which handles the base elements structure.
     368    */
     369    protected function handle_initThemes()
     370    {
     371        $this->registerTheme(
     372            'Light',
     373            __('Light', 'EVEShipInfo'),
     374            __('A theme for light themed blogs.', 'EVEShipInfo')   
     375        );
     376
     377        $this->registerTheme(
     378            'Dark',
     379            __('Dark', 'EVEShipInfo'),
     380            __('A theme for dark themed blogs.', 'EVEShipInfo')
     381        );
     382    }
     383   
     384    protected $themes = array();
     385   
     386   /**
     387    * Registers a frontend theme CSS.
     388    *
     389    * @param string $id
     390    * @param string $label
     391    * @param string $description
     392    */
     393    protected function registerTheme($id, $label, $description)
     394    {
     395        $this->themes[$id] = array(
     396            'label' => $label,
     397            'description' => $description
     398        );
    345399    }
    346400   
     
    363417            add_shortcode($instance->getTagName(), array($instance, 'handle_call'));
    364418        }
     419    }
     420   
     421   /**
     422    * Retrieves the definitions for all available themes.
     423    * @return array
     424    */
     425    public function getThemes()
     426    {
     427        return $this->themes;
    365428    }
    366429   
     
    469532       
    470533        wp_register_style('eveshipinfo', $this->getScriptURL('EVEShipInfo.css'));
    471         wp_register_style('eveshipinfo_light', $this->getScriptURL('ThemeLight.css'), array('eveshipinfo'));
    472        
    473534        wp_enqueue_style('eveshipinfo');
    474         wp_enqueue_style('eveshipinfo_light');
     535       
     536        wp_register_style('eveshipinfo_theme', $this->getScriptURL('Theme'.$this->getThemeID().'.css'), array('eveshipinfo'));
     537        wp_enqueue_style('eveshipinfo_theme');
    475538    }
    476539   
     
    612675        );
    613676       
    614         add_submenu_page(
    615             'eveshipinfo',
    616             __('Dashboard', 'EVEShipInfo'),
    617             __('Dashboard', 'EVEShipInfo'),
    618             'edit_posts',
    619             'eveshipinfo',
    620             array($this, 'handle_displayMainPage')
     677        $submenuPages = array(
     678            array(
     679                'navTitle' => __('Dashboard', 'EVEShipInfo'),
     680                'name' => 'eveshipinfo',
     681                'callback' => array($this, 'handle_displayMainPage')
     682            ),
     683            array(
     684                'navTitle' => __('Themes', 'EVEShipInfo'),
     685                'name' => 'eveshipinfo_themes',
     686                'callback' => array($this, 'handle_displayThemesPage')
     687            ),
     688            array(
     689                'navTitle' => __('Shortcodes', 'EVEShipInfo'),
     690                'name' => 'eveshipinfo_shortcodes',
     691                'callback' => array($this, 'handle_displayShortcodesPage')
     692            ),
     693            array(
     694                'navTitle' => __('EFT import', 'EVEShipInfo'),
     695                'name' => 'eveshipinfo_eftimport',
     696                'callback' => array($this, 'handle_displayEFTImportPage')
     697            ),
     698            array(
     699                'navTitle' => __('EFT fittings', 'EVEShipInfo'),
     700                'name' => 'eveshipinfo_eftfittings',
     701                'callback' => array($this, 'handle_displayEFTFittingsPage')
     702            ),
     703            array(
     704                'navTitle' => __('Database', 'EVEShipInfo'),
     705                'name' => 'eveshipinfo_database',
     706                'callback' => array($this, 'handle_displayDatabasePage')
     707            ),
     708            /*array(
     709                'navTitle' => __('Help', 'EVEShipInfo'),
     710                'name' => 'eveshipinfo_help',
     711                'callback' => array($this, 'handle_displayHelpPage')
     712            ),*/
    621713        );
    622        
    623         add_submenu_page(
    624             'eveshipinfo',
    625             __('Help and Documentation', 'EVEShipInfo'),
    626             __('Help', 'EVEShipInfo'),
    627             'edit_posts',
    628             'eveshipinfo_help',
    629             array($this, 'handle_displayHelpPage')
    630         );
    631        
    632         add_submenu_page(
    633             'eveshipinfo',
    634             __('Database reference', 'EVEShipInfo'),
    635             __('Database', 'EVEShipInfo'),
    636             'edit_posts',
    637             'eveshipinfo_database',
    638             array($this, 'handle_displayDatabasePage')
    639         );
    640        
    641         add_submenu_page(
    642             'eveshipinfo',
    643             __('Shortcodes reference', 'EVEShipInfo'),
    644             __('Shortcodes', 'EVEShipInfo'),
    645             'edit_posts',
    646             'eveshipinfo_shortcodes',
    647             array($this, 'handle_displayShortcodesPage')
    648         );
    649 
    650         add_submenu_page(
    651         'eveshipinfo',
    652             __('EFT import', 'EVEShipInfo'),
    653             __('EFT import', 'EVEShipInfo'),
    654             'edit_posts',
    655             'eveshipinfo_eftimport',
    656             array($this, 'handle_displayEFTImportPage')
    657         );
    658          
    659         $eft = $this->createEFTManager();
    660         add_submenu_page(
    661             'eveshipinfo',
    662             __('EFT fittings', 'EVEShipInfo'),
    663             __('EFT fittings', 'EVEShipInfo'),
    664             'edit_posts',
    665             'eveshipinfo_eftfittings',
    666             array($this, 'handle_displayEFTFittingsPage')
    667         );
     714     
     715        foreach($submenuPages as $page) {
     716            add_submenu_page(
     717                'eveshipinfo',
     718                $page['navTitle'],
     719                $page['navTitle'],
     720                'edit_posts',
     721                $page['name'],
     722                $page['callback']
     723            );
     724        }
    668725    }
    669726   
     
    675732    }
    676733
     734    public function handle_displayThemesPage()
     735    {
     736        $this->handle_displayMainPage('Themes');
     737    }
     738   
    677739    public function handle_displayShortcodesPage()
    678740    {
  • eve-shipinfo/trunk/classes/EVEShipInfo/Admin/Page/Main.php

    r1236586 r1237087  
    77        $tabs = array(
    88            'Dashboard' => __('Dashboard', 'EVEShipInfo'),
    9             'Help' => __('Help', 'EVEShipInfo'),
    10             'Database' => __('Database reference', 'EVEShipInfo'),
     9            'Themes' => __('Themes', 'EVEShipInfo'),
    1110            'Shortcodes' => __('Shortcordes reference', 'EVEShipInfo'),
    1211            'EFTImport' => __('EFT import', 'EVEShipInfo'),
    13             'EFTFittings' => __('EFT fittings', 'EVEShipInfo')
    14         );
     12            'EFTFittings' => __('EFT fittings', 'EVEShipInfo'),
     13            'Database' => __('Database reference', 'EVEShipInfo'),
     14            //'Help' => __('Help', 'EVEhipInfo')
     15        );
    1516       
    1617        return $tabs;
  • eve-shipinfo/trunk/classes/EVEShipInfo/Admin/UI/Form/Element/RadioGroup.php

    r1236586 r1237087  
    2525        }
    2626           
    27         return implode('<br/>', $items);
     27        return implode('', $items);
    2828    }
    2929}
     
    6060
    6161        return
    62         '<label>'.
     62        '<label class="radio-group-item">'.
    6363            '<input'.$this->element->getPlugin()->compileAttributes($atts).'/> '.
    6464            $this->label.
  • eve-shipinfo/trunk/classes/EVEShipInfo/Admin/UI/Icon.php

    r1236586 r1237087  
    2323        'PROTECT' => 'lock',
    2424        'UNPROTECT' => 'unlock',
    25         'LIST_VIEW' => 'list-view'
     25        'LIST_VIEW' => 'list-view',
     26        'THEME' => 'admin-appearance'
    2627    );
    2728
     
    4344    }
    4445
     46    public function theme() { return $this->setType('THEME'); }
    4547    public function listView() { return $this->setType('LIST_VIEW'); }
    4648    public function add() { return $this->setType('ADD'); }
  • eve-shipinfo/trunk/css/ThemeLight.css

    r1081848 r1237087  
    9696
    9797.shipinfo-fittingbox{
     98font-family:'Rajdhani', sans-serif;
    9899position:relative;
    99100margin:6px 0 28px 0;
     
    101102padding:6px;
    102103border:solid 1px #ccc;
    103 border-radius:4px;
     104background:#fff;
    104105}
    105106
    106107.shipinfo-fittingbox-header{
    107 font-size:16px;
    108108line-height:20px;
    109109margin-bottom:6px;
     110padding:4px 0;
    110111}
    111112
     
    116117}
    117118
     119.shipinfo-fittingbox-fitname{
     120font-size:22px;
     121font-weight:600;
     122}
     123
     124.shipinfo-fittingbox .shipinfo-dismiss{
     125margin-top:-7px;
     126}
     127
    118128.shipinfo-fittingbox-shipname{
    119129float:right;
    120130font-style:italic;
    121131margin-right:4px;
     132font-size:16px;
    122133}
    123134
     
    125136margin:6px 0 0 0;
    126137}
    127 
    128 .shipinfo-fittingbox-closer{
    129 position:absolute;
    130 top:-10px;
    131 right:-10px;
    132 border-radius:16px;
    133 background:#ccc;
    134 color:#fff;
    135 border:solid 2px #aaa;
    136 font-family:monospace;
    137 font-size:14px;
    138 overflow:hidden;
    139 line-height:14px;
    140 padding:0 2px;
    141 cursor:pointer;
    142 }
    143 
    144 .shipinfo-fittingbox-closer:hover{
    145 color:#666;
    146 background:#fafafa;
    147 }
  • eve-shipinfo/trunk/css/admin.css

    r1236586 r1237087  
    115115margin-right:10px;
    116116}
     117
     118.radio-group-item{
     119display:block;
     120margin-bottom:8px;
     121}
  • eve-shipinfo/trunk/js/EVEShipInfo/Fitting.js

    r1236586 r1237087  
    2727    this.rendered = false;
    2828   
     29    this.ElementID = function(part)
     30    {
     31        return this.jsID+'_'+part;
     32    };
     33   
     34    this.Element = function(part)
     35    {
     36        return jQuery('#'+this.ElementID(part));
     37    };
     38
    2939    this.Show = function()
    3040    {
     
    4454                '<div class="shipinfo-fittingbox-wrap">'+
    4555                    '<div class="shipinfo-fittingbox-header">'+
    46                         this.name+' '+
     56                        '<span class="shipinfo-fittingbox-fitname">'+
     57                            this.name+' '+
     58                        '</span>'+
     59                        ' '+
    4760                        '<span class="shipinfo-fittingbox-shipname">'+
    4861                            '<a href="javascript:void(0)" class="shipinfo-shiplink" onclick="EVEShipInfo.InfoPopup(\''+this.ship.id+'\')">'+
     
    5063                            '</a>'+
    5164                        '</span>'+
    52                         '<span class="shipinfo-fittingbox-closer" onclick="fobj'+this.linkID+'.Hide()">x</span>'+
    5365                    '</div>'+
    5466                    '<div class="shipinfo-fittingbox-content">'+
     
    5668                    '</div>'+
    5769                    '<div class="shipinfo-fittingbox-toolbar">'+
    58                         '<a href="javascript:void(0)" onclick="jQuery(\'#'+this.jsID+'-praisalform\').submit()">EVEPraisal</a>'+
     70                        '<div class="shipinfo-dismiss" id="'+this.ElementID('dismiss')+'">&times;</div>'+
     71                        '<a href="javascript:void(0)" onclick="jQuery(\'#'+this.ElementID('praisalform')+'\').submit()">EVEPraisal</a>'+
    5972                    '</div>'+
    6073                    '<div style="display:none">'+
    61                         '<form action="http://evepraisal.com/estimate" method="post" target="_blank" id="'+this.jsID+'-praisalform">'+
     74                        '<form action="http://evepraisal.com/estimate" method="post" target="_blank" id="'+this.ElementID('praisalform')+'">'+
    6275                            '<input type="hidden" name="raw_paste" value="'+this.ExportTextonly()+'"/>'+
    6376                            '<input type="hidden" name="hide_buttons" value="false"/>'+
     
    7285            link.after(html);
    7386            this.rendered = true;
     87           
     88            var fit = this;
     89            this.Element('dismiss').on('click', function() {
     90                fit.Hide();
     91            });
    7492        } else {
    7593            jQuery('#'+this.jsID).show();
Note: See TracChangeset for help on using the changeset viewer.