Version 4.6.0
This commit is contained in:
1 parent
f79dcf067a
commit
517a5e1f70
2036 files changed
+110041
-26162
No files matched your search
@@ -357,8 +357,17 @@ abstract class _CustomField extends \IPS\Node\Model
|
||||
case 'Color':
|
||||
case 'Radio':
|
||||
case 'Number':
|
||||
$columnDefinition['type'] = 'VARCHAR';
|
||||
$columnDefinition['length'] = 255;
|
||||
if ( !isset( $values['pf_max_input'] ) OR !$values['pf_max_input'] )
|
||||
{
|
||||
$columnDefinition['type'] = 'MEDIUMTEXT';
|
||||
unset( $columnDefinition['length'] );
|
||||
}
|
||||
else
|
||||
{
|
||||
$columnDefinition['type'] = 'VARCHAR';
|
||||
$columnDefinition['length'] = 255;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 'YesNo':
|
||||
@@ -370,7 +379,15 @@ abstract class _CustomField extends \IPS\Node\Model
|
||||
}
|
||||
if ( isset( $values['pf_max_input'] ) and $values['pf_max_input'] )
|
||||
{
|
||||
$columnDefinition['length'] = $values['pf_max_input'];
|
||||
if( $values['pf_max_input'] > 255 )
|
||||
{
|
||||
$columnDefinition['type'] = 'MEDIUMTEXT';
|
||||
unset( $columnDefinition['length'] );
|
||||
}
|
||||
else
|
||||
{
|
||||
$columnDefinition['length'] = $values['pf_max_input'];
|
||||
}
|
||||
}
|
||||
|
||||
if ( !$this->id )
|
||||
@@ -584,10 +601,29 @@ abstract class _CustomField extends \IPS\Node\Model
|
||||
|
||||
\IPS\Lang::deleteCustom( 'core', static::$langKey . '_' . $this->id );
|
||||
\IPS\Lang::deleteCustom( 'core', static::$langKey . '_' . $this->id . '_desc' );
|
||||
|
||||
|
||||
if ( isset( static::$contentDatabaseTable ) )
|
||||
{
|
||||
\IPS\Db::i()->dropColumn( static::$contentDatabaseTable, $column );
|
||||
if( $this->type == 'Upload' )
|
||||
{
|
||||
/* Delete records */
|
||||
\IPS\Task::queue( 'core', 'FileCleanup', array(
|
||||
'table' => static::$contentDatabaseTable,
|
||||
'column' => $column,
|
||||
'storageExtension' => static::$uploadStorageExtension,
|
||||
'dropColumn' => $column,
|
||||
'dropColumnTable' => static::$contentDatabaseTable,
|
||||
'multipleFiles' => $this->multiple
|
||||
), 4 );
|
||||
}
|
||||
else
|
||||
{
|
||||
try
|
||||
{
|
||||
\IPS\Db::i()->dropColumn( static::$contentDatabaseTable, $column );
|
||||
}
|
||||
catch( \IPS\Db\Exception $e ) { }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -610,6 +646,15 @@ abstract class _CustomField extends \IPS\Node\Model
|
||||
}
|
||||
|
||||
$options = array();
|
||||
|
||||
$maxLength = $this->max_input ?: NULL;
|
||||
|
||||
/* Set the max length to 255 because that's the max the column can store */
|
||||
if( !$maxLength AND !\in_array( $this->type, [ 'Editor', 'TextArea', 'Upload', 'Address', 'CodeMirror', 'Select' ] ) )
|
||||
{
|
||||
$maxLength = 255;
|
||||
}
|
||||
|
||||
switch ( $this->type )
|
||||
{
|
||||
case 'Date':
|
||||
@@ -631,7 +676,7 @@ abstract class _CustomField extends \IPS\Node\Model
|
||||
case 'Text':
|
||||
case 'TextArea':
|
||||
case 'Url':
|
||||
$options['maxLength'] = $this->max_input ?: NULL;
|
||||
$options['maxLength'] = $maxLength;
|
||||
$options['regex'] = $this->input_format ?: NULL;
|
||||
break;
|
||||
|
||||
@@ -906,9 +951,10 @@ abstract class _CustomField extends \IPS\Node\Model
|
||||
*
|
||||
* @param mixed $value The value
|
||||
* @param bool $showSensitiveInformation If TRUE, potentially sensitive data (like passwords) will be displayed - otherwise will be blanked out
|
||||
* @param string $separator Used to separate items when displaying a field with multiple values.
|
||||
* @return string
|
||||
*/
|
||||
public function displayValue( $value=NULL, $showSensitiveInformation=FALSE )
|
||||
public function displayValue( $value=NULL, $showSensitiveInformation=FALSE, $separator=NULL )
|
||||
{
|
||||
switch ( $this->type )
|
||||
{
|
||||
@@ -960,7 +1006,7 @@ abstract class _CustomField extends \IPS\Node\Model
|
||||
|
||||
if ( $this->multiple )
|
||||
{
|
||||
return implode( '<br>', explode( ',', htmlspecialchars( $value, ENT_DISALLOWED | ENT_QUOTES, 'UTF-8', FALSE ) ) );
|
||||
return implode( ( $separator ) ? $separator : '<br>', explode( ',', htmlspecialchars( $value, ENT_DISALLOWED | ENT_QUOTES, 'UTF-8', FALSE ) ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user