سؤال

I would like to have it so that users that are logged into the frontend of my Joomla site can edit their articles in a new window without any template applied as soon they press on the edit Button, so that only the editor (in this case JCE) is shown.

I found the source code in components/com_content/helpers/Icon.php, but have no idea if it's possible at all or how I have to re-code it. Any idea?

// Show checked_out icon if the article is checked out by a different user
if (property_exists($article, 'checked_out') && property_exists($article, 'checked_out_time') && $article->checked_out > 0 && $article->checked_out != $user->get('id')) {
    $checkoutUser = JFactory::getUser($article->checked_out);
    $button = JHtml::_('image', 'system/checked_out.png', NULL, NULL, true);
    $date = JHtml::_('date', $article->checked_out_time);
    $tooltip = JText::_('JLIB_HTML_CHECKED_OUT').' :: '.JText::sprintf('COM_CONTENT_CHECKED_OUT_BY', $checkoutUser->name).' <br /> '.$date;
    return '<span class="hasTip" title="'.htmlspecialchars($tooltip, ENT_COMPAT, 'UTF-8').'">'.$button.'</span>';
}

$url    = 'index.php?option=com_content&task=article.edit&a_id='.$article->id.'&return='.base64_encode(urlencode($uri));
$icon   = $article->state ? 'edit.png' : 'edit_unpublished.png';
$text   = JHtml::_('image', 'system/'.$icon, JText::_('JGLOBAL_EDIT'), NULL, true);

if ($article->state == 0) {
    $overlib = JText::_('JUNPUBLISHED');
}
else {
    $overlib = JText::_('JPUBLISHED');
}

$date = JHtml::_('date', $article->created);
$author = $article->created_by_alias ? $article->created_by_alias : $article->author;

$overlib .= '&lt;br /&gt;';
$overlib .= $date;
$overlib .= '&lt;br /&gt;';
$overlib .= JText::sprintf('COM_CONTENT_WRITTEN_BY', htmlspecialchars($author, ENT_COMPAT, 'UTF-8'));

$button = JHtml::_('link', JRoute::_($url), $text);

$output = '<span class="hasTip" title="'.JText::_('COM_CONTENT_EDIT_ITEM').' :: '.$overlib.'">'.$button.'</span>';

return $output;
هل كانت مفيدة؟

المحلول

You should create a template override for the view, in that you can place the link to edit adding:

&tmpl=component

to the url so that only the component part will be shown; and add the

target="_blank" to the <a href or the <form tag so it goes to a new window.

This will most likely open in a new tab, if you want a new window, build the url and pass it to the window.open call.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top