From 37b0852fdb8b82741b327af57d898d4d89c2f177 Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Thu, 10 Dec 2009 14:33:15 -0500 Subject: move forward form to plugin --- lib/forwardform.php | 147 ----------------------------------------- lib/noticelist.php | 21 ------ plugins/Repeat/forwardform.php | 147 +++++++++++++++++++++++++++++++++++++++++ 3 files changed, 147 insertions(+), 168 deletions(-) delete mode 100644 lib/forwardform.php create mode 100644 plugins/Repeat/forwardform.php diff --git a/lib/forwardform.php b/lib/forwardform.php deleted file mode 100644 index 2052856ae..000000000 --- a/lib/forwardform.php +++ /dev/null @@ -1,147 +0,0 @@ -. - * - * @category Form - * @package StatusNet - * @author Evan Prodromou - * @copyright 2009 StatusNet, Inc. - * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 - * @link http://status.net/ - */ - -if (!defined('STATUSNET') && !defined('LACONICA')) { - exit(1); -} - -require_once INSTALLDIR.'/lib/form.php'; - -/** - * Form for forwarding a notice - * - * @category Form - * @package StatusNet - * @author Evan Prodromou - * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 - * @link http://status.net/ - */ - -class ForwardForm extends Form -{ - /** - * Notice to forward - */ - - var $notice = null; - - /** - * Constructor - * - * @param HTMLOutputter $out output channel - * @param Notice $notice notice to forward - */ - - function __construct($out=null, $notice=null) - { - parent::__construct($out); - - $this->notice = $notice; - } - - /** - * ID of the form - * - * @return int ID of the form - */ - - function id() - { - return 'forward-' . $this->notice->id; - } - - /** - * Action of the form - * - * @return string URL of the action - */ - - function action() - { - return common_local_url('forward'); - } - - /** - * Include a session token for CSRF protection - * - * @return void - */ - - function sessionToken() - { - $this->out->hidden('token-' . $this->notice->id, - common_session_token()); - } - - /** - * Legend of the Form - * - * @return void - */ - function formLegend() - { - $this->out->element('legend', null, _('Forward this notice')); - } - - /** - * Data elements - * - * @return void - */ - - function formData() - { - $this->out->hidden('notice-n'.$this->notice->id, - $this->notice->id, - 'notice'); - } - - /** - * Action elements - * - * @return void - */ - - function formActions() - { - $this->out->submit('forward-submit-' . $this->notice->id, - _('Forward'), 'submit', null, _('Forward this notice')); - } - - /** - * Class of the form. - * - * @return string the form's class - */ - - function formClass() - { - return 'form_forward'; - } -} diff --git a/lib/noticelist.php b/lib/noticelist.php index d6ffc9ca9..21cec528f 100644 --- a/lib/noticelist.php +++ b/lib/noticelist.php @@ -212,7 +212,6 @@ class NoticeListItem extends Widget $this->out->elementStart('div', 'notice-options'); $this->showFaveForm(); $this->showReplyLink(); - $this->showForwardForm(); $this->showDeleteLink(); $this->out->elementEnd('div'); } @@ -531,26 +530,6 @@ class NoticeListItem extends Widget } } - /** - * show the form to forward a notice - * - * @return void - */ - - function showForwardForm() - { - $user = common_current_user(); - if ($user && $user->id != $this->notice->profile_id) { - $profile = $user->getProfile(); - if ($profile->hasForwarded($this->notice->id)) { - $this->out->text(_('Forwarded')); - } else { - $ff = new ForwardForm($this->out, $this->notice); - $ff->show(); - } - } - } - /** * if the user is the author, let them delete the notice * diff --git a/plugins/Repeat/forwardform.php b/plugins/Repeat/forwardform.php new file mode 100644 index 000000000..2052856ae --- /dev/null +++ b/plugins/Repeat/forwardform.php @@ -0,0 +1,147 @@ +. + * + * @category Form + * @package StatusNet + * @author Evan Prodromou + * @copyright 2009 StatusNet, Inc. + * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 + * @link http://status.net/ + */ + +if (!defined('STATUSNET') && !defined('LACONICA')) { + exit(1); +} + +require_once INSTALLDIR.'/lib/form.php'; + +/** + * Form for forwarding a notice + * + * @category Form + * @package StatusNet + * @author Evan Prodromou + * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 + * @link http://status.net/ + */ + +class ForwardForm extends Form +{ + /** + * Notice to forward + */ + + var $notice = null; + + /** + * Constructor + * + * @param HTMLOutputter $out output channel + * @param Notice $notice notice to forward + */ + + function __construct($out=null, $notice=null) + { + parent::__construct($out); + + $this->notice = $notice; + } + + /** + * ID of the form + * + * @return int ID of the form + */ + + function id() + { + return 'forward-' . $this->notice->id; + } + + /** + * Action of the form + * + * @return string URL of the action + */ + + function action() + { + return common_local_url('forward'); + } + + /** + * Include a session token for CSRF protection + * + * @return void + */ + + function sessionToken() + { + $this->out->hidden('token-' . $this->notice->id, + common_session_token()); + } + + /** + * Legend of the Form + * + * @return void + */ + function formLegend() + { + $this->out->element('legend', null, _('Forward this notice')); + } + + /** + * Data elements + * + * @return void + */ + + function formData() + { + $this->out->hidden('notice-n'.$this->notice->id, + $this->notice->id, + 'notice'); + } + + /** + * Action elements + * + * @return void + */ + + function formActions() + { + $this->out->submit('forward-submit-' . $this->notice->id, + _('Forward'), 'submit', null, _('Forward this notice')); + } + + /** + * Class of the form. + * + * @return string the form's class + */ + + function formClass() + { + return 'form_forward'; + } +} -- cgit v1.2.3-54-g00ecf