[ Index ]

PHP Cross Reference of Drupal 6 (yi-drupal)

title

Body

[close]

/sites/all/modules/ckeditor/includes/ -> ckeditor.popup.html (source)

   1  <html xmlns="http://www.w3.org/1999/xhtml">
   2  <!--
   3     CKEditor - The text editor for the Internet - http://ckeditor.com
   4     Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
   5  -->
   6  <head>
   7    <title>CKEditor</title>
   8    <script type="text/javascript">
   9    var ckeditor_was_opened_in_popup_window = true;
  10    var Drupal=window.opener['Drupal'];
  11  document.write('<scr' + 'ipt src="' + window.opener['Drupal'].settings.basePath + 'misc/jquery.js"></scr' + 'ipt>');
  12  document.write('<scr' + 'ipt src="' + window.opener['Drupal'].settings.ckeditor.editor_path + '/ckeditor.js?I"></scr' + 'ipt>');
  13  document.write('<scr' + 'ipt src="' + window.opener['Drupal'].settings.ckeditor.module_path + '/includes/ckeditor.utils.js?I"></scr' + 'ipt>');
  14  document.write('<scr' + 'ipt src="' + window.opener['Drupal'].settings.ckeditor.module_path + '/ckeditor.config.js?I"></scr' + 'ipt>');
  15  
  16  function Ok()
  17  {
  18    var textarea_id=$(".content_editor").attr("id");
  19    var data=CKEDITOR.instances[textarea_id].getData();
  20    if (teaser=window.opener.Drupal.ckeditorTeaserInfo(textarea_id)) {
  21      var brcode=/<!--break-->/;
  22      data=data.split(brcode);
  23      if(data.length>1){
  24        teaser.textareaContainer.show();
  25        teaser.textarea.attr('disabled', '');
  26        if (teaser.button.attr('value') != Drupal.t('Join summary')) {
  27          try {teaser.button.click();} catch(e) {teaser.button.val(Drupal.t('Join summary'));}
  28        }
  29        teaser.textarea.val(data[0]);
  30        window.opener.$("#"+textarea_id).val(data[1]);
  31      } else {
  32        window.opener.$("#"+textarea_id).val(data[0]);
  33        teaser.textarea.attr('disabled', 'disabled');
  34        if (teaser.button.attr('value') != Drupal.t('Split summary at cursor')) {
  35          try {teaser.button.click();} catch(e) {teaser.button.val(Drupal.t('Split summary at cursor'));}
  36        }
  37      }
  38      teaser.buttonContainer.show();
  39    } else {
  40      window.opener.$("#"+textarea_id).val(data);
  41    }
  42    window.opener.focus();
  43    window.close();
  44  }
  45  function Cancel()
  46  {
  47    if ( CKEDITOR.instances[$(".content_editor").attr("id")].checkDirty() )
  48    {
  49      if ( !confirm(Drupal.t('Are you sure you want to cancel? Your changes will be lost.')) )
  50        return ;
  51    }
  52  
  53    window.close();
  54  }
  55  
  56  function get_element_id(){
  57    var regexp=/[?&]el=([^&#]*)/i;
  58    var rs=regexp.exec(window.location.href);
  59    if( rs == null ) {
  60      return "";
  61    } else {
  62      return rs[1];
  63    }
  64  }
  65    </script>
  66  </head>
  67  <body>
  68    <script type="text/javascript">
  69      $(document).ready(function () {
  70        var textarea_id=get_element_id();
  71        $(".content_editor").attr("id", textarea_id);
  72        if (teaser=Drupal.ckeditorTeaserInfo(textarea_id)) {
  73          if(teaser.textarea.val().length > 0){
  74            $(".content_editor").val(
  75              teaser.textarea.val() + '\n<!--break-->\n' + window.opener.$("#"+textarea_id).val()
  76            );
  77          } else {
  78            $(".content_editor").val(window.opener.$("#"+textarea_id).val());
  79          }
  80        } else {
  81          $(".content_editor").val(window.opener.$("#"+textarea_id).val());
  82        }
  83  
  84        if (typeof Drupal.settings.ckeditor.settings[textarea_id].toolbar_orig == 'undefined'){
  85          Drupal.settings.ckeditor.settings[textarea_id].toolbar_orig = Drupal.settings.ckeditor.settings[textarea_id].toolbar;
  86        }
  87        else {
  88          Drupal.settings.ckeditor.settings[textarea_id].toolbar = Drupal.settings.ckeditor.settings[textarea_id].toolbar_orig;
  89        }
  90        Drupal.settings.ckeditor.settings[textarea_id].toolbar = eval(Drupal.settings.ckeditor.settings[textarea_id].toolbar);
  91  
  92        if (($("#" + textarea_id).val().length > 0) && (window.opener.$("#" + textarea_id).attr('class').indexOf("filterxss1") != -1 || window.opener.$("#" + textarea_id).attr('class').indexOf("filterxss2") != -1)) {
  93          if (typeof Drupal.settings.ckeditor.settings[textarea_id].input_format == 'undefined') {
  94            Drupal.settings.ckeditor.settings[textarea_id].input_format = Drupal.settings.ckeditor.default_input_format;
  95          }
  96          else if (typeof Drupal.settings.ckeditor.settings[textarea_id].input_format == 'object') {
  97            Drupal.settings.ckeditor.settings[textarea_id].input_format = Drupal.settings.ckeditor.settings[textarea_id].input_format.pop();
  98          }
  99          $.post(Drupal.settings.basePath + 'index.php?q=ckeditor/xss', {
 100            'text': $('#' + textarea_id).val(),
 101            'token': Drupal.settings.ckeditor.ajaxToken,
 102            'textarea_id': textarea_id,
 103            'query': Drupal.settings.ckeditor.query,
 104            'theme' : Drupal.settings.ckeditor.theme,
 105            'input_format': Drupal.settings.ckeditor.settings[textarea_id].input_format
 106          }, function(text){
 107            $("#" + textarea_id).val(text);
 108            CKEDITOR.replace(textarea_id, Drupal.settings.ckeditor.settings[textarea_id]);
 109          });
 110        }
 111        else {
 112          CKEDITOR.replace(textarea_id, Drupal.settings.ckeditor.settings[textarea_id]);
 113        }
 114      });
 115    </script>
 116    <table width="100%" height="100%">
 117      <tr>
 118        <td height="100%">
 119          <textarea class="content_editor">
 120          </textarea>
 121        </td>
 122      </tr>
 123      <tr>
 124        <td>
 125          <input type="button" value="OK" onclick="Ok();" style="width:120px" />
 126          <input type="button" value="Cancel" onclick="Cancel();" />
 127        </td>
 128      </tr>
 129    </table>
 130  </body>
 131  </html>


Generated: Mon Jul 9 18:01:44 2012 Cross-referenced by PHPXref 0.7