Source for file langform.tpl.php

Documentation is available at langform.tpl.php

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

Documentation generated on Mon, 05 May 2008 16:20:49 +0400 by phpDocumentor 1.4.0