From b9a8b2ad056b0e944bdcae2b2a6ecb8f88a46f2f Mon Sep 17 00:00:00 2001 From: Mikael Nordfeldth Date: Fri, 4 Jul 2014 14:13:48 +0200 Subject: [PATCH] missing file for 4b40d6bb2ad6540fe114eebe74b2330902382a81 --- lib/tagprofileform.php | 145 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 145 insertions(+) create mode 100644 lib/tagprofileform.php diff --git a/lib/tagprofileform.php b/lib/tagprofileform.php new file mode 100644 index 0000000000..8541235c6f --- /dev/null +++ b/lib/tagprofileform.php @@ -0,0 +1,145 @@ +. + * + * @category Form + * @package StatusNet + * @author Evan Prodromou + * @author Sarven Capadisli + * @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('GNUSOCIAL')) { exit(1); } + +/** + * Form for tagging a profile with a peopletag + * + * @category Form + * @package StatusNet + * @author Evan Prodromou + * @author Sarven Capadisli + * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 + * @link http://status.net/ + * + * @see HTMLOutputter + */ +class TagProfileForm extends Form +{ + protected $target = null; + + /** + * Constructor + * + * @param Action $action Action we're being embedded into + * @param array $options Array of optional parameters + * 'user' a user instead of current + * 'content' notice content + * 'inreplyto' ID of notice to reply to + * 'lat' Latitude + * 'lon' Longitude + * 'location_id' ID of location + * 'location_ns' Namespace of location + */ + function __construct(Action $action, Profile $target) + { + parent::__construct($action); + + $this->target = $target; + } + + /** + * ID of the form + * + * @return string ID of the form + */ + + function id() + { + return 'form_tagprofile_'.$target->id; + } + + /** + * Class of the form + * + * @return string class of the form + */ + + function formClass() + { + return 'form_tagprofile form_settings'; + } + + /** + * Action of the form + * + * @return string URL of the action + */ + + function action() + { + return common_local_url('tagprofile', array('id' => $this->target->id)); + } + + /** + * Legend of the Form + * + * @return void + */ + function formLegend() + { + // TRANS: Form legend for notice form. + $this->out->element('legend', null, sprintf(_m('ADDTOLIST', 'List %s'), $this->target->getNickname())); + + } + + /** + * Data elements + * + * @return void + */ + function formData() + { + if (Event::handle('StartShowTagProfileFormData', array($this))) { + $this->hidden('token', common_session_token()); + $this->hidden('id', $this->target->id); + + $this->elementStart('ul', 'form_data'); + $this->elementStart('li'); + + $tags = Profile_tag::getTagsArray($this->out->getScoped()->id, $this->target->id, $this->out->getScoped()->id); + // TRANS: Field label on list form. + $this->input('tags', _m('LABEL','Lists'), + ($this->arg('tags')) ? $this->arg('tags') : implode(' ', $tags), + // TRANS: Field title on list form. + _('Lists for this user (letters, numbers, -, ., and _), comma- or space- separated.')); + $this->elementEnd('li'); + $this->elementEnd('ul'); + Event::handle('EndShowTagProfileFormData', array($this)); + } + } + + function formActions() + { + // TRANS: Button text to save lists. + $this->out->submit('save', _m('BUTTON', 'Save')); + } +}