mirror of
https://github.com/e107inc/e107.git
synced 2025-08-11 00:54:49 +02:00
Tweaked some of the upgrade checks and default forum order after upgrade.
This commit is contained in:
@@ -121,17 +121,17 @@ if(deftrue('NEW_FORUMADMIN'))
|
|||||||
protected $listQry = "SELECT a. *, CASE WHEN a.forum_parent = 0 THEN a.forum_order ELSE b.forum_order + (( a.forum_order)/1000) END AS Sort FROM `#forum` AS a LEFT JOIN `#forum` AS b ON a.forum_parent = b.forum_id ";
|
protected $listQry = "SELECT a. *, CASE WHEN a.forum_parent = 0 THEN a.forum_order ELSE b.forum_order + (( a.forum_order)/1000) END AS Sort FROM `#forum` AS a LEFT JOIN `#forum` AS b ON a.forum_parent = b.forum_id ";
|
||||||
protected $listOrder = 'Sort,forum_order ';
|
protected $listOrder = 'Sort,forum_order ';
|
||||||
// protected $listOrder = 'forum_order';
|
// protected $listOrder = 'forum_order';
|
||||||
|
// protected $listOrder = ' COALESCE(NULLIF(forum_parent,0), forum_id), forum_parent > 0, forum_order ';
|
||||||
|
|
||||||
|
protected $fields = array ( 'checkboxes' => array ( 'title' => '', 'type' => null, 'data' => null, 'width' => '5%', 'thclass' => 'center', 'forced' => '1', 'class' => 'center', 'toggle' => 'e-multiselect', ),
|
||||||
protected $fields = array ( 'checkboxes' => array ( 'title' => '', 'type' => null, 'data' => null, 'width' => '5%', 'thclass' => 'center', 'forced' => '1', 'class' => 'center', 'toggle' => 'e-multiselect', ),
|
'forum_id' => array ( 'title' => LAN_ID, 'data' => 'int', 'width' => '5%', 'help' => '', 'readParms' => '', 'writeParms' => '', 'class' => 'left', 'thclass' => 'left', ),
|
||||||
'forum_id' => array ( 'title' => LAN_ID, 'data' => 'int', 'width' => '5%', 'help' => '', 'readParms' => '', 'writeParms' => '', 'class' => 'left', 'thclass' => 'left', ),
|
'forum_name' => array ( 'title' => LAN_TITLE, 'type' => 'method', 'inline'=>true, 'data' => 'str', 'width' => '40%', 'help' => '', 'readParms' => '', 'writeParms' => '', 'class' => 'left', 'thclass' => 'left', ),
|
||||||
'forum_name' => array ( 'title' => LAN_TITLE, 'type' => 'method', 'inline'=>true, 'data' => 'str', 'width' => '40%', 'help' => '', 'readParms' => '', 'writeParms' => '', 'class' => 'left', 'thclass' => 'left', ),
|
'forum_description' => array ( 'title' => LAN_DESCRIPTION, 'type' => 'textarea', 'data' => 'str', 'width' => '30%', 'help' => '', 'readParms' => '', 'writeParms' => '', 'class' => 'left', 'thclass' => 'left', ),
|
||||||
'forum_description' => array ( 'title' => LAN_DESCRIPTION, 'type' => 'textarea', 'data' => 'str', 'width' => '30%', 'help' => '', 'readParms' => '', 'writeParms' => '', 'class' => 'left', 'thclass' => 'left', ),
|
'forum_parent' => array ( 'title' => 'Parent', 'type' => 'dropdown', 'data' => 'int', 'width' => '10%', 'help' => '', 'readParms' => '', 'writeParms' => '', 'class' => 'left', 'thclass' => 'left', ),
|
||||||
'forum_parent' => array ( 'title' => 'Parent', 'type' => 'dropdown', 'data' => 'int', 'width' => '10%', 'help' => '', 'readParms' => '', 'writeParms' => '', 'class' => 'left', 'thclass' => 'left', ),
|
'forum_sub' => array ( 'title' => 'SubForum of', 'type' => 'dropdown', 'data' => 'int', 'width' => 'auto', 'help' => '', 'readParms' => '', 'writeParms' => '', 'class' => 'center', 'thclass' => 'center', ),
|
||||||
'forum_sub' => array ( 'title' => 'SubForum of', 'type' => 'dropdown', 'data' => 'int', 'width' => 'auto', 'help' => '', 'readParms' => '', 'writeParms' => '', 'class' => 'center', 'thclass' => 'center', ),
|
|
||||||
'forum_moderators' => array ( 'title' => 'Moderators', 'type' => 'userclass', 'inline'=>true, 'data' => 'int', 'width' => 'auto', 'help' => '', 'readParms' => 'classlist=admin,main,classes', 'writeParms' => "classlist=admin,main,classes", 'class' => 'left', 'thclass' => 'left', ),
|
'forum_moderators' => array ( 'title' => 'Moderators', 'type' => 'userclass', 'inline'=>true, 'data' => 'int', 'width' => 'auto', 'help' => '', 'readParms' => 'classlist=admin,main,classes', 'writeParms' => "classlist=admin,main,classes", 'class' => 'left', 'thclass' => 'left', ),
|
||||||
'forum_threads' => array ( 'title' => 'Threads', 'type' => 'number', 'data' => 'int', 'noedit'=>true, 'width' => 'auto', 'help' => '', 'readParms' => '', 'writeParms' => '', 'class' => 'center', 'thclass' => 'center', ),
|
'forum_threads' => array ( 'title' => 'Threads', 'type' => 'number', 'data' => 'int', 'noedit'=>true, 'width' => 'auto', 'help' => '', 'readParms' => '', 'writeParms' => '', 'class' => 'center', 'thclass' => 'center', ),
|
||||||
'forum_replies' => array ( 'title' => 'Replies', 'type' => 'number', 'data' => 'int', 'noedit'=>true, 'width' => 'auto', 'help' => '', 'readParms' => '', 'writeParms' => '', 'class' => 'center', 'thclass' => 'center', ),
|
'forum_replies' => array ( 'title' => 'Replies', 'type' => 'number', 'data' => 'int', 'noedit'=>true, 'width' => 'auto', 'help' => '', 'readParms' => '', 'writeParms' => '', 'class' => 'center', 'thclass' => 'center', ),
|
||||||
'forum_lastpost_user' => array ( 'title' => LAN_AUTHOR, 'type' => 'hidden', 'noedit'=>true, 'data' => 'int', 'width' => 'auto', 'help' => '', 'readParms' => '', 'writeParms' => '', 'class' => 'left', 'thclass' => 'left', ),
|
'forum_lastpost_user' => array ( 'title' => LAN_AUTHOR, 'type' => 'hidden', 'noedit'=>true, 'data' => 'int', 'width' => 'auto', 'help' => '', 'readParms' => '', 'writeParms' => '', 'class' => 'left', 'thclass' => 'left', ),
|
||||||
'forum_lastpost_user_anon' => array ( 'title' => 'User-Anon', 'type' => 'hidden','noedit'=>true, 'data' => 'str', 'width' => 'auto', 'help' => '', 'readParms' => '', 'writeParms' => '', 'class' => 'center', 'thclass' => 'center', ),
|
'forum_lastpost_user_anon' => array ( 'title' => 'User-Anon', 'type' => 'hidden','noedit'=>true, 'data' => 'str', 'width' => 'auto', 'help' => '', 'readParms' => '', 'writeParms' => '', 'class' => 'center', 'thclass' => 'center', ),
|
||||||
'forum_lastpost_info' => array ( 'title' => 'LastPost', 'type' => 'hidden', 'noedit'=>true, 'data' => 'str', 'width' => 'auto', 'help' => '', 'readParms' => '', 'writeParms' => '', 'class' => 'center', 'thclass' => 'center', ),
|
'forum_lastpost_info' => array ( 'title' => 'LastPost', 'type' => 'hidden', 'noedit'=>true, 'data' => 'str', 'width' => 'auto', 'help' => '', 'readParms' => '', 'writeParms' => '', 'class' => 'center', 'thclass' => 'center', ),
|
||||||
@@ -177,10 +177,47 @@ if(deftrue('NEW_FORUMADMIN'))
|
|||||||
public $forumObj = null;
|
public $forumObj = null;
|
||||||
|
|
||||||
|
|
||||||
|
// Correct bad ordering based on parent/child relationship.
|
||||||
|
private function checkOrder()
|
||||||
|
{
|
||||||
|
$sql = e107::getDb();
|
||||||
|
$sql2 = e107::getDb('sql2');
|
||||||
|
$count = $sql->select('forum', 'forum_id', 'forum_order = 0');
|
||||||
|
|
||||||
|
if($count > 1)
|
||||||
|
{
|
||||||
|
$sql->gen("SELECT forum_id,forum_name,forum_parent,forum_order FROM `#forum` ORDER BY COALESCE(NULLIF(forum_parent,0), forum_id), forum_parent > 0, forum_order ");
|
||||||
|
|
||||||
|
$c = 0;
|
||||||
|
while($row = $sql->fetch())
|
||||||
|
{
|
||||||
|
//print_a($row);
|
||||||
|
|
||||||
|
if($row['forum_parent'] == 0)
|
||||||
|
{
|
||||||
|
$c = $c + 100;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$c = $c+1;
|
||||||
|
}
|
||||||
|
|
||||||
|
$sql2->update('forum', 'forum_order = '.$c.' WHERE forum_id = '.$row['forum_id'].' LIMIT 1');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public function init()
|
public function init()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
$this->checkOrder();
|
||||||
|
|
||||||
|
|
||||||
if(e107::isInstalled('poll') == false)
|
if(e107::isInstalled('poll') == false)
|
||||||
{
|
{
|
||||||
$this->prefs['poll']['writeParms']['post'] = " <span class='label label-important'>Not installed</span>";
|
$this->prefs['poll']['writeParms']['post'] = " <span class='label label-important'>Not installed</span>";
|
||||||
|
@@ -49,6 +49,12 @@ class forum_setup
|
|||||||
*/
|
*/
|
||||||
function upgrade_required()
|
function upgrade_required()
|
||||||
{
|
{
|
||||||
|
if(!e107::getDb()->db_Table_exists('forum_thread'))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if(!e107::getDb()->field('forum_thread','thread_id'))
|
if(!e107::getDb()->field('forum_thread','thread_id'))
|
||||||
{
|
{
|
||||||
return true; // true to trigger an upgrade alert, and false to not.
|
return true; // true to trigger an upgrade alert, and false to not.
|
||||||
|
@@ -215,7 +215,7 @@ function step2()
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
$text = "<form method='post' action='" . e_SELF . "?step=3'>
|
$text = "<form method='post' action='" . e_SELF . "?step=3'>
|
||||||
<input class='btn' type='submit' name='nextStep[3]' value='Proceed to step 3' />
|
<input class='btn btn-success' type='submit' name='nextStep[3]' value='Proceed to step 3' />
|
||||||
</form>";
|
</form>";
|
||||||
}
|
}
|
||||||
$ns -> tablerender('Step 2: Forum table creation', $mes -> render() . $text);
|
$ns -> tablerender('Step 2: Forum table creation', $mes -> render() . $text);
|
||||||
@@ -791,11 +791,11 @@ function step10()
|
|||||||
|
|
||||||
if ($_SESSION['forumupdate']['attachment_total'] == 0)
|
if ($_SESSION['forumupdate']['attachment_total'] == 0)
|
||||||
{
|
{
|
||||||
$text .= "
|
$text = "
|
||||||
No forum attachments found.
|
No forum attachments found.
|
||||||
<br /><br />
|
<br /><br />
|
||||||
<form method='post' action='" . e_SELF . "?step=11'>
|
<form method='post' action='" . e_SELF . "?step=11'>
|
||||||
<input class='btn' type='submit' name='nextStep[11]' value='Proceed to step 11' />
|
<input class='btn btn-success' type='submit' name='nextStep[11]' value='Proceed to step 11' />
|
||||||
</form>
|
</form>
|
||||||
";
|
";
|
||||||
$ns -> tablerender($stepCaption, $text);
|
$ns -> tablerender($stepCaption, $text);
|
||||||
|
Reference in New Issue
Block a user