From 1158ea3fe130a94214c8e2d7c2317a26c66597b1 Mon Sep 17 00:00:00 2001
From: Jared Hancock <jared@osticket.com>
Date: Mon, 12 May 2014 10:45:10 -0500
Subject: [PATCH] tips: Add tips for api-keys

---
 .../en_US/help/tips/manage.addnew_api.yaml    | 40 -------------------
 .../i18n/en_US/help/tips/manage.api_keys.yaml | 20 +++++-----
 include/staff/apikey.inc.php                  | 10 ++++-
 scp/apikeys.php                               |  4 +-
 4 files changed, 19 insertions(+), 55 deletions(-)
 delete mode 100644 include/i18n/en_US/help/tips/manage.addnew_api.yaml

diff --git a/include/i18n/en_US/help/tips/manage.addnew_api.yaml b/include/i18n/en_US/help/tips/manage.addnew_api.yaml
deleted file mode 100644
index 668ea53db..000000000
--- a/include/i18n/en_US/help/tips/manage.addnew_api.yaml
+++ /dev/null
@@ -1,40 +0,0 @@
-#
-# This is popup help messages for the Admin Panel -> Manage -> Add New API Key
-#
-# Fields:
-# title - Shown in bold at the top of the popover window
-# content - The body of the help popover
-# links - List of links shows below the content
-#   title - Link title
-#   href - href of link (links starting with / are translated to the
-#       helpdesk installation path)
-#
-# The key names such as 'helpdesk_name' should not be translated as they
-# must match the HTML #ids put into the page template.
-#
----
-status:
-    title: Status
-    content: >
-
-ip_address:
-    title: IP Address
-    content: >
-
-services:
-    title: Services
-    content: >
-
-can_create_tickets:
-    title: Can Create Tickets
-    content: >
-        Define various options (XML/JSON/Email) and how they will affect the user
-        experience.
-
-can_execute_cron:
-    title: Can Execute Cron
-    content: >
-        <span class="doc-tip-title">Cron</span> is a techincal reference to
-        scheduled tasks. Allowing cron execution via the API enables usage
-        of the <cron>rcron.php</cron> script packaged in the
-        <code>scripts/</code> folder with the system.
diff --git a/include/i18n/en_US/help/tips/manage.api_keys.yaml b/include/i18n/en_US/help/tips/manage.api_keys.yaml
index 6fe6e7c81..f7bdbdae7 100644
--- a/include/i18n/en_US/help/tips/manage.api_keys.yaml
+++ b/include/i18n/en_US/help/tips/manage.api_keys.yaml
@@ -13,22 +13,20 @@
 # must match the HTML #ids put into the page template.
 #
 ---
-add_new_api_key:
-    title: Add New API Key
-    content: >
-
-api_keys_table:
-    title: API Keys
-    content: >
 
 api_key:
     title: API Key
     content: >
+        API keys are used to authenticate clients submitting new tickets via
+        the Application Programming Interface (API). API keys are used
+        instead of passwords. Since API keys may be sent unencrypted, they
+        are linked to each client's network IP address.
+    links:
+      - title: osTicket API Documentation
+        href: https://github.com/osTicket/osTicket-1.8/blob/develop/setup/doc/api.md
 
 ip_addr:
     title: IP Address
     content: >
-
-status:
-    title: Status
-    content: >
+        Client's network IP address. Each unique client IP address will
+        require separate API keys
diff --git a/include/staff/apikey.inc.php b/include/staff/apikey.inc.php
index b559678c2..9de6a2f75 100644
--- a/include/staff/apikey.inc.php
+++ b/include/staff/apikey.inc.php
@@ -22,7 +22,9 @@ $info=Format::htmlchars(($errors && $_POST)?$_POST:$info);
  <input type="hidden" name="do" value="<?php echo $action; ?>">
  <input type="hidden" name="a" value="<?php echo Format::htmlchars($_REQUEST['a']); ?>">
  <input type="hidden" name="id" value="<?php echo $info['id']; ?>">
- <h2>API Key</h2>
+ <h2>API Key
+    <i class="help-tip icon-question-sign" href="#api_key"></i>
+    </h2>
  <table class="form_table" width="940" border="0" cellspacing="0" cellpadding="2">
     <thead>
         <tr>
@@ -49,7 +51,10 @@ $info=Format::htmlchars(($errors && $_POST)?$_POST:$info);
                 IP Address:
             </td>
             <td>
+                <span>
                 <?php echo $api->getIPAddr(); ?>
+                <i class="help-tip icon-question-sign" href="#ip_addr"></i>
+                </span>
             </td>
         </tr>
         <tr>
@@ -64,8 +69,11 @@ $info=Format::htmlchars(($errors && $_POST)?$_POST:$info);
                IP Address:
             </td>
             <td>
+                <span>
                 <input type="text" size="30" name="ipaddr" value="<?php echo $info['ipaddr']; ?>">
                 &nbsp;<span class="error">*&nbsp;<?php echo $errors['ipaddr']; ?></span>
+                <i class="help-tip icon-question-sign" href="#ip_addr"></i>
+                </span>
             </td>
         </tr>
         <?php } ?>
diff --git a/scp/apikeys.php b/scp/apikeys.php
index 9f511ecda..529b67a8a 100644
--- a/scp/apikeys.php
+++ b/scp/apikeys.php
@@ -96,10 +96,8 @@ if($_POST){
 $page='apikeys.inc.php';
 $tip_namespace = 'manage.api_keys';
 
-if($api || ($_REQUEST['a'] && !strcasecmp($_REQUEST['a'],'add'))) {
+if($api || ($_REQUEST['a'] && !strcasecmp($_REQUEST['a'],'add')))
     $page = 'apikey.inc.php';
-    $tip_namespace = 'manage.addnew_api';
-}
 
 $nav->setTabActive('manage');
 $ost->addExtraHeader('<meta name="tip-namespace" content="' . $tip_namespace . '" />',
-- 
GitLab