[ Index ]

PHP Cross Reference of phpwcms V1.5.0 _r431 (28.01.12)

title

Body

[close]

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

   1  <?php
   2  /*************************************************************************************
   3     Copyright notice
   4     
   5     (c) 2002-2012 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  $content['tabwysiwygoff'] = empty($content['tabs']['tabwysiwygoff']) ? 0 : 1;
  41  unset($content['tabs']['tabwysiwygoff']);
  42  
  43  // check which WYSIWYG editor to load
  44  // only FCKeditor is supported here
  45  // or WYSIWYG disabled
  46  if(!empty($_SESSION["WYSIWYG_EDITOR"]) && !$content['tabwysiwygoff']) {
  47  
  48      $BE['HEADER']['fckeditor.js']    = '    <script type="text/javascript" src="include/inc_ext/fckeditor/fckeditor.js"></script>';
  49      $content['wysiwyg']                = true;
  50      
  51      // check if FCKeditor is enabled
  52      $content['wysiwyg_toolbar']        = $_SESSION["WYSIWYG_EDITOR"] == 2 ? $_SESSION['WYSIWYG_TEMPLATE'] : 'phpwcms_basic';
  53  
  54  } else {
  55  
  56      $content['wysiwyg']                = false;
  57      $content['wysiwyg_toolbar']        = '';
  58  
  59  }
  60  
  61  ?>
  62  
  63  <tr><td colspan="2" class="rowspacer0x7"><img src="img/leer.gif" alt="" width="1" height="1" /></td></tr>
  64  
  65  <tr>
  66      <td align="right" class="chatlist"><?php echo $BL['be_admin_struct_template']; ?>:&nbsp;</td>
  67      <td><table border="0" cellpadding="0" cellspacing="0" summary="">
  68          <tr>
  69              <td><select name="template" id="template" class="f11b width150">
  70  <?php
  71      
  72      echo '<option value="">'.$BL['be_admin_tmpl_default'].'</option>'.LF;
  73  
  74      $tmpllist = get_tmpl_files(PHPWCMS_TEMPLATE.'inc_cntpart/tabs');
  75      if(is_array($tmpllist) && count($tmpllist)) {
  76          foreach($tmpllist as $val) {
  77              $selected_val = (isset($content["tabs_template"]) && $val == $content["tabs_template"]) ? ' selected="selected"' : '';
  78              $val = html_specialchars($val);
  79              echo '    <option value="' . $val . '"' . $selected_val . '>' . $val . '</option>' . LF;
  80          }
  81      }
  82  
  83  ?>                  
  84              </select></td>
  85          
  86          </tr>
  87          
  88      </table></td>        
  89          
  90  </tr>
  91  
  92  <tr><td colspan="2" class="rowspacer7x7"><img src="img/leer.gif" alt="" width="1" height="1" /></td></tr>
  93  
  94  <tr>
  95      <td id="col_1_width">&nbsp;</td>
  96      <td><table cellpadding="0" cellspacing="0" border="0" summary="">
  97          <tr>
  98              <td class="tdbottom6"><button class="btn_add_tab" id="btn_add_tab">
  99                  <span><?php echo $BL['be_tab_add'] ?></span>
 100              </button></td>
 101              <td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
 102              <td><input type="checkbox" name="tabwysiwygoff" id="tabwysiwygoff" value="1"<?php is_checked(1, $content['tabwysiwygoff']) ?> /></td>
 103              <td class="chatlist"><label for="tabwysiwygoff">&nbsp;<?php echo $BL['be_cnt_no_wysiwyg_editor'] ?></label></td>
 104          </tr>        
 105      </table></td>
 106  </tr>
 107  
 108  <tr>
 109      <td colspan="2"><ul id="tabs">
 110  
 111  <?php
 112  
 113      // Sort/Up Down Title
 114      $sort_up_down = $BL['be_func_struct_sort_up'] . ' / '. $BL['be_func_struct_sort_down'];
 115  
 116      foreach($content['tabs'] as $key => $value) {
 117  
 118  ?>
 119  
 120              <li id="tab<?php echo $key ?>" class="tab">
 121              <table cellpadding="0" cellspacing="0" border="0" summary="">
 122              
 123                  <tr>
 124                      <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>
 125                      <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>            
 126                      <td><a href="#" onclick="return deleteTab('tab<?php echo $key ?>');"><img src="img/famfamfam/tab_delete.gif" alt="" border="" /></a></td>
 127                  </tr>                
 128                  <tr>
 129                      <td class="chatlist col1w" align="right"><?php echo $BL['be_headline'] ?>:&nbsp;</td>
 130                      <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>            
 131                  </tr>
 132                  <tr>
 133                      <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>
 134                  </tr>
 135              
 136              </table>
 137              </li>    
 138  
 139  <?php
 140  
 141      }
 142  ?>    
 143  
 144      </ul></td>
 145  </tr>
 146  
 147  <tr>
 148      <td colspan="2" class="rowspacer0x7">
 149      <script type="text/javascript">
 150      <!--
 151  
 152      var wysiwyg    = <?php echo $content['wysiwyg'] ? 'true' : 'false'; ?>;
 153      var fckbase    = '<?php echo PHPWCMS_URL.'include/inc_ext/fckeditor/'; ?>';
 154      var toolbar    = '<?php echo $content['wysiwyg_toolbar']; ?>';
 155      var entries = 0;
 156      var FCK        = new Array();
 157      
 158      window.addEvent('domready', function() {
 159  
 160          var head    = document.getElementsByTagName('head');
 161          //new Element('style', {'type': 'text/css'} ).setText('td.col1w {width: ' + col1w['width'] + 'px;}').injectInside( head[0] );
 162          
 163          var entries = $('tabs').getChildren().length;
 164          
 165          $('btn_add_tab').addEvent('click', function(event) {
 166              event = new Event(event).stop();
 167              
 168              var entry = '<table cellpadding="0" cellspacing="0" border="0" summary="">';
 169              entry    +=    '<tr><td class="chatlist col1w" align="right"><?php echo $BL['be_tab_name'] ?>:&nbsp;<'+'/td>';
 170              entry    +=    '<td class="tdbottom2"><input type="text" name="tabtitle[' + entries + ']" id="tabtitle' + entries + '" value="" class="f11b width400" /'+'><'+'/td>';
 171              entry    +=    '<td><a href="#" onclick="return deleteTab(\'tab' + entries + '\');"><img src="img/famfamfam/tab_delete.gif" alt="" border="" /><'+'/a><'+'/td><'+'/tr>';
 172              entry    +=    '<tr><td class="chatlist col1w" align="right"><?php echo $BL['be_headline'] ?>:&nbsp;<'+'/td>';
 173              entry    +=    '<td colspan="2"><input type="text" name="tabheadline[' + entries + ']" id="tabheadline' + entries + '" value="" class="v11 width400" /'+'><'+'/td><'+'/tr>';
 174              entry    +=    '<tr><td colspan="3" class="tdtop5"><textarea name="tabtext[' + entries + ']" id="tabtext' + entries + '" rows="10" class="v12" ';
 175              entry    +=    'style="width:536px;height:150px;"><'+'/textarea><'+'/td><'+'/tr><'+'/table>';
 176              
 177              var tab = new Element('li', {'id': 'tab'+entries, 'class': 'tab nomove'} ).setHTML( entry ).injectInside( $('tabs') );
 178                          
 179              if(wysiwyg) {
 180                  EnableFCK(entries);
 181              }
 182              
 183              //makeSortable();
 184      
 185              window.scrollTo(0, tab.getCoordinates()['top']);
 186              
 187              entries++;
 188              
 189          });
 190          
 191          if(wysiwyg && entries > 0) {
 192  
 193              for(x = 0; x < entries; x++) {
 194                  EnableFCK(x);
 195              }
 196          }
 197          
 198          makeSortable();
 199          
 200          /*
 201          var col1w    = $('col_1_width').getCoordinates();
 202          
 203          alert(col1w['width']);
 204          $$('td.col1w').each( function(el) {
 205              el.setStyle('width', col1w['width'] + 'px');
 206          });
 207          */
 208      
 209      });
 210      
 211  	function makeSortable() {
 212          var s = new Sortables( $('tabs'), { handles: 'em' } );
 213      }
 214      
 215  	function EnableFCK(x) {
 216  
 217          if( $('tabtext'+x) ) {
 218      
 219              FCK[x] = new FCKeditor('tabtext'+x);
 220                      
 221              FCK[x].BasePath = fckbase;
 222              FCK[x].Config['CustomConfigurationsPath'] = fckbase+'fckeditor_config.js.php';
 223              FCK[x].Config['StartupFocus'] = false;
 224              FCK[x].Width = 536;
 225              FCK[x].Height = 150;
 226              FCK[x].ToolbarSet = toolbar;    
 227                                  
 228              FCK[x].ReplaceTextarea() ;
 229          }
 230      
 231      }
 232      
 233  	function deleteTab(e) {
 234          if(confirm('<?php echo $BL['be_tab_delete_js'] ?>')) {
 235              $(e).remove();
 236          }
 237          return false;
 238      }
 239  
 240      
 241      //-->
 242      </script>
 243      </td>
 244  </tr>


Generated: Sun Jan 29 16:31:14 2012 Cross-referenced by PHPXref 0.7.1