[ Index ]
 

Code source de b2evolution 2.1.0-beta

Accédez au Source d'autres logiciels libres

Classes | Fonctions | Variables | Constantes | Tables

title

Body

[fermer]

/blogs/inc/collections/views/ -> _coll_urls.form.php (source)

   1  <?php
   2  /**

   3   * This file implements the UI view for the collection URL properties.

   4   *

   5   * b2evolution - {@link http://b2evolution.net/}

   6   * Released under GNU GPL License - {@link http://b2evolution.net/about/license.html}

   7   * @copyright (c)2003-2007 by Francois PLANQUE - {@link http://fplanque.net/}

   8   * Parts of this file are copyright (c)2004-2005 by Daniel HAHLER - {@link http://thequod.de/contact}.

   9   *

  10   * {@internal Open Source relicensing agreement:

  11   * Daniel HAHLER grants Francois PLANQUE the right to license

  12   * Daniel HAHLER's contributions to this file and the b2evolution project

  13   * under any OSI approved OSS license (http://www.opensource.org/licenses/).

  14   * }}

  15   *

  16   * @package admin

  17   * {@internal Below is a list of authors who have contributed to design/coding of this file: }}

  18   * @author blueyed: Daniel HAHLER

  19   * @author fplanque: Francois PLANQUE.

  20   *

  21   * @version $Id: _coll_urls.form.php,v 1.9 2007/11/03 04:56:03 fplanque Exp $

  22   */
  23  if( !defined('EVO_MAIN_INIT') ) die( 'Please, do not access this page directly.' );
  24  
  25  /**

  26   * @var Blog

  27   */
  28  global $edited_Blog;
  29  /**

  30   * @var GeneralSettings

  31   */
  32  global $Settings;
  33  /**

  34   * @var Log

  35   */
  36  global $Debuglog;
  37  
  38  ?>
  39  <script type="text/javascript">
  40      <!--
  41      // Script to update the Blog URL preview:

  42      var blog_baseurl = '<?php echo str_replace( "'", "\'", $edited_Blog->gen_baseurl() ); ?>';
  43  
  44  	function update_urlpreview( baseurl )
  45      {
  46          if( typeof baseurl == 'string' )
  47          {
  48              blog_baseurl = baseurl;
  49          }
  50  
  51          if( document.getElementById( 'urlpreview' ).hasChildNodes() )
  52          {
  53              document.getElementById( 'urlpreview' ).firstChild.data = blog_baseurl;
  54          }
  55          else
  56          {
  57              document.getElementById( 'urlpreview' ).appendChild( document.createTextNode( blog_baseurl ) );
  58          }
  59      }
  60  
  61  	function show_hide_chapter_prefix(ob)
  62      {
  63          var fldset = document.getElementById( 'category_prefix_container' );
  64          if( ob.value == 'param_num' )
  65          {
  66              fldset.style.display = 'none';
  67          }
  68          else
  69          {
  70              fldset.style.display = '';
  71          }
  72      }
  73      //-->

  74  </script>
  75  
  76  
  77  <?php
  78  
  79  global $blog, $tab;
  80  
  81  $Form = new Form();
  82  
  83  $Form->begin_form( 'fform' );
  84  
  85  $Form->hidden_ctrl();
  86  $Form->hidden( 'action', 'update' );
  87  $Form->hidden( 'tab', $tab );
  88  $Form->hidden( 'blog', $blog );
  89  
  90  
  91  global $baseurl, $basedomain;
  92  
  93  // determine siteurl type (if not set from update-action)

  94  if( preg_match('#https?://#', $edited_Blog->get( 'siteurl' ) ) )
  95  { // absolute
  96      $blog_siteurl_relative = '';
  97      $blog_siteurl_absolute = $edited_Blog->get( 'siteurl' );
  98  }
  99  else
 100  { // relative
 101      $blog_siteurl_relative = $edited_Blog->get( 'siteurl' );
 102      $blog_siteurl_absolute = 'http://';
 103  }
 104  
 105  $Form->begin_fieldset( T_('Blog URL').' ['.T_('Admin').']' );
 106  
 107      if( $current_User->check_perm( 'blog_admin', 'edit', false, $edited_Blog->ID ) )
 108      {    // Permission to edit advanced admin settings
 109  
 110          $Form->text( 'blog_urlname', $edited_Blog->get( 'urlname' ), 20, T_('Blog URL name'), T_('Used to uniquely identify this blog. Appears in URLs and gets used as default for the media location (see the advanced tab).'), 255 );
 111  
 112          if( $default_blog_ID = $Settings->get('default_blog_ID') )
 113          {
 114              $Debuglog->add('Default blog is set to: '.$default_blog_ID);
 115              $BlogCache = & get_Cache( 'BlogCache' );
 116              if( $default_Blog = & $BlogCache->get_by_ID($default_blog_ID, false) )
 117              { // Default blog exists
 118                  $defblog = $default_Blog->dget('shortname');
 119              }
 120          }
 121  
 122          $siteurl_relative_warning = '';
 123           if( ! preg_match( '~(^|/|\.php.?)$~i', $blog_siteurl_relative ) )
 124           {
 125              $siteurl_relative_warning = ' <span class="note red">'.T_('WARNING: it is highly recommended that this ends in with a / or .php !').'</span>';
 126          }
 127  
 128          $siteurl_absolute_warning = '';
 129           if( ! preg_match( '~(^|/|\.php.?)$~i', $blog_siteurl_absolute ) )
 130           {
 131              $siteurl_absolute_warning = ' <span class="note red">'.T_('WARNING: it is highly recommended that this ends in with a / or .php !').'</span>';
 132          }
 133  
 134  
 135          $Form->radio( 'blog_access_type', $edited_Blog->get( 'access_type' ), array(
 136              array( 'default', T_('Default blog in index.php'),
 137                                              '('.( !isset($defblog)
 138                                                  ?    /* TRANS: NO current default blog */ T_('No default blog is currently set')
 139                                                  : /* TRANS: current default blog */ T_('Current default :').' '.$defblog ).
 140                                              ')',
 141                                          '',
 142                                          'onclick="update_urlpreview( \''.$baseurl.'index.php\' );"'
 143              ),
 144              array( 'index.php', T_('Explicit param on index.php'),
 145                                          'index.php?blog=123',
 146                                          '',
 147                                          'onclick="update_urlpreview( \''.$baseurl.'index.php?blog='.$edited_Blog->ID.'\' )"',
 148              ),
 149              array( 'extrapath', T_('Extra path on index.php'),
 150                                          'index.php/url_name',
 151                                          '',
 152                                          'onclick="update_urlpreview( \''.$baseurl.'index.php/\'+document.getElementById( \'blog_urlname\' ).value )"'
 153              ),
 154              array( 'relative', T_('Relative to baseurl').':',
 155                                          '',
 156                                          '<span class="nobr"><code>'.$baseurl.'</code>'
 157                                          .'<input type="text" id="blog_siteurl_relative" class="form_text_input" name="blog_siteurl_relative" size="35" maxlength="120" value="'
 158                                          .format_to_output( $blog_siteurl_relative, 'formvalue' )
 159                                          .'" onkeyup="update_urlpreview( \''.$baseurl.'\'+this.value );"
 160                                          onfocus="document.getElementsByName(\'blog_access_type\')[3].checked=true;
 161                                          update_urlpreview( \''.$baseurl.'\'+this.value );" /></span>'.$siteurl_relative_warning,
 162                                          'onclick="document.getElementById( \'blog_siteurl_relative\' ).focus();"'
 163              ),
 164              array( 'subdom', T_('Subdomain of basedomain'),
 165                                          'http://url_name.'.$basedomain.'/',
 166                                          '',
 167                                          'onclick="update_urlpreview( \'http://\'+document.getElementById( \'blog_urlname\' ).value+\'.'.$basedomain.'/\' )"'
 168              ),
 169              array( 'absolute', T_('Absolute URL').':',
 170                                          '',
 171                                          '<input type="text" id="blog_siteurl_absolute" class="form_text_input" name="blog_siteurl_absolute" size="50" maxlength="120" value="'
 172                                              .format_to_output( $blog_siteurl_absolute, 'formvalue' )
 173                                              .'" onkeyup="update_urlpreview( this.value );"
 174                                              onfocus="document.getElementsByName(\'blog_access_type\')[5].checked=true;
 175                                              update_urlpreview( this.value );" />'.$siteurl_absolute_warning,
 176                                          'onclick="document.getElementById( \'blog_siteurl_absolute\' ).focus();"'
 177              ),
 178          ), T_('Blog base URL'), true );
 179  
 180      }
 181  
 182      // URL Preview 'always displayed)

 183      $blogurl = $edited_Blog->gen_blogurl();
 184      $Form->info( T_('URL preview'), '<span id="urlpreview">'.$blogurl.'</span>' );
 185  
 186  $Form->end_fieldset();
 187  
 188  
 189  $Form->begin_fieldset( T_('Archive URLs') );
 190  
 191      $Form->radio( 'archive_links', $edited_Blog->get_setting('archive_links'),
 192          array(
 193                  array( 'param', T_('Use param'), T_('Archive links will look like ')
 194                                  .url_add_param( $blogurl, 'm=20071231' ) ),
 195                  array( 'extrapath', T_('Use extra-path'), T_('Archive links will look like ' )
 196                                  .url_add_tail( $blogurl, '/2007/12/31/' ) ),
 197              ), T_('Archive links'), true );
 198  
 199  $Form->end_fieldset();
 200  
 201  
 202  $Form->begin_fieldset( T_('Category URLs') );
 203  
 204      $Form->radio( 'chapter_links', $edited_Blog->get_setting('chapter_links'),
 205          array(
 206                  array( 'param_num', T_('Use param: cat ID'), T_('Category links will look like ')
 207                                  .url_add_param( $blogurl, 'cat=123' ),'', 'onclick="show_hide_chapter_prefix(this);"'),
 208                  array( 'subchap', T_('Use extra-path: sub-category'), T_('Category links will look like ' )
 209                                  .url_add_tail( $blogurl, '/subcat/' ), '', 'onclick="show_hide_chapter_prefix(this);"' ),
 210                  array( 'chapters', T_('Use extra-path: category path'), T_('Category links will look like ' )
 211                                  .url_add_tail( $blogurl, '/cat/subcat/' ), '', 'onclick="show_hide_chapter_prefix(this);"' ),
 212              ), T_('Category links'), true );
 213  
 214  
 215      echo '<div id="category_prefix_container">';
 216          $Form->text_input( 'category_prefix', $edited_Blog->get_setting( 'category_prefix' ), 30, T_('Prefix'),
 217                                                      T_('A optional prefix to be added to the URLs of the categories'),
 218                                                      array('maxlength' => 120) );
 219      echo '</div>';
 220      if( $edited_Blog->get_setting( 'chapter_links' ) == 'param_num' )
 221      { ?>
 222      <script type="text/javascript">
 223          <!--
 224          var fldset = document.getElementById( 'category_prefix_container' );
 225          fldset.style.display = 'none';
 226          //-->

 227      </script>
 228      <?php
 229      }
 230  
 231  $Form->end_fieldset();
 232  
 233  
 234  $Form->begin_fieldset( T_('Single post URLs') );
 235  
 236      $Form->radio( 'single_links', $edited_Blog->get_setting('single_links'),
 237          array(
 238                array( 'param_num', T_('Use param: post ID'), T_('Links will look like: \'stub?p=123&amp;c=1&amp;tb=1&amp;pb=1&amp;more=1\'') ),
 239                array( 'param_title', T_('Use param: post title'), T_('Links will look like: \'stub?title=post-title&amp;c=1&amp;tb=1&amp;pb=1&amp;more=1\'') ),
 240                  array( 'short', T_('Use extra-path: post title'), T_('Links will look like \'stub/post-title\'' ) ),
 241                  array( 'y', T_('Use extra-path: year'), T_('Links will look like \'stub/2006/post-title\'' ) ),
 242                  array( 'ym', T_('Use extra-path: year & month'), T_('Links will look like \'stub/2006/12/post-title\'' ) ),
 243                  array( 'ymd', T_('Use extra-path: year, month & day'), T_('Links will look like \'stub/2006/12/31/post-title\'' ) ),
 244                  array( 'subchap', T_('Use extra-path: sub-category'), T_('Links will look like \'stub/subcat/post-title\'' ) ),
 245                  array( 'chapters', T_('Use extra-path: category path'), T_('Links will look like \'stub/cat/subcat/post-title\'' ) ),
 246              ), T_('Single post links'), true,
 247              T_('For example, single post links are used when viewing comments for a post. May be used for permalinks - see below.') );
 248              // fp> TODO: check where we really need to force single and where we could use any permalink

 249  
 250  $Form->end_fieldset();
 251  
 252  
 253  $Form->buttons( array( array( 'submit', 'submit', T_('Save !'), 'SaveButton' ),
 254                                                      array( 'reset', '', T_('Reset'), 'ResetButton' ) ) );
 255  
 256  $Form->end_form();
 257  
 258  /*

 259   * $Log: _coll_urls.form.php,v $

 260   * Revision 1.9  2007/11/03 04:56:03  fplanque

 261   * permalink / title links cleanup

 262   *

 263   * Revision 1.8  2007/11/02 02:39:07  fplanque

 264   * refactored blog settings / UI

 265   *

 266   * Revision 1.7  2007/10/08 08:31:59  fplanque

 267   * nicer forms

 268   *

 269   * Revision 1.6  2007/10/06 21:17:26  fplanque

 270   * cleanup

 271   *

 272   * Revision 1.5  2007/10/04 00:44:21  waltercruz

 273   * Not erasing category prefix in javascript.

 274   *

 275   * Revision 1.4  2007/10/01 13:41:07  waltercruz

 276   * Category prefix, trying to make the code more b2evo style

 277   *

 278   * Revision 1.3  2007/09/29 01:50:50  fplanque

 279   * temporary rollback; waiting for new version

 280   *

 281   * Revision 1.1  2007/06/25 10:59:38  fplanque

 282   * MODULES (refactored MVC)

 283   *

 284   * Revision 1.10  2007/05/29 01:17:20  fplanque

 285   * advanced admin blog settings are now restricted by a special permission

 286   *

 287   * Revision 1.9  2007/05/28 15:18:30  fplanque

 288   * cleanup

 289   *

 290   * Revision 1.8  2007/05/28 01:35:23  fplanque

 291   * fixed static page generation

 292   *

 293   * Revision 1.7  2007/04/26 00:11:05  fplanque

 294   * (c) 2007

 295   *

 296   * Revision 1.6  2007/03/25 15:07:38  fplanque

 297   * multiblog fixes

 298   *

 299   * Revision 1.5  2007/03/25 13:20:52  fplanque

 300   * cleaned up blog base urls

 301   * needs extensive testing...

 302   *

 303   * Revision 1.4  2007/03/24 20:41:16  fplanque

 304   * Refactored a lot of the link junk.

 305   * Made options blog specific.

 306   * Some junk still needs to be cleaned out. Will do asap.

 307   *

 308   * Revision 1.3  2007/01/23 08:06:25  fplanque

 309   * Simplified!!!

 310   *

 311   * Revision 1.2  2006/12/11 00:32:26  fplanque

 312   * allow_moving_chapters stting moved to UI

 313   * chapters are now called categories in the UI

 314   */
 315  ?>


Généré le : Thu Nov 29 23:58:50 2007 par Balluche grâce à PHPXref 0.7
  Clicky Web Analytics