Pagina 1 di 2

Estensione sort topics alphabetically

Inviato: mer feb 18, 2015 11:51 am
da systemcrack
Ciao Brunino volevo chiederti se e quando avevi tempo, possibile realizzare l'estensione come da titolo che riprende la fantastica mod sort topic alphabetically a mio avviso indispensabile.

EDIT BRUNINO:
extension -> viewtopic.php?f=6&t=300

R: Estensione sort topics alphabetically

Inviato: mer feb 18, 2015 12:13 pm
da brunino
Me la spieghi nel dettaglio? Ora non ho modo di scaricarla...

Nei prossimi mesi forse ce la faccio

Inviato dal mio GT-S5360 con Tapatalk 2

Re: Estensione sort topics alphabetically

Inviato: mer feb 18, 2015 3:15 pm
da systemcrack
Guarda se vuoi posso darti l'accesso al mio vecchio forum che ce l'ha installata così vedi come funziona.. di seguito ti riporto screen di pca e della mo e la guida del file install:

La mod mette in ordine i post per la prima lettera del titolo quando clicchi sulla lettera.

PCA/gestione forum/crea-modifica forum-categoria/Impostazioni generali forum
Immagine

In forum
Immagine

Immagine

Files to Edit
viewforum.php,
includes/acp/acp_forums.php,
language/en/viewforum.php,
language/en/acp/forums.php,
styles/prosilver/template/viewforum_body.html,
adm/style/acp_forums.html

SQL

Codice: Seleziona tutto

ALTER TABLE phpbb_forums ADD sort_alphabet TINYINT( 1 ) NOT NULL DEFAULT '0';


Open: viewforum.php
Find
Tip: This may be a partial find and not the whole line.

Codice: Seleziona tutto

if (!$forum_data)
{
   trigger_error('NO_FORUM');
}


Add after
Tip: Add these lines on a new blank line after the preceding line(s) to find.

Codice: Seleziona tutto

// Begin Sort topics alphabetically
$letter   = request_var('letter', '');
if (!in_array($letter, range('A', 'Z')) && $letter != 'other' || !$forum_data['sort_alphabet'])
{
   $letter = '';
}
// End Sort topics alphabetically


Find
Tip: This may be a partial find and not the whole line.

Codice: Seleziona tutto

gen_sort_selects($limit_days, $sort_by_text, $sort_days, $sort_key, $sort_dir, $s_limit_days, $s_sort_key, $s_sort_dir, $u_sort_param);


Add after
Tip: Add these lines on a new blank line after the preceding line(s) to find.

Codice: Seleziona tutto

// Begin sort topics alphabetically
// A bit of phpBB code from memberlist, thank you
$sql_where_letter = '';
if ($letter == 'other')
{
   for ($i = 97; $i < 123; $i++)
   {
      $sql_where_letter .= ' AND topic_title NOT ' . $db->sql_like_expression(chr($i) . $db->any_char);
   }
}
else if ($letter)
{
   $sql_where_letter .= ' AND topic_title ' . $db->sql_like_expression(substr($letter, 0, 1) . $db->any_char);
}
// End sort topics alphabetically


Find
Tip: This may be a partial find and not the whole line.

Codice: Seleziona tutto

if ($sort_days)
{
   $min_post_time = time() - ($sort_days * 86400);
Replace With
Tip: Replace the preceding line(s) to find with the following lines.

Code: Select All
if ($sort_days || $letter)
{
   $min_post_time = ($sort_days) ? time() - ($sort_days * 86400) : 0;


Find
Tip: This may be a partial find and not the whole line.

Codice: Seleziona tutto

OR topic_type = " . POST_ANNOUNCE . ")

Add after
Tip: Add these lines on a new blank line after the preceding line(s) to find.

Codice: Seleziona tutto

$sql_where_letter


Find
Tip: This may be a partial find and not the whole line.
'

Codice: Seleziona tutto

GOTO_PAGE_IMG'            => $user->img('icon_post_target', 'GOTO_PAGE'),


Add after
Tip: Add these lines on a new blank line after the preceding line(s) to find.

Codice: Seleziona tutto

'U_ALL_TOPICS' => append_sid("viewforum.$phpEx", "f=$forum_id&amp;letter=&amp;st=$sort_days&amp;sk=$sort_key&amp;sd=$sort_dir"),
'S_SORT_ALPHABET' => $forum_data['sort_alphabet'],


Find
Tip: This may be a partial find and not the whole line.

Codice: Seleziona tutto

// Grab icons
$icons = $cache->obtain_icons();


Add before
Tip: Add these lines on a new blank line before the preceding line(s) to find.

Codice: Seleziona tutto

// Begin sort topics alphabetically

foreach (range('A', 'Z') as $single_letter)
{
   $template->assign_block_vars('alphabet', array(
      'LETTER' => $single_letter,
      'U_LETTER' => append_sid("viewforum.$phpEx", "f=$forum_id&amp;letter=$single_letter&amp;$u_sort_param"),
      'DIVIDER' => ',',
   ));
}
$template->assign_block_vars('alphabet', array(
      'LETTER' => "#",
      'U_LETTER' => append_sid("viewforum.$phpEx", "f=$forum_id&amp;letter=other&amp;$u_sort_param"),
      'DIVIDER' => '',
));
// End sort topics alphabetically
Find
Tip: This may be a partial find and not the whole line.

Code: Select All
      else
      {
         $topics_count--;
      }


Replace With
Tip: Replace the preceding line(s) to find with the following lines.

Codice: Seleziona tutto

elseif(empty($letter))
        {
            $topics_count--;
        }


Find
Tip: This may be a partial find and not the whole line.

Codice: Seleziona tutto

else
{
   $get_forum_ids = array_diff($active_forum_ary['forum_id'], $active_forum_ary['exclude_forum_id']);
   $sql_where = (sizeof($get_forum_ids)) ? $db->sql_in_set('t.forum_id', $get_forum_ids) : 't.forum_id = ' . $forum_id;
}


Add after
Tip: Add these lines on a new blank line after the preceding line(s) to find.

Codice: Seleziona tutto

// Sort topic alphabetically
// We need to edit the once generated where part of the query, since table shortcuts are used
$sql_where_letter = str_replace('topic_title', 't.topic_title', $sql_where_letter);


Find
Tip: This may be a partial find and not the whole line.

Codice: Seleziona tutto

$sql_approved


Add after
Tip: Add these lines on a new blank line after the preceding line(s) to find.

Codice: Seleziona tutto

$sql_where_letter


Find
Tip: This may be a partial find and not the whole line.

Codice: Seleziona tutto

'PAGINATION'   => generate_pagination(append_sid("{$phpbb_root_path}viewforum.$phpEx", "f=$forum_id&amp;$u_sort_param"), $topics_count, $config['topics_per_page'], $start),


Replace With
Tip: Replace the preceding line(s) to find with the following lines.

Codice: Seleziona tutto

'PAGINATION'   => generate_pagination(append_sid("{$phpbb_root_path}viewforum.$phpEx", "f=$forum_id&amp;letter=$letter&amp;$u_sort_param"), $topics_count, $config['topics_per_page'], $start),


Open: includes/acp/acp_forums.php
Find
Tip: This may be a partial find and not the whole line.

Codice: Seleziona tutto

'forum_password_unset'   => request_var('forum_password_unset', false),


Add after
Tip: Add these lines on a new blank line after the preceding line(s) to find.

Codice: Seleziona tutto

'sort_alphabet'         => request_var('sort_alphabet', 0),


Find
Tip: This may be a partial find and not the whole line.

Codice: Seleziona tutto

'forum_password_confirm'=> '',

Add after
Tip: Add these lines on a new blank line after the preceding line(s) to find.

Codice: Seleziona tutto

'sort_alphabet'      => 0,


Find
Tip: This may be a partial find and not the whole line.

Codice: Seleziona tutto

'S_FORUM_PASSWORD_SET'      => (empty($forum_data['forum_password'])) ? false : true,


Add after
Tip: Add these lines on a new blank line after the preceding line(s) to find.

Codice: Seleziona tutto

'S_SORT_ALPHABETICALLY'      => $forum_data['sort_alphabet'],


Open: language/en/viewforum.php
Find
Tip: This may be a partial find and not the whole line.

Codice: Seleziona tutto

'POST_FORUM_LOCKED'      => 'Forum is locked',


Add after
Tip: Add these lines on a new blank line after the preceding line(s) to find.

Codice: Seleziona tutto

'SORT_ALPHABETICALLY' => 'Sort alphabetically',


Open: language/en/acp/forums.php
Find
Tip: This may be a partial find and not the whole line.

Codice: Seleziona tutto

'REDIRECT_ACL'   => 'Now you are able to %sset permissions%s for this forum.',


Add after
Tip: Add these lines on a new blank line after the preceding line(s) to find.

Codice: Seleziona tutto

'SORT_ALPHABETICALLY' => 'Allow sorting by first letters',
'SORT_ALPHABETICALLY_EXPLAIN' => 'Displays a panel which lets users to choose to display topics starting with a specific letter or character.',


Open: styles/prosilver/template/viewforum_body.html
Find
Tip: This may be a partial find and not the whole line.

Codice: Seleziona tutto

<!-- BEGIN topicrow -->


Add before
Tip: Add these lines on a new blank line before the preceding line(s) to find.

Codice: Seleziona tutto

<!-- IF S_SORT_ALPHABET -->
            <div class="panel">
<div class="inner"><span class="corners-top"><span></span></span>
<ul class="linklist">
<li><strong style="font-size: 0.95em;">{L_SORT_ALPHABETICALLY}: <a href="{U_ALL_TOPICS}" style="font-weight: bold;">{L_ALL_TOPICS}</a>,
   <!-- BEGIN alphabet -->
   <a href="{alphabet.U_LETTER}" style="font-weight: bold;">{alphabet.LETTER}</a>{alphabet.DIVIDER}
   <!-- END alphabet --></strong>
</ul>
<span class="corners-bottom"><span></span></span></div>
</div>
<!-- ENDIF -->


Open: adm/style/acp_forums.html
Find
Tip: This may be a partial find and not the whole line.

Codice: Seleziona tutto

<dl>
   <dt><label for="topics_per_page">{L_FORUM_TOPICS_PAGE}:</label><br /><span>{L_FORUM_TOPICS_PAGE_EXPLAIN}</span></dt>
   <dd><input type="text" id="topics_per_page" name="topics_per_page" value="{TOPICS_PER_PAGE}" size="4" maxlength="4" /></dd>
</dl>


Add after
Tip: Add these lines on a new blank line after the preceding line(s) to find.

Codice: Seleziona tutto

<dl>
   <dt><label for="sort_alphabet">{L_SORT_ALPHABETICALLY}:</label><br /><span>{L_SORT_ALPHABETICALLY_EXPLAIN}</span></dt>
   <dd><label><input type="radio" class="radio" name="sort_alphabet" value="1"<!-- IF S_SORT_ALPHABETICALLY --> id="sort_alphabet" checked="checked"<!-- ENDIF --> /> {L_YES}</label>
   <label><input type="radio" class="radio" name="sort_alphabet" value="0"<!-- IF not S_SORT_ALPHABETICALLY --> id="sort_alphabet" checked="checked"<!-- ENDIF --> /> {L_NO}</label></dd>
</dl>


In allegato pacchetto originale
sort_topics_alphabetically_1.0.3.zip
(29.8 KiB) Scaricato 2444 volte

Re: Estensione sort topics alphabetically

Inviato: mer feb 18, 2015 4:06 pm
da brunino
Non dovrebbe essere difficile... Quando ho compkletato la Who Visited This Topic passo a questa ;)

Re: Estensione sort topics alphabetically

Inviato: lun feb 23, 2015 10:48 am
da brunino
Ma mostra solo i topic con la lettera scelta?

Re: Estensione sort topics alphabetically

Inviato: lun feb 23, 2015 1:04 pm
da systemcrack
Si esatto.

Re: Estensione sort topics alphabetically

Inviato: ven mar 20, 2015 3:47 pm
da systemcrack
Linko una conversazione sul com che forse potrebbe tornare utile:
https://www.phpbb.com/community/viewtop ... #p13797261

Re: Estensione sort topics alphabetically

Inviato: ven mag 08, 2015 5:31 pm
da systemcrack
Giusto per la cronaca.. un utente in mp sul phpbb.com mi ha chiesto se hai intenzione di realizzare questa estensione.

R: Estensione sort topics alphabetically

Inviato: sab mag 09, 2015 6:54 am
da brunino
Per il momento no. Se lui la puo fare subito meglio per tutti...

Inviato dal mio GT-S5360 con Tapatalk 2

Re: Estensione sort topics alphabetically

Inviato: ven lug 10, 2015 7:11 pm
da MadCon88
This would be great as 3.1 extension. Thanks