Ignore:
Timestamp:
Dec 8, 2012, 2:53:06 AM (11 years ago)
Author:
julien1311
Message:

new options : position and opacity

Location:
extensions/Media_Icon/admin
Files:
3 added
1 edited
1 moved

Legend:

Unmodified
Added
Removed
  • extensions/Media_Icon/admin/admin.php

    r19284 r19324  
    22//Chech whether we are indeed included by Piwigo.
    33if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
     4
     5//Load globals
     6global $conf, $page;
     7
     8//Library for tabs
     9include_once(PHPWG_ROOT_PATH .'admin/include/tabsheet.class.php');
    410
    511//Load translation files
     
    915check_status(ACCESS_ADMINISTRATOR);
    1016
    11 $conf_media_icon = $conf['media_icon'];
    12 $conf_media_icon_unserialize = unserialize($conf['media_icon']);
     17//Initialization
     18$my_base_url = get_admin_plugin_menu_link(__FILE__);
    1319
    14 //Save config
    15 if (isset($_POST['submit'])) {
    16         //New parameters
    17         $conf_media_icon_unserialize['style'] = $_POST['style'];
    18        
    19         //Save
    20         conf_update_param('media_icon', serialize($conf_media_icon_unserialize));
    21         array_push($page['infos'], l10n('Information data registered in database'));
     20//Tab management
     21if (!isset($_GET['tab']))
     22    $page['tab'] = 'general';
     23else
     24    $page['tab'] = $_GET['tab'];
     25
     26$tabsheet = new tabsheet();
     27$tabsheet->add('general',
     28               l10n('General'),
     29               $my_base_url.'&tab=general');
     30$tabsheet->add('advanced',
     31               l10n('Advanced options'),
     32               $my_base_url.'&tab=advanced');
     33$tabsheet->select($page['tab']);
     34$tabsheet->assign();
     35
     36switch ($page['tab']) {
     37        case 'advanced':
     38                include_once(dirname(__FILE__).'/admin_advanced.php');
     39                break;
     40        default:
     41                include_once(dirname(__FILE__).'/admin_general.php');
     42                break;
    2243}
    23 
    24 //Parameters of the template
    25         $template->assign('MEDIA_ICON_STYLE_LOGO_SELECTED', ($conf_media_icon_unserialize['style'] == 'logo') ? 'selected="selected"' : null);
    26         $template->assign('MEDIA_ICON_STYLE_PHOTO_SELECTED', ($conf_media_icon_unserialize['style'] == 'photo') ? 'selected="selected"' : null);
    27         $template->assign('MEDIA_ICON_STYLE_FOLDER_SELECTED', ($conf_media_icon_unserialize['style'] == 'folder') ? 'selected="selected"' : null);
    28         $template->assign('MEDIA_ICON_STYLE_FOLDERCOLOR_SELECTED', ($conf_media_icon_unserialize['style'] == 'foldercolor') ? 'selected="selected"' : null);
    29        
    30 //Fetch the template.
    31 global $template;
    32 
    33 //add a stylesheet
    34 $template->append('head_elements', '<link rel="stylesheet" type="text/css" href="'.MEDIA_ICON_PATH.'template/'.$conf_media_icon_unserialize['style'].'_media_icon.css">');
    35        
    36 //Add our template to the global template
    37 $template->set_filenames(
    38         array(
    39                 'plugin_admin_content' => dirname(__FILE__).'/admin.tpl'
    40         )   
    41 );
    42  
    43 //Assign the template contents to ADMIN_CONTENT
    44 $template->assign_var_from_handle('ADMIN_CONTENT', 'plugin_admin_content');
    4544?>
  • extensions/Media_Icon/admin/admin_general.tpl

    r19284 r19324  
    11{html_head}{literal}
    22<style type="text/css">
    3   div.media_icon_admin_element {
    4     width:20%;
    5     font-weight:normal;
    6         float: left;
    7   }
    8   .properties p {
    9         font-weight: normal;
    10         text-align: center;
    11         margin-top: 1em;
    12   }
     3        div.media_icon_admin_element {
     4                width: 20%;
     5                font-weight: bold;
     6                float: left;
     7                margin: 1,5em 1,5em;
     8        }
    139 
    14   .media_icon_important {
    15         font-weight: bold;
    16   }
     10        .properties label {
     11                font-weight: bold;
     12                text-align: center;
     13        }
     14
     15        .properties p {
     16                font-weight: normal;
     17                margin-top: 1em;
     18                text-align: center;
     19        }
     20
     21        .media_icon_important {
     22                font-weight: bold;
     23        }
    1724</style>
    1825{/literal}{/html_head}
     
    2936        </p>
    3037        <p>     
    31                 <select id="media_icon_select" name="style">
    32                         <option value="logo" {$MEDIA_ICON_STYLE_LOGO_SELECTED}>{'Logo'|@translate}</option>
    33                         <option value="photo" {$MEDIA_ICON_STYLE_PHOTO_SELECTED}>{'Photo'|@translate}</option>
    34                         <option value="folder" {$MEDIA_ICON_STYLE_FOLDER_SELECTED}>{'Folder'|@translate}</option>
    35                         <option value="foldercolor" {$MEDIA_ICON_STYLE_FOLDERCOLOR_SELECTED}>{'Folder color'|@translate}</option>
     38                <select id="media_icon_select" name="media_icon_style">
     39                        <option value="logo"{if $media_icon_style.logo} selected="selected"{/if}>{'Logo'|@translate}</option>
     40                        <option value="photo"{if $media_icon_style.photo} selected="selected"{/if}>{'Photo'|@translate}</option>
     41                        <option value="folder"{if $media_icon_style.folder} selected="selected"{/if}>{'Folder'|@translate}</option>
     42                        <option value="foldercolor"{if $media_icon_style.foldercolor} selected="selected"{/if}>{'Folder color'|@translate}</option>
    3643                </select>
    3744        </p>
     
    4451<fieldset>
    4552        <legend>{'Result'|@translate}</legend>
    46         <div class="media_icon_admin_element">{'Youtube videos'|@translate} <span class="media_icon_admin_youtube"></span></div>
     53        <div class="media_icon_admin_element">{'Youtube videos'|@translate}<span class="media_icon_admin_youtube"></span></div>
    4754        <div class="media_icon_admin_element">{'Vimeo videos'|@translate} <span class="media_icon_admin_vimeo"></span></div>
    4855        <div class="media_icon_admin_element">{'Dailymotion videos'|@translate} <span class="media_icon_admin_dailymotion"></span></div>
Note: See TracChangeset for help on using the changeset viewer.