00001 <?php
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 require_once FASTFRAME_ROOT . 'lib/FastFrame/Action/Form.php';
00026
00027
00028
00029
00040
00041 class FF_Action_Form_PortalBlock extends FF_Action_Form {
00042
00043
00050 function renderAdditionalLinks()
00051 {
00052 $this->o_output->o_tpl->append('page_links', $this->o_output->link(
00053 FastFrame::selfURL(array('actionId' => ACTION_LIST)),
00054 sprintf(_('Return to %s List'), $this->getSingularText())));
00055 }
00056
00057
00058
00059
00067 function createFormElements()
00068 {
00069 $this->o_form->addElement('hidden', 'actionId');
00070 $this->o_form->addElement('hidden', 'objectId');
00071 $this->o_form->addElement('submit', 'submitbutton');
00072 $this->o_form->addElement('text', 'name', null, array('maxlength' => 150, 'size' => 30));
00073 $this->o_form->addElement('checkbox', 'nl2br');
00074 $this->o_form->addElement('textarea', 'content', null, array('cols' => 100, 'rows' => 15));
00075 $this->o_form->addRule('name', _('Name cannot be blank.'), 'required', null, 'client');
00076 }
00077
00078
00079
00080
00087 function getSingularText()
00088 {
00089 return _('Portal Block');
00090 }
00091
00092
00093
00094
00102 function getPluralText()
00103 {
00104 return _('Portal Blocks');
00105 }
00106
00107
00108
00109
00118 function getTableData()
00119 {
00120 $a_headers = array();
00121 $a_headers[] = array(
00122 'title' => '* ' . _('Name'),
00123 'titleStyle' => 'style="font-weight: bold;"',
00124 'data' => $this->o_renderer->elementToHtml('name'),
00125 );
00126 $a_headers[] = array(
00127 'title' => _('Convert Linebreaks'),
00128 'data' => $this->o_renderer->elementToHtml('nl2br'),
00129 );
00130 $tmp_help = nl2br(_('The following tags can be used to format the text:
00131 [b]<b>bold text</b>[/b]
00132 [i]<i>italic text</i>[/i]
00133 [u]<u>underlined text</u>[/u]
00134 [ulist]
00135 [*]unordered item 1
00136 [/ulist]
00137 [url=http:
00138 [url=portal:1]<u>A Link to Portal Block 1</u>[/url]
00139 [email=bob@example.com]<u>Email Bob</u>[/email]'));
00140 $a_headers[] = array(
00141 'title' => sprintf(_('Content %s'), $this->o_output->getHelpLink($tmp_help)),
00142 'data' => $this->o_renderer->elementToHtml('content'),
00143 );
00144 return $a_headers;
00145 }
00146
00147
00148
00149
00157 function getFormDefaults()
00158 {
00159 $a_fields = array();
00160 $a_fields['objectId'] = $this->o_model->getId();
00161 $a_fields['name'] = $this->o_model->getName();
00162 $a_fields['nl2br'] = $this->o_model->getNl2Br();
00163 $a_fields['content'] = $this->o_model->getContent();
00164 return $a_fields;
00165 }
00166
00167
00168
00169
00176 function checkPerms()
00177 {
00178 if ($this->o_perms->hasPerm('can_edit_block')) {
00179 return true;
00180 }
00181 else {
00182 $this->o_nextAction->setNextActionId(ACTION_PROBLEM);
00183 $this->o_output->setMessage(_('You do not have permission to edit portal blocks.'), FASTFRAME_ERROR_MESSAGE);
00184 return false;
00185 }
00186 }
00187
00188
00189 }
00190 ?>