Version 5.0.6
This commit is contained in:
1 parent
a3a4a9ccbd
commit
b89858b2ff
1214 files changed
+92828
-14859
No files matched your search
@@ -15,6 +15,7 @@ namespace IPS\convert\modules\admin\manage;
|
||||
|
||||
use IPS\Application;
|
||||
use IPS\convert\App;
|
||||
use IPS\convert\Application as ConverterApplication;
|
||||
use IPS\convert\Exception;
|
||||
use IPS\convert\Library;
|
||||
use IPS\convert\Software;
|
||||
@@ -99,12 +100,12 @@ class convert extends Controller
|
||||
}
|
||||
|
||||
/* Do a quick parent storage check */
|
||||
\IPS\convert\Application::checkConvParent( $app->getSource()->getLibrary()->app );
|
||||
ConverterApplication::checkConvParent( $app->getSource()->getLibrary()->getAppKey() );
|
||||
|
||||
/* Check child apps also have temporary columns */
|
||||
foreach( $app->children() as $child )
|
||||
{
|
||||
\IPS\convert\Application::checkConvParent( $child->getSource()->getLibrary()->app );
|
||||
ConverterApplication::checkConvParent( $child->getSource()->getLibrary()->getAppKey() );
|
||||
}
|
||||
|
||||
/* Are we using the legacy UI? If not, then start converting as we already have everything we need. */
|
||||
|
||||
@@ -188,12 +188,6 @@ class manage extends Controller
|
||||
|
||||
if ( \IPS\IN_DEV )
|
||||
{
|
||||
Output::i()->sidebar['actions']['software'] = array(
|
||||
'icon' => 'plus',
|
||||
'title' => 'new_software',
|
||||
'link' => Url::internal( "app=convert&module=manage&controller=manage&do=software" ),
|
||||
'data' => array( 'ipsDialog' => '', 'ipsDialog-title' => Member::loggedIn()->language()->addToStack('new_software') )
|
||||
);
|
||||
Output::i()->sidebar['actions']['library'] = array(
|
||||
'icon' => 'plus',
|
||||
'title' => 'new_library',
|
||||
@@ -254,67 +248,6 @@ class manage extends Controller
|
||||
Output::i()->output .= $table;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create New Converter
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function software() : void
|
||||
{
|
||||
if ( \IPS\IN_DEV === FALSE )
|
||||
{
|
||||
Output::i()->error( 'new_sofware_not_in_dev', '1V100/1', 403 );
|
||||
}
|
||||
|
||||
$form = new Form;
|
||||
$form->add( new Text( 'classname', NULL, TRUE ) );
|
||||
|
||||
if ( $values = $form->values() )
|
||||
{
|
||||
/* Get the default code */
|
||||
$default = file_get_contents( \IPS\ROOT_PATH . '/applications/convert/data/defaults/Software.txt' );
|
||||
|
||||
/* Explode the entered class name to figure out the file path and namespace */
|
||||
$exploded = explode( '\\', ltrim( $values['classname'], '\\' ) );
|
||||
|
||||
/* Copy the exploded array to generate the path */
|
||||
$copied = $exploded;
|
||||
|
||||
/* Shift off IPS from the namespace */
|
||||
array_shift( $copied );
|
||||
|
||||
/* Get our application key */
|
||||
$application = array_shift( $copied );
|
||||
|
||||
/* Generate our path */
|
||||
$filepath = \IPS\ROOT_PATH . "/applications/{$application}/sources/" . implode( '/', $copied ) . ".php";
|
||||
|
||||
/* Now figure out our namespace, class, and default code with replacements */
|
||||
$classname = array_pop( $exploded );
|
||||
$namespace = implode( '\\', $exploded );
|
||||
$code = str_replace( array( '<#NAMESPACE#>', '<#CLASS#>', '<#CLASS_LOWER#>' ), array( $namespace, $classname, mb_strtolower( $classname ) ), $default );
|
||||
|
||||
/* Check if we need to create a folder */
|
||||
if( count( $copied ) > 1 )
|
||||
{
|
||||
$folder = \IPS\ROOT_PATH . "/applications/{$application}/sources/" . $copied[0];
|
||||
if( !file_exists( $folder ) )
|
||||
{
|
||||
@mkdir( $folder );
|
||||
@chmod( $folder, FOLDER_PERMISSION_NO_WRITE );
|
||||
}
|
||||
}
|
||||
|
||||
/* Generate the file */
|
||||
file_put_contents( $filepath, $code );
|
||||
|
||||
Output::i()->redirect( Url::internal( "app=convert&module=manage&controller=manage" ), 'saved' );
|
||||
}
|
||||
|
||||
Output::i()->title = Member::loggedIn()->language()->addToStack( 'new_software' );
|
||||
Output::i()->output = (string) $form;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create New Library
|
||||
*
|
||||
|
||||
Reference in new issue
Block a user