# This patch file was generated by NetBeans IDE
# This patch can be applied using context Tools: Apply Diff Patch action on respective folder.
# It uses platform neutral UTF-8 encoding.
# Above lines and this line are ignored by the patching process.
Index: extlink/extlink.js
--- extlink/extlink.js Base (1.4.2.1)
+++ extlink/extlink.js Locally Modified (Based On 1.4.2.1)
@@ -65,8 +65,21 @@
     }
 
     if (Drupal.settings.extlink.extTarget) {
+      if (Drupal.settings.extlink.extTarget == "ext_iframe") {
+        $(external_links).attr('href', function() {
+          return "/extlink_iframe/" + $(this).attr('href').replace(/^https?:\/\//, "")
+        });
+        $(external_links).removeAttr('target');
+      }
+      else if (Drupal.settings.extlink.extTarget == "ext_frame" && (top.location == self.location)) {
+        $(external_links).attr('href', function() {
+          return "/extlink_frame" + document.location.pathname.replace(/\/$/, "") +  "/--/" + $(this).attr('href').replace(/^https?:\/\//, "")
+        });
+        $(external_links).removeAttr('target');
+      } else {
       // Apply the target attribute to all links.
       $(external_links).attr('target', Drupal.settings.extlink.extTarget);
     }
+    }
   });
 }
Index: extlink/extlink.module
--- extlink/extlink.module Base (1.3.2.2)
+++ extlink/extlink.module Locally Modified (Based On 1.3.2.2)
@@ -11,6 +11,18 @@
     'access callback' => 'user_access',
     'access arguments' => array('administer site configuration'),
   );
+  $items['extlink_frame'] = array(
+    'title' => 'Frame',
+    'page callback' => 'extlink_frame',
+    'access arguments' => array('access frame'),
+    'type' => MENU_CALLBACK,
+  );
+  $items['extlink_iframe'] = array(
+    'title' => 'iFrame',
+    'page callback' => 'extlink_iframe',
+    'access arguments' => array('access frame'),
+    'type' => MENU_CALLBACK,
+  );
   return $items;
 }
 
@@ -21,7 +33,8 @@
   $path = drupal_get_path('module', 'extlink');
   drupal_add_js($path .'/extlink.js');
   drupal_add_js(array('extlink' => array(
-    'extTarget'     => variable_get('extlink_target', 0),
+    'extTarget'     => variable_get('extlink_target', '_self'),
+//    'extIntenal'    => variable_get('extlink_internal', '_self'),
     'extClass'      => variable_get('extlink_class', 'ext'),
     'extSubdomains' => variable_get('extlink_subdomains', 1),
     'mailtoClass'   => variable_get('extlink_mailto_class', 'mailto'))), 'setting'
@@ -58,12 +71,64 @@
   );
 
   $form['extlink_target'] = array(
-    '#type' => 'checkbox',
-    '#title' => t('Open external links in a new window'),
-    '#return_value' => '_blank',
-    '#default_value' => variable_get('extlink_target', 0),
-    '#description' => t('Should all external links be opened in a new window?'),
+    '#type' => 'radios',
+    '#title' => t('How external links should be opened'),
+    '#options' => array('_self' => 'The same window', '_blank' => 'A new window/tab', 'ext_iframe' => 'In an iFrame', 'ext_frame' => 'In a Frameset'),
+    '#default_value' => variable_get('extlink_target', '_self'),
+    '#description' =>  t('Sets the target location for all external links. \'The same window\' is the default.'),
   );
   
+  $form['extlink_height'] = array(
+    '#type' => 'textfield',
+    '#title' => t('Height of frame for external links'),
+    '#default_value' => variable_get('extlink_height', '35%'),
+    '#description' =>  t('Sets the height of target frame for all external links. Can be over-ridden by css.'),
+    '#size' => 4,
+    '#maxlength' => 4,
+  );
+
+  $form['extlink_width'] = array(
+    '#type' => 'textfield',
+    '#title' => t('Width of frame for external links'),
+    '#default_value' => variable_get('extlink_width', '75%'),
+    '#description' =>  t('Sets the width of target frame for all external links. (only applies to In an iFrame). Can be over-ridden by css.'),
+    '#size' => 4,
+    '#maxlength' => 4,
+  );
+  
   return system_settings_form($form);
 }
+
+function extlink_iframe() {
+  $arg_list = arg();
+  array_shift($arg_list);
+  $ext_page = 'http://' . implode('/', $arg_list);
+  
+  return theme('extlink_iframe', $ext_page, variable_get('extlink_width', '75%'), variable_get('extlink_height', '35%'));
+}
+function extlink_frame() {
+  $arg_list = arg();
+  $term = array_search('--', $arg_list);
+  $src_page = implode('/', array_slice($arg_list, 1, $term - 1));
+  $ext_page = 'http://' . implode('/', array_slice($arg_list, $term + 1));
+  
+  // Construct page title
+  $head_title = variable_get('site_name', 'Drupal');
+  if (variable_get('site_slogan', '')) {
+    $head_title .= ' | ' . variable_get('site_slogan', '');
+  }
+ 
+  print theme('extlink_frameset', $head_title, $src_page, $ext_page, variable_get('extlink_height', '35%'));
+}
+function extlink_theme() {
+  return array(
+    'extlink_iframe' => array(
+      'template' => 'extlink_iframe',
+      'arguments' => array('ext' => NULL, 'width' => '75%', 'height' => '35%'),
+    ),
+    'extlink_frameset' => array(
+      'template' => 'extlink_frameset',
+      'arguments' => array('head_title' => NULL, 'src' => '/', 'ext' => NULL, 'height' => '35%'),
+    ),
+  );
+}
Index: extlink/extlink_frameset.tpl.php
--- extlink/extlink_frameset.tpl.php No Base Revision
+++ extlink/extlink_frameset.tpl.php Locally New
@@ -0,0 +1,32 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN"
+  "http://www.w3.org/TR/html4/frameset.dtd">
+<?php
+// $Id: extlink_frameset.tpl.php,
+
+/**
+ * @file extlink_frameset.tpl.php
+ * Default theme implementation for a frameset to display external links.
+ *
+ * Available variables:
+ * - $head_title: Page title suitable for <head>.
+ * - $src: URL to the originating feed item.
+ * - $ext: URL of page to display in 'external' frame "ext_frame".
+ * - $height: Specifies height of 'external' frame. Either a number (pixels) or a percentage.
+ *
+ * @see template_preprocess()
+ */
+?>
+<html>
+<head>
+  <title><?php print $head_title; ?></title>
+</head>
+<frameset rows="*, <?php print $height; ?>">
+  <frame src="/<?php print $src; ?>" />
+  <frame name="ext_frame" src="<?php print $ext; ?>" />
+  <noframes>
+    <h2>Error:</h2><p>Either your browser does not support frames or you have them switched off.</p>
+    <p>This page cannot be dislayed as intended without frames.</p>
+    <p>Please update or configure your browser and refresh the page.</p>
+  </noframes>
+</frameset>
+</html>
Index: extlink/extlink_iframe.tpl.php
--- extlink/extlink_iframe.tpl.php No Base Revision
+++ extlink/extlink_iframe.tpl.php Locally New
@@ -0,0 +1,20 @@
+<?php
+// $Id: extlink_frameset.tpl.php,
+
+/**
+ * @file extlink_frameset.tpl.php
+ * Default theme implementation for a frameset to display external links.
+ *
+ * Available variables:
+ * - $ext: URL of page to display in 'external' frame "ext_frame".
+ * - $protocol: Protocol used to access $ext.
+ * - $height: Specifies height of 'external' frame. Number of pixels.
+ * - $width: Specifies width of 'external' frame. Number of pixels.
+ *
+ * @see template_preprocess()
+ */
+?><iframe name="ext_frame" src="<?php print $ext; ?>" width="<?php print $width; ?>" height="<?php print $height; ?>">
+  <h2>Error:</h2><p>Either your browser does not support iframes or you have them switched off.</p>
+  <p>This page cannot be dislayed as intended without iframes.</p>
+  <p>Please update or configure your browser and refresh the page.</p>
+</iframe>
