コード例 #1
0
ファイル: Trackbacks.php プロジェクト: Dulciane/jaws
 /**
  * Displays blog trackback to be edited
  *
  * @access  public
  * @return  string  XHTML template content
  */
 function ViewTrackback()
 {
     $this->gadget->CheckPermission('ManageTrackbacks');
     $tModel = $this->gadget->model->loadAdmin('Trackbacks');
     $pModel = $this->gadget->model->loadAdmin('Posts');
     // Fetch the trackback
     $trackback = $tModel->GetTrackback(jaws()->request->fetch('id', 'get'));
     if (Jaws_Error::IsError($trackback)) {
         Jaws_Header::Location(BASE_SCRIPT . '?gadget=Blog&action=ManageTrackbacks');
     }
     // Fetch the entry
     $entry = $pModel->getEntry($trackback['parent_id']);
     if (Jaws_Error::IsError($entry)) {
         Jaws_Header::Location(BASE_SCRIPT . '?gadget=Blog&action=ManageTrackbacks');
     }
     $tpl = $this->gadget->template->loadAdmin('Trackback.html');
     $tpl->SetBlock('view_trackback');
     $tpl->SetVariable('menubar', $this->MenuBar('ManageTrackbacks'));
     $date = Jaws_Date::getInstance();
     include_once JAWS_PATH . 'include/Jaws/Widgets/FieldSet.php';
     $fieldset = new Jaws_Widgets_FieldSet(_t('BLOG_VIEW_TRACKBACK'));
     $text = '<strong>' . $entry['title'] . '</strong>';
     $staticText =& Piwi::CreateWidget('StaticEntry', _t('BLOG_TRACKBACKS_CURRENTLY_UPDATING_FOR', $text));
     $blog_name =& Piwi::CreateWidget('Entry', 'blog_name', Jaws_XSS::filter($trackback['blog_name']));
     $blog_name->SetTitle(_t('BLOG_TRACKBACK_BLOGNAME'));
     $blog_name->SetStyle('width: 400px;');
     $url =& Piwi::CreateWidget('Entry', 'url', Jaws_XSS::filter($trackback['url']));
     $url->SetStyle('direction: ltr;');
     $url->SetTitle(_t('GLOBAL_URL'));
     $url->SetStyle('width: 400px;');
     $createTime =& Piwi::CreateWidget('Entry', 'create_time', $date->Format($trackback['createtime']));
     $createTime->SetTitle(_t('GLOBAL_CREATETIME'));
     $createTime->SetStyle('direction: ltr;');
     $createTime->SetEnabled(false);
     $updateTime =& Piwi::CreateWidget('Entry', 'update_time', $date->Format($trackback['updatetime']));
     $updateTime->SetTitle(_t('GLOBAL_UPDATETIME'));
     $updateTime->SetStyle('direction: ltr;');
     $updateTime->SetEnabled(false);
     $ip =& Piwi::CreateWidget('Entry', 'ip', $trackback['ip']);
     $ip->SetTitle(_t('GLOBAL_IP'));
     $ip->SetStyle('direction: ltr;');
     $ip->SetEnabled(false);
     $subject =& Piwi::CreateWidget('Entry', 'title', Jaws_XSS::filter($trackback['title']));
     $subject->SetTitle(_t('GLOBAL_TITLE'));
     $subject->SetStyle('width: 400px;');
     $excerpt =& Piwi::CreateWidget('TextArea', 'excerpt', $trackback['excerpt']);
     $excerpt->SetRows(5);
     $excerpt->SetColumns(60);
     $excerpt->SetStyle('width: 400px;');
     $excerpt->SetTitle(_t('BLOG_TRACKBACK_EXCERPT'));
     $cancelButton =& Piwi::CreateWidget('Button', 'previewButton', _t('GLOBAL_CANCEL'), STOCK_CANCEL);
     $cancelButton->AddEvent(ON_CLICK, 'history.go(-1);');
     $buttonbox =& Piwi::CreateWidget('HBox');
     $buttonbox->SetStyle(_t('GLOBAL_LANG_DIRECTION') == 'rtl' ? 'float: left;' : 'float: right;');
     $buttonbox->PackStart($cancelButton);
     $fieldset->Add($staticText);
     $fieldset->Add($blog_name);
     $fieldset->Add($url);
     $fieldset->Add($createTime);
     $fieldset->Add($updateTime);
     $fieldset->Add($ip);
     $fieldset->Add($subject);
     $fieldset->Add($excerpt);
     $tpl->SetVariable('field', $fieldset->Get());
     $tpl->SetVariable('buttonbox', $buttonbox->Get());
     $tpl->ParseBlock('view_trackback');
     return $tpl->Get();
 }