Version 4.3.0
This commit is contained in:
1 parent
96997ddd8e
commit
fe1acf984a
1349 files changed
+116159
-67711
No files matched your search
+57
-12
@@ -109,6 +109,11 @@ class _Controller extends \IPS\Dispatcher\Controller
|
||||
return $rows;
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the "add" button in the page root rather than the table root
|
||||
*/
|
||||
protected $_addButtonInRoot = TRUE;
|
||||
|
||||
/**
|
||||
* Get Root Buttons
|
||||
*
|
||||
@@ -127,7 +132,7 @@ class _Controller extends \IPS\Dispatcher\Controller
|
||||
'data' => ( $nodeClass::$modalForms ? array( 'ipsDialog' => '', 'ipsDialog-title' => \IPS\Member::loggedIn()->language()->addToStack('add') ) : array() )
|
||||
);
|
||||
|
||||
if ( \IPS\Request::i()->isAjax() )
|
||||
if ( \IPS\Request::i()->isAjax() or !$this->_addButtonInRoot )
|
||||
{
|
||||
return array( 'add' => $add );
|
||||
}
|
||||
@@ -150,6 +155,17 @@ class _Controller extends \IPS\Dispatcher\Controller
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetch any additional HTML for this row
|
||||
*
|
||||
* @param object $node Node returned from $nodeClass::load()
|
||||
* @return NULL|string
|
||||
*/
|
||||
public function _getRowHtml( $node )
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Single Row
|
||||
*
|
||||
@@ -189,7 +205,7 @@ class _Controller extends \IPS\Dispatcher\Controller
|
||||
return \IPS\Theme::i()->getTemplate( 'trees', 'core' )->row(
|
||||
$this->url,
|
||||
$id,
|
||||
$node->_title,
|
||||
static::nodeTitle( $node ),
|
||||
$node->childrenCount( NULL ),
|
||||
$buttons,
|
||||
$node->_description,
|
||||
@@ -202,7 +218,8 @@ class _Controller extends \IPS\Dispatcher\Controller
|
||||
$this->_titleHtml,
|
||||
$this->_descriptionHtml,
|
||||
$node->canAdd(),
|
||||
( $node instanceof $nodeClass )
|
||||
( $node instanceof $nodeClass ),
|
||||
$this->_getRowHtml( $node )
|
||||
);
|
||||
}
|
||||
|
||||
@@ -513,7 +530,7 @@ class _Controller extends \IPS\Dispatcher\Controller
|
||||
}
|
||||
try
|
||||
{
|
||||
$node = call_user_func( "{$nodeClass}::load", \IPS\Request::i()->from );
|
||||
$node = $nodeClass::load( \IPS\Request::i()->from );
|
||||
}
|
||||
catch ( \OutOfRangeException $e )
|
||||
{
|
||||
@@ -732,7 +749,7 @@ class _Controller extends \IPS\Dispatcher\Controller
|
||||
}
|
||||
try
|
||||
{
|
||||
$node = call_user_func( "{$nodeClass}::load", \IPS\Request::i()->id );
|
||||
$node = $nodeClass::load( \IPS\Request::i()->id );
|
||||
}
|
||||
catch ( \OutOfRangeException $e )
|
||||
{
|
||||
@@ -845,6 +862,9 @@ class _Controller extends \IPS\Dispatcher\Controller
|
||||
/* Copy it */
|
||||
$new = clone $node;
|
||||
\IPS\Session::i()->log( 'acplog__node_copied', array( $this->title => TRUE, $node->titleForLog() => FALSE ) );
|
||||
|
||||
/* Clear create menu */
|
||||
\IPS\Member::clearCreateMenu();
|
||||
|
||||
/* Boink */
|
||||
$url = $this->url->setQueryString( array( 'do' => 'form', 'id' => $new->_id ) );
|
||||
@@ -939,7 +959,7 @@ class _Controller extends \IPS\Dispatcher\Controller
|
||||
|
||||
if( $parent !== 'null' )
|
||||
{
|
||||
$node = call_user_func( array( $nodeClass, 'load' ), $parent );
|
||||
$node = $nodeClass::load( $parent );
|
||||
$node->setLastComment();
|
||||
$node->setLastReview();
|
||||
$node->save();
|
||||
@@ -998,7 +1018,7 @@ class _Controller extends \IPS\Dispatcher\Controller
|
||||
{
|
||||
try
|
||||
{
|
||||
$node = call_user_func( "{$nodeClass}::load", \IPS\Request::i()->id );
|
||||
$node = $nodeClass::load( \IPS\Request::i()->id );
|
||||
\IPS\Output::i()->title = $node->_title;
|
||||
}
|
||||
catch ( \OutOfRangeException $e )
|
||||
@@ -1006,6 +1026,10 @@ class _Controller extends \IPS\Dispatcher\Controller
|
||||
\IPS\Output::i()->error( 'node_error', '2S101/M', 404, '' );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
\IPS\Output::i()->error( 'node_error', '2S101/X', 404, '' );
|
||||
}
|
||||
|
||||
/* Check permission */
|
||||
if( !$node->canManagePermissions() )
|
||||
@@ -1054,7 +1078,19 @@ class _Controller extends \IPS\Dispatcher\Controller
|
||||
},
|
||||
);
|
||||
|
||||
$disabledPermissions = $node->disabledPermissions();
|
||||
try
|
||||
{
|
||||
$disabledPermissions = $node->disabledPermissions();
|
||||
}
|
||||
catch( \UnderflowException $e )
|
||||
{
|
||||
if( $e->getCode() != 199 )
|
||||
{
|
||||
throw $e;
|
||||
}
|
||||
|
||||
\IPS\Output::i()->error( 'generic_error', '4F383/1', 500, $e->getMessage() );
|
||||
}
|
||||
|
||||
foreach ( $node->permissionTypes() as $k => $v )
|
||||
{
|
||||
@@ -1173,7 +1209,7 @@ class _Controller extends \IPS\Dispatcher\Controller
|
||||
|
||||
try
|
||||
{
|
||||
$node = call_user_func( "{$nodeClass}::load", \IPS\Request::i()->id );
|
||||
$node = $nodeClass::load( \IPS\Request::i()->id );
|
||||
}
|
||||
catch ( \OutOfRangeException $e )
|
||||
{
|
||||
@@ -1244,7 +1280,7 @@ class _Controller extends \IPS\Dispatcher\Controller
|
||||
}
|
||||
try
|
||||
{
|
||||
$node = call_user_func( "{$nodeClass}::load", \IPS\Request::i()->id );
|
||||
$node = $nodeClass::load( \IPS\Request::i()->id );
|
||||
}
|
||||
catch ( \OutOfRangeException $e )
|
||||
{
|
||||
@@ -1415,8 +1451,6 @@ class _Controller extends \IPS\Dispatcher\Controller
|
||||
),
|
||||
$this->url->setQueryString( array( 'do' => 'massManageContent', 'id' => $node->_id ) )
|
||||
);
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1452,4 +1486,15 @@ class _Controller extends \IPS\Dispatcher\Controller
|
||||
|
||||
\IPS\Output::i()->output = \IPS\Theme::i()->getTemplate( 'trees', 'core' )->rows( $rows, '' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Allow overloading to change how the title is displayed in the tree
|
||||
*
|
||||
* @param $node \IPS\Node Node
|
||||
* @return string
|
||||
*/
|
||||
protected static function nodeTitle( $node )
|
||||
{
|
||||
return $node->_title;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user