Browse Source

部署到git

master
wanghongjun 2 years ago
parent
commit
10cc7db76b
  1. 895
      framework/library/phpexcel/PHPExcel.php
  2. 246
      framework/library/phpexcel/PHPExcel/NamedRange.php
  3. 918
      framework/library/phpexcel/PHPExcel/ReferenceHelper.php
  4. 708
      framework/library/phpexcel/PHPExcel/Style/NumberFormat.php
  5. 207
      framework/library/phpexcel/PHPExcel/Style/Protection.php
  6. 220
      framework/library/phpexcel/PHPExcel/Worksheet/PageMargins.php
  7. 798
      framework/library/phpexcel/PHPExcel/Worksheet/PageSetup.php
  8. 545
      framework/library/phpexcel/PHPExcel/Worksheet/Protection.php
  9. 1582
      framework/library/phpexcel/PHPExcel/Writer/Excel5/Parser.php
  10. 190
      framework/library/phpexcel/PHPExcel/Writer/OpenDocument.php
  11. 90
      framework/library/phpexcel/PHPExcel/Writer/PDF.php
  12. 943
      web/common/permission.inc.php
  13. 13
      web/resource/components/kindeditor/plugins/code/prettify.css
  14. 28
      web/resource/components/kindeditor/plugins/code/prettify.js
  15. BIN
      web/resource/components/kindeditor/plugins/image/images/refresh.png
  16. 1384
      web/resource/components/kindeditor/plugins/multiimage/multiimage.js
  17. 27
      web/resource/components/kindeditor/plugins/pagebreak/pagebreak.js
  18. 41
      web/resource/components/kindeditor/plugins/plainpaste/plainpaste.js
  19. 31
      web/resource/components/kindeditor/plugins/preview/preview.js
  20. 81
      web/resource/components/kindeditor/plugins/quickformat/quickformat.js
  21. 143
      web/resource/components/kindeditor/themes/qq/qq.css
  22. 3
      web/resource/components/tinymce/langs/readme.md
  23. 1
      web/resource/components/tinymce/plugins/advlist/plugin.min.js
  24. 1
      web/resource/components/tinymce/plugins/anchor/plugin.min.js
  25. 1
      web/resource/components/tinymce/plugins/autolink/plugin.min.js
  26. 1
      web/resource/components/tinymce/plugins/autoresize/plugin.min.js
  27. 1
      web/resource/components/tinymce/plugins/autosave/plugin.min.js
  28. 1
      web/resource/components/tinymce/plugins/bbcode/plugin.min.js
  29. 1
      web/resource/components/tinymce/plugins/charmap/plugin.min.js
  30. 1
      web/resource/components/tinymce/plugins/code/plugin.min.js
  31. 1
      web/resource/components/tinymce/plugins/contextmenu/plugin.min.js
  32. 1
      web/resource/components/tinymce/plugins/directionality/plugin.min.js
  33. 1
      web/resource/components/tinymce/plugins/emoticons/plugin.min.js
  34. 1
      web/resource/components/tinymce/plugins/example/plugin.min.js
  35. 1
      web/resource/components/tinymce/plugins/example_dependency/plugin.min.js
  36. 1
      web/resource/components/tinymce/plugins/fullpage/plugin.min.js
  37. 1
      web/resource/components/tinymce/plugins/fullscreen/plugin.min.js
  38. 1
      web/resource/components/tinymce/plugins/hr/plugin.min.js
  39. 48
      web/resource/components/tinymce/plugins/image/plugin.min.js
  40. 1
      web/resource/components/tinymce/plugins/importcss/plugin.min.js
  41. 1
      web/resource/components/tinymce/plugins/insertdatetime/plugin.min.js
  42. 1
      web/resource/components/tinymce/plugins/layer/plugin.min.js
  43. 1
      web/resource/components/tinymce/plugins/legacyoutput/plugin.min.js
  44. 1
      web/resource/components/tinymce/plugins/link/plugin.min.js
  45. 1
      web/resource/components/tinymce/plugins/lists/plugin.min.js
  46. 779
      web/resource/components/tinymce/plugins/media/plugin.min.js
  47. 38
      web/resource/components/tinymce/plugins/multiimage/plugin.min.js
  48. 1
      web/resource/components/tinymce/plugins/nonbreaking/plugin.min.js
  49. 1
      web/resource/components/tinymce/plugins/noneditable/plugin.min.js
  50. 1
      web/resource/components/tinymce/plugins/pagebreak/plugin.min.js
  51. 1
      web/resource/components/tinymce/plugins/paste/plugin.min.js
  52. 1
      web/resource/components/tinymce/plugins/preview/plugin.min.js
  53. 1
      web/resource/components/tinymce/plugins/print/plugin.min.js
  54. 1
      web/resource/components/tinymce/plugins/save/plugin.min.js
  55. 1
      web/resource/components/tinymce/plugins/searchreplace/plugin.min.js
  56. 1
      web/resource/components/tinymce/plugins/spellchecker/plugin.min.js
  57. 1
      web/resource/components/tinymce/plugins/tabfocus/plugin.min.js
  58. 1
      web/resource/components/tinymce/plugins/table/plugin.min.js
  59. 1
      web/resource/components/tinymce/plugins/template/plugin.min.js
  60. 1
      web/resource/components/tinymce/plugins/textcolor/plugin.min.js
  61. 1
      web/resource/components/tinymce/plugins/visualblocks/plugin.min.js
  62. 1
      web/resource/components/tinymce/plugins/visualchars/plugin.min.js
  63. 1
      web/resource/components/tinymce/plugins/wordcount/plugin.min.js
  64. 1
      web/resource/components/tinymce/skins/lightgray/fonts/readme.md
  65. BIN
      web/resource/components/tinymce/skins/lightgray/img/object.gif
  66. BIN
      web/resource/components/ueditor/dialogs/attachment/images/progress.png
  67. BIN
      web/resource/components/ueditor/dialogs/emotion/images/neweditor-tab-bg.png
  68. BIN
      web/resource/components/ueditor/dialogs/image/images/progress.png
  69. 1
      web/resource/components/ueditor/dialogs/music/music.css
  70. 32
      web/resource/components/ueditor/dialogs/music/music.html
  71. 192
      web/resource/components/ueditor/dialogs/music/music.js
  72. 40
      web/resource/components/ueditor/dialogs/preview/preview.html
  73. BIN
      web/resource/components/ueditor/dialogs/scrawl/images/redo.png
  74. BIN
      web/resource/components/ueditor/dialogs/scrawl/images/redoH.png
  75. BIN
      web/resource/components/ueditor/dialogs/template/images/pre0.png
  76. BIN
      web/resource/components/ueditor/dialogs/template/images/pre1.png
  77. BIN
      web/resource/components/ueditor/dialogs/template/images/pre2.png
  78. BIN
      web/resource/components/ueditor/dialogs/template/images/pre3.png
  79. BIN
      web/resource/components/ueditor/dialogs/template/images/pre4.png
  80. BIN
      web/resource/components/ueditor/dialogs/video/images/none_focus.jpg
  81. BIN
      web/resource/components/ueditor/dialogs/video/images/progress.png
  82. BIN
      web/resource/components/ueditor/lang/en/images/music.png
  83. BIN
      web/resource/components/ueditor/lang/zh-cn/images/music.png
  84. BIN
      web/resource/components/ueditor/themes/default/images/neweditor-tab-bg.png
  85. BIN
      web/resource/components/ueditor/themes/default/images/pagebreak.gif
  86. 15
      web/resource/components/ueditor/third-party/highcharts/adapters/prototype-adapter.js
  87. 316
      web/resource/components/ueditor/third-party/highcharts/adapters/prototype-adapter.src.js
  88. 12
      web/resource/components/ueditor/third-party/highcharts/modules/no-data-to-display.js
  89. 128
      web/resource/components/ueditor/third-party/highcharts/modules/no-data-to-display.src.js
  90. 26
      web/resource/components/webuploader/README.md
  91. BIN
      web/resource/components/webuploader/progress.png
  92. BIN
      web/resource/images/msg-tab-z25df2d.png
  93. BIN
      web/resource/images/music-icon.png
  94. BIN
      web/resource/images/noavatar_middle.gif
  95. BIN
      web/resource/images/nopic-107.png
  96. BIN
      web/resource/images/nopic-203.png
  97. BIN
      web/resource/images/nopic-account.png
  98. BIN
      web/resource/images/nopic-module.png
  99. BIN
      web/resource/images/nopic-small.jpg
  100. BIN
      web/resource/images/nopic-template.png

895
framework/library/phpexcel/PHPExcel.php

@ -0,0 +1,895 @@
<?php
/**
* PHPExcel
*
* Copyright (c) 2006 - 2013 PHPExcel
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* @category PHPExcel
* @package PHPExcel
* @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel)
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @version 1.7.9, 2013-06-02
*/
/** PHPExcel root directory */
if (!defined('PHPEXCEL_ROOT')) {
define('PHPEXCEL_ROOT', dirname(__FILE__) . '/');
require(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
}
/**
* PHPExcel
*
* @category PHPExcel
* @package PHPExcel
* @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel)
*/
class PHPExcel
{
/**
* Unique ID
*
* @var string
*/
private $_uniqueID;
/**
* Document properties
*
* @var PHPExcel_DocumentProperties
*/
private $_properties;
/**
* Document security
*
* @var PHPExcel_DocumentSecurity
*/
private $_security;
/**
* Collection of Worksheet objects
*
* @var PHPExcel_Worksheet[]
*/
private $_workSheetCollection = array();
/**
* Calculation Engine
*
* @var PHPExcel_Calculation
*/
private $_calculationEngine = NULL;
/**
* Active sheet index
*
* @var int
*/
private $_activeSheetIndex = 0;
/**
* Named ranges
*
* @var PHPExcel_NamedRange[]
*/
private $_namedRanges = array();
/**
* CellXf supervisor
*
* @var PHPExcel_Style
*/
private $_cellXfSupervisor;
/**
* CellXf collection
*
* @var PHPExcel_Style[]
*/
private $_cellXfCollection = array();
/**
* CellStyleXf collection
*
* @var PHPExcel_Style[]
*/
private $_cellStyleXfCollection = array();
/**
* Create a new PHPExcel with one Worksheet
*/
public function __construct()
{
$this->_uniqueID = uniqid();
$this->_calculationEngine = PHPExcel_Calculation::getInstance($this);
// Initialise worksheet collection and add one worksheet
$this->_workSheetCollection = array();
$this->_workSheetCollection[] = new PHPExcel_Worksheet($this);
$this->_activeSheetIndex = 0;
// Create document properties
$this->_properties = new PHPExcel_DocumentProperties();
// Create document security
$this->_security = new PHPExcel_DocumentSecurity();
// Set named ranges
$this->_namedRanges = array();
// Create the cellXf supervisor
$this->_cellXfSupervisor = new PHPExcel_Style(true);
$this->_cellXfSupervisor->bindParent($this);
// Create the default style
$this->addCellXf(new PHPExcel_Style);
$this->addCellStyleXf(new PHPExcel_Style);
}
/**
* Code to execute when this worksheet is unset()
*
*/
public function __destruct() {
PHPExcel_Calculation::unsetInstance($this);
$this->disconnectWorksheets();
} // function __destruct()
/**
* Disconnect all worksheets from this PHPExcel workbook object,
* typically so that the PHPExcel object can be unset
*
*/
public function disconnectWorksheets()
{
$worksheet = NULL;
foreach($this->_workSheetCollection as $k => &$worksheet) {
$worksheet->disconnectCells();
$this->_workSheetCollection[$k] = null;
}
unset($worksheet);
$this->_workSheetCollection = array();
}
/**
* Return the calculation engine for this worksheet
*
* @return PHPExcel_Calculation
*/
public function getCalculationEngine()
{
return $this->_calculationEngine;
} // function getCellCacheController()
/**
* Get properties
*
* @return PHPExcel_DocumentProperties
*/
public function getProperties()
{
return $this->_properties;
}
/**
* Set properties
*
* @param PHPExcel_DocumentProperties $pValue
*/
public function setProperties(PHPExcel_DocumentProperties $pValue)
{
$this->_properties = $pValue;
}
/**
* Get security
*
* @return PHPExcel_DocumentSecurity
*/
public function getSecurity()
{
return $this->_security;
}
/**
* Set security
*
* @param PHPExcel_DocumentSecurity $pValue
*/
public function setSecurity(PHPExcel_DocumentSecurity $pValue)
{
$this->_security = $pValue;
}
/**
* Get active sheet
*
* @return PHPExcel_Worksheet
*/
public function getActiveSheet()
{
return $this->_workSheetCollection[$this->_activeSheetIndex];
}
/**
* Create sheet and add it to this workbook
*
* @param int|null $iSheetIndex Index where sheet should go (0,1,..., or null for last)
* @return PHPExcel_Worksheet
* @throws PHPExcel_Exception
*/
public function createSheet($iSheetIndex = NULL)
{
$newSheet = new PHPExcel_Worksheet($this);
$this->addSheet($newSheet, $iSheetIndex);
return $newSheet;
}
/**
* Check if a sheet with a specified name already exists
*
* @param string $pSheetName Name of the worksheet to check
* @return boolean
*/
public function sheetNameExists($pSheetName)
{
return ($this->getSheetByName($pSheetName) !== NULL);
}
/**
* Add sheet
*
* @param PHPExcel_Worksheet $pSheet
* @param int|null $iSheetIndex Index where sheet should go (0,1,..., or null for last)
* @return PHPExcel_Worksheet
* @throws PHPExcel_Exception
*/
public function addSheet(PHPExcel_Worksheet $pSheet, $iSheetIndex = NULL)
{
if ($this->sheetNameExists($pSheet->getTitle())) {
throw new PHPExcel_Exception(
"Workbook already contains a worksheet named '{$pSheet->getTitle()}'. Rename this worksheet first."
);
}
if($iSheetIndex === NULL) {
if ($this->_activeSheetIndex < 0) {
$this->_activeSheetIndex = 0;
}
$this->_workSheetCollection[] = $pSheet;
} else {
// Insert the sheet at the requested index
array_splice(
$this->_workSheetCollection,
$iSheetIndex,
0,
array($pSheet)
);
// Adjust active sheet index if necessary
if ($this->_activeSheetIndex >= $iSheetIndex) {
++$this->_activeSheetIndex;
}
}
return $pSheet;
}
/**
* Remove sheet by index
*
* @param int $pIndex Active sheet index
* @throws PHPExcel_Exception
*/
public function removeSheetByIndex($pIndex = 0)
{
$numSheets = count($this->_workSheetCollection);
if ($pIndex > $numSheets - 1) {
throw new PHPExcel_Exception(
"You tried to remove a sheet by the out of bounds index: {$pIndex}. The actual number of sheets is {$numSheets}."
);
} else {
array_splice($this->_workSheetCollection, $pIndex, 1);
}
// Adjust active sheet index if necessary
if (($this->_activeSheetIndex >= $pIndex) &&
($pIndex > count($this->_workSheetCollection) - 1)) {
--$this->_activeSheetIndex;
}
}
/**
* Get sheet by index
*
* @param int $pIndex Sheet index
* @return PHPExcel_Worksheet
* @throws PHPExcel_Exception
*/
public function getSheet($pIndex = 0)
{
$numSheets = count($this->_workSheetCollection);
if ($pIndex > $numSheets - 1) {
throw new PHPExcel_Exception(
"Your requested sheet index: {$pIndex} is out of bounds. The actual number of sheets is {$numSheets}."
);
} else {
return $this->_workSheetCollection[$pIndex];
}
}
/**
* Get all sheets
*
* @return PHPExcel_Worksheet[]
*/
public function getAllSheets()
{
return $this->_workSheetCollection;
}
/**
* Get sheet by name
*
* @param string $pName Sheet name
* @return PHPExcel_Worksheet
*/
public function getSheetByName($pName = '')
{
$worksheetCount = count($this->_workSheetCollection);
for ($i = 0; $i < $worksheetCount; ++$i) {
if ($this->_workSheetCollection[$i]->getTitle() === $pName) {
return $this->_workSheetCollection[$i];
}
}
return NULL;
}
/**
* Get index for sheet
*
* @param PHPExcel_Worksheet $pSheet
* @return Sheet index
* @throws PHPExcel_Exception
*/
public function getIndex(PHPExcel_Worksheet $pSheet)
{
foreach ($this->_workSheetCollection as $key => $value) {
if ($value->getHashCode() == $pSheet->getHashCode()) {
return $key;
}
}
throw new PHPExcel_Exception("Sheet does not exist.");
}
/**
* Set index for sheet by sheet name.
*
* @param string $sheetName Sheet name to modify index for
* @param int $newIndex New index for the sheet
* @return New sheet index
* @throws PHPExcel_Exception
*/
public function setIndexByName($sheetName, $newIndex)
{
$oldIndex = $this->getIndex($this->getSheetByName($sheetName));
$pSheet = array_splice(
$this->_workSheetCollection,
$oldIndex,
1
);
array_splice(
$this->_workSheetCollection,
$newIndex,
0,
$pSheet
);
return $newIndex;
}
/**
* Get sheet count
*
* @return int
*/
public function getSheetCount()
{
return count($this->_workSheetCollection);
}
/**
* Get active sheet index
*
* @return int Active sheet index
*/
public function getActiveSheetIndex()
{
return $this->_activeSheetIndex;
}
/**
* Set active sheet index
*
* @param int $pIndex Active sheet index
* @throws PHPExcel_Exception
* @return PHPExcel_Worksheet
*/
public function setActiveSheetIndex($pIndex = 0)
{
$numSheets = count($this->_workSheetCollection);
if ($pIndex > $numSheets - 1) {
throw new PHPExcel_Exception(
"You tried to set a sheet active by the out of bounds index: {$pIndex}. The actual number of sheets is {$numSheets}."
);
} else {
$this->_activeSheetIndex = $pIndex;
}
return $this->getActiveSheet();
}
/**
* Set active sheet index by name
*
* @param string $pValue Sheet title
* @return PHPExcel_Worksheet
* @throws PHPExcel_Exception
*/
public function setActiveSheetIndexByName($pValue = '')
{
if (($worksheet = $this->getSheetByName($pValue)) instanceof PHPExcel_Worksheet) {
$this->setActiveSheetIndex($this->getIndex($worksheet));
return $worksheet;
}
throw new PHPExcel_Exception('Workbook does not contain sheet:' . $pValue);
}
/**
* Get sheet names
*
* @return string[]
*/
public function getSheetNames()
{
$returnValue = array();
$worksheetCount = $this->getSheetCount();
for ($i = 0; $i < $worksheetCount; ++$i) {
$returnValue[] = $this->getSheet($i)->getTitle();
}
return $returnValue;
}
/**
* Add external sheet
*
* @param PHPExcel_Worksheet $pSheet External sheet to add
* @param int|null $iSheetIndex Index where sheet should go (0,1,..., or null for last)
* @throws PHPExcel_Exception
* @return PHPExcel_Worksheet
*/
public function addExternalSheet(PHPExcel_Worksheet $pSheet, $iSheetIndex = null) {
if ($this->sheetNameExists($pSheet->getTitle())) {
throw new PHPExcel_Exception("Workbook already contains a worksheet named '{$pSheet->getTitle()}'. Rename the external sheet first.");
}
// count how many cellXfs there are in this workbook currently, we will need this below
$countCellXfs = count($this->_cellXfCollection);
// copy all the shared cellXfs from the external workbook and append them to the current
foreach ($pSheet->getParent()->getCellXfCollection() as $cellXf) {
$this->addCellXf(clone $cellXf);
}
// move sheet to this workbook
$pSheet->rebindParent($this);
// update the cellXfs
foreach ($pSheet->getCellCollection(false) as $cellID) {
$cell = $pSheet->getCell($cellID);
$cell->setXfIndex( $cell->getXfIndex() + $countCellXfs );
}
return $this->addSheet($pSheet, $iSheetIndex);
}
/**
* Get named ranges
*
* @return PHPExcel_NamedRange[]
*/
public function getNamedRanges() {
return $this->_namedRanges;
}
/**
* Add named range
*
* @param PHPExcel_NamedRange $namedRange
* @return PHPExcel
*/
public function addNamedRange(PHPExcel_NamedRange $namedRange) {
if ($namedRange->getScope() == null) {
// global scope
$this->_namedRanges[$namedRange->getName()] = $namedRange;
} else {
// local scope
$this->_namedRanges[$namedRange->getScope()->getTitle().'!'.$namedRange->getName()] = $namedRange;
}
return true;
}
/**
* Get named range
*
* @param string $namedRange
* @param PHPExcel_Worksheet|null $pSheet Scope. Use null for global scope
* @return PHPExcel_NamedRange|null
*/
public function getNamedRange($namedRange, PHPExcel_Worksheet $pSheet = null) {
$returnValue = null;
if ($namedRange != '' && ($namedRange !== NULL)) {
// first look for global defined name
if (isset($this->_namedRanges[$namedRange])) {
$returnValue = $this->_namedRanges[$namedRange];
}
// then look for local defined name (has priority over global defined name if both names exist)
if (($pSheet !== NULL) && isset($this->_namedRanges[$pSheet->getTitle() . '!' . $namedRange])) {
$returnValue = $this->_namedRanges[$pSheet->getTitle() . '!' . $namedRange];
}
}
return $returnValue;
}
/**
* Remove named range
*
* @param string $namedRange
* @param PHPExcel_Worksheet|null $pSheet Scope: use null for global scope.
* @return PHPExcel
*/
public function removeNamedRange($namedRange, PHPExcel_Worksheet $pSheet = null) {
if ($pSheet === NULL) {
if (isset($this->_namedRanges[$namedRange])) {
unset($this->_namedRanges[$namedRange]);
}
} else {
if (isset($this->_namedRanges[$pSheet->getTitle() . '!' . $namedRange])) {
unset($this->_namedRanges[$pSheet->getTitle() . '!' . $namedRange]);
}
}
return $this;
}
/**
* Get worksheet iterator
*
* @return PHPExcel_WorksheetIterator
*/
public function getWorksheetIterator() {
return new PHPExcel_WorksheetIterator($this);
}
/**
* Copy workbook (!= clone!)
*
* @return PHPExcel
*/
public function copy() {
$copied = clone $this;
$worksheetCount = count($this->_workSheetCollection);
for ($i = 0; $i < $worksheetCount; ++$i) {
$this->_workSheetCollection[$i] = $this->_workSheetCollection[$i]->copy();
$this->_workSheetCollection[$i]->rebindParent($this);
}
return $copied;
}
/**
* Implement PHP __clone to create a deep clone, not just a shallow copy.
*/
public function __clone() {
foreach($this as $key => $val) {
if (is_object($val) || (is_array($val))) {
$this->{$key} = unserialize(serialize($val));
}
}
}
/**
* Get the workbook collection of cellXfs
*
* @return PHPExcel_Style[]
*/
public function getCellXfCollection()
{
return $this->_cellXfCollection;
}
/**
* Get cellXf by index
*
* @param int $pIndex
* @return PHPExcel_Style
*/
public function getCellXfByIndex($pIndex = 0)
{
return $this->_cellXfCollection[$pIndex];
}
/**
* Get cellXf by hash code
*
* @param string $pValue
* @return PHPExcel_Style|false
*/
public function getCellXfByHashCode($pValue = '')
{
foreach ($this->_cellXfCollection as $cellXf) {
if ($cellXf->getHashCode() == $pValue) {
return $cellXf;
}
}
return false;
}
/**
* Check if style exists in style collection
*
* @param PHPExcel_Style $pCellStyle
* @return boolean
*/
public function cellXfExists($pCellStyle = null)
{
return in_array($pCellStyle, $this->_cellXfCollection, true);
}
/**
* Get default style
*
* @return PHPExcel_Style
* @throws PHPExcel_Exception
*/
public function getDefaultStyle()
{
if (isset($this->_cellXfCollection[0])) {
return $this->_cellXfCollection[0];
}
throw new PHPExcel_Exception('No default style found for this workbook');
}
/**
* Add a cellXf to the workbook
*
* @param PHPExcel_Style $style
*/
public function addCellXf(PHPExcel_Style $style)
{
$this->_cellXfCollection[] = $style;
$style->setIndex(count($this->_cellXfCollection) - 1);
}
/**
* Remove cellXf by index. It is ensured that all cells get their xf index updated.
*
* @param int $pIndex Index to cellXf
* @throws PHPExcel_Exception
*/
public function removeCellXfByIndex($pIndex = 0)
{
if ($pIndex > count($this->_cellXfCollection) - 1) {
throw new PHPExcel_Exception("CellXf index is out of bounds.");
} else {
// first remove the cellXf
array_splice($this->_cellXfCollection, $pIndex, 1);
// then update cellXf indexes for cells
foreach ($this->_workSheetCollection as $worksheet) {
foreach ($worksheet->getCellCollection(false) as $cellID) {
$cell = $worksheet->getCell($cellID);
$xfIndex = $cell->getXfIndex();
if ($xfIndex > $pIndex ) {
// decrease xf index by 1
$cell->setXfIndex($xfIndex - 1);
} else if ($xfIndex == $pIndex) {
// set to default xf index 0
$cell->setXfIndex(0);
}
}
}
}
}
/**
* Get the cellXf supervisor
*
* @return PHPExcel_Style
*/
public function getCellXfSupervisor()
{
return $this->_cellXfSupervisor;
}
/**
* Get the workbook collection of cellStyleXfs
*
* @return PHPExcel_Style[]
*/
public function getCellStyleXfCollection()
{
return $this->_cellStyleXfCollection;
}
/**
* Get cellStyleXf by index
*
* @param int $pIndex
* @return PHPExcel_Style
*/
public function getCellStyleXfByIndex($pIndex = 0)
{
return $this->_cellStyleXfCollection[$pIndex];
}
/**
* Get cellStyleXf by hash code
*
* @param string $pValue
* @return PHPExcel_Style|false
*/
public function getCellStyleXfByHashCode($pValue = '')
{
foreach ($this->_cellXfStyleCollection as $cellStyleXf) {
if ($cellStyleXf->getHashCode() == $pValue) {
return $cellStyleXf;
}
}
return false;
}
/**
* Add a cellStyleXf to the workbook
*
* @param PHPExcel_Style $pStyle
*/
public function addCellStyleXf(PHPExcel_Style $pStyle)
{
$this->_cellStyleXfCollection[] = $pStyle;
$pStyle->setIndex(count($this->_cellStyleXfCollection) - 1);
}
/**
* Remove cellStyleXf by index
*
* @param int $pIndex
* @throws PHPExcel_Exception
*/
public function removeCellStyleXfByIndex($pIndex = 0)
{
if ($pIndex > count($this->_cellStyleXfCollection) - 1) {
throw new PHPExcel_Exception("CellStyleXf index is out of bounds.");
} else {
array_splice($this->_cellStyleXfCollection, $pIndex, 1);
}
}
/**
* Eliminate all unneeded cellXf and afterwards update the xfIndex for all cells
* and columns in the workbook
*/
public function garbageCollect()
{
// how many references are there to each cellXf ?
$countReferencesCellXf = array();
foreach ($this->_cellXfCollection as $index => $cellXf) {
$countReferencesCellXf[$index] = 0;
}
foreach ($this->getWorksheetIterator() as $sheet) {
// from cells
foreach ($sheet->getCellCollection(false) as $cellID) {
$cell = $sheet->getCell($cellID);
++$countReferencesCellXf[$cell->getXfIndex()];
}
// from row dimensions
foreach ($sheet->getRowDimensions() as $rowDimension) {
if ($rowDimension->getXfIndex() !== null) {
++$countReferencesCellXf[$rowDimension->getXfIndex()];
}
}
// from column dimensions
foreach ($sheet->getColumnDimensions() as $columnDimension) {
++$countReferencesCellXf[$columnDimension->getXfIndex()];
}
}
// remove cellXfs without references and create mapping so we can update xfIndex
// for all cells and columns
$countNeededCellXfs = 0;
foreach ($this->_cellXfCollection as $index => $cellXf) {
if ($countReferencesCellXf[$index] > 0 || $index == 0) { // we must never remove the first cellXf
++$countNeededCellXfs;
} else {
unset($this->_cellXfCollection[$index]);
}
$map[$index] = $countNeededCellXfs - 1;
}
$this->_cellXfCollection = array_values($this->_cellXfCollection);
// update the index for all cellXfs
foreach ($this->_cellXfCollection as $i => $cellXf) {
$cellXf->setIndex($i);
}
// make sure there is always at least one cellXf (there should be)
if (empty($this->_cellXfCollection)) {
$this->_cellXfCollection[] = new PHPExcel_Style();
}
// update the xfIndex for all cells, row dimensions, column dimensions
foreach ($this->getWorksheetIterator() as $sheet) {
// for all cells
foreach ($sheet->getCellCollection(false) as $cellID) {
$cell = $sheet->getCell($cellID);
$cell->setXfIndex( $map[$cell->getXfIndex()] );
}
// for all row dimensions
foreach ($sheet->getRowDimensions() as $rowDimension) {
if ($rowDimension->getXfIndex() !== null) {
$rowDimension->setXfIndex( $map[$rowDimension->getXfIndex()] );
}
}
// for all column dimensions
foreach ($sheet->getColumnDimensions() as $columnDimension) {
$columnDimension->setXfIndex( $map[$columnDimension->getXfIndex()] );
}
// also do garbage collection for all the sheets
$sheet->garbageCollect();
}
}
/**
* Return the unique ID value assigned to this spreadsheet workbook
*
* @return string
*/
public function getID() {
return $this->_uniqueID;
}
}

246
framework/library/phpexcel/PHPExcel/NamedRange.php

@ -0,0 +1,246 @@
<?php
/**
* PHPExcel
*
* Copyright (c) 2006 - 2013 PHPExcel
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* @category PHPExcel
* @package PHPExcel
* @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel)
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @version 1.7.9, 2013-06-02
*/
/**
* PHPExcel_NamedRange
*
* @category PHPExcel
* @package PHPExcel
* @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel)
*/
class PHPExcel_NamedRange
{
/**
* Range name
*
* @var string
*/
private $_name;
/**
* Worksheet on which the named range can be resolved
*
* @var PHPExcel_Worksheet
*/
private $_worksheet;
/**
* Range of the referenced cells
*
* @var string
*/
private $_range;
/**
* Is the named range local? (i.e. can only be used on $this->_worksheet)
*
* @var bool
*/
private $_localOnly;
/**
* Scope
*
* @var PHPExcel_Worksheet
*/
private $_scope;
/**
* Create a new NamedRange
*
* @param string $pName
* @param PHPExcel_Worksheet $pWorksheet
* @param string $pRange
* @param bool $pLocalOnly
* @param PHPExcel_Worksheet|null $pScope Scope. Only applies when $pLocalOnly = true. Null for global scope.
* @throws PHPExcel_Exception
*/
public function __construct($pName = null, PHPExcel_Worksheet $pWorksheet, $pRange = 'A1', $pLocalOnly = false, $pScope = null)
{
// Validate data
if (($pName === NULL) || ($pWorksheet === NULL) || ($pRange === NULL)) {
throw new PHPExcel_Exception('Parameters can not be null.');
}
// Set local members
$this->_name = $pName;
$this->_worksheet = $pWorksheet;
$this->_range = $pRange;
$this->_localOnly = $pLocalOnly;
$this->_scope = ($pLocalOnly == true) ?
(($pScope == null) ? $pWorksheet : $pScope) : null;
}
/**
* Get name
*
* @return string
*/
public function getName() {
return $this->_name;
}
/**
* Set name
*
* @param string $value
* @return PHPExcel_NamedRange
*/
public function setName($value = null) {
if ($value !== NULL) {
// Old title
$oldTitle = $this->_name;
// Re-attach
if ($this->_worksheet !== NULL) {
$this->_worksheet->getParent()->removeNamedRange($this->_name,$this->_worksheet);
}
$this->_name = $value;
if ($this->_worksheet !== NULL) {
$this->_worksheet->getParent()->addNamedRange($this);
}
// New title
$newTitle = $this->_name;
PHPExcel_ReferenceHelper::getInstance()->updateNamedFormulas($this->_worksheet->getParent(), $oldTitle, $newTitle);
}
return $this;
}
/**
* Get worksheet
*
* @return PHPExcel_Worksheet
*/
public function getWorksheet() {
return $this->_worksheet;
}
/**
* Set worksheet
*
* @param PHPExcel_Worksheet $value
* @return PHPExcel_NamedRange
*/
public function setWorksheet(PHPExcel_Worksheet $value = null) {
if ($value !== NULL) {
$this->_worksheet = $value;
}
return $this;
}
/**
* Get range
*
* @return string
*/
public function getRange() {
return $this->_range;
}
/**
* Set range
*
* @param string $value
* @return PHPExcel_NamedRange
*/
public function setRange($value = null) {
if ($value !== NULL) {
$this->_range = $value;
}
return $this;
}
/**
* Get localOnly
*
* @return bool
*/
public function getLocalOnly() {
return $this->_localOnly;
}
/**
* Set localOnly
*
* @param bool $value
* @return PHPExcel_NamedRange
*/
public function setLocalOnly($value = false) {
$this->_localOnly = $value;
$this->_scope = $value ? $this->_worksheet : null;
return $this;
}
/**
* Get scope
*
* @return PHPExcel_Worksheet|null
*/
public function getScope() {
return $this->_scope;
}
/**
* Set scope
*
* @param PHPExcel_Worksheet|null $value
* @return PHPExcel_NamedRange
*/
public function setScope(PHPExcel_Worksheet $value = null) {
$this->_scope = $value;
$this->_localOnly = ($value == null) ? false : true;
return $this;
}
/**
* Resolve a named range to a regular cell range
*
* @param string $pNamedRange Named range
* @param PHPExcel_Worksheet|null $pSheet Scope. Use null for global scope
* @return PHPExcel_NamedRange
*/
public static function resolveRange($pNamedRange = '', PHPExcel_Worksheet $pSheet) {
return $pSheet->getParent()->getNamedRange($pNamedRange, $pSheet);
}
/**
* Implement PHP __clone to create a deep clone, not just a shallow copy.
*/
public function __clone() {
$vars = get_object_vars($this);
foreach ($vars as $key => $value) {
if (is_object($value)) {
$this->$key = clone $value;
} else {
$this->$key = $value;
}
}
}
}

918
framework/library/phpexcel/PHPExcel/ReferenceHelper.php

@ -0,0 +1,918 @@
<?php
/**
* PHPExcel
*
* Copyright (c) 2006 - 2013 PHPExcel
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* @category PHPExcel
* @package PHPExcel
* @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel)
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @version 1.7.9, 2013-06-02
*/
/**
* PHPExcel_ReferenceHelper (Singleton)
*
* @category PHPExcel
* @package PHPExcel
* @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel)
*/
class PHPExcel_ReferenceHelper
{
/** Constants */
/** Regular Expressions */
const REFHELPER_REGEXP_CELLREF = '((\w*|\'[^!]*\')!)?(?<![:a-z\$])(\$?[a-z]{1,3}\$?\d+)(?=[^:!\d\'])';
const REFHELPER_REGEXP_CELLRANGE = '((\w*|\'[^!]*\')!)?(\$?[a-z]{1,3}\$?\d+):(\$?[a-z]{1,3}\$?\d+)';
const REFHELPER_REGEXP_ROWRANGE = '((\w*|\'[^!]*\')!)?(\$?\d+):(\$?\d+)';
const REFHELPER_REGEXP_COLRANGE = '((\w*|\'[^!]*\')!)?(\$?[a-z]{1,3}):(\$?[a-z]{1,3})';
/**
* Instance of this class
*
* @var PHPExcel_ReferenceHelper
*/
private static $_instance;
/**
* Get an instance of this class
*
* @return PHPExcel_ReferenceHelper
*/
public static function getInstance() {
if (!isset(self::$_instance) || (self::$_instance === NULL)) {
self::$_instance = new PHPExcel_ReferenceHelper();
}
return self::$_instance;
}
/**
* Create a new PHPExcel_ReferenceHelper
*/
protected function __construct() {
}
/**
* Compare two column addresses
* Intended for use as a Callback function for sorting column addresses by column
*
* @param string $a First column to test (e.g. 'AA')
* @param string $b Second column to test (e.g. 'Z')
* @return integer
*/
public static function columnSort($a, $b) {
return strcasecmp(strlen($a) . $a, strlen($b) . $b);
}
/**
* Compare two column addresses
* Intended for use as a Callback function for reverse sorting column addresses by column
*
* @param string $a First column to test (e.g. 'AA')
* @param string $b Second column to test (e.g. 'Z')
* @return integer
*/
public static function columnReverseSort($a, $b) {
return 1 - strcasecmp(strlen($a) . $a, strlen($b) . $b);
}
/**
* Compare two cell addresses
* Intended for use as a Callback function for sorting cell addresses by column and row
*
* @param string $a First cell to test (e.g. 'AA1')
* @param string $b Second cell to test (e.g. 'Z1')
* @return integer
*/
public static function cellSort($a, $b) {
sscanf($a,'%[A-Z]%d', $ac, $ar);
sscanf($b,'%[A-Z]%d', $bc, $br);
if ($ar == $br) {
return strcasecmp(strlen($ac) . $ac, strlen($bc) . $bc);
}
return ($ar < $br) ? -1 : 1;
}
/**
* Compare two cell addresses
* Intended for use as a Callback function for sorting cell addresses by column and row
*
* @param string $a First cell to test (e.g. 'AA1')
* @param string $b Second cell to test (e.g. 'Z1')
* @return integer
*/
public static function cellReverseSort($a, $b) {
sscanf($a,'%[A-Z]%d', $ac, $ar);
sscanf($b,'%[A-Z]%d', $bc, $br);
if ($ar == $br) {
return 1 - strcasecmp(strlen($ac) . $ac, strlen($bc) . $bc);
}
return ($ar < $br) ? 1 : -1;
}
/**
* Test whether a cell address falls within a defined range of cells
*
* @param string $cellAddress Address of the cell we're testing
* @param integer $beforeRow Number of the row we're inserting/deleting before
* @param integer $pNumRows Number of rows to insert/delete (negative values indicate deletion)
* @param integer $beforeColumnIndex Index number of the column we're inserting/deleting before
* @param integer $pNumCols Number of columns to insert/delete (negative values indicate deletion)
* @return boolean
*/
private static function cellAddressInDeleteRange($cellAddress, $beforeRow, $pNumRows, $beforeColumnIndex, $pNumCols) {
list($cellColumn, $cellRow) = PHPExcel_Cell::coordinateFromString($cellAddress);
$cellColumnIndex = PHPExcel_Cell::columnIndexFromString($cellColumn);
// Is cell within the range of rows/columns if we're deleting
if ($pNumRows < 0 &&
($cellRow >= ($beforeRow + $pNumRows)) &&
($cellRow < $beforeRow)) {
return TRUE;
} elseif ($pNumCols < 0 &&
($cellColumnIndex >= ($beforeColumnIndex + $pNumCols)) &&
($cellColumnIndex < $beforeColumnIndex)) {
return TRUE;
}
return FALSE;
}
/**
* Update page breaks when inserting/deleting rows/columns
*
* @param PHPExcel_Worksheet $pSheet The worksheet that we're editing
* @param string $pBefore Insert/Delete before this cell address (e.g. 'A1')
* @param integer $beforeColumnIndex Index number of the column we're inserting/deleting before
* @param integer $pNumCols Number of columns to insert/delete (negative values indicate deletion)
* @param integer $beforeRow Number of the row we're inserting/deleting before
* @param integer $pNumRows Number of rows to insert/delete (negative values indicate deletion)
*/
protected function _adjustPageBreaks(PHPExcel_Worksheet $pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows)
{
$aBreaks = $pSheet->getBreaks();
($pNumCols > 0 || $pNumRows > 0) ?
uksort($aBreaks, array('PHPExcel_ReferenceHelper','cellReverseSort')) :
uksort($aBreaks, array('PHPExcel_ReferenceHelper','cellSort'));
foreach ($aBreaks as $key => $value) {
if (self::cellAddressInDeleteRange($key, $beforeRow, $pNumRows, $beforeColumnIndex, $pNumCols)) {
// If we're deleting, then clear any defined breaks that are within the range
// of rows/columns that we're deleting
$pSheet->setBreak($key, PHPExcel_Worksheet::BREAK_NONE);
} else {
// Otherwise update any affected breaks by inserting a new break at the appropriate point
// and removing the old affected break
$newReference = $this->updateCellReference($key, $pBefore, $pNumCols, $pNumRows);
if ($key != $newReference) {
$pSheet->setBreak($newReference, $value)
->setBreak($key, PHPExcel_Worksheet::BREAK_NONE);
}
}
}
}
/**
* Update cell comments when inserting/deleting rows/columns
*
* @param PHPExcel_Worksheet $pSheet The worksheet that we're editing
* @param string $pBefore Insert/Delete before this cell address (e.g. 'A1')
* @param integer $beforeColumnIndex Index number of the column we're inserting/deleting before
* @param integer $pNumCols Number of columns to insert/delete (negative values indicate deletion)
* @param integer $beforeRow Number of the row we're inserting/deleting before
* @param integer $pNumRows Number of rows to insert/delete (negative values indicate deletion)
*/
protected function _adjustComments($pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows)
{
$aComments = $pSheet->getComments();
$aNewComments = array(); // the new array of all comments
foreach ($aComments as $key => &$value) {
// Any comments inside a deleted range will be ignored
if (!self::cellAddressInDeleteRange($key, $beforeRow, $pNumRows, $beforeColumnIndex, $pNumCols)) {
// Otherwise build a new array of comments indexed by the adjusted cell reference
$newReference = $this->updateCellReference($key, $pBefore, $pNumCols, $pNumRows);
$aNewComments[$newReference] = $value;
}
}
// Replace the comments array with the new set of comments
$pSheet->setComments($aNewComments);
}
/**
* Update hyperlinks when inserting/deleting rows/columns
*
* @param PHPExcel_Worksheet $pSheet The worksheet that we're editing
* @param string $pBefore Insert/Delete before this cell address (e.g. 'A1')
* @param integer $beforeColumnIndex Index number of the column we're inserting/deleting before
* @param integer $pNumCols Number of columns to insert/delete (negative values indicate deletion)
* @param integer $beforeRow Number of the row we're inserting/deleting before
* @param integer $pNumRows Number of rows to insert/delete (negative values indicate deletion)
*/
protected function _adjustHyperlinks($pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows)
{
$aHyperlinkCollection = $pSheet->getHyperlinkCollection();
($pNumCols > 0 || $pNumRows > 0) ?
uksort($aHyperlinkCollection, array('PHPExcel_ReferenceHelper','cellReverseSort')) :
uksort($aHyperlinkCollection, array('PHPExcel_ReferenceHelper','cellSort'));
foreach ($aHyperlinkCollection as $key => $value) {
$newReference = $this->updateCellReference($key, $pBefore, $pNumCols, $pNumRows);
if ($key != $newReference) {
$pSheet->setHyperlink( $newReference, $value );
$pSheet->setHyperlink( $key, null );
}
}
}
/**
* Update data validations when inserting/deleting rows/columns
*
* @param PHPExcel_Worksheet $pSheet The worksheet that we're editing
* @param string $pBefore Insert/Delete before this cell address (e.g. 'A1')
* @param integer $beforeColumnIndex Index number of the column we're inserting/deleting before
* @param integer $pNumCols Number of columns to insert/delete (negative values indicate deletion)
* @param integer $beforeRow Number of the row we're inserting/deleting before
* @param integer $pNumRows Number of rows to insert/delete (negative values indicate deletion)
*/
protected function _adjustDataValidations($pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows)
{
$aDataValidationCollection = $pSheet->getDataValidationCollection();
($pNumCols > 0 || $pNumRows > 0) ?
uksort($aDataValidationCollection, array('PHPExcel_ReferenceHelper','cellReverseSort')) :
uksort($aDataValidationCollection, array('PHPExcel_ReferenceHelper','cellSort'));
foreach ($aDataValidationCollection as $key => $value) {
$newReference = $this->updateCellReference($key, $pBefore, $pNumCols, $pNumRows);
if ($key != $newReference) {
$pSheet->setDataValidation( $newReference, $value );
$pSheet->setDataValidation( $key, null );
}
}
}
/**
* Update merged cells when inserting/deleting rows/columns
*
* @param PHPExcel_Worksheet $pSheet The worksheet that we're editing
* @param string $pBefore Insert/Delete before this cell address (e.g. 'A1')
* @param integer $beforeColumnIndex Index number of the column we're inserting/deleting before
* @param integer $pNumCols Number of columns to insert/delete (negative values indicate deletion)
* @param integer $beforeRow Number of the row we're inserting/deleting before
* @param integer $pNumRows Number of rows to insert/delete (negative values indicate deletion)
*/
protected function _adjustMergeCells($pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows)
{
$aMergeCells = $pSheet->getMergeCells();
$aNewMergeCells = array(); // the new array of all merge cells
foreach ($aMergeCells as $key => &$value) {
$newReference = $this->updateCellReference($key, $pBefore, $pNumCols, $pNumRows);
$aNewMergeCells[$newReference] = $newReference;
}
$pSheet->setMergeCells($aNewMergeCells); // replace the merge cells array
}
/**
* Update protected cells when inserting/deleting rows/columns
*
* @param PHPExcel_Worksheet $pSheet The worksheet that we're editing
* @param string $pBefore Insert/Delete before this cell address (e.g. 'A1')
* @param integer $beforeColumnIndex Index number of the column we're inserting/deleting before
* @param integer $pNumCols Number of columns to insert/delete (negative values indicate deletion)
* @param integer $beforeRow Number of the row we're inserting/deleting before
* @param integer $pNumRows Number of rows to insert/delete (negative values indicate deletion)
*/
protected function _adjustProtectedCells($pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows)
{
$aProtectedCells = $pSheet->getProtectedCells();
($pNumCols > 0 || $pNumRows > 0) ?
uksort($aProtectedCells, array('PHPExcel_ReferenceHelper','cellReverseSort')) :
uksort($aProtectedCells, array('PHPExcel_ReferenceHelper','cellSort'));
foreach ($aProtectedCells as $key => $value) {
$newReference = $this->updateCellReference($key, $pBefore, $pNumCols, $pNumRows);
if ($key != $newReference) {
$pSheet->protectCells( $newReference, $value, true );
$pSheet->unprotectCells( $key );
}
}
}
/**
* Update column dimensions when inserting/deleting rows/columns
*
* @param PHPExcel_Worksheet $pSheet The worksheet that we're editing
* @param string $pBefore Insert/Delete before this cell address (e.g. 'A1')
* @param integer $beforeColumnIndex Index number of the column we're inserting/deleting before
* @param integer $pNumCols Number of columns to insert/delete (negative values indicate deletion)
* @param integer $beforeRow Number of the row we're inserting/deleting before
* @param integer $pNumRows Number of rows to insert/delete (negative values indicate deletion)
*/
protected function _adjustColumnDimensions($pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows)
{
$aColumnDimensions = array_reverse($pSheet->getColumnDimensions(), true);
if (!empty($aColumnDimensions)) {
foreach ($aColumnDimensions as $objColumnDimension) {
$newReference = $this->updateCellReference($objColumnDimension->getColumnIndex() . '1', $pBefore, $pNumCols, $pNumRows);
list($newReference) = PHPExcel_Cell::coordinateFromString($newReference);
if ($objColumnDimension->getColumnIndex() != $newReference) {
$objColumnDimension->setColumnIndex($newReference);
}
}
$pSheet->refreshColumnDimensions();
}
}
/**
* Update row dimensions when inserting/deleting rows/columns
*
* @param PHPExcel_Worksheet $pSheet The worksheet that we're editing
* @param string $pBefore Insert/Delete before this cell address (e.g. 'A1')
* @param integer $beforeColumnIndex Index number of the column we're inserting/deleting before
* @param integer $pNumCols Number of columns to insert/delete (negative values indicate deletion)
* @param integer $beforeRow Number of the row we're inserting/deleting before
* @param integer $pNumRows Number of rows to insert/delete (negative values indicate deletion)
*/
protected function _adjustRowDimensions($pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows)
{
$aRowDimensions = array_reverse($pSheet->getRowDimensions(), true);
if (!empty($aRowDimensions)) {
foreach ($aRowDimensions as $objRowDimension) {
$newReference = $this->updateCellReference('A' . $objRowDimension->getRowIndex(), $pBefore, $pNumCols, $pNumRows);
list(, $newReference) = PHPExcel_Cell::coordinateFromString($newReference);
if ($objRowDimension->getRowIndex() != $newReference) {
$objRowDimension->setRowIndex($newReference);
}
}
$pSheet->refreshRowDimensions();
$copyDimension = $pSheet->getRowDimension($beforeRow - 1);
for ($i = $beforeRow; $i <= $beforeRow - 1 + $pNumRows; ++$i) {
$newDimension = $pSheet->getRowDimension($i);
$newDimension->setRowHeight($copyDimension->getRowHeight());
$newDimension->setVisible($copyDimension->getVisible());
$newDimension->setOutlineLevel($copyDimension->getOutlineLevel());
$newDimension->setCollapsed($copyDimension->getCollapsed());
}
}
}
/**
* Insert a new column or row, updating all possible related data
*
* @param string $pBefore Insert before this cell address (e.g. 'A1')
* @param integer $pNumCols Number of columns to insert/delete (negative values indicate deletion)
* @param integer $pNumRows Number of rows to insert/delete (negative values indicate deletion)
* @param PHPExcel_Worksheet $pSheet The worksheet that we're editing
* @throws PHPExcel_Exception
*/
public function insertNewBefore($pBefore = 'A1', $pNumCols = 0, $pNumRows = 0, PHPExcel_Worksheet $pSheet = NULL)
{
$remove = ($pNumCols < 0 || $pNumRows < 0);
$aCellCollection = $pSheet->getCellCollection();
// Get coordinates of $pBefore
$beforeColumn = 'A';
$beforeRow = 1;
list($beforeColumn, $beforeRow) = PHPExcel_Cell::coordinateFromString($pBefore);
$beforeColumnIndex = PHPExcel_Cell::columnIndexFromString($beforeColumn);
// Clear cells if we are removing columns or rows
$highestColumn = $pSheet->getHighestColumn();
$highestRow = $pSheet->getHighestRow();
// 1. Clear column strips if we are removing columns
if ($pNumCols < 0 && $beforeColumnIndex - 2 + $pNumCols > 0) {
for ($i = 1; $i <= $highestRow - 1; ++$i) {
for ($j = $beforeColumnIndex - 1 + $pNumCols; $j <= $beforeColumnIndex - 2; ++$j) {
$coordinate = PHPExcel_Cell::stringFromColumnIndex($j) . $i;
$pSheet->removeConditionalStyles($coordinate);
if ($pSheet->cellExists($coordinate)) {
$pSheet->getCell($coordinate)->setValueExplicit('', PHPExcel_Cell_DataType::TYPE_NULL);
$pSheet->getCell($coordinate)->setXfIndex(0);
}
}
}
}
// 2. Clear row strips if we are removing rows
if ($pNumRows < 0 && $beforeRow - 1 + $pNumRows > 0) {
for ($i = $beforeColumnIndex - 1; $i <= PHPExcel_Cell::columnIndexFromString($highestColumn) - 1; ++$i) {
for ($j = $beforeRow + $pNumRows; $j <= $beforeRow - 1; ++$j) {
$coordinate = PHPExcel_Cell::stringFromColumnIndex($i) . $j;
$pSheet->removeConditionalStyles($coordinate);
if ($pSheet->cellExists($coordinate)) {
$pSheet->getCell($coordinate)->setValueExplicit('', PHPExcel_Cell_DataType::TYPE_NULL);
$pSheet->getCell($coordinate)->setXfIndex(0);
}
}
}
}
// Loop through cells, bottom-up, and change cell coordinates
while (($cellID = $remove ? array_shift($aCellCollection) : array_pop($aCellCollection))) {
$cell = $pSheet->getCell($cellID);
$cellIndex = PHPExcel_Cell::columnIndexFromString($cell->getColumn());
if ($cellIndex-1 + $pNumCols < 0) {
continue;
}
// New coordinates
$newCoordinates = PHPExcel_Cell::stringFromColumnIndex($cellIndex-1 + $pNumCols) . ($cell->getRow() + $pNumRows);
// Should the cell be updated? Move value and cellXf index from one cell to another.
if (($cellIndex >= $beforeColumnIndex) &&
($cell->getRow() >= $beforeRow)) {
// Update cell styles
$pSheet->getCell($newCoordinates)->setXfIndex($cell->getXfIndex());
// Insert this cell at its new location
if ($cell->getDataType() == PHPExcel_Cell_DataType::TYPE_FORMULA) {
// Formula should be adjusted
$pSheet->getCell($newCoordinates)
->setValue($this->updateFormulaReferences($cell->getValue(),
$pBefore, $pNumCols, $pNumRows, $pSheet->getTitle()));
} else {
// Formula should not be adjusted
$pSheet->getCell($newCoordinates)->setValue($cell->getValue());
}
// Clear the original cell
$pSheet->getCellCacheController()->deleteCacheData($cellID);
} else {
/* We don't need to update styles for rows/columns before our insertion position,
but we do still need to adjust any formulae in those cells */
if ($cell->getDataType() == PHPExcel_Cell_DataType::TYPE_FORMULA) {
// Formula should be adjusted
$cell->setValue($this->updateFormulaReferences($cell->getValue(),
$pBefore, $pNumCols, $pNumRows, $pSheet->getTitle()));
}
}
}
// Duplicate styles for the newly inserted cells
$highestColumn = $pSheet->getHighestColumn();
$highestRow = $pSheet->getHighestRow();
if ($pNumCols > 0 && $beforeColumnIndex - 2 > 0) {
for ($i = $beforeRow; $i <= $highestRow - 1; ++$i) {
// Style
$coordinate = PHPExcel_Cell::stringFromColumnIndex( $beforeColumnIndex - 2 ) . $i;
if ($pSheet->cellExists($coordinate)) {
$xfIndex = $pSheet->getCell($coordinate)->getXfIndex();
$conditionalStyles = $pSheet->conditionalStylesExists($coordinate) ?
$pSheet->getConditionalStyles($coordinate) : false;
for ($j = $beforeColumnIndex - 1; $j <= $beforeColumnIndex - 2 + $pNumCols; ++$j) {
$pSheet->getCellByColumnAndRow($j, $i)->setXfIndex($xfIndex);
if ($conditionalStyles) {
$cloned = array();
foreach ($conditionalStyles as $conditionalStyle) {
$cloned[] = clone $conditionalStyle;
}
$pSheet->setConditionalStyles(PHPExcel_Cell::stringFromColumnIndex($j) . $i, $cloned);
}
}
}
}
}
if ($pNumRows > 0 && $beforeRow - 1 > 0) {
for ($i = $beforeColumnIndex - 1; $i <= PHPExcel_Cell::columnIndexFromString($highestColumn) - 1; ++$i) {
// Style
$coordinate = PHPExcel_Cell::stringFromColumnIndex($i) . ($beforeRow - 1);
if ($pSheet->cellExists($coordinate)) {
$xfIndex = $pSheet->getCell($coordinate)->getXfIndex();
$conditionalStyles = $pSheet->conditionalStylesExists($coordinate) ?
$pSheet->getConditionalStyles($coordinate) : false;
for ($j = $beforeRow; $j <= $beforeRow - 1 + $pNumRows; ++$j) {
$pSheet->getCell(PHPExcel_Cell::stringFromColumnIndex($i) . $j)->setXfIndex($xfIndex);
if ($conditionalStyles) {
$cloned = array();
foreach ($conditionalStyles as $conditionalStyle) {
$cloned[] = clone $conditionalStyle;
}
$pSheet->setConditionalStyles(PHPExcel_Cell::stringFromColumnIndex($i) . $j, $cloned);
}
}
}
}
}
// Update worksheet: column dimensions
$this->_adjustColumnDimensions($pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows);
// Update worksheet: row dimensions
$this->_adjustRowDimensions($pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows);
// Update worksheet: page breaks
$this->_adjustPageBreaks($pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows);
// Update worksheet: comments
$this->_adjustComments($pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows);
// Update worksheet: hyperlinks
$this->_adjustHyperlinks($pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows);
// Update worksheet: data validations
$this->_adjustDataValidations($pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows);
// Update worksheet: merge cells
$this->_adjustMergeCells($pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows);
// Update worksheet: protected cells
$this->_adjustProtectedCells($pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows);
// Update worksheet: autofilter
$autoFilter = $pSheet->getAutoFilter();
$autoFilterRange = $autoFilter->getRange();
if (!empty($autoFilterRange)) {
if ($pNumCols != 0) {
$autoFilterColumns = array_keys($autoFilter->getColumns());
if (count($autoFilterColumns) > 0) {
sscanf($pBefore,'%[A-Z]%d', $column, $row);
$columnIndex = PHPExcel_Cell::columnIndexFromString($column);
list($rangeStart,$rangeEnd) = PHPExcel_Cell::rangeBoundaries($autoFilterRange);
if ($columnIndex <= $rangeEnd[0]) {
if ($pNumCols < 0) {
// If we're actually deleting any columns that fall within the autofilter range,
// then we delete any rules for those columns
$deleteColumn = $columnIndex + $pNumCols - 1;
$deleteCount = abs($pNumCols);
for ($i = 1; $i <= $deleteCount; ++$i) {
if (in_array(PHPExcel_Cell::stringFromColumnIndex($deleteColumn),$autoFilterColumns)) {
$autoFilter->clearColumn(PHPExcel_Cell::stringFromColumnIndex($deleteColumn));
}
++$deleteColumn;
}
}
$startCol = ($columnIndex > $rangeStart[0]) ? $columnIndex : $rangeStart[0];
// Shuffle columns in autofilter range
if ($pNumCols > 0) {
// For insert, we shuffle from end to beginning to avoid overwriting
$startColID = PHPExcel_Cell::stringFromColumnIndex($startCol-1);
$toColID = PHPExcel_Cell::stringFromColumnIndex($startCol+$pNumCols-1);
$endColID = PHPExcel_Cell::stringFromColumnIndex($rangeEnd[0]);
$startColRef = $startCol;
$endColRef = $rangeEnd[0];
$toColRef = $rangeEnd[0]+$pNumCols;
do {
$autoFilter->shiftColumn(PHPExcel_Cell::stringFromColumnIndex($endColRef-1),PHPExcel_Cell::stringFromColumnIndex($toColRef-1));
--$endColRef;
--$toColRef;
} while ($startColRef <= $endColRef);
} else {
// For delete, we shuffle from beginning to end to avoid overwriting
$startColID = PHPExcel_Cell::stringFromColumnIndex($startCol-1);
$toColID = PHPExcel_Cell::stringFromColumnIndex($startCol+$pNumCols-1);
$endColID = PHPExcel_Cell::stringFromColumnIndex($rangeEnd[0]);
do {
$autoFilter->shiftColumn($startColID,$toColID);
++$startColID;
++$toColID;
} while ($startColID != $endColID);
}
}
}
}
$pSheet->setAutoFilter( $this->updateCellReference($autoFilterRange, $pBefore, $pNumCols, $pNumRows) );
}
// Update worksheet: freeze pane
if ($pSheet->getFreezePane() != '') {
$pSheet->freezePane( $this->updateCellReference($pSheet->getFreezePane(), $pBefore, $pNumCols, $pNumRows) );
}
// Page setup
if ($pSheet->getPageSetup()->isPrintAreaSet()) {
$pSheet->getPageSetup()->setPrintArea( $this->updateCellReference($pSheet->getPageSetup()->getPrintArea(), $pBefore, $pNumCols, $pNumRows) );
}
// Update worksheet: drawings
$aDrawings = $pSheet->getDrawingCollection();
foreach ($aDrawings as $objDrawing) {
$newReference = $this->updateCellReference($objDrawing->getCoordinates(), $pBefore, $pNumCols, $pNumRows);
if ($objDrawing->getCoordinates() != $newReference) {
$objDrawing->setCoordinates($newReference);
}
}
// Update workbook: named ranges
if (count($pSheet->getParent()->getNamedRanges()) > 0) {
foreach ($pSheet->getParent()->getNamedRanges() as $namedRange) {
if ($namedRange->getWorksheet()->getHashCode() == $pSheet->getHashCode()) {
$namedRange->setRange(
$this->updateCellReference($namedRange->getRange(), $pBefore, $pNumCols, $pNumRows)
);
}
}
}
// Garbage collect
$pSheet->garbageCollect();
}
/**
* Update references within formulas
*
* @param string $pFormula Formula to update
* @param int $pBefore Insert before this one
* @param int $pNumCols Number of columns to insert
* @param int $pNumRows Number of rows to insert
* @param string $sheetName Worksheet name/title
* @return string Updated formula
* @throws PHPExcel_Exception
*/
public function updateFormulaReferences($pFormula = '', $pBefore = 'A1', $pNumCols = 0, $pNumRows = 0, $sheetName = '') {
// Update cell references in the formula
$formulaBlocks = explode('"',$pFormula);
$i = false;
foreach($formulaBlocks as &$formulaBlock) {
// Ignore blocks that were enclosed in quotes (alternating entries in the $formulaBlocks array after the explode)
if ($i = !$i) {
$adjustCount = 0;
$newCellTokens = $cellTokens = array();
// Search for row ranges (e.g. 'Sheet1'!3:5 or 3:5) with or without $ absolutes (e.g. $3:5)
$matchCount = preg_match_all('/'.self::REFHELPER_REGEXP_ROWRANGE.'/i', ' '.$formulaBlock.' ', $matches, PREG_SET_ORDER);
if ($matchCount > 0) {
foreach($matches as $match) {
$fromString = ($match[2] > '') ? $match[2].'!' : '';
$fromString .= $match[3].':'.$match[4];
$modified3 = substr($this->updateCellReference('$A'.$match[3],$pBefore,$pNumCols,$pNumRows),2);
$modified4 = substr($this->updateCellReference('$A'.$match[4],$pBefore,$pNumCols,$pNumRows),2);
if ($match[3].':'.$match[4] !== $modified3.':'.$modified4) {
if (($match[2] == '') || (trim($match[2],"'") == $sheetName)) {
$toString = ($match[2] > '') ? $match[2].'!' : '';
$toString .= $modified3.':'.$modified4;
// Max worksheet size is 1,048,576 rows by 16,384 columns in Excel 2007, so our adjustments need to be at least one digit more
$column = 100000;
$row = 10000000+trim($match[3],'$');
$cellIndex = $column.$row;
$newCellTokens[$cellIndex] = preg_quote($toString);
$cellTokens[$cellIndex] = '/(?<!\d)'.preg_quote($fromString).'(?!\d)/i';
++$adjustCount;
}
}
}
}
// Search for column ranges (e.g. 'Sheet1'!C:E or C:E) with or without $ absolutes (e.g. $C:E)
$matchCount = preg_match_all('/'.self::REFHELPER_REGEXP_COLRANGE.'/i', ' '.$formulaBlock.' ', $matches, PREG_SET_ORDER);
if ($matchCount > 0) {
foreach($matches as $match) {
$fromString = ($match[2] > '') ? $match[2].'!' : '';
$fromString .= $match[3].':'.$match[4];
$modified3 = substr($this->updateCellReference($match[3].'$1',$pBefore,$pNumCols,$pNumRows),0,-2);
$modified4 = substr($this->updateCellReference($match[4].'$1',$pBefore,$pNumCols,$pNumRows),0,-2);
if ($match[3].':'.$match[4] !== $modified3.':'.$modified4) {
if (($match[2] == '') || (trim($match[2],"'") == $sheetName)) {
$toString = ($match[2] > '') ? $match[2].'!' : '';
$toString .= $modified3.':'.$modified4;
// Max worksheet size is 1,048,576 rows by 16,384 columns in Excel 2007, so our adjustments need to be at least one digit more
$column = PHPExcel_Cell::columnIndexFromString(trim($match[3],'$')) + 100000;
$row = 10000000;
$cellIndex = $column.$row;
$newCellTokens[$cellIndex] = preg_quote($toString);
$cellTokens[$cellIndex] = '/(?<![A-Z])'.preg_quote($fromString).'(?![A-Z])/i';
++$adjustCount;
}
}
}
}
// Search for cell ranges (e.g. 'Sheet1'!A3:C5 or A3:C5) with or without $ absolutes (e.g. $A1:C$5)
$matchCount = preg_match_all('/'.self::REFHELPER_REGEXP_CELLRANGE.'/i', ' '.$formulaBlock.' ', $matches, PREG_SET_ORDER);
if ($matchCount > 0) {
foreach($matches as $match) {
$fromString = ($match[2] > '') ? $match[2].'!' : '';
$fromString .= $match[3].':'.$match[4];
$modified3 = $this->updateCellReference($match[3],$pBefore,$pNumCols,$pNumRows);
$modified4 = $this->updateCellReference($match[4],$pBefore,$pNumCols,$pNumRows);
if ($match[3].$match[4] !== $modified3.$modified4) {
if (($match[2] == '') || (trim($match[2],"'") == $sheetName)) {
$toString = ($match[2] > '') ? $match[2].'!' : '';
$toString .= $modified3.':'.$modified4;
list($column,$row) = PHPExcel_Cell::coordinateFromString($match[3]);
// Max worksheet size is 1,048,576 rows by 16,384 columns in Excel 2007, so our adjustments need to be at least one digit more
$column = PHPExcel_Cell::columnIndexFromString(trim($column,'$')) + 100000;
$row = trim($row,'$') + 10000000;
$cellIndex = $column.$row;
$newCellTokens[$cellIndex] = preg_quote($toString);
$cellTokens[$cellIndex] = '/(?<![A-Z])'.preg_quote($fromString).'(?!\d)/i';
++$adjustCount;
}
}
}
}
// Search for cell references (e.g. 'Sheet1'!A3 or C5) with or without $ absolutes (e.g. $A1 or C$5)
$matchCount = preg_match_all('/'.self::REFHELPER_REGEXP_CELLREF.'/i', ' '.$formulaBlock.' ', $matches, PREG_SET_ORDER);
if ($matchCount > 0) {
foreach($matches as $match) {
$fromString = ($match[2] > '') ? $match[2].'!' : '';
$fromString .= $match[3];
$modified3 = $this->updateCellReference($match[3],$pBefore,$pNumCols,$pNumRows);
if ($match[3] !== $modified3) {
if (($match[2] == '') || (trim($match[2],"'") == $sheetName)) {
$toString = ($match[2] > '') ? $match[2].'!' : '';
$toString .= $modified3;
list($column,$row) = PHPExcel_Cell::coordinateFromString($match[3]);
// Max worksheet size is 1,048,576 rows by 16,384 columns in Excel 2007, so our adjustments need to be at least one digit more
$column = PHPExcel_Cell::columnIndexFromString(trim($column,'$')) + 100000;
$row = trim($row,'$') + 10000000;
$cellIndex = $column.$row;
$newCellTokens[$cellIndex] = preg_quote($toString);
$cellTokens[$cellIndex] = '/(?<![A-Z])'.preg_quote($fromString).'(?!\d)/i';
++$adjustCount;
}
}
}
}
if ($adjustCount > 0) {
if ($pNumCols > 0) {
krsort($cellTokens);
krsort($newCellTokens);
} else {
ksort($cellTokens);
ksort($newCellTokens);
}
// Update cell references in the formula
$formulaBlock = str_replace('\\','',preg_replace($cellTokens,$newCellTokens,$formulaBlock));
}
}
}
unset($formulaBlock);
// Then rebuild the formula string
return implode('"',$formulaBlocks);
}
/**
* Update cell reference
*
* @param string $pCellRange Cell range
* @param int $pBefore Insert before this one
* @param int $pNumCols Number of columns to increment
* @param int $pNumRows Number of rows to increment
* @return string Updated cell range
* @throws PHPExcel_Exception
*/
public function updateCellReference($pCellRange = 'A1', $pBefore = 'A1', $pNumCols = 0, $pNumRows = 0) {
// Is it in another worksheet? Will not have to update anything.
if (strpos($pCellRange, "!") !== false) {
return $pCellRange;
// Is it a range or a single cell?
} elseif (strpos($pCellRange, ':') === false && strpos($pCellRange, ',') === false) {
// Single cell
return $this->_updateSingleCellReference($pCellRange, $pBefore, $pNumCols, $pNumRows);
} elseif (strpos($pCellRange, ':') !== false || strpos($pCellRange, ',') !== false) {
// Range
return $this->_updateCellRange($pCellRange, $pBefore, $pNumCols, $pNumRows);
} else {
// Return original
return $pCellRange;
}
}
/**
* Update named formulas (i.e. containing worksheet references / named ranges)
*
* @param PHPExcel $pPhpExcel Object to update
* @param string $oldName Old name (name to replace)
* @param string $newName New name
*/
public function updateNamedFormulas(PHPExcel $pPhpExcel, $oldName = '', $newName = '') {
if ($oldName == '') {
return;
}
foreach ($pPhpExcel->getWorksheetIterator() as $sheet) {
foreach ($sheet->getCellCollection(false) as $cellID) {
$cell = $sheet->getCell($cellID);
if (($cell !== NULL) && ($cell->getDataType() == PHPExcel_Cell_DataType::TYPE_FORMULA)) {
$formula = $cell->getValue();
if (strpos($formula, $oldName) !== false) {
$formula = str_replace("'" . $oldName . "'!", "'" . $newName . "'!", $formula);
$formula = str_replace($oldName . "!", $newName . "!", $formula);
$cell->setValueExplicit($formula, PHPExcel_Cell_DataType::TYPE_FORMULA);
}
}
}
}
}
/**
* Update cell range
*
* @param string $pCellRange Cell range (e.g. 'B2:D4', 'B:C' or '2:3')
* @param int $pBefore Insert before this one
* @param int $pNumCols Number of columns to increment
* @param int $pNumRows Number of rows to increment
* @return string Updated cell range
* @throws PHPExcel_Exception
*/
private function _updateCellRange($pCellRange = 'A1:A1', $pBefore = 'A1', $pNumCols = 0, $pNumRows = 0) {
if (strpos($pCellRange,':') !== false || strpos($pCellRange, ',') !== false) {
// Update range
$range = PHPExcel_Cell::splitRange($pCellRange);
$ic = count($range);
for ($i = 0; $i < $ic; ++$i) {
$jc = count($range[$i]);
for ($j = 0; $j < $jc; ++$j) {
if (ctype_alpha($range[$i][$j])) {
$r = PHPExcel_Cell::coordinateFromString($this->_updateSingleCellReference($range[$i][$j].'1', $pBefore, $pNumCols, $pNumRows));
$range[$i][$j] = $r[0];
} elseif(ctype_digit($range[$i][$j])) {
$r = PHPExcel_Cell::coordinateFromString($this->_updateSingleCellReference('A'.$range[$i][$j], $pBefore, $pNumCols, $pNumRows));
$range[$i][$j] = $r[1];
} else {
$range[$i][$j] = $this->_updateSingleCellReference($range[$i][$j], $pBefore, $pNumCols, $pNumRows);
}
}
}
// Recreate range string
return PHPExcel_Cell::buildRange($range);
} else {
throw new PHPExcel_Exception("Only cell ranges may be passed to this method.");
}
}
/**
* Update single cell reference
*
* @param string $pCellReference Single cell reference
* @param int $pBefore Insert before this one
* @param int $pNumCols Number of columns to increment
* @param int $pNumRows Number of rows to increment
* @return string Updated cell reference
* @throws PHPExcel_Exception
*/
private function _updateSingleCellReference($pCellReference = 'A1', $pBefore = 'A1', $pNumCols = 0, $pNumRows = 0) {
if (strpos($pCellReference, ':') === false && strpos($pCellReference, ',') === false) {
// Get coordinates of $pBefore
list($beforeColumn, $beforeRow) = PHPExcel_Cell::coordinateFromString( $pBefore );
// Get coordinates of $pCellReference
list($newColumn, $newRow) = PHPExcel_Cell::coordinateFromString( $pCellReference );
// Verify which parts should be updated
$updateColumn = (($newColumn{0} != '$') && ($beforeColumn{0} != '$') &&
PHPExcel_Cell::columnIndexFromString($newColumn) >= PHPExcel_Cell::columnIndexFromString($beforeColumn));
$updateRow = (($newRow{0} != '$') && ($beforeRow{0} != '$') &&
$newRow >= $beforeRow);
// Create new column reference
if ($updateColumn) {
$newColumn = PHPExcel_Cell::stringFromColumnIndex( PHPExcel_Cell::columnIndexFromString($newColumn) - 1 + $pNumCols );
}
// Create new row reference
if ($updateRow) {
$newRow = $newRow + $pNumRows;
}
// Return new reference
return $newColumn . $newRow;
} else {
throw new PHPExcel_Exception("Only single cell references may be passed to this method.");
}
}
/**
* __clone implementation. Cloning should not be allowed in a Singleton!
*
* @throws PHPExcel_Exception
*/
public final function __clone() {
throw new PHPExcel_Exception("Cloning a Singleton is not allowed!");
}
}

708
framework/library/phpexcel/PHPExcel/Style/NumberFormat.php

@ -0,0 +1,708 @@
<?php
/**
* PHPExcel
*
* Copyright (c) 2006 - 2013 PHPExcel
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* @category PHPExcel
* @package PHPExcel_Style
* @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel)
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @version 1.7.9, 2013-06-02
*/
/**
* PHPExcel_Style_NumberFormat
*
* @category PHPExcel
* @package PHPExcel_Style
* @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel)
*/
class PHPExcel_Style_NumberFormat extends PHPExcel_Style_Supervisor implements PHPExcel_IComparable
{
/* Pre-defined formats */
const FORMAT_GENERAL = 'General';
const FORMAT_TEXT = '@';
const FORMAT_NUMBER = '0';
const FORMAT_NUMBER_00 = '0.00';
const FORMAT_NUMBER_COMMA_SEPARATED1 = '#,##0.00';
const FORMAT_NUMBER_COMMA_SEPARATED2 = '#,##0.00_-';
const FORMAT_PERCENTAGE = '0%';
const FORMAT_PERCENTAGE_00 = '0.00%';
const FORMAT_DATE_YYYYMMDD2 = 'yyyy-mm-dd';
const FORMAT_DATE_YYYYMMDD = 'yy-mm-dd';
const FORMAT_DATE_DDMMYYYY = 'dd/mm/yy';
const FORMAT_DATE_DMYSLASH = 'd/m/y';
const FORMAT_DATE_DMYMINUS = 'd-m-y';
const FORMAT_DATE_DMMINUS = 'd-m';
const FORMAT_DATE_MYMINUS = 'm-y';
const FORMAT_DATE_XLSX14 = 'mm-dd-yy';
const FORMAT_DATE_XLSX15 = 'd-mmm-yy';
const FORMAT_DATE_XLSX16 = 'd-mmm';
const FORMAT_DATE_XLSX17 = 'mmm-yy';
const FORMAT_DATE_XLSX22 = 'm/d/yy h:mm';
const FORMAT_DATE_DATETIME = 'd/m/y h:mm';
const FORMAT_DATE_TIME1 = 'h:mm AM/PM';
const FORMAT_DATE_TIME2 = 'h:mm:ss AM/PM';
const FORMAT_DATE_TIME3 = 'h:mm';
const FORMAT_DATE_TIME4 = 'h:mm:ss';
const FORMAT_DATE_TIME5 = 'mm:ss';
const FORMAT_DATE_TIME6 = 'h:mm:ss';
const FORMAT_DATE_TIME7 = 'i:s.S';
const FORMAT_DATE_TIME8 = 'h:mm:ss;@';
const FORMAT_DATE_YYYYMMDDSLASH = 'yy/mm/dd;@';
const FORMAT_CURRENCY_USD_SIMPLE = '"$"#,##0.00_-';
const FORMAT_CURRENCY_USD = '$#,##0_-';
const FORMAT_CURRENCY_EUR_SIMPLE = '[$EUR ]#,##0.00_-';
/**
* Excel built-in number formats
*
* @var array
*/
protected static $_builtInFormats;
/**
* Excel built-in number formats (flipped, for faster lookups)
*
* @var array
*/
protected static $_flippedBuiltInFormats;
/**
* Format Code
*
* @var string
*/
protected $_formatCode = PHPExcel_Style_NumberFormat::FORMAT_GENERAL;
/**
* Built-in format Code
*
* @var string
*/
protected $_builtInFormatCode = 0;
/**
* Create a new PHPExcel_Style_NumberFormat
*
* @param boolean $isSupervisor Flag indicating if this is a supervisor or not
* Leave this value at default unless you understand exactly what
* its ramifications are
* @param boolean $isConditional Flag indicating if this is a conditional style or not
* Leave this value at default unless you understand exactly what
* its ramifications are
*/
public function __construct($isSupervisor = FALSE, $isConditional = FALSE)
{
// Supervisor?
parent::__construct($isSupervisor);
if ($isConditional) {
$this->_formatCode = NULL;
}
}
/**
* Get the shared style component for the currently active cell in currently active sheet.
* Only used for style supervisor
*
* @return PHPExcel_Style_NumberFormat
*/
public function getSharedComponent()
{
return $this->_parent->getSharedComponent()->getNumberFormat();
}
/**
* Build style array from subcomponents
*
* @param array $array
* @return array
*/
public function getStyleArray($array)
{
return array('numberformat' => $array);
}
/**
* Apply styles from array
*
* <code>
* $objPHPExcel->getActiveSheet()->getStyle('B2')->getNumberFormat()->applyFromArray(
* array(
* 'code' => PHPExcel_Style_NumberFormat::FORMAT_CURRENCY_EUR_SIMPLE
* )
* );
* </code>
*
* @param array $pStyles Array containing style information
* @throws PHPExcel_Exception
* @return PHPExcel_Style_NumberFormat
*/
public function applyFromArray($pStyles = null)
{
if (is_array($pStyles)) {
if ($this->_isSupervisor) {
$this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($this->getStyleArray($pStyles));
} else {
if (array_key_exists('code', $pStyles)) {
$this->setFormatCode($pStyles['code']);
}
}
} else {
throw new PHPExcel_Exception("Invalid style array passed.");
}
return $this;
}
/**
* Get Format Code
*
* @return string
*/
public function getFormatCode()
{
if ($this->_isSupervisor) {
return $this->getSharedComponent()->getFormatCode();
}
if ($this->_builtInFormatCode !== false)
{
return self::builtInFormatCode($this->_builtInFormatCode);
}
return $this->_formatCode;
}
/**
* Set Format Code
*
* @param string $pValue
* @return PHPExcel_Style_NumberFormat
*/
public function setFormatCode($pValue = PHPExcel_Style_NumberFormat::FORMAT_GENERAL)
{
if ($pValue == '') {
$pValue = PHPExcel_Style_NumberFormat::FORMAT_GENERAL;
}
if ($this->_isSupervisor) {
$styleArray = $this->getStyleArray(array('code' => $pValue));
$this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray);
} else {
$this->_formatCode = $pValue;
$this->_builtInFormatCode = self::builtInFormatCodeIndex($pValue);
}
return $this;
}
/**
* Get Built-In Format Code
*
* @return int
*/
public function getBuiltInFormatCode()
{
if ($this->_isSupervisor) {
return $this->getSharedComponent()->getBuiltInFormatCode();
}
return $this->_builtInFormatCode;
}
/**
* Set Built-In Format Code
*
* @param int $pValue
* @return PHPExcel_Style_NumberFormat
*/
public function setBuiltInFormatCode($pValue = 0)
{
if ($this->_isSupervisor) {
$styleArray = $this->getStyleArray(array('code' => self::builtInFormatCode($pValue)));
$this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray);
} else {
$this->_builtInFormatCode = $pValue;
$this->_formatCode = self::builtInFormatCode($pValue);
}
return $this;
}
/**
* Fill built-in format codes
*/
private static function fillBuiltInFormatCodes()
{
// Built-in format codes
if (is_null(self::$_builtInFormats)) {
self::$_builtInFormats = array();
// General
self::$_builtInFormats[0] = PHPExcel_Style_NumberFormat::FORMAT_GENERAL;
self::$_builtInFormats[1] = '0';
self::$_builtInFormats[2] = '0.00';
self::$_builtInFormats[3] = '#,##0';
self::$_builtInFormats[4] = '#,##0.00';
self::$_builtInFormats[9] = '0%';
self::$_builtInFormats[10] = '0.00%';
self::$_builtInFormats[11] = '0.00E+00';
self::$_builtInFormats[12] = '# ?/?';
self::$_builtInFormats[13] = '# ??/??';
self::$_builtInFormats[14] = 'mm-dd-yy';
self::$_builtInFormats[15] = 'd-mmm-yy';
self::$_builtInFormats[16] = 'd-mmm';
self::$_builtInFormats[17] = 'mmm-yy';
self::$_builtInFormats[18] = 'h:mm AM/PM';
self::$_builtInFormats[19] = 'h:mm:ss AM/PM';
self::$_builtInFormats[20] = 'h:mm';
self::$_builtInFormats[21] = 'h:mm:ss';
self::$_builtInFormats[22] = 'm/d/yy h:mm';
self::$_builtInFormats[37] = '#,##0 ;(#,##0)';
self::$_builtInFormats[38] = '#,##0 ;[Red](#,##0)';
self::$_builtInFormats[39] = '#,##0.00;(#,##0.00)';
self::$_builtInFormats[40] = '#,##0.00;[Red](#,##0.00)';
self::$_builtInFormats[44] = '_("$"* #,##0.00_);_("$"* \(#,##0.00\);_("$"* "-"??_);_(@_)';
self::$_builtInFormats[45] = 'mm:ss';
self::$_builtInFormats[46] = '[h]:mm:ss';
self::$_builtInFormats[47] = 'mmss.0';
self::$_builtInFormats[48] = '##0.0E+0';
self::$_builtInFormats[49] = '@';
// CHT
self::$_builtInFormats[27] = '[$-404]e/m/d';
self::$_builtInFormats[30] = 'm/d/yy';
self::$_builtInFormats[36] = '[$-404]e/m/d';
self::$_builtInFormats[50] = '[$-404]e/m/d';
self::$_builtInFormats[57] = '[$-404]e/m/d';
// THA
self::$_builtInFormats[59] = 't0';
self::$_builtInFormats[60] = 't0.00';
self::$_builtInFormats[61] = 't#,##0';
self::$_builtInFormats[62] = 't#,##0.00';
self::$_builtInFormats[67] = 't0%';
self::$_builtInFormats[68] = 't0.00%';
self::$_builtInFormats[69] = 't# ?/?';
self::$_builtInFormats[70] = 't# ??/??';
// Flip array (for faster lookups)
self::$_flippedBuiltInFormats = array_flip(self::$_builtInFormats);
}
}
/**
* Get built-in format code
*
* @param int $pIndex
* @return string
*/
public static function builtInFormatCode($pIndex)
{
// Clean parameter
$pIndex = intval($pIndex);
// Ensure built-in format codes are available
self::fillBuiltInFormatCodes();
// Lookup format code
if (isset(self::$_builtInFormats[$pIndex])) {
return self::$_builtInFormats[$pIndex];
}
return '';
}
/**
* Get built-in format code index
*
* @param string $formatCode
* @return int|boolean
*/
public static function builtInFormatCodeIndex($formatCode)
{
// Ensure built-in format codes are available
self::fillBuiltInFormatCodes();
// Lookup format code
if (isset(self::$_flippedBuiltInFormats[$formatCode])) {
return self::$_flippedBuiltInFormats[$formatCode];
}
return false;
}
/**
* Get hash code
*
* @return string Hash code
*/
public function getHashCode()
{
if ($this->_isSupervisor) {
return $this->getSharedComponent()->getHashCode();
}
return md5(
$this->_formatCode
. $this->_builtInFormatCode
. __CLASS__
);
}
/**
* Search/replace values to convert Excel date/time format masks to PHP format masks
*
* @var array
*/
private static $_dateFormatReplacements = array(
// first remove escapes related to non-format characters
'\\' => '',
// 12-hour suffix
'am/pm' => 'A',
// 4-digit year
'e' => 'Y',
'yyyy' => 'Y',
// 2-digit year
'yy' => 'y',
// first letter of month - no php equivalent
'mmmmm' => 'M',
// full month name
'mmmm' => 'F',
// short month name
'mmm' => 'M',
// mm is minutes if time, but can also be month w/leading zero
// so we try to identify times be the inclusion of a : separator in the mask
// It isn't perfect, but the best way I know how
':mm' => ':i',
'mm:' => 'i:',
// month leading zero
'mm' => 'm',
// month no leading zero
'm' => 'n',
// full day of week name
'dddd' => 'l',
// short day of week name
'ddd' => 'D',
// days leading zero
'dd' => 'd',
// days no leading zero
'd' => 'j',
// seconds
'ss' => 's',
// fractional seconds - no php equivalent
'.s' => ''
);
/**
* Search/replace values to convert Excel date/time format masks hours to PHP format masks (24 hr clock)
*
* @var array
*/
private static $_dateFormatReplacements24 = array(
'hh' => 'H',
'h' => 'G'
);
/**
* Search/replace values to convert Excel date/time format masks hours to PHP format masks (12 hr clock)
*
* @var array
*/
private static $_dateFormatReplacements12 = array(
'hh' => 'h',
'h' => 'g'
);
private static function _formatAsDate(&$value, &$format)
{
// dvc: convert Excel formats to PHP date formats
// strip off first part containing e.g. [$-F800] or [$USD-409]
// general syntax: [$<Currency string>-<language info>]
// language info is in hexadecimal
$format = preg_replace('/^(\[\$[A-Z]*-[0-9A-F]*\])/i', '', $format);
// OpenOffice.org uses upper-case number formats, e.g. 'YYYY', convert to lower-case
$format = strtolower($format);
$format = strtr($format,self::$_dateFormatReplacements);
if (!strpos($format,'A')) { // 24-hour time format
$format = strtr($format,self::$_dateFormatReplacements24);
} else { // 12-hour time format
$format = strtr($format,self::$_dateFormatReplacements12);
}
$dateObj = PHPExcel_Shared_Date::ExcelToPHPObject($value);
$value = $dateObj->format($format);
}
private static function _formatAsPercentage(&$value, &$format)
{
if ($format === self::FORMAT_PERCENTAGE) {
$value = round( (100 * $value), 0) . '%';
} else {
if (preg_match('/\.[#0]+/i', $format, $m)) {
$s = substr($m[0], 0, 1) . (strlen($m[0]) - 1);
$format = str_replace($m[0], $s, $format);
}
if (preg_match('/^[#0]+/', $format, $m)) {
$format = str_replace($m[0], strlen($m[0]), $format);
}
$format = '%' . str_replace('%', 'f%%', $format);
$value = sprintf($format, 100 * $value);
}
}
private static function _formatAsFraction(&$value, &$format)
{
$sign = ($value < 0) ? '-' : '';
$integerPart = floor(abs($value));
$decimalPart = trim(fmod(abs($value),1),'0.');
$decimalLength = strlen($decimalPart);
$decimalDivisor = pow(10,$decimalLength);
$GCD = PHPExcel_Calculation_MathTrig::GCD($decimalPart,$decimalDivisor);
$adjustedDecimalPart = $decimalPart/$GCD;
$adjustedDecimalDivisor = $decimalDivisor/$GCD;
if ((strpos($format,'0') !== false) || (strpos($format,'#') !== false) || (substr($format,0,3) == '? ?')) {
if ($integerPart == 0) {
$integerPart = '';
}
$value = "$sign$integerPart $adjustedDecimalPart/$adjustedDecimalDivisor";
} else {
$adjustedDecimalPart += $integerPart * $adjustedDecimalDivisor;
$value = "$sign$adjustedDecimalPart/$adjustedDecimalDivisor";
}
}
private static function _complexNumberFormatMask($number, $mask) {
if (strpos($mask,'.') !== false) {
$numbers = explode('.', $number . '.0');
$masks = explode('.', $mask . '.0');
$result1 = self::_complexNumberFormatMask($numbers[0], $masks[0]);
$result2 = strrev(self::_complexNumberFormatMask(strrev($numbers[1]), strrev($masks[1])));
return $result1 . '.' . $result2;
}
$r = preg_match_all('/0+/', $mask, $result, PREG_OFFSET_CAPTURE);
if ($r > 1) {
$result = array_reverse($result[0]);
foreach($result as $block) {
$divisor = 1 . $block[0];
$size = strlen($block[0]);
$offset = $block[1];
$blockValue = sprintf(
'%0' . $size . 'd',
fmod($number, $divisor)
);
$number = floor($number / $divisor);
$mask = substr_replace($mask,$blockValue, $offset, $size);
}
if ($number > 0) {
$mask = substr_replace($mask, $number, $offset, 0);
}
$result = $mask;
} else {
$result = $number;
}
return $result;
}
/**
* Convert a value in a pre-defined format to a PHP string
*
* @param mixed $value Value to format
* @param string $format Format code
* @param array $callBack Callback function for additional formatting of string
* @return string Formatted string
*/
public static function toFormattedString($value = '0', $format = PHPExcel_Style_NumberFormat::FORMAT_GENERAL, $callBack = null)
{
// For now we do not treat strings although section 4 of a format code affects strings
if (!is_numeric($value)) return $value;
// For 'General' format code, we just pass the value although this is not entirely the way Excel does it,
// it seems to round numbers to a total of 10 digits.
if (($format === PHPExcel_Style_NumberFormat::FORMAT_GENERAL) || ($format === PHPExcel_Style_NumberFormat::FORMAT_TEXT)) {
return $value;
}
// Get the sections, there can be up to four sections
$sections = explode(';', $format);
// Fetch the relevant section depending on whether number is positive, negative, or zero?
// Text not supported yet.
// Here is how the sections apply to various values in Excel:
// 1 section: [POSITIVE/NEGATIVE/ZERO/TEXT]
// 2 sections: [POSITIVE/ZERO/TEXT] [NEGATIVE]
// 3 sections: [POSITIVE/TEXT] [NEGATIVE] [ZERO]
// 4 sections: [POSITIVE] [NEGATIVE] [ZERO] [TEXT]
switch (count($sections)) {
case 1:
$format = $sections[0];
break;
case 2:
$format = ($value >= 0) ? $sections[0] : $sections[1];
$value = abs($value); // Use the absolute value
break;
case 3:
$format = ($value > 0) ?
$sections[0] : ( ($value < 0) ?
$sections[1] : $sections[2]);
$value = abs($value); // Use the absolute value
break;
case 4:
$format = ($value > 0) ?
$sections[0] : ( ($value < 0) ?
$sections[1] : $sections[2]);
$value = abs($value); // Use the absolute value
break;
default:
// something is wrong, just use first section
$format = $sections[0];
break;
}
// Save format with color information for later use below
$formatColor = $format;
// Strip color information
$color_regex = '/^\\[[a-zA-Z]+\\]/';
$format = preg_replace($color_regex, '', $format);
// Let's begin inspecting the format and converting the value to a formatted string
if (preg_match('/^(\[\$[A-Z]*-[0-9A-F]*\])*[hmsdy]/i', $format)) { // datetime format
self::_formatAsDate($value, $format);
} else if (preg_match('/%$/', $format)) { // % number format
self::_formatAsPercentage($value, $format);
} else {
if ($format === self::FORMAT_CURRENCY_EUR_SIMPLE) {
$value = 'EUR ' . sprintf('%1.2f', $value);
} else {
// In Excel formats, "_" is used to add spacing, which we can't do in HTML
$format = preg_replace('/_./', '', $format);
// Some non-number characters are escaped with \, which we don't need
$format = preg_replace("/\\\\/", '', $format);
// Some non-number strings are quoted, so we'll get rid of the quotes, likewise any positional * symbols
$format = str_replace(array('"','*'), '', $format);
// Find out if we need thousands separator
// This is indicated by a comma enclosed by a digit placeholder:
// #,# or 0,0
$useThousands = preg_match('/(#,#|0,0)/', $format);
if ($useThousands) {
$format = preg_replace('/0,0/', '00', $format);
$format = preg_replace('/#,#/', '##', $format);
}
// Scale thousands, millions,...
// This is indicated by a number of commas after a digit placeholder:
// #, or 0.0,,
$scale = 1; // same as no scale
$matches = array();
if (preg_match('/(#|0)(,+)/', $format, $matches)) {
$scale = pow(1000, strlen($matches[2]));
// strip the commas
$format = preg_replace('/0,+/', '0', $format);
$format = preg_replace('/#,+/', '#', $format);
}
if (preg_match('/#?.*\?\/\?/', $format, $m)) {
//echo 'Format mask is fractional '.$format.' <br />';
if ($value != (int)$value) {
self::_formatAsFraction($value, $format);
}
} else {
// Handle the number itself
// scale number
$value = $value / $scale;
// Strip #
$format = preg_replace('/\\#/', '0', $format);
$n = "/\[[^\]]+\]/";
$m = preg_replace($n, '', $format);
$number_regex = "/(0+)(\.?)(0*)/";
if (preg_match($number_regex, $m, $matches)) {
$left = $matches[1];
$dec = $matches[2];
$right = $matches[3];
// minimun width of formatted number (including dot)
$minWidth = strlen($left) + strlen($dec) + strlen($right);
if ($useThousands) {
$value = number_format(
$value
, strlen($right)
, PHPExcel_Shared_String::getDecimalSeparator()
, PHPExcel_Shared_String::getThousandsSeparator()
);
$value = preg_replace($number_regex, $value, $format);
} else {
if (preg_match('/0([^\d\.]+)0/', $format, $matches)) {
$value = self::_complexNumberFormatMask($value, $format);
} else {
$sprintf_pattern = "%0$minWidth." . strlen($right) . "f";
$value = sprintf($sprintf_pattern, $value);
$value = preg_replace($number_regex, $value, $format);
}
}
}
}
if (preg_match('/\[\$(.*)\]/u', $format, $m)) {
// Currency or Accounting
$currencyFormat = $m[0];
$currencyCode = $m[1];
list($currencyCode) = explode('-',$currencyCode);
if ($currencyCode == '') {
$currencyCode = PHPExcel_Shared_String::getCurrencyCode();
}
$value = preg_replace('/\[\$([^\]]*)\]/u',$currencyCode,$value);
}
}
}
// Additional formatting provided by callback function
if ($callBack !== null) {
list($writerInstance, $function) = $callBack;
$value = $writerInstance->$function($value, $formatColor);
}
return $value;
}
}

207
framework/library/phpexcel/PHPExcel/Style/Protection.php

@ -0,0 +1,207 @@
<?php
/**
* PHPExcel
*
* Copyright (c) 2006 - 2013 PHPExcel
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* @category PHPExcel
* @package PHPExcel_Style
* @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel)
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @version 1.4.5, 2007-08-23
*/
/**
* PHPExcel_Style_Protection
*
* @category PHPExcel
* @package PHPExcel_Style
* @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel)
*/
class PHPExcel_Style_Protection extends PHPExcel_Style_Supervisor implements PHPExcel_IComparable
{
/** Protection styles */
const PROTECTION_INHERIT = 'inherit';
const PROTECTION_PROTECTED = 'protected';
const PROTECTION_UNPROTECTED = 'unprotected';
/**
* Locked
*
* @var string
*/
protected $_locked;
/**
* Hidden
*
* @var string
*/
protected $_hidden;
/**
* Create a new PHPExcel_Style_Protection
*
* @param boolean $isSupervisor Flag indicating if this is a supervisor or not
* Leave this value at default unless you understand exactly what
* its ramifications are
* @param boolean $isConditional Flag indicating if this is a conditional style or not
* Leave this value at default unless you understand exactly what
* its ramifications are
*/
public function __construct($isSupervisor = FALSE, $isConditional = FALSE)
{
// Supervisor?
parent::__construct($isSupervisor);
// Initialise values
if (!$isConditional) {
$this->_locked = self::PROTECTION_INHERIT;
$this->_hidden = self::PROTECTION_INHERIT;
}
}
/**
* Get the shared style component for the currently active cell in currently active sheet.
* Only used for style supervisor
*
* @return PHPExcel_Style_Protection
*/
public function getSharedComponent()
{
return $this->_parent->getSharedComponent()->getProtection();
}
/**
* Build style array from subcomponents
*
* @param array $array
* @return array
*/
public function getStyleArray($array)
{
return array('protection' => $array);
}
/**
* Apply styles from array
*
* <code>
* $objPHPExcel->getActiveSheet()->getStyle('B2')->getLocked()->applyFromArray(
* array(
* 'locked' => TRUE,
* 'hidden' => FALSE
* )
* );
* </code>
*
* @param array $pStyles Array containing style information
* @throws PHPExcel_Exception
* @return PHPExcel_Style_Protection
*/
public function applyFromArray($pStyles = NULL) {
if (is_array($pStyles)) {
if ($this->_isSupervisor) {
$this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($this->getStyleArray($pStyles));
} else {
if (isset($pStyles['locked'])) {
$this->setLocked($pStyles['locked']);
}
if (isset($pStyles['hidden'])) {
$this->setHidden($pStyles['hidden']);
}
}
} else {
throw new PHPExcel_Exception("Invalid style array passed.");
}
return $this;
}
/**
* Get locked
*
* @return string
*/
public function getLocked() {
if ($this->_isSupervisor) {
return $this->getSharedComponent()->getLocked();
}
return $this->_locked;
}
/**
* Set locked
*
* @param string $pValue
* @return PHPExcel_Style_Protection
*/
public function setLocked($pValue = self::PROTECTION_INHERIT) {
if ($this->_isSupervisor) {
$styleArray = $this->getStyleArray(array('locked' => $pValue));
$this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray);
} else {
$this->_locked = $pValue;
}
return $this;
}
/**
* Get hidden
*
* @return string
*/
public function getHidden() {
if ($this->_isSupervisor) {
return $this->getSharedComponent()->getHidden();
}
return $this->_hidden;
}
/**
* Set hidden
*
* @param string $pValue
* @return PHPExcel_Style_Protection
*/
public function setHidden($pValue = self::PROTECTION_INHERIT) {
if ($this->_isSupervisor) {
$styleArray = $this->getStyleArray(array('hidden' => $pValue));
$this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray);
} else {
$this->_hidden = $pValue;
}
return $this;
}
/**
* Get hash code
*
* @return string Hash code
*/
public function getHashCode() {
if ($this->_isSupervisor) {
return $this->getSharedComponent()->getHashCode();
}
return md5(
$this->_locked
. $this->_hidden
. __CLASS__
);
}
}

220
framework/library/phpexcel/PHPExcel/Worksheet/PageMargins.php

@ -0,0 +1,220 @@
<?php
/**
* PHPExcel
*
* Copyright (c) 2006 - 2013 PHPExcel
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* @category PHPExcel
* @package PHPExcel_Worksheet
* @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel)
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @version 1.7.9, 2013-06-02
*/
/**
* PHPExcel_Worksheet_PageMargins
*
* @category PHPExcel
* @package PHPExcel_Worksheet
* @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel)
*/
class PHPExcel_Worksheet_PageMargins
{
/**
* Left
*
* @var double
*/
private $_left = 0.7;
/**
* Right
*
* @var double
*/
private $_right = 0.7;
/**
* Top
*
* @var double
*/
private $_top = 0.75;
/**
* Bottom
*
* @var double
*/
private $_bottom = 0.75;
/**
* Header
*
* @var double
*/
private $_header = 0.3;
/**
* Footer
*
* @var double
*/
private $_footer = 0.3;
/**
* Create a new PHPExcel_Worksheet_PageMargins
*/
public function __construct()
{
}
/**
* Get Left
*
* @return double
*/
public function getLeft() {
return $this->_left;
}
/**
* Set Left
*
* @param double $pValue
* @return PHPExcel_Worksheet_PageMargins
*/
public function setLeft($pValue) {
$this->_left = $pValue;
return $this;
}
/**
* Get Right
*
* @return double
*/
public function getRight() {
return $this->_right;
}
/**
* Set Right
*
* @param double $pValue
* @return PHPExcel_Worksheet_PageMargins
*/
public function setRight($pValue) {
$this->_right = $pValue;
return $this;
}
/**
* Get Top
*
* @return double
*/
public function getTop() {
return $this->_top;
}
/**
* Set Top
*
* @param double $pValue
* @return PHPExcel_Worksheet_PageMargins
*/
public function setTop($pValue) {
$this->_top = $pValue;
return $this;
}
/**
* Get Bottom
*
* @return double
*/
public function getBottom() {
return $this->_bottom;
}
/**
* Set Bottom
*
* @param double $pValue
* @return PHPExcel_Worksheet_PageMargins
*/
public function setBottom($pValue) {
$this->_bottom = $pValue;
return $this;
}
/**
* Get Header
*
* @return double
*/
public function getHeader() {
return $this->_header;
}
/**
* Set Header
*
* @param double $pValue
* @return PHPExcel_Worksheet_PageMargins
*/
public function setHeader($pValue) {
$this->_header = $pValue;
return $this;
}
/**
* Get Footer
*
* @return double
*/
public function getFooter() {
return $this->_footer;
}
/**
* Set Footer
*
* @param double $pValue
* @return PHPExcel_Worksheet_PageMargins
*/
public function setFooter($pValue) {
$this->_footer = $pValue;
return $this;
}
/**
* Implement PHP __clone to create a deep clone, not just a shallow copy.
*/
public function __clone() {
$vars = get_object_vars($this);
foreach ($vars as $key => $value) {
if (is_object($value)) {
$this->$key = clone $value;
} else {
$this->$key = $value;
}
}
}
}

798
framework/library/phpexcel/PHPExcel/Worksheet/PageSetup.php

@ -0,0 +1,798 @@
<?php
/**
* PHPExcel
*
* Copyright (c) 2006 - 2013 PHPExcel
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* @category PHPExcel
* @package PHPExcel_Worksheet
* @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel)
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @version 1.7.9, 2013-06-02
*/
/**
* PHPExcel_Worksheet_PageSetup
*
* <code>
* Paper size taken from Office Open XML Part 4 - Markup Language Reference, page 1988:
*
* 1 = Letter paper (8.5 in. by 11 in.)
* 2 = Letter small paper (8.5 in. by 11 in.)
* 3 = Tabloid paper (11 in. by 17 in.)
* 4 = Ledger paper (17 in. by 11 in.)
* 5 = Legal paper (8.5 in. by 14 in.)
* 6 = Statement paper (5.5 in. by 8.5 in.)
* 7 = Executive paper (7.25 in. by 10.5 in.)
* 8 = A3 paper (297 mm by 420 mm)
* 9 = A4 paper (210 mm by 297 mm)
* 10 = A4 small paper (210 mm by 297 mm)
* 11 = A5 paper (148 mm by 210 mm)
* 12 = B4 paper (250 mm by 353 mm)
* 13 = B5 paper (176 mm by 250 mm)
* 14 = Folio paper (8.5 in. by 13 in.)
* 15 = Quarto paper (215 mm by 275 mm)
* 16 = Standard paper (10 in. by 14 in.)
* 17 = Standard paper (11 in. by 17 in.)
* 18 = Note paper (8.5 in. by 11 in.)
* 19 = #9 envelope (3.875 in. by 8.875 in.)
* 20 = #10 envelope (4.125 in. by 9.5 in.)
* 21 = #11 envelope (4.5 in. by 10.375 in.)
* 22 = #12 envelope (4.75 in. by 11 in.)
* 23 = #14 envelope (5 in. by 11.5 in.)
* 24 = C paper (17 in. by 22 in.)
* 25 = D paper (22 in. by 34 in.)
* 26 = E paper (34 in. by 44 in.)
* 27 = DL envelope (110 mm by 220 mm)
* 28 = C5 envelope (162 mm by 229 mm)
* 29 = C3 envelope (324 mm by 458 mm)
* 30 = C4 envelope (229 mm by 324 mm)
* 31 = C6 envelope (114 mm by 162 mm)
* 32 = C65 envelope (114 mm by 229 mm)
* 33 = B4 envelope (250 mm by 353 mm)
* 34 = B5 envelope (176 mm by 250 mm)
* 35 = B6 envelope (176 mm by 125 mm)
* 36 = Italy envelope (110 mm by 230 mm)
* 37 = Monarch envelope (3.875 in. by 7.5 in.).
* 38 = 6 3/4 envelope (3.625 in. by 6.5 in.)
* 39 = US standard fanfold (14.875 in. by 11 in.)
* 40 = German standard fanfold (8.5 in. by 12 in.)
* 41 = German legal fanfold (8.5 in. by 13 in.)
* 42 = ISO B4 (250 mm by 353 mm)
* 43 = Japanese double postcard (200 mm by 148 mm)
* 44 = Standard paper (9 in. by 11 in.)
* 45 = Standard paper (10 in. by 11 in.)
* 46 = Standard paper (15 in. by 11 in.)
* 47 = Invite envelope (220 mm by 220 mm)
* 50 = Letter extra paper (9.275 in. by 12 in.)
* 51 = Legal extra paper (9.275 in. by 15 in.)
* 52 = Tabloid extra paper (11.69 in. by 18 in.)
* 53 = A4 extra paper (236 mm by 322 mm)
* 54 = Letter transverse paper (8.275 in. by 11 in.)
* 55 = A4 transverse paper (210 mm by 297 mm)
* 56 = Letter extra transverse paper (9.275 in. by 12 in.)
* 57 = SuperA/SuperA/A4 paper (227 mm by 356 mm)
* 58 = SuperB/SuperB/A3 paper (305 mm by 487 mm)
* 59 = Letter plus paper (8.5 in. by 12.69 in.)
* 60 = A4 plus paper (210 mm by 330 mm)
* 61 = A5 transverse paper (148 mm by 210 mm)
* 62 = JIS B5 transverse paper (182 mm by 257 mm)
* 63 = A3 extra paper (322 mm by 445 mm)
* 64 = A5 extra paper (174 mm by 235 mm)
* 65 = ISO B5 extra paper (201 mm by 276 mm)
* 66 = A2 paper (420 mm by 594 mm)
* 67 = A3 transverse paper (297 mm by 420 mm)
* 68 = A3 extra transverse paper (322 mm by 445 mm)
* </code>
*
* @category PHPExcel
* @package PHPExcel_Worksheet
* @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel)
*/
class PHPExcel_Worksheet_PageSetup
{
/* Paper size */
const PAPERSIZE_LETTER = 1;
const PAPERSIZE_LETTER_SMALL = 2;
const PAPERSIZE_TABLOID = 3;
const PAPERSIZE_LEDGER = 4;
const PAPERSIZE_LEGAL = 5;
const PAPERSIZE_STATEMENT = 6;
const PAPERSIZE_EXECUTIVE = 7;
const PAPERSIZE_A3 = 8;
const PAPERSIZE_A4 = 9;
const PAPERSIZE_A4_SMALL = 10;
const PAPERSIZE_A5 = 11;
const PAPERSIZE_B4 = 12;
const PAPERSIZE_B5 = 13;
const PAPERSIZE_FOLIO = 14;
const PAPERSIZE_QUARTO = 15;
const PAPERSIZE_STANDARD_1 = 16;
const PAPERSIZE_STANDARD_2 = 17;
const PAPERSIZE_NOTE = 18;
const PAPERSIZE_NO9_ENVELOPE = 19;
const PAPERSIZE_NO10_ENVELOPE = 20;
const PAPERSIZE_NO11_ENVELOPE = 21;
const PAPERSIZE_NO12_ENVELOPE = 22;
const PAPERSIZE_NO14_ENVELOPE = 23;
const PAPERSIZE_C = 24;
const PAPERSIZE_D = 25;
const PAPERSIZE_E = 26;
const PAPERSIZE_DL_ENVELOPE = 27;
const PAPERSIZE_C5_ENVELOPE = 28;
const PAPERSIZE_C3_ENVELOPE = 29;
const PAPERSIZE_C4_ENVELOPE = 30;
const PAPERSIZE_C6_ENVELOPE = 31;
const PAPERSIZE_C65_ENVELOPE = 32;
const PAPERSIZE_B4_ENVELOPE = 33;
const PAPERSIZE_B5_ENVELOPE = 34;
const PAPERSIZE_B6_ENVELOPE = 35;
const PAPERSIZE_ITALY_ENVELOPE = 36;
const PAPERSIZE_MONARCH_ENVELOPE = 37;
const PAPERSIZE_6_3_4_ENVELOPE = 38;
const PAPERSIZE_US_STANDARD_FANFOLD = 39;
const PAPERSIZE_GERMAN_STANDARD_FANFOLD = 40;
const PAPERSIZE_GERMAN_LEGAL_FANFOLD = 41;
const PAPERSIZE_ISO_B4 = 42;
const PAPERSIZE_JAPANESE_DOUBLE_POSTCARD = 43;
const PAPERSIZE_STANDARD_PAPER_1 = 44;
const PAPERSIZE_STANDARD_PAPER_2 = 45;
const PAPERSIZE_STANDARD_PAPER_3 = 46;
const PAPERSIZE_INVITE_ENVELOPE = 47;
const PAPERSIZE_LETTER_EXTRA_PAPER = 48;
const PAPERSIZE_LEGAL_EXTRA_PAPER = 49;
const PAPERSIZE_TABLOID_EXTRA_PAPER = 50;
const PAPERSIZE_A4_EXTRA_PAPER = 51;
const PAPERSIZE_LETTER_TRANSVERSE_PAPER = 52;
const PAPERSIZE_A4_TRANSVERSE_PAPER = 53;
const PAPERSIZE_LETTER_EXTRA_TRANSVERSE_PAPER = 54;
const PAPERSIZE_SUPERA_SUPERA_A4_PAPER = 55;
const PAPERSIZE_SUPERB_SUPERB_A3_PAPER = 56;
const PAPERSIZE_LETTER_PLUS_PAPER = 57;
const PAPERSIZE_A4_PLUS_PAPER = 58;
const PAPERSIZE_A5_TRANSVERSE_PAPER = 59;
const PAPERSIZE_JIS_B5_TRANSVERSE_PAPER = 60;
const PAPERSIZE_A3_EXTRA_PAPER = 61;
const PAPERSIZE_A5_EXTRA_PAPER = 62;
const PAPERSIZE_ISO_B5_EXTRA_PAPER = 63;
const PAPERSIZE_A2_PAPER = 64;
const PAPERSIZE_A3_TRANSVERSE_PAPER = 65;
const PAPERSIZE_A3_EXTRA_TRANSVERSE_PAPER = 66;
/* Page orientation */
const ORIENTATION_DEFAULT = 'default';
const ORIENTATION_LANDSCAPE = 'landscape';
const ORIENTATION_PORTRAIT = 'portrait';
/* Print Range Set Method */
const SETPRINTRANGE_OVERWRITE = 'O';
const SETPRINTRANGE_INSERT = 'I';
/**
* Paper size
*
* @var int
*/
private $_paperSize = PHPExcel_Worksheet_PageSetup::PAPERSIZE_LETTER;
/**
* Orientation
*
* @var string
*/
private $_orientation = PHPExcel_Worksheet_PageSetup::ORIENTATION_DEFAULT;
/**
* Scale (Print Scale)
*
* Print scaling. Valid values range from 10 to 400
* This setting is overridden when fitToWidth and/or fitToHeight are in use
*
* @var int?
*/
private $_scale = 100;
/**
* Fit To Page
* Whether scale or fitToWith / fitToHeight applies
*
* @var boolean
*/
private $_fitToPage = FALSE;
/**
* Fit To Height
* Number of vertical pages to fit on
*
* @var int?
*/
private $_fitToHeight = 1;
/**
* Fit To Width
* Number of horizontal pages to fit on
*
* @var int?
*/
private $_fitToWidth = 1;
/**
* Columns to repeat at left
*
* @var array Containing start column and end column, empty array if option unset
*/
private $_columnsToRepeatAtLeft = array('', '');
/**
* Rows to repeat at top
*
* @var array Containing start row number and end row number, empty array if option unset
*/
private $_rowsToRepeatAtTop = array(0, 0);
/**
* Center page horizontally
*
* @var boolean
*/
private $_horizontalCentered = FALSE;
/**
* Center page vertically
*
* @var boolean
*/
private $_verticalCentered = FALSE;
/**
* Print area
*
* @var string
*/
private $_printArea = NULL;
/**
* First page number
*
* @var int
*/
private $_firstPageNumber = NULL;
/**
* Create a new PHPExcel_Worksheet_PageSetup
*/
public function __construct()
{
}
/**
* Get Paper Size
*
* @return int
*/
public function getPaperSize() {
return $this->_paperSize;
}
/**
* Set Paper Size
*
* @param int $pValue
* @return PHPExcel_Worksheet_PageSetup
*/
public function setPaperSize($pValue = PHPExcel_Worksheet_PageSetup::PAPERSIZE_LETTER) {
$this->_paperSize = $pValue;
return $this;
}
/**
* Get Orientation
*
* @return string
*/
public function getOrientation() {
return $this->_orientation;
}
/**
* Set Orientation
*
* @param string $pValue
* @return PHPExcel_Worksheet_PageSetup
*/
public function setOrientation($pValue = PHPExcel_Worksheet_PageSetup::ORIENTATION_DEFAULT) {
$this->_orientation = $pValue;
return $this;
}
/**
* Get Scale
*
* @return int?
*/
public function getScale() {
return $this->_scale;
}
/**
* Set Scale
*
* Print scaling. Valid values range from 10 to 400
* This setting is overridden when fitToWidth and/or fitToHeight are in use
*
* @param int? $pValue
* @param boolean $pUpdate Update fitToPage so scaling applies rather than fitToHeight / fitToWidth
* @return PHPExcel_Worksheet_PageSetup
* @throws PHPExcel_Exception
*/
public function setScale($pValue = 100, $pUpdate = true) {
// Microsoft Office Excel 2007 only allows setting a scale between 10 and 400 via the user interface,
// but it is apparently still able to handle any scale >= 0, where 0 results in 100
if (($pValue >= 0) || is_null($pValue)) {
$this->_scale = $pValue;
if ($pUpdate) {
$this->_fitToPage = false;
}
} else {
throw new PHPExcel_Exception("Scale must not be negative");
}
return $this;
}
/**
* Get Fit To Page
*
* @return boolean
*/
public function getFitToPage() {
return $this->_fitToPage;
}
/**
* Set Fit To Page
*
* @param boolean $pValue
* @return PHPExcel_Worksheet_PageSetup
*/
public function setFitToPage($pValue = TRUE) {
$this->_fitToPage = $pValue;
return $this;
}
/**
* Get Fit To Height
*
* @return int?
*/
public function getFitToHeight() {
return $this->_fitToHeight;
}
/**
* Set Fit To Height
*
* @param int? $pValue
* @param boolean $pUpdate Update fitToPage so it applies rather than scaling
* @return PHPExcel_Worksheet_PageSetup
*/
public function setFitToHeight($pValue = 1, $pUpdate = TRUE) {
$this->_fitToHeight = $pValue;
if ($pUpdate) {
$this->_fitToPage = TRUE;
}
return $this;
}
/**
* Get Fit To Width
*
* @return int?
*/
public function getFitToWidth() {
return $this->_fitToWidth;
}
/**
* Set Fit To Width
*
* @param int? $pValue
* @param boolean $pUpdate Update fitToPage so it applies rather than scaling
* @return PHPExcel_Worksheet_PageSetup
*/
public function setFitToWidth($pValue = 1, $pUpdate = TRUE) {
$this->_fitToWidth = $pValue;
if ($pUpdate) {
$this->_fitToPage = TRUE;
}
return $this;
}
/**
* Is Columns to repeat at left set?
*
* @return boolean
*/
public function isColumnsToRepeatAtLeftSet() {
if (is_array($this->_columnsToRepeatAtLeft)) {
if ($this->_columnsToRepeatAtLeft[0] != '' && $this->_columnsToRepeatAtLeft[1] != '') {
return true;
}
}
return false;
}
/**
* Get Columns to repeat at left
*
* @return array Containing start column and end column, empty array if option unset
*/
public function getColumnsToRepeatAtLeft() {
return $this->_columnsToRepeatAtLeft;
}
/**
* Set Columns to repeat at left
*
* @param array $pValue Containing start column and end column, empty array if option unset
* @return PHPExcel_Worksheet_PageSetup
*/
public function setColumnsToRepeatAtLeft($pValue = null) {
if (is_array($pValue)) {
$this->_columnsToRepeatAtLeft = $pValue;
}
return $this;
}
/**
* Set Columns to repeat at left by start and end
*
* @param string $pStart
* @param string $pEnd
* @return PHPExcel_Worksheet_PageSetup
*/
public function setColumnsToRepeatAtLeftByStartAndEnd($pStart = 'A', $pEnd = 'A') {
$this->_columnsToRepeatAtLeft = array($pStart, $pEnd);
return $this;
}
/**
* Is Rows to repeat at top set?
*
* @return boolean
*/
public function isRowsToRepeatAtTopSet() {
if (is_array($this->_rowsToRepeatAtTop)) {
if ($this->_rowsToRepeatAtTop[0] != 0 && $this->_rowsToRepeatAtTop[1] != 0) {
return true;
}
}
return false;
}
/**
* Get Rows to repeat at top
*
* @return array Containing start column and end column, empty array if option unset
*/
public function getRowsToRepeatAtTop() {
return $this->_rowsToRepeatAtTop;
}
/**
* Set Rows to repeat at top
*
* @param array $pValue Containing start column and end column, empty array if option unset
* @return PHPExcel_Worksheet_PageSetup
*/
public function setRowsToRepeatAtTop($pValue = null) {
if (is_array($pValue)) {
$this->_rowsToRepeatAtTop = $pValue;
}
return $this;
}
/**
* Set Rows to repeat at top by start and end
*
* @param int $pStart
* @param int $pEnd
* @return PHPExcel_Worksheet_PageSetup
*/
public function setRowsToRepeatAtTopByStartAndEnd($pStart = 1, $pEnd = 1) {
$this->_rowsToRepeatAtTop = array($pStart, $pEnd);
return $this;
}
/**
* Get center page horizontally
*
* @return bool
*/
public function getHorizontalCentered() {
return $this->_horizontalCentered;
}
/**
* Set center page horizontally
*
* @param bool $value
* @return PHPExcel_Worksheet_PageSetup
*/
public function setHorizontalCentered($value = false) {
$this->_horizontalCentered = $value;
return $this;
}
/**
* Get center page vertically
*
* @return bool
*/
public function getVerticalCentered() {
return $this->_verticalCentered;
}
/**
* Set center page vertically
*
* @param bool $value
* @return PHPExcel_Worksheet_PageSetup
*/
public function setVerticalCentered($value = false) {
$this->_verticalCentered = $value;
return $this;
}
/**
* Get print area
*
* @param int $index Identifier for a specific print area range if several ranges have been set
* Default behaviour, or a index value of 0, will return all ranges as a comma-separated string
* Otherwise, the specific range identified by the value of $index will be returned
* Print areas are numbered from 1
* @throws PHPExcel_Exception
* @return string
*/
public function getPrintArea($index = 0) {
if ($index == 0) {
return $this->_printArea;
}
$printAreas = explode(',',$this->_printArea);
if (isset($printAreas[$index-1])) {
return $printAreas[$index-1];
}
throw new PHPExcel_Exception("Requested Print Area does not exist");
}
/**
* Is print area set?
*
* @param int $index Identifier for a specific print area range if several ranges have been set
* Default behaviour, or an index value of 0, will identify whether any print range is set
* Otherwise, existence of the range identified by the value of $index will be returned
* Print areas are numbered from 1
* @return boolean
*/
public function isPrintAreaSet($index = 0) {
if ($index == 0) {
return !is_null($this->_printArea);
}
$printAreas = explode(',',$this->_printArea);
return isset($printAreas[$index-1]);
}
/**
* Clear a print area
*
* @param int $index Identifier for a specific print area range if several ranges have been set
* Default behaviour, or an index value of 0, will clear all print ranges that are set
* Otherwise, the range identified by the value of $index will be removed from the series
* Print areas are numbered from 1
* @return PHPExcel_Worksheet_PageSetup
*/
public function clearPrintArea($index = 0) {
if ($index == 0) {
$this->_printArea = NULL;
} else {
$printAreas = explode(',',$this->_printArea);
if (isset($printAreas[$index-1])) {
unset($printAreas[$index-1]);
$this->_printArea = implode(',',$printAreas);
}
}
return $this;
}
/**
* Set print area. e.g. 'A1:D10' or 'A1:D10,G5:M20'
*
* @param string $value
* @param int $index Identifier for a specific print area range allowing several ranges to be set
* When the method is "O"verwrite, then a positive integer index will overwrite that indexed
* entry in the print areas list; a negative index value will identify which entry to
* overwrite working bacward through the print area to the list, with the last entry as -1.
* Specifying an index value of 0, will overwrite <b>all</b> existing print ranges.
* When the method is "I"nsert, then a positive index will insert after that indexed entry in
* the print areas list, while a negative index will insert before the indexed entry.
* Specifying an index value of 0, will always append the new print range at the end of the
* list.
* Print areas are numbered from 1
* @param string $method Determines the method used when setting multiple print areas
* Default behaviour, or the "O" method, overwrites existing print area
* The "I" method, inserts the new print area before any specified index, or at the end of the list
* @return PHPExcel_Worksheet_PageSetup
* @throws PHPExcel_Exception
*/
public function setPrintArea($value, $index = 0, $method = self::SETPRINTRANGE_OVERWRITE) {
if (strpos($value,'!') !== false) {
throw new PHPExcel_Exception('Cell coordinate must not specify a worksheet.');
} elseif (strpos($value,':') === false) {
throw new PHPExcel_Exception('Cell coordinate must be a range of cells.');
} elseif (strpos($value,'$') !== false) {
throw new PHPExcel_Exception('Cell coordinate must not be absolute.');
}
$value = strtoupper($value);
if ($method == self::SETPRINTRANGE_OVERWRITE) {
if ($index == 0) {
$this->_printArea = $value;
} else {
$printAreas = explode(',',$this->_printArea);
if($index < 0) {
$index = count($printAreas) - abs($index) + 1;
}
if (($index <= 0) || ($index > count($printAreas))) {
throw new PHPExcel_Exception('Invalid index for setting print range.');
}
$printAreas[$index-1] = $value;
$this->_printArea = implode(',',$printAreas);
}
} elseif($method == self::SETPRINTRANGE_INSERT) {
if ($index == 0) {
$this->_printArea .= ($this->_printArea == '') ? $value : ','.$value;
} else {
$printAreas = explode(',',$this->_printArea);
if($index < 0) {
$index = abs($index) - 1;
}
if ($index > count($printAreas)) {
throw new PHPExcel_Exception('Invalid index for setting print range.');
}
$printAreas = array_merge(array_slice($printAreas,0,$index),array($value),array_slice($printAreas,$index));
$this->_printArea = implode(',',$printAreas);
}
} else {
throw new PHPExcel_Exception('Invalid method for setting print range.');
}
return $this;
}
/**
* Add a new print area (e.g. 'A1:D10' or 'A1:D10,G5:M20') to the list of print areas
*
* @param string $value
* @param int $index Identifier for a specific print area range allowing several ranges to be set
* A positive index will insert after that indexed entry in the print areas list, while a
* negative index will insert before the indexed entry.
* Specifying an index value of 0, will always append the new print range at the end of the
* list.
* Print areas are numbered from 1
* @return PHPExcel_Worksheet_PageSetup
* @throws PHPExcel_Exception
*/
public function addPrintArea($value, $index = -1) {
return $this->setPrintArea($value, $index, self::SETPRINTRANGE_INSERT);
}
/**
* Set print area
*
* @param int $column1 Column 1
* @param int $row1 Row 1
* @param int $column2 Column 2
* @param int $row2 Row 2
* @param int $index Identifier for a specific print area range allowing several ranges to be set
* When the method is "O"verwrite, then a positive integer index will overwrite that indexed
* entry in the print areas list; a negative index value will identify which entry to
* overwrite working bacward through the print area to the list, with the last entry as -1.
* Specifying an index value of 0, will overwrite <b>all</b> existing print ranges.
* When the method is "I"nsert, then a positive index will insert after that indexed entry in
* the print areas list, while a negative index will insert before the indexed entry.
* Specifying an index value of 0, will always append the new print range at the end of the
* list.
* Print areas are numbered from 1
* @param string $method Determines the method used when setting multiple print areas
* Default behaviour, or the "O" method, overwrites existing print area
* The "I" method, inserts the new print area before any specified index, or at the end of the list
* @return PHPExcel_Worksheet_PageSetup
* @throws PHPExcel_Exception
*/
public function setPrintAreaByColumnAndRow($column1, $row1, $column2, $row2, $index = 0, $method = self::SETPRINTRANGE_OVERWRITE)
{
return $this->setPrintArea(PHPExcel_Cell::stringFromColumnIndex($column1) . $row1 . ':' . PHPExcel_Cell::stringFromColumnIndex($column2) . $row2, $index, $method);
}
/**
* Add a new print area to the list of print areas
*
* @param int $column1 Start Column for the print area
* @param int $row1 Start Row for the print area
* @param int $column2 End Column for the print area
* @param int $row2 End Row for the print area
* @param int $index Identifier for a specific print area range allowing several ranges to be set
* A positive index will insert after that indexed entry in the print areas list, while a
* negative index will insert before the indexed entry.
* Specifying an index value of 0, will always append the new print range at the end of the
* list.
* Print areas are numbered from 1
* @return PHPExcel_Worksheet_PageSetup
* @throws PHPExcel_Exception
*/
public function addPrintAreaByColumnAndRow($column1, $row1, $column2, $row2, $index = -1)
{
return $this->setPrintArea(PHPExcel_Cell::stringFromColumnIndex($column1) . $row1 . ':' . PHPExcel_Cell::stringFromColumnIndex($column2) . $row2, $index, self::SETPRINTRANGE_INSERT);
}
/**
* Get first page number
*
* @return int
*/
public function getFirstPageNumber() {
return $this->_firstPageNumber;
}
/**
* Set first page number
*
* @param int $value
* @return PHPExcel_Worksheet_HeaderFooter
*/
public function setFirstPageNumber($value = null) {
$this->_firstPageNumber = $value;
return $this;
}
/**
* Reset first page number
*
* @return PHPExcel_Worksheet_HeaderFooter
*/
public function resetFirstPageNumber() {
return $this->setFirstPageNumber(null);
}
/**
* Implement PHP __clone to create a deep clone, not just a shallow copy.
*/
public function __clone() {
$vars = get_object_vars($this);
foreach ($vars as $key => $value) {
if (is_object($value)) {
$this->$key = clone $value;
} else {
$this->$key = $value;
}
}
}
}

545
framework/library/phpexcel/PHPExcel/Worksheet/Protection.php

@ -0,0 +1,545 @@
<?php
/**
* PHPExcel
*
* Copyright (c) 2006 - 2013 PHPExcel
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* @category PHPExcel
* @package PHPExcel_Worksheet
* @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel)
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @version 1.7.9, 2013-06-02
*/
/**
* PHPExcel_Worksheet_Protection
*
* @category PHPExcel
* @package PHPExcel_Worksheet
* @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel)
*/
class PHPExcel_Worksheet_Protection
{
/**
* Sheet
*
* @var boolean
*/
private $_sheet = false;
/**
* Objects
*
* @var boolean
*/
private $_objects = false;
/**
* Scenarios
*
* @var boolean
*/
private $_scenarios = false;
/**
* Format cells
*
* @var boolean
*/
private $_formatCells = false;
/**
* Format columns
*
* @var boolean
*/
private $_formatColumns = false;
/**
* Format rows
*
* @var boolean
*/
private $_formatRows = false;
/**
* Insert columns
*
* @var boolean
*/
private $_insertColumns = false;
/**
* Insert rows
*
* @var boolean
*/
private $_insertRows = false;
/**
* Insert hyperlinks
*
* @var boolean
*/
private $_insertHyperlinks = false;
/**
* Delete columns
*
* @var boolean
*/
private $_deleteColumns = false;
/**
* Delete rows
*
* @var boolean
*/
private $_deleteRows = false;
/**
* Select locked cells
*
* @var boolean
*/
private $_selectLockedCells = false;
/**
* Sort
*
* @var boolean
*/
private $_sort = false;
/**
* AutoFilter
*
* @var boolean
*/
private $_autoFilter = false;
/**
* Pivot tables
*
* @var boolean
*/
private $_pivotTables = false;
/**
* Select unlocked cells
*
* @var boolean
*/
private $_selectUnlockedCells = false;
/**
* Password
*
* @var string
*/
private $_password = '';
/**
* Create a new PHPExcel_Worksheet_Protection
*/
public function __construct()
{
}
/**
* Is some sort of protection enabled?
*
* @return boolean
*/
function isProtectionEnabled() {
return $this->_sheet ||
$this->_objects ||
$this->_scenarios ||
$this->_formatCells ||
$this->_formatColumns ||
$this->_formatRows ||
$this->_insertColumns ||
$this->_insertRows ||
$this->_insertHyperlinks ||
$this->_deleteColumns ||
$this->_deleteRows ||
$this->_selectLockedCells ||
$this->_sort ||
$this->_autoFilter ||
$this->_pivotTables ||
$this->_selectUnlockedCells;
}
/**
* Get Sheet
*
* @return boolean
*/
function getSheet() {
return $this->_sheet;
}
/**
* Set Sheet
*
* @param boolean $pValue
* @return PHPExcel_Worksheet_Protection
*/
function setSheet($pValue = false) {
$this->_sheet = $pValue;
return $this;
}
/**
* Get Objects
*
* @return boolean
*/
function getObjects() {
return $this->_objects;
}
/**
* Set Objects
*
* @param boolean $pValue
* @return PHPExcel_Worksheet_Protection
*/
function setObjects($pValue = false) {
$this->_objects = $pValue;
return $this;
}
/**
* Get Scenarios
*
* @return boolean
*/
function getScenarios() {
return $this->_scenarios;
}
/**
* Set Scenarios
*
* @param boolean $pValue
* @return PHPExcel_Worksheet_Protection
*/
function setScenarios($pValue = false) {
$this->_scenarios = $pValue;
return $this;
}
/**
* Get FormatCells
*
* @return boolean
*/
function getFormatCells() {
return $this->_formatCells;
}
/**
* Set FormatCells
*
* @param boolean $pValue
* @return PHPExcel_Worksheet_Protection
*/
function setFormatCells($pValue = false) {
$this->_formatCells = $pValue;
return $this;
}
/**
* Get FormatColumns
*
* @return boolean
*/
function getFormatColumns() {
return $this->_formatColumns;
}
/**
* Set FormatColumns
*
* @param boolean $pValue
* @return PHPExcel_Worksheet_Protection
*/
function setFormatColumns($pValue = false) {
$this->_formatColumns = $pValue;
return $this;
}
/**
* Get FormatRows
*
* @return boolean
*/
function getFormatRows() {
return $this->_formatRows;
}
/**
* Set FormatRows
*
* @param boolean $pValue
* @return PHPExcel_Worksheet_Protection
*/
function setFormatRows($pValue = false) {
$this->_formatRows = $pValue;
return $this;
}
/**
* Get InsertColumns
*
* @return boolean
*/
function getInsertColumns() {
return $this->_insertColumns;
}
/**
* Set InsertColumns
*
* @param boolean $pValue
* @return PHPExcel_Worksheet_Protection
*/
function setInsertColumns($pValue = false) {
$this->_insertColumns = $pValue;
return $this;
}
/**
* Get InsertRows
*
* @return boolean
*/
function getInsertRows() {
return $this->_insertRows;
}
/**
* Set InsertRows
*
* @param boolean $pValue
* @return PHPExcel_Worksheet_Protection
*/
function setInsertRows($pValue = false) {
$this->_insertRows = $pValue;
return $this;
}
/**
* Get InsertHyperlinks
*
* @return boolean
*/
function getInsertHyperlinks() {
return $this->_insertHyperlinks;
}
/**
* Set InsertHyperlinks
*
* @param boolean $pValue
* @return PHPExcel_Worksheet_Protection
*/
function setInsertHyperlinks($pValue = false) {
$this->_insertHyperlinks = $pValue;
return $this;
}
/**
* Get DeleteColumns
*
* @return boolean
*/
function getDeleteColumns() {
return $this->_deleteColumns;
}
/**
* Set DeleteColumns
*
* @param boolean $pValue
* @return PHPExcel_Worksheet_Protection
*/
function setDeleteColumns($pValue = false) {
$this->_deleteColumns = $pValue;
return $this;
}
/**
* Get DeleteRows
*
* @return boolean
*/
function getDeleteRows() {
return $this->_deleteRows;
}
/**
* Set DeleteRows
*
* @param boolean $pValue
* @return PHPExcel_Worksheet_Protection
*/
function setDeleteRows($pValue = false) {
$this->_deleteRows = $pValue;
return $this;
}
/**
* Get SelectLockedCells
*
* @return boolean
*/
function getSelectLockedCells() {
return $this->_selectLockedCells;
}
/**
* Set SelectLockedCells
*
* @param boolean $pValue
* @return PHPExcel_Worksheet_Protection
*/
function setSelectLockedCells($pValue = false) {
$this->_selectLockedCells = $pValue;
return $this;
}
/**
* Get Sort
*
* @return boolean
*/
function getSort() {
return $this->_sort;
}
/**
* Set Sort
*
* @param boolean $pValue
* @return PHPExcel_Worksheet_Protection
*/
function setSort($pValue = false) {
$this->_sort = $pValue;
return $this;
}
/**
* Get AutoFilter
*
* @return boolean
*/
function getAutoFilter() {
return $this->_autoFilter;
}
/**
* Set AutoFilter
*
* @param boolean $pValue
* @return PHPExcel_Worksheet_Protection
*/
function setAutoFilter($pValue = false) {
$this->_autoFilter = $pValue;
return $this;
}
/**
* Get PivotTables
*
* @return boolean
*/
function getPivotTables() {
return $this->_pivotTables;
}
/**
* Set PivotTables
*
* @param boolean $pValue
* @return PHPExcel_Worksheet_Protection
*/
function setPivotTables($pValue = false) {
$this->_pivotTables = $pValue;
return $this;
}
/**
* Get SelectUnlockedCells
*
* @return boolean
*/
function getSelectUnlockedCells() {
return $this->_selectUnlockedCells;
}
/**
* Set SelectUnlockedCells
*
* @param boolean $pValue
* @return PHPExcel_Worksheet_Protection
*/
function setSelectUnlockedCells($pValue = false) {
$this->_selectUnlockedCells = $pValue;
return $this;
}
/**
* Get Password (hashed)
*
* @return string
*/
function getPassword() {
return $this->_password;
}
/**
* Set Password
*
* @param string $pValue
* @param boolean $pAlreadyHashed If the password has already been hashed, set this to true
* @return PHPExcel_Worksheet_Protection
*/
function setPassword($pValue = '', $pAlreadyHashed = false) {
if (!$pAlreadyHashed) {
$pValue = PHPExcel_Shared_PasswordHasher::hashPassword($pValue);
}
$this->_password = $pValue;
return $this;
}
/**
* Implement PHP __clone to create a deep clone, not just a shallow copy.
*/
public function __clone() {
$vars = get_object_vars($this);
foreach ($vars as $key => $value) {
if (is_object($value)) {
$this->$key = clone $value;
} else {
$this->$key = $value;
}
}
}
}

1582
framework/library/phpexcel/PHPExcel/Writer/Excel5/Parser.php

File diff suppressed because it is too large

190
framework/library/phpexcel/PHPExcel/Writer/OpenDocument.php

@ -0,0 +1,190 @@
<?php
/**
* PHPExcel_Writer_OpenDocument
*
* Copyright (c) 2006 - 2015 PHPExcel
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* @category PHPExcel
* @package PHPExcel_Writer_OpenDocument
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @version ##VERSION##, ##DATE##
*/
class PHPExcel_Writer_OpenDocument extends PHPExcel_Writer_Abstract implements PHPExcel_Writer_IWriter
{
/**
* Private writer parts
*
* @var PHPExcel_Writer_OpenDocument_WriterPart[]
*/
private $writerParts = array();
/**
* Private PHPExcel
*
* @var PHPExcel
*/
private $spreadSheet;
/**
* Create a new PHPExcel_Writer_OpenDocument
*
* @param PHPExcel $pPHPExcel
*/
public function __construct(PHPExcel $pPHPExcel = null)
{
$this->setPHPExcel($pPHPExcel);
$writerPartsArray = array(
'content' => 'PHPExcel_Writer_OpenDocument_Content',
'meta' => 'PHPExcel_Writer_OpenDocument_Meta',
'meta_inf' => 'PHPExcel_Writer_OpenDocument_MetaInf',
'mimetype' => 'PHPExcel_Writer_OpenDocument_Mimetype',
'settings' => 'PHPExcel_Writer_OpenDocument_Settings',
'styles' => 'PHPExcel_Writer_OpenDocument_Styles',
'thumbnails' => 'PHPExcel_Writer_OpenDocument_Thumbnails'
);
foreach ($writerPartsArray as $writer => $class) {
$this->writerParts[$writer] = new $class($this);
}
}
/**
* Get writer part
*
* @param string $pPartName Writer part name
* @return PHPExcel_Writer_Excel2007_WriterPart
*/
public function getWriterPart($pPartName = '')
{
if ($pPartName != '' && isset($this->writerParts[strtolower($pPartName)])) {
return $this->writerParts[strtolower($pPartName)];
} else {
return null;
}
}
/**
* Save PHPExcel to file
*
* @param string $pFilename
* @throws PHPExcel_Writer_Exception
*/
public function save($pFilename = null)
{
if (!$this->spreadSheet) {
throw new PHPExcel_Writer_Exception('PHPExcel object unassigned.');
}
// garbage collect
$this->spreadSheet->garbageCollect();
// If $pFilename is php://output or php://stdout, make it a temporary file...
$originalFilename = $pFilename;
if (strtolower($pFilename) == 'php://output' || strtolower($pFilename) == 'php://stdout') {
$pFilename = @tempnam(PHPExcel_Shared_File::sys_get_temp_dir(), 'phpxltmp');
if ($pFilename == '') {
$pFilename = $originalFilename;
}
}
$objZip = $this->createZip($pFilename);
$objZip->addFromString('META-INF/manifest.xml', $this->getWriterPart('meta_inf')->writeManifest());
$objZip->addFromString('Thumbnails/thumbnail.png', $this->getWriterPart('thumbnails')->writeThumbnail());
$objZip->addFromString('content.xml', $this->getWriterPart('content')->write());
$objZip->addFromString('meta.xml', $this->getWriterPart('meta')->write());
$objZip->addFromString('mimetype', $this->getWriterPart('mimetype')->write());
$objZip->addFromString('settings.xml', $this->getWriterPart('settings')->write());
$objZip->addFromString('styles.xml', $this->getWriterPart('styles')->write());
// Close file
if ($objZip->close() === false) {
throw new PHPExcel_Writer_Exception("Could not close zip file $pFilename.");
}
// If a temporary file was used, copy it to the correct file stream
if ($originalFilename != $pFilename) {
if (copy($pFilename, $originalFilename) === false) {
throw new PHPExcel_Writer_Exception("Could not copy temporary zip file $pFilename to $originalFilename.");
}
@unlink($pFilename);
}
}
/**
* Create zip object
*
* @param string $pFilename
* @throws PHPExcel_Writer_Exception
* @return ZipArchive
*/
private function createZip($pFilename)
{
// Create new ZIP file and open it for writing
$zipClass = PHPExcel_Settings::getZipClass();
$objZip = new $zipClass();
// Retrieve OVERWRITE and CREATE constants from the instantiated zip class
// This method of accessing constant values from a dynamic class should work with all appropriate versions of PHP
$ro = new ReflectionObject($objZip);
$zipOverWrite = $ro->getConstant('OVERWRITE');
$zipCreate = $ro->getConstant('CREATE');
if (file_exists($pFilename)) {
unlink($pFilename);
}
// Try opening the ZIP file
if ($objZip->open($pFilename, $zipOverWrite) !== true) {
if ($objZip->open($pFilename, $zipCreate) !== true) {
throw new PHPExcel_Writer_Exception("Could not open $pFilename for writing.");
}
}
return $objZip;
}
/**
* Get PHPExcel object
*
* @return PHPExcel
* @throws PHPExcel_Writer_Exception
*/
public function getPHPExcel()
{
if ($this->spreadSheet !== null) {
return $this->spreadSheet;
} else {
throw new PHPExcel_Writer_Exception('No PHPExcel assigned.');
}
}
/**
* Set PHPExcel object
*
* @param PHPExcel $pPHPExcel PHPExcel object
* @throws PHPExcel_Writer_Exception
* @return PHPExcel_Writer_Excel2007
*/
public function setPHPExcel(PHPExcel $pPHPExcel = null)
{
$this->spreadSheet = $pPHPExcel;
return $this;
}
}

90
framework/library/phpexcel/PHPExcel/Writer/PDF.php

@ -0,0 +1,90 @@
<?php
/**
* PHPExcel
*
* Copyright (c) 2006 - 2013 PHPExcel
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* @category PHPExcel
* @package PHPExcel_Writer_PDF
* @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel)
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @version 1.7.9, 2013-06-02
*/
/**
* PHPExcel_Writer_PDF
*
* @category PHPExcel
* @package PHPExcel_Writer_PDF
* @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel)
*/
class PHPExcel_Writer_PDF
{
/**
* The wrapper for the requested PDF rendering engine
*
* @var PHPExcel_Writer_PDF_Core
*/
private $_renderer = NULL;
/**
* Instantiate a new renderer of the configured type within this container class
*
* @param PHPExcel $phpExcel PHPExcel object
* @throws PHPExcel_Writer_Exception when PDF library is not configured
*/
public function __construct(PHPExcel $phpExcel)
{
$pdfLibraryName = PHPExcel_Settings::getPdfRendererName();
if (is_null($pdfLibraryName)) {
throw new PHPExcel_Writer_Exception("PDF Rendering library has not been defined.");
}
$pdfLibraryPath = PHPExcel_Settings::getPdfRendererPath();
if (is_null($pdfLibraryName)) {
throw new PHPExcel_Writer_Exception("PDF Rendering library path has not been defined.");
}
$includePath = str_replace('\\', '/', get_include_path());
$rendererPath = str_replace('\\', '/', $pdfLibraryPath);
if (strpos($rendererPath, $includePath) === false) {
set_include_path(get_include_path() . PATH_SEPARATOR . $pdfLibraryPath);
}
$rendererName = 'PHPExcel_Writer_PDF_' . $pdfLibraryName;
$this->_renderer = new $rendererName($phpExcel);
}
/**
* Magic method to handle direct calls to the configured PDF renderer wrapper class.
*
* @param string $name Renderer library method name
* @param mixed[] $arguments Array of arguments to pass to the renderer method
* @return mixed Returned data from the PDF renderer wrapper method
*/
public function __call($name, $arguments)
{
if ($this->_renderer === NULL) {
throw new PHPExcel_Writer_Exception("PDF Rendering library has not been defined.");
}
return call_user_func_array(array($this->_renderer, $name), $arguments);
}
}

943
web/common/permission.inc.php

@ -0,0 +1,943 @@
<?php
/**
* [WeEngine System] Copyright (c) 2014 WE7.CC
* WeEngine is NOT a free software, it under the license terms, visited http://www.w7.cc/ for more details.
*/
defined('IN_IA') or exit('Access Denied');
$we7_file_permission = array (
'account' =>
array (
'default' => '',
'direct' =>
array (
0 => 'auth',
1 => 'welcome',
),
'vice_founder' =>
array (
0 => 'account*',
),
'owner' =>
array (
0 => 'account*',
),
'manager' =>
array (
0 => 'common-info',
1 => 'display',
2 => 'manage',
3 => 'post-step',
4 => 'post-user',
5 => 'post',
6 => 'create',
),
'operator' =>
array (
0 => 'common-info',
1 => 'display',
2 => 'manage',
3 => 'post-step',
4 => 'create',
),
'clerk' =>
array (
0 => 'display',
),
'unbind_user' =>
array (
),
),
'advertisement' =>
array (
'default' => '',
'direct' =>
array (
),
'vice_founder' =>
array (
),
'owner' =>
array (
),
'manager' =>
array (
),
'operator' =>
array (
),
'clerk' =>
array (
),
'unbind_user' =>
array (
),
),
'article' =>
array (
'default' => '',
'direct' =>
array (
0 => 'notice-show',
1 => 'news-show',
),
'vice_founder' =>
array (
),
'owner' =>
array (
),
'manager' =>
array (
),
'operator' =>
array (
),
'clerk' =>
array (
),
'unbind_user' =>
array (
),
),
'message' =>
array (
'default' => '',
'direct' =>
array (
),
'vice_founder' =>
array (
0 => 'notice',
),
'owner' =>
array (
0 => 'notice',
),
'manager' =>
array (
0 => 'notice',
),
'operator' =>
array (
0 => 'notice',
),
'clerk' =>
array (
0 => 'notice',
),
'unbind_user' =>
array (
0 => 'notice',
),
),
'cloud' =>
array (
'default' => 'touch',
'direct' =>
array (
0 => 'touch',
1 => 'dock',
),
'vice_founder' =>
array (
),
'owner' =>
array (
),
'manager' =>
array (
),
'operator' =>
array (
),
'clerk' =>
array (
),
'unbind_user' =>
array (
),
),
'cron' =>
array (
'default' => '',
'direct' =>
array (
0 => 'entry',
),
'vice_founder' =>
array (
),
'owner' =>
array (
),
'manager' =>
array (
),
'operator' =>
array (
),
'clerk' =>
array (
),
'unbind_user' =>
array (
),
),
'founder' =>
array (
'default' => '',
'direct' =>
array (
),
'vice_founder' =>
array (
),
'owner' =>
array (
),
'manager' =>
array (
),
'operator' =>
array (
),
'clerk' =>
array (
),
'unbind_user' =>
array (
),
),
'help' =>
array (
'default' => '',
'direct' =>
array (
),
'vice_founder' =>
array (
0 => 'help*',
),
'owner' =>
array (
0 => 'help*',
),
'manager' =>
array (
0 => 'help*',
),
'operator' =>
array (
0 => 'help*',
),
'clerk' =>
array (
),
'unbind_user' =>
array (
),
),
'home' =>
array (
'default' => 'welcome',
'direct' =>
array (
),
'vice_founder' =>
array (
0 => 'home*',
),
'owner' =>
array (
0 => 'home*',
),
'manager' =>
array (
0 => 'home*',
),
'operator' =>
array (
0 => 'home*',
),
'clerk' =>
array (
0 => 'welcome',
),
'unbind_user' =>
array (
),
'expired' =>
array (
0 => 'welcome',
),
),
'mc' =>
array (
'default' => '',
'direct' =>
array (
),
'vice_founder' =>
array (
0 => 'mc*',
),
'owner' =>
array (
0 => 'mc*',
),
'manager' =>
array (
0 => 'chats',
1 => 'fields',
2 => 'group',
3 => 'trade',
4 => 'fans',
5 => 'member',
6 => 'message',
),
'operator' =>
array (
0 => 'chats',
1 => 'fields',
2 => 'group',
3 => 'trade',
),
'clerk' =>
array (
),
'unbind_user' =>
array (
),
),
'module' =>
array (
'default' => '',
'direct' =>
array (
),
'vice_founder' =>
array (
0 => 'module*',
),
'owner' =>
array (
0 => 'manage-account',
1 => 'manage-system',
2 => 'permission',
3 => 'display',
4 => 'welcome',
5 => 'link',
6 => 'link-account',
7 => 'shortcut',
8 => 'plugin',
),
'manager' =>
array (
0 => 'manage-account',
1 => 'display',
2 => 'welcome',
3 => 'link',
4 => 'link-account',
5 => 'shortcut',
6 => 'plugin',
),
'operator' =>
array (
0 => 'manage-account',
1 => 'display',
2 => 'welcome',
3 => 'link',
4 => 'link-account',
5 => 'shortcut',
6 => 'plugin',
),
'clerk' =>
array (
0 => 'display',
1 => 'manage-account',
2 => 'welcome',
3 => 'link',
4 => 'link-account',
5 => 'shortcut',
6 => 'plugin',
),
'unbind_user' =>
array (
),
),
'platform' =>
array (
'default' => '',
'direct' =>
array (
),
'vice_founder' =>
array (
0 => 'platform*',
),
'owner' =>
array (
0 => 'platform*',
),
'manager' =>
array (
0 => 'cover',
1 => 'reply',
2 => 'menu',
3 => 'qr',
4 => 'mass',
5 => 'material',
6 => 'material-post',
7 => 'url2qr',
),
'operator' =>
array (
0 => 'cover',
1 => 'reply',
2 => 'material',
3 => 'material-post',
4 => 'url2qr',
),
'clerk' =>
array (
0 => 'reply',
1 => 'cover',
2 => 'material',
3 => 'material-post',
),
'unbind_user' =>
array (
),
),
'profile' =>
array (
'default' => '',
'direct' =>
array (
),
'vice_founder' =>
array (
0 => 'profile*',
),
'owner' =>
array (
0 => 'profile*',
),
'manager' =>
array (
0 => 'remote',
1 => 'passport',
2 => 'tplnotice',
3 => 'notify',
4 => 'common',
5 => 'payment',
6 => 'refund',
7 => 'module-link-uniacid',
8 => 'bind-domain',
),
'operator' =>
array (
),
'clerk' =>
array (
),
'unbind_user' =>
array (
0 => 'profile*',
),
),
'site' =>
array (
'default' => '',
'direct' =>
array (
0 => 'entry',
),
'vice_founder' =>
array (
0 => 'site*',
),
'owner' =>
array (
0 => 'site*',
),
'manager' =>
array (
0 => 'editor',
1 => 'article',
2 => 'category',
3 => 'style',
4 => 'nav',
5 => 'slide',
6 => 'multi',
7 => 'comment',
),
'operator' =>
array (
0 => 'editor',
1 => 'article',
2 => 'category',
3 => 'style',
4 => 'nav',
5 => 'slide',
),
'clerk' =>
array (
0 => 'nav',
),
'unbind_user' =>
array (
),
),
'statistics' =>
array (
'default' => '',
'direct' =>
array (
),
'vice_founder' =>
array (
0 => 'statistics*',
),
'owner' =>
array (
0 => 'statistics*',
),
'manager' =>
array (
0 => 'app',
1 => 'site',
2 => 'setting',
3 => 'fans',
),
'operator' =>
array (
),
'clerk' =>
array (
),
'unbind_user' =>
array (
),
),
'store' =>
array (
'default' => '',
'direct' =>
array (
),
'vice_founder' =>
array (
0 => 'goods-buyer',
1 => 'orders',
),
'owner' =>
array (
0 => 'goods-buyer',
1 => 'orders',
),
'manager' =>
array (
0 => 'goods-buyer',
1 => 'orders',
),
'operator' =>
array (
0 => 'goods-buyer',
1 => 'orders',
),
'clerk' =>
array (
),
'unbind_user' =>
array (
),
'expired' =>
array (
0 => 'goods-buyer',
1 => 'orders',
),
),
'system' =>
array (
'default' => '',
'direct' =>
array (
),
'vice_founder' =>
array (
0 => 'updatecache',
),
'owner' =>
array (
0 => 'updatecache',
),
'manager' =>
array (
0 => 'updatecache',
),
'operator' =>
array (
0 => 'updatecache',
),
'clerk' =>
array (
0 => 'updatecache',
),
'unbind_user' =>
array (
0 => 'updatecache',
),
'expired' =>
array (
0 => 'updatecache',
),
),
'user' =>
array (
'default' => 'display',
'direct' =>
array (
0 => 'login',
1 => 'register',
2 => 'logout',
3 => 'find-password',
4 => 'third-bind',
5 => 'agreement-show',
),
'vice_founder' =>
array (
0 => 'user*',
),
'owner' =>
array (
0 => 'profile',
),
'manager' =>
array (
0 => 'profile',
),
'operator' =>
array (
0 => 'profile',
),
'clerk' =>
array (
0 => 'profile',
),
'unbind_user' =>
array (
0 => 'profile',
),
'expired' =>
array (
0 => 'user*',
),
),
'miniapp' =>
array (
'default' => '',
'direct' =>
array (
),
'vice_founder' =>
array (
0 => 'miniapp*',
),
'owner' =>
array (
0 => 'miniapp*',
),
'manager' =>
array (
0 => 'display',
1 => 'version',
2 => 'post',
),
'operator' =>
array (
0 => 'display',
1 => 'version',
2 => 'post',
),
'clerk' =>
array (
0 => 'display',
1 => 'version',
2 => 'post',
),
'unbind_user' =>
array (
),
),
'wxapp' =>
array (
'default' => '',
'direct' =>
array (
),
'vice_founder' =>
array (
0 => 'wxapp*',
),
'owner' =>
array (
0 => 'wxapp*',
),
'manager' =>
array (
0 => 'display',
1 => 'version',
2 => 'post',
3 => 'auth',
4 => 'manage',
),
'operator' =>
array (
0 => 'display',
1 => 'version',
2 => 'post',
3 => 'auth',
),
'clerk' =>
array (
0 => 'display',
),
'unbind_user' =>
array (
),
),
'webapp' =>
array (
'default' => '',
'direct' =>
array (
),
'vice_founder' =>
array (
0 => 'webapp*',
),
'owner' =>
array (
0 => 'webapp*',
),
'manager' =>
array (
0 => 'home',
1 => 'manage',
),
'operator' =>
array (
0 => 'home',
1 => 'manage',
),
'clerk' =>
array (
0 => 'home',
),
'unbind_user' =>
array (
),
),
'phoneapp' =>
array (
'default' => '',
'direct' =>
array (
),
'vice_founder' =>
array (
0 => 'phoneapp*',
),
'owner' =>
array (
0 => 'phoneapp*',
),
'manager' =>
array (
0 => 'display',
1 => 'manage',
2 => 'version',
),
'operator' =>
array (
0 => 'display',
1 => 'manage',
2 => 'version',
),
'clerk' =>
array (
0 => 'display',
),
),
'utility' =>
array (
'default' => '',
'direct' =>
array (
0 => 'verifycode',
1 => 'code',
2 => 'bindcall',
3 => 'subscribe',
4 => 'wxcode',
5 => 'modules',
6 => 'link',
7 => 'visit',
8 => 'file',
),
'vice_founder' =>
array (
0 => 'user',
1 => 'emulator',
2 => 'file',
),
'owner' =>
array (
0 => 'emulator',
1 => 'file',
),
'manager' =>
array (
0 => 'emulator',
1 => 'file',
),
'operator' =>
array (
0 => 'emulator',
1 => 'file',
),
'clerk' =>
array (
0 => 'emulator',
1 => 'file',
),
'unbind_user' =>
array (
),
),
'append' =>
array (
0 => 'append*',
),
'see_more_info' =>
array (
'founder' =>
array (
0 => 'see_module_manage_system_except_installed',
1 => 'see_module_manage_system_ugrade',
2 => 'see_module_manage_system_stop',
3 => 'see_module_manage_system_install',
4 => 'see_module_manage_system_shopinfo',
5 => 'see_module_manage_system_info_edit',
6 => 'see_module_manage_system_detailinfo',
7 => 'see_module_manage_system_group_add',
8 => 'see_module_manage_system_welcome_support',
9 => 'see_account_post_modules_tpl_edit_store_endtime',
10 => 'see_account_manage_module_tpl_all_permission',
11 => 'see_account_manage_sms_blance',
12 => 'see_account_manage_users_edit_vicefounder',
13 => 'see_account_manage_users_edit_owner',
14 => 'see_account_manage_users_set_permission_for_manager',
15 => 'see_account_manage_users_set_permission_for_operator',
16 => 'see_account_manage_users_addmanager',
17 => 'see_account_manage_users_delmanager',
18 => 'see_account_manage_users_deloperator',
19 => 'see_account_manage_users_adduser',
20 => 'see_account_manage_users_add_viceuser',
21 => 'see_account_manage_display',
22 => 'see_account_manage_recycle',
23 => 'see_account_manage_system_platform',
24 => 'see_account_manage_expired_message',
25 => 'see_permission_create_account_group',
26 => 'see_permission_module_group',
27 => 'see_permission_user_group',
28 => 'see_permission_founder_group',
29 => 'see_system_upgrade',
30 => 'see_system_manage_clerk',
31 => 'see_system_manage_vice_founder',
32 => 'see_system_add_vice_founder',
33 => 'see_notice_post',
34 => 'see_message_official',
35 => 'see_message_order',
36 => 'see_message_register',
37 => 'see_message_worker',
38 => 'see_module_manage_system_newversion',
39 => 'see_user_add_welcome_account',
40 => 'see_user_edit_base_founder_name',
41 => 'see_user_create_own_vice_founder',
42 => 'see_user_profile_account_num',
43 => 'see_user_profile_edit_username',
44 => 'see_user_manage_display',
45 => 'see_user_manage_founder',
46 => 'see_user_manage_clerk',
47 => 'see_user_manage_check',
48 => 'see_user_manage_recycle',
49 => 'see_user_manage_fields',
50 => 'see_user_manage_expire',
51 => 'see_workorder',
52 => 'see_controller',
53 => 'see_modules_deactivate',
),
'vice_founder' =>
array (
0 => 'see_account_manage_users_adduser',
1 => 'see_account_manage_users_edit_owner',
2 => 'see_account_manage_users_set_permission_for_manager',
3 => 'see_account_manage_users_set_permission_for_operator',
4 => 'see_account_manage_users_deloperator',
5 => 'see_account_manage_users_delmanager',
6 => 'see_account_manage_display',
7 => 'see_account_manage_recycle',
8 => 'see_module_manage_system_group_add',
9 => 'see_permission_create_account_group',
10 => 'see_permission_module_group',
11 => 'see_permission_user_group',
12 => 'see_user_add_welcome_account',
13 => 'see_user_profile_account_num',
14 => 'see_user_manage_display',
15 => 'see_user_manage_check',
16 => 'see_user_manage_recycle',
17 => 'see_controller',
),
'owner' =>
array (
0 => 'see_account_manage_users_set_permission_for_manager',
1 => 'see_account_manage_users_set_permission_for_operator',
2 => 'see_account_manage_users_deloperator',
3 => 'see_account_manage_users_delmanager',
4 => 'see_account_manage_display',
5 => 'see_account_manage_recycle',
6 => 'see_modules_recharge',
7 => 'see_user_add_welcome_account',
8 => 'see_user_profile_account_num',
),
'manager' =>
array (
0 => 'see_account_manage_users_set_permission_for_operator',
1 => 'see_account_manage_users_deloperator',
2 => 'see_account_manage_display',
3 => 'see_user_profile_welcome',
4 => 'see_user_add_welcome_account',
5 => 'see_user_profile_account_num',
),
'operator' =>
array (
0 => 'see_account_manage_display',
1 => 'see_user_profile_welcome',
2 => 'see_user_add_welcome_account',
3 => 'see_user_profile_account_num',
),
'clerk' =>
array (
),
'unbind_user' =>
array (
0 => 'see_user_profile_welcome',
),
'expired' =>
array (
),
),
);
return $we7_file_permission;

13
web/resource/components/kindeditor/plugins/code/prettify.css

@ -0,0 +1,13 @@
.pln{color:#000}@media screen{.str{color:#080}.kwd{color:#008}.com{color:#800}.typ{color:#606}.lit{color:#066}.pun,.opn,.clo{color:#660}.tag{color:#008}.atn{color:#606}.atv{color:#080}.dec,.var{color:#606}.fun{color:red}}@media print,projection{.str{color:#060}.kwd{color:#006;font-weight:bold}.com{color:#600;font-style:italic}.typ{color:#404;font-weight:bold}.lit{color:#044}.pun,.opn,.clo{color:#440}.tag{color:#006;font-weight:bold}.atn{color:#404}.atv{color:#060}}pre.prettyprint{padding:2px;border:1px solid #888}ol.linenums{margin-top:0;margin-bottom:0}li.L0,li.L1,li.L2,li.L3,li.L5,li.L6,li.L7,li.L8{list-style-type:none}li.L1,li.L3,li.L5,li.L7,li.L9{background:#eee}
pre.prettyprint {
border: 0;
border-left: 3px solid rgb(204, 204, 204);
margin-left: 2em;
padding: 0.5em;
font-size: 110%;
display: block;
font-family: "Consolas", "Monaco", "Bitstream Vera Sans Mono", "Courier New", Courier, monospace;
margin: 1em 0px;
white-space: pre;
}

28
web/resource/components/kindeditor/plugins/code/prettify.js

@ -0,0 +1,28 @@
var q=null;window.PR_SHOULD_USE_CONTINUATION=!0;
(function(){function L(a){function m(a){var f=a.charCodeAt(0);if(f!==92)return f;var b=a.charAt(1);return(f=r[b])?f:"0"<=b&&b<="7"?parseInt(a.substring(1),8):b==="u"||b==="x"?parseInt(a.substring(2),16):a.charCodeAt(1)}function e(a){if(a<32)return(a<16?"\\x0":"\\x")+a.toString(16);a=String.fromCharCode(a);if(a==="\\"||a==="-"||a==="["||a==="]")a="\\"+a;return a}function h(a){for(var f=a.substring(1,a.length-1).match(/\\u[\dA-Fa-f]{4}|\\x[\dA-Fa-f]{2}|\\[0-3][0-7]{0,2}|\\[0-7]{1,2}|\\[\S\s]|[^\\]/g),a=
[],b=[],o=f[0]==="^",c=o?1:0,i=f.length;c<i;++c){var j=f[c];if(/\\[bdsw]/i.test(j))a.push(j);else{var j=m(j),d;c+2<i&&"-"===f[c+1]?(d=m(f[c+2]),c+=2):d=j;b.push([j,d]);d<65||j>122||(d<65||j>90||b.push([Math.max(65,j)|32,Math.min(d,90)|32]),d<97||j>122||b.push([Math.max(97,j)&-33,Math.min(d,122)&-33]))}}b.sort(function(a,f){return a[0]-f[0]||f[1]-a[1]});f=[];j=[NaN,NaN];for(c=0;c<b.length;++c)i=b[c],i[0]<=j[1]+1?j[1]=Math.max(j[1],i[1]):f.push(j=i);b=["["];o&&b.push("^");b.push.apply(b,a);for(c=0;c<
f.length;++c)i=f[c],b.push(e(i[0])),i[1]>i[0]&&(i[1]+1>i[0]&&b.push("-"),b.push(e(i[1])));b.push("]");return b.join("")}function y(a){for(var f=a.source.match(/\[(?:[^\\\]]|\\[\S\s])*]|\\u[\dA-Fa-f]{4}|\\x[\dA-Fa-f]{2}|\\\d+|\\[^\dux]|\(\?[!:=]|[()^]|[^()[\\^]+/g),b=f.length,d=[],c=0,i=0;c<b;++c){var j=f[c];j==="("?++i:"\\"===j.charAt(0)&&(j=+j.substring(1))&&j<=i&&(d[j]=-1)}for(c=1;c<d.length;++c)-1===d[c]&&(d[c]=++t);for(i=c=0;c<b;++c)j=f[c],j==="("?(++i,d[i]===void 0&&(f[c]="(?:")):"\\"===j.charAt(0)&&
(j=+j.substring(1))&&j<=i&&(f[c]="\\"+d[i]);for(i=c=0;c<b;++c)"^"===f[c]&&"^"!==f[c+1]&&(f[c]="");if(a.ignoreCase&&s)for(c=0;c<b;++c)j=f[c],a=j.charAt(0),j.length>=2&&a==="["?f[c]=h(j):a!=="\\"&&(f[c]=j.replace(/[A-Za-z]/g,function(a){a=a.charCodeAt(0);return"["+String.fromCharCode(a&-33,a|32)+"]"}));return f.join("")}for(var t=0,s=!1,l=!1,p=0,d=a.length;p<d;++p){var g=a[p];if(g.ignoreCase)l=!0;else if(/[a-z]/i.test(g.source.replace(/\\u[\da-f]{4}|\\x[\da-f]{2}|\\[^UXux]/gi,""))){s=!0;l=!1;break}}for(var r=
{b:8,t:9,n:10,v:11,f:12,r:13},n=[],p=0,d=a.length;p<d;++p){g=a[p];if(g.global||g.multiline)throw Error(""+g);n.push("(?:"+y(g)+")")}return RegExp(n.join("|"),l?"gi":"g")}function M(a){function m(a){switch(a.nodeType){case 1:if(e.test(a.className))break;for(var g=a.firstChild;g;g=g.nextSibling)m(g);g=a.nodeName;if("BR"===g||"LI"===g)h[s]="\n",t[s<<1]=y++,t[s++<<1|1]=a;break;case 3:case 4:g=a.nodeValue,g.length&&(g=p?g.replace(/\r\n?/g,"\n"):g.replace(/[\t\n\r ]+/g," "),h[s]=g,t[s<<1]=y,y+=g.length,
t[s++<<1|1]=a)}}var e=/(?:^|\s)nocode(?:\s|$)/,h=[],y=0,t=[],s=0,l;a.currentStyle?l=a.currentStyle.whiteSpace:window.getComputedStyle&&(l=document.defaultView.getComputedStyle(a,q).getPropertyValue("white-space"));var p=l&&"pre"===l.substring(0,3);m(a);return{a:h.join("").replace(/\n$/,""),c:t}}function B(a,m,e,h){m&&(a={a:m,d:a},e(a),h.push.apply(h,a.e))}function x(a,m){function e(a){for(var l=a.d,p=[l,"pln"],d=0,g=a.a.match(y)||[],r={},n=0,z=g.length;n<z;++n){var f=g[n],b=r[f],o=void 0,c;if(typeof b===
"string")c=!1;else{var i=h[f.charAt(0)];if(i)o=f.match(i[1]),b=i[0];else{for(c=0;c<t;++c)if(i=m[c],o=f.match(i[1])){b=i[0];break}o||(b="pln")}if((c=b.length>=5&&"lang-"===b.substring(0,5))&&!(o&&typeof o[1]==="string"))c=!1,b="src";c||(r[f]=b)}i=d;d+=f.length;if(c){c=o[1];var j=f.indexOf(c),k=j+c.length;o[2]&&(k=f.length-o[2].length,j=k-c.length);b=b.substring(5);B(l+i,f.substring(0,j),e,p);B(l+i+j,c,C(b,c),p);B(l+i+k,f.substring(k),e,p)}else p.push(l+i,b)}a.e=p}var h={},y;(function(){for(var e=a.concat(m),
l=[],p={},d=0,g=e.length;d<g;++d){var r=e[d],n=r[3];if(n)for(var k=n.length;--k>=0;)h[n.charAt(k)]=r;r=r[1];n=""+r;p.hasOwnProperty(n)||(l.push(r),p[n]=q)}l.push(/[\S\s]/);y=L(l)})();var t=m.length;return e}function u(a){var m=[],e=[];a.tripleQuotedStrings?m.push(["str",/^(?:'''(?:[^'\\]|\\[\S\s]|''?(?=[^']))*(?:'''|$)|"""(?:[^"\\]|\\[\S\s]|""?(?=[^"]))*(?:"""|$)|'(?:[^'\\]|\\[\S\s])*(?:'|$)|"(?:[^"\\]|\\[\S\s])*(?:"|$))/,q,"'\""]):a.multiLineStrings?m.push(["str",/^(?:'(?:[^'\\]|\\[\S\s])*(?:'|$)|"(?:[^"\\]|\\[\S\s])*(?:"|$)|`(?:[^\\`]|\\[\S\s])*(?:`|$))/,
q,"'\"`"]):m.push(["str",/^(?:'(?:[^\n\r'\\]|\\.)*(?:'|$)|"(?:[^\n\r"\\]|\\.)*(?:"|$))/,q,"\"'"]);a.verbatimStrings&&e.push(["str",/^@"(?:[^"]|"")*(?:"|$)/,q]);var h=a.hashComments;h&&(a.cStyleComments?(h>1?m.push(["com",/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,q,"#"]):m.push(["com",/^#(?:(?:define|elif|else|endif|error|ifdef|include|ifndef|line|pragma|undef|warning)\b|[^\n\r]*)/,q,"#"]),e.push(["str",/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h|[a-z]\w*)>/,q])):m.push(["com",/^#[^\n\r]*/,
q,"#"]));a.cStyleComments&&(e.push(["com",/^\/\/[^\n\r]*/,q]),e.push(["com",/^\/\*[\S\s]*?(?:\*\/|$)/,q]));a.regexLiterals&&e.push(["lang-regex",/^(?:^^\.?|[!+-]|!=|!==|#|%|%=|&|&&|&&=|&=|\(|\*|\*=|\+=|,|-=|->|\/|\/=|:|::|;|<|<<|<<=|<=|=|==|===|>|>=|>>|>>=|>>>|>>>=|[?@[^]|\^=|\^\^|\^\^=|{|\||\|=|\|\||\|\|=|~|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\s*(\/(?=[^*/])(?:[^/[\\]|\\[\S\s]|\[(?:[^\\\]]|\\[\S\s])*(?:]|$))+\/)/]);(h=a.types)&&e.push(["typ",h]);a=(""+a.keywords).replace(/^ | $/g,
"");a.length&&e.push(["kwd",RegExp("^(?:"+a.replace(/[\s,]+/g,"|")+")\\b"),q]);m.push(["pln",/^\s+/,q," \r\n\t\xa0"]);e.push(["lit",/^@[$_a-z][\w$@]*/i,q],["typ",/^(?:[@_]?[A-Z]+[a-z][\w$@]*|\w+_t\b)/,q],["pln",/^[$_a-z][\w$@]*/i,q],["lit",/^(?:0x[\da-f]+|(?:\d(?:_\d+)*\d*(?:\.\d*)?|\.\d\+)(?:e[+-]?\d+)?)[a-z]*/i,q,"0123456789"],["pln",/^\\[\S\s]?/,q],["pun",/^.[^\s\w"-$'./@\\`]*/,q]);return x(m,e)}function D(a,m){function e(a){switch(a.nodeType){case 1:if(k.test(a.className))break;if("BR"===a.nodeName)h(a),
a.parentNode&&a.parentNode.removeChild(a);else for(a=a.firstChild;a;a=a.nextSibling)e(a);break;case 3:case 4:if(p){var b=a.nodeValue,d=b.match(t);if(d){var c=b.substring(0,d.index);a.nodeValue=c;(b=b.substring(d.index+d[0].length))&&a.parentNode.insertBefore(s.createTextNode(b),a.nextSibling);h(a);c||a.parentNode.removeChild(a)}}}}function h(a){function b(a,d){var e=d?a.cloneNode(!1):a,f=a.parentNode;if(f){var f=b(f,1),g=a.nextSibling;f.appendChild(e);for(var h=g;h;h=g)g=h.nextSibling,f.appendChild(h)}return e}
for(;!a.nextSibling;)if(a=a.parentNode,!a)return;for(var a=b(a.nextSibling,0),e;(e=a.parentNode)&&e.nodeType===1;)a=e;d.push(a)}var k=/(?:^|\s)nocode(?:\s|$)/,t=/\r\n?|\n/,s=a.ownerDocument,l;a.currentStyle?l=a.currentStyle.whiteSpace:window.getComputedStyle&&(l=s.defaultView.getComputedStyle(a,q).getPropertyValue("white-space"));var p=l&&"pre"===l.substring(0,3);for(l=s.createElement("LI");a.firstChild;)l.appendChild(a.firstChild);for(var d=[l],g=0;g<d.length;++g)e(d[g]);m===(m|0)&&d[0].setAttribute("value",
m);var r=s.createElement("OL");r.className="linenums";for(var n=Math.max(0,m-1|0)||0,g=0,z=d.length;g<z;++g)l=d[g],l.className="L"+(g+n)%10,l.firstChild||l.appendChild(s.createTextNode("\xa0")),r.appendChild(l);a.appendChild(r)}function k(a,m){for(var e=m.length;--e>=0;){var h=m[e];A.hasOwnProperty(h)?window.console&&console.warn("cannot override language handler %s",h):A[h]=a}}function C(a,m){if(!a||!A.hasOwnProperty(a))a=/^\s*</.test(m)?"default-markup":"default-code";return A[a]}function E(a){var m=
a.g;try{var e=M(a.h),h=e.a;a.a=h;a.c=e.c;a.d=0;C(m,h)(a);var k=/\bMSIE\b/.test(navigator.userAgent),m=/\n/g,t=a.a,s=t.length,e=0,l=a.c,p=l.length,h=0,d=a.e,g=d.length,a=0;d[g]=s;var r,n;for(n=r=0;n<g;)d[n]!==d[n+2]?(d[r++]=d[n++],d[r++]=d[n++]):n+=2;g=r;for(n=r=0;n<g;){for(var z=d[n],f=d[n+1],b=n+2;b+2<=g&&d[b+1]===f;)b+=2;d[r++]=z;d[r++]=f;n=b}for(d.length=r;h<p;){var o=l[h+2]||s,c=d[a+2]||s,b=Math.min(o,c),i=l[h+1],j;if(i.nodeType!==1&&(j=t.substring(e,b))){k&&(j=j.replace(m,"\r"));i.nodeValue=
j;var u=i.ownerDocument,v=u.createElement("SPAN");v.className=d[a+1];var x=i.parentNode;x.replaceChild(v,i);v.appendChild(i);e<o&&(l[h+1]=i=u.createTextNode(t.substring(b,o)),x.insertBefore(i,v.nextSibling))}e=b;e>=o&&(h+=2);e>=c&&(a+=2)}}catch(w){"console"in window&&console.log(w&&w.stack?w.stack:w)}}var v=["break,continue,do,else,for,if,return,while"],w=[[v,"auto,case,char,const,default,double,enum,extern,float,goto,int,long,register,short,signed,sizeof,static,struct,switch,typedef,union,unsigned,void,volatile"],
"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"],F=[w,"alignof,align_union,asm,axiom,bool,concept,concept_map,const_cast,constexpr,decltype,dynamic_cast,explicit,export,friend,inline,late_check,mutable,namespace,nullptr,reinterpret_cast,static_assert,static_cast,template,typeid,typename,using,virtual,where"],G=[w,"abstract,boolean,byte,extends,final,finally,implements,import,instanceof,null,native,package,strictfp,super,synchronized,throws,transient"],
H=[G,"as,base,by,checked,decimal,delegate,descending,dynamic,event,fixed,foreach,from,group,implicit,in,interface,internal,into,is,lock,object,out,override,orderby,params,partial,readonly,ref,sbyte,sealed,stackalloc,string,select,uint,ulong,unchecked,unsafe,ushort,var"],w=[w,"debugger,eval,export,function,get,null,set,undefined,var,with,Infinity,NaN"],I=[v,"and,as,assert,class,def,del,elif,except,exec,finally,from,global,import,in,is,lambda,nonlocal,not,or,pass,print,raise,try,with,yield,False,True,None"],
J=[v,"alias,and,begin,case,class,def,defined,elsif,end,ensure,false,in,module,next,nil,not,or,redo,rescue,retry,self,super,then,true,undef,unless,until,when,yield,BEGIN,END"],v=[v,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"],K=/^(DIR|FILE|vector|(de|priority_)?queue|list|stack|(const_)?iterator|(multi)?(set|map)|bitset|u?(int|float)\d*)/,N=/\S/,O=u({keywords:[F,H,w,"caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END"+
I,J,v],hashComments:!0,cStyleComments:!0,multiLineStrings:!0,regexLiterals:!0}),A={};k(O,["default-code"]);k(x([],[["pln",/^[^<?]+/],["dec",/^<!\w[^>]*(?:>|$)/],["com",/^<\!--[\S\s]*?(?:--\>|$)/],["lang-",/^<\?([\S\s]+?)(?:\?>|$)/],["lang-",/^<%([\S\s]+?)(?:%>|$)/],["pun",/^(?:<[%?]|[%?]>)/],["lang-",/^<xmp\b[^>]*>([\S\s]+?)<\/xmp\b[^>]*>/i],["lang-js",/^<script\b[^>]*>([\S\s]*?)(<\/script\b[^>]*>)/i],["lang-css",/^<style\b[^>]*>([\S\s]*?)(<\/style\b[^>]*>)/i],["lang-in.tag",/^(<\/?[a-z][^<>]*>)/i]]),
["default-markup","htm","html","mxml","xhtml","xml","xsl"]);k(x([["pln",/^\s+/,q," \t\r\n"],["atv",/^(?:"[^"]*"?|'[^']*'?)/,q,"\"'"]],[["tag",/^^<\/?[a-z](?:[\w-.:]*\w)?|\/?>$/i],["atn",/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^\s"'>]*(?:[^\s"'/>]|\/(?=\s)))/],["pun",/^[/<->]+/],["lang-js",/^on\w+\s*=\s*"([^"]+)"/i],["lang-js",/^on\w+\s*=\s*'([^']+)'/i],["lang-js",/^on\w+\s*=\s*([^\s"'>]+)/i],["lang-css",/^style\s*=\s*"([^"]+)"/i],["lang-css",/^style\s*=\s*'([^']+)'/i],["lang-css",
/^style\s*=\s*([^\s"'>]+)/i]]),["in.tag"]);k(x([],[["atv",/^[\S\s]+/]]),["uq.val"]);k(u({keywords:F,hashComments:!0,cStyleComments:!0,types:K}),["c","cc","cpp","cxx","cyc","m"]);k(u({keywords:"null,true,false"}),["json"]);k(u({keywords:H,hashComments:!0,cStyleComments:!0,verbatimStrings:!0,types:K}),["cs"]);k(u({keywords:G,cStyleComments:!0}),["java"]);k(u({keywords:v,hashComments:!0,multiLineStrings:!0}),["bsh","csh","sh"]);k(u({keywords:I,hashComments:!0,multiLineStrings:!0,tripleQuotedStrings:!0}),
["cv","py"]);k(u({keywords:"caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END",hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["perl","pl","pm"]);k(u({keywords:J,hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["rb"]);k(u({keywords:w,cStyleComments:!0,regexLiterals:!0}),["js"]);k(u({keywords:"all,and,by,catch,class,else,extends,false,finally,for,if,in,is,isnt,loop,new,no,not,null,of,off,on,or,return,super,then,true,try,unless,until,when,while,yes",
hashComments:3,cStyleComments:!0,multilineStrings:!0,tripleQuotedStrings:!0,regexLiterals:!0}),["coffee"]);k(x([],[["str",/^[\S\s]+/]]),["regex"]);window.prettyPrintOne=function(a,m,e){var h=document.createElement("PRE");h.innerHTML=a;e&&D(h,e);E({g:m,i:e,h:h});return h.innerHTML};window.prettyPrint=function(a){function m(){for(var e=window.PR_SHOULD_USE_CONTINUATION?l.now()+250:Infinity;p<h.length&&l.now()<e;p++){var n=h[p],k=n.className;if(k.indexOf("prettyprint")>=0){var k=k.match(g),f,b;if(b=
!k){b=n;for(var o=void 0,c=b.firstChild;c;c=c.nextSibling)var i=c.nodeType,o=i===1?o?b:c:i===3?N.test(c.nodeValue)?b:o:o;b=(f=o===b?void 0:o)&&"CODE"===f.tagName}b&&(k=f.className.match(g));k&&(k=k[1]);b=!1;for(o=n.parentNode;o;o=o.parentNode)if((o.tagName==="pre"||o.tagName==="code"||o.tagName==="xmp")&&o.className&&o.className.indexOf("prettyprint")>=0){b=!0;break}b||((b=(b=n.className.match(/\blinenums\b(?::(\d+))?/))?b[1]&&b[1].length?+b[1]:!0:!1)&&D(n,b),d={g:k,h:n,i:b},E(d))}}p<h.length?setTimeout(m,
250):a&&a()}for(var e=[document.getElementsByTagName("pre"),document.getElementsByTagName("code"),document.getElementsByTagName("xmp")],h=[],k=0;k<e.length;++k)for(var t=0,s=e[k].length;t<s;++t)h.push(e[k][t]);var e=q,l=Date;l.now||(l={now:function(){return+new Date}});var p=0,d,g=/\blang(?:uage)?-([\w.]+)(?!\S)/;m()};window.PR={createSimpleLexer:x,registerLangHandler:k,sourceDecorator:u,PR_ATTRIB_NAME:"atn",PR_ATTRIB_VALUE:"atv",PR_COMMENT:"com",PR_DECLARATION:"dec",PR_KEYWORD:"kwd",PR_LITERAL:"lit",
PR_NOCODE:"nocode",PR_PLAIN:"pln",PR_PUNCTUATION:"pun",PR_SOURCE:"src",PR_STRING:"str",PR_TAG:"tag",PR_TYPE:"typ"}})();

BIN
web/resource/components/kindeditor/plugins/image/images/refresh.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 800 B

1384
web/resource/components/kindeditor/plugins/multiimage/multiimage.js

File diff suppressed because it is too large

27
web/resource/components/kindeditor/plugins/pagebreak/pagebreak.js

@ -0,0 +1,27 @@
/*******************************************************************************
* KindEditor - WYSIWYG HTML Editor for Internet
* Copyright (C) 2006-2011 kindsoft.net
*
* @author Roddy <luolonghao@gmail.com>
* @site http://www.kindsoft.net/
* @licence http://www.kindsoft.net/license.php
*******************************************************************************/
KindEditor.plugin('pagebreak', function(K) {
var self = this;
var name = 'pagebreak';
var pagebreakHtml = K.undef(self.pagebreakHtml, '<hr style="page-break-after: always;" class="ke-pagebreak" />');
self.clickToolbar(name, function() {
var cmd = self.cmd, range = cmd.range;
self.focus();
var tail = self.newlineTag == 'br' || K.WEBKIT ? '' : '<span id="__kindeditor_tail_tag__"></span>';
self.insertHtml(pagebreakHtml + tail);
if (tail !== '') {
var p = K('#__kindeditor_tail_tag__', self.edit.doc);
range.selectNodeContents(p[0]);
p.removeAttr('id');
cmd.select();
}
});
});

41
web/resource/components/kindeditor/plugins/plainpaste/plainpaste.js

@ -0,0 +1,41 @@
/*******************************************************************************
* KindEditor - WYSIWYG HTML Editor for Internet
* Copyright (C) 2006-2011 kindsoft.net
*
* @author Roddy <luolonghao@gmail.com>
* @site http://www.kindsoft.net/
* @licence http://www.kindsoft.net/license.php
*******************************************************************************/
KindEditor.plugin('plainpaste', function(K) {
var self = this, name = 'plainpaste';
self.clickToolbar(name, function() {
var lang = self.lang(name + '.'),
html = '<div style="padding:10px 20px;">' +
'<div style="margin-bottom:10px;">' + lang.comment + '</div>' +
'<textarea class="ke-textarea" style="width:408px;height:260px;"></textarea>' +
'</div>',
dialog = self.createDialog({
name : name,
width : 450,
title : self.lang(name),
body : html,
yesBtn : {
name : self.lang('yes'),
click : function(e) {
var html = textarea.val();
html = K.escape(html);
html = html.replace(/ {2}/g, ' &nbsp;');
if (self.newlineTag == 'p') {
html = html.replace(/^/, '<p>').replace(/$/, '</p>').replace(/\n/g, '</p><p>');
} else {
html = html.replace(/\n/g, '<br />$&');
}
self.insertHtml(html).hideDialog().focus();
}
}
}),
textarea = K('textarea', dialog.div);
textarea[0].focus();
});
});

31
web/resource/components/kindeditor/plugins/preview/preview.js

@ -0,0 +1,31 @@
/*******************************************************************************
* KindEditor - WYSIWYG HTML Editor for Internet
* Copyright (C) 2006-2011 kindsoft.net
*
* @author Roddy <luolonghao@gmail.com>
* @site http://www.kindsoft.net/
* @licence http://www.kindsoft.net/license.php
*******************************************************************************/
KindEditor.plugin('preview', function(K) {
var self = this, name = 'preview', undefined;
self.clickToolbar(name, function() {
var lang = self.lang(name + '.'),
html = '<div style="padding:10px 20px;">' +
'<iframe class="ke-textarea" frameborder="0" style="width:708px;height:400px;"></iframe>' +
'</div>',
dialog = self.createDialog({
name : name,
width : 750,
title : self.lang(name),
body : html
}),
iframe = K('iframe', dialog.div),
doc = K.iframeDoc(iframe);
doc.open();
doc.write(self.fullHtml());
doc.close();
K(doc.body).css('background-color', '#FFF');
iframe[0].contentWindow.focus();
});
});

81
web/resource/components/kindeditor/plugins/quickformat/quickformat.js

@ -0,0 +1,81 @@
/*******************************************************************************
* KindEditor - WYSIWYG HTML Editor for Internet
* Copyright (C) 2006-2011 kindsoft.net
*
* @author Roddy <luolonghao@gmail.com>
* @site http://www.kindsoft.net/
* @licence http://www.kindsoft.net/license.php
*******************************************************************************/
KindEditor.plugin('quickformat', function(K) {
var self = this, name = 'quickformat',
blockMap = K.toMap('blockquote,center,div,h1,h2,h3,h4,h5,h6,p');
function getFirstChild(knode) {
var child = knode.first();
while (child && child.first()) {
child = child.first();
}
return child;
}
self.clickToolbar(name, function() {
self.focus();
var doc = self.edit.doc,
range = self.cmd.range,
child = K(doc.body).first(), next,
nodeList = [], subList = [],
bookmark = range.createBookmark(true);
while(child) {
next = child.next();
var firstChild = getFirstChild(child);
if (!firstChild || firstChild.name != 'img') {
if (blockMap[child.name]) {
child.html(child.html().replace(/^(\s|&nbsp;| )+/ig, ''));
child.css('text-indent', '2em');
} else {
subList.push(child);
}
if (!next || (blockMap[next.name] || blockMap[child.name] && !blockMap[next.name])) {
if (subList.length > 0) {
nodeList.push(subList);
}
subList = [];
}
}
child = next;
}
K.each(nodeList, function(i, subList) {
var wrapper = K('<p style="text-indent:2em;"></p>', doc);
subList[0].before(wrapper);
K.each(subList, function(i, knode) {
wrapper.append(knode);
});
});
range.moveToBookmark(bookmark);
self.addBookmark();
});
});
/**
--------------------------
abcd<br />
1234<br />
to
<p style="text-indent:2em;">
abcd<br />
1234<br />
</p>
--------------------------
&nbsp; abcd<img>1233
<p>1234</p>
to
<p style="text-indent:2em;">abcd<img>1233</p>
<p style="text-indent:2em;">1234</p>
--------------------------
*/

143
web/resource/components/kindeditor/themes/qq/qq.css

@ -0,0 +1,143 @@
/* container */
.ke-container-qq {
display: block;
border: 1px solid #c3c3c3;
background-color: #FFF;
overflow: hidden;
margin: 0;
padding: 0;
}
/* toolbar */
.ke-container-qq .ke-toolbar {
border-bottom: 1px solid #c3c3c3;
background-color: #FFFFFF;
padding: 2px 5px;
text-align: left;
overflow: hidden;
zoom: 1;
}
.ke-toolbar-icon-url {
background-image: url(editor.gif);
width:18px;
*xwidth:20px;
height:18px;
*xheight:20px;
}
.ke-icon-checked{
background-image: url(../default/default.png);
width:16px;
height:16px;
}
.ke-container-qq .ke-icon-bold{
background-position: 4px 1px;
}
.ke-container-qq .ke-icon-italic{
background-position: -27px 1px;
}
.ke-container-qq .ke-icon-italic{
background-position: -28px 1px;
}
.ke-container-qq .ke-icon-underline{
background-position: -60px 1px;
}
.ke-container-qq .ke-icon-fontname{
background-position: -95px 1px;
}
.ke-container-qq .ke-icon-fontsize{
background-position: -128px 1px;
}
.ke-container-qq .ke-icon-forecolor{
background-position: -159px 1px;
}
.ke-container-qq .ke-icon-hilitecolor{
background-position: -190px 1px;
}
.ke-container-qq .ke-icon-plug-align{
background-position: -223px 1px;
}
.plug-align-justifyleft{
background-position: -350px 1px;
}
.plug-align-justifycenter{
background-position: -382px 1px;
}
.plug-align-justifyright{
background-position: -414px 1px;
}
.plug-order-insertorderedlist{
background-position: -446px 1px;
}
.plug-order-insertunorderedlist{
background-position: -477px 1px;
}
.plug-indent-indent{
background-position: -513px 1px;
}
.plug-indent-outdent{
background-position: -545px 1px;
}
.ke-container-qq .ke-icon-plug-order{
background-position: -255px 1px;
}
.ke-container-qq .ke-icon-plug-indent{
background-position: -287px 1px;
}
.ke-container-qq .ke-icon-link{
background-position: -319px 1px;
}
.ke-container-qq .ke-toolbar .ke-outline {
cursor: default;
padding:0px;
border:1px solid #fff;
}
.ke-container-qq .ke-toolbar .ke-on {
border-left:1px solid white;
border-top:1px solid white;
border-right:1px solid gray;
border-bottom:1px solid gray;
background-color: #FFFFFF;
}
.ke-container-qq .ke-toolbar .ke-selected {
border-left:1px solid gray;
border-top:1px solid gray;
border-right:1px solid white;
border-bottom:1px solid white;
background-color: #FFFFFF;
}
.ke-container-qq .ke-toolbar .ke-disabled {
cursor: default;
}
.ke-colorpicker-qq{
background:#fff;
}
/* statusbar */
.ke-container-qq .ke-statusbar {
display:none;
}
/* menu */
.ke-menu-qq {
border:1px solid #a6a6a6;
position:absolute;
background:#fff;
-moz-box-shadow:2px 2px 4px #DDDDDD;
z-index:999;
left:-400px;
top:-386px;
right:218px;
width:130px;
}
.ke-menu-qq .ke-menu-item {
padding:0px;
background:#fff;
}
.ke-menu-qq .ke-menu-item-on {
border:1px solid #000080;background:#FFEEC2;color:#036;
}
.ke-menu-qq .ke-toolbar .ke-selected {
border:1px solid #9a9afb;
}
.ke-menu-qq .ke-menu-item-left{
width:auto;
}

3
web/resource/components/tinymce/langs/readme.md

@ -0,0 +1,3 @@
This is where language files should be placed.
Please DO NOT translate these directly use this service: https://www.transifex.com/projects/p/tinymce/

1
web/resource/components/tinymce/plugins/advlist/plugin.min.js

@ -0,0 +1 @@
tinymce.PluginManager.add("advlist",function(t){function e(t,e){var n=[];return tinymce.each(e.split(/[ ,]/),function(t){n.push({text:t.replace(/\-/g," ").replace(/\b\w/g,function(t){return t.toUpperCase()}),data:"default"==t?"":t})}),n}function n(e,n){var o,l=t.dom,a=t.selection;o=l.getParent(a.getNode(),"ol,ul"),o&&o.nodeName==e&&n!==!1||t.execCommand("UL"==e?"InsertUnorderedList":"InsertOrderedList"),n=n===!1?i[e]:n,i[e]=n,o=l.getParent(a.getNode(),"ol,ul"),o&&(l.setStyle(o,"listStyleType",n),o.removeAttribute("data-mce-style")),t.focus()}function o(e){var n=t.dom.getStyle(t.dom.getParent(t.selection.getNode(),"ol,ul"),"listStyleType")||"";e.control.items().each(function(t){t.active(t.settings.data===n)})}var l,a,i={};l=e("OL",t.getParam("advlist_number_styles","default,lower-alpha,lower-greek,lower-roman,upper-alpha,upper-roman")),a=e("UL",t.getParam("advlist_bullet_styles","default,circle,disc,square")),t.addButton("numlist",{type:"splitbutton",tooltip:"Numbered list",menu:l,onshow:o,onselect:function(t){n("OL",t.control.settings.data)},onclick:function(){n("OL",!1)}}),t.addButton("bullist",{type:"splitbutton",tooltip:"Bullet list",menu:a,onshow:o,onselect:function(t){n("UL",t.control.settings.data)},onclick:function(){n("UL",!1)}})});

1
web/resource/components/tinymce/plugins/anchor/plugin.min.js

@ -0,0 +1 @@
tinymce.PluginManager.add("anchor",function(n){function e(){var e=n.selection.getNode();n.windowManager.open({title:"Anchor",body:{type:"textbox",name:"name",size:40,label:"Name",value:e.name||e.id},onsubmit:function(e){n.execCommand("mceInsertContent",!1,n.dom.createHTML("a",{id:e.data.name}))}})}n.addButton("anchor",{icon:"anchor",tooltip:"Anchor",onclick:e,stateSelector:"a:not([href])"}),n.addMenuItem("anchor",{icon:"anchor",text:"Anchor",context:"insert",onclick:e})});

1
web/resource/components/tinymce/plugins/autolink/plugin.min.js

@ -0,0 +1 @@
tinymce.PluginManager.add("autolink",function(t){function n(t){o(t,-1,"(",!0)}function e(t){o(t,0,"",!0)}function i(t){o(t,-1,"",!1)}function o(t,n,e){function i(t,n){if(0>n&&(n=0),3==t.nodeType){var e=t.data.length;n>e&&(n=e)}return n}function o(t,n){f.setStart(t,i(t,n))}function r(t,n){f.setEnd(t,i(t,n))}var f,d,a,s,c,l,u,g,h;if(f=t.selection.getRng(!0).cloneRange(),f.startOffset<5){if(g=f.endContainer.previousSibling,!g){if(!f.endContainer.firstChild||!f.endContainer.firstChild.nextSibling)return;g=f.endContainer.firstChild.nextSibling}if(h=g.length,o(g,h),r(g,h),f.endOffset<5)return;d=f.endOffset,s=g}else{if(s=f.endContainer,3!=s.nodeType&&s.firstChild){for(;3!=s.nodeType&&s.firstChild;)s=s.firstChild;3==s.nodeType&&(o(s,0),r(s,s.nodeValue.length))}d=1==f.endOffset?2:f.endOffset-1-n}a=d;do o(s,d>=2?d-2:0),r(s,d>=1?d-1:0),d-=1;while(" "!=f.toString()&&""!==f.toString()&&160!=f.toString().charCodeAt(0)&&d-2>=0&&f.toString()!=e);f.toString()==e||160==f.toString().charCodeAt(0)?(o(s,d),r(s,a),d+=1):0===f.startOffset?(o(s,0),r(s,a)):(o(s,d),r(s,a)),l=f.toString(),"."==l.charAt(l.length-1)&&r(s,a-1),l=f.toString(),u=l.match(/^(https?:\/\/|ssh:\/\/|ftp:\/\/|file:\/|www\.|(?:mailto:)?[A-Z0-9._%+\-]+@)(.+)$/i),u&&("www."==u[1]?u[1]="http://www.":/@$/.test(u[1])&&!/^mailto:/.test(u[1])&&(u[1]="mailto:"+u[1]),c=t.selection.getBookmark(),t.selection.setRng(f),t.execCommand("createlink",!1,u[1]+u[2]),t.selection.moveToBookmark(c),t.nodeChanged())}var r;return t.on("keydown",function(n){return 13==n.keyCode?i(t):void 0}),tinymce.Env.ie?void t.on("focus",function(){if(!r){r=!0;try{t.execCommand("AutoUrlDetect",!1,!0)}catch(n){}}}):(t.on("keypress",function(e){return 41==e.keyCode?n(t):void 0}),void t.on("keyup",function(n){return 32==n.keyCode?e(t):void 0}))});

1
web/resource/components/tinymce/plugins/autoresize/plugin.min.js

@ -0,0 +1 @@
tinymce.PluginManager.add("autoresize",function(e){function t(){return e.plugins.fullscreen&&e.plugins.fullscreen.isFullscreen()}function i(n){var s,r,g,u,l,m,h,d,f=tinymce.DOM;if(r=e.getDoc()){if(g=r.body,u=r.documentElement,l=o.autoresize_min_height,!g||n&&"setcontent"===n.type&&n.initial||t())return void(g&&u&&(g.style.overflowY="auto",u.style.overflowY="auto"));h=e.dom.getStyle(g,"margin-top",!0),d=e.dom.getStyle(g,"margin-bottom",!0),m=g.offsetHeight+parseInt(h,10)+parseInt(d,10),(isNaN(m)||0>=m)&&(m=tinymce.Env.ie?g.scrollHeight:tinymce.Env.webkit&&0===g.clientHeight?0:g.offsetHeight),m>o.autoresize_min_height&&(l=m),o.autoresize_max_height&&m>o.autoresize_max_height?(l=o.autoresize_max_height,g.style.overflowY="auto",u.style.overflowY="auto"):(g.style.overflowY="hidden",u.style.overflowY="hidden",g.scrollTop=0),l!==a&&(s=l-a,f.setStyle(f.get(e.id+"_ifr"),"height",l+"px"),a=l,tinymce.isWebKit&&0>s&&i(n))}}function n(e,t,o){setTimeout(function(){i({}),e--?n(e,t,o):o&&o()},t)}var o=e.settings,a=0;e.settings.inline||(o.autoresize_min_height=parseInt(e.getParam("autoresize_min_height",e.getElement().offsetHeight),10),o.autoresize_max_height=parseInt(e.getParam("autoresize_max_height",0),10),e.on("init",function(){var t=e.getParam("autoresize_overflow_padding",1);e.dom.setStyles(e.getBody(),{paddingBottom:e.getParam("autoresize_bottom_margin",50),paddingLeft:t,paddingRight:t})}),e.on("nodechange setcontent keyup FullscreenStateChanged",i),e.getParam("autoresize_on_init",!0)&&e.on("init",function(){n(20,100,function(){n(5,1e3)})}),e.addCommand("mceAutoResize",i))});

1
web/resource/components/tinymce/plugins/autosave/plugin.min.js

@ -0,0 +1 @@
tinymce.PluginManager.add("autosave",function(e){function t(e,t){var n={s:1e3,m:6e4};return e=/^(\d+)([ms]?)$/.exec(""+(e||t)),(e[2]?n[e[2]]:1)*parseInt(e,10)}function n(){var e=parseInt(l.getItem(d+"time"),10)||0;return(new Date).getTime()-e>v.autosave_retention?(a(!1),!1):!0}function a(t){l.removeItem(d+"draft"),l.removeItem(d+"time"),t!==!1&&e.fire("RemoveDraft")}function r(){!c()&&e.isDirty()&&(l.setItem(d+"draft",e.getContent({format:"raw",no_events:!0})),l.setItem(d+"time",(new Date).getTime()),e.fire("StoreDraft"))}function o(){n()&&(e.setContent(l.getItem(d+"draft"),{format:"raw"}),e.fire("RestoreDraft"))}function i(){m||(setInterval(function(){e.removed||r()},v.autosave_interval),m=!0)}function s(){var t=this;t.disabled(!n()),e.on("StoreDraft RestoreDraft RemoveDraft",function(){t.disabled(!n())}),i()}function u(){e.undoManager.beforeChange(),o(),a(),e.undoManager.add()}function f(){var e;return tinymce.each(tinymce.editors,function(t){t.plugins.autosave&&t.plugins.autosave.storeDraft(),!e&&t.isDirty()&&t.getParam("autosave_ask_before_unload",!0)&&(e=t.translate("You have unsaved changes are you sure you want to navigate away?"))}),e}function c(t){var n=e.settings.forced_root_block;return t=tinymce.trim("undefined"==typeof t?e.getBody().innerHTML:t),""===t||new RegExp("^<"+n+"[^>]*>(( |&nbsp;|[ ]|<br[^>]*>)+?|)</"+n+">|<br>$","i").test(t)}var d,m,v=e.settings,l=tinymce.util.LocalStorage;d=v.autosave_prefix||"tinymce-autosave-{path}{query}-{id}-",d=d.replace(/\{path\}/g,document.location.pathname),d=d.replace(/\{query\}/g,document.location.search),d=d.replace(/\{id\}/g,e.id),v.autosave_interval=t(v.autosave_interval,"30s"),v.autosave_retention=t(v.autosave_retention,"20m"),e.addButton("restoredraft",{title:"Restore last draft",onclick:u,onPostRender:s}),e.addMenuItem("restoredraft",{text:"Restore last draft",onclick:u,onPostRender:s,context:"file"}),e.settings.autosave_restore_when_empty!==!1&&(e.on("init",function(){n()&&c()&&o()}),e.on("saveContent",function(){a()})),window.onbeforeunload=f,this.hasDraft=n,this.storeDraft=r,this.restoreDraft=o,this.removeDraft=a,this.isEmpty=c});

1
web/resource/components/tinymce/plugins/bbcode/plugin.min.js

@ -0,0 +1 @@
!function(){tinymce.create("tinymce.plugins.BBCodePlugin",{init:function(o){var e=this,t=o.getParam("bbcode_dialect","punbb").toLowerCase();o.on("beforeSetContent",function(o){o.content=e["_"+t+"_bbcode2html"](o.content)}),o.on("postProcess",function(o){o.set&&(o.content=e["_"+t+"_bbcode2html"](o.content)),o.get&&(o.content=e["_"+t+"_html2bbcode"](o.content))})},getInfo:function(){return{longname:"BBCode Plugin",author:"Moxiecode Systems AB",authorurl:"http://www.tinymce.com",infourl:"http://www.tinymce.com/wiki.php/Plugin:bbcode"}},_punbb_html2bbcode:function(o){function e(e,t){o=o.replace(e,t)}return o=tinymce.trim(o),e(/<a.*?href=\"(.*?)\".*?>(.*?)<\/a>/gi,"[url=$1]$2[/url]"),e(/<font.*?color=\"(.*?)\".*?class=\"codeStyle\".*?>(.*?)<\/font>/gi,"[code][color=$1]$2[/color][/code]"),e(/<font.*?color=\"(.*?)\".*?class=\"quoteStyle\".*?>(.*?)<\/font>/gi,"[quote][color=$1]$2[/color][/quote]"),e(/<font.*?class=\"codeStyle\".*?color=\"(.*?)\".*?>(.*?)<\/font>/gi,"[code][color=$1]$2[/color][/code]"),e(/<font.*?class=\"quoteStyle\".*?color=\"(.*?)\".*?>(.*?)<\/font>/gi,"[quote][color=$1]$2[/color][/quote]"),e(/<span style=\"color: ?(.*?);\">(.*?)<\/span>/gi,"[color=$1]$2[/color]"),e(/<font.*?color=\"(.*?)\".*?>(.*?)<\/font>/gi,"[color=$1]$2[/color]"),e(/<span style=\"font-size:(.*?);\">(.*?)<\/span>/gi,"[size=$1]$2[/size]"),e(/<font>(.*?)<\/font>/gi,"$1"),e(/<img.*?src=\"(.*?)\".*?\/>/gi,"[img]$1[/img]"),e(/<span class=\"codeStyle\">(.*?)<\/span>/gi,"[code]$1[/code]"),e(/<span class=\"quoteStyle\">(.*?)<\/span>/gi,"[quote]$1[/quote]"),e(/<strong class=\"codeStyle\">(.*?)<\/strong>/gi,"[code][b]$1[/b][/code]"),e(/<strong class=\"quoteStyle\">(.*?)<\/strong>/gi,"[quote][b]$1[/b][/quote]"),e(/<em class=\"codeStyle\">(.*?)<\/em>/gi,"[code][i]$1[/i][/code]"),e(/<em class=\"quoteStyle\">(.*?)<\/em>/gi,"[quote][i]$1[/i][/quote]"),e(/<u class=\"codeStyle\">(.*?)<\/u>/gi,"[code][u]$1[/u][/code]"),e(/<u class=\"quoteStyle\">(.*?)<\/u>/gi,"[quote][u]$1[/u][/quote]"),e(/<\/(strong|b)>/gi,"[/b]"),e(/<(strong|b)>/gi,"[b]"),e(/<\/(em|i)>/gi,"[/i]"),e(/<(em|i)>/gi,"[i]"),e(/<\/u>/gi,"[/u]"),e(/<span style=\"text-decoration: ?underline;\">(.*?)<\/span>/gi,"[u]$1[/u]"),e(/<u>/gi,"[u]"),e(/<blockquote[^>]*>/gi,"[quote]"),e(/<\/blockquote>/gi,"[/quote]"),e(/<br \/>/gi,"\n"),e(/<br\/>/gi,"\n"),e(/<br>/gi,"\n"),e(/<p>/gi,""),e(/<\/p>/gi,"\n"),e(/&nbsp;|\u00a0/gi," "),e(/&quot;/gi,'"'),e(/&lt;/gi,"<"),e(/&gt;/gi,">"),e(/&amp;/gi,"&"),o},_punbb_bbcode2html:function(o){function e(e,t){o=o.replace(e,t)}return o=tinymce.trim(o),e(/\n/gi,"<br />"),e(/\[b\]/gi,"<strong>"),e(/\[\/b\]/gi,"</strong>"),e(/\[i\]/gi,"<em>"),e(/\[\/i\]/gi,"</em>"),e(/\[u\]/gi,"<u>"),e(/\[\/u\]/gi,"</u>"),e(/\[url=([^\]]+)\](.*?)\[\/url\]/gi,'<a href="$1">$2</a>'),e(/\[url\](.*?)\[\/url\]/gi,'<a href="$1">$1</a>'),e(/\[img\](.*?)\[\/img\]/gi,'<img src="$1" />'),e(/\[color=(.*?)\](.*?)\[\/color\]/gi,'<font color="$1">$2</font>'),e(/\[code\](.*?)\[\/code\]/gi,'<span class="codeStyle">$1</span>&nbsp;'),e(/\[quote.*?\](.*?)\[\/quote\]/gi,'<span class="quoteStyle">$1</span>&nbsp;'),o}}),tinymce.PluginManager.add("bbcode",tinymce.plugins.BBCodePlugin)}();

1
web/resource/components/tinymce/plugins/charmap/plugin.min.js

File diff suppressed because one or more lines are too long

1
web/resource/components/tinymce/plugins/code/plugin.min.js

@ -0,0 +1 @@
tinymce.PluginManager.add("code",function(e){function o(){e.windowManager.open({title:"Source code",body:{type:"textbox",name:"code",multiline:!0,minWidth:e.getParam("code_dialog_width",600),minHeight:e.getParam("code_dialog_height",Math.min(tinymce.DOM.getViewPort().h-200,500)),value:e.getContent({source_view:!0}),spellcheck:!1,style:"direction: ltr; text-align: left"},onSubmit:function(o){e.focus(),e.undoManager.transact(function(){e.setContent(o.data.code)}),e.selection.setCursorLocation(),e.nodeChanged()}})}e.addCommand("mceCodeEditor",o),e.addButton("code",{icon:"code",tooltip:"Source code",onclick:o}),e.addMenuItem("code",{icon:"code",text:"Source code",context:"tools",onclick:o})});

1
web/resource/components/tinymce/plugins/contextmenu/plugin.min.js

@ -0,0 +1 @@
tinymce.PluginManager.add("contextmenu",function(e){var n,t=e.settings.contextmenu_never_use_native;e.on("contextmenu",function(i){var o;if(!i.ctrlKey||t){if(i.preventDefault(),o=e.settings.contextmenu||"link image multiimage inserttable | cell row column deletetable",n)n.show();else{var c=[];tinymce.each(o.split(/[ ,]/),function(n){var t=e.menuItems[n];"|"==n&&(t={text:n}),t&&(t.shortcut="",c.push(t))});for(var a=0;a<c.length;a++)"|"==c[a].text&&(0===a||a==c.length-1)&&c.splice(a,1);n=new tinymce.ui.Menu({items:c,context:"contextmenu"}).addClass("contextmenu").renderTo(),e.on("remove",function(){n.remove(),n=null})}var l={x:i.pageX,y:i.pageY};e.inline||(l=tinymce.DOM.getPos(e.getContentAreaContainer()),l.x+=i.clientX,l.y+=i.clientY),n.moveTo(l.x,l.y)}})});

1
web/resource/components/tinymce/plugins/directionality/plugin.min.js

@ -0,0 +1 @@
tinymce.PluginManager.add("directionality",function(t){function e(e){var i,n=t.dom,r=t.selection.getSelectedBlocks();r.length&&(i=n.getAttrib(r[0],"dir"),tinymce.each(r,function(t){n.getParent(t.parentNode,"*[dir='"+e+"']",n.getRoot())||(i!=e?n.setAttrib(t,"dir",e):n.setAttrib(t,"dir",null))}),t.nodeChanged())}function i(t){var e=[];return tinymce.each("h1 h2 h3 h4 h5 h6 div p".split(" "),function(i){e.push(i+"[dir="+t+"]")}),e.join(",")}t.addCommand("mceDirectionLTR",function(){e("ltr")}),t.addCommand("mceDirectionRTL",function(){e("rtl")}),t.addButton("ltr",{title:"Left to right",cmd:"mceDirectionLTR",stateSelector:i("ltr")}),t.addButton("rtl",{title:"Right to left",cmd:"mceDirectionRTL",stateSelector:i("rtl")})});

1
web/resource/components/tinymce/plugins/emoticons/plugin.min.js

@ -0,0 +1 @@
tinymce.PluginManager.add("emoticons",function(t,e){function a(){var t;return t='<table role="list" class="mce-grid">',tinymce.each(i,function(a){t+="<tr>",tinymce.each(a,function(a){var i=e+"/img/smiley-"+a+".gif";t+='<td><a href="#" data-mce-url="'+i+'" data-mce-alt="'+a+'" tabindex="-1" role="option" aria-label="'+a+'"><img src="'+i+'" style="width: 18px; height: 18px" role="presentation" /></a></td>'}),t+="</tr>"}),t+="</table>"}var i=[["cool","cry","embarassed","foot-in-mouth"],["frown","innocent","kiss","laughing"],["money-mouth","sealed","smile","surprised"],["tongue-out","undecided","wink","yell"]];t.addButton("emoticons",{type:"panelbutton",panel:{role:"application",autohide:!0,html:a,onclick:function(e){var a=t.dom.getParent(e.target,"a");a&&(t.insertContent('<img src="'+a.getAttribute("data-mce-url")+'" alt="'+a.getAttribute("data-mce-alt")+'" />'),this.hide())}},tooltip:"Emoticons"})});

1
web/resource/components/tinymce/plugins/example/plugin.min.js

@ -0,0 +1 @@
tinymce.PluginManager.add("example",function(t,e){t.addButton("example",{text:"My button",icon:!1,onclick:function(){t.windowManager.open({title:"Example plugin",body:[{type:"textbox",name:"title",label:"Title"}],onsubmit:function(e){t.insertContent("Title: "+e.data.title)}})}}),t.addMenuItem("example",{text:"Example plugin",context:"tools",onclick:function(){t.windowManager.open({title:"TinyMCE site",url:e+"/dialog.html",width:600,height:400,buttons:[{text:"Insert",onclick:function(){var e=t.windowManager.getWindows()[0];t.insertContent(e.getContentWindow().document.getElementById("content").value),e.close()}},{text:"Close",onclick:"close"}]})}})});

1
web/resource/components/tinymce/plugins/example_dependency/plugin.min.js

@ -0,0 +1 @@
tinymce.PluginManager.add("example_dependency",function(){},["example"]);

1
web/resource/components/tinymce/plugins/fullpage/plugin.min.js

File diff suppressed because one or more lines are too long

1
web/resource/components/tinymce/plugins/fullscreen/plugin.min.js

@ -0,0 +1 @@
tinymce.PluginManager.add("fullscreen",function(e){function t(){var e,t,n=window,i=document,l=i.body;return l.offsetWidth&&(e=l.offsetWidth,t=l.offsetHeight),n.innerWidth&&n.innerHeight&&(e=n.innerWidth,t=n.innerHeight),{w:e,h:t}}function n(){function n(){d.setStyle(a,"height",t().h-(h.clientHeight-a.clientHeight))}var u,h,a,f,m=document.body,g=document.documentElement;s=!s,h=e.getContainer(),u=h.style,a=e.getContentAreaContainer().firstChild,f=a.style,s?(i=f.width,l=f.height,f.width=f.height="100%",c=u.width,o=u.height,u.width=u.height="",d.addClass(m,"mce-fullscreen"),d.addClass(g,"mce-fullscreen"),d.addClass(h,"mce-fullscreen"),d.bind(window,"resize",n),n(),r=n):(f.width=i,f.height=l,c&&(u.width=c),o&&(u.height=o),d.removeClass(m,"mce-fullscreen"),d.removeClass(g,"mce-fullscreen"),d.removeClass(h,"mce-fullscreen"),d.unbind(window,"resize",r)),e.fire("FullscreenStateChanged",{state:s})}var i,l,r,c,o,s=!1,d=tinymce.DOM;return e.settings.inline?void 0:(e.on("init",function(){e.addShortcut("Ctrl+Alt+F","",n)}),e.on("remove",function(){r&&d.unbind(window,"resize",r)}),e.addCommand("mceFullScreen",n),e.addMenuItem("fullscreen",{text:"Fullscreen",shortcut:"Ctrl+Alt+F",selectable:!0,onClick:n,onPostRender:function(){var t=this;e.on("FullscreenStateChanged",function(e){t.active(e.state)})},context:"view"}),e.addButton("fullscreen",{tooltip:"Fullscreen",shortcut:"Ctrl+Alt+F",onClick:n,onPostRender:function(){var t=this;e.on("FullscreenStateChanged",function(e){t.active(e.state)})}}),{isFullscreen:function(){return s}})});

1
web/resource/components/tinymce/plugins/hr/plugin.min.js

@ -0,0 +1 @@
tinymce.PluginManager.add("hr",function(n){n.addCommand("InsertHorizontalRule",function(){n.execCommand("mceInsertContent",!1,"<hr />")}),n.addButton("hr",{icon:"hr",tooltip:"Horizontal line",cmd:"InsertHorizontalRule"}),n.addMenuItem("hr",{icon:"hr",text:"Horizontal line",cmd:"InsertHorizontalRule",context:"insert"})});

48
web/resource/components/tinymce/plugins/image/plugin.min.js

@ -0,0 +1,48 @@
tinymce.PluginManager.add('image', function(editor) {
function handleImageDialog() {
var dom = editor.dom;
var imgElm = editor.selection.getNode();
require(['util'], function(u){
var v = '';
if (imgElm && imgElm.tagName.toLowerCase() == 'img') {
v = imgElm.src;
}
u.image(v, function(val){
data = {
src: val.url,
alt: val.filename,
title: val.filename
};
if (!data["class"]) {
delete data["class"];
}
if (!imgElm || imgElm.tagName.toLowerCase() != 'img') {
data.id = '__mcenew';
editor.focus();
editor.selection.setContent(dom.createHTML('img', data));
imgElm = dom.get('__mcenew');
dom.setAttrib(imgElm, 'id', null);
} else {
dom.setAttribs(imgElm, data);
}
},'', {direct: true, multi : false} );
});
}
editor.addButton('image', {
icon: 'image',
tooltip: 'Insert/edit image',
onclick: handleImageDialog,
stateSelector: 'img:not([data-mce-object],[data-mce-placeholder])'
});
editor.addMenuItem('image', {
icon: 'image',
text: 'Insert image',
onclick: handleImageDialog,
context: 'insert',
prependToContext: true
});
});

1
web/resource/components/tinymce/plugins/importcss/plugin.min.js

@ -0,0 +1 @@
tinymce.PluginManager.add("importcss",function(t){function e(t){return"string"==typeof t?function(e){return-1!==e.indexOf(t)}:t instanceof RegExp?function(e){return t.test(e)}:t}function n(e,n){function i(t,e){var c,o=t.href;if(o&&n(o,e)){s(t.imports,function(t){i(t,!0)});try{c=t.cssRules||t.rules}catch(a){}s(c,function(t){t.styleSheet?i(t.styleSheet,!0):t.selectorText&&s(t.selectorText.split(","),function(t){r.push(tinymce.trim(t))})})}}var r=[],c={};s(t.contentCSS,function(t){c[t]=!0}),n||(n=function(t,e){return e||c[t]});try{s(e.styleSheets,function(t){i(t)})}catch(o){}return r}function i(e){var n,i=/^(?:([a-z0-9\-_]+))?(\.[a-z0-9_\-\.]+)$/i.exec(e);if(i){var r=i[1],s=i[2].substr(1).split(".").join(" "),c=tinymce.makeMap("a,img");return i[1]?(n={title:e},t.schema.getTextBlockElements()[r]?n.block=r:t.schema.getBlockElements()[r]||c[r.toLowerCase()]?n.selector=r:n.inline=r):i[2]&&(n={inline:"span",title:e.substr(1),classes:s}),t.settings.importcss_merge_classes!==!1?n.classes=s:n.attributes={"class":s},n}}var r=this,s=tinymce.each;t.on("renderFormatsMenu",function(c){var o=t.settings,a={},l=o.importcss_selector_converter||i,f=e(o.importcss_selector_filter),m=c.control;t.settings.importcss_append||m.items().remove();var u=[];tinymce.each(o.importcss_groups,function(t){t=tinymce.extend({},t),t.filter=e(t.filter),u.push(t)}),s(n(c.doc||t.getDoc(),e(o.importcss_file_filter)),function(e){if(-1===e.indexOf(".mce-")&&!a[e]&&(!f||f(e))){var n,i=l.call(r,e);if(i){var s=i.name||tinymce.DOM.uniqueId();if(u)for(var c=0;c<u.length;c++)if(!u[c].filter||u[c].filter(e)){u[c].item||(u[c].item={text:u[c].title,menu:[]}),n=u[c].item.menu;break}t.formatter.register(s,i);var o=tinymce.extend({},m.settings.itemDefaults,{text:i.title,format:s});n?n.push(o):m.add(o)}a[e]=!0}}),s(u,function(t){m.add(t.item)}),c.control.renderNew()}),r.convertSelectorToFormat=i});

1
web/resource/components/tinymce/plugins/insertdatetime/plugin.min.js

@ -0,0 +1 @@
tinymce.PluginManager.add("insertdatetime",function(e){function t(t,a){function n(e,t){if(e=""+e,e.length<t)for(var a=0;a<t-e.length;a++)e="0"+e;return e}return a=a||new Date,t=t.replace("%D","%m/%d/%Y"),t=t.replace("%r","%I:%M:%S %p"),t=t.replace("%Y",""+a.getFullYear()),t=t.replace("%y",""+a.getYear()),t=t.replace("%m",n(a.getMonth()+1,2)),t=t.replace("%d",n(a.getDate(),2)),t=t.replace("%H",""+n(a.getHours(),2)),t=t.replace("%M",""+n(a.getMinutes(),2)),t=t.replace("%S",""+n(a.getSeconds(),2)),t=t.replace("%I",""+((a.getHours()+11)%12+1)),t=t.replace("%p",""+(a.getHours()<12?"AM":"PM")),t=t.replace("%B",""+e.translate(m[a.getMonth()])),t=t.replace("%b",""+e.translate(c[a.getMonth()])),t=t.replace("%A",""+e.translate(d[a.getDay()])),t=t.replace("%a",""+e.translate(i[a.getDay()])),t=t.replace("%%","%")}function a(a){var n=t(a);if(e.settings.insertdatetime_element){var r;r=t(/%[HMSIp]/.test(a)?"%Y-%m-%dT%H:%M":"%Y-%m-%d"),n='<time datetime="'+r+'">'+n+"</time>";var i=e.dom.getParent(e.selection.getStart(),"time");if(i)return void e.dom.setOuterHTML(i,n)}e.insertContent(n)}var n,r,i="Sun Mon Tue Wed Thu Fri Sat Sun".split(" "),d="Sunday Monday Tuesday Wednesday Thursday Friday Saturday Sunday".split(" "),c="Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec".split(" "),m="January February March April May June July August September October November December".split(" "),u=[];e.addCommand("mceInsertDate",function(){a(e.getParam("insertdatetime_dateformat",e.translate("%Y-%m-%d")))}),e.addCommand("mceInsertTime",function(){a(e.getParam("insertdatetime_timeformat",e.translate("%H:%M:%S")))}),e.addButton("insertdatetime",{type:"splitbutton",title:"Insert date/time",onclick:function(){a(n||r)},menu:u}),tinymce.each(e.settings.insertdatetime_formats||["%H:%M:%S","%Y-%m-%d","%I:%M:%S %p","%D"],function(e){r||(r=e),u.push({text:t(e),onclick:function(){n=e,a(e)}})}),e.addMenuItem("insertdatetime",{icon:"date",text:"Insert date/time",menu:u,context:"insert"})});

1
web/resource/components/tinymce/plugins/layer/plugin.min.js

@ -0,0 +1 @@
tinymce.PluginManager.add("layer",function(e){function t(e){do if(e.className&&-1!=e.className.indexOf("mceItemLayer"))return e;while(e=e.parentNode)}function o(t){var o=e.dom;tinymce.each(o.select("div,p",t),function(e){/^(absolute|relative|fixed)$/i.test(e.style.position)&&(e.hasVisual?o.addClass(e,"mceItemVisualAid"):o.removeClass(e,"mceItemVisualAid"),o.addClass(e,"mceItemLayer"))})}function d(o){var d,n,a=[],i=t(e.selection.getNode()),s=-1,l=-1;for(n=[],tinymce.walk(e.getBody(),function(e){1==e.nodeType&&/^(absolute|relative|static)$/i.test(e.style.position)&&n.push(e)},"childNodes"),d=0;d<n.length;d++)a[d]=n[d].style.zIndex?parseInt(n[d].style.zIndex,10):0,0>s&&n[d]==i&&(s=d);if(0>o){for(d=0;d<a.length;d++)if(a[d]<a[s]){l=d;break}l>-1?(n[s].style.zIndex=a[l],n[l].style.zIndex=a[s]):a[s]>0&&(n[s].style.zIndex=a[s]-1)}else{for(d=0;d<a.length;d++)if(a[d]>a[s]){l=d;break}l>-1?(n[s].style.zIndex=a[l],n[l].style.zIndex=a[s]):n[s].style.zIndex=a[s]+1}e.execCommand("mceRepaint")}function n(){var t=e.dom,o=t.getPos(t.getParent(e.selection.getNode(),"*")),d=e.getBody();e.dom.add(d,"div",{style:{position:"absolute",left:o.x,top:o.y>20?o.y:20,width:100,height:100},"class":"mceItemVisualAid mceItemLayer"},e.selection.getContent()||e.getLang("layer.content")),tinymce.Env.ie&&t.setHTML(d,d.innerHTML)}function a(){var o=t(e.selection.getNode());o||(o=e.dom.getParent(e.selection.getNode(),"DIV,P,IMG")),o&&("absolute"==o.style.position.toLowerCase()?(e.dom.setStyles(o,{position:"",left:"",top:"",width:"",height:""}),e.dom.removeClass(o,"mceItemVisualAid"),e.dom.removeClass(o,"mceItemLayer")):(o.style.left||(o.style.left="20px"),o.style.top||(o.style.top="20px"),o.style.width||(o.style.width=o.width?o.width+"px":"100px"),o.style.height||(o.style.height=o.height?o.height+"px":"100px"),o.style.position="absolute",e.dom.setAttrib(o,"data-mce-style",""),e.addVisual(e.getBody())),e.execCommand("mceRepaint"),e.nodeChanged())}e.addCommand("mceInsertLayer",n),e.addCommand("mceMoveForward",function(){d(1)}),e.addCommand("mceMoveBackward",function(){d(-1)}),e.addCommand("mceMakeAbsolute",function(){a()}),e.addButton("moveforward",{title:"layer.forward_desc",cmd:"mceMoveForward"}),e.addButton("movebackward",{title:"layer.backward_desc",cmd:"mceMoveBackward"}),e.addButton("absolute",{title:"layer.absolute_desc",cmd:"mceMakeAbsolute"}),e.addButton("insertlayer",{title:"layer.insertlayer_desc",cmd:"mceInsertLayer"}),e.on("init",function(){tinymce.Env.ie&&e.getDoc().execCommand("2D-Position",!1,!0)}),e.on("mouseup",function(o){var d=t(o.target);d&&e.dom.setAttrib(d,"data-mce-style","")}),e.on("mousedown",function(o){var d,n=o.target,a=e.getDoc();tinymce.Env.gecko&&(t(n)?"on"!==a.designMode&&(a.designMode="on",n=a.body,d=n.parentNode,d.removeChild(n),d.appendChild(n)):"on"==a.designMode&&(a.designMode="off"))}),e.on("NodeChange",o)});

1
web/resource/components/tinymce/plugins/legacyoutput/plugin.min.js

@ -0,0 +1 @@
!function(e){e.on("AddEditor",function(e){e.editor.settings.inline_styles=!1}),e.PluginManager.add("legacyoutput",function(t){t.on("init",function(){var i="p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li,table,img",n=e.explode(t.settings.font_size_style_values),l=t.schema;t.formatter.register({alignleft:{selector:i,attributes:{align:"left"}},aligncenter:{selector:i,attributes:{align:"center"}},alignright:{selector:i,attributes:{align:"right"}},alignjustify:{selector:i,attributes:{align:"justify"}},bold:[{inline:"b",remove:"all"},{inline:"strong",remove:"all"},{inline:"span",styles:{fontWeight:"bold"}}],italic:[{inline:"i",remove:"all"},{inline:"em",remove:"all"},{inline:"span",styles:{fontStyle:"italic"}}],underline:[{inline:"u",remove:"all"},{inline:"span",styles:{textDecoration:"underline"},exact:!0}],strikethrough:[{inline:"strike",remove:"all"},{inline:"span",styles:{textDecoration:"line-through"},exact:!0}],fontname:{inline:"font",attributes:{face:"%value"}},fontsize:{inline:"font",attributes:{size:function(t){return e.inArray(n,t.value)+1}}},forecolor:{inline:"font",attributes:{color:"%value"}},hilitecolor:{inline:"font",styles:{backgroundColor:"%value"}}}),e.each("b,i,u,strike".split(","),function(e){l.addValidElements(e+"[*]")}),l.getElementRule("font")||l.addValidElements("font[face|size|color|style]"),e.each(i.split(","),function(e){var t=l.getElementRule(e);t&&(t.attributes.align||(t.attributes.align={},t.attributesOrder.push("align")))})})})}(tinymce);

1
web/resource/components/tinymce/plugins/link/plugin.min.js

@ -0,0 +1 @@
tinymce.PluginManager.add("link",function(t){function e(e){return function(){var n=t.settings.link_list;"string"==typeof n?tinymce.util.XHR.send({url:n,success:function(t){e(tinymce.util.JSON.parse(t))}}):"function"==typeof n?n(e):e(n)}}function n(e){function n(t){var e=d.find("#text");(!e.value()||t.lastControl&&e.value()==t.lastControl.text())&&e.value(t.control.text()),d.find("#href").value(t.control.value())}function l(){function n(e,l){return l=l||[],tinymce.each(e,function(e){var i={text:e.text||e.title};e.menu?i.menu=n(e.menu):i.value=t.convertURL(e.value||e.url,"href"),l.push(i)}),l}return n(e,[{text:"None",value:""}])}function i(e){return tinymce.each(e,function(e){e.textStyle=function(){return t.formatter.getCssText({inline:"a",classes:[e.value]})}}),e}function a(e,n,l){var i,a=[];return tinymce.each(t.settings[e]||l,function(t){var e={text:t.text||t.title,value:t.value};a.push(e),(b[n]===t.value||!i&&t.selected)&&(i=e)}),i&&!b[n]&&(b[n]=i.value,i.selected=!0),a}function r(e){var l=[];return tinymce.each(t.dom.select("a:not([href])"),function(t){var n=t.name||t.id;n&&l.push({text:n,value:"#"+n,selected:-1!=e.indexOf("#"+n)})}),l.length?(l.unshift({text:"None",value:""}),{name:"anchor",type:"listbox",label:"Anchors",values:l,onselect:n}):void 0}function o(){h&&h.value(t.convertURL(this.value(),"href")),!f&&0===b.text.length&&x&&this.parent().parent().find("#text")[0].value(this.value())}function s(t){var e=k.getContent();if(/</.test(e)&&(!/^<a [^>]+>[^<]+<\/a>$/.test(e)||-1==e.indexOf("href=")))return!1;if(t){var n,l=t.childNodes;if(0===l.length)return!1;for(n=l.length-1;n>=0;n--)if(3!=l[n].nodeType)return!1}return!0}var u,c,f,d,x,v,h,g,m,p,y,b={},k=t.selection,w=t.dom;u=k.getNode(),c=w.getParent(u,"a[href]"),x=s(),b.text=f=c?c.innerText||c.textContent:k.getContent({format:"text"}),b.href=c?w.getAttrib(c,"href"):"",b.target=c?w.getAttrib(c,"target"):t.settings.default_link_target||null,b.rel=c?w.getAttrib(c,"rel"):null,b["class"]=c?w.getAttrib(c,"class"):null,b.title=c?w.getAttrib(c,"title"):"",x&&(v={name:"text",type:"textbox",size:40,label:"Text to display",onchange:function(){b.text=this.value()}}),e&&(h={type:"listbox",label:"Link list",values:l(),onselect:n,value:t.convertURL(b.href,"href"),onPostRender:function(){h=this}}),t.settings.target_list!==!1&&(m={name:"target",type:"listbox",label:"Target",values:a("target_list","target",[{text:"None",value:""},{text:"New window",value:"_blank"}])}),t.settings.rel_list&&(g={name:"rel",type:"listbox",label:"Rel",values:a("rel_list","rel",[{text:"None",value:""}])}),t.settings.link_class_list&&(p={name:"class",type:"listbox",label:"Class",values:i(a("link_class_list","class"))}),t.settings.link_title!==!1&&(y={name:"title",type:"textbox",label:"Title",value:b.title}),d=t.windowManager.open({title:"Insert link",data:b,body:[{name:"href",type:"filepicker",filetype:"file",size:40,autofocus:!0,label:"Url",onchange:o,onkeyup:o},v,y,r(b.href),h,g,m,p],onSubmit:function(e){function n(e,n){var l=t.selection.getRng();window.setTimeout(function(){t.windowManager.confirm(e,function(e){t.selection.setRng(l),n(e)})},0)}function l(){var e={href:i,target:b.target?b.target:null,rel:b.rel?b.rel:null,"class":b["class"]?b["class"]:null,title:b.title?b.title:null};c?(t.focus(),x&&b.text!=f&&("innerText"in c?c.innerText=b.text:c.textContent=b.text),w.setAttribs(c,e),k.select(c),t.undoManager.add()):x?t.insertContent(w.createHTML("a",e,w.encode(b.text))):t.execCommand("mceInsertLink",!1,e)}var i;return b=tinymce.extend(b,e.data),(i=b.href)?i.indexOf("@")>0&&-1==i.indexOf("//")&&-1==i.indexOf("mailto:")?void n("The URL you entered seems to be an email address. Do you want to add the required mailto: prefix?",function(t){t&&(i="mailto:"+i),l()}):/^\s*www\./i.test(i)?void n("The URL you entered seems to be an external link. Do you want to add the required http:// prefix?",function(t){t&&(i="http://"+i),l()}):void l():void t.execCommand("unlink")}})}t.addButton("link",{icon:"link",tooltip:"Insert/edit link",shortcut:"Ctrl+K",onclick:e(n),stateSelector:"a[href]"}),t.addButton("unlink",{icon:"unlink",tooltip:"Remove link",cmd:"unlink",stateSelector:"a[href]"}),t.addShortcut("Ctrl+K","",e(n)),this.showDialog=n,t.addMenuItem("link",{icon:"link",text:"Insert link",shortcut:"Ctrl+K",onclick:e(n),stateSelector:"a[href]",context:"insert",prependToContext:!0})});

1
web/resource/components/tinymce/plugins/lists/plugin.min.js

File diff suppressed because one or more lines are too long

779
web/resource/components/tinymce/plugins/media/plugin.min.js

@ -0,0 +1,779 @@
/**
* plugin.js
*
* Copyright, Moxiecode Systems AB
* Released under LGPL License.
*
* License: http://www.tinymce.com/license
* Contributing: http://www.tinymce.com/contributing
*/
/*jshint maxlen:255 */
/*eslint max-len:0 */
/*global tinymce:true */
tinymce.PluginManager.add('media', function(editor, url) {
var urlPatterns = [
{regex: /youtu\.be\/([\w\-.]+)/, type: 'iframe', w: '100%', h: '250px', url: '//www.youtube.com/embed/$1'},
{regex: /youtube\.com(.+)v=([^&]+)/, type: 'iframe', w: '100%', h: '250px', url: '//www.youtube.com/embed/$2'},
{regex: /vimeo\.com\/([0-9]+)/, type: 'iframe', w: '100%', h: '250px', url: '//player.vimeo.com/video/$1?title=0&byline=0&portrait=0&color=8dc7dc'},
{regex: /vimeo\.com\/(.*)\/([0-9]+)/, type: "iframe", w: '100%', h: '250px', url: "//player.vimeo.com/video/$2?title=0&amp;byline=0"},
{regex: /maps\.google\.([a-z]{2,3})\/maps\/(.+)msid=(.+)/, type: 'iframe', w: '100%', h: '250px', url: '//maps.google.com/maps/ms?msid=$2&output=embed"'},
{regex: /v\.youku\.com\/v_show\/id_([\w\-=]+)\.html/, type: 'iframe', w: '100%', h: '250px', url: '//player.youku.com/embed/$1'},
{regex: /tudou\.com\/(listplay|albumplay)\/([\w\-=]+)\/([\w\-=]+)\.html/, type: 'iframe', w: '100%', h: '250px', url: '//www.tudou.com/programs/view/html5embed.action?type=0&code=$3&lcode='},
{regex: /tudou\.com\/programs\/view\/([\w\-=]+)\//, type: 'iframe', w: '100%', h: '250px', url: '//www.tudou.com/programs/view/html5embed.action?type=0&code=$1&lcode='},
{regex: /56\.com\/([\w\-=]+)\/v_([\w\-=]+)\.html/, type: 'iframe', w: '100%', h: '250px', url: '//www.56.com/iframe/$2"'},
{regex: /v\.ku6\.com\/.+\/([\w\-=._]+)\.html.*$/, type: 'iframe', w: '100%', h: '250px', url: '//player.ku6.com/refer/$1/v.swf'}
];
var embedChange = (tinymce.Env.ie && tinymce.Env.ie <= 8) ? 'onChange' : 'onInput';
function guessMime(url) {
if (url.indexOf('.mp3') != -1) {
return 'audio/mpeg';
}
if (url.indexOf('.wav') != -1) {
return 'audio/wav';
}
if (url.indexOf('.mp4') != -1) {
return 'video/mp4';
}
if (url.indexOf('.webm') != -1) {
return 'video/webm';
}
if (url.indexOf('.ogg') != -1) {
return 'video/ogg';
}
if (url.indexOf('.swf') != -1) {
return 'application/x-shockwave-flash';
}
return '';
}
function getVideoScriptMatch(src) {
var prefixes = editor.settings.media_scripts;
if (prefixes) {
for (var i = 0; i < prefixes.length; i++) {
if (src.indexOf(prefixes[i].filter) !== -1) {
return prefixes[i];
}
}
}
}
function showDialog() {
var win, width, height, data;
var generalFormItems = [
{
name: 'source1',
type: 'filepicker',
filetype: 'media',
size: 40,
autofocus: true,
label: 'Source',
onchange: function(e) {
tinymce.each(e.meta, function(value, key) {
win.find('#' + key).value(value);
});
}
}
];
function recalcSize(e) {
var widthCtrl, heightCtrl, newWidth, newHeight;
widthCtrl = win.find('#width')[0];
heightCtrl = win.find('#height')[0];
newWidth = widthCtrl.value();
newHeight = heightCtrl.value();
if (win.find('#constrain')[0].checked() && width && height && newWidth && newHeight) {
if (e.control == widthCtrl) {
newHeight = Math.round((newWidth / width) * newHeight);
heightCtrl.value(newHeight);
} else {
newWidth = Math.round((newHeight / height) * newWidth);
widthCtrl.value(newWidth);
}
}
width = newWidth;
height = newHeight;
}
generalFormItems.push({type: 'label',text: '支持优酷、56、土豆、酷六',forId: ''});
generalFormItems.push({type: 'label',text: '直接填写页面地址即可',forId: ''});
generalFormItems.push({type: 'label',text: '其它视频请复制“通用代码”到内嵌中',forId: ''});
if (editor.settings.media_alt_source !== false) {
generalFormItems.push({name: 'source2', type: 'filepicker', filetype: 'media', size: 40, label: 'Alternative source'});
}
if (editor.settings.media_poster !== false) {
generalFormItems.push({name: 'poster', type: 'filepicker', filetype: 'image', size: 40, label: 'Poster'});
}
if (editor.settings.media_dimensions !== false) {
generalFormItems.push({
type: 'container',
label: 'Dimensions',
layout: 'flex',
align: 'center',
spacing: 5,
items: [
{name: 'width', type: 'textbox', maxLength: 3, size: 3, onchange: recalcSize},
{type: 'label', text: 'x'},
{name: 'height', type: 'textbox', maxLength: 3, size: 3, onchange: recalcSize},
{name: 'constrain', type: 'checkbox', checked: true, text: 'Constrain proportions'}
]
});
}
data = getData(editor.selection.getNode());
width = data.width;
height = data.height;
var embedTextBox = {
id: 'mcemediasource',
type: 'textbox',
flex: 1,
name: 'embed',
value: getSource(),
multiline: true,
label: 'Source'
};
function updateValueOnChange() {
data = htmlToData(this.value());
this.parent().parent().fromJSON(data);
}
embedTextBox[embedChange] = updateValueOnChange;
win = editor.windowManager.open({
title: 'Insert/edit video',
data: data,
bodyType: 'tabpanel',
body: [
{
title: 'General',
type: "form",
onShowTab: function() {
data = htmlToData(this.next().find('#embed').value());
this.fromJSON(data);
},
items: generalFormItems
},
{
title: 'Embed',
type: "panel",
layout: 'flex',
direction: 'column',
align: 'stretch',
padding: 10,
spacing: 10,
onShowTab: function() {
this.find('#embed').value(dataToHtml(this.parent().toJSON()));
},
items: [
{
type: 'label',
text: 'Paste your embed code below:',
forId: 'mcemediasource'
},
embedTextBox
]
}
],
onSubmit: function() {
var beforeObjects, afterObjects, i, y;
beforeObjects = editor.dom.select('img[data-mce-object]');
editor.insertContent(dataToHtml(this.toJSON()));
afterObjects = editor.dom.select('img[data-mce-object]');
// Find new image placeholder so we can select it
for (i = 0; i < beforeObjects.length; i++) {
for (y = afterObjects.length - 1; y >= 0; y--) {
if (beforeObjects[i] == afterObjects[y]) {
afterObjects.splice(y, 1);
}
}
}
editor.selection.select(afterObjects[0]);
editor.nodeChanged();
}
});
}
function getSource() {
var elm = editor.selection.getNode();
if (elm.getAttribute('data-mce-object')) {
return editor.selection.getContent();
}
}
function dataToHtml(data) {
var html = '';
if (!data.source1) {
tinymce.extend(data, htmlToData(data.embed));
if (!data.source1) {
return '';
}
}
if (!data.source2) {
data.source2 = '';
}
if (!data.poster) {
data.poster = '';
}
data.source1 = editor.convertURL(data.source1, "source");
data.source2 = editor.convertURL(data.source2, "source");
data.source1mime = guessMime(data.source1);
data.source2mime = guessMime(data.source2);
data.poster = editor.convertURL(data.poster, "poster");
data.flashPlayerUrl = editor.convertURL(url + '/moxieplayer.swf', "movie");
tinymce.each(urlPatterns, function(pattern) {
var match, i, url;
if ((match = pattern.regex.exec(data.source1))) {
url = pattern.url;
for (i = 0; match[i]; i++) {
/*jshint loopfunc:true*/
/*eslint no-loop-func:0 */
url = url.replace('$' + i, function() {
return match[i];
});
}
data.source1 = url;
data.type = pattern.type;
data.width = data.width || pattern.w;
data.height = data.height || pattern.h;
}
});
if (data.embed) {
html = updateHtml(data.embed, data, true);
} else {
var videoScript = getVideoScriptMatch(data.source1);
if (videoScript) {
data.type = 'script';
data.width = videoScript.width;
data.height = videoScript.height;
}
data.width = data.width || 300;
data.height = data.height || 150;
tinymce.each(data, function(value, key) {
data[key] = editor.dom.encode(value);
});
if (data.type == "iframe") {
html += '<iframe src="' + data.source1 + '" style="width:' + data.width + '; height:' + data.height + ';" frameborder="0"></iframe>';
} else if (data.source1mime == "application/x-shockwave-flash") {
html += '<object data="' + data.source1 + '" width="' + data.width + '" height="' + data.height + '" type="application/x-shockwave-flash">';
if (data.poster) {
html += '<img src="' + data.poster + '" width="' + data.width + '" height="' + data.height + '" />';
}
html += '</object>';
} else if (data.source1mime.indexOf('audio') != -1) {
if (editor.settings.audio_template_callback) {
html = editor.settings.audio_template_callback(data);
} else {
html += (
'<audio controls="controls" src="' + data.source1 + '">' +
(data.source2 ? '\n<source src="' + data.source2 + '"' + (data.source2mime ? ' type="' + data.source2mime + '"' : '') + ' />\n' : '') +
'</audio>'
);
}
} else if (data.type == "script") {
html += '<script src="' + data.source1 + '"></script>';
} else {
if (editor.settings.video_template_callback) {
html = editor.settings.video_template_callback(data);
} else {
html = (
'<video width="' + data.width + '" height="' + data.height + '"' + (data.poster ? ' poster="' + data.poster + '"' : '') + ' controls="controls">\n' +
'<source src="' + data.source1 + '"' + (data.source1mime ? ' type="' + data.source1mime + '"' : '') + ' />\n' +
(data.source2 ? '<source src="' + data.source2 + '"' + (data.source2mime ? ' type="' + data.source2mime + '"' : '') + ' />\n' : '') +
'</video>'
);
}
}
}
return html;
}
function htmlToData(html) {
var data = {};
new tinymce.html.SaxParser({
validate: false,
allow_conditional_comments: true,
special: 'script,noscript',
start: function(name, attrs) {
if (!data.source1 && name == "param") {
data.source1 = attrs.map.movie;
}
if (name == "iframe" || name == "object" || name == "embed" || name == "video" || name == "audio") {
if (!data.type) {
data.type = name;
}
data = tinymce.extend(attrs.map, data);
}
if (name == "script") {
var videoScript = getVideoScriptMatch(attrs.map.src);
if (!videoScript) {
return;
}
data = {
type: "script",
source1: attrs.map.src,
width: videoScript.width,
height: videoScript.height
};
}
if (name == "source") {
if (!data.source1) {
data.source1 = attrs.map.src;
} else if (!data.source2) {
data.source2 = attrs.map.src;
}
}
if (name == "img" && !data.poster) {
data.poster = attrs.map.src;
}
}
}).parse(html);
data.source1 = data.source1 || data.src || data.data;
data.source2 = data.source2 || '';
data.poster = data.poster || '';
return data;
}
function getData(element) {
if (element.getAttribute('data-mce-object')) {
return htmlToData(editor.serializer.serialize(element, {selection: true}));
}
return {};
}
function sanitize(html) {
if (editor.settings.media_filter_html === false) {
return html;
}
var writer = new tinymce.html.Writer();
new tinymce.html.SaxParser({
validate: false,
allow_conditional_comments: false,
special: 'script,noscript',
comment: function(text) {
writer.comment(text);
},
cdata: function(text) {
writer.cdata(text);
},
text: function(text, raw) {
writer.text(text, raw);
},
start: function(name, attrs, empty) {
if (name == 'script' || name == 'noscript') {
return;
}
for (var i = 0; i < attrs.length; i++) {
if (attrs[i].name.indexOf('on') === 0) {
return;
}
}
writer.start(name, attrs, empty);
},
end: function(name) {
if (name == 'script' || name == 'noscript') {
return;
}
writer.end(name);
}
}, new tinymce.html.Schema({})).parse(html);
return writer.getContent();
}
function updateHtml(html, data, updateAll) {
var writer = new tinymce.html.Writer();
var sourceCount = 0, hasImage;
function setAttributes(attrs, updatedAttrs) {
var name, i, value, attr;
for (name in updatedAttrs) {
value = "" + updatedAttrs[name];
if (attrs.map[name]) {
i = attrs.length;
while (i--) {
attr = attrs[i];
if (attr.name == name) {
if (value) {
attrs.map[name] = value;
attr.value = value;
} else {
delete attrs.map[name];
attrs.splice(i, 1);
}
}
}
} else if (value) {
attrs.push({
name: name,
value: value
});
attrs.map[name] = value;
}
}
}
new tinymce.html.SaxParser({
validate: false,
allow_conditional_comments: true,
special: 'script,noscript',
comment: function(text) {
writer.comment(text);
},
cdata: function(text) {
writer.cdata(text);
},
text: function(text, raw) {
writer.text(text, raw);
},
start: function(name, attrs, empty) {
switch (name) {
case "video":
case "object":
case "embed":
case "img":
case "iframe":
setAttributes(attrs, {
style: 'width:'+data.width+'; height:'+data.height+';'
});
break;
}
if (updateAll) {
switch (name) {
case "video":
setAttributes(attrs, {
poster: data.poster,
src: ""
});
if (data.source2) {
setAttributes(attrs, {
src: ""
});
}
break;
case "iframe":
setAttributes(attrs, {
src: data.source1
});
break;
case "source":
sourceCount++;
if (sourceCount <= 2) {
setAttributes(attrs, {
src: data["source" + sourceCount],
type: data["source" + sourceCount + "mime"]
});
if (!data["source" + sourceCount]) {
return;
}
}
break;
case "img":
if (!data.poster) {
return;
}
hasImage = true;
break;
}
}
writer.start(name, attrs, empty);
},
end: function(name) {
if (name == "video" && updateAll) {
for (var index = 1; index <= 2; index++) {
if (data["source" + index]) {
var attrs = [];
attrs.map = {};
if (sourceCount < index) {
setAttributes(attrs, {
src: data["source" + index],
type: data["source" + index + "mime"]
});
writer.start("source", attrs, true);
}
}
}
}
if (data.poster && name == "object" && updateAll && !hasImage) {
var imgAttrs = [];
imgAttrs.map = {};
setAttributes(imgAttrs, {
src: data.poster,
width: data.width,
height: data.height
});
writer.start("img", imgAttrs, true);
}
writer.end(name);
}
}, new tinymce.html.Schema({})).parse(html);
return writer.getContent();
}
editor.on('ResolveName', function(e) {
var name;
if (e.target.nodeType == 1 && (name = e.target.getAttribute("data-mce-object"))) {
e.name = name;
}
});
editor.on('preInit', function() {
// Make sure that any messy HTML is retained inside these
var specialElements = editor.schema.getSpecialElements();
tinymce.each('video audio iframe object'.split(' '), function(name) {
specialElements[name] = new RegExp('<\/' + name + '[^>]*>', 'gi');
});
// Allow elements
//editor.schema.addValidElements('object[id|style|width|height|classid|codebase|*],embed[id|style|width|height|type|src|*],video[*],audio[*]');
// Set allowFullscreen attribs as boolean
var boolAttrs = editor.schema.getBoolAttrs();
tinymce.each('webkitallowfullscreen mozallowfullscreen allowfullscreen'.split(' '), function(name) {
boolAttrs[name] = {};
});
// Converts iframe, video etc into placeholder images
editor.parser.addNodeFilter('iframe,video,audio,object,embed,script', function(nodes, name) {
var i = nodes.length, ai, node, placeHolder, attrName, attrValue, attribs, innerHtml;
var videoScript;
while (i--) {
node = nodes[i];
if (!node.parent) {
continue;
}
if (node.name == 'script') {
videoScript = getVideoScriptMatch(node.attr('src'));
if (!videoScript) {
continue;
}
}
placeHolder = new tinymce.html.Node('img', 1);
placeHolder.shortEnded = true;
if (videoScript) {
if (videoScript.width) {
node.attr('width', videoScript.width.toString());
}
if (videoScript.height) {
node.attr('height', videoScript.height.toString());
}
}
// Prefix all attributes except width, height and style since we
// will add these to the placeholder
attribs = node.attributes;
ai = attribs.length;
while (ai--) {
attrName = attribs[ai].name;
attrValue = attribs[ai].value;
if (attrName !== "width" && attrName !== "height" && attrName !== "style") {
if (attrName == "data" || attrName == "src") {
attrValue = editor.convertURL(attrValue, attrName);
}
placeHolder.attr('data-mce-p-' + attrName, attrValue);
}
}
// Place the inner HTML contents inside an escaped attribute
// This enables us to copy/paste the fake object
innerHtml = node.firstChild && node.firstChild.value;
if (innerHtml) {
placeHolder.attr("data-mce-html", escape(innerHtml));
placeHolder.firstChild = null;
}
placeHolder.attr({
width: node.attr('width') || "300",
height: node.attr('height') || (name == "audio" ? "30" : "150"),
style: node.attr('style'),
src: tinymce.Env.transparentSrc,
"data-mce-object": name,
"class": "mce-object mce-object-" + name
});
node.replace(placeHolder);
}
});
// Replaces placeholder images with real elements for video, object, iframe etc
editor.serializer.addAttributeFilter('data-mce-object', function(nodes, name) {
var i = nodes.length, node, realElm, ai, attribs, innerHtml, innerNode, realElmName;
while (i--) {
node = nodes[i];
if (!node.parent) {
continue;
}
realElmName = node.attr(name);
realElm = new tinymce.html.Node(realElmName, 1);
// Add width/height to everything but audio
if (realElmName != "audio" && realElmName != "script") {
realElm.attr({
width: node.attr('width'),
height: node.attr('height')
});
}
realElm.attr({
style: node.attr('style')
});
// Unprefix all placeholder attributes
attribs = node.attributes;
ai = attribs.length;
while (ai--) {
var attrName = attribs[ai].name;
if (attrName.indexOf('data-mce-p-') === 0) {
realElm.attr(attrName.substr(11), attribs[ai].value);
}
}
if (realElmName == "script") {
realElm.attr('type', 'text/javascript');
}
// Inject innerhtml
innerHtml = node.attr('data-mce-html');
if (innerHtml) {
innerNode = new tinymce.html.Node('#text', 3);
innerNode.raw = true;
innerNode.value = sanitize(unescape(innerHtml));
realElm.append(innerNode);
}
node.replace(realElm);
}
});
});
editor.on('ObjectSelected', function(e) {
var objectType = e.target.getAttribute('data-mce-object');
if (objectType == "audio" || objectType == "script") {
e.preventDefault();
}
});
editor.on('objectResized', function(e) {
var target = e.target, html;
if (target.getAttribute('data-mce-object')) {
html = target.getAttribute('data-mce-html');
if (html) {
html = unescape(html);
target.setAttribute('data-mce-html', escape(
updateHtml(html, {
width: e.width,
height: e.height
})
));
}
}
});
editor.addButton('media', {
tooltip: 'Insert/edit video',
onclick: showDialog,
stateSelector: ['img[data-mce-object=video]', 'img[data-mce-object=iframe]']
});
editor.addMenuItem('media', {
icon: 'media',
text: 'Insert video',
onclick: showDialog,
context: 'insert',
prependToContext: true
});
});

38
web/resource/components/tinymce/plugins/multiimage/plugin.min.js

@ -0,0 +1,38 @@
tinymce.PluginManager.add('multiimage', function(editor) {
function handleImageDialog() {
var dom = editor.dom;
var imgElm = editor.selection.getNode();
require(['util'], function(u){
var v = '';
if (imgElm && imgElm.tagName.toLowerCase() == 'img') {
v = imgElm.src;
}
u.uploadMultiPictures(function(list){
for(var i=0;i<list.length;i++){
data = {
src: list[i]['url'],
alt: list[i]['filename'],
title: list[i]['filename']
};
editor.focus();
editor.selection.setContent(dom.createHTML('img', data));
}
});
});
}
editor.addButton('multiimage', {
icon: 'image',
tooltip: 'Insert multi image',
onclick: handleImageDialog,
stateSelector: 'img:not([data-mce-object],[data-mce-placeholder])'
});
editor.addMenuItem('multiimage', {
icon: 'image',
text: 'Insert multi image',
onclick: handleImageDialog,
context: 'insert',
prependToContext: true
});
});

1
web/resource/components/tinymce/plugins/nonbreaking/plugin.min.js

@ -0,0 +1 @@
tinymce.PluginManager.add("nonbreaking",function(n){var e=n.getParam("nonbreaking_force_tab");if(n.addCommand("mceNonBreaking",function(){n.insertContent(n.plugins.visualchars&&n.plugins.visualchars.state?'<span class="mce-nbsp">&nbsp;</span>':"&nbsp;"),n.dom.setAttrib(n.dom.select("span.mce-nbsp"),"data-mce-bogus","1")}),n.addButton("nonbreaking",{title:"Insert nonbreaking space",cmd:"mceNonBreaking"}),n.addMenuItem("nonbreaking",{text:"Nonbreaking space",cmd:"mceNonBreaking",context:"insert"}),e){var a=+e>1?+e:3;n.on("keydown",function(e){if(9==e.keyCode){if(e.shiftKey)return;e.preventDefault();for(var t=0;a>t;t++)n.execCommand("mceNonBreaking")}})}});

1
web/resource/components/tinymce/plugins/noneditable/plugin.min.js

@ -0,0 +1 @@
tinymce.PluginManager.add("noneditable",function(e){function t(e){var t;if(1===e.nodeType){if(t=e.getAttribute(u),t&&"inherit"!==t)return t;if(t=e.contentEditable,"inherit"!==t)return t}return null}function n(e){for(var n;e;){if(n=t(e))return"false"===n?e:null;e=e.parentNode}}function r(){function r(e){for(;e;){if(e.id===g)return e;e=e.parentNode}}function a(e){var t;if(e)for(t=new f(e,e),e=t.current();e;e=t.next())if(3===e.nodeType)return e}function i(n,r){var a,i;return"false"===t(n)&&u.isBlock(n)?void s.select(n):(i=u.createRng(),"true"===t(n)&&(n.firstChild||n.appendChild(e.getDoc().createTextNode(" ")),n=n.firstChild,r=!0),a=u.create("span",{id:g,"data-mce-bogus":!0},m),r?n.parentNode.insertBefore(a,n):u.insertAfter(a,n),i.setStart(a.firstChild,1),i.collapse(!0),s.setRng(i),a)}function o(e){var t,n,i,o;if(e)t=s.getRng(!0),t.setStartBefore(e),t.setEndBefore(e),n=a(e),n&&n.nodeValue.charAt(0)==m&&(n=n.deleteData(0,1)),u.remove(e,!0),s.setRng(t);else for(i=r(s.getStart());(e=u.get(g))&&e!==o;)i!==e&&(n=a(e),n&&n.nodeValue.charAt(0)==m&&(n=n.deleteData(0,1)),u.remove(e,!0)),o=e}function l(){function e(e,n){var r,a,i,o,l;if(r=d.startContainer,a=d.startOffset,3==r.nodeType){if(l=r.nodeValue.length,a>0&&l>a||(n?a==l:0===a))return}else{if(!(a<r.childNodes.length))return n?null:e;var u=!n&&a>0?a-1:a;r=r.childNodes[u],r.hasChildNodes()&&(r=r.firstChild)}for(i=new f(r,e);o=i[n?"prev":"next"]();){if(3===o.nodeType&&o.nodeValue.length>0)return;if("true"===t(o))return o}return e}var r,a,l,d,u;o(),l=s.isCollapsed(),r=n(s.getStart()),a=n(s.getEnd()),(r||a)&&(d=s.getRng(!0),l?(r=r||a,(u=e(r,!0))?i(u,!0):(u=e(r,!1))?i(u,!1):s.select(r)):(d=s.getRng(!0),r&&d.setStartBefore(r),a&&d.setEndAfter(a),s.setRng(d)))}function d(a){function i(e,t){for(;e=e[t?"previousSibling":"nextSibling"];)if(3!==e.nodeType||e.nodeValue.length>0)return e}function d(e,t){s.select(e),s.collapse(t)}function g(a){function i(e){for(var t=d;t;){if(t===e)return;t=t.parentNode}u.remove(e),l()}function o(){var r,o,l=e.schema.getNonEmptyElements();for(o=new tinymce.dom.TreeWalker(d,e.getBody());(r=a?o.prev():o.next())&&!l[r.nodeName.toLowerCase()]&&!(3===r.nodeType&&tinymce.trim(r.nodeValue).length>0);)if("false"===t(r))return i(r),!0;return n(r)?!0:!1}var f,d,c,g;if(s.isCollapsed()){if(f=s.getRng(!0),d=f.startContainer,c=f.startOffset,d=r(d)||d,g=n(d))return i(g),!1;if(3==d.nodeType&&(a?c>0:c<d.nodeValue.length))return!0;if(1==d.nodeType&&(d=d.childNodes[c]||d),o())return!1}return!0}var m,p,v,E,h=a.keyCode;if(v=s.getStart(),E=s.getEnd(),m=n(v)||n(E),m&&(112>h||h>124)&&h!=c.DELETE&&h!=c.BACKSPACE){if((tinymce.isMac?a.metaKey:a.ctrlKey)&&(67==h||88==h||86==h))return;if(a.preventDefault(),h==c.LEFT||h==c.RIGHT){var y=h==c.LEFT;if(e.dom.isBlock(m)){var T=y?m.previousSibling:m.nextSibling,C=new f(T,T),b=y?C.prev():C.next();d(b,!y)}else d(m,y)}}else if(h==c.LEFT||h==c.RIGHT||h==c.BACKSPACE||h==c.DELETE){if(p=r(v)){if(h==c.LEFT||h==c.BACKSPACE)if(m=i(p,!0),m&&"false"===t(m)){if(a.preventDefault(),h!=c.LEFT)return void u.remove(m);d(m,!0)}else o(p);if(h==c.RIGHT||h==c.DELETE)if(m=i(p),m&&"false"===t(m)){if(a.preventDefault(),h!=c.RIGHT)return void u.remove(m);d(m,!1)}else o(p)}if((h==c.BACKSPACE||h==c.DELETE)&&!g(h==c.BACKSPACE))return a.preventDefault(),!1}}var u=e.dom,s=e.selection,g="mce_noneditablecaret",m="";e.on("mousedown",function(n){var r=e.selection.getNode();"false"===t(r)&&r==n.target&&l()}),e.on("mouseup keyup",l),e.on("keydown",d)}function a(t){var n=l.length,r=t.content,a=tinymce.trim(o);if("raw"!=t.format){for(;n--;)r=r.replace(l[n],function(t){var n=arguments,i=n[n.length-2];return i>0&&'"'==r.charAt(i-1)?t:'<span class="'+a+'" data-mce-content="'+e.dom.encode(n[0])+'">'+e.dom.encode("string"==typeof n[1]?n[1]:n[0])+"</span>"});t.content=r}}var i,o,l,f=tinymce.dom.TreeWalker,d="contenteditable",u="data-mce-"+d,c=tinymce.util.VK;i=" "+tinymce.trim(e.getParam("noneditable_editable_class","mceEditable"))+" ",o=" "+tinymce.trim(e.getParam("noneditable_noneditable_class","mceNonEditable"))+" ",l=e.getParam("noneditable_regexp"),l&&!l.length&&(l=[l]),e.on("PreInit",function(){r(),l&&e.on("BeforeSetContent",a),e.parser.addAttributeFilter("class",function(e){for(var t,n,r=e.length;r--;)n=e[r],t=" "+n.attr("class")+" ",-1!==t.indexOf(i)?n.attr(u,"true"):-1!==t.indexOf(o)&&n.attr(u,"false")}),e.serializer.addAttributeFilter(u,function(e){for(var t,n=e.length;n--;)t=e[n],l&&t.attr("data-mce-content")?(t.name="#text",t.type=3,t.raw=!0,t.value=t.attr("data-mce-content")):(t.attr(d,null),t.attr(u,null))}),e.parser.addAttributeFilter(d,function(e){for(var t,n=e.length;n--;)t=e[n],t.attr(u,t.attr(d)),t.attr(d,null)})}),e.on("drop",function(e){n(e.target)&&e.preventDefault()})});

1
web/resource/components/tinymce/plugins/pagebreak/plugin.min.js

@ -0,0 +1 @@
tinymce.PluginManager.add("pagebreak",function(e){var a="mce-pagebreak",t=e.getParam("pagebreak_separator","<!-- pagebreak -->"),n=new RegExp(t.replace(/[\?\.\*\[\]\(\)\{\}\+\^\$\:]/g,function(e){return"\\"+e}),"gi"),r='<img src="'+tinymce.Env.transparentSrc+'" class="'+a+'" data-mce-resize="false" />';e.addCommand("mcePageBreak",function(){e.insertContent(e.settings.pagebreak_split_block?"<p>"+r+"</p>":r)}),e.addButton("pagebreak",{title:"Page break",cmd:"mcePageBreak"}),e.addMenuItem("pagebreak",{text:"Page break",icon:"pagebreak",cmd:"mcePageBreak",context:"insert"}),e.on("ResolveName",function(t){"IMG"==t.target.nodeName&&e.dom.hasClass(t.target,a)&&(t.name="pagebreak")}),e.on("click",function(t){t=t.target,"IMG"===t.nodeName&&e.dom.hasClass(t,a)&&e.selection.select(t)}),e.on("BeforeSetContent",function(e){e.content=e.content.replace(n,r)}),e.on("PreInit",function(){e.serializer.addNodeFilter("img",function(a){for(var n,r,c=a.length;c--;)if(n=a[c],r=n.attr("class"),r&&-1!==r.indexOf("mce-pagebreak")){var o=n.parent;if(e.schema.getBlockElements()[o.name]&&e.settings.pagebreak_split_block){o.type=3,o.value=t,o.raw=!0,n.remove();continue}n.type=3,n.value=t,n.raw=!0}})})});

1
web/resource/components/tinymce/plugins/paste/plugin.min.js

File diff suppressed because one or more lines are too long

1
web/resource/components/tinymce/plugins/preview/plugin.min.js

@ -0,0 +1 @@
tinymce.PluginManager.add("preview",function(e){var t=e.settings,i=!tinymce.Env.ie;e.addCommand("mcePreview",function(){e.windowManager.open({title:"Preview",width:parseInt(e.getParam("plugin_preview_width","650"),10),height:parseInt(e.getParam("plugin_preview_height","500"),10),html:'<iframe src="javascript:\'\'" frameborder="0"'+(i?' sandbox="allow-scripts"':"")+"></iframe>",buttons:{text:"Close",onclick:function(){this.parent().parent().close()}},onPostRender:function(){var n,a="";a+='<base href="'+e.documentBaseURI.getURI()+'">',tinymce.each(e.contentCSS,function(t){a+='<link type="text/css" rel="stylesheet" href="'+e.documentBaseURI.toAbsolute(t)+'">'});var r=t.body_id||"tinymce";-1!=r.indexOf("=")&&(r=e.getParam("body_id","","hash"),r=r[e.id]||r);var d=t.body_class||"";-1!=d.indexOf("=")&&(d=e.getParam("body_class","","hash"),d=d[e.id]||"");var o=e.settings.directionality?' dir="'+e.settings.directionality+'"':"";if(n="<!DOCTYPE html><html><head>"+a+'</head><body id="'+r+'" class="mce-content-body '+d+'"'+o+">"+e.getContent()+"</body></html>",i)this.getEl("body").firstChild.src="data:text/html;charset=utf-8,"+encodeURIComponent(n);else{var s=this.getEl("body").firstChild.contentWindow.document;s.open(),s.write(n),s.close()}}})}),e.addButton("preview",{title:"Preview",cmd:"mcePreview"}),e.addMenuItem("preview",{text:"Preview",cmd:"mcePreview",context:"view"})});

1
web/resource/components/tinymce/plugins/print/plugin.min.js

@ -0,0 +1 @@
tinymce.PluginManager.add("print",function(t){t.addCommand("mcePrint",function(){t.getWin().print()}),t.addButton("print",{title:"Print",cmd:"mcePrint"}),t.addShortcut("Ctrl+P","","mcePrint"),t.addMenuItem("print",{text:"Print",cmd:"mcePrint",icon:"print",shortcut:"Ctrl+P",context:"file"})});

1
web/resource/components/tinymce/plugins/save/plugin.min.js

@ -0,0 +1 @@
tinymce.PluginManager.add("save",function(e){function a(){var a;return a=tinymce.DOM.getParent(e.id,"form"),!e.getParam("save_enablewhendirty",!0)||e.isDirty()?(tinymce.triggerSave(),e.getParam("save_onsavecallback")?void(e.execCallback("save_onsavecallback",e)&&(e.startContent=tinymce.trim(e.getContent({format:"raw"})),e.nodeChanged())):void(a?(e.isNotDirty=!0,(!a.onsubmit||a.onsubmit())&&("function"==typeof a.submit?a.submit():e.windowManager.alert("Error: Form submit field collision.")),e.nodeChanged()):e.windowManager.alert("Error: No form element found."))):void 0}function n(){var a=tinymce.trim(e.startContent);return e.getParam("save_oncancelcallback")?void e.execCallback("save_oncancelcallback",e):(e.setContent(a),e.undoManager.clear(),void e.nodeChanged())}function t(){var a=this;e.on("nodeChange",function(){a.disabled(e.getParam("save_enablewhendirty",!0)&&!e.isDirty())})}e.addCommand("mceSave",a),e.addCommand("mceCancel",n),e.addButton("save",{icon:"save",text:"Save",cmd:"mceSave",disabled:!0,onPostRender:t}),e.addButton("cancel",{text:"Cancel",icon:!1,cmd:"mceCancel",disabled:!0,onPostRender:t}),e.addShortcut("ctrl+s","","mceSave")});

1
web/resource/components/tinymce/plugins/searchreplace/plugin.min.js

File diff suppressed because one or more lines are too long

1
web/resource/components/tinymce/plugins/spellchecker/plugin.min.js

File diff suppressed because one or more lines are too long

1
web/resource/components/tinymce/plugins/tabfocus/plugin.min.js

@ -0,0 +1 @@
tinymce.PluginManager.add("tabfocus",function(e){function n(e){9!==e.keyCode||e.ctrlKey||e.altKey||e.metaKey||e.preventDefault()}function t(n){function t(n){function t(e){return"BODY"===e.nodeName||"hidden"!=e.type&&"none"!=e.style.display&&"hidden"!=e.style.visibility&&t(e.parentNode)}function r(e){return e.tabIndex||"INPUT"==e.nodeName||"TEXTAREA"==e.nodeName}function c(e){return!r(e)&&"-1"!=e.getAttribute("tabindex")&&t(e)}if(u=i.select(":input:enabled,*[tabindex]:not(iframe)"),o(u,function(n,t){return n.id==e.id?(a=t,!1):void 0}),n>0){for(d=a+1;d<u.length;d++)if(c(u[d]))return u[d]}else for(d=a-1;d>=0;d--)if(c(u[d]))return u[d];return null}var a,u,c,d;if(!(9!==n.keyCode||n.ctrlKey||n.altKey||n.metaKey)&&(c=r(e.getParam("tab_focus",e.getParam("tabfocus_elements",":prev,:next"))),1==c.length&&(c[1]=c[0],c[0]=":prev"),u=n.shiftKey?":prev"==c[0]?t(-1):i.get(c[0]):":next"==c[1]?t(1):i.get(c[1]))){var y=tinymce.get(u.id||u.name);u.id&&y?y.focus():window.setTimeout(function(){tinymce.Env.webkit||window.focus(),u.focus()},10),n.preventDefault()}}var i=tinymce.DOM,o=tinymce.each,r=tinymce.explode;e.on("init",function(){e.inline&&tinymce.DOM.setAttrib(e.getBody(),"tabIndex",null)}),e.on("keyup",n),tinymce.Env.gecko?e.on("keypress keydown",t):e.on("keydown",t)});

1
web/resource/components/tinymce/plugins/table/plugin.min.js

File diff suppressed because one or more lines are too long

1
web/resource/components/tinymce/plugins/template/plugin.min.js

@ -0,0 +1 @@
tinymce.PluginManager.add("template",function(e){function t(t){return function(){var a=e.settings.templates;"string"==typeof a?tinymce.util.XHR.send({url:a,success:function(e){t(tinymce.util.JSON.parse(e))}}):t(a)}}function a(t){function a(t){function a(t){if(-1==t.indexOf("<html>")){var a="";tinymce.each(e.contentCSS,function(t){a+='<link type="text/css" rel="stylesheet" href="'+e.documentBaseURI.toAbsolute(t)+'">'}),t="<!DOCTYPE html><html><head>"+a+"</head><body>"+t+"</body></html>"}t=r(t,"template_preview_replace_values");var l=n.find("iframe")[0].getEl().contentWindow.document;l.open(),l.write(t),l.close()}var c=t.control.value();c.url?tinymce.util.XHR.send({url:c.url,success:function(e){l=e,a(l)}}):(l=c.content,a(l)),n.find("#description")[0].text(t.control.value().description)}var n,l,i=[];return t&&0!==t.length?(tinymce.each(t,function(e){i.push({selected:!i.length,text:e.title,value:{url:e.url,content:e.content,description:e.description}})}),n=e.windowManager.open({title:"Insert template",layout:"flex",direction:"column",align:"stretch",padding:15,spacing:10,items:[{type:"form",flex:0,padding:0,items:[{type:"container",label:"Templates",items:{type:"listbox",label:"Templates",name:"template",values:i,onselect:a}}]},{type:"label",name:"description",label:"Description",text:" "},{type:"iframe",flex:1,border:1}],onsubmit:function(){c(!1,l)},width:e.getParam("template_popup_width",600),height:e.getParam("template_popup_height",500)}),void n.find("listbox")[0].fire("select")):void e.windowManager.alert("No templates defined")}function n(t,a){function n(e,t){if(e=""+e,e.length<t)for(var a=0;a<t-e.length;a++)e="0"+e;return e}var l="Sun Mon Tue Wed Thu Fri Sat Sun".split(" "),r="Sunday Monday Tuesday Wednesday Thursday Friday Saturday Sunday".split(" "),c="Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec".split(" "),i="January February March April May June July August September October November December".split(" ");return a=a||new Date,t=t.replace("%D","%m/%d/%Y"),t=t.replace("%r","%I:%M:%S %p"),t=t.replace("%Y",""+a.getFullYear()),t=t.replace("%y",""+a.getYear()),t=t.replace("%m",n(a.getMonth()+1,2)),t=t.replace("%d",n(a.getDate(),2)),t=t.replace("%H",""+n(a.getHours(),2)),t=t.replace("%M",""+n(a.getMinutes(),2)),t=t.replace("%S",""+n(a.getSeconds(),2)),t=t.replace("%I",""+((a.getHours()+11)%12+1)),t=t.replace("%p",""+(a.getHours()<12?"AM":"PM")),t=t.replace("%B",""+e.translate(i[a.getMonth()])),t=t.replace("%b",""+e.translate(c[a.getMonth()])),t=t.replace("%A",""+e.translate(r[a.getDay()])),t=t.replace("%a",""+e.translate(l[a.getDay()])),t=t.replace("%%","%")}function l(t){var a=e.dom,n=e.getParam("template_replace_values");i(a.select("*",t),function(e){i(n,function(t,l){a.hasClass(e,l)&&"function"==typeof n[l]&&n[l](e)})})}function r(t,a){return i(e.getParam(a),function(e,a){"function"!=typeof e&&(t=t.replace(new RegExp("\\{\\$"+a+"\\}","g"),e))}),t}function c(t,a){function c(e,t){return new RegExp("\\b"+t+"\\b","g").test(e.className)}var o,s,p=e.dom,m=e.selection.getContent();a=r(a,"template_replace_values"),o=p.create("div",null,a),s=p.select(".mceTmpl",o),s&&s.length>0&&(o=p.create("div",null),o.appendChild(s[0].cloneNode(!0))),i(p.select("*",o),function(t){c(t,e.getParam("template_cdate_classes","cdate").replace(/\s+/g,"|"))&&(t.innerHTML=n(e.getParam("template_cdate_format",e.getLang("template.cdate_format")))),c(t,e.getParam("template_mdate_classes","mdate").replace(/\s+/g,"|"))&&(t.innerHTML=n(e.getParam("template_mdate_format",e.getLang("template.mdate_format")))),c(t,e.getParam("template_selected_content_classes","selcontent").replace(/\s+/g,"|"))&&(t.innerHTML=m)}),l(o),e.execCommand("mceInsertContent",!1,o.innerHTML),e.addVisual()}var i=tinymce.each;e.addCommand("mceInsertTemplate",c),e.addButton("template",{title:"Insert template",onclick:t(a)}),e.addMenuItem("template",{text:"Insert template",onclick:t(a),context:"insert"}),e.on("PreProcess",function(t){var a=e.dom;i(a.select("div",t.node),function(t){a.hasClass(t,"mceTmpl")&&(i(a.select("*",t),function(t){a.hasClass(t,e.getParam("template_mdate_classes","mdate").replace(/\s+/g,"|"))&&(t.innerHTML=n(e.getParam("template_mdate_format",e.getLang("template.mdate_format"))))}),l(t))})})});

1
web/resource/components/tinymce/plugins/textcolor/plugin.min.js

@ -0,0 +1 @@
tinymce.PluginManager.add("textcolor",function(e){function t(){var t,o,l=[];for(o=e.settings.textcolor_map||["000000","Black","993300","Burnt orange","333300","Dark olive","003300","Dark green","003366","Dark azure","000080","Navy Blue","333399","Indigo","333333","Very dark gray","800000","Maroon","FF6600","Orange","808000","Olive","008000","Green","008080","Teal","0000FF","Blue","666699","Grayish blue","808080","Gray","FF0000","Red","FF9900","Amber","99CC00","Yellow green","339966","Sea green","33CCCC","Turquoise","3366FF","Royal blue","800080","Purple","999999","Medium gray","FF00FF","Magenta","FFCC00","Gold","FFFF00","Yellow","00FF00","Lime","00FFFF","Aqua","00CCFF","Sky blue","993366","Red violet","C0C0C0","Silver","FF99CC","Pink","FFCC99","Peach","FFFF99","Light yellow","CCFFCC","Pale green","CCFFFF","Pale cyan","99CCFF","Light sky blue","CC99FF","Plum","FFFFFF","White"],t=0;t<o.length;t+=2)l.push({text:o[t+1],color:o[t]});return l}function o(){var o,l,r,a,c,i,n,F,d,s=this;for(o=t(),r='<table class="mce-grid mce-grid-border mce-colorbutton-grid" role="list" cellspacing="0"><tbody>',a=o.length-1,c=e.settings.textcolor_rows||5,i=e.settings.textcolor_cols||8,F=0;c>F;F++){for(r+="<tr>",n=0;i>n;n++)d=F*i+n,d>a?r+="<td></td>":(l=o[d],r+='<td><div id="'+s._id+"-"+d+'" data-mce-color="'+l.color+'" role="option" tabIndex="-1" style="'+(l?"background-color: #"+l.color:"")+'" title="'+l.text+'"></div></td>');r+="</tr>"}return r+="</tbody></table>"}function l(t){var o,l=this.parent();(o=t.target.getAttribute("data-mce-color"))&&(this.lastId&&document.getElementById(this.lastId).setAttribute("aria-selected",!1),t.target.setAttribute("aria-selected",!0),this.lastId=t.target.id,l.hidePanel(),o="#"+o,l.color(o),e.execCommand(l.settings.selectcmd,!1,o))}function r(){var t=this;t._color&&e.execCommand(t.settings.selectcmd,!1,t._color)}e.addButton("forecolor",{type:"colorbutton",tooltip:"Text color",selectcmd:"ForeColor",panel:{role:"application",ariaRemember:!0,html:o,onclick:l},onclick:r}),e.addButton("backcolor",{type:"colorbutton",tooltip:"Background color",selectcmd:"HiliteColor",panel:{role:"application",ariaRemember:!0,html:o,onclick:l},onclick:r})});

1
web/resource/components/tinymce/plugins/visualblocks/plugin.min.js

@ -0,0 +1 @@
tinymce.PluginManager.add("visualblocks",function(e,s){function o(){var s=this;s.active(a),e.on("VisualBlocks",function(){s.active(e.dom.hasClass(e.getBody(),"mce-visualblocks"))})}var l,t,a;window.NodeList&&(e.addCommand("mceVisualBlocks",function(){var o,c=e.dom;l||(l=c.uniqueId(),o=c.create("link",{id:l,rel:"stylesheet",href:s+"/css/visualblocks.css"}),e.getDoc().getElementsByTagName("head")[0].appendChild(o)),e.on("PreviewFormats AfterPreviewFormats",function(s){a&&c.toggleClass(e.getBody(),"mce-visualblocks","afterpreviewformats"==s.type)}),c.toggleClass(e.getBody(),"mce-visualblocks"),a=e.dom.hasClass(e.getBody(),"mce-visualblocks"),t&&t.active(c.hasClass(e.getBody(),"mce-visualblocks")),e.fire("VisualBlocks")}),e.addButton("visualblocks",{title:"Show blocks",cmd:"mceVisualBlocks",onPostRender:o}),e.addMenuItem("visualblocks",{text:"Show blocks",cmd:"mceVisualBlocks",onPostRender:o,selectable:!0,context:"view",prependToContext:!0}),e.on("init",function(){e.settings.visualblocks_default_state&&e.execCommand("mceVisualBlocks",!1,null,{skip_focus:!0})}),e.on("remove",function(){e.dom.removeClass(e.getBody(),"mce-visualblocks")}))});

1
web/resource/components/tinymce/plugins/visualchars/plugin.min.js

@ -0,0 +1 @@
tinymce.PluginManager.add("visualchars",function(e){function a(a){var t,s,i,r,c,d,l=e.getBody(),m=e.selection;if(n=!n,o.state=n,e.fire("VisualChars",{state:n}),a&&(d=m.getBookmark()),n)for(s=[],tinymce.walk(l,function(e){3==e.nodeType&&e.nodeValue&&-1!=e.nodeValue.indexOf(" ")&&s.push(e)},"childNodes"),i=0;i<s.length;i++){for(r=s[i].nodeValue,r=r.replace(/(\u00a0)/g,'<span data-mce-bogus="1" class="mce-nbsp">$1</span>'),c=e.dom.create("div",null,r);t=c.lastChild;)e.dom.insertAfter(t,s[i]);e.dom.remove(s[i])}else for(s=e.dom.select("span.mce-nbsp",l),i=s.length-1;i>=0;i--)e.dom.remove(s[i],1);m.moveToBookmark(d)}function t(){var a=this;e.on("VisualChars",function(e){a.active(e.state)})}var n,o=this;e.addCommand("mceVisualChars",a),e.addButton("visualchars",{title:"Show invisible characters",cmd:"mceVisualChars",onPostRender:t}),e.addMenuItem("visualchars",{text:"Show invisible characters",cmd:"mceVisualChars",onPostRender:t,selectable:!0,context:"view",prependToContext:!0}),e.on("beforegetcontent",function(e){n&&"raw"!=e.format&&!e.draft&&(n=!0,a(!1))})});

1
web/resource/components/tinymce/plugins/wordcount/plugin.min.js

@ -0,0 +1 @@
tinymce.PluginManager.add("wordcount",function(a){function b(){a.theme.panel.find("#wordcount").text(["Words: {0}",e.getCount()])}var c,d,e=this;c=a.getParam("wordcount_countregex",/[\w\u2019\x27\-\u00C0-\u1FFF]+/g),h=a.getParam("wordhcount_countregex",/[\u2E80-\u9FFF]{1}/g),d=a.getParam("wordcount_cleanregex",/[.(),;:!?%#$?\x27\x22_+=\\\/\-]*/g),a.on("init",function(){var c=a.theme.panel&&a.theme.panel.find("#statusbar")[0];c&&window.setTimeout(function(){c.insert({type:"label",name:"wordcount",text:["Words: {0}",e.getCount()],classes:"wordcount",disabled:a.settings.readonly},0),a.on("setcontent beforeaddundo",b),a.on("keyup",function(a){32==a.keyCode&&b()})},0)}),e.getCount=function(){var b=a.getContent({format:"raw"}),e=0;if(b){b=b.replace(/\.\.\./g," "),b=b.replace(/<.[^<>]*?>/g," "),b=b.replace(/&nbsp;|&#160;/gi," "),b=b.replace(/(\w+)(&#?[a-z0-9]+;)+(\w+)/i,"$1$3"),b=b.replace(/&.+?;/g," "),b=b.replace(d,"");var f=b.match(c);f&&(e=f.length);var g=b.match(h);g&&(e+=g.length)}return e}});

1
web/resource/components/tinymce/skins/lightgray/fonts/readme.md

@ -0,0 +1 @@
Icons are generated and provided by the http://icomoon.io service.

BIN
web/resource/components/tinymce/skins/lightgray/img/object.gif

Binary file not shown.

After

Width:  |  Height:  |  Size: 152 B

BIN
web/resource/components/ueditor/dialogs/attachment/images/progress.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

BIN
web/resource/components/ueditor/dialogs/emotion/images/neweditor-tab-bg.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 216 B

BIN
web/resource/components/ueditor/dialogs/image/images/progress.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

1
web/resource/components/ueditor/dialogs/music/music.css

@ -0,0 +1 @@
.listPanel,.page,.resultBar{overflow:hidden}.m-h,.pageon{font-weight:700}.wrapper{margin:5px 10px}.searchBar{height:30px;padding:7px 0 3px;text-align:center}.searchBtn{font-size:13px;height:24px}.resultBar{width:460px;margin:5px auto;border:1px solid #CCC;border-radius:5px;box-shadow:2px 2px 5px #D3D6DA}.panelon{display:block}.paneloff{display:none}.page{width:220px;margin:20px auto}.pageoff,.pageon{float:right;width:24px;line-height:24px;height:24px;margin-right:5px;text-align:center}.pageon{background:0 0;border:none;color:#000}.pageoff{cursor:pointer;background-color:#fff;border:1px solid #E7ECF0;color:#2D64B3;text-decoration:none}.m-l,.m-m,.m-s,.m-t,.m-try-t,.m-z{float:left}.m-box{width:460px}.m-m{line-height:20px;height:20px}.m-h{height:24px;line-height:24px;padding-left:46px;background-color:#FAFAFA;border-bottom:1px solid #DAD8D8;font-size:12px;color:#333}.m-l{width:40px}.m-t{width:140px}.m-s{width:110px}.m-z{width:100px}.m-try-t{width:60px}.m-try,.m-trying{float:left;width:20px;height:20px}.m-try{background:url(http://static.tieba.baidu.com/tb/editor/images/try_music.gif) no-repeat}.m-trying{background:url(http://static.tieba.baidu.com/tb/editor/images/stop_music.gif) no-repeat}.loading{width:95px;height:7px;font-size:7px;margin:60px auto;background:url(http://static.tieba.baidu.com/tb/editor/images/loading.gif) no-repeat}.empty{width:300px;height:40px;padding:2px;margin:50px auto;line-height:40px;color:#069;text-align:center}

32
web/resource/components/ueditor/dialogs/music/music.html

@ -0,0 +1,32 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<title>插入音乐</title>
<script type="text/javascript" src="../internal.js"></script>
<link rel="stylesheet" type="text/css" href="music.css">
</head>
<body>
<div class="wrapper">
<div class="searchBar">
<input id="J_searchName" type="text"/>
<input type="button" class="searchBtn" id="J_searchBtn">
</div>
<div class="resultBar" id="J_resultBar">
<div class="loading" style="display:none"></div>
<div class="empty"><var id="lang_input_tips"></var></div>
</div>
<div id="J_preview"></div>
</div>
<script type="text/javascript" src="music.js"></script>
<script type="text/javascript">
var music = new Music;
dialog.onok = function () {
music.exec();
};
dialog.oncancel = function () {
$G('J_preview').innerHTML = "";
};
</script>
</body>
</html>

192
web/resource/components/ueditor/dialogs/music/music.js

@ -0,0 +1,192 @@
function Music() {
this.init();
}
(function () {
var pages = [],
panels = [],
selectedItem = null;
Music.prototype = {
total:70,
pageSize:10,
dataUrl:"http://tingapi.ting.baidu.com/v1/restserver/ting?method=baidu.ting.search.common",
playerUrl:"http://box.baidu.com/widget/flash/bdspacesong.swf",
init:function () {
var me = this;
domUtils.on($G("J_searchName"), "keyup", function (event) {
var e = window.event || event;
if (e.keyCode == 13) {
me.dosearch();
}
});
domUtils.on($G("J_searchBtn"), "click", function () {
me.dosearch();
});
},
callback:function (data) {
var me = this;
me.data = data.song_list;
setTimeout(function () {
$G('J_resultBar').innerHTML = me._renderTemplate(data.song_list);
}, 300);
},
dosearch:function () {
var me = this;
selectedItem = null;
var key = $G('J_searchName').value;
if (utils.trim(key) == "")return false;
key = encodeURIComponent(key);
me._sent(key);
},
doselect:function (i) {
var me = this;
if (typeof i == 'object') {
selectedItem = i;
} else if (typeof i == 'number') {
selectedItem = me.data[i];
}
},
onpageclick:function (id) {
var me = this;
for (var i = 0; i < pages.length; i++) {
$G(pages[i]).className = 'pageoff';
$G(panels[i]).className = 'paneloff';
}
$G('page' + id).className = 'pageon';
$G('panel' + id).className = 'panelon';
},
listenTest:function (elem) {
var me = this,
view = $G('J_preview'),
is_play_action = (elem.className == 'm-try'),
old_trying = me._getTryingElem();
if (old_trying) {
old_trying.className = 'm-try';
view.innerHTML = '';
}
if (is_play_action) {
elem.className = 'm-trying';
view.innerHTML = me._buildMusicHtml(me._getUrl(true));
}
},
_sent:function (param) {
var me = this;
$G('J_resultBar').innerHTML = '<div class="loading"></div>';
utils.loadFile(document, {
src:me.dataUrl + '&query=' + param + '&page_size=' + me.total + '&callback=music.callback&.r=' + Math.random(),
tag:"script",
type:"text/javascript",
defer:"defer"
});
},
_removeHtml:function (str) {
var reg = /<\s*\/?\s*[^>]*\s*>/gi;
return str.replace(reg, "");
},
_getUrl:function (isTryListen) {
var me = this;
var param = 'from=tiebasongwidget&url=&name=' + encodeURIComponent(me._removeHtml(selectedItem.title)) + '&artist='
+ encodeURIComponent(me._removeHtml(selectedItem.author)) + '&extra='
+ encodeURIComponent(me._removeHtml(selectedItem.album_title))
+ '&autoPlay='+isTryListen+'' + '&loop=true';
return me.playerUrl + "?" + param;
},
_getTryingElem:function () {
var s = $G('J_listPanel').getElementsByTagName('span');
for (var i = 0; i < s.length; i++) {
if (s[i].className == 'm-trying')
return s[i];
}
return null;
},
_buildMusicHtml:function (playerUrl) {
var html = '<embed class="BDE_try_Music" allowfullscreen="false" pluginspage="http://www.macromedia.com/go/getflashplayer"';
html += ' src="' + playerUrl + '"';
html += ' width="1" height="1" style="position:absolute;left:-2000px;"';
html += ' type="application/x-shockwave-flash" wmode="transparent" play="true" loop="false"';
html += ' menu="false" allowscriptaccess="never" scale="noborder">';
return html;
},
_byteLength:function (str) {
return str.replace(/[^\u0000-\u007f]/g, "\u0061\u0061").length;
},
_getMaxText:function (s) {
var me = this;
s = me._removeHtml(s);
if (me._byteLength(s) > 12)
return s.substring(0, 5) + '...';
if (!s) s = "&nbsp;";
return s;
},
_rebuildData:function (data) {
var me = this,
newData = [],
d = me.pageSize,
itembox;
for (var i = 0; i < data.length; i++) {
if ((i + d) % d == 0) {
itembox = [];
newData.push(itembox)
}
itembox.push(data[i]);
}
return newData;
},
_renderTemplate:function (data) {
var me = this;
if (data.length == 0)return '<div class="empty">' + lang.emptyTxt + '</div>';
data = me._rebuildData(data);
var s = [], p = [], t = [];
s.push('<div id="J_listPanel" class="listPanel">');
p.push('<div class="page">');
for (var i = 0, tmpList; tmpList = data[i++];) {
panels.push('panel' + i);
pages.push('page' + i);
if (i == 1) {
s.push('<div id="panel' + i + '" class="panelon">');
if (data.length != 1) {
t.push('<div id="page' + i + '" onclick="music.onpageclick(' + i + ')" class="pageon">' + (i ) + '</div>');
}
} else {
s.push('<div id="panel' + i + '" class="paneloff">');
t.push('<div id="page' + i + '" onclick="music.onpageclick(' + i + ')" class="pageoff">' + (i ) + '</div>');
}
s.push('<div class="m-box">');
s.push('<div class="m-h"><span class="m-t">' + lang.chapter + '</span><span class="m-s">' + lang.singer
+ '</span><span class="m-z">' + lang.special + '</span><span class="m-try-t">' + lang.listenTest + '</span></div>');
for (var j = 0, tmpObj; tmpObj = tmpList[j++];) {
s.push('<label for="radio-' + i + '-' + j + '" class="m-m">');
s.push('<input type="radio" id="radio-' + i + '-' + j + '" name="musicId" class="m-l" onclick="music.doselect(' + (me.pageSize * (i-1) + (j-1)) + ')"/>');
s.push('<span class="m-t">' + me._getMaxText(tmpObj.title) + '</span>');
s.push('<span class="m-s">' + me._getMaxText(tmpObj.author) + '</span>');
s.push('<span class="m-z">' + me._getMaxText(tmpObj.album_title) + '</span>');
s.push('<span class="m-try" onclick="music.doselect(' + (me.pageSize * (i-1) + (j-1)) + ');music.listenTest(this)"></span>');
s.push('</label>');
}
s.push('</div>');
s.push('</div>');
}
t.reverse();
p.push(t.join(''));
s.push('</div>');
p.push('</div>');
return s.join('') + p.join('');
},
exec:function () {
var me = this;
if (selectedItem == null) return;
$G('J_preview').innerHTML = "";
editor.execCommand('music', {
url:me._getUrl(false),
width:400,
height:95
});
}
};
})();

40
web/resource/components/ueditor/dialogs/preview/preview.html

@ -0,0 +1,40 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<style>
html,body{
height:100%;
width:100%;
padding:0;
margin:0;
}
#preview{
width:100%;
height:100%;
padding:0;
margin:0;
}
#preview *{font-family:sans-serif;font-size:16px;}
</style>
<script type="text/javascript" src="../internal.js"></script>
<script src="../../ueditor.parse.js"></script>
<title></title>
</head>
<body class="view">
<div id="preview" style="margin:8px">
</div>
</body>
<script>
document.getElementById('preview').innerHTML = editor.getContent();
uParse('#preview',{
rootPath : '../../',
chartContainerHeight:500
})
dialog.oncancel = function(){
document.getElementById('preview').innerHTML = '';
}
</script>
</html>

BIN
web/resource/components/ueditor/dialogs/scrawl/images/redo.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 454 B

BIN
web/resource/components/ueditor/dialogs/scrawl/images/redoH.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 536 B

BIN
web/resource/components/ueditor/dialogs/template/images/pre0.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 250 B

BIN
web/resource/components/ueditor/dialogs/template/images/pre1.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 291 B

BIN
web/resource/components/ueditor/dialogs/template/images/pre2.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 394 B

BIN
web/resource/components/ueditor/dialogs/template/images/pre3.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 485 B

BIN
web/resource/components/ueditor/dialogs/template/images/pre4.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 393 B

BIN
web/resource/components/ueditor/dialogs/video/images/none_focus.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

BIN
web/resource/components/ueditor/dialogs/video/images/progress.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

BIN
web/resource/components/ueditor/lang/en/images/music.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 89 KiB

BIN
web/resource/components/ueditor/lang/zh-cn/images/music.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

BIN
web/resource/components/ueditor/themes/default/images/neweditor-tab-bg.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 216 B

BIN
web/resource/components/ueditor/themes/default/images/pagebreak.gif

Binary file not shown.

After

Width:  |  Height:  |  Size: 54 B

15
web/resource/components/ueditor/third-party/highcharts/adapters/prototype-adapter.js

@ -0,0 +1,15 @@
/*
Highcharts JS v3.0.6 (2013-10-04)
Prototype adapter
@author Michael Nelson, Torstein Hønsi.
Feel free to use and modify this script.
Highcharts license: www.highcharts.com/license.
*/
var HighchartsAdapter=function(){var f=typeof Effect!=="undefined";return{init:function(a){if(f)Effect.HighchartsTransition=Class.create(Effect.Base,{initialize:function(b,c,d,g){var e;this.element=b;this.key=c;e=b.attr?b.attr(c):$(b).getStyle(c);if(c==="d")this.paths=a.init(b,b.d,d),this.toD=d,e=0,d=1;this.start(Object.extend(g||{},{from:e,to:d,attribute:c}))},setup:function(){HighchartsAdapter._extend(this.element);if(!this.element._highchart_animation)this.element._highchart_animation={};this.element._highchart_animation[this.key]=
this},update:function(b){var c=this.paths,d=this.element;c&&(b=a.step(c[0],c[1],b,this.toD));d.attr?d.element&&d.attr(this.options.attribute,b):(c={},c[this.options.attribute]=b,$(d).setStyle(c))},finish:function(){this.element&&this.element._highchart_animation&&delete this.element._highchart_animation[this.key]}})},adapterRun:function(a,b){return parseInt($(a).getStyle(b),10)},getScript:function(a,b){var c=$$("head")[0];c&&c.appendChild((new Element("script",{type:"text/javascript",src:a})).observe("load",
b))},addNS:function(a){var b=/^(?:click|mouse(?:down|up|over|move|out))$/;return/^(?:load|unload|abort|error|select|change|submit|reset|focus|blur|resize|scroll)$/.test(a)||b.test(a)?a:"h:"+a},addEvent:function(a,b,c){a.addEventListener||a.attachEvent?Event.observe($(a),HighchartsAdapter.addNS(b),c):(HighchartsAdapter._extend(a),a._highcharts_observe(b,c))},animate:function(a,b,c){var d,c=c||{};c.delay=0;c.duration=(c.duration||500)/1E3;c.afterFinish=c.complete;if(f)for(d in b)new Effect.HighchartsTransition($(a),
d,b[d],c);else{if(a.attr)for(d in b)a.attr(d,b[d]);c.complete&&c.complete()}a.attr||$(a).setStyle(b)},stop:function(a){var b;if(a._highcharts_extended&&a._highchart_animation)for(b in a._highchart_animation)a._highchart_animation[b].cancel()},each:function(a,b){$A(a).each(b)},inArray:function(a,b,c){return b?b.indexOf(a,c):-1},offset:function(a){return $(a).cumulativeOffset()},fireEvent:function(a,b,c,d){a.fire?a.fire(HighchartsAdapter.addNS(b),c):a._highcharts_extended&&(c=c||{},a._highcharts_fire(b,
c));c&&c.defaultPrevented&&(d=null);d&&d(c)},removeEvent:function(a,b,c){$(a).stopObserving&&(b&&(b=HighchartsAdapter.addNS(b)),$(a).stopObserving(b,c));window===a?Event.stopObserving(a,b,c):(HighchartsAdapter._extend(a),a._highcharts_stop_observing(b,c))},washMouseEvent:function(a){return a},grep:function(a,b){return a.findAll(b)},map:function(a,b){return a.map(b)},_extend:function(a){a._highcharts_extended||Object.extend(a,{_highchart_events:{},_highchart_animation:null,_highcharts_extended:!0,
_highcharts_observe:function(b,a){this._highchart_events[b]=[this._highchart_events[b],a].compact().flatten()},_highcharts_stop_observing:function(b,a){b?a?this._highchart_events[b]=[this._highchart_events[b]].compact().flatten().without(a):delete this._highchart_events[b]:this._highchart_events={}},_highcharts_fire:function(a,c){var d=this;(this._highchart_events[a]||[]).each(function(a){if(!c.stopped)c.preventDefault=function(){c.defaultPrevented=!0},c.target=d,a.bind(this)(c)===!1&&c.preventDefault()}.bind(this))}})}}}();

316
web/resource/components/ueditor/third-party/highcharts/adapters/prototype-adapter.src.js

@ -0,0 +1,316 @@
/**
* @license Highcharts JS v3.0.6 (2013-10-04)
* Prototype adapter
*
* @author Michael Nelson, Torstein Hønsi.
*
* Feel free to use and modify this script.
* Highcharts license: www.highcharts.com/license.
*/
// JSLint options:
/*global Effect, Class, Event, Element, $, $$, $A */
// Adapter interface between prototype and the Highcharts charting library
var HighchartsAdapter = (function () {
var hasEffect = typeof Effect !== 'undefined';
return {
/**
* Initialize the adapter. This is run once as Highcharts is first run.
* @param {Object} pathAnim The helper object to do animations across adapters.
*/
init: function (pathAnim) {
if (hasEffect) {
/**
* Animation for Highcharts SVG element wrappers only
* @param {Object} element
* @param {Object} attribute
* @param {Object} to
* @param {Object} options
*/
Effect.HighchartsTransition = Class.create(Effect.Base, {
initialize: function (element, attr, to, options) {
var from,
opts;
this.element = element;
this.key = attr;
from = element.attr ? element.attr(attr) : $(element).getStyle(attr);
// special treatment for paths
if (attr === 'd') {
this.paths = pathAnim.init(
element,
element.d,
to
);
this.toD = to;
// fake values in order to read relative position as a float in update
from = 0;
to = 1;
}
opts = Object.extend((options || {}), {
from: from,
to: to,
attribute: attr
});
this.start(opts);
},
setup: function () {
HighchartsAdapter._extend(this.element);
// If this is the first animation on this object, create the _highcharts_animation helper that
// contain pointers to the animation objects.
if (!this.element._highchart_animation) {
this.element._highchart_animation = {};
}
// Store a reference to this animation instance.
this.element._highchart_animation[this.key] = this;
},
update: function (position) {
var paths = this.paths,
element = this.element,
obj;
if (paths) {
position = pathAnim.step(paths[0], paths[1], position, this.toD);
}
if (element.attr) { // SVGElement
if (element.element) { // If not, it has been destroyed (#1405)
element.attr(this.options.attribute, position);
}
} else { // HTML, #409
obj = {};
obj[this.options.attribute] = position;
$(element).setStyle(obj);
}
},
finish: function () {
// Delete the property that holds this animation now that it is finished.
// Both canceled animations and complete ones gets a 'finish' call.
if (this.element && this.element._highchart_animation) { // #1405
delete this.element._highchart_animation[this.key];
}
}
});
}
},
/**
* Run a general method on the framework, following jQuery syntax
* @param {Object} el The HTML element
* @param {String} method Which method to run on the wrapped element
*/
adapterRun: function (el, method) {
// This currently works for getting inner width and height. If adding
// more methods later, we need a conditional implementation for each.
return parseInt($(el).getStyle(method), 10);
},
/**
* Downloads a script and executes a callback when done.
* @param {String} scriptLocation
* @param {Function} callback
*/
getScript: function (scriptLocation, callback) {
var head = $$('head')[0]; // Returns an array, so pick the first element.
if (head) {
// Append a new 'script' element, set its type and src attributes, add a 'load' handler that calls the callback
head.appendChild(new Element('script', { type: 'text/javascript', src: scriptLocation}).observe('load', callback));
}
},
/**
* Custom events in prototype needs to be namespaced. This method adds a namespace 'h:' in front of
* events that are not recognized as native.
*/
addNS: function (eventName) {
var HTMLEvents = /^(?:load|unload|abort|error|select|change|submit|reset|focus|blur|resize|scroll)$/,
MouseEvents = /^(?:click|mouse(?:down|up|over|move|out))$/;
return (HTMLEvents.test(eventName) || MouseEvents.test(eventName)) ?
eventName :
'h:' + eventName;
},
// el needs an event to be attached. el is not necessarily a dom element
addEvent: function (el, event, fn) {
if (el.addEventListener || el.attachEvent) {
Event.observe($(el), HighchartsAdapter.addNS(event), fn);
} else {
HighchartsAdapter._extend(el);
el._highcharts_observe(event, fn);
}
},
// motion makes things pretty. use it if effects is loaded, if not... still get to the end result.
animate: function (el, params, options) {
var key,
fx;
// default options
options = options || {};
options.delay = 0;
options.duration = (options.duration || 500) / 1000;
options.afterFinish = options.complete;
// animate wrappers and DOM elements
if (hasEffect) {
for (key in params) {
// The fx variable is seemingly thrown away here, but the Effect.setup will add itself to the _highcharts_animation object
// on the element itself so its not really lost.
fx = new Effect.HighchartsTransition($(el), key, params[key], options);
}
} else {
if (el.attr) { // #409 without effects
for (key in params) {
el.attr(key, params[key]);
}
}
if (options.complete) {
options.complete();
}
}
if (!el.attr) { // HTML element, #409
$(el).setStyle(params);
}
},
// this only occurs in higcharts 2.0+
stop: function (el) {
var key;
if (el._highcharts_extended && el._highchart_animation) {
for (key in el._highchart_animation) {
// Cancel the animation
// The 'finish' function in the Effect object will remove the reference
el._highchart_animation[key].cancel();
}
}
},
// um.. each
each: function (arr, fn) {
$A(arr).each(fn);
},
inArray: function (item, arr, from) {
return arr ? arr.indexOf(item, from) : -1;
},
/**
* Get the cumulative offset relative to the top left of the page. This method, unlike its
* jQuery and MooTools counterpart, still suffers from issue #208 regarding the position
* of a chart within a fixed container.
*/
offset: function (el) {
return $(el).cumulativeOffset();
},
// fire an event based on an event name (event) and an object (el).
// again, el may not be a dom element
fireEvent: function (el, event, eventArguments, defaultFunction) {
if (el.fire) {
el.fire(HighchartsAdapter.addNS(event), eventArguments);
} else if (el._highcharts_extended) {
eventArguments = eventArguments || {};
el._highcharts_fire(event, eventArguments);
}
if (eventArguments && eventArguments.defaultPrevented) {
defaultFunction = null;
}
if (defaultFunction) {
defaultFunction(eventArguments);
}
},
removeEvent: function (el, event, handler) {
if ($(el).stopObserving) {
if (event) {
event = HighchartsAdapter.addNS(event);
}
$(el).stopObserving(event, handler);
} if (window === el) {
Event.stopObserving(el, event, handler);
} else {
HighchartsAdapter._extend(el);
el._highcharts_stop_observing(event, handler);
}
},
washMouseEvent: function (e) {
return e;
},
// um, grep
grep: function (arr, fn) {
return arr.findAll(fn);
},
// um, map
map: function (arr, fn) {
return arr.map(fn);
},
// extend an object to handle highchart events (highchart objects, not svg elements).
// this is a very simple way of handling events but whatever, it works (i think)
_extend: function (object) {
if (!object._highcharts_extended) {
Object.extend(object, {
_highchart_events: {},
_highchart_animation: null,
_highcharts_extended: true,
_highcharts_observe: function (name, fn) {
this._highchart_events[name] = [this._highchart_events[name], fn].compact().flatten();
},
_highcharts_stop_observing: function (name, fn) {
if (name) {
if (fn) {
this._highchart_events[name] = [this._highchart_events[name]].compact().flatten().without(fn);
} else {
delete this._highchart_events[name];
}
} else {
this._highchart_events = {};
}
},
_highcharts_fire: function (name, args) {
var target = this;
(this._highchart_events[name] || []).each(function (fn) {
// args is never null here
if (args.stopped) {
return; // "throw $break" wasn't working. i think because of the scope of 'this'.
}
// Attach a simple preventDefault function to skip default handler if called
args.preventDefault = function () {
args.defaultPrevented = true;
};
args.target = target;
// If the event handler return false, prevent the default handler from executing
if (fn.bind(this)(args) === false) {
args.preventDefault();
}
}
.bind(this));
}
});
}
}
};
}());

12
web/resource/components/ueditor/third-party/highcharts/modules/no-data-to-display.js

@ -0,0 +1,12 @@
/*
Highcharts JS v3.0.6 (2013-10-04)
Plugin for displaying a message when there is no data visible in chart.
(c) 2010-2013 Highsoft AS
Author: Øystein Moseng
License: www.highcharts.com/license
*/
(function(c){function f(){return!!this.points.length}function g(){this.hasData()?this.hideNoData():this.showNoData()}var d=c.seriesTypes,e=c.Chart.prototype,h=c.getOptions(),i=c.extend;i(h.lang,{noData:"No data to display"});h.noData={position:{x:0,y:0,align:"center",verticalAlign:"middle"},attr:{},style:{fontWeight:"bold",fontSize:"12px",color:"#60606a"}};d.pie.prototype.hasData=f;if(d.gauge)d.gauge.prototype.hasData=f;if(d.waterfall)d.waterfall.prototype.hasData=f;c.Series.prototype.hasData=function(){return this.dataMax!==
void 0&&this.dataMin!==void 0};e.showNoData=function(a){var b=this.options,a=a||b.lang.noData,b=b.noData;if(!this.noDataLabel)this.noDataLabel=this.renderer.label(a,0,0,null,null,null,null,null,"no-data").attr(b.attr).css(b.style).add(),this.noDataLabel.align(i(this.noDataLabel.getBBox(),b.position),!1,"plotBox")};e.hideNoData=function(){if(this.noDataLabel)this.noDataLabel=this.noDataLabel.destroy()};e.hasData=function(){for(var a=this.series,b=a.length;b--;)if(a[b].hasData()&&!a[b].options.isInternal)return!0;
return!1};e.callbacks.push(function(a){c.addEvent(a,"load",g);c.addEvent(a,"redraw",g)})})(Highcharts);

128
web/resource/components/ueditor/third-party/highcharts/modules/no-data-to-display.src.js

@ -0,0 +1,128 @@
/**
* @license Highcharts JS v3.0.6 (2013-10-04)
* Plugin for displaying a message when there is no data visible in chart.
*
* (c) 2010-2013 Highsoft AS
* Author: Øystein Moseng
*
* License: www.highcharts.com/license
*/
(function (H) { // docs
var seriesTypes = H.seriesTypes,
chartPrototype = H.Chart.prototype,
defaultOptions = H.getOptions(),
extend = H.extend;
// Add language option
extend(defaultOptions.lang, {
noData: 'No data to display'
});
// Add default display options for message
defaultOptions.noData = {
position: {
x: 0,
y: 0,
align: 'center',
verticalAlign: 'middle'
},
attr: {
},
style: {
fontWeight: 'bold',
fontSize: '12px',
color: '#60606a'
}
};
/**
* Define hasData functions for series. These return true if there are data points on this series within the plot area
*/
function hasDataPie() {
return !!this.points.length; /* != 0 */
}
seriesTypes.pie.prototype.hasData = hasDataPie;
if (seriesTypes.gauge) {
seriesTypes.gauge.prototype.hasData = hasDataPie;
}
if (seriesTypes.waterfall) {
seriesTypes.waterfall.prototype.hasData = hasDataPie;
}
H.Series.prototype.hasData = function () {
return this.dataMax !== undefined && this.dataMin !== undefined;
};
/**
* Display a no-data message.
*
* @param {String} str An optional message to show in place of the default one
*/
chartPrototype.showNoData = function (str) {
var chart = this,
options = chart.options,
text = str || options.lang.noData,
noDataOptions = options.noData;
if (!chart.noDataLabel) {
chart.noDataLabel = chart.renderer.label(text, 0, 0, null, null, null, null, null, 'no-data')
.attr(noDataOptions.attr)
.css(noDataOptions.style)
.add();
chart.noDataLabel.align(extend(chart.noDataLabel.getBBox(), noDataOptions.position), false, 'plotBox');
}
};
/**
* Hide no-data message
*/
chartPrototype.hideNoData = function () {
var chart = this;
if (chart.noDataLabel) {
chart.noDataLabel = chart.noDataLabel.destroy();
}
};
/**
* Returns true if there are data points within the plot area now
*/
chartPrototype.hasData = function () {
var chart = this,
series = chart.series,
i = series.length;
while (i--) {
if (series[i].hasData() && !series[i].options.isInternal) {
return true;
}
}
return false;
};
/**
* Show no-data message if there is no data in sight. Otherwise, hide it.
*/
function handleNoData() {
var chart = this;
if (chart.hasData()) {
chart.hideNoData();
} else {
chart.showNoData();
}
}
/**
* Add event listener to handle automatic display of no-data message
*/
chartPrototype.callbacks.push(function (chart) {
H.addEvent(chart, 'load', handleNoData);
H.addEvent(chart, 'redraw', handleNoData);
});
}(Highcharts));

26
web/resource/components/webuploader/README.md

@ -0,0 +1,26 @@
目录说明
========================
```bash
├── Uploader.swf # SWF文件,当使用Flash运行时需要引入。
├── webuploader.js # 完全版本。
├── webuploader.min.js # min版本
├── webuploader.flashonly.js # 只有Flash实现的版本。
├── webuploader.flashonly.min.js # min版本
├── webuploader.html5only.js # 只有Html5实现的版本。
├── webuploader.html5only.min.js # min版本
├── webuploader.noimage.js # 去除图片处理的版本,包括HTML5和FLASH.
├── webuploader.noimage.min.js # min版本
├── webuploader.custom.js # 自定义打包方案,请查看 Gruntfile.js,满足移动端使用。
└── webuploader.custom.min.js # min版本
```
## 示例
请把整个 Git 包下载下来放在 php 服务器下,因为默认提供的文件接受是用 php 编写的,打开 examples 页面便能查看示例效果。
version 0.1.5

BIN
web/resource/components/webuploader/progress.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

BIN
web/resource/images/msg-tab-z25df2d.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

BIN
web/resource/images/music-icon.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

BIN
web/resource/images/noavatar_middle.gif

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

BIN
web/resource/images/nopic-107.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

BIN
web/resource/images/nopic-203.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

BIN
web/resource/images/nopic-account.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 290 B

BIN
web/resource/images/nopic-module.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 340 B

BIN
web/resource/images/nopic-small.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.6 KiB

BIN
web/resource/images/nopic-template.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 142 B

Some files were not shown because too many files changed in this diff

Loading…
Cancel
Save