{
if ( !$manager->checkTicket() )
{
- bm_doError(_ERROR_BADTICKET);
+ bm_doError($skin, _ERROR_BADTICKET);
}
}
$extrahead = '';
}
- bm_message($skin, _ITEM_ADDED, _ITEM_ADDED, $message,$extrahead);
+ bm_message($skin, _ITEM_ADDED, $message,$extrahead);
return;
// only allow if user is allowed to alter item
if ( !$member->canUpdateItem($itemid, $catid) )
{
- bm_doError(_ERROR_DISALLOWED);
+ bm_doError($skin, _ERROR_DISALLOWED);
}
$body = postVar('body');
// show error when sth goes wrong
if ( !$catid )
{
- bm_doError('Could not create new category');
+ bm_doError($skin, 'Could not create new category');
}
}
$timestamp = 0;
break;
default:
- bm_doError('Something went wrong');
+ bm_doError($skin, 'Something went wrong');
}
// update item for real
Item::delete($draftid);
}
- // show success message
- if ( $catid != intPostVar('catid') )
+ if ( $result['status'] == 'newcategory' )
{
- bm_message($skin, _ITEM_UPDATED, _ITEM_UPDATED, 'Item was added, and a new category was created. <a href="index.php?action=categoryedit&blogid=' . $blog->getID() . '&catid=' . $catid . '" onclick="if (event && event.preventDefault) event.preventDefault(); window.open(this.href); return false;" title="Opens in new window">Click here to edit the name and description of the category.</a>', '');
+ $href = "index.php?action=categoryedit&blogid={$blogid}&catid={$result['catid']}";
+ $onclick = 'if (event && event.preventDefault) event.preventDefault(); window.open(this.href); return false;';
+ $title = _BOOKMARKLET_NEW_WINDOW;
+ $aTag = " <a href=\"{$href}\" onclick=\"{$onclick}\" title=\"{$title}\">";
+ $message = _BOOKMARKLET_NEW_CATEGORY . $aTag . _BOOKMARKLET_NEW_CATEGORY_EDIT . '</a>';
}
else
{
- bm_message($skin, _ITEM_UPDATED, _ITEM_UPDATED, _ITEM_UPDATED, '');
+ $message = _ITEM_ADDED;
}
+ // show success message
+ bm_message($skin, _ITEM_ADDED, $message, '');
return;
}
if ( !Blog::existsID($blogid) )
{
- bm_doError(_ERROR_NOSUCHBLOG);
+ bm_doError($skin, _ERROR_NOSUCHBLOG);
}
else if ( !$member->isTeamMember($blogid) )
{
- bm_doError(_ERROR_NOTONTEAM);
+ bm_doError($skin, _ERROR_NOTONTEAM);
}
$blog =& $manager->getBlog($blogid);
}
Admin::$blog = &$blog;
- Admin::$item = &$item;
+ Admin::$contents = &$item;
Admin::setAdminAction('createitem');
$skin->parse('createitem');
if ( !$manager->existsItem($itemid, 0, 0) )
{
- bm_doError(_ERROR_NOSUCHITEM);
+ bm_doError($skin, _ERROR_NOSUCHITEM);
}
else if ( !$member->canAlterItem($itemid) )
{
- bm_doError(_ERROR_DISALLOWED);
+ bm_doError($skin, _ERROR_DISALLOWED);
}
$blog =& $manager->getBlog(getBlogIDFromItemID($itemid) );
}
Admin::$blog = &$blog;
- Admin::$item = &$item;
+ Admin::$contents = &$item;
Admin::setAdminAction('itemedit');
$skin->parse('itemedit');
function bm_doError($skin, $msg)
{
- bm_message($skin, _ERROR, _ERRORMSG, $msg);
+ bm_message($skin, _ERRORMSG, $msg);
die;
}
-function bm_message($skin, $title, $head, $msg, $extrahead = '')
+function bm_message($skin, $title, $msg, $extrahead = '')
{
- /* TODO: $title, $head, $msg, $extraheadを渡す */
+ Admin::$extrahead = $extrahead;
+ Admin::$contents = array(
+ 'title' => $title,
+ 'msg' => $msg
+ );
$skin->parse('adminerrorpage');
return;