diff options
-rw-r--r-- | settings/css/oauth.css | 4 | ||||
-rw-r--r-- | settings/oauth.php | 33 | ||||
-rw-r--r-- | settings/templates/oauth-required-apps.php | 19 | ||||
-rw-r--r-- | settings/templates/oauth.php | 6 |
4 files changed, 53 insertions, 9 deletions
diff --git a/settings/css/oauth.css b/settings/css/oauth.css index 8bc8c8d428b..ccdb98cfa39 100644 --- a/settings/css/oauth.css +++ b/settings/css/oauth.css @@ -1,2 +1,4 @@ .guest-container{ width:35%; margin: 2em auto 0 auto; } -#oauth-request button{ float: right; }
\ No newline at end of file +#oauth-request a.button{ float: right; } +#oauth-request ul li{ list-style: disc; } +#oauth-request ul { margin-left: 2em; margin-top: 1em; } diff --git a/settings/oauth.php b/settings/oauth.php index 5fe21940b04..2592b926d17 100644 --- a/settings/oauth.php +++ b/settings/oauth.php @@ -23,13 +23,36 @@ switch($operation){ // Example $consumer = array( 'name' => 'Firefox Bookmark Sync', - 'scopes' => array('bookmarks'), + 'scopes' => array('ookmarks'), ); - $t = new OC_Template('settings', 'oauth', 'guest'); - OC_Util::addStyle('settings', 'oauth'); - $t->assign('consumer', $consumer); - $t->printPage(); + // Check that the scopes are real and installed + $apps = OC_App::getEnabledApps(); + $notfound = array(); + foreach($consumer['scopes'] as $requiredapp){ + if(!in_array($requiredapp, $apps)){ + $notfound[] = $requiredapp; + } + } + if(!empty($notfound)){ + // We need more apps :( Show error + if(count($notfound)==1){ + $message = 'requires that you have an extra app installed on your ownCloud. Please contact your ownCloud administrator and ask them to install the app below.'; + } else { + $message = 'requires that you have some extra apps installed on your ownCloud. Please contract your ownCloud administrator and ask them to install the apps below.'; + } + $t = new OC_Template('settings', 'oauth-required-apps', 'guest'); + OC_Util::addStyle('settings', 'oauth'); + $t->assign('requiredapps', $notfound); + $t->assign('consumer', $consumer); + $t->assign('message', $message); + $t->printPage(); + } else { + $t = new OC_Template('settings', 'oauth', 'guest'); + OC_Util::addStyle('settings', 'oauth'); + $t->assign('consumer', $consumer); + $t->printPage(); + } break; case 'access_token'; diff --git a/settings/templates/oauth-required-apps.php b/settings/templates/oauth-required-apps.php new file mode 100644 index 00000000000..d4fce54c59c --- /dev/null +++ b/settings/templates/oauth-required-apps.php @@ -0,0 +1,19 @@ +<?php +/** + * Copyright (c) 2012, Tom Needham <tom@owncloud.com> + * This file is licensed under the Affero General Public License version 3 or later. + * See the COPYING-README file. + */ +?> +<div id="oauth-request" class="guest-container"> + <p><strong><?php echo $_['consumer']['name'].'</strong> '.$_['message']; ?></p> + <ul> + <?php + // Foreach requested scope + foreach($_['requiredapps'] as $requiredapp){ + echo '<li>'.$requiredapp.'</li>'; + } + ?> + </ul> + <a href="<?php echo OC::$WEBROOT; ?>" id="back-home" class="button">Back to ownCloud</a> +</div> diff --git a/settings/templates/oauth.php b/settings/templates/oauth.php index b9fa67d8a35..053a8aee6d3 100644 --- a/settings/templates/oauth.php +++ b/settings/templates/oauth.php @@ -6,7 +6,7 @@ */ ?> <div id="oauth-request" class="guest-container"> - <p><strong><?php echo $_['consumer']['name']; ?></strong> is requesting permission to read, write, modify and delete data from the following apps:</p> + <p><strong><?php echo $_['consumer']['name']; ?></strong> is requesting your permission to read, write, modify and delete data from the following apps:</p> <ul> <?php // Foreach requested scope @@ -15,6 +15,6 @@ } ?> </ul> - <button>Allow</button> - <button>Disallow</button> + <a href="#" class="button">Allow</a> + <a href="#" class="button">Disallow</a> </div> |