123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211 |
- <?php
- if (!defined('STATUSNET') && !defined('LACONICA')) {
- exit(1);
- }
- require_once INSTALLDIR . '/lib/util/form.php';
- require_once INSTALLDIR . '/lib/profile/togglepeopletag.php';
- class PeopletagEditForm extends Form
- {
-
- var $peopletag = null;
- var $tagger = null;
-
- function __construct($out=null, Profile_list $peopletag=null)
- {
- parent::__construct($out);
- $this->peopletag = $peopletag;
- $this->tagger = Profile::getKV('id', $peopletag->tagger);
- }
-
- function id()
- {
- return 'form_peopletag_edit-' . $this->peopletag->id;
- }
-
- function formClass()
- {
- return 'form_settings';
- }
-
- function action()
- {
- return common_local_url('editpeopletag',
- array('tagger' => $this->tagger->nickname, 'tag' => $this->peopletag->tag));
- }
-
- function formLegend()
- {
-
-
- $this->out->element('legend', null, sprintf(_('Edit list %s'), $this->peopletag->tag));
- }
-
- function formData()
- {
- $id = $this->peopletag->id;
- $tag = $this->peopletag->tag;
- $description = $this->peopletag->description;
- $private = $this->peopletag->private;
- $this->out->elementStart('ul', 'form_data');
- $this->out->elementStart('li');
- $this->out->hidden('id', $id);
-
- $this->out->input('tag', _m('LABEL','List'),
- ($this->out->arg('tag')) ? $this->out->arg('tag') : $tag,
-
- _('Change the list (letters, numbers, -, ., and _ are allowed).'));
- $this->out->elementEnd('li');
- $this->out->elementStart('li');
- $desclimit = Profile_list::maxDescription();
- if ($desclimit == 0) {
-
- $descinstr = _('Describe the list or topic.');
- } else {
-
-
- $descinstr = sprintf(_m('Describe the list or topic in %d character.',
- 'Describe the list or topic in %d characters.',
- $desclimit),
- $desclimit);
- }
-
- $this->out->textarea('description', _('Description'),
- ($this->out->arg('description')) ? $this->out->arg('description') : $description,
- $descinstr);
-
- $this->out->checkbox('private', _('Private'), $private);
- $this->out->elementEnd('li');
- $this->out->elementEnd('ul');
- }
-
- function formActions()
- {
-
- $this->out->submit('submit', _('Save'));
- $this->out->submit('form_action-yes',
-
- _m('BUTTON','Delete'),
- 'submit',
- 'delete',
-
- _('Delete this list.'));
- }
- function showProfileList()
- {
- $tagged = $this->peopletag->getTagged();
-
- $this->out->element('h2', null, _('Add or remove people'));
- $this->out->elementStart('div', 'profile_search_wrap');
-
- $this->out->element('h3', null, _m('HEADER','Search'));
- $search = new SearchProfileForm($this->out, $this->peopletag);
- $search->show();
- $this->out->element('ul', array('id' => 'profile_search_results', 'class' => 'empty'));
- $this->out->elementEnd('div');
- $this->out->elementStart('ul', 'profile-lister');
- while ($tagged->fetch()) {
- $this->out->elementStart('li', 'entity_removable_profile');
- $this->showProfileItem($tagged);
- $this->out->elementStart('span', 'entity_actions');
- $untag = new UntagButton($this->out, $tagged, $this->peopletag);
- $untag->show();
- $this->out->elementEnd('span');
- $this->out->elementEnd('li');
- }
- $this->out->elementEnd('ul');
- }
- function showProfileItem($profile)
- {
- $item = new TaggedProfileItem($this->out, $profile);
- $item->show();
- }
- }
|