示例#1
0
?>

<?php 
if ($protocol == "soap") {
    // only need old authentication information for SOAP APIs, its included in the swagger editor content for REST
    print '<div class="section">
			<label class="sectionHeader">' . t('Identify your application using') . '</label>
			<span class="highlightText"
				id="api_identify">' . ibm_apim_get_ident_label($api_authorization[0]['value']) . '</span>
			<span class="explanationText">&nbsp;-&nbsp;&nbsp;&nbsp;</span><span
				class="explanationText">' . ibm_apim_get_ident_explanation($api_authorization[0]['value']) . '</span>
		</div>

		<div class="section">
			<label class="sectionHeader">' . t('Authenticate using') . '</label>
			<span class="highlightText" id="api_auth">' . ibm_apim_get_auth_label($api_authentication[0]['value']) . '</span>
			<span class="explanationText">&nbsp;-&nbsp;&nbsp;&nbsp;</span><span
				class="explanationText">';
    switch ($api_authentication[0]['value']) {
        case 'basic':
            print t('You must always provide your user ID and password to use this API.') . '</span>';
            break;
        case 'none':
            print t('You can access this API without authentication.') . '</span>';
            break;
        case 'oauth':
            print t('You can use OAuth 2 to access this API.') . '</span>';
            print '<div class="oauthContainer">';
            print '<div><span class="explanationText">' . t('Authorization endpoint URL:') . ' </span>';
            print '<span class="oauthText">' . check_plain($variables['oauthconfig']['authorizationEndpointURL']) . '</span></div>';
            print '<div><span class="explanationText">' . t('Token endpoint URL:') . ' </span>';
 if (isset($isdev) && $isdev == TRUE) {
     $unsubscribelink = "<a href='" . url('application/' . $variables['application_apiid'][0]['safe_value'] . '/unsubscribe/' . check_plain($sub['subId'])) . "'>" . t('Unsubscribe') . "</a>";
 }
 $showversion = variable_get('ibm_apim_show_versions', 1);
 $versiontext = '';
 if ($showversion == 1) {
     $versiontext = ' (v' . $sub['version'] . ')';
 }
 print "<div class='appPlanName'>" . check_plain($sub['name']) . $versiontext . $pendingapp . " <span class='planUnsubscribe'>" . $unsubscribelink . "</span></div>";
 if (isset($sub['supersededBy']) && !empty($sub['supersededBy']) && isset($isdev) && $isdev == TRUE) {
     print "<div class='migratePlanContainer'><div class='migrateButton'>" . l(t('Migrate'), 'application/' . $application_apiid[0]['value'] . '/migrate/' . $sub['id'] . '/' . base64_encode($sub['supersededBy'])) . "</div><div class='migratePlanText'>" . t('A new version of this plan has been published.') . "</div></div>";
 }
 print "<div id='accordion'>";
 foreach ($sub['apis'] as $api) {
     $ident = ibm_apim_get_ident_label($api['authorization']);
     $auth = ibm_apim_get_auth_label($api['authentication']);
     $versiontext = '';
     if ($showversion == 1) {
         $versiontext = ' (v' . $api['version'] . ')';
     }
     print "<div><h3>" . check_plain($api['name']) . $versiontext . "<span class='testAPILink'>" . l(t('Details'), "api/" . $api['id'] . "/" . $api['version'], array('attributes' => array('class' => array('detailsLink')))) . "</span></h3>";
     print "<div class='portalApi animateMaxHeight'>";
     print "<div class='tableHeaderBackground clearTable'>\r\n\t\t\t<div class='column resourceMethod'>" . t('Verb') . "</div>\r\n\t\t\t<div class='column ascendingSort resourcePathShort'>" . t('Path') . "</div>\r\n\t\t\t<div class='column resourceName'>" . t('Name') . "</div>\r\n\t\t\t<div class='column resourceDesc'>" . t('Description') . "</div>\r\n\t\t\t<div class='column resourceRateLimit'>" . t('Rate Limit') . "</div>\r\n\t\t    <div class='column resourceAnalytics'>" . t('Analytics') . "</div>\r\n\t\t</div>\r\n\t <div class='resourceView resourcePlanView'>";
     foreach ($api['resources'] as $resource) {
         if (isset($resource['rateLimit']['numRequests'])) {
             $ratelimitstr = t('@requests requests per @period @timescale', array('@requests' => check_plain($resource['rateLimit']['numRequests']), '@period' => check_plain($resource['rateLimit']['timePeriod']), '@timescale' => check_plain($resource['rateLimit']['timeScale'])));
         } else {
             $ratelimitstr = t('unlimited');
         }
         print "<div class='displayInlineTop resourceHeadline'>\r\n\t\t <div class='displayInlineTop resourceMethod resourceMethodBadge " . strtoupper(check_plain($resource['verb'])) . "'>" . strtoupper(check_plain($resource['verb'])) . "</div>\r\n\t\t <div class='displayInlineTop resourcePathShort boundedText' title='" . check_plain($api['context']) . check_plain($resource['path']) . "'>" . check_plain($api['context']) . check_plain($resource['path']) . "</div>\r\n\t\t <div class='displayInlineTop resourceName boundedText' title='" . check_plain($resource['name']) . "'>" . check_plain($resource['name']) . "</div>\r\n\t\t <div class='displayInlineTop resourceDesc boundedText' title='" . check_plain($resource['description']) . "'>" . check_plain($resource['description']) . "</div>\r\n\t\t <div class='displayInlineTop boundedText tableLabel'>" . t('Rate Limit:') . "</div>\r\n\t\t <div class='displayInlineTop resourceRateLimit'>" . $ratelimitstr . "</div>";
         if (isset($sub['approved']) && $sub['approved'] == false) {