[Customisation Database Commits] r285 - in /trunk/titania: .htaccess contributions/faq.php includes/core/url.php includes/objects/faq.php styles/default/template/contributions/contribution_faq.html
Nathan Guse
exreaction at phpbb.com
Fri Jul 10 23:55:33 UTC 2009
Author: exreaction
Date: Fri Jul 10 23:55:31 2009
New Revision: 285
Log:
A few tweaks to the urls/faq
Modified:
trunk/titania/.htaccess
trunk/titania/contributions/faq.php
trunk/titania/includes/core/url.php
trunk/titania/includes/objects/faq.php
trunk/titania/styles/default/template/contributions/contribution_faq.html
Modified: trunk/titania/.htaccess
==============================================================================
*** trunk/titania/.htaccess (original)
--- trunk/titania/.htaccess Fri Jul 10 23:55:31 2009
***************
*** 10,36 ****
RewriteEngine on
#authors
RewriteCond %{REQUEST_FILENAME} !-f
! Rewriterule ^(authors?)/([^/]+)/?([^/]+)?/?$ ./authors/index.php?u=$2&page=$3 [NC]
#contributions
RewriteCond %{REQUEST_FILENAME} !-f
! Rewriterule ^(mod|style|snippet|translation|contributions?)/([^/]+)/?([^/]+)?/?$ ./contributions/index.php?c=$2&page=$3 [NC]
!
! #faq
! RewriteCond %{REQUEST_FILENAME} !-f
! Rewriterule ^(mod|style|snippet|translation|contributions?)/([^/]+)/faq/([^/]+)?/?$ ./contributions/index.php?c=$2&page=faq&action=$3 [NC]
! Rewriterule ^(mod|style|snippet|translation|contributions?)/([^/]+)/faq/([^/]+)/?([^/]+)?/?$ ./contributions/index.php?c=$2&page=faq&f=$3&action=$4 [NC]
#rating
RewriteCond %{REQUEST_FILENAME} !-f
! Rewriterule ^rate/?([^/]+)?$ ./index.php?action=rate [NC]
#categories
RewriteCond %{REQUEST_FILENAME} !-f
! Rewriterule ^([^/]+)/([^/]+)/([^/]+)/?$ ./index.php?c=$3 [NC]
RewriteCond %{REQUEST_FILENAME} !-f
! Rewriterule ^([^/]+)/([^/]+)/?$ ./index.php?c=$2 [NC]
RewriteCond %{REQUEST_FILENAME} !-f
! Rewriterule ^([^/]+)/?$ ./index.php?c=$1 [NC]
--- 10,37 ----
RewriteEngine on
+ ##
+ # URL's should end in ([^/]+)?
+ # The last section is used for additional information in the URL (sid, style, action, etc)
+ # It is handled internally, so you do not need to pass it to anything.
+ ##
+
#authors
RewriteCond %{REQUEST_FILENAME} !-f
! Rewriterule ^authors?/([^/]+)/?([^/]+)?/?([^/]+)?$ ./authors/index.php?u=$1&page=$2 [NC]
#contributions
RewriteCond %{REQUEST_FILENAME} !-f
! Rewriterule ^(mod|style|snippet|translation|contributions?)/([^/]+)/?([^/]+)?/?([^/]+)?$ ./contributions/index.php?c=$2&page=$3 [NC]
#rating
RewriteCond %{REQUEST_FILENAME} !-f
! Rewriterule ^rate/?([^/]+)?$ ./index.php?action=rate [NC]
#categories
RewriteCond %{REQUEST_FILENAME} !-f
! Rewriterule ^([^/]+)/([^/]+)/([^/]+)/?([^/]+)?$ ./index.php?c=$3 [NC]
RewriteCond %{REQUEST_FILENAME} !-f
! Rewriterule ^([^/]+)/([^/]+)/?([^/]+)?$ ./index.php?c=$2 [NC]
RewriteCond %{REQUEST_FILENAME} !-f
! Rewriterule ^([^/]+)/?([^/]+)?$ ./index.php?c=$1 [NC]
Modified: trunk/titania/contributions/faq.php
==============================================================================
*** trunk/titania/contributions/faq.php (original)
--- trunk/titania/contributions/faq.php Fri Jul 10 23:55:31 2009
***************
*** 89,95 ****
$faq->submit();
$message = ($action == 'edit') ? phpbb::$user->lang['FAQ_EDITED'] : phpbb::$user->lang['FAQ_CREATED'];
! $message .= '<br /><br />' . sprintf(phpbb::$user->lang['RETURN_FAQ'], '<a href="' . $faq->get_url('details') . '">', '</a>');
$message .= '<br /><br />' . sprintf(phpbb::$user->lang['RETURN_FAQ_LIST'], '<a href="' . titania::$contrib->get_url('faq') . '">', '</a>');
trigger_error($message);
--- 89,95 ----
$faq->submit();
$message = ($action == 'edit') ? phpbb::$user->lang['FAQ_EDITED'] : phpbb::$user->lang['FAQ_CREATED'];
! $message .= '<br /><br />' . sprintf(phpbb::$user->lang['RETURN_FAQ'], '<a href="' . $faq->get_url() . '">', '</a>');
$message .= '<br /><br />' . sprintf(phpbb::$user->lang['RETURN_FAQ_LIST'], '<a href="' . titania::$contrib->get_url('faq') . '">', '</a>');
trigger_error($message);
***************
*** 149,179 ****
break;
! case 'details':
!
! titania::page_header('FAQ_DETAILS');
!
! if ($faq->faq_access < titania::$access_level)
{
! trigger_error('NOT_AUTHORISED');
! }
!
! // increase a FAQ views counter
! $faq->increase_views_counter();
! phpbb::$template->assign_vars(array(
! 'FAQ_SUBJECT' => $faq->faq_subject,
! 'FAQ_TEXT' => $faq->get_faq_text(),
! 'FAQ_VIEWS' => $faq->faq_views,
! 'S_DETAILS' => true,
! 'U_EDIT_FAQ' => (titania::$contrib->is_author || phpbb::$auth->acl_get('titania_faq_edit')) ? $faq->get_url('edit') : false,
! ));
! case 'list':
! default:
titania::page_header('FAQ_LIST');
// Titania's access
--- 149,177 ----
break;
! default:
! if ($faq_id)
{
! titania::page_header('FAQ_DETAILS');
! if ($faq->faq_access < titania::$access_level)
! {
! trigger_error('NOT_AUTHORISED');
! }
! // increase a FAQ views counter
! $faq->increase_views_counter();
! phpbb::$template->assign_vars(array(
! 'FAQ_SUBJECT' => $faq->faq_subject,
! 'FAQ_TEXT' => $faq->get_faq_text(),
! 'FAQ_VIEWS' => $faq->faq_views,
! 'S_DETAILS' => true,
+ 'U_EDIT_FAQ' => (titania::$contrib->is_author || phpbb::$auth->acl_get('titania_faq_edit')) ? $faq->get_url('edit') : false,
+ ));
+ }
titania::page_header('FAQ_LIST');
// Titania's access
***************
*** 201,207 ****
while ($row = phpbb::$db->sql_fetchrow($result))
{
phpbb::$template->assign_block_vars('faqlist', array(
! 'U_FAQ' => $faq->get_url('details', $row['faq_id']),
'SUBJECT' => $row['faq_subject'],
'VIEWS' => $row['faq_views'],
--- 199,205 ----
while ($row = phpbb::$db->sql_fetchrow($result))
{
phpbb::$template->assign_block_vars('faqlist', array(
! 'U_FAQ' => $faq->get_url('', $row['faq_id']),
'SUBJECT' => $row['faq_subject'],
'VIEWS' => $row['faq_views'],
Modified: trunk/titania/includes/core/url.php
==============================================================================
*** trunk/titania/includes/core/url.php (original)
--- trunk/titania/includes/core/url.php Fri Jul 10 23:55:31 2009
***************
*** 87,92 ****
--- 87,98 ----
// Now clean and append the items
foreach ($params as $name => $value)
{
+ if ($name == '#')
+ {
+ $anchor = '#' . $value;
+ continue;
+ }
+
if (substr($url, -1) != '/')
{
$url .= $this->separator;
Modified: trunk/titania/includes/objects/faq.php
==============================================================================
*** trunk/titania/includes/objects/faq.php (original)
--- trunk/titania/includes/objects/faq.php Fri Jul 10 23:55:31 2009
***************
*** 57,71 ****
{
// Configure object properties
$this->object_config = array_merge($this->object_config, array(
! 'faq_id' => array('default' => 0),
'contrib_id' => array('default' => 0),
'faq_order_id' => array('default' => 0),
'faq_subject' => array('default' => '', 'max' => 255),
! 'faq_text' => array('default' => ''),
'faq_text_bitfield' => array('default' => '', 'readonly' => true),
'faq_text_uid' => array('default' => '', 'readonly' => true),
'faq_text_options' => array('default' => 7, 'readonly' => true),
! 'faq_views' => array('default' => 0),
'faq_access' => array('default' => 2),
));
--- 57,71 ----
{
// Configure object properties
$this->object_config = array_merge($this->object_config, array(
! 'faq_id' => array('default' => 0),
'contrib_id' => array('default' => 0),
'faq_order_id' => array('default' => 0),
'faq_subject' => array('default' => '', 'max' => 255),
! 'faq_text' => array('default' => ''),
'faq_text_bitfield' => array('default' => '', 'readonly' => true),
'faq_text_uid' => array('default' => '', 'readonly' => true),
'faq_text_options' => array('default' => 7, 'readonly' => true),
! 'faq_views' => array('default' => 0),
'faq_access' => array('default' => 2),
));
***************
*** 267,282 ****
*
* @return string
*/
! public function get_url($action, $faq_id = false)
{
$url = titania::$contrib->get_url('faq');
if ($action == 'create')
{
return titania::$url->append_url($url, array('action' => $action));
}
! return titania::$url->append_url($url, array('action' => $action, 'f' => (($faq_id) ? $faq_id : $this->faq_id)));
}
/*
--- 267,287 ----
*
* @return string
*/
! public function get_url($action = '', $faq_id = false)
{
$url = titania::$contrib->get_url('faq');
+ $faq_id = (($faq_id) ? $faq_id : $this->faq_id);
if ($action == 'create')
{
return titania::$url->append_url($url, array('action' => $action));
}
+ else if (!$action)
+ {
+ return titania::$url->append_url($url, array('f' => $faq_id, '#' => 'details'));
+ }
! return titania::$url->append_url($url, array('action' => $action, 'f' => $faq_id));
}
/*
Modified: trunk/titania/styles/default/template/contributions/contribution_faq.html
==============================================================================
*** trunk/titania/styles/default/template/contributions/contribution_faq.html (original)
--- trunk/titania/styles/default/template/contributions/contribution_faq.html Fri Jul 10 23:55:31 2009
***************
*** 14,20 ****
<!-- BEGIN faqlist -->
<li>
<dl>
! <dt style="float:left; display: block; width: 70%"><a href="{faqlist.U_FAQ}#f{faqlist.S_ROW_COUNT}">{faqlist.SUBJECT}</a><dt>
<dd style="margin-left: 71%; text-align: right">
<!-- IF faqlist.U_MOVE_UP -->
<!-- IF faqlist.S_FIRST_ROW -->{ICON_MOVE_UP_DISABLED} <!-- ELSE --><a href="{faqlist.U_MOVE_UP}">{ICON_MOVE_UP}</a> <!-- ENDIF -->
--- 14,20 ----
<!-- BEGIN faqlist -->
<li>
<dl>
! <dt style="float:left; display: block; width: 70%"><a href="{faqlist.U_FAQ}">{faqlist.SUBJECT}</a><dt>
<dd style="margin-left: 71%; text-align: right">
<!-- IF faqlist.U_MOVE_UP -->
<!-- IF faqlist.S_FIRST_ROW -->{ICON_MOVE_UP_DISABLED} <!-- ELSE --><a href="{faqlist.U_MOVE_UP}">{ICON_MOVE_UP}</a> <!-- ENDIF -->
***************
*** 35,63 ****
<span class="corners-bottom"><span></span></span>
</div>
<hr class="dashed" style="margin-bottom: 10px;" />
!
<!-- IF S_DETAILS -->
! <a name="f{S_ROW_COUNT}"></a>
<div class="faq-item" id="f{S_ROW_COUNT}">
{FAQ_SUBJECT}
</div>
!
<div class="faq-body">
{FAQ_TEXT}
</div>
!
! <p>{L_VIEWS}: {FAQ_VIEWS}</p>
<!-- ENDIF -->
<!-- ELSEIF S_EDIT -->
<form action="{U_ACTION}" method="post">
<div class="panel">
<div class="inner"><span class="corners-top"><span></span></span>
!
<h2>{L_EDIT_FAQ}<!-- IF FAQ_SUBJECT --> :: {FAQ_SUBJECT}<!-- ENDIF --></h2>
!
<!-- IF ERROR_MSG --><p class="error">{ERROR_MSG}</p><!-- ENDIF -->
!
<fieldset>
<dl style="clear: left;">
<dt><label for="subject">{L_FAQ_SUBJECT}:</label></dt>
--- 35,63 ----
<span class="corners-bottom"><span></span></span>
</div>
<hr class="dashed" style="margin-bottom: 10px;" />
!
<!-- IF S_DETAILS -->
! <a name="details"></a>
<div class="faq-item" id="f{S_ROW_COUNT}">
{FAQ_SUBJECT}
</div>
!
<div class="faq-body">
{FAQ_TEXT}
</div>
!
! <p>{L_VIEWS}: {FAQ_VIEWS}</p>
<!-- ENDIF -->
<!-- ELSEIF S_EDIT -->
<form action="{U_ACTION}" method="post">
<div class="panel">
<div class="inner"><span class="corners-top"><span></span></span>
!
<h2>{L_EDIT_FAQ}<!-- IF FAQ_SUBJECT --> :: {FAQ_SUBJECT}<!-- ENDIF --></h2>
!
<!-- IF ERROR_MSG --><p class="error">{ERROR_MSG}</p><!-- ENDIF -->
!
<fieldset>
<dl style="clear: left;">
<dt><label for="subject">{L_FAQ_SUBJECT}:</label></dt>
***************
*** 72,89 ****
<dl style="clear: left;">
<dt><label for="text">{L_FAQ_TEXT}:</label></dt>
<dd><textarea name="text" id="text" class="inputbox" cols="40" rows="5">{FAQ_TEXT}</textarea></dd>
! </dl>
</fieldset>
<span class="corners-bottom"><span></span></span></div>
</div>
<fieldset class="submit-buttons">
! <input type="reset" value="{L_RESET}" name="reset" class="button2" />
<input type="submit" name="submit" value="{L_SUBMIT}" class="button1" />
{S_FORM_TOKEN}
</fieldset>
! </form>
<!-- ENDIF -->
<!-- INCLUDE contributions/contribution_footer.html -->
\ No newline at end of file
--- 72,89 ----
<dl style="clear: left;">
<dt><label for="text">{L_FAQ_TEXT}:</label></dt>
<dd><textarea name="text" id="text" class="inputbox" cols="40" rows="5">{FAQ_TEXT}</textarea></dd>
! </dl>
</fieldset>
<span class="corners-bottom"><span></span></span></div>
</div>
<fieldset class="submit-buttons">
! <input type="reset" value="{L_RESET}" name="reset" class="button2" />
<input type="submit" name="submit" value="{L_SUBMIT}" class="button1" />
{S_FORM_TOKEN}
</fieldset>
! </form>
<!-- ENDIF -->
<!-- INCLUDE contributions/contribution_footer.html -->
\ No newline at end of file
More information about the customisationdb-commits
mailing list