2 balupton Nov 05, 2006 19:59

in ../admin.php?ctrl=itemstatuses i can define entry statuses which are set whenever en entry is created. according to this status i want to change the format of the entry.
regards,
PAT
i would imagine you would want something like this;
if you are using the Custom skin, then look for the line;
<div class="bPost bPost<?php $Item->status( 'raw' ) ?>" lang="<?php $Item->lang() ?>">
and replace with
<div class="bPost bPost<?php $Item->status( 'raw' );
$Item_extra_status = $Item->get('t_extra_status');
if ( !$Item_extra_status )
$Item_extra_status = 'none';
echo ' Item_extra_status_'.$Item_extra_status;
?>" lang="<?php $Item->lang() ?>">
then in it's .css file add something like
.Item_extra_status_unread {
color:yellow;
}
great, works perfectly!
a last question, what would be the code to actually show the status (and the priority btw..) in the blog entry?
PAT
ok, for status I found out myself:
<?php echo 'Status:'.$Item_extra_status;?>
what is it for priority?
PAT
echo $Item->priority;
or
$Item->priority();
ok, i tried to apply an aditional formating according to the priority of the posting. something strange happens:
when i use this code:
<div class="bPost bPost<?php $Item->status( 'raw' );
$Item_extra_status = $Item->get('t_extra_status');
if ( !$Item_extra_status )
$Item_extra_status = 'none';
echo ' Item_extra_status_'.$Item_extra_status.' Item_priority_'.$Item->priority();
?>"
it results in this html code:
<div class="bPost bPostprotected3 Item_extra_status_none Item_priority_" lang="de-DE">
as you see, the priority (here: 3) is at the wrong place. i would have expected it as this:
<div class="bPost bPostprotected Item_extra_status_none Item_priority_3" lang="de-DE">
do you see my mistake?
PAT
Yes. Because what that code is doing is;
echo 'text'.(echo 'something else');
in which case 'something else' is echo'd first.
You want to do (i recomend this one);
echo ' Item_extra_status_'.$Item_extra_status.' Item_priority_'.$Item->priority;
or
echo ' Item_extra_status_'.$Item_extra_status.' Item_priority_'; $Item->priority();
ok, that was the problem, thanks.
two last questions ;) :
1)
do you see an easy way to change the status directly from the blog entry view? i imagine a dropdown list with the different available statuses (similar to the backoffice) and when you change the status, the page reloads.
2)
is there a way, after creating/editing a post in the backoffice, to directly return to the frontend, skipping the "entry changed.." etc page in the backoffice?
PAT
You can do a little bit of work now, but i'll get you started off ;)
1.
The following code will find out wether the current user can edit the current post;
if( is_logged_in() && $current_User->check_perm( 'blog_post_statuses', $Item->status, false, $Item->blog_ID ) )
{
// the user can modify this post
}
So what you want to do is go extract some html out of the backoffice edit page or whatever into that if statement.
2. Open up the backoffice code, and when you find the appropriate part where it says updating/creating post done or whatever, add the following
<script type="text/javascript" >document.location = '<?php echo $GLOBALS['base_url']; ?>';</script>
Should be good, you could pm EdB and ask him to help out, he loves hacking things up. As i'm actually meant to be studying for my exams next week ;)
;)
thanks for all the help, good luck with the exams..
PAT
balupton wrote:
i would imagine you would want something like this;
if you are using the Custom skin, then look for the line;
<div class="bPost bPost<?php $Item->status( 'raw' ) ?>" lang="<?php $Item->lang() ?>">
and replace with
<div class="bPost bPost<?php $Item->status( 'raw' ); $Item_extra_status = $Item->get('t_extra_status'); if ( !$Item_extra_status ) $Item_extra_status = 'none'; echo ' Item_extra_status_'.$Item_extra_status; ?>" lang="<?php $Item->lang() ?>">
then in it's .css file add something like
.Item_extra_status_unread { color:yellow; }
I'm looking for this exact solution but for the glossyblue skin for 2.X
any chance to get this working for this skin ?
who decides their status?