[dev] [PATCH] PGP and S/MIME key import settings (take 2)

Sergei Turchanov sergei.turchanov at vvsu.ru
Thu May 5 19:50:27 PDT 2005


Hello,

this patch reorganizes S/MIME public/personal certficate import to match
PGP options page.

Also clearly indicate requirements for key import:
file upload support and address book to modify contacts (add_source != '').

-- 
With best regards,
Sergei Turchanov.




-------------- next part --------------
Index: horde2/imp/templates/pgp/pgp.inc
===================================================================
RCS file: /repository/imp/templates/pgp/pgp.inc,v
retrieving revision 1.36
diff -u -r1.36 pgp.inc
--- horde2/imp/templates/pgp/pgp.inc	15 Apr 2005 12:57:21 -0000	1.36
+++ horde2/imp/templates/pgp/pgp.inc	6 May 2005 01:05:30 -0000
@@ -36,14 +36,18 @@
 <?php endif; ?>
 </div>
 
-<?php if ($imp['file_upload']): ?>
 <br class="spacer" />
 <div class="nowrap">
+<?php if (!$imp['file_upload']): ?>
+  <span style="color:red"><?php echo _("Key import is not available. File upload is not enabled in your PHP configuration.") ?></span>
+<?php elseif (!$GLOBALS['prefs']->getValue('add_source')): ?>
+  <strong><?php echo _("Key import is not available. You have no address book defined to add/modify your contacts.") ?></strong>
+<?php else: ?>
   <?php $public_import_url = Util::addParameter(Util::addParameter($selfURL, 'actionID', 'import_public_key'), 'reload', $selfURL); ?>
   <input type="submit" name="save" class="button" onclick="open_pgp_import('<?php echo $public_import_url ?>'); return false;" value="<?php echo _("Import Public Key") ?>" />
   <?php echo Help::link('imp', 'pgp-import-pubkey') ?>
-</div>
 <?php endif; ?>
+</div>
 
 <br class="spacer" />
 <div class="header">
Index: horde2/imp/templates/smime/smime.inc
===================================================================
RCS file: /repository/imp/templates/smime/smime.inc,v
retrieving revision 1.33
diff -u -r1.33 smime.inc
--- horde2/imp/templates/smime/smime.inc	2 May 2005 20:44:24 -0000	1.33
+++ horde2/imp/templates/smime/smime.inc	6 May 2005 01:05:30 -0000
@@ -5,9 +5,6 @@
 <br class="spacer" />
 <div class="header">
   <ul>
-<?php if ($imp['file_upload']): ?>
-    <li><?php echo Horde::link('#', _("Import Public Key"), '', '', 'open_smime_import(\'' . Util::addParameter($selfURL, array('actionID' => 'import_public_key', 'reload' => $selfURL)) . '\');return false;') . _("Import Public Key"); ?></a></li>
-<?php endif; ?>
     <li><?php echo Help::link('imp', 'smime-manage-pubkey') ?></li>
   </ul>
   <?php echo _("S/MIME Public Keyring") ?>
@@ -33,11 +30,20 @@
 </div>
 
 <br class="spacer" />
+<div class="nowrap">
+<?php if (!$imp['file_upload']): ?>
+  <span style="color:red"><?php echo _("Key import is not available. File upload is not enabled in your PHP configuration.") ?></span>
+<?php elseif (!$GLOBALS['prefs']->getValue('add_source')): ?>
+  <strong><?php echo _("Key import is not available. You have no address book defined to add/modify your contacts.") ?></strong>
+<?php else: ?>
+  <?php $public_import_url = Util::addParameter($selfURL, array('actionID' => 'import_public_key', 'reload' => $selfURL)); ?>
+  <input type="submit" name="save" class="button" onclick="open_smime_import('<?php echo $public_import_url ?>'); return false;" value="<?php echo _("Import Public Key") ?>" />
+<?php endif; ?>
+</div>
+
+<br class="spacer" />
 <div class="header">
   <ul>
-<?php if ($imp['file_upload'] && (!$prefs->getValue('smime_public_key') || !$prefs->getValue('smime_private_key'))): ?>
-    <li><?php $personal_import_url = Util::addParameter($selfURL, 'actionID', 'import_personal_certs'); echo Horde::link('#', _("Import Personal Certificate"), '', '', 'open_smime_import(\'' . Util::addParameter($selfURL, 'actionID', 'import_personal_certs') . '\'); return false;') . _("Import Personal Certificate"); ?></a></li>
-<?php endif; ?>
     <li><?php echo Help::link('imp', 'smime-overview-personalkey') ?></li>
   </ul>
   <?php echo _("Your S/MIME Public/Private Certificates") ?>
@@ -77,6 +83,16 @@
 <?php else: ?>
 <strong><?php echo _("No Personal Certificate Present") ?></strong>
 </div>
+
+<br class="spacer" />
+<div class="nowrap">
+<?php   if ($imp['file_upload']): ?>
+  <?php $personal_import_url = Util::addParameter($selfURL, 'actionID', 'import_personal_certs'); ?>
+  <input type="submit" name="save" class="button" onclick="open_smime_import('<?php echo $personal_import_url ?>'); return false;" value="<?php echo _("Import Personal Certificate") ?>" />
+<?php   else: ?>
+  <span style="color:red"><?php echo _("Certificate import is not available. File upload is not enabled in your PHP configuration.") ?></span>
+<?php   endif; ?>
+</div>
 <?php endif; ?>
 
 <br class="spacer" />


More information about the dev mailing list