* @link http://status.net/
*
*/
-
class ApplicationEditForm extends Form
{
/**
* group for user to join
*/
-
var $application = null;
/**
* @param Action $out output channel
* @param User_group $group group to join
*/
-
function __construct($out=null, $application=null)
{
parent::__construct($out);
*
* @return string ID of the form
*/
-
function id()
{
if ($this->application) {
*
* @return string the method to use for submitting
*/
-
function method()
{
$this->enctype = 'multipart/form-data';
*
* @return string of the form class
*/
-
function formClass()
{
return 'form_settings';
*
* @return string URL of the action
*/
-
function action()
{
$cur = common_current_user();
*
* @return void
*/
-
function formLegend()
{
// TRANS: Form legend.
*
* @return void
*/
-
function formData()
{
if ($this->application) {
$this->out->element('img', array('src' => $icon));
}
+ $this->out->element('input', array('name' => 'MAX_FILE_SIZE',
+ 'type' => 'hidden',
+ 'id' => 'MAX_FILE_SIZE',
+ 'value' => ImageFile::maxFileSizeInt()));
$this->out->element('label', array('for' => 'app_icon'),
// TRANS: Form input field label for application icon.
_('Icon'));
'id' => 'app_icon'));
// TRANS: Form guide.
$this->out->element('p', 'form_guide', _('Icon for this application'));
- $this->out->element('input', array('name' => 'MAX_FILE_SIZE',
- 'type' => 'hidden',
- 'id' => 'MAX_FILE_SIZE',
- 'value' => ImageFile::maxFileSizeInt()));
$this->out->elementEnd('li');
$this->out->elementStart('li');
$maxDesc = Oauth_application::maxDesc();
if ($maxDesc > 0) {
// TRANS: Form input field instructions.
- $descInstr = sprintf(_('Describe your application in %d characters'),
+ // TRANS: %d is the number of available characters for the description.
+ $descInstr = sprintf(_m('Describe your application in %d character','Describe your application in %d characters',$maxDesc),
$maxDesc);
} else {
// TRANS: Form input field instructions.
// Default to Browser
- if ($this->application->type == Oauth_application::$browser
- || empty($this->application->type)) {
+ if (empty($this->application)
+ || empty($this->application->type)
+ || $this->application->type == Oauth_application::$browser) {
$attrs['checked'] = 'checked';
}
'class' => 'radio',
'value' => Oauth_application::$desktop);
- if ($this->application->type == Oauth_application::$desktop) {
+ if (!empty($this->application) && $this->application->type == Oauth_application::$desktop) {
$attrs['checked'] = 'checked';
}
// default to read-only access
- if ($this->application->access_type & Oauth_application::$readAccess
- || empty($this->application->access_type)) {
+ if (empty($this->application)
+ || empty($this->application->access_type)
+ || $this->application->access_type & Oauth_application::$readAccess) {
$attrs['checked'] = 'checked';
}
'class' => 'radio',
'value' => 'rw');
- if ($this->application->access_type & Oauth_application::$readAccess
+ if (!empty($this->application)
+ && $this->application->access_type & Oauth_application::$readAccess
&& $this->application->access_type & Oauth_application::$writeAccess
) {
$attrs['checked'] = 'checked';
*
* @return void
*/
-
function formActions()
{
- // TRANS: Button label
+ // TRANS: Button label in the "Edit application" form.
$this->out->submit('cancel', _m('BUTTON','Cancel'), 'submit form_action-primary',
- // TRANS: Submit button title
- 'cancel', _('Cancel'));
- // TRANS: Button label
+ // TRANS: Submit button title.
+ 'cancel', _('Cancel application changes.'));
+ // TRANS: Button label in the "Edit application" form.
$this->out->submit('save', _m('BUTTON','Save'), 'submit form_action-secondary',
- // TRANS: Submit button title
- 'save', _('Save'));
+ // TRANS: Submit button title.
+ 'save', _('Save application changes.'));
}
}