[ Index ]
 

Code source de eGroupWare 1.2.106-2

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

title

Body

[fermer]

/phpgwapi/js/tinymce/jscripts/tiny_mce/plugins/insertdatetime/ -> editor_plugin_src.js (source)

   1  /* Import plugin specific language pack */
   2  tinyMCE.importPluginLanguagePack('insertdatetime', 'cs,el,en,fr_ca,it,ko,sv,zh_cn,fa,fr,de,pl');
   3  
   4  /**
   5   * Returns the HTML contents of the insertdate, inserttime controls.
   6   */
   7  function TinyMCE_insertdatetime_getControlHTML(control_name) {
   8      var safariPatch = '" onclick="';
   9  
  10      if (tinyMCE.isSafari)
  11          safariPatch = "";
  12  
  13      switch (control_name) {
  14          case "insertdate":
  15              return '<img id="{$editor_id}_insertdate" src="{$pluginurl}/images/insertdate.gif" title="{$lang_insertdate_desc}" width="20" height="20" class="mceButtonNormal" onmouseover="tinyMCE.switchClass(this,\'mceButtonOver\');" onmouseout="tinyMCE.restoreClass(this);" onmousedown="tinyMCE.restoreAndSwitchClass(this,\'mceButtonDown\');' + safariPatch + 'tinyMCE.execInstanceCommand(\'{$editor_id}\',\'mceInsertDate\');">';
  16  
  17          case "inserttime":
  18              return '<img id="{$editor_id}_inserttime" src="{$pluginurl}/images/inserttime.gif" title="{$lang_inserttime_desc}" width="20" height="20" class="mceButtonNormal" onmouseover="tinyMCE.switchClass(this,\'mceButtonOver\');" onmouseout="tinyMCE.restoreClass(this);" onmousedown="tinyMCE.restoreAndSwitchClass(this,\'mceButtonDown\');' + safariPatch + 'tinyMCE.execInstanceCommand(\'{$editor_id}\',\'mceInsertTime\');">';
  19      }
  20  
  21      return "";
  22  }
  23  
  24  /**
  25   * Executes the mceInsertDate command.
  26   */
  27  function TinyMCE_insertdatetime_execCommand(editor_id, element, command, user_interface, value) {
  28      /* Adds zeros infront of value */
  29  	function addZeros(value, len) {
  30          value = "" + value;
  31  
  32          if (value.length < len) {
  33              for (var i=0; i<(len-value.length); i++)
  34                  value = "0" + value;
  35          }
  36  
  37          return value;
  38      }
  39  
  40      /* Returns the date object in the specified format */
  41  	function getDateTime(date, format) {
  42          format = tinyMCE.regexpReplace(format, "%D", "%m/%d/%y");
  43          format = tinyMCE.regexpReplace(format, "%r", "%I:%M:%S %p");
  44          format = tinyMCE.regexpReplace(format, "%Y", "" + date.getFullYear());
  45          format = tinyMCE.regexpReplace(format, "%y", "" + date.getYear());
  46          format = tinyMCE.regexpReplace(format, "%m", addZeros(date.getMonth()+1, 2));
  47          format = tinyMCE.regexpReplace(format, "%d", addZeros(date.getDate(), 2));
  48          format = tinyMCE.regexpReplace(format, "%H", "" + addZeros(date.getHours(), 2));
  49          format = tinyMCE.regexpReplace(format, "%M", "" + addZeros(date.getMinutes(), 2));
  50          format = tinyMCE.regexpReplace(format, "%S", "" + addZeros(date.getSeconds(), 2));
  51          format = tinyMCE.regexpReplace(format, "%I", "" + (date.getHours() < 12 ? (date.getHours()+1) : 24-date.getHours()));
  52          format = tinyMCE.regexpReplace(format, "%p", "" + (date.getHours() < 12 ? "AM" : "PM"));
  53          format = tinyMCE.regexpReplace(format, "%B", "" + tinyMCE.getLang("lang_inserttime_months_long")[date.getMonth()]);
  54          format = tinyMCE.regexpReplace(format, "%b", "" + tinyMCE.getLang("lang_inserttime_months_short")[date.getMonth()]);
  55          format = tinyMCE.regexpReplace(format, "%A", "" + tinyMCE.getLang("lang_inserttime_day_long")[date.getDay()]);
  56          format = tinyMCE.regexpReplace(format, "%a", "" + tinyMCE.getLang("lang_inserttime_day_short")[date.getDay()]);
  57          format = tinyMCE.regexpReplace(format, "%%", "%");
  58  
  59          return format;
  60      }
  61  
  62      // Handle commands
  63      switch (command) {
  64          case "mceInsertDate":
  65              tinyMCE.execInstanceCommand(editor_id, 'mceInsertContent', false, getDateTime(new Date(), tinyMCE.getParam("plugin_insertdate_dateFormat", "%Y-%m-%d")));
  66              return true;
  67  
  68          case "mceInsertTime":
  69              tinyMCE.execInstanceCommand(editor_id, 'mceInsertContent', false, getDateTime(new Date(), tinyMCE.getParam("plugin_insertdate_timeFormat", "%H:%M:%S")));
  70              return true;
  71      }
  72  
  73      // Pass to next handler in chain
  74      return false;
  75  }


Généré le : Sun Feb 25 17:20:01 2007 par Balluche grâce à PHPXref 0.7