Ok, hier nun zu meinen Änderungen, um einzelne Artikel als Auswahlmöglichkeit haben zu können:
Hinzufügen:
/plugins/tinyMCE/plugins/morelinks/morelib.php:
/plugins/tinyMCE/plugins/morelinks/morelinks.php:PHP-Code:
/**
* Get all allowed pages and return them as string
* @return string
*/
public function createArticleList() {
// erstmal ohne Berechtigungstests
return $this->doCreateArticleList();
if ($this->User->isAdmin) {
return $this->doCreateArticleList();
}
$return = '';
$processed = array();
return $return;
}
/**
* Recursively get all allowed pages and return them as string
* @param integer
* @param integer
* @return string
*/
public function doCreateArticleList() {
// Alle Seiten mit Artikeln
$objPages = $this->Database->prepare("SELECT id, title FROM tl_page WHERE id IN (SELECT pid FROM tl_article GROUP BY pid)")
->execute();
if ($objPages->numRows < 1) {
return '';
}
while ($objPages->next()) {
$strOptions .= '<optgroup label="' . $objPages->title . '">';
// Seite durchgehen und Artikel auflisten
$objArticle = $this->Database->prepare("SELECT id, title FROM tl_article WHERE pid=? ORDER BY id DESC")
->execute($objPages->id);
while ($objArticle->next()) {
$strOptions .= sprintf(
'<option value="{{article_url::%s}}">%s%s</option>',
$objArticle->id,
str_repeat(" ", 1),
substr(specialchars($objArticle->title), 0, 50)
);
}
$strOptions .= '</optgroup>';
}
return $strOptions;
}
Ab Ca. Zeile 75 die drei tr mit diesen vier tr ersetzen:
HTML-Code:<tr>
<td nowrap="nowrap"><label for="tlarticle">{#morelinks_dlg.article}</label></td>
<td><select id="tlpage" name="tlarticle" style="width: 200px" onchange="document.forms[0].tlnews.value='';document.forms[0].tlevents.value='';document.forms[0].tlfaq.value='';document.forms[0].href.value=this.value;"><option value="">-</option><?php echo $objLib->createArticleList();; ?></select></td>
</tr>
<tr>
<td nowrap="nowrap"><label for="tlnews">{#morelinks_dlg.news}</label></td>
<td><select id="tlpage" name="tlnews" style="width: 200px" onchange="document.forms[0].tlarticle.value='';document.forms[0].tlevents.value='';document.forms[0].tlfaq.value='';document.forms[0].href.value=this.value;"><option value="">-</option><?php echo $objLib->createNewsList();; ?></select></td>
</tr>
<tr>
<td nowrap="nowrap"><label for="tlevents">{#morelinks_dlg.events}</label></td>
<td><select id="tlfile" name="tlevents" style="width: 200px" onchange="document.forms[0].tlarticle.value='';document.forms[0].tlnews.value='';document.forms[0].tlfaq.value='';document.forms[0].href.value=this.value;"><option value="">-</option><?php echo $objLib->createEventsList(); ?></select></td>
</tr>
<tr>
<td nowrap="nowrap"><label for="tlfaq">{#morelinks_dlg.faqs}</label></td>
<td><select id="tlfile" name="tlfaq" style="width: 200px" onchange="document.forms[0].tlarticle.value='';document.forms[0].tlevents.value='';document.forms[0].tlnews.value='';document.forms[0].href.value=this.value;"><option value="">-</option><?php echo $objLib->createFaqList(); ?></select></td>
</tr>
/plugins/tinyMCE/plugins/morelinks/langs/de_dlg.js:
In Zeile 3 einfügen:
/plugins/tinyMCE/plugins/morelinks/langs/en_dlg.js:Code:article:"Artikel",
In Zeile 3 einfügen:
Code:article:"Article",
Das war’s eigentlich. Funktioniert einwandfrei.
Aber kann gerne nochmal gegengetestet werden. ;)