]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - actions/showapplication.php
Merge branch 'testing' of git@gitorious.org:statusnet/mainline into testing
[quix0rs-gnu-social.git] / actions / showapplication.php
index 6d19b9561c29ef72d3609f5f113e57e117f50fd8..090e11882ebe49c6f0b59cc4f3f097dc6990a9f3 100644 (file)
@@ -92,6 +92,7 @@ class ShowApplicationAction extends OwnerDesignAction
 
         if ($cur->id != $this->owner->id) {
             $this->clientError(_('You are not the owner of this application.'), 401);
+            return false;
         }
 
         return true;
@@ -151,114 +152,128 @@ class ShowApplicationAction extends OwnerDesignAction
 
         $cur = common_current_user();
 
-        $this->elementStart('div', 'entity_actions');
-
-        $this->element('a',
-            array('href' =>
-                common_local_url(
-                    'editapplication',
-                    array(
-                        'nickname' => $this->owner->nickname,
-                        'id' => $this->application->id
-                    )
-                )
-            ), 'Edit application');
-
-        $this->elementStart('form', array(
-            'id' => 'forma_reset_key',
-            'class' => 'form_reset_key',
-            'method' => 'POST',
-            'action' => common_local_url('showapplication',
-                array('nickname' => $cur->nickname,
-                      'id' => $this->application->id))));
-
-        $this->elementStart('fieldset');
-        $this->hidden('token', common_session_token());
-        $this->submit('reset', _('Reset Consumer key/secret'));
-        $this->elementEnd('fieldset');
-        $this->elementEnd('form');
-
-        $this->elementEnd('div');
-
         $consumer = $this->application->getConsumer();
 
-        $this->elementStart('div', 'entity-application');
-
-        $this->elementStart('ul', 'entity_application_details');
-
-       $this->elementStart('li', 'entity_application-icon');
-
-       if (!empty($this->application->icon)) {
-           $this->element('img', array('src' => $this->application->icon));
-       }
-
-       $this->elementEnd('li');
+        $this->elementStart('div', 'entity_profile vcard');
+        $this->element('h2', null, _('Application profile'));
+        $this->elementStart('dl', 'entity_depiction');
+        $this->element('dt', null, _('Icon'));
+        $this->elementStart('dd');
+        if (!empty($this->application->icon)) {
+            $this->element('img', array('src' => $this->application->icon,
+                                        'class' => 'photo logo'));
+        }
+        $this->elementEnd('dd');
+        $this->elementEnd('dl');
 
-        $this->elementStart('li', 'entity_application_name');
-        $this->element('span', array('class' => 'big'), $this->application->name);
-        $this->raw(sprintf(_(' by %1$s'), $this->application->organization));
-        $this->elementEnd('li');
+        $this->elementStart('dl', 'entity_fn');
+        $this->element('dt', null, _('Name'));
+        $this->elementStart('dd');
+        $this->element('a', array('href' =>  $this->application->source_url,
+                                  'class' => 'url fn'),
+                            $this->application->name);
+        $this->elementEnd('dd');
+        $this->elementEnd('dl');
 
-        $this->element('li', 'entity_application_description', $this->application->description);
+        $this->elementStart('dl', 'entity_org');
+        $this->element('dt', null, _('Organization'));
+        $this->elementStart('dd');
+        $this->element('a', array('href' =>  $this->application->homepage,
+                                  'class' => 'url'),
+                            $this->application->organization);
+        $this->elementEnd('dd');
+        $this->elementEnd('dl');
 
-        $this->elementStart('li', 'entity_application_statistics');
+        $this->elementStart('dl', 'entity_note');
+        $this->element('dt', null, _('Description'));
+        $this->element('dd', 'note', $this->application->description);
+        $this->elementEnd('dl');
 
+        $this->elementStart('dl', 'entity_statistics');
+        $this->element('dt', null, _('Statistics'));
+        $this->elementStart('dd');
         $defaultAccess = ($this->application->access_type & Oauth_application::$writeAccess)
             ? 'read-write' : 'read-only';
         $profile = Profile::staticGet($this->application->owner);
-        $userCnt = 0; // XXX: count how many users use the app
+
+        $appUsers = new Oauth_application_user();
+        $appUsers->application_id = $this->application->id;
+        $userCnt = $appUsers->count();
 
         $this->raw(sprintf(
-            _('Created by %1$s - %2$s access by default - %3$d users.'),
+            _('Created by %1$s - %2$s access by default - %3$d users'),
               $profile->getBestName(),
               $defaultAccess,
               $userCnt
             ));
+        $this->elementEnd('dd');
+        $this->elementEnd('dl');
+        $this->elementEnd('div');
 
+        $this->elementStart('div', 'entity_actions');
+        $this->element('h2', null, _('Application actions'));
+        $this->elementStart('ul');
+        $this->elementStart('li', 'entity_edit');
+        $this->element('a',
+                       array('href' => common_local_url('editapplication',
+                                                        array('id' => $this->application->id))),
+                       'Edit');
         $this->elementEnd('li');
 
+        $this->elementStart('li', 'entity_reset_keysecret');
+        $this->elementStart('form', array(
+            'id' => 'forma_reset_key',
+            'class' => 'form_reset_key',
+            'method' => 'POST',
+            'action' => common_local_url('showapplication',
+                                         array('id' => $this->application->id))));
+
+        $this->elementStart('fieldset');
+        $this->hidden('token', common_session_token());
+        $this->submit('reset', _('Reset key & secret'));
+        $this->elementEnd('fieldset');
+        $this->elementEnd('form');
+        $this->elementEnd('li');
         $this->elementEnd('ul');
+        $this->elementEnd('div');
 
+        $this->elementStart('div', 'entity_data');
+        $this->element('h2', null, _('Application info'));
         $this->elementStart('dl', 'entity_consumer_key');
         $this->element('dt', null, _('Consumer key'));
-        $this->element('dd', 'label', $consumer->consumer_key);
+        $this->element('dd', null, $consumer->consumer_key);
         $this->elementEnd('dl');
 
         $this->elementStart('dl', 'entity_consumer_secret');
         $this->element('dt', null, _('Consumer secret'));
-        $this->element('dd', 'label', $consumer->consumer_secret);
+        $this->element('dd', null, $consumer->consumer_secret);
         $this->elementEnd('dl');
 
         $this->elementStart('dl', 'entity_request_token_url');
         $this->element('dt', null, _('Request token URL'));
-        $this->element('dd', 'label', common_local_url('oauthrequesttoken'));
+        $this->element('dd', null, common_local_url('apioauthrequesttoken'));
         $this->elementEnd('dl');
 
         $this->elementStart('dl', 'entity_access_token_url');
         $this->element('dt', null, _('Access token URL'));
-        $this->element('dd', 'label', common_local_url('oauthaccesstoken'));
+        $this->element('dd', null, common_local_url('apioauthaccesstoken'));
         $this->elementEnd('dl');
 
         $this->elementStart('dl', 'entity_authorize_url');
         $this->element('dt', null, _('Authorize URL'));
-        $this->element('dd', 'label', common_local_url('oauthauthorize'));
+        $this->element('dd', null, common_local_url('apioauthauthorize'));
         $this->elementEnd('dl');
 
-        $this->element('p', 'oauth-signature-note',
-            '*We support hmac-sha1 signatures. We do not support the plaintext signature method.');
-
+        $this->element('p', 'note',
+            _('Note: We support HMAC-SHA1 signatures. We do not support the plaintext signature method.'));
         $this->elementEnd('div');
 
-        $this->elementStart('div', 'entity-list-apps');
+        $this->elementStart('p', array('id' => 'application_action'));
         $this->element('a',
-            array(
-                'href' => common_local_url(
-                    'apps',
-                    array('nickname' => $this->owner->nickname)
-                )
-            ),
-            'View your applications');
-        $this->elementEnd('div');
+            array('href' => common_local_url('oauthappssettings'),
+                  'class' => 'more'),
+                  'View your applications');
+        $this->elementEnd('p');
     }
 
     function resetKey()
@@ -310,4 +325,3 @@ class ShowApplicationAction extends OwnerDesignAction
     }
 
 }
-