]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - lib/applicationeditform.php
.inc.php please ...
[quix0rs-gnu-social.git] / lib / applicationeditform.php
index 6f03a9beda7538bdb4d4d07db5da792185b7165e..4b4356e72184e26b5f0fc98a9b8e7049c46be958 100644 (file)
@@ -43,13 +43,11 @@ require_once INSTALLDIR . '/lib/form.php';
  * @link     http://status.net/
  *
  */
-
 class ApplicationEditForm extends Form
 {
     /**
      * group for user to join
      */
-
     var $application = null;
 
     /**
@@ -58,7 +56,6 @@ class ApplicationEditForm extends Form
      * @param Action     $out   output channel
      * @param User_group $group group to join
      */
-
     function __construct($out=null, $application=null)
     {
         parent::__construct($out);
@@ -71,7 +68,6 @@ class ApplicationEditForm extends Form
      *
      * @return string ID of the form
      */
-
     function id()
     {
         if ($this->application) {
@@ -89,7 +85,6 @@ class ApplicationEditForm extends Form
      *
      * @return string the method to use for submitting
      */
-
     function method()
     {
         $this->enctype = 'multipart/form-data';
@@ -101,7 +96,6 @@ class ApplicationEditForm extends Form
      *
      * @return string of the form class
      */
-
     function formClass()
     {
         return 'form_settings';
@@ -112,7 +106,6 @@ class ApplicationEditForm extends Form
      *
      * @return string URL of the action
      */
-
     function action()
     {
         $cur = common_current_user();
@@ -130,9 +123,9 @@ class ApplicationEditForm extends Form
      *
      * @return void
      */
-
     function formLegend()
     {
+        // TRANS: Form legend.
         $this->out->element('legend', null, _('Edit application'));
     }
 
@@ -141,7 +134,6 @@ class ApplicationEditForm extends Form
      *
      * @return void
      */
-
     function formData()
     {
         if ($this->application) {
@@ -168,8 +160,6 @@ class ApplicationEditForm extends Form
             $this->access_type = '';
         }
 
-        $this->out->hidden('token', common_session_token());
-
         $this->out->elementStart('ul', 'form_data');
 
         $this->out->elementStart('li', array('id' => 'application_icon'));
@@ -178,22 +168,25 @@ class ApplicationEditForm extends Form
             $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'));
         $this->out->element('input', array('name' => 'app_icon',
                                            'type' => 'file',
                                            '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');
 
         $this->out->hidden('application_id', $id);
 
+        // TRANS: Form input field label for application name.
         $this->out->input('name', _('Name'),
                           ($this->out->arg('name')) ? $this->out->arg('name') : $name);
 
@@ -203,11 +196,15 @@ class ApplicationEditForm extends Form
 
         $maxDesc = Oauth_application::maxDesc();
         if ($maxDesc > 0) {
-            $descInstr = sprintf(_('Describe your application in %d characters'),
+            // TRANS: Form input field instructions.
+            // 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.
             $descInstr = _('Describe your application');
         }
+        // TRANS: Form input field label.
         $this->out->textarea('description', _('Description'),
                         ($this->out->arg('description')) ? $this->out->arg('description') : $description,
                              $descInstr);
@@ -215,27 +212,39 @@ class ApplicationEditForm extends Form
         $this->out->elementEnd('li');
 
         $this->out->elementStart('li');
+        // TRANS: Form input field instructions.
+        $instruction = _('URL of the homepage of this application');
+        // TRANS: Form input field label.
         $this->out->input('source_url', _('Source URL'),
                           ($this->out->arg('source_url')) ? $this->out->arg('source_url') : $source_url,
-                          _('URL of the homepage of this application'));
+                          $instruction);
         $this->out->elementEnd('li');
 
         $this->out->elementStart('li');
+        // TRANS: Form input field instructions.
+        $instruction = _('Organization responsible for this application');
+        // TRANS: Form input field label.
         $this->out->input('organization', _('Organization'),
                           ($this->out->arg('organization')) ? $this->out->arg('organization') : $organization,
-                          _('Organization responsible for this application'));
+                          $instruction);
         $this->out->elementEnd('li');
 
         $this->out->elementStart('li');
+        // TRANS: Form input field instructions.
+        $instruction = _('URL for the homepage of the organization');
+        // TRANS: Form input field label.
         $this->out->input('homepage', _('Homepage'),
                           ($this->out->arg('homepage')) ? $this->out->arg('homepage') : $homepage,
-                          _('URL for the homepage of the organization'));
+                          $instruction);
         $this->out->elementEnd('li');
 
         $this->out->elementStart('li');
+        // TRANS: Form input field instructions.
+        $instruction = _('URL to redirect to after authentication');
+        // TRANS: Form input field label.
         $this->out->input('callback_url', ('Callback URL'),
                           ($this->out->arg('callback_url')) ? $this->out->arg('callback_url') : $callback_url,
-                          _('URL to redirect to after authentication'));
+                          $instruction);
         $this->out->elementEnd('li');
 
         $this->out->elementStart('li', array('id' => 'application_types'));
@@ -248,8 +257,9 @@ class ApplicationEditForm extends Form
 
         // 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';
         }
 
@@ -257,6 +267,7 @@ class ApplicationEditForm extends Form
 
         $this->out->element('label', array('for' => 'app_type-browser',
                                            'class' => 'radio'),
+                            // TRANS: Radio button label for application type
                             _('Browser'));
 
         $attrs = array('name' => 'app_type',
@@ -265,7 +276,7 @@ class ApplicationEditForm extends Form
                        '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';
         }
 
@@ -273,7 +284,9 @@ class ApplicationEditForm extends Form
 
         $this->out->element('label', array('for' => 'app_type-desktop',
                                            'class' => 'radio'),
+                            // TRANS: Radio button label for application type
                             _('Desktop'));
+        // TRANS: Form guide.
         $this->out->element('p', 'form_guide', _('Type of application, browser or desktop'));
         $this->out->elementEnd('li');
 
@@ -287,8 +300,9 @@ class ApplicationEditForm extends Form
 
         // 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';
         }
 
@@ -296,6 +310,7 @@ class ApplicationEditForm extends Form
 
         $this->out->element('label', array('for' => 'default_access_type-ro',
                                            'class' => 'radio'),
+                            // TRANS: Radio button label for access type.
                             _('Read-only'));
 
         $attrs = array('name' => 'default_access_type',
@@ -304,7 +319,8 @@ class ApplicationEditForm extends Form
                        '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';
@@ -314,7 +330,9 @@ class ApplicationEditForm extends Form
 
         $this->out->element('label', array('for' => 'default_access_type-rw',
                                            'class' => 'radio'),
+                            // TRANS: Radio button label for access type.
                             _('Read-write'));
+        // TRANS: Form guide.
         $this->out->element('p', 'form_guide', _('Default access for this application: read-only, or read-write'));
 
         $this->out->elementEnd('li');
@@ -327,12 +345,15 @@ class ApplicationEditForm extends Form
      *
      * @return void
      */
-
     function formActions()
     {
-        $this->out->submit('cancel', _('Cancel'), 'submit form_action-primary',
-                           'cancel', _('Cancel'));
-        $this->out->submit('save', _('Save'), 'submit form_action-secondary',
-                           'save', _('Save'));
+        // 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 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 application changes.'));
     }
 }