[ Index ]

PHP Cross Reference of phpwcms V1.4.3 _r380 (23.11.09)

title

Body

[close]

/include/inc_tmpl/content/ -> cnt32.inc.php (source)

   1  <?php
   2  /*************************************************************************************
   3     Copyright notice
   4     
   5     (c) 2002-2009 Oliver Georgi (oliver@phpwcms.de) // All rights reserved.
   6   
   7     This script is part of PHPWCMS. The PHPWCMS web content management system is
   8     free software; you can redistribute it and/or modify it under the terms of
   9     the GNU General Public License as published by the Free Software Foundation;
  10     either version 2 of the License, or (at your option) any later version.
  11    
  12     The GNU General Public License can be found at http://www.gnu.org/copyleft/gpl.html
  13     A copy is found in the textfile GPL.txt and important notices to the license 
  14     from the author is found in LICENSE.txt distributed with these scripts.
  15    
  16     This script is distributed in the hope that it will be useful, but WITHOUT ANY 
  17     WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
  18     PARTICULAR PURPOSE.  See the GNU General Public License for more details.
  19   
  20     This copyright notice MUST APPEAR in all copies of the script!
  21  *************************************************************************************/
  22  
  23  // ----------------------------------------------------------------
  24  // obligate check for phpwcms constants
  25  if (!defined('PHPWCMS_ROOT')) {
  26     die("You Cannot Access This Script Directly, Have a Nice Day.");
  27  }
  28  // ----------------------------------------------------------------
  29  
  30  
  31  // Tabs
  32  
  33  initMootools();
  34  $BE['HEADER']['tabs.css']    = '    <link href="include/inc_css/tabs.css" rel="stylesheet" type="text/css" />';
  35  
  36  // set default values
  37  if(empty($content['tabs']) || !is_array($content['tabs'])) {
  38      $content['tabs'] = array();
  39  }
  40  
  41  // check which WYSIWYG editor to load
  42  // only FCKeditor is supported here
  43  // or WYSIWYG disabled
  44  if(!empty($_SESSION["WYSIWYG_EDITOR"])) {
  45  
  46      $BE['HEADER']['fckeditor.js']    = '    <script type="text/javascript" src="include/inc_ext/fckeditor/fckeditor.js"></script>';
  47      $content['wysiwyg']                = true;
  48      
  49      // check if FCKeditor is enabled
  50      $content['wysiwyg_toolbar']        = $_SESSION["WYSIWYG_EDITOR"] == 2 ? $_SESSION['WYSIWYG_TEMPLATE'] : 'phpwcms_basic';
  51  
  52  } else {
  53  
  54      $content['wysiwyg']                = false;
  55      $content['wysiwyg_toolbar']        = '';
  56  
  57  }
  58  
  59  ?>
  60  
  61  <tr><td colspan="2" class="rowspacer0x7"><img src="img/leer.gif" alt="" width="1" height="1" /></td></tr>
  62  
  63  <tr>
  64      <td align="right" class="chatlist"><?php echo $BL['be_admin_struct_template']; ?>:&nbsp;</td>
  65      <td><table border="0" cellpadding="0" cellspacing="0" summary="">
  66          <tr>
  67              <td><select name="template" id="template" class="f11b width150">
  68  <?php
  69      
  70      echo '<option value="">'.$BL['be_admin_tmpl_default'].'</option>'.LF;
  71  
  72      $tmpllist = get_tmpl_files(PHPWCMS_TEMPLATE.'inc_cntpart/tabs');
  73      if(is_array($tmpllist) && count($tmpllist)) {
  74          foreach($tmpllist as $val) {
  75              $selected_val = (isset($content["tabs_template"]) && $val == $content["tabs_template"]) ? ' selected="selected"' : '';
  76              $val = html_specialchars($val);
  77              echo '    <option value="' . $val . '"' . $selected_val . '>' . $val . '</option>' . LF;
  78          }
  79      }
  80  
  81  ?>                  
  82              </select></td>
  83          
  84          </tr>
  85          
  86      </table></td>        
  87          
  88  </tr>
  89  
  90  <tr><td colspan="2" class="rowspacer7x7"><img src="img/leer.gif" alt="" width="1" height="1" /></td></tr>
  91  
  92  <tr>
  93      <td id="col_1_width">&nbsp;</td>
  94      <td class="tdbottom6"><button class="btn_add_tab" id="btn_add_tab">
  95          <span><?php echo $BL['be_tab_add'] ?></span>
  96      </button></td>
  97  </tr>
  98  
  99  <tr>
 100      <td colspan="2"><ul id="tabs">
 101  
 102  <?php
 103  
 104      // Sort/Up Down Title
 105      $sort_up_down = $BL['be_func_struct_sort_up'] . ' / '. $BL['be_func_struct_sort_down'];
 106  
 107      foreach($content['tabs'] as $key => $value) {
 108  
 109  ?>
 110  
 111              <li id="tab<?php echo $key ?>" class="tab">
 112              <table cellpadding="0" cellspacing="0" border="0" summary="">
 113              
 114                  <tr>
 115                      <td class="chatlist col1w" align="right"><em class="handle" title="<?php echo $sort_up_down; ?>">&nbsp;</em><?php echo $BL['be_tab_name'] ?>:&nbsp;</td>
 116                      <td class="tdbottom2"><input type="text" name="tabtitle[<?php echo $key ?>]" id="tabtitle<?php echo $key ?>" value="<?php echo html_specialchars($value['tabtitle']) ?>" class="f11b width400" /></td>            
 117                      <td><a href="#" onclick="return deleteTab('tab<?php echo $key ?>');"><img src="img/famfamfam/tab_delete.gif" alt="" border="" /></a></td>
 118                  </tr>                
 119                  <tr>
 120                      <td class="chatlist col1w" align="right"><?php echo $BL['be_headline'] ?>:&nbsp;</td>
 121                      <td colspan="2"><input type="text" name="tabheadline[<?php echo $key ?>]" id="tabheadline<?php echo $key ?>" value="<?php echo html_specialchars($value['tabheadline']) ?>" class="v11 width400" /></td>            
 122                  </tr>
 123                  <tr>
 124                      <td colspan="3" class="tdtop5"><textarea name="tabtext[<?php echo $key ?>]" id="tabtext<?php echo $key ?>" rows="10" class="v12" style="width:536px;height:150px;"><?php echo html_specialchars($value['tabtext']) ?></textarea></td>
 125                  </tr>
 126              
 127              </table>
 128              </li>    
 129  
 130  <?php
 131  
 132      }
 133  ?>    
 134  
 135      </ul></td>
 136  </tr>
 137  
 138  <tr>
 139      <td colspan="2" class="rowspacer0x7">
 140      <script type="text/javascript">
 141      <!--
 142  
 143      var wysiwyg    = <?php echo $content['wysiwyg'] ? 'true' : 'false'; ?>;
 144      var fckbase    = '<?php echo PHPWCMS_URL.'include/inc_ext/fckeditor/'; ?>';
 145      var toolbar    = '<?php echo $content['wysiwyg_toolbar']; ?>';
 146      var entries = 0;
 147      var FCK        = new Array();
 148      
 149      window.addEvent('domready', function() {
 150  
 151          var head    = document.getElementsByTagName('head');
 152          //new Element('style', {'type': 'text/css'} ).setText('td.col1w {width: ' + col1w['width'] + 'px;}').injectInside( head[0] );
 153          
 154          var entries = $('tabs').getChildren().length;
 155          
 156          $('btn_add_tab').addEvent('click', function(event) {
 157              event = new Event(event).stop();
 158              
 159              var entry = '<table cellpadding="0" cellspacing="0" border="0" summary="">';
 160              entry    +=    '<tr><td class="chatlist col1w" align="right"><?php echo $BL['be_tab_name'] ?>:&nbsp;<'+'/td>';
 161              entry    +=    '<td class="tdbottom2"><input type="text" name="tabtitle[' + entries + ']" id="tabtitle' + entries + '" value="" class="f11b width400" /'+'><'+'/td>';
 162              entry    +=    '<td><a href="#" onclick="return deleteTab(\'tab' + entries + '\');"><img src="img/famfamfam/tab_delete.gif" alt="" border="" /><'+'/a><'+'/td><'+'/tr>';
 163              entry    +=    '<tr><td class="chatlist col1w" align="right"><?php echo $BL['be_headline'] ?>:&nbsp;<'+'/td>';
 164              entry    +=    '<td colspan="2"><input type="text" name="tabheadline[' + entries + ']" id="tabheadline' + entries + '" value="" class="v11 width400" /'+'><'+'/td><'+'/tr>';
 165              entry    +=    '<tr><td colspan="3" class="tdtop5"><textarea name="tabtext[' + entries + ']" id="tabtext' + entries + '" rows="10" class="v12" ';
 166              entry    +=    'style="width:536px;height:150px;"><'+'/textarea><'+'/td><'+'/tr><'+'/table>';
 167              
 168              var tab = new Element('li', {'id': 'tab'+entries, 'class': 'tab nomove'} ).setHTML( entry ).injectInside( $('tabs') );
 169                          
 170              if(wysiwyg) {
 171                  EnableFCK(entries);
 172              }
 173              
 174              //makeSortable();
 175      
 176              window.scrollTo(0, tab.getCoordinates()['top']);
 177              
 178              entries++;
 179              
 180          });
 181          
 182          if(wysiwyg && entries > 0) {
 183  
 184              for(x = 0; x < entries; x++) {
 185                  EnableFCK(x);
 186              }
 187          }
 188          
 189          makeSortable();
 190          
 191          /*
 192          var col1w    = $('col_1_width').getCoordinates();
 193          
 194          alert(col1w['width']);
 195          $$('td.col1w').each( function(el) {
 196              el.setStyle('width', col1w['width'] + 'px');
 197          });
 198          */
 199      
 200      });
 201      
 202  	function makeSortable() {
 203          var s = new Sortables( $('tabs'), { handles: 'em' } );
 204      }
 205      
 206  	function EnableFCK(x) {
 207  
 208          if( $('tabtext'+x) ) {
 209      
 210              FCK[x] = new FCKeditor('tabtext'+x);
 211                      
 212              FCK[x].BasePath = fckbase;
 213              FCK[x].Config['CustomConfigurationsPath'] = fckbase+'fckeditor_config.js.php';
 214              FCK[x].Config['StartupFocus'] = false;
 215              FCK[x].Width = 536;
 216              FCK[x].Height = 150;
 217              FCK[x].ToolbarSet = toolbar;    
 218                                  
 219              FCK[x].ReplaceTextarea() ;
 220          }
 221      
 222      }
 223      
 224  	function deleteTab(e) {
 225          if(confirm('<?php echo $BL['be_tab_delete_js'] ?>')) {
 226              $(e).remove();
 227          }
 228          return false;
 229      }
 230  
 231      
 232      //-->
 233      </script>
 234      </td>
 235  </tr>


Generated: Wed Dec 30 05:55:15 2009 Cross-referenced by PHPXref 0.7