[ Index ]
 

Code source de PHP NUKE 7.9

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

title

Body

[fermer]

/includes/tiny_mce/plugins/insertdatetime/ -> editor_plugin_src.js (source)

   1  /* Import plugin specific language pack */

   2  tinyMCE.importPluginLanguagePack('insertdatetime', 'albanian,arabic,brazilian,catala,chinese,czech,danish,dutch,english,euskara,finnish,french,galego,german,greek,hungarian,icelandic,indonesian,italian,macedonian,norwegian,polish,portuguese,romanian,russian,slovak,slovenian,spanish,swedish,thai,turkish,ukrainian,vietnamese');
   3  
   4  /**

   5   * Returns the HTML contents of the insertdate, inserttime controls.

   6   */
   7  function TinyMCE_insertdatetime_getControlHTML(control_name) {
   8      switch (control_name) {
   9          case "insertdate":
  10              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\');" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'mceInsertDate\');">';
  11  
  12          case "inserttime":
  13              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\');" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'mceInsertTime\');">';
  14      }
  15  
  16      return "";
  17  }
  18  
  19  /**

  20   * Executes the mceInsertDate command.

  21   */
  22  function TinyMCE_insertdatetime_execCommand(editor_id, element, command, user_interface, value) {
  23      /* Adds zeros infront of value */

  24  	function addZeros(value, len) {
  25          value = "" + value;
  26  
  27          if (value.length < len) {
  28              for (var i=0; i<(len-value.length); i++)
  29                  value = "0" + value;
  30          }
  31  
  32          return value;
  33      }
  34  
  35      /* Returns the date object in the specified format */

  36  	function getDateTime(date, format) {
  37          format = tinyMCE.regexpReplace(format, "%D", "%m/%d/%y");
  38          format = tinyMCE.regexpReplace(format, "%r", "%I:%M:%S %p");
  39          format = tinyMCE.regexpReplace(format, "%Y", "" + date.getFullYear());
  40          format = tinyMCE.regexpReplace(format, "%y", "" + date.getYear());
  41          format = tinyMCE.regexpReplace(format, "%m", addZeros(date.getMonth()+1, 2));
  42          format = tinyMCE.regexpReplace(format, "%d", addZeros(date.getDate(), 2));
  43          format = tinyMCE.regexpReplace(format, "%H", "" + addZeros(date.getHours(), 2));
  44          format = tinyMCE.regexpReplace(format, "%M", "" + addZeros(date.getMinutes(), 2));
  45          format = tinyMCE.regexpReplace(format, "%S", "" + addZeros(date.getSeconds(), 2));
  46          format = tinyMCE.regexpReplace(format, "%I", "" + (date.getHours() < 12 ? (date.getHours()+1) : 24-date.getHours()));
  47          format = tinyMCE.regexpReplace(format, "%p", "" + (date.getHours() < 12 ? "AM" : "PM"));
  48          format = tinyMCE.regexpReplace(format, "%B", "" + tinyMCE.getLang("lang_inserttime_months_long")[date.getMonth()]);
  49          format = tinyMCE.regexpReplace(format, "%b", "" + tinyMCE.getLang("lang_inserttime_months_short")[date.getMonth()]);
  50          format = tinyMCE.regexpReplace(format, "%A", "" + tinyMCE.getLang("lang_inserttime_day_long")[date.getDay()]);
  51          format = tinyMCE.regexpReplace(format, "%a", "" + tinyMCE.getLang("lang_inserttime_day_short")[date.getDay()]);
  52          format = tinyMCE.regexpReplace(format, "%%", "%");
  53  
  54          return format;
  55      }
  56  
  57      // Handle commands

  58      switch (command) {
  59          case "mceInsertDate":
  60              tinyMCE.execInstanceCommand(editor_id, 'mceInsertContent', false, getDateTime(new Date(), tinyMCE.getParam("plugin_insertdate_dateFormat", "%Y-%m-%d")));
  61              return true;
  62  
  63          case "mceInsertTime":
  64              tinyMCE.execInstanceCommand(editor_id, 'mceInsertContent', false, getDateTime(new Date(), tinyMCE.getParam("plugin_insertdate_timeFormat", "%H:%M:%S")));
  65              return true;
  66      }
  67  
  68      // Pass to next handler in chain

  69      return false;
  70  }


Généré le : Sun Apr 1 11:11:59 2007 par Balluche grâce à PHPXref 0.7