[ Index ]
 

Code source de CMS made simple 1.0.5

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/lib/filemanager/ImageManager/assets/ -> editorFrame.js (source)

   1  /**
   2   * Javascript used by the editorFrame.php, it basically initializes the frame.
   3   * @author $Author: Wei Zhuo $
   4   * @version $Id: editorFrame.js 26 2004-03-31 02:35:21Z Wei Zhuo $
   5   * @package ImageManager
   6   */
   7  
   8  var topDoc = window.top.document;
   9  
  10  var t_cx = topDoc.getElementById('cx');
  11  var t_cy = topDoc.getElementById('cy');
  12  var t_cw = topDoc.getElementById('cw');
  13  var t_ch = topDoc.getElementById('ch');
  14  
  15  var m_sx = topDoc.getElementById('sx');
  16  var m_sy = topDoc.getElementById('sy');
  17  var m_w = topDoc.getElementById('mw');
  18  var m_h = topDoc.getElementById('mh');
  19  var m_a = topDoc.getElementById('ma');
  20  var m_d = topDoc.getElementById('md');
  21  
  22  var s_sw = topDoc.getElementById('sw');
  23  var s_sh = topDoc.getElementById('sh');
  24  
  25  var r_ra = topDoc.getElementById('ra');
  26  
  27  var pattern = "img/2x2.gif";
  28  
  29  function doSubmit(action)
  30  {
  31      if (action == 'crop')
  32      {
  33          var url = "editorFrame.php?img="+currentImageFile+"&action=crop&params="+parseInt(t_cx.value)+','+parseInt(t_cy.value)+','+ parseInt(t_cw.value)+','+parseInt(t_ch.value);
  34  
  35          //alert(url);
  36          location.href = url;
  37  
  38          //location.reload();
  39      }   
  40      else if (action == 'scale')
  41      {
  42          var url = "editorFrame.php?img="+currentImageFile+"&action=scale&params="+parseInt(s_sw.value)+','+parseInt(s_sh.value);
  43          //alert(url);
  44          location.href = url;
  45          
  46      }
  47      else if (action == 'rotate')
  48      {
  49          var flip = topDoc.getElementById('flip');
  50  
  51          if(flip.value == 'hoz' || flip.value == 'ver') 
  52              location.href = "editorFrame.php?img="+currentImageFile+"&action=flip&params="+flip.value;
  53          else if (isNaN(parseFloat(r_ra.value))==false)
  54              location.href = "editorFrame.php?img="+currentImageFile+"&action=rotate&params="+parseFloat(r_ra.value);
  55      }
  56      else if(action == 'save') {
  57          var s_file = topDoc.getElementById('save_filename');
  58          var s_format = topDoc.getElementById('save_format');
  59          var s_quality = topDoc.getElementById('quality');
  60  
  61          var format = s_format.value.split(",");
  62          if(s_file.value.length <= 0) 
  63          {
  64              alert(i18n('Please enter a filename to save.'));
  65          }
  66          else
  67          {
  68              var filename = encodeURI(s_file.value);
  69              var quality = parseInt(s_quality.value);
  70              var url = "editorFrame.php?img="+currentImageFile+"&action=save&params="+format[0]+","+quality+"&file="+filename;
  71              //alert(url);
  72              location.href = url;
  73          }
  74      }
  75  }
  76  
  77  
  78  function addEvent(obj, evType, fn)
  79  { 
  80      if (obj.addEventListener) { obj.addEventListener(evType, fn, true); return true; } 
  81      else if (obj.attachEvent) {  var r = obj.attachEvent("on"+evType, fn);  return r;  } 
  82      else {  return false; } 
  83  } 
  84  
  85  var jg_doc
  86  
  87  init = function()
  88  {
  89      jg_doc = new jsGraphics("imgCanvas"); // draw directly into document
  90      jg_doc.setColor("#000000"); // black
  91  
  92      initEditor();
  93  }
  94  
  95  addEvent(window, 'load', init);
  96  


Généré le : Tue Apr 3 18:50:37 2007 par Balluche grâce à PHPXref 0.7