I am trying to respond to a control panel feature request from a client that should be easy to satisfy, but because there are no extension hooks available, this is proving rather difficult.
My task, in a nutshell, is to transform the “publish” page (where you select the weblog you want to publish into) so that the weblogs are grouped in a more attractive manner.
I have found a function called weblog_select_list which appears to be the key to this, but, looking at the way this function’s output combines html presentation with content it looks like it is going to be rather messy.
If EE core functions had separation of presentation from content from logic (including, for example, templates for admin pages) this would all be so much easier.
Any suggestions?
<pre><code> /** Weblog selection menu /** ——————————————–*/ // This function shows a list of available weblogs. // This list will be displayed when a user clicks the // “publish” link when more than one weblog exist. //——————————————–
function weblog_select_list($add='')
{
global $IN, $DSP, $DB, $LANG, $FNS, $SESS;
if ($IN->GBL('C') == 'publish')
{
$blurb = $LANG->line('select_blog_to_post_in');
$title = $LANG->line('publish');
$action = 'C=publish'.AMP.'M=entry_form';
}
else
{
$blurb = $LANG->line('select_blog_to_edit');
$title = $LANG->line('edit');
$action = 'C=edit'.AMP.'M=view_entries';
}
/** -------------------------------------------------
/** Fetch the blogs the user is allowed to post in
/** -------------------------------------------------*/
$links = array();
$i = 0;
foreach ($SESS->userdata['assigned_weblogs'] as $weblog_id => $weblog_title)
{
$links[] = $DSP->table_qrow(($i++ % 2) ? 'tableCellOne' : 'tableCellTwo', $DSP->qdiv('defaultBold', $DSP->anchor(BASE.AMP.$action.AMP.'weblog_id='.$weblog_id.$add, $weblog_title)));
}
// If there are no allowed blogs, show a message
if (count($links) < 1)
{
return $DSP->no_access_message($LANG->line('unauthorized_for_any_blogs'));
}
$DSP->body .= $DSP->table('tableBorder', '0', '', '100%')
.$DSP->table_qrow('tableHeading', $blurb);
foreach ($links as $val)
{
$DSP->body .= $val;
}
$DSP->body .= $DSP->table_c();
$DSP->title = $title;
$DSP->crumb = $title;
}
/* END */[/code]
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.