Changeset 15110


Ignore:
Timestamp:
05/19/12 00:07:43 (8 years ago)
Author:
mistic100
Message:

fix textarea size
better PHP code for config

Location:
extensions/SmiliesSupport
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • extensions/SmiliesSupport/admin.php

    r14526 r15110  
    1717{ 
    1818  // the smilies.txt file is not saved if the directory is changed 
    19   if (isset($_POST['text1']) AND $_POST['text1'] != $conf_smiliessupport['folder'])  
     19  if (isset($_POST['folder']) AND $_POST['folder'] != $conf_smiliessupport['folder'])  
    2020  { 
    2121    $not_save_file = true; 
    2222     
    23     $handle = opendir(SMILIES_PATH.'smilies/'.$_POST['text1']); 
    24     $i = 0; 
    25     while (false !== ($file = readdir($handle))) 
     23    if (!file_exists(SMILIES_PATH.'smilies/'.$_POST['folder'].'/'.$_POST['representant'])) 
    2624    { 
    27       if ( $file != '.' AND $file != '..' AND in_array(get_extension($file), array('gif', 'jpg', 'png')) ) 
     25      $handle = opendir(SMILIES_PATH.'smilies/'.$_POST['folder']); 
     26      $i = 0; 
     27      while (false !== ($file = readdir($handle))) 
    2828      { 
    29         $_POST['text3'] = $file; 
    30         closedir($handle); 
    31         break; 
     29        if ( $file != '.' AND $file != '..' AND in_array(get_extension($file), array('gif', 'jpg', 'png')) ) 
     30        { 
     31          $_POST['representant'] = $file; 
     32          closedir($handle); 
     33          break; 
     34        } 
    3235      } 
    3336    } 
     
    3639  // new configuration 
    3740  $conf_smiliessupport = array( 
    38     'folder' => isset($_POST['text1']) ? $_POST['text1'] : 'crystal', 
    39     'cols' => isset($_POST['text2']) ? $_POST['text2'] : '6', 
    40     'representant' => isset($_POST['text3']) ? $_POST['text3'] : 'smile.png', 
     41    'folder' => isset($_POST['folder']) ? $_POST['folder'] : 'crystal', 
     42    'cols' => isset($_POST['cols']) ? $_POST['cols'] : '6', 
     43    'representant' => isset($_POST['representant']) ? $_POST['representant'] : 'smile.png', 
    4144  ); 
    42   if (empty($_POST['text'])) $_POST['text'] = ':)    smile.png'; 
     45  if (empty($_POST['text'])) $_POST['text'] = ''; 
    4346     
    4447  conf_update_param('smiliessupport', serialize($conf_smiliessupport)); 
     
    97100 
    98101$template->assign(array( 
    99   'TEXT1_VALUE' => $conf_smiliessupport['folder'], 
    100   'TEXT2_VALUE' => $conf_smiliessupport['cols'], 
    101   'TEXT3_VALUE' => $conf_smiliessupport['representant'], 
     102  'FOLDER' => $conf_smiliessupport['folder'], 
     103  'COLS' => $conf_smiliessupport['cols'], 
     104  'REPRESENTANT' => $conf_smiliessupport['representant'], 
    102105  'sets' => $sets, 
    103106  'smiliesfiles' => $smilies_table, 
     
    107110// get the content of definitions file 
    108111$smilies_file = SMILIES_PATH.'smilies/'.$conf_smiliessupport['folder'].'/smilies.txt'; 
    109 if (file_exists($smilies_file)) { 
     112if (file_exists($smilies_file)) 
     113{ 
    110114  $content_file = file_get_contents($smilies_file); 
    111115  $template->assign(array('CONTENT_FILE' => $content_file)); 
  • extensions/SmiliesSupport/template/markitup/style.markitup.css

    r11294 r15110  
    11/* common */ 
    2 .markItUp { 
    3   display:inline-block; 
    4 } 
    52.markItUp * { 
    63  margin:0px; padding:0px; 
     
    1310} 
    1411.markItUp textarea { 
     12  margin-top:0 !important; 
    1513  display:block; 
    1614} 
     
    2624.markItUpFooter { 
    2725  display:none; 
     26} 
     27.markItUpHeader { 
     28  display:inline-block; 
    2829} 
    2930 
  • extensions/SmiliesSupport/template/smiliessupport_admin.tpl

    r14526 r15110  
    3838    <li> 
    3939      <span class="property">{'Smileys\' folder'|@translate}</span> 
    40       <select name="text1"> 
    41         {html_options options=$sets selected=$TEXT1_VALUE} 
     40      <select name="folder"> 
     41        {html_options options=$sets selected=$FOLDER} 
    4242      </select> 
    4343    </li> 
    4444    <li> 
    4545      <span class="property">{'Nb. columns'|@translate}</span> 
    46       <input type="text" size="3" name="text2" value="{$TEXT2_VALUE}" /> 
     46      <input type="text" size="3" name="cols" value="{$COLS}" /> 
    4747    </li>     
    4848    <li> 
    4949      <span class="property">{'Representative'|@translate}</span> 
    50       <select name="text3"> 
    51         {html_options options=$smilies selected=$TEXT3_VALUE} 
     50      <select name="representant"> 
     51        {html_options options=$smilies selected=$REPRESENTANT} 
    5252      </select> 
    5353    </li> 
  • extensions/SmiliesSupport/template/smiliessupport_page.tpl

    r14526 r15110  
     1{if not isset($BBCODE_PATH)} 
    12{combine_script id="markitup" require='jquery' path=$SMILIES_PATH|@cat:"template/markitup/jquery.markitup.js"} 
    23{combine_css path=$SMILIES_PATH|@cat:"template/markitup/style.markitup.css"} 
     4{/if} 
    35 
    46{footer_script require='jquery'} 
     
    2830 
    2931  <ul id="smiliesdiv"> 
    30     <li><table><tr> 
     32    <li><table><tr>{strip} 
    3133    {foreach from=$smiliesfiles item=smileyfile}  
    3234      <td><a href="{$smileyfile.TITLE}"><img src="{$smileyfile.PATH}"/></a></td> 
    3335      {$smileyfile.TR} 
    3436    {/foreach} 
    35     </tr></table></li> 
     37    {/strip}</tr></table></li> 
    3638  </ul> 
    3739</li> 
Note: See TracChangeset for help on using the changeset viewer.