[ Index ]

PHP Cross Reference of Mambo 4.6.5

[ Variables ]     [ Functions ]     [ Classes ]     [ Constants ]     [ Statistics ]

title

Body

[close]

/administrator/components/com_languages/views/templates/ -> langform.tpl.php (source)

   1  <?php
   2  /**
   3  * @package Mambo
   4  * @subpackage Languages
   5  * @author Mambo Foundation Inc see README.php
   6  * @copyright (C) 2000 - 2009 Mambo Foundation Inc.
   7  * See COPYRIGHT.php for copyright notices and details.
   8  * @license GNU/GPL Version 2, see LICENSE.php
   9  *
  10  * Redistributions of files must retain the above copyright notice.
  11  *
  12  * Mambo is free software; you can redistribute it and/or
  13  * modify it under the terms of the GNU General Public License
  14  * as published by the Free Software Foundation; version 2 of the License.
  15  */
  16  
  17  defined( '_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' );
  18      mosCommonHTML::loadOverlib();
  19      $iso = split( '=', _ISO );
  20  ?>    
  21  <script type="text/javascript">    
  22  var iso = "<?php echo $iso[1];?>";
  23  var wincharset = "<?php echo $language->charset;?>";
  24  function submitbutton(pressbutton) {
  25      var form = document.adminForm;
  26      var page_ = document.adminForm.page_.value;
  27      if (pressbutton == 'cancel') {
  28          submitform( pressbutton );
  29          return;
  30      }        // do field validation
  31      if (form.language.value == "") {
  32          alert( "<?php echo T_('You must choose a language.') ?>" );
  33      } else if (form.charset.value == "") {
  34          alert( "<?php echo T_('You must choose a character set.') ?>" );
  35      }else if ( (iso!=wincharset) && (page_=="editpage") )
  36      {
  37          alert( "<?php echo T_("Cannot save! You must set \\\"$language->title\\\" to default language before.") ?>");
  38      }  else {
  39          submitform( pressbutton );
  40      }
  41  }
  42  </script>
  43  <?php if ($task == 'new') : ?>    
  44  <script type="text/javascript">
  45  function langselect(select) {
  46      var language       = select.form.elements["language"];
  47      var iso3166_2      = select.form.elements["iso3166_2"];
  48      var charset        = select.form.elements["charset"];
  49      var plural_form    = select.form.elements["plural_form"];
  50      var date_format    = select.form.elements["date_format"];
  51      var text_direction = select.form.elements["text_direction"];
  52      var territory      = select.form.elements["territory"];
  53      lang               = select.options[select.selectedIndex].value;
  54      language.value     = select.options[select.selectedIndex].text;
  55      territory.value     = '';
  56      iso3166_2.options.length = 0;
  57      charset.options.length = 0;
  58      select.options[0] = new Option("<?php echo T_("choose language"); ?>", "", true, false);
  59      if (lang != "") {
  60          if(plurals[lang])  plural_form.value = plurals[lang];
  61          if(dateformats[lang])  date_format.value = dateformats[lang];
  62          if(directions[lang])  text_direction.value = directions[lang];
  63          var t_options   = territories[lang];
  64          var c_options   = codesets[lang];
  65          iso3166_2.options[0] = new Option("<?php echo T_("choose territory"); ?>", "", true, false);
  66          charset.options[0]   = new Option("<?php echo T_("choose character set"); ?>", "utf-8", true, false);
  67          for (var a = 0; a < t_options.length; a++) {
  68              iso3166_2.options[a + 1] = new Option(t_options[a].territory, t_options[a].iso3166_2);
  69          }
  70          for (var b = 0; b < c_options.length; b++) {
  71              charset.options[b + 1] = new Option(c_options[b].text, c_options[b].value);
  72          }
  73      }
  74  }
  75  function territoryselect(select) {
  76      var territory  = select.form.elements["territory"];
  77      var iso3166_3  = select.form.elements["iso3166_3"];
  78      iso3166_3.value= '';
  79      iso            = select.options[select.selectedIndex].value;
  80      if(iso != '') territory.value= select.options[select.selectedIndex].text;
  81      else territory.value= '';
  82  
  83      var tarr   = territories[lang];
  84      for (var a = 0; a < tarr.length; a++) {
  85          if(iso == tarr[a].iso3166_2) {
  86              iso3166_3.value = tarr[a].iso3166_3;
  87          }
  88      }
  89  }
  90  var territories = new Object();
  91  <?php foreach ($territories as $name => $territory) : ?>
  92  territories['<?php echo $name ?>'] =  [<?php
  93  $str = '';
  94  $cnt = count($territories[$name]);
  95  for ($a=0; $a<$cnt; $a++) {
  96      $str .= '{iso3166_2:"'.$territory[$a]['iso3166_2'].'", iso3166_3:"'.$territory[$a]['iso3166_3'].'", territory:"'.$territory[$a]['territory'].'"}';
  97      $str .= $a != $cnt-1 ? ", " : "";
  98      echo $str;
  99      $str = '';
 100  }
 101  ?>];
 102  <?php endforeach; ?>
 103  var codesets = new Object();
 104  <?php foreach ($codesets as $name => $charset) : ?>
 105  codesets['<?php echo $name ?>'] =  [<?php
 106  $str = '';
 107  $cnt = count($codesets[$name]);
 108  for ($b=0; $b<count($codesets[$name]); $b++) {
 109      $str .= '{value:"'.$charset[$b].'", text:"'.$charset[$b].'"}';
 110      $str .= $b != $cnt-1 ? ", " : "";
 111      echo $str;
 112      $str = '';
 113  }
 114  ?>];
 115  <?php endforeach; ?>
 116  var directions = new Object();
 117  <?php foreach ($directions as $name => $dir) : ?>
 118  directions['<?php echo $name ?>'] =  <?php echo "'$dir'"; ?>;
 119  <?php endforeach; ?>
 120  var dateformats = new Object();
 121  <?php foreach ($dateformats as $name => $fmt) : ?>
 122  dateformats['<?php echo $name ?>'] =  <?php echo "'$fmt'"; ?>;
 123  <?php endforeach; ?>
 124  var plurals = new Object();
 125  <?php foreach ($plural_forms as $name => $exp) : ?>
 126  plurals['<?php echo $name ?>'] =  <?php echo "'$exp'"; ?>;
 127  <?php endforeach; ?>
 128  </script>
 129  <table class="adminform">
 130      <tr>
 131          <td style="width:200px"><?php echo T_('Language') ?></td>
 132          <td>               
 133              <select id="iso639" name="iso639" style="width:250px" class="inputbox" onchange="langselect(this)">     
 134              <option value=""><?php echo T_('choose language') ?></option>   
 135              <?php foreach ($locales as $name => $locale): ?>        
 136              <option value="<?php echo $name ?>"><?php echo $locale['title'] ?></option>  
 137              <?php endforeach; ?>
 138              </select>
 139          </td>
 140      </tr>
 141      <tr>
 142          <td style="width:200px"><?php echo T_('Territory') ?>:</td>
 143          <td>            
 144              <select id="iso3166_2" name="iso3166_2" style="width:250px" class="inputbox" onchange="territoryselect(this)">       
 145              <option value=""><?php echo T_('choose territory') ?></option>   
 146              </select>             
 147         </td>
 148      </tr>    
 149      <tr>
 150          <td><?php echo T_('Character Set') ?>:</td>
 151          <td>
 152              <select id="codeset" name="charset" style="width:250px" class="inputbox">        
 153              <option value="utf-8"><?php echo T_('choose charset') ?></option>   
 154              </select>
 155              <input type="hidden" name="page_" value="addpage" />
 156              <?php #echo mosToolTip( T_('The character encoding for this language. Ex. utf-8') ); ?>
 157          </td>
 158      </tr>
 159  </table>
 160  <?php endif; //if ($task == 'new') : ?>
 161  
 162  <input type="hidden" id="language" name="language" value="<?php echo isset($language->name) ? $language->name : '' ?>" />
 163  <input type="hidden" id="text_direction" name="text_direction" value="<?php echo isset($language->text_direction) ? $language->text_direction : '' ?>" />
 164  <input type="hidden" id="plural_form" name="plural_form" value="<?php echo isset($language) && isset($language->plural_form['expression']) ? $language->plural_form['expression'] : 'nplurals=2; plural=n != 1;' ?>" />
 165  <input type="hidden" id="date_format" name="date_format" value="<?php echo isset($language->date_format) ? $language->date_format : '' ?>" />
 166  <input type="hidden" id="territory" name="territory" value="<?php echo isset($language->territory) ? $language->territory : '' ?>" />
 167  <input type="hidden" id="iso3166_3" name="iso3166_3" value="<?php echo isset($language->iso3166_3) ? $language->iso3166_3 : '' ?>" />
 168  
 169  <?php if ($task == 'edit') : ?> 
 170  <?php 
 171  $tabs = new mosTabs(1);
 172  $tabs->startPane("editlanguage");
 173  $tabs->startTab(T_("Details"),"details");
 174  
 175  ?>
 176  <table class="adminform">  
 177  <tr><td style="width:150px">&nbsp;</td><td>&nbsp;</td></tr> 
 178      <tr>
 179          <td><?php echo T_('Language') ?>:</td>
 180          <td>                           
 181          <input type="hidden" id="iso639" name="iso639" value="<?php echo $language->iso639 ?>" />
 182          <span style="font-weight:bold;font-size:110%"><?php echo $language->title; ?></span>
 183          </td>
 184      </tr>
 185      <?php if (!empty($language->territory)) : ?> 
 186      <tr>
 187          <td><?php echo T_('Territory') ?>:</td>
 188          <td>
 189              <input type="hidden" id="iso3166_2" name="iso3166_2" value="<?php echo $language->iso3166_2  ?>" />  
 190              <span style="font-weight:bold;font-size:110%"><?php echo $language->territory; ?> </span>
 191          </td>
 192      </tr>
 193      <?php endif; ?>            
 194      <tr>
 195          <td><?php echo T_('Character Set') ?>:</td>
 196          <td><div style="width:400px">
 197          <input type="hidden" id="charset" name="charset" value="<?php echo $language->charset ?>" />
 198          <div style="display:inline;;margin-right:120px;font-weight:bold;font-size:110%"><?php echo $language->charset; ?> </div>
 199  <!---->
 200         <?php /* if (class_exists('ConvertCharset')) : ? >
 201          <div style="display:inline;text-align:right;margin-right:0px">
 202          <button class="button" onclick="submitbutton('convert')"><?php echo T_('Convert to') ? >:</button>
 203          <select name="newcharset" id="newcharset">
 204          < ?php foreach ($language->codesets as $chr): 
 205          if ($chr != $language->charset) echo '<option value="'.$chr.'">'.$chr.'</option>';
 206          endforeach; ? >
 207          </select>
 208          </div>
 209          <?php endif; */ ?> 
 210  <!---->
 211          </div>
 212          </td>
 213      </tr>
 214      <tr>
 215          <td><?php echo T_('Description') ?>:</td>
 216          <td>
 217              <input type="text" name="description" maxlength="100" class="inputbox" style="width:400px" value="<?php echo $language->description ?>" />
 218          </td>
 219      </tr>
 220      <tr>
 221          <td><?php echo T_('Author') ?>:</td>
 222          <td>
 223              <input type="text" name="author" maxlength="100" class="inputbox" style="width:400px" value="<?php echo $language->author ?>" />
 224          </td>
 225      </tr>
 226      <tr>
 227          <td><?php echo T_('Author Email') ?>:</td>
 228          <td>
 229              <input type="text" name="authoremail" maxlength="100" class="inputbox" style="width:400px" value="<?php echo $language->authoremail ?>" />
 230          </td>
 231      </tr>
 232      <tr>
 233          <td><?php echo T_('Author Url') ?>:</td>
 234          <td>
 235              <input type="text" name="authorurl" maxlength="100" class="inputbox" style="width:400px" value="<?php echo $language->authorurl ?>" />
 236          </td>
 237      </tr>
 238      <tr>
 239          <td><?php echo T_('Text Direction') ?>:</td>
 240          <td>
 241              <select     name="text_direction" class="inputbox"  style="width:400px">  
 242              <option value="ltr"<?php if ($language->text_direction == 'ltr') echo ' selected="selected"' ?>><?php echo T_('left to right') ?></option>                
 243              <option value="rtl"<?php if ($language->text_direction == 'rtl') echo ' selected="selected"' ?>><?php echo T_('right to left') ?></option>
 244              </select>            
 245          </td>
 246      </tr>
 247      <tr>
 248          <td><?php echo T_('Plural Forms'); ?></td>
 249          <td>
 250              <select     name="plural_form" class="inputbox"  style="width:400px">    
 251              <?php foreach ($plurals as $plural): ?>       
 252              <option value="<?php echo $plural[1] ?>"<?php if ($language->plural_form['expression'] == $plural[1]) echo ' selected="selected"' ?>><?php echo $plural[0] ?></option>                   
 253              <?php endforeach; ?> 
 254              </select>                        
 255          </td>
 256      </tr>
 257      <tr>
 258          <td><?php echo T_('Date Format') ?></td>
 259          <td>
 260              <input type="text" name="date_format" maxlength="100" class="inputbox" style="width:400px" value="<?php echo $language->date_format ?>" />
 261              <?php echo mosToolTip( T_('Date format for strftime().') ); ?>
 262          </td>
 263      </tr>
 264      <tr>
 265          <td><?php echo T_('Locales') ?></td>
 266          <td>
 267              <input type="text" name="locale" maxlength="100" class="inputbox" style="width:400px" value="<?php echo $language->locale ?>" />
 268              <input type="hidden" name="page_" value="editpage" />
 269              <?php echo mosToolTip( T_('The locale list for setlocale(). \nLocale names must be comma separated.') ); ?>
 270          </td>
 271      </tr>
 272  </table>
 273  <?php $tabs->endTab(); $tabs->startTab(T_('Days'),"days"); ?>
 274  <table class="adminform">
 275  <tr><td style="width:150px">&nbsp;</td><td>&nbsp;</td></tr> 
 276      <?php foreach ($language->days as $kd => $day): ?>
 277      <tr>
 278          <td>
 279              <?php echo strtoupper($kd); ?>
 280          </td>
 281          <td>
 282              <input type="text" name="days[<?php echo $kd ?>]" maxlength="100" class="inputbox" style="width:400px" value="<?php echo $day ?>" />
 283          </td>
 284      </tr>
 285      <?php endforeach; ?> 
 286  </table>
 287  <?php $tabs->endTab(); $tabs->startTab(T_('Months'),"months"); ?>
 288  <table class="adminform">
 289  <tr><td style="width:150px">&nbsp;</td><td>&nbsp;</td></tr> 
 290      <?php foreach ($language->months as $km => $month): ?>
 291      <tr>
 292          <td>
 293              <?php echo strtoupper($km); ?>
 294          </td>
 295          <td>
 296              <input type="text" name="months[<?php echo $km ?>]" maxlength="100" class="inputbox" style="width:250px" value="<?php echo $month ?>" />
 297          </td>
 298      </tr>
 299      <?php endforeach; ?> 
 300  </table>
 301  <?php $tabs->endTab(); $tabs->endPane(); ?>
 302  <?php endif;  ?>
 303