Changeset 3507


Ignore:
Timestamp:
Jul 3, 2009, 5:42:14 PM (15 years ago)
Author:
flop25
Message:

add the managment of style !

Location:
extensions/music_player
Files:
22 added
1 deleted
8 edited

Legend:

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

    r3329 r3507  
    66global $conf, $template, $lang, $page;
    77global $prefixeTable;
    8 //include(get_language_filepath('plugin.lang.php', $m_p->plugin_path));
    9         load_language('plugin.lang', $m_p->plugin_path);
     8load_language('plugin.lang', $m_p->plugin_path);
    109
    1110$page['infos'] = array();
    1211
    13 /*$template->assign_vars(
    14   array(
    15     'PLUGIN_PATH' => $m_p->plugin_path
    16     )); */
    1712$template->assign(array(
    1813        'PLUGIN_PATH'                   => $m_p->plugin_path,
     
    371366
    372367////envoi
     368if (isset($_POST['envoi_config']) ){
    373369if ($_POST['envoi_config']=='lecteur')
    374370{
     
    387383      $_POST['mp_autostart'],
    388384      $_POST['mp_autoscroll'],
     385      $_POST['style'],
     386      $_POST['various_style'],
    389387    );
    390388  }
     
    402400      $_POST['mp_autostart'],
    403401      $_POST['mp_autoscroll'],
     402      $_POST['style'],
     403      $_POST['various_style'],
    404404    );
    405405  }   
     
    414414//  $mp_msgs[] = $lang['mp_msg_admin_5'];
    415415array_push($page['infos'], l10n('mp_msg_admin_5'));
    416 }
     416}}
    417417if (isset($_POST['envoi_config']) ){
    418418if ($_POST['envoi_config']=='plugin' or isset($_POST['foot']))
     
    442442if ($conf_lecteur[6]=='true') $repeat=$check;
    443443if ($conf_lecteur[8]=='true') $autoscroll=$check;
     444if ($conf_lecteur[10]=='true') $various_style=$check;
    444445
    445446if ($conf_lecteur[7]!='0')
    446447{
    447 $rep = pwg_query('SELECT texte FROM '.MP_PLAYLIST.' WHERE id IN (\''.$conf_lecteur[7].'\') ;');
    448 $pl = mysql_fetch_array($rep);
    449 $txt=$pl['texte'];
     448        $rep = pwg_query('SELECT texte FROM '.MP_PLAYLIST.' WHERE id IN (\''.$conf_lecteur[7].'\') ;');
     449        $pl = mysql_fetch_array($rep);
     450        $txt=$pl['texte'];
    450451}
    451452else {$txt="Defaut"; }
     
    454455if ($conf_plugin[1]=='true') $head=$check;
    455456if ($conf_plugin[2]=='true') $foot=$check;
     457
     458////////////////////////////////////////////////
     459////////[ liste des styles globaux //////////
     460////////////////////////////////////////////////
     461        $fichier = array();
     462        $dir = opendir('./plugins/music_player/template/style'); //ouvre le repertoire courant désigné par la variable
     463     while(false!==($file = readdir($dir))){ //on lit tout et on récupere tout les dossiers dans $folder
     464   
     465     if(!in_array($file, array('.','..'))){ //on eleve le parent et le courant '. et ..'
     466          if(is_file($file)) { continue; }
     467          $page = $file; //sort l'extension du fichier
     468      $page = explode('.', $page);
     469      $nb = count($page);
     470      $nom_fichier = $page[0];
     471      for ($i = 1; $i < $nb-1; $i++){
     472       $nom_fichier .= '.'.$page[$i];
     473      }
     474      if(isset($page[1])){
     475       $ext_fichier = $page[$nb-1];
     476      }
     477      else {
     478       $ext_fichier = '';
     479      }
     480   
     481      if($ext_fichier == 'css') { //On ne prend que les css
     482       array_push($fichier, $file);
     483      }
     484         }//fin if in array
     485     }//while
     486    natcasesort($fichier); //la fonction natcasesort( ) est la fonction de tri standard sauf qu'elle ignore la casse
     487   
     488       
     489        foreach($fichier as $file) {
     490                if ($conf_lecteur[9]==$file)
     491                {
     492                       
     493                        $template->append('list_style',
     494                                array('FILE' => $file,
     495                                          'TEXTE' => '->'.$file,
     496                                          ));
     497                }
     498                else
     499                {
     500                        $template->append('list_style',
     501                        array('FILE' => $file,
     502                                  'TEXTE' => $file,
     503                                  ));
     504                }
     505        }
     506
     507
    456508////assignement des valeurs
    457509$template->assign(
     
    473525      'AUTOSTART_T' => $txt,
    474526      'MP_AUTOSCROLL_ACTIVATED' => $autoscroll,
     527      'MP_VARIOUS_STYLE' => $various_style,
    475528    )
    476529  );
  • extensions/music_player/class.inc.php

    r3500 r3507  
    3737         if (isset($conf_plugin)) {
    3838                $template->concat( 'PLUGIN_INDEX_ACTIONS',
    39                   '<li><a href="javascript:void(0)" onClick="window.open(\''.get_root_url().'plugins/'.$this->plugin_name.'/lecteur.php\',\'musique\',\'width='.$conf_plugin[4].',height='.$conf_plugin[3].',top=400,left=400,menubar=no,resizable=yes,toolbar=no,status=no,alwaysRaised=yes\')" ><img src="'.get_root_url().'plugins/'.$this->plugin_name.'/template/icon/icon32.png" alt="Music Player" title="Play Music" class="button" /></a></li>');
     39                  '<li><a href="javascript:void(0)" onClick="window.open(\''.get_root_url().'plugins/'.$this->plugin_name.'/lecteur.php\',\'musique\',\'width='.$conf_plugin[4].',height='.$conf_plugin[3].',top=400,left=400,toolbar=no,location=no,menubar=no,resizable=yes,status=no,alwaysRaised=yes\')" ><img src="'.get_root_url().'plugins/'.$this->plugin_name.'/template/icon/icon32.png" alt="Music Player" title="Play Music" class="button" /></a></li>');
    4040          }
    4141  }
     
    5959            array_splice($block->data, $position-1, 0, array('mp' =>
    6060              array(
    61                 'URL' => 'javascript:void(0)'.'onClick="window.open(\''.get_root_url().'plugins/'.$this->plugin_name.'/lecteur.php\',\'musique\',\'width='.$conf_plugin[4].',height='.$conf_plugin[3].',top=400,left=400,menubar=no,resizable=yes,toolbar=no,status=no,alwaysRaised=yes\')" ',
     61                'URL' => 'javascript:void(0)'.'onClick="window.open(\''.get_root_url().'plugins/'.$this->plugin_name.'/lecteur.php\',\'musique\',\'width='.$conf_plugin[4].',height='.$conf_plugin[3].',top=400,left=400,toolbar=no,location=no,menubar=no,resizable=yes,status=no,alwaysRaised=yes\')" ',
    6262                'TITLE' => l10n('lien_expl'),
    6363                'NAME' => l10n('lien_titre')
  • extensions/music_player/lecteur.php

    r3501 r3507  
    7676*/
    7777include(PHPWG_ROOT_PATH.'include/page_header.php');
    78         load_language('plugin.lang', $m_p->plugin_path);
     78load_language('plugin.lang', $m_p->plugin_path);
    7979
    8080$template->assign(
     
    118118}
    119119// +-----------------------------------------------------------------------+
     120// |                         Configuration du style                        |
     121// +-----------------------------------------------------------------------+
     122$conf_lecteur = explode("," , $conf['mp_lecteur']);
     123
     124if ($conf_lecteur[10]=='true')
     125{
     126        $file = 'lecteur.css';
     127        $dir = LOCALEDIT_PATH.'template/style/';
     128        $theme_file = $dir.$user['template'].'/'.$user['theme'].'/'.$file;
     129        $template_file = $dir.$user['template'].'/'.$file;
     130       
     131        if (file_exists($theme_file))
     132        {
     133                $template->assign(array( 'STYLE_FILE' => $theme_file ) );
     134        }
     135        elseif (file_exists($template_file))
     136        {
     137                $template->assign(array( 'STYLE_FILE' => $template_file ) );
     138        }
     139        else
     140        {
     141                $template->assign(array( 'STYLE_FILE' => $dir.$conf_lecteur[9] ) );
     142        }
     143}
     144else
     145{
     146        $template->assign(array( 'STYLE_FILE' => $dir.$conf_lecteur[9] ) );
     147}
     148if ($conf_lecteur[10]=='true')
     149{
     150
     151        $file = 'lecteur.conf.php';
     152        $dir = LOCALEDIT_PATH.'template/style/';
     153        $theme_file = $dir.$user['template'].'/'.$user['theme'].'/'.$file;
     154        $template_file = $dir.$user['template'].'/'.$file;
     155       
     156        if (file_exists($theme_file))
     157        {
     158                include($theme_file);
     159        }
     160        elseif (file_exists($template_file))
     161        {
     162                include($template_file) ;
     163        }
     164        else
     165        {
     166                $name = explode('.', $conf_lecteur[9]);
     167                include_once($dir.$name[0].'.conf.php');
     168        }
     169}
     170else
     171{
     172        $name = explode('.', $conf_lecteur[9]);
     173        include_once($dir.$name[0].'.conf.php');
     174}
     175
     176
     177
     178// +-----------------------------------------------------------------------+
    120179// |                         Configuration du lecteur                      |
    121180// +-----------------------------------------------------------------------+
    122181
    123 $conf_lecteur = explode("," , $conf['mp_lecteur']);
    124182
    125183if ($conf_lecteur[5]=='true') $shuffle=$conf_lecteur[5]; else $shuffle="false";
     
    152210      'URL' => $url,
    153211      'AUTOSCROLL' => $autoscroll,
     212      'BACK_COLOR' => $BACK_COLOR,
     213      'FRONT_COLOR' => $FRONT_COLOR,
     214      'LIGHT_COLOR' => $LIGHT_COLOR,
    154215    )
    155216  );
  • extensions/music_player/maintain.inc.php

    r3329 r3507  
    4545INSERT INTO ' . CONFIG_TABLE . ' (param,value,comment)
    4646        VALUES
    47         ("mp_lecteur" , "148,300,128,true,128,false,list,0,true" , "Lecteur config : haut tt, larg tt, haut pl, miniature, larg min, shuffle, repeat, autostart, autoscroll");';
     47        ("mp_lecteur" , "148,300,128,true,128,false,list,0,true,lecteur.css,true" , "Lecteur config : haut tt, larg tt, haut pl, miniature, larg min, shuffle, repeat, autostart, autoscroll, style, style pour chaque thème");';
    4848    pwg_query($q);
    4949
     
    109109INSERT INTO ' . CONFIG_TABLE . ' (param,value,comment)
    110110        VALUES
    111         ("mp_lecteur" , "148,300,128,true,128,false,list,0,true" , "Lecteur config : haut tt, larg tt, haut pl, miniature, larg min, shuffle, repeat, autostart, autoscroll");';
     111        ("mp_lecteur" , "148,300,128,true,128,false,list,0,true,lecteur.css,true" , "Lecteur config : haut tt, larg tt, haut pl, miniature, larg min, shuffle, repeat, autostart, autoscroll, style, style pour chaque thème");';
    112112    pwg_query($q);
    113113   }
     
    121121   $nbr=count($conf);
    122122   
    123      if ($nbr!=9)
     123     if ($nbr!=11)
    124124     {
    125125      pwg_query('DELETE FROM '.CONFIG_TABLE.' WHERE param IN (\'mp_lecteur\')');
     
    128128INSERT INTO ' . CONFIG_TABLE . ' (param,value,comment)
    129129        VALUES
    130         ("mp_lecteur" , "148,300,128,true,128,false,list,0,true" , "Lecteur config : haut tt, larg tt, haut pl, miniature, larg min, shuffle, repeat, autostart, autoscroll");';
     130        ("mp_lecteur" , "148,300,128,true,128,false,list,0,true,lecteur.css,true" , "Lecteur config : haut tt, larg tt, haut pl, miniature, larg min, shuffle, repeat, autostart, autoscroll, style, style pour chaque thème");';
    131131      pwg_query($q);
    132132     }
  • extensions/music_player/player/v4/readme.html

    r3329 r3507  
    2525        <script type="text/javascript" src="swfobject.js"></script>
    2626        <script type="text/javascript">
    27                 var s1 = new SWFObject("player.swf","ply","328","200","9","#FFFFFF");
     27                var s1 = new SWFObject("player.swf","playlist","328","200","9","#FFFFFF");
    2828                s1.addParam("allowfullscreen","true");
    2929                s1.addParam("allowscriptaccess","always");
  • extensions/music_player/template/admin.tpl

    r3500 r3507  
    8080      px <br />
    8181      {'mp_admin_3_opt2_2'|@translate}</li>
     82        <li>
     83       {'mp_admin_3_opt9'|@translate}<br />
     84       <select name="style">
     85        {foreach from=$list_style item=ls}
     86        <option value="{$ls.FILE}">{$ls.TEXTE}</option>
     87        {/foreach}
     88      </select>
     89      <br />
     90      <input type="checkbox" name="various_style" value="true" {$MP_VARIOUS_STYLE} />
     91      {'mp_admin_3_opt10'|@translate}<br />
     92    </li>
    8293    <li>
    8394      <input type="checkbox" name="mp_miniature" value="true" {$MP_MINIATURE_ACTIVATED} />
  • extensions/music_player/template/lecteur.tpl

    r3329 r3507  
    1 {html_head}<link rel="stylesheet" type="text/css" href="./template/lecteur.css">{/html_head}
     1{html_head}<link rel="stylesheet" type="text/css" href="{$STYLE_FILE}">{/html_head}
    22{html_head}<script type="text/javascript" src="./player/swfobject.js"></script>{/html_head}
    33{html_head}<script type="text/javascript">
     
    3535{/if}
    3636
    37 <div id="content">
     37<div id="content" class="content">
    3838<div id="autre_content">
    39 <div id="montre" style="display:block" align="center">
    40   <a href="javascript:void(0)" onclick="document.getElementById('montre').style.display ='none';document.getElementById('cache').style.display ='block'">{'mp_montre'|@translate}</a>
    41 </div>
    42 <div id="cache" style="display:none" align="center">
    43   <a href="javascript:void(0)" onclick="document.getElementById('montre').style.display ='block';document.getElementById('cache').style.display ='none'">{'mp_cache'|@translate}</a><br />
    44   <ul>
    45   {foreach from=$playlist item=playlist}<!-- BEGIN playlist -->
    46     <li><a href="javascript:void(0)" onclick="javascript:loadFile({literal}{{/literal}file:'{$playlist.URL}'{literal}}{/literal})" >{$playlist.TEXTE}</a></li>
    47   {/foreach}<!-- END playlist -->
    48   </ul>
    49 </div>
     39  <table id="table_content" border="0" cellspacing="0" cellpadding="0">
     40    <tr>
     41      <td id="section_up_left">&nbsp;</td>
     42      <td id="section_up"><a href="#" id="close_button" onclick="window.close();" title="{'Close this window'|@translate}"><img src="template/icon/exit.png" class="button" alt="close"></a></li></ul></td>
     43      <td id="section_up_right">&nbsp;</td>
     44    </tr>
     45    <tr>
     46      <td id="section_left">&nbsp;</td>
     47      <td id="section_in">
     48        <div class="titrePage">
     49        <div id="montre" style="display:block" align="center">
     50          <a href="javascript:void(0)" onclick="document.getElementById('montre').style.display ='none';document.getElementById('cache').style.display ='block'">{'mp_montre'|@translate}</a>
     51        </div>
     52        <div id="cache" style="display:none" align="center">
     53          <a href="javascript:void(0)" onclick="document.getElementById('montre').style.display ='block';document.getElementById('cache').style.display ='none'">{'mp_cache'|@translate}</a><br />
     54          <ul>
     55          {foreach from=$playlist item=playlist}<!-- BEGIN playlist -->
     56            <li><a href="javascript:void(0)" onclick="javascript:loadFile({literal}{{/literal}file:'{$playlist.URL}'{literal}}{/literal})" >{$playlist.TEXTE}</a></li>
     57          {/foreach}<!-- END playlist -->
     58          </ul>
     59        </div>
     60  </div>
    5061<p align="center" id="player">
    5162<script type="text/javascript">
     
    5667        so.addVariable("enablejs","true");
    5768        so.addVariable("javascriptid","playlist");
    58         so.addVariable('backcolor','0x000000');
    59         so.addVariable('frontcolor','0xffffff');
    60         so.addVariable('lightcolor','0x0099CC');
     69        so.addVariable('backcolor','{$BACK_COLOR}');
     70        so.addVariable('frontcolor','{$FRONT_COLOR}');
     71        so.addVariable('lightcolor','{$LIGHT_COLOR}');
    6172        so.addVariable('linktarget','_blank');
    6273    so.addParam("allowfullscreen","true");
     
    7485        so.write("player");
    7586</script></p>
    76 <p id="pageBottomActions"><a href="#" onclick="window.close();" title="{'Close this window'|@translate}"><img src="template/icon/exit.png" class="button" alt="close"></a></p>
     87</td>
     88          <td id="section_right">&nbsp;</td>
     89    </tr>
     90    <tr>
     91      <td id="section_bottom_left">&nbsp;</td>
     92      <td id="section_bottom" >&nbsp;</td>
     93      <td id="section_bottom_right" >&nbsp;</td>
     94    </tr>
     95  </table>
    7796</div>
    7897</div> <!-- the_page -->
Note: See TracChangeset for help on using the changeset viewer.