3 * StatusNet, the distributed open-source microblogging tool
5 * Form for editing a peopletag
9 * LICENCE: This program is free software: you can redistribute it and/or modify
10 * it under the terms of the GNU Affero General Public License as published by
11 * the Free Software Foundation, either version 3 of the License, or
12 * (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU Affero General Public License for more details.
19 * You should have received a copy of the GNU Affero General Public License
20 * along with this program. If not, see <http://www.gnu.org/licenses/>.
24 * @author Shashi Gowda <connect2shashi@gmail.com>
25 * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
26 * @link http://status.net/
29 if (!defined('STATUSNET') && !defined('LACONICA')) {
33 require_once INSTALLDIR.'/lib/form.php';
34 require_once INSTALLDIR.'/lib/togglepeopletag.php';
37 * Form for editing a peopletag
41 * @author Shashi Gowda <connect2shashi@gmail.com>
42 * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
43 * @link http://status.net/
47 class PeopletagEditForm extends Form
53 var $peopletag = null;
59 * @param Action $out output channel
60 * @param User_group $group group to join
62 function __construct($out=null, Profile_list $peopletag=null)
64 parent::__construct($out);
66 $this->peopletag = $peopletag;
67 $this->tagger = Profile::staticGet('id', $peopletag->tagger);
73 * @return string ID of the form
77 return 'form_peopletag_edit-' . $this->peopletag->id;
83 * @return string of the form class
87 return 'form_settings';
93 * @return string URL of the action
97 return common_local_url('editpeopletag',
98 array('tagger' => $this->tagger->nickname, 'tag' => $this->peopletag->tag));
106 function formLegend()
108 // TRANS: Form legend for list edit form.
109 // TRANS: %s is a list.
110 $this->out->element('legend', null, sprintf(_('Edit list %s'), $this->peopletag->tag));
114 * Data elements of the form
120 $id = $this->peopletag->id;
121 $tag = $this->peopletag->tag;
122 $description = $this->peopletag->description;
123 $private = $this->peopletag->private;
125 $this->out->elementStart('ul', 'form_data');
127 $this->out->elementStart('li');
128 $this->out->hidden('id', $id);
130 // TRANS: Field label for list.
131 $this->out->input('tag', _m('LABEL','List'),
132 ($this->out->arg('tag')) ? $this->out->arg('tag') : $tag,
133 // TRANS: Field title for list.
134 _('Change the list (letters, numbers, -, ., and _ are allowed).'));
135 $this->out->elementEnd('li');
137 $this->out->elementStart('li');
138 $desclimit = Profile_list::maxDescription();
139 if ($desclimit == 0) {
140 // TRANS: Field title for description of list.
141 $descinstr = _('Describe the list or topic.');
143 // TRANS: Field title for description of list.
144 // TRANS: %d is the maximum number of characters for the description.
145 $descinstr = sprintf(_m('Describe the list or topic in %d character.',
146 'Describe the list or topic in %d characters.',
150 // TRANS: Field label for description of list.
151 $this->out->textarea('description', _('Description'),
152 ($this->out->arg('description')) ? $this->out->arg('description') : $description,
154 // TRANS: Checkbox label to mark a list private.
155 $this->out->checkbox('private', _('Private'), $private);
156 $this->out->elementEnd('li');
157 $this->out->elementEnd('ul');
165 function formActions()
167 // TRANS: Button text to save a list.
168 $this->out->submit('submit', _('Save'));
169 $this->out->submit('form_action-yes',
170 // TRANS: Button text to delete a list.
171 _m('BUTTON','Delete'),
174 // TRANS: Button title to delete a list.
175 _('Delete this list.'));
178 function showProfileList()
180 $tagged = $this->peopletag->getTagged();
181 // TRANS: Header in list edit form.
182 $this->out->element('h2', null, _('Add or remove people'));
184 $this->out->elementStart('div', 'profile_search_wrap');
185 // TRANS: Header in list edit form.
186 $this->out->element('h3', null, _m('HEADER','Search'));
187 $search = new SearchProfileForm($this->out, $this->peopletag);
189 $this->out->element('ul', array('id' => 'profile_search_results', 'class' => 'empty'));
190 $this->out->elementEnd('div');
192 $this->out->elementStart('ul', 'profile-lister');
193 while ($tagged->fetch()) {
194 $this->out->elementStart('li', 'entity_removable_profile');
195 $this->showProfileItem($tagged);
196 $this->out->elementStart('span', 'entity_actions');
197 $untag = new UntagButton($this->out, $tagged, $this->peopletag);
199 $this->out->elementEnd('span');
200 $this->out->elementEnd('li');
202 $this->out->elementEnd('ul');
205 function showProfileItem($profile)
207 $item = new TaggedProfileItem($this->out, $profile);