3
* This file implements the UI view for the collection URL properties.
5
* Quam Plures - {@link http://quamplures.net/}
6
* Released under GNU GPL License - {@link http://quamplures.net/license.html}
7
* @copyright (c) 2009 - 2011 by the Quam Plures developers - {@link http://quamplures.net/}
8
* @copyright (c)2003-2009 by Francois PLANQUE - {@link http://fplanque.net/}
9
* Parts of this file are copyright (c)2004-2005 by Daniel HAHLER - {@link http://thequod.de/contact}.
11
* {@internal Open Source relicensing agreement:
12
* Daniel HAHLER grants Francois PLANQUE the right to license
13
* Daniel HAHLER's contributions to this file and the b2evolution project
14
* under any OSI approved OSS license (http://www.opensource.org/licenses/).
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.
21
* @package collections
23
if( !defined('QP_MAIN_INIT') ) die( 'Please, do not access this page directly.' );
31
* @var GeneralSettings
41
<script type="text/javascript">
42
// Script to update the Blog URL preview:
43
var blog_baseurl = '<?php echo str_replace( "'", "\'", $edited_Blog->gen_baseurl() ); ?>';
44
function update_urlpreview( baseurl )
46
if( typeof baseurl == 'string' )
48
blog_baseurl = baseurl;
50
if( document.getElementById( 'urlpreview' ).hasChildNodes() )
52
document.getElementById( 'urlpreview' ).firstChild.data = blog_baseurl;
56
document.getElementById( 'urlpreview' ).appendChild( document.createTextNode( blog_baseurl ) );
59
function show_hide_chapter_prefix(ob)
61
var fldset = document.getElementById( 'category_prefix_container' );
62
if( ob.value == 'param_num' )
64
fldset.style.display = 'none';
68
fldset.style.display = '';
75
$Form->begin_form( 'fform' );
78
$Form->hidden( 'action', 'update' );
79
$Form->hidden( 'tab', 'urls' );
80
$Form->hidden( 'blog', $edited_Blog->ID );
82
global $app_baseurl, $basedomain;
84
// determine siteurl type (if not set from update-action)
85
if( preg_match('#https?://#', $edited_Blog->get( 'siteurl' ) ) )
87
$blog_siteurl_relative = '';
88
$blog_siteurl_absolute = $edited_Blog->get( 'siteurl' );
92
$blog_siteurl_relative = $edited_Blog->get( 'siteurl' );
93
$blog_siteurl_absolute = 'http://';
96
$Form->begin_fieldset( get_manual_link( 'blog-url' ).T_('Blog URL').' ['.T_('Admin').']' );
97
if( $current_User->check_perm( 'blog_admin', 'edit', false, $edited_Blog->ID ) )
98
{ // Permission to edit advanced admin settings
99
$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 );
100
if( $default_blog_ID = $Settings->get( 'default_blog_ID' ) )
102
$Debuglog->add('Default blog is set to: '.$default_blog_ID);
103
$BlogCache = & get_Cache( 'BlogCache' );
104
if( $default_Blog = & $BlogCache->get_by_ID($default_blog_ID, false) )
105
{ // Default blog exists
106
$defblog = $default_Blog->dget('shortname');
109
$siteurl_relative_warning = '';
110
if( ! preg_match( '~(^|/|\.php.?)$~i', $blog_siteurl_relative ) )
112
$siteurl_relative_warning = ' <span class="note red">'.T_('WARNING: it is highly recommended that this ends in with a / or .php !').'</span>';
114
$siteurl_absolute_warning = '';
115
if( ! preg_match( '~(^|/|\.php.?)$~i', $blog_siteurl_absolute ) )
117
$siteurl_absolute_warning = ' <span class="note red">'.T_('WARNING: it is highly recommended that this ends in with a / or .php !').'</span>';
119
$Form->radio( 'blog_access_type', $edited_Blog->get( 'access_type' ), array(
120
array( 'default', T_('Default blog in index.php'),
121
$app_baseurl.'index.php ('.( !isset($defblog)
122
? /* TRANS: NO current default blog */ T_('No default blog is currently set')
123
: /* TRANS: current default blog */ T_('Current default :').' '.$defblog ).
126
'onclick="update_urlpreview( \''.$app_baseurl.'index.php\' );"'
128
array( 'index.php', T_('Explicit param on index.php'),
129
$app_baseurl.'index.php?blog='.$edited_Blog->ID,
131
'onclick="update_urlpreview( \''.$app_baseurl.'index.php?blog='.$edited_Blog->ID.'\' )"',
133
array( 'extrapath', T_('Extra path on index.php'),
134
$app_baseurl.'index.php/'.$edited_Blog->get( 'urlname' ),
136
'onclick="update_urlpreview( \''.$app_baseurl.'index.php/\'+document.getElementById( \'blog_urlname\' ).value )"'
138
array( 'relative', T_('Relative to baseurl').':',
140
'<span class="nobr"><code>'.$app_baseurl.'</code>'
141
.'<input type="text" id="blog_siteurl_relative" class="form_text_input" name="blog_siteurl_relative" size="35" maxlength="120" value="'
142
.format_to_output( $blog_siteurl_relative, 'formvalue' )
143
.'" onkeyup="update_urlpreview( \''.$app_baseurl.'\'+this.value );"
144
onfocus="document.getElementsByName(\'blog_access_type\')[3].checked=true;
145
update_urlpreview( \''.$app_baseurl.'\'+this.value );" /></span>'.$siteurl_relative_warning,
146
'onclick="document.getElementById( \'blog_siteurl_relative\' ).focus();"'
148
array( 'subdom', T_('Subdomain of basedomain'),
149
'http://url_name.'.$basedomain.'/',
151
'onclick="update_urlpreview( \'http://\'+document.getElementById( \'blog_urlname\' ).value+\'.'.$basedomain.'/\' )"'
153
array( 'absolute', T_('Absolute URL').':',
155
'<input type="text" id="blog_siteurl_absolute" class="form_text_input" name="blog_siteurl_absolute" size="50" maxlength="120" value="'
156
.format_to_output( $blog_siteurl_absolute, 'formvalue' )
157
.'" onkeyup="update_urlpreview( this.value );"
158
onfocus="document.getElementsByName(\'blog_access_type\')[5].checked=true;
159
update_urlpreview( this.value );" />'.$siteurl_absolute_warning,
160
'onclick="document.getElementById( \'blog_siteurl_absolute\' ).focus();"'
162
), T_('Blog base URL'), true );
164
// URL Preview (always displayed)
165
$blogurl = $edited_Blog->gen_blogurl();
166
$Form->info( T_('URL preview'), '<span id="urlpreview">'.$blogurl.'</span>' );
167
$Form->end_fieldset();
169
$Form->begin_fieldset( get_manual_link( 'main-page-post-list' ).T_('Main page / post list') );
170
$Form->checkbox( 'default_noindex', $edited_Blog->get_setting( 'default_noindex' ), T_('Default blog page'), T_('META NOINDEX') );
171
$Form->checklist( array(
172
array( 'canonical_homepage', 1, T_('301 redirect to canonical URL when possible'), $edited_Blog->get_setting( 'canonical_homepage' ) ),
173
array( 'relcanonical_homepage', 1, T_('Use rel="canonical" if not 301 redirected'), $edited_Blog->get_setting( 'relcanonical_homepage' ) ),
174
), 'canonical_homepage_options', T_('Make canonical') );
175
$Form->checkbox( 'paged_noindex', $edited_Blog->get_setting( 'paged_noindex' ), T_('"Next" blog pages'), T_('META NOINDEX').' - '.T_('Page 2,3,4...') );
176
$Form->checkbox( 'paged_nofollowto', $edited_Blog->get_setting( 'paged_nofollowto' ), '', T_('NOFOLLOW on links to').' '.T_('Page 2,3,4...') );
177
$Form->radio( 'title_link_type', $edited_Blog->get_setting( 'title_link_type' ), array(
178
array( 'permalink', T_('Link to the permanent url of the post') ),
179
array( 'linkto_url', T_('Link to the "link to URL" specified in the post (if any)') ),
180
array( 'auto', T_('Link to the "link to URL" if specified, otherwise fall back to permanent url') ),
181
array( 'none', T_('No links on titles') ),
182
), T_('Post titles'), true );
183
// TODO: checkbox display "permalink" separately from the title
184
$Form->radio( 'main_content', $edited_Blog->get_setting( 'main_content' ), array(
185
array( 'excerpt', T_('Post excerpts') ),
186
array( 'normal', T_('Standard post contents (stopping at "<!-- more -->")') ),
187
array( 'full', T_('Full post contents (including after "<!-- more -->")') ),
188
), T_('Post contents'), true );
189
$Form->radio( 'permalinks', $edited_Blog->get_setting( 'permalinks' ), array(
190
array( 'single', T_('Link to single post') ),
191
array( 'archive', T_('Link to post in archive') ),
192
array( 'subchap', T_('Link to post in sub-category') ),
193
), T_('Permalinks'), true );
194
$Form->end_fieldset();
196
$Form->begin_fieldset( get_manual_link( 'single-post-pages-permalink-pages' ).T_('Single post pages / "Permalink" pages') );
197
$Form->radio( 'single_links', $edited_Blog->get_setting( 'single_links' ), array(
198
array( 'param_num', T_('Use param: post ID'), T_('E-g: ')
199
.url_add_param( $blogurl, '<strong>p=123&more=1</strong>' ) ),
200
array( 'param_title', T_('Use param: post title'), T_('E-g: ')
201
.url_add_param( $blogurl, '<strong>title=post-title&more=1</strong>' ) ),
202
array( 'short', T_('Use extra-path: post title'), T_('E-g: ')
203
.url_add_tail( $blogurl, '<strong>/post-title</strong>' ) ),
204
array( 'y', T_('Use extra-path: year'), T_('E-g: ')
205
.url_add_tail( $blogurl, '<strong>/2006/post-title</strong>' ) ),
206
array( 'ym', T_('Use extra-path: year & month'), T_('E-g: ')
207
.url_add_tail( $blogurl, '<strong>/2006/12/post-title</strong>' ) ),
208
array( 'ymd', T_('Use extra-path: year, month & day'), T_('E-g: ')
209
.url_add_tail( $blogurl, '<strong>/2006/12/31/post-title</strong>' ) ),
210
array( 'subchap', T_('Use extra-path: sub-category'), T_('E-g: ')
211
.url_add_tail( $blogurl, '<strong>/subcat/post-title</strong>' ) ),
212
array( 'chapters', T_('Use extra-path: category path'), T_('E-g: ')
213
.url_add_tail( $blogurl, '<strong>/cat/subcat/post-title</strong>' ) ),
214
), T_('Single post URLs'), true );
215
$Form->checklist( array(
216
array( 'canonical_item_urls', 1, T_('301 redirect to canonical URL when possible'), $edited_Blog->get_setting( 'canonical_item_urls' ) ),
217
array( 'relcanonical_item_urls', 1, T_('Use rel="canonical" if not 301 redirected'), $edited_Blog->get_setting( 'relcanonical_item_urls' ) ),
218
), 'canonical_item_urls_options', T_('Make canonical') );
219
$Form->checkbox( 'excerpts_meta_description', $edited_Blog->get_setting( 'excerpts_meta_description' ), T_('Meta description'), T_('Use excerpt as meta description for posts and pages') );
220
$Form->end_fieldset();
222
$Form->begin_fieldset( get_manual_link( 'category-pages' ).T_('Category pages') );
223
$Form->radio( 'chapter_links', $edited_Blog->get_setting( 'chapter_links' ), array(
224
array( 'param_num', T_('Use param: cat ID'), T_('E-g: ')
225
.url_add_param( $blogurl, '<strong>cat=123</strong>' ),'', 'onclick="show_hide_chapter_prefix(this);"'),
226
array( 'subchap', T_('Use extra-path: sub-category'), T_('E-g: ')
227
.url_add_tail( $blogurl, '<strong>/subcat/</strong>' ), '', 'onclick="show_hide_chapter_prefix(this);"' ),
228
array( 'chapters', T_('Use extra-path: category path'), T_('E-g: ')
229
.url_add_tail( $blogurl, '<strong>/cat/subcat/</strong>' ), '', 'onclick="show_hide_chapter_prefix(this);"' ),
230
), T_('Category URLs'), true );
231
echo '<div id="category_prefix_container">';
232
$Form->text_input( 'category_prefix', $edited_Blog->get_setting( 'category_prefix' ), 30, T_('Prefix'),
233
T_('An optional prefix to be added to the URLs of the categories'), array( 'maxlength' => 120 ) );
235
if( $edited_Blog->get_setting( 'chapter_links' ) == 'param_num' )
237
<script type="text/javascript">
239
var fldset = document.getElementById( 'category_prefix_container' );
240
fldset.style.display = 'none';
245
$Form->checklist( array(
246
array( 'canonical_cat_urls', 1, T_('301 redirect to canonical URL when possible'), $edited_Blog->get_setting( 'canonical_cat_urls' ) ),
247
array( 'relcanonical_cat_urls', 1, T_('Use rel="canonical" if not 301 redirected'), $edited_Blog->get_setting( 'relcanonical_cat_urls' ) ),
248
), 'canonical_cat_urls_options', T_('Make canonical') );
249
$Form->checkbox( 'chapter_noindex', $edited_Blog->get_setting( 'chapter_noindex' ), T_('Indexing'), T_('META NOINDEX') );
250
$Form->radio( 'chapter_content', $edited_Blog->get_setting( 'chapter_content' ), array(
251
array( 'excerpt', T_('Post excerpts') ),
252
array( 'normal', T_('Standard post contents (stopping at "<!-- more -->")') ),
253
array( 'full', T_('Full post contents (including after "<!-- more -->")') ),
254
), T_('Post contents'), true );
255
$Form->text( 'chapter_posts_per_page', $edited_Blog->get_setting( 'chapter_posts_per_page' ), 4, T_('Posts per page'),
256
T_('Leave empty to use blog default').' ('.$edited_Blog->get_setting( 'posts_per_page' ).')', 4 );
257
$Form->checkbox( 'catdir_noindex', $edited_Blog->get_setting( 'catdir_noindex' ), T_('Category directory'), T_('META NOINDEX') );
258
$Form->checkbox( 'categories_meta_description', $edited_Blog->get_setting( 'categories_meta_description' ),
259
T_('Meta description'), T_('Use category description as meta description for category pages') );
260
$Form->end_fieldset();
262
$Form->begin_fieldset( get_manual_link( 'tag-pages' ).T_('Tag pages'), array('id'=>'tag_links_fieldset') );
263
$Form->radio( 'tag_links', $edited_Blog->get_setting( 'tag_links' ), array(
264
array( 'param', T_('Use param'), T_('E-g: ')
265
.url_add_param( $blogurl, '<strong>tag=mytag</strong>' ) ),
266
array( 'prefix-only', T_('Use extra-path').': '.'Use URL path prefix only (recommended)', T_('E-g: ')
267
.url_add_tail( $blogurl, '<strong>/<span class="tag_links_tag_prefix"></span>mytag</strong>' ) ),
268
array( 'dash', T_('Use extra-path').': '.'trailing dash', T_('E-g: ')
269
.url_add_tail( $blogurl, '<strong>/<span class="tag_links_tag_prefix"></span>mytag-</strong>' ) ),
270
array( 'colon', T_('Use extra-path').': '.'trailing colon', T_('E-g: ')
271
.url_add_tail( $blogurl, '<strong>/<span class="tag_links_tag_prefix"></span>mytag:</strong>' ) ),
272
array( 'semicolon', T_('Use extra-path').': '.'trailing semi-colon (NOT recommended)', T_('E-g: ')
273
.url_add_tail( $blogurl, '<strong>/<span class="tag_links_tag_prefix"></span>mytag;</strong>' ) ),
274
), T_('Tag page URLs'), true );
275
$Form->text_input( 'tag_prefix', $edited_Blog->get_setting( 'tag_prefix' ), 30, T_('Prefix'),
276
T_('An optional prefix to be added to the URLs of the tag pages'),
277
array( 'maxlength' => 120 ) );
278
$Form->checkbox( 'tag_rel_attrib', $edited_Blog->get_setting( 'tag_rel_attrib' ), T_('Rel attribute'),
279
sprintf( T_('Add <a %s>rel="tag" attribute</a> to tag links.'), 'href="http://microformats.org/wiki/rel-tag"' ) );
280
$Form->checklist( array(
281
array( 'canonical_tag_urls', 1, T_('301 redirect to canonical URL when possible'), $edited_Blog->get_setting( 'canonical_tag_urls' ) ),
282
array( 'relcanonical_tag_urls', 1, T_('Use rel="canonical" if not 301 redirected'), $edited_Blog->get_setting( 'relcanonical_tag_urls' ) ),
283
), 'canonical_tag_urls_options', T_('Make canonical') );
284
$Form->checkbox( 'tag_noindex', $edited_Blog->get_setting( 'tag_noindex' ), T_('Indexing'), T_('META NOINDEX') );
285
$Form->radio( 'tag_content', $edited_Blog->get_setting( 'tag_content' ), array(
286
array( 'excerpt', T_('Post excerpts') ),
287
array( 'normal', T_('Standard post contents (stopping at "<!-- more -->")') ),
288
array( 'full', T_('Full post contents (including after "<!-- more -->")') ),
289
), T_('Post contents'), true );
290
$Form->text( 'tag_posts_per_page', $edited_Blog->get_setting( 'tag_posts_per_page' ), 4, T_('Posts per page'),
291
T_('Leave empty to use blog default').' ('.$edited_Blog->get_setting( 'posts_per_page' ).')', 4 );
292
$Form->end_fieldset();
294
// Javascript juice for the tag fields.
296
<script type="text/javascript">
297
jQuery("#tag_links_fieldset input[type=radio]").click( function()
299
// Disable tag_prefix, if "param" is used.
300
jQuery('#tag_prefix').attr("disabled", this.value == 'param' ? "disabled" : "");
301
// Disable tag_rel_attrib, if "prefix-only" is not used.
302
jQuery('#tag_rel_attrib').attr("disabled", this.value == 'prefix-only' ? "" : "disabled");
303
// NOTE: dh> ".closest('fieldset').andSelf()" is required for the add-field_required-class-to-fieldset-hack. Remove as appropriate.
304
if( this.value == 'prefix-only' )
305
jQuery('#tag_prefix').closest('fieldset').andSelf().addClass('field_required');
307
jQuery('#tag_prefix').closest('fieldset').andSelf().removeClass('field_required');
308
} ).filter(":checked").click();
309
// Set text of span.tag_links_tag_prefix according to this field, defaulting to "tag" for "prefix-only".
310
jQuery("#tag_prefix").keyup( function() {
311
jQuery("span.tag_links_tag_prefix").each(
313
var newval = ((jQuery("#tag_prefix").val().length || jQuery(this).closest("div").find("input[type=radio]").attr("value") != "prefix-only") ? jQuery("#tag_prefix").val() : "tag");
314
if( newval.length ) newval += "/";
315
jQuery(this).text( newval );
321
$Form->begin_fieldset( get_manual_link( 'by-date-archives' ).T_('"By date" archives') );
322
$Form->radio( 'archive_links', $edited_Blog->get_setting( 'archive_links' ), array(
323
array( 'param', T_('Use param'), T_('E-g: ').url_add_param( $blogurl, '<strong>m=20071231</strong>' ) ),
324
array( 'extrapath', T_('Use extra-path'), T_('E-g: ').url_add_tail( $blogurl, '<strong>/2007/12/31/</strong>' ) ),
325
), T_('Date archive URLs'), true );
326
$Form->checklist( array(
327
array( 'canonical_archive_urls', 1, T_('301 redirect to canonical URL when possible'), $edited_Blog->get_setting( 'canonical_archive_urls' ) ),
328
array( 'relcanonical_archive_urls', 1, T_('Use rel="canonical" if not 301 redirected'), $edited_Blog->get_setting( 'relcanonical_archive_urls' ) ),
329
), 'canonical_archive_urls_options', T_('Make canonical') );
330
$Form->checkbox( 'archive_noindex', $edited_Blog->get_setting( 'archive_noindex' ), T_('Indexing'), T_('META NOINDEX') );
331
$Form->checkbox( 'archive_nofollowto', $edited_Blog->get_setting( 'archive_nofollowto' ), T_('Follow TO'), T_('NOFOLLOW on links to').' '.T_('date archives') );
332
$Form->radio( 'archive_content', $edited_Blog->get_setting( 'archive_content' ), array(
333
array( 'excerpt', T_('Post excerpts') ),
334
array( 'normal', T_('Standard post contents (stopping at "<!-- more -->")') ),
335
array( 'full', T_('Full post contents (including after "<!-- more -->")') ),
336
), T_('Post contents'), true );
337
$Form->text( 'archive_posts_per_page', $edited_Blog->get_setting( 'archive_posts_per_page' ), 4, T_('Posts per page'),
338
T_('Leave empty to use blog default').' ('.$edited_Blog->get_setting( 'posts_per_page' ).')', 4 );
339
$Form->checkbox( 'arcdir_noindex', $edited_Blog->get_setting( 'arcdir_noindex' ), T_('Archive directory'), T_('META NOINDEX') );
340
$Form->end_fieldset();
342
$Form->begin_fieldset( get_manual_link( 'other-filtered-pages' ).T_('Other filtered pages') );
343
$Form->checkbox( 'filtered_noindex', $edited_Blog->get_setting( 'filtered_noindex' ), T_('Other filtered posts pages'), T_('META NOINDEX').' - '.T_('Filtered by keyword search, by author, etc.') );
344
$Form->radio( 'filtered_content', $edited_Blog->get_setting( 'filtered_content' ), array(
345
array( 'excerpt', T_('Post excerpts') ),
346
array( 'normal', T_('Standard post contents (stopping at "<!-- more -->")') ),
347
array( 'full', T_('Full post contents (including after "<!-- more -->")') ),
348
), T_('Post contents'), true );
349
$Form->end_fieldset();
351
$Form->begin_fieldset( get_manual_link( 'other-pages' ).T_('Other pages') );
352
$Form->checkbox( 'feedback-popup_noindex', $edited_Blog->get_setting( 'feedback-popup_noindex' ), T_('Comment popups'),
353
T_('META NOINDEX').' - '.T_('For templates with comment popups only.') );
354
$Form->checkbox( 'msgform_noindex', $edited_Blog->get_setting( 'msgform_noindex' ), T_('Contact forms'),
355
T_('META NOINDEX').' - '.T_('WARNING: Letting search engines index contact forms will attract spam.') );
356
$Form->checkbox( 'special_noindex', $edited_Blog->get_setting( 'special_noindex' ), T_('Other special pages'),
357
T_('META NOINDEX').' - '.T_('Pages with no index setting of their own... yet.') );
358
$Form->radio( '404_response', $edited_Blog->get_setting( '404_response' ), array(
359
array( '200', T_('200 "OK" response') ),
360
array( '301', T_('301 redirect to main page') ),
361
array( '302', T_('302 redirect to main page') ),
362
array( '303', T_('303 redirect to main page') ),
363
array( '404', T_('404 "Not found" response') ),
364
array( '410', T_('410 "Gone" response') ),
365
), T_('404 "Not Found" response'), true );
366
$Form->end_fieldset();
368
$Form->buttons( array(
369
array( 'submit', 'submit', T_('Update'), 'SaveButton' ),
370
array( 'reset', '', T_('Reset'), 'ResetButton' ),