Alles klar, habe es selber hinbekommen:
anscheinend hat der "mode" etwas damit zu tun. Habe jetzt meine Dateien angepasst:
PHP-Code:
$GLOBALS['TL_DCA']['tl_mb_dokument'] = array
(
// Config
'config' => array
(
'dataContainer' => 'Table',
'ptable' => 'tl_mb_kategorie',
'enableVersioning' => true
),
// List
'list' => array
(
'sorting' => array
(
'mode' => 6,
'fields' => array('dk_name','dk_datei'),
'flag' => 1
),
'label' => array
(
'fields' => array('dk_name'),
'format' => '%s',
'label_callback' => array('tl_mb_dokument', 'addIcon')
),
'global_operations' => array
(
'all' => array
(
'label' => &$GLOBALS['TL_LANG']['MSC']['all'],
'href' => 'act=select',
'class' => 'header_edit_all',
'attributes' => 'onclick="Backend.getScrollOffset();" accesskey="e"'
)
),
'operations' => array
(
'edit' => array
(
'label' => &$GLOBALS['TL_LANG']['tl_mb_dokument']['edit'],
'href' => 'act=edit',
'icon' => 'edit.gif'
),
'copy' => array
(
'label' => &$GLOBALS['TL_LANG']['tl_mb_dokument']['copy'],
'href' => 'act=copy',
'icon' => 'copy.gif'
),
'delete' => array
(
'label' => &$GLOBALS['TL_LANG']['tl_mb_dokument']['delete'],
'href' => 'act=delete',
'icon' => 'delete.gif',
'attributes' => 'onclick="if (!confirm(\'' . $GLOBALS['TL_LANG']['MSC']['deleteConfirm'] . '\')) return false; Backend.getScrollOffset();"'
),
'show' => array
(
'label' => &$GLOBALS['TL_LANG']['tl_mb_dokument']['show'],
'href' => 'act=show',
'icon' => 'show.gif'
)
)
),
// Palettes
'palettes' => array
(
'__selector__' => array(''),
'default' => '{dokument_legend},dk_name,dk_kategorieid,dk_beschreibung,dk_stichworte;dk_datei,dk_dateityp,dk_dateigroesse;dk_upload_userid,dk_upload_datum,dk_speicherpfad,dk_abgeschlossen'
),
// Subpalettes
'subpalettes' => array
(
'' => ''
),
// Fields
'fields' => array
(
// varchar(64)
'dk_name' => array
(
'label' => &$GLOBALS['TL_LANG']['tl_mb_dokument']['dk_name'],
'exclude' => true,
'inputType' => 'text',
'eval' => array('mandatory'=>true, 'maxlength'=>64)
),
//varchar(10), fk
/* 'dk_kategorieid' => array
(
'label' => &$GLOBALS['TL_LANG']['tl_mb_dokument']['dk_kategorieid'],
'exclude' => true,
'inputType' => 'select',
'foreignKey' => 'tl_mb_kategorie.kt_name',
'eval' => array( 'multiple'=>false, 'mandatory'=>true,'maxlength'=>10)
),
*/
//text
'dk_beschreibung' => array
(
'label' => &$GLOBALS['TL_LANG']['tl_mb_dokument']['dk_beschreibung'],
'exclude' => true,
'inputType' => 'textarea',
'eval' => array('mandatory'=>true, 'maxlength'=>255)
),
//varchar(255)
'dk_stichworte' => array
(
'label' => &$GLOBALS['TL_LANG']['tl_mb_dokument']['dk_stichworte'],
'exclude' => true,
'inputType' => 'text',
'eval' => array('mandatory'=>true, 'maxlength'=>255)
),
//varchar(100)
'dk_datei' => array
(
'label' => &$GLOBALS['TL_LANG']['tl_mb_dokument']['dk_datei'],
'exclude' => true,
'inputType' => 'text',
'eval' => array('mandatory'=>false, 'readonly'=>true)
),
//varchar(4)
'dk_dateityp' => array
(
'label' => &$GLOBALS['TL_LANG']['tl_mb_dokument']['dk_dateityp'],
'exclude' => true,
'inputType' => 'text',
'eval' => array('mandatory'=>false,'readonly'=>true,'maxlength'=>4)
),
//int(10)
'dk_upload_userid' => array
(
'label' => &$GLOBALS['TL_LANG']['tl_mb_dokument']['dk_upload_userid'],
'exclude' => true,
'inputType' => 'text',
'eval' => array('mandatory'=>false, 'maxlength'=>64, 'readonly'=>true)
),
//varchar(64)
'dk_speicherpfad' => array
(
'label' => &$GLOBALS['TL_LANG']['tl_mb_dokument']['dk_speicherpfad'],
'exclude' => true,
'inputType' => 'text',
'eval' => array('mandatory'=>false, 'maxlength'=>64, 'readonly'=>true)
),
// char(1)
'dk_abgeschlossen' => array
(
'label' => &$GLOBALS['TL_LANG']['tl_mb_dokument']['dk_abgeschlossen'],
'exclude' => true,
'inputType' => 'checkbox',
)
)
);
class tl_mb_dokument extends Backend
{
/**
* Import the back end user object
*/
public function __construct()
{
parent::__construct();
$this->import('BackendUser', 'User');
}
/**
* add an icon
*/
public function addIcon($row,$label)
{
$image = 'system/modules/mb_dokman/article.gif';
return $this->generateImage($image)." ".$label;
}
}
PHP-Code:
$GLOBALS['TL_DCA']['tl_mb_kategorie'] = array
(
// Config
'config' => array
(
'dataContainer' => 'Table',
'ctable' => array('tl_mb_dokument','tl_mb_zugriffsrecht'),
'enableVersioning' => true
),
// List
'list' => array
(
'sorting' => array
(
'mode' => 5,
'fields' => array('kt_parentid'),
'flag' => 1
),
'label' => array
(
'fields' => array('kt_name'),
'format' => '%s',
'label_callback' => array('tl_mb_kategorie', 'addIcon')
),
'global_operations' => array
(
'all' => array
(
'label' => &$GLOBALS['TL_LANG']['MSC']['all'],
'href' => 'act=select',
'class' => 'header_edit_all',
'attributes' => 'onclick="Backend.getScrollOffset();" accesskey="e"'
)
),
'operations' => array
(
'edit' => array
(
'label' => &$GLOBALS['TL_LANG']['tl_mb_kategorie']['edit'],
'href' => 'act=edit',
'icon' => 'edit.gif'
),
'copy' => array
(
'label' => &$GLOBALS['TL_LANG']['tl_mb_kategorie']['copy'],
'href' => 'act=copy',
'icon' => 'copy.gif'
),
'delete' => array
(
'label' => &$GLOBALS['TL_LANG']['tl_mb_kategorie']['delete'],
'href' => 'act=delete',
'icon' => 'delete.gif',
'attributes' => 'onclick="if (!confirm(\'' . $GLOBALS['TL_LANG']['MSC']['deleteConfirm'] . '\')) return false; Backend.getScrollOffset();"'
),
'show' => array
(
'label' => &$GLOBALS['TL_LANG']['tl_mb_kategorie']['show'],
'href' => 'act=show',
'icon' => 'show.gif'
)
)
),
// Palettes
'palettes' => array
(
'__selector__' => array(''),
'default' => '{kategorie_legend},kt_name,kt_titel,kt_beschreibung,kt_parentid,kt_dateityp,kt_abgeschlossen'
),
// Subpalettes
'subpalettes' => array
(
'' => ''
),
// Fields
'fields' => array
(
'kt_name' => array
(
'label' => &$GLOBALS['TL_LANG']['tl_mb_kategorie']['kt_name'],
'exclude' => true,
'inputType' => 'text',
'eval' => array('mandatory'=>true, 'maxlength'=>64, 'tl_class'=>'w50')
),
'kt_titel' => array
(
'label' => &$GLOBALS['TL_LANG']['tl_mb_kategorie']['kt_titel'],
'exclude' => true,
'inputType' => 'text',
'eval' => array('mandatory'=>false, 'maxlength'=>64)
),
'kt_beschreibung' => array
(
'label' => &$GLOBALS['TL_LANG']['tl_mb_kategorie']['kt_beschreibung'],
'exclude' => true,
'inputType' => 'textarea',
'eval' => array('rte'=>'tinyMCE', 'tl_class'=>'clr')
),
/*'kt_parentid' => array
(
'label' => &$GLOBALS['TL_LANG']['tl_mb_kategorie']['kt_parentid'],
'exclude' => true,
'inputType' => 'pageTree',
'foreignKey' => 'tl_mb_kategorie.kt_name',
'eval' => array('multiple'=>true)
),*/
'kt_dateityp' => array
(
'label' => &$GLOBALS['TL_LANG']['tl_mb_kategorie']['kt_dateityp'],
'exclude' => true,
'inputType' => 'text',
'eval' => array('mandatory'=>true, 'maxlength'=>64)
),
'kt_abgeschlossen' => array
(
'label' => &$GLOBALS['TL_LANG']['tl_mb_kategorie']['kt_abgeschlossen'],
'exclude' => true,
'inputType' => 'checkbox'
)
)
);
class tl_mb_kategorie extends Backend
{
/**
* Import the back end user object
*/
public function __construct()
{
parent::__construct();
$this->import('BackendUser', 'User');
}
/**
* add an icon
*/
public function addIcon($row,$label)
{
$image = 'system/modules/mb_dokman/folder.gif';
return $this->generateImage($image)." ".$label;
}
}
PHP-Code:
$GLOBALS['TL_DCA']['tl_mb_zugriffsrecht'] = array
(
// Config
'config' => array
(
'label' => "test",
'dataContainer' => 'Table',
'ptable' => 'tl_mb_kategorie',
'enableVersioning' => true
),
// List
'list' => array
(
'sorting' => array
(
'mode' => 6,
'fields' => array('zr_mitgliedergruppenid'),
'icon' => 'edit.gif',
'flag' => 1
),
'label' => array
(
'fields' => array('zr_mitgliedergruppenid'),
'format' => '%s',
'label_callback' => array('tl_mb_zugriffsrecht', 'convertIds')
),
'global_operations' => array
(
'all' => array
(
'label' => &$GLOBALS['TL_LANG']['MSC']['all'],
'href' => 'act=select',
'class' => 'header_edit_all',
'attributes' => 'onclick="Backend.getScrollOffset();" accesskey="e"'
)
),
'operations' => array
(
'edit' => array
(
'label' => &$GLOBALS['TL_LANG']['tl_mb_zugriffsrecht']['edit'],
'href' => 'act=edit',
'icon' => 'edit.gif'
),
'copy' => array
(
'label' => &$GLOBALS['TL_LANG']['tl_mb_zugriffsrecht']['copy'],
'href' => 'act=copy',
'icon' => 'copy.gif'
),
'delete' => array
(
'label' => &$GLOBALS['TL_LANG']['tl_mb_zugriffsrecht']['delete'],
'href' => 'act=delete',
'icon' => 'delete.gif',
'attributes' => 'onclick="if (!confirm(\'' . $GLOBALS['TL_LANG']['MSC']['deleteConfirm'] . '\')) return false; Backend.getScrollOffset();"'
),
'show' => array
(
'label' => &$GLOBALS['TL_LANG']['tl_mb_zugriffsrecht']['show'],
'href' => 'act=show',
'icon' => 'show.gif'
)
)
),
// Palettes
'palettes' => array
(
'__selector__' => array(''),
'default' => '{zugriffsrecht_legend},zr_kategorieid,zr_mitgliedergruppenid;{zugriffsrecht_legend_einzelrechte},zr_dokument_lesen,zr_dokument_upload,zr_dokument_loeschen,zr_dokument_editieren,zr_dokument_abschliessen'
),
// Subpalettes
'subpalettes' => array
(
'' => ''
),
// Fields
'fields' => array
(
/*'zr_kategorieid' => array
(
'label' => &$GLOBALS['TL_LANG']['tl_mb_zugriffsrecht']['zr_kategorieid'],
'exclude' => true,
'inputType' => 'select',
'foreignKey' => 'tl_mb_kategorie.kt_name',
'eval' => array('multiple'=>false,'mandatory'=>true,'tl_class'=>'w40')
),
*/
'zr_mitgliedergruppenid' => array
(
'label' => &$GLOBALS['TL_LANG']['tl_mb_zugriffsrecht']['zr_mitgliedergruppenid'],
'exclude' => true,
'inputType' => 'select',
'foreignKey' => 'tl_member_group.name',
'eval' => array('multiple'=>false,'mandatory'=>true,'tl_class'=>'clr')
),
'zr_dokument_lesen' => array
(
'label' => &$GLOBALS['TL_LANG']['tl_mb_zugriffsrecht']['zr_dokument_lesen'],
'exclude' => true,
'inputType' => 'checkbox',
'default' => '1'
),
'zr_dokument_upload' => array
(
'label' => &$GLOBALS['TL_LANG']['tl_mb_zugriffsrecht']['zr_dokument_upload'],
'exclude' => true,
'inputType' => 'checkbox'
),
'zr_dokument_loeschen' => array
(
'label' => &$GLOBALS['TL_LANG']['tl_mb_zugriffsrecht']['zr_dokument_loeschen'],
'exclude' => true,
'inputType' => 'checkbox'
),
'zr_dokument_editieren' => array
(
'label' => &$GLOBALS['TL_LANG']['tl_mb_zugriffsrecht']['zr_dokument_editieren'],
'exclude' => true,
'inputType' => 'checkbox'
),
'zr_dokument_abschliessen' => array
(
'label' => &$GLOBALS['TL_LANG']['tl_mb_zugriffsrecht']['zr_dokument_abschliessen'],
'exclude' => true,
'inputType' => 'checkbox'
)
)
);
/**
* Class tl_user
*
* Provide miscellaneous methods that are used by the data configuration array.
* @copyright Götz-Daniel Jantsch 2010
* @author Götz-Daniel Jantsch
* @package mb
*/
class tl_mb_zugriffsrecht extends Backend
{
/**
* Import the back end user object
*/
public function __construct()
{
parent::__construct();
$this->import('BackendUser', 'User');
}
/**
* Convert the Groupid to Groupname and add an icon
*/
public function convertIds($row)
{
// Gruppennamen holen
$objRes = $this->Database->prepare("SELECT * FROM tl_member_group WHERE id=?")
->limit(1)
->execute($row['zr_mitgliedergruppenid']);
$label = ' '.$objRes->name;
$image = 'system/modules/mb_dokman/schlossoffen.gif';
return $this->generateImage($image).$label;
}
}
Ich bitte mal jemanden um Aufklärung: Kann es sein, dass mode 5 und 6 das pid Feld befüllen und die id des parents über dieses Ablagesymbol bekommen?
Oder kann man das mit den anderen modes auch realisieren, ohne "mit der Hand" Fremdschlüssel zu verwalten?