Permalink
Browse files

adds chrome_frame module and unsupport_ie feature module

  • Loading branch information...
1 parent caf3d60 commit 8c616df03f60e8b0f90e095e6b24eb48e30b2a7b @emjayess committed Mar 8, 2013

Large diffs are not rendered by default.

Oops, something went wrong.
@@ -0,0 +1,38 @@
+<?php
+
+/**
+ * @file
+ * Provides the menu callback for the Chrome Frame administration.
+ */
+
+/**
+ * Menu callback; Administer Chrome Frame settings.
+ */
+function chrome_frame_settings() {
+ $form = array();
+ $form['chrome_frame_prompt'] = array(
+ '#title' => t('Prompt Chrome Frame installation'),
+ '#description' => t('Should Chrome Frame prompt installation on IE users?'),
+ '#type' => 'radios',
+ '#options' => array(
+ 'disabled' => t('Don\'t Prompt'),
+ 'ie6orless' => t('IE 6 only'),
+ 'ie7orless' => t('IE 7 or lower'),
+ 'ie8orless' => t('IE 8 or lower'),
+ 'all' => t('Prompt for all versions of IE'),
+ ),
+ '#default_value' => variable_get('chrome_frame_prompt', 0),
+ );
+ $form['chrome_frame_mode'] = array(
+ '#title' => t('Mode'),
+ '#type' => 'select',
+ '#options' => array(
+ 'inline' => t('Inline'),
+ 'overlay' => t('Overlay'),
+ 'popup' => t('Popup'),
+ ),
+ '#description' => t('How the user should be prompted when Google Chrome Frame is missing. Overlay will display a modal dialog. Using a Popup will result in creating a new window for the prompt.'),
+ '#default_value' => variable_get('chrome_frame_mode', 'inline'),
+ );
+ return system_settings_form($form);
+}
@@ -0,0 +1,10 @@
+name = Chrome Frame
+description = Provide integration with Google Chrome Frame
+core = 7.x
+configure = admin/config/services/chrome_frame
+; Information added by drupal.org packaging script on 2011-10-06
+version = "7.x-1.0-alpha2"
+core = "7.x"
+project = "chrome_frame"
+datestamp = "1317937601"
+
@@ -0,0 +1,89 @@
+<?php
+
+/**
+ * @file
+ *
+ * Provide integration with Google Chrome Frame
+ */
+
+/**
+ * Implements hook_menu().
+ */
+function chrome_frame_menu() {
+ $items['admin/config/services/chrome_frame'] = array(
+ 'title' => 'Chrome Frame',
+ 'description' => 'Configure Chrome Frame Settings',
+ 'page callback' => 'drupal_get_form',
+ 'page arguments' => array('chrome_frame_settings'),
+ 'access arguments' => array('administer site configuration'),
+ 'file' => 'chrome_frame.admin.inc',
+ );
+
+ return $items;
+}
+
+/**
+ * Implements hook_init().
+ *
+ * Add the chrome meta tag, and all the javascript
+ */
+function chrome_frame_init() {
+ $element = array(
+ '#type' => 'html_tag',
+ '#tag' => 'meta',
+ '#attributes' => array(
+ 'content' => 'chrome=1',
+ 'http-equiv' => 'X-UA-Compatible',
+ ),
+ );
+ drupal_add_html_head($element, 'chrome_frame_meta_tag');
+}
+
+
+/**
+ * Implements hook_page_build
+ */
+function chrome_frame_page_build(&$page) {
+ global $base_url;
+
+ $options = drupal_json_encode(array(
+ 'node' => 'chrome-frame',
+ 'mode' => variable_get('chrome_frame_mode', 'inline'),
+ 'destination' => $base_url . $_SERVER['REQUEST_URI'],
+ ));
+
+ switch (variable_get('chrome_frame_prompt')) {
+ case 'all':
+ $page['page_bottom']['chrome_frame']= array(
+ '#type' => 'markup',
+ '#markup' => '<div id="chrome-frame"></div><script src="http://ajax.googleapis.com/ajax/libs/chrome-frame/1/CFInstall.min.js" type="text/javascript"></script><script type="text/javascript">CFInstall.check('. $options .');</script>',
+ );
+ break;
+
+ case 'ie6orless':
+ $page['page_bottom']['chrome_frame']= array(
+ '#type' => 'markup',
+ '#markup' => '<div id="chrome-frame"></div><!--[if lte IE 6]><script src="http://ajax.googleapis.com/ajax/libs/chrome-frame/1/CFInstall.min.js" type="text/javascript"></script><script type="text/javascript">CFInstall.check('. $options .');</script><![endif]-->',
+ );
+ break;
+
+ case 'ie7orless':
+ $page['page_bottom']['chrome_frame']= array(
+ '#type' => 'markup',
+ '#markup' => '<div id="chrome-frame"></div><!--[if lte IE 7]><script src="http://ajax.googleapis.com/ajax/libs/chrome-frame/1/CFInstall.min.js" type="text/javascript"></script><script type="text/javascript">CFInstall.check('. $options .');</script><![endif]-->',
+ );
+ break;
+
+ case 'ie8orless':
+ $page['page_bottom']['chrome_frame']= array(
+ '#type' => 'markup',
+ '#markup' => '<div id="chrome-frame"></div><!--[if lte IE 8]><script src="http://ajax.googleapis.com/ajax/libs/chrome-frame/1/CFInstall.min.js" type="text/javascript"></script><script type="text/javascript">CFInstall.check('. $options .');</script><![endif]-->',
+ );
+ break;
+
+ case 'disabled':
+ break;
+ }
+}
+
+
@@ -0,0 +1,15 @@
+<?php
+/**
+ * @file
+ * unsupport_ie.features.inc
+ */
+
+/**
+ * Implements hook_ctools_plugin_api().
+ */
+function unsupport_ie_ctools_plugin_api() {
+ list($module, $api) = func_get_args();
+ if ($module == "strongarm" && $api == "strongarm") {
+ return array("version" => "1");
+ }
+}
@@ -0,0 +1,13 @@
+name = Unsupport IE
+description = It's my site, and I'll screw IE users all I want to
+core = 7.x
+package = Prerogative
+version = 7.x-1.0
+project = unsupport_ie
+dependencies[] = chrome_frame
+dependencies[] = ctools
+dependencies[] = strongarm
+features[ctools][] = strongarm:strongarm:1
+features[features_api][] = api:1
+features[variable][] = chrome_frame_mode
+features[variable][] = chrome_frame_prompt
@@ -0,0 +1,7 @@
+<?php
+/**
+ * @file
+ * Code for the Unsupport IE feature.
+ */
+
+include_once 'unsupport_ie.features.inc';
@@ -0,0 +1,28 @@
+<?php
+/**
+ * @file
+ * unsupport_ie.strongarm.inc
+ */
+
+/**
+ * Implements hook_strongarm().
+ */
+function unsupport_ie_strongarm() {
+ $export = array();
+
+ $strongarm = new stdClass();
+ $strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */
+ $strongarm->api_version = 1;
+ $strongarm->name = 'chrome_frame_mode';
+ $strongarm->value = 'inline';
+ $export['chrome_frame_mode'] = $strongarm;
+
+ $strongarm = new stdClass();
+ $strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */
+ $strongarm->api_version = 1;
+ $strongarm->name = 'chrome_frame_prompt';
+ $strongarm->value = 'all';
+ $export['chrome_frame_prompt'] = $strongarm;
+
+ return $export;
+}

0 comments on commit 8c616df

Please sign in to comment.