123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232 |
- <?php
- if (!defined('STATUSNET') && !defined('LACONICA')) {
- exit(1);
- }
- require_once INSTALLDIR . '/lib/util/form.php';
- class GroupEditForm extends Form
- {
-
- var $group = null;
-
- function __construct($out=null, $group=null)
- {
- parent::__construct($out);
- $this->group = $group;
- }
-
- function id()
- {
- if ($this->group) {
- return 'form_group_edit-' . $this->group->id;
- } else {
- return 'form_group_add';
- }
- }
-
- function formClass()
- {
- return 'form_settings';
- }
-
- function action()
- {
- if ($this->group) {
- return common_local_url('editgroup',
- array('nickname' => $this->group->nickname));
- } else {
- return common_local_url('newgroup');
- }
- }
-
- function formLegend()
- {
-
- $this->out->element('legend', null, _('Create a new group'));
- }
-
- function formData()
- {
- if ($this->group) {
- $id = $this->group->id;
- $nickname = $this->group->nickname;
- $fullname = $this->group->fullname;
- $homepage = $this->group->homepage;
- $description = $this->group->description;
- $location = $this->group->location;
- } else {
- $id = '';
- $nickname = '';
- $fullname = '';
- $homepage = '';
- $description = '';
- $location = '';
- }
- $this->out->elementStart('ul', 'form_data');
- if (Event::handle('StartGroupEditFormData', array($this))) {
- $this->out->elementStart('li');
- $this->out->hidden('groupid', $id);
-
- $this->out->input('newnickname', _('Nickname'),
- ($this->out->arg('newnickname')) ? $this->out->arg('newnickname') : $nickname,
-
- _('1-64 lowercase letters or numbers, no punctuation or spaces.'),
- null, false,
- $this->group instanceof User_group && !common_config('profile', 'changenick')
- ? array('disabled'=>'disabled')
- : array());
- $this->out->elementEnd('li');
- $this->out->elementStart('li');
-
- $this->out->input('fullname', _('Full name'),
- ($this->out->arg('fullname')) ? $this->out->arg('fullname') : $fullname);
- $this->out->elementEnd('li');
- $this->out->elementStart('li');
-
- $this->out->input('homepage', _('Homepage'),
- ($this->out->arg('homepage')) ? $this->out->arg('homepage') : $homepage,
-
- _('URL of the homepage or blog of the group or topic.'));
- $this->out->elementEnd('li');
- $this->out->elementStart('li');
- $desclimit = User_group::maxDescription();
- if ($desclimit == 0) {
-
- $descinstr = _('Describe the group or topic.');
- } else {
-
-
- $descinstr = sprintf(_m('Describe the group or topic in %d character or less.',
- 'Describe the group or topic in %d characters or less.',
- $desclimit),
- $desclimit);
- }
-
- $this->out->textarea('description', _('Description'),
- ($this->out->arg('description')) ? $this->out->arg('description') : $description,
- $descinstr);
- $this->out->elementEnd('li');
- $this->out->elementStart('li');
-
- $this->out->input('location', _('Location'),
- ($this->out->arg('location')) ? $this->out->arg('location') : $location,
-
- _('Location for the group, if any, like "City, State (or Region), Country".'));
- $this->out->elementEnd('li');
- if (common_config('group', 'maxaliases') > 0) {
- $aliases = (empty($this->group)) ? array() : $this->group->getAliases();
- $this->out->elementStart('li');
-
- $this->out->input('aliases', _('Aliases'),
- ($this->out->arg('aliases')) ? $this->out->arg('aliases') :
- (!empty($aliases)) ? implode(' ', $aliases) : '',
-
-
- sprintf(_m('Extra nicknames for the group, separated with commas or spaces. Maximum %d alias allowed.',
- 'Extra nicknames for the group, separated with commas or spaces. Maximum %d aliases allowed.',
- common_config('group', 'maxaliases')),
- common_config('group', 'maxaliases')));;
- $this->out->elementEnd('li');
- }
- $this->out->elementStart('li');
-
- $this->out->checkbox('private', _m('LABEL','Private'),
- ($this->out->arg('private')) ? $this->out->arg('private') :
- ((!empty($this->group)) ? $this->group->isPrivate() : false),
-
- _('New members must be approved by admin and all posts are forced to be private.'));
- $this->out->elementEnd('li');
- Event::handle('EndGroupEditFormData', array($this));
- }
- $this->out->elementEnd('ul');
- }
-
- function formActions()
- {
-
- $this->out->submit('submit', _m('BUTTON','Save'));
- }
- }
|