@ -0,0 +1,199 @@ |
|||
<?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_RichText |
|||
* @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_RichText |
|||
* |
|||
* @category PHPExcel |
|||
* @package PHPExcel_RichText |
|||
* @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) |
|||
*/ |
|||
class PHPExcel_RichText implements PHPExcel_IComparable |
|||
{ |
|||
/** |
|||
* Rich text elements |
|||
* |
|||
* @var PHPExcel_RichText_ITextElement[] |
|||
*/ |
|||
private $_richTextElements; |
|||
|
|||
/** |
|||
* Create a new PHPExcel_RichText instance |
|||
* |
|||
* @param PHPExcel_Cell $pCell |
|||
* @throws PHPExcel_Exception |
|||
*/ |
|||
public function __construct(PHPExcel_Cell $pCell = null) |
|||
{ |
|||
// Initialise variables |
|||
$this->_richTextElements = array(); |
|||
|
|||
// Rich-Text string attached to cell? |
|||
if ($pCell !== NULL) { |
|||
// Add cell text and style |
|||
if ($pCell->getValue() != "") { |
|||
$objRun = new PHPExcel_RichText_Run($pCell->getValue()); |
|||
$objRun->setFont(clone $pCell->getParent()->getStyle($pCell->getCoordinate())->getFont()); |
|||
$this->addText($objRun); |
|||
} |
|||
|
|||
// Set parent value |
|||
$pCell->setValueExplicit($this, PHPExcel_Cell_DataType::TYPE_STRING); |
|||
} |
|||
} |
|||
|
|||
/** |
|||
* Add text |
|||
* |
|||
* @param PHPExcel_RichText_ITextElement $pText Rich text element |
|||
* @throws PHPExcel_Exception |
|||
* @return PHPExcel_RichText |
|||
*/ |
|||
public function addText(PHPExcel_RichText_ITextElement $pText = null) |
|||
{ |
|||
$this->_richTextElements[] = $pText; |
|||
return $this; |
|||
} |
|||
|
|||
/** |
|||
* Create text |
|||
* |
|||
* @param string $pText Text |
|||
* @return PHPExcel_RichText_TextElement |
|||
* @throws PHPExcel_Exception |
|||
*/ |
|||
public function createText($pText = '') |
|||
{ |
|||
$objText = new PHPExcel_RichText_TextElement($pText); |
|||
$this->addText($objText); |
|||
return $objText; |
|||
} |
|||
|
|||
/** |
|||
* Create text run |
|||
* |
|||
* @param string $pText Text |
|||
* @return PHPExcel_RichText_Run |
|||
* @throws PHPExcel_Exception |
|||
*/ |
|||
public function createTextRun($pText = '') |
|||
{ |
|||
$objText = new PHPExcel_RichText_Run($pText); |
|||
$this->addText($objText); |
|||
return $objText; |
|||
} |
|||
|
|||
/** |
|||
* Get plain text |
|||
* |
|||
* @return string |
|||
*/ |
|||
public function getPlainText() |
|||
{ |
|||
// Return value |
|||
$returnValue = ''; |
|||
|
|||
// Loop through all PHPExcel_RichText_ITextElement |
|||
foreach ($this->_richTextElements as $text) { |
|||
$returnValue .= $text->getText(); |
|||
} |
|||
|
|||
// Return |
|||
return $returnValue; |
|||
} |
|||
|
|||
/** |
|||
* Convert to string |
|||
* |
|||
* @return string |
|||
*/ |
|||
public function __toString() |
|||
{ |
|||
return $this->getPlainText(); |
|||
} |
|||
|
|||
/** |
|||
* Get Rich Text elements |
|||
* |
|||
* @return PHPExcel_RichText_ITextElement[] |
|||
*/ |
|||
public function getRichTextElements() |
|||
{ |
|||
return $this->_richTextElements; |
|||
} |
|||
|
|||
/** |
|||
* Set Rich Text elements |
|||
* |
|||
* @param PHPExcel_RichText_ITextElement[] $pElements Array of elements |
|||
* @throws PHPExcel_Exception |
|||
* @return PHPExcel_RichText |
|||
*/ |
|||
public function setRichTextElements($pElements = null) |
|||
{ |
|||
if (is_array($pElements)) { |
|||
$this->_richTextElements = $pElements; |
|||
} else { |
|||
throw new PHPExcel_Exception("Invalid PHPExcel_RichText_ITextElement[] array passed."); |
|||
} |
|||
return $this; |
|||
} |
|||
|
|||
/** |
|||
* Get hash code |
|||
* |
|||
* @return string Hash code |
|||
*/ |
|||
public function getHashCode() |
|||
{ |
|||
$hashElements = ''; |
|||
foreach ($this->_richTextElements as $element) { |
|||
$hashElements .= $element->getHashCode(); |
|||
} |
|||
|
|||
return md5( |
|||
$hashElements |
|||
. __CLASS__ |
|||
); |
|||
} |
|||
|
|||
/** |
|||
* 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; |
|||
} |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,354 @@ |
|||
<?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_Settings |
|||
* @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')) { |
|||
/** |
|||
* @ignore |
|||
*/ |
|||
define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../'); |
|||
require(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php'); |
|||
} |
|||
|
|||
|
|||
class PHPExcel_Settings |
|||
{ |
|||
/** constants */ |
|||
/** Available Zip library classes */ |
|||
const PCLZIP = 'PHPExcel_Shared_ZipArchive'; |
|||
const ZIPARCHIVE = 'ZipArchive'; |
|||
|
|||
/** Optional Chart Rendering libraries */ |
|||
const CHART_RENDERER_JPGRAPH = 'jpgraph'; |
|||
|
|||
/** Optional PDF Rendering libraries */ |
|||
const PDF_RENDERER_TCPDF = 'tcPDF'; |
|||
const PDF_RENDERER_DOMPDF = 'DomPDF'; |
|||
const PDF_RENDERER_MPDF = 'mPDF'; |
|||
|
|||
|
|||
private static $_chartRenderers = array( |
|||
self::CHART_RENDERER_JPGRAPH, |
|||
); |
|||
|
|||
private static $_pdfRenderers = array( |
|||
self::PDF_RENDERER_TCPDF, |
|||
self::PDF_RENDERER_DOMPDF, |
|||
self::PDF_RENDERER_MPDF, |
|||
); |
|||
|
|||
|
|||
/** |
|||
* Name of the class used for Zip file management |
|||
* e.g. |
|||
* ZipArchive |
|||
* |
|||
* @var string |
|||
*/ |
|||
private static $_zipClass = self::ZIPARCHIVE; |
|||
|
|||
|
|||
/** |
|||
* Name of the external Library used for rendering charts |
|||
* e.g. |
|||
* jpgraph |
|||
* |
|||
* @var string |
|||
*/ |
|||
private static $_chartRendererName = NULL; |
|||
|
|||
/** |
|||
* Directory Path to the external Library used for rendering charts |
|||
* |
|||
* @var string |
|||
*/ |
|||
private static $_chartRendererPath = NULL; |
|||
|
|||
|
|||
/** |
|||
* Name of the external Library used for rendering PDF files |
|||
* e.g. |
|||
* mPDF |
|||
* |
|||
* @var string |
|||
*/ |
|||
private static $_pdfRendererName = NULL; |
|||
|
|||
/** |
|||
* Directory Path to the external Library used for rendering PDF files |
|||
* |
|||
* @var string |
|||
*/ |
|||
private static $_pdfRendererPath = NULL; |
|||
|
|||
|
|||
/** |
|||
* Set the Zip handler Class that PHPExcel should use for Zip file management (PCLZip or ZipArchive) |
|||
* |
|||
* @param string $zipClass The Zip handler class that PHPExcel should use for Zip file management |
|||
* e.g. PHPExcel_Settings::PCLZip or PHPExcel_Settings::ZipArchive |
|||
* @return boolean Success or failure |
|||
*/ |
|||
public static function setZipClass($zipClass) |
|||
{ |
|||
if (($zipClass === self::PCLZIP) || |
|||
($zipClass === self::ZIPARCHIVE)) { |
|||
self::$_zipClass = $zipClass; |
|||
return TRUE; |
|||
} |
|||
return FALSE; |
|||
} // function setZipClass() |
|||
|
|||
|
|||
/** |
|||
* Return the name of the Zip handler Class that PHPExcel is configured to use (PCLZip or ZipArchive) |
|||
* or Zip file management |
|||
* |
|||
* @return string Name of the Zip handler Class that PHPExcel is configured to use |
|||
* for Zip file management |
|||
* e.g. PHPExcel_Settings::PCLZip or PHPExcel_Settings::ZipArchive |
|||
*/ |
|||
public static function getZipClass() |
|||
{ |
|||
return self::$_zipClass; |
|||
} // function getZipClass() |
|||
|
|||
|
|||
/** |
|||
* Return the name of the method that is currently configured for cell cacheing |
|||
* |
|||
* @return string Name of the cacheing method |
|||
*/ |
|||
public static function getCacheStorageMethod() |
|||
{ |
|||
return PHPExcel_CachedObjectStorageFactory::getCacheStorageMethod(); |
|||
} // function getCacheStorageMethod() |
|||
|
|||
|
|||
/** |
|||
* Return the name of the class that is currently being used for cell cacheing |
|||
* |
|||
* @return string Name of the class currently being used for cacheing |
|||
*/ |
|||
public static function getCacheStorageClass() |
|||
{ |
|||
return PHPExcel_CachedObjectStorageFactory::getCacheStorageClass(); |
|||
} // function getCacheStorageClass() |
|||
|
|||
|
|||
/** |
|||
* Set the method that should be used for cell cacheing |
|||
* |
|||
* @param string $method Name of the cacheing method |
|||
* @param array $arguments Optional configuration arguments for the cacheing method |
|||
* @return boolean Success or failure |
|||
*/ |
|||
public static function setCacheStorageMethod( |
|||
$method = PHPExcel_CachedObjectStorageFactory::cache_in_memory, |
|||
$arguments = array() |
|||
) |
|||
{ |
|||
return PHPExcel_CachedObjectStorageFactory::initialize($method, $arguments); |
|||
} // function setCacheStorageMethod() |
|||
|
|||
|
|||
/** |
|||
* Set the locale code to use for formula translations and any special formatting |
|||
* |
|||
* @param string $locale The locale code to use (e.g. "fr" or "pt_br" or "en_uk") |
|||
* @return boolean Success or failure |
|||
*/ |
|||
public static function setLocale($locale='en_us') |
|||
{ |
|||
return PHPExcel_Calculation::getInstance()->setLocale($locale); |
|||
} // function setLocale() |
|||
|
|||
|
|||
/** |
|||
* Set details of the external library that PHPExcel should use for rendering charts |
|||
* |
|||
* @param string $libraryName Internal reference name of the library |
|||
* e.g. PHPExcel_Settings::CHART_RENDERER_JPGRAPH |
|||
* @param string $libraryBaseDir Directory path to the library's base folder |
|||
* |
|||
* @return boolean Success or failure |
|||
*/ |
|||
public static function setChartRenderer($libraryName, $libraryBaseDir) |
|||
{ |
|||
if (!self::setChartRendererName($libraryName)) |
|||
return FALSE; |
|||
return self::setChartRendererPath($libraryBaseDir); |
|||
} // function setChartRenderer() |
|||
|
|||
|
|||
/** |
|||
* Identify to PHPExcel the external library to use for rendering charts |
|||
* |
|||
* @param string $libraryName Internal reference name of the library |
|||
* e.g. PHPExcel_Settings::CHART_RENDERER_JPGRAPH |
|||
* |
|||
* @return boolean Success or failure |
|||
*/ |
|||
public static function setChartRendererName($libraryName) |
|||
{ |
|||
if (!in_array($libraryName,self::$_chartRenderers)) { |
|||
return FALSE; |
|||
} |
|||
|
|||
self::$_chartRendererName = $libraryName; |
|||
|
|||
return TRUE; |
|||
} // function setChartRendererName() |
|||
|
|||
|
|||
/** |
|||
* Tell PHPExcel where to find the external library to use for rendering charts |
|||
* |
|||
* @param string $libraryBaseDir Directory path to the library's base folder |
|||
* @return boolean Success or failure |
|||
*/ |
|||
public static function setChartRendererPath($libraryBaseDir) |
|||
{ |
|||
if ((file_exists($libraryBaseDir) === false) || (is_readable($libraryBaseDir) === false)) { |
|||
return FALSE; |
|||
} |
|||
self::$_chartRendererPath = $libraryBaseDir; |
|||
|
|||
return TRUE; |
|||
} // function setChartRendererPath() |
|||
|
|||
|
|||
/** |
|||
* Return the Chart Rendering Library that PHPExcel is currently configured to use (e.g. jpgraph) |
|||
* |
|||
* @return string|NULL Internal reference name of the Chart Rendering Library that PHPExcel is |
|||
* currently configured to use |
|||
* e.g. PHPExcel_Settings::CHART_RENDERER_JPGRAPH |
|||
*/ |
|||
public static function getChartRendererName() |
|||
{ |
|||
return self::$_chartRendererName; |
|||
} // function getChartRendererName() |
|||
|
|||
|
|||
/** |
|||
* Return the directory path to the Chart Rendering Library that PHPExcel is currently configured to use |
|||
* |
|||
* @return string|NULL Directory Path to the Chart Rendering Library that PHPExcel is |
|||
* currently configured to use |
|||
*/ |
|||
public static function getChartRendererPath() |
|||
{ |
|||
return self::$_chartRendererPath; |
|||
} // function getChartRendererPath() |
|||
|
|||
|
|||
/** |
|||
* Set details of the external library that PHPExcel should use for rendering PDF files |
|||
* |
|||
* @param string $libraryName Internal reference name of the library |
|||
* e.g. PHPExcel_Settings::PDF_RENDERER_TCPDF, |
|||
* PHPExcel_Settings::PDF_RENDERER_DOMPDF |
|||
* or PHPExcel_Settings::PDF_RENDERER_MPDF |
|||
* @param string $libraryBaseDir Directory path to the library's base folder |
|||
* |
|||
* @return boolean Success or failure |
|||
*/ |
|||
public static function setPdfRenderer($libraryName, $libraryBaseDir) |
|||
{ |
|||
if (!self::setPdfRendererName($libraryName)) |
|||
return FALSE; |
|||
return self::setPdfRendererPath($libraryBaseDir); |
|||
} // function setPdfRenderer() |
|||
|
|||
|
|||
/** |
|||
* Identify to PHPExcel the external library to use for rendering PDF files |
|||
* |
|||
* @param string $libraryName Internal reference name of the library |
|||
* e.g. PHPExcel_Settings::PDF_RENDERER_TCPDF, |
|||
* PHPExcel_Settings::PDF_RENDERER_DOMPDF |
|||
* or PHPExcel_Settings::PDF_RENDERER_MPDF |
|||
* |
|||
* @return boolean Success or failure |
|||
*/ |
|||
public static function setPdfRendererName($libraryName) |
|||
{ |
|||
if (!in_array($libraryName,self::$_pdfRenderers)) { |
|||
return FALSE; |
|||
} |
|||
|
|||
self::$_pdfRendererName = $libraryName; |
|||
|
|||
return TRUE; |
|||
} // function setPdfRendererName() |
|||
|
|||
|
|||
/** |
|||
* Tell PHPExcel where to find the external library to use for rendering PDF files |
|||
* |
|||
* @param string $libraryBaseDir Directory path to the library's base folder |
|||
* @return boolean Success or failure |
|||
*/ |
|||
public static function setPdfRendererPath($libraryBaseDir) |
|||
{ |
|||
if ((file_exists($libraryBaseDir) === false) || (is_readable($libraryBaseDir) === false)) { |
|||
return FALSE; |
|||
} |
|||
self::$_pdfRendererPath = $libraryBaseDir; |
|||
|
|||
return TRUE; |
|||
} // function setPdfRendererPath() |
|||
|
|||
|
|||
/** |
|||
* Return the PDF Rendering Library that PHPExcel is currently configured to use (e.g. dompdf) |
|||
* |
|||
* @return string|NULL Internal reference name of the PDF Rendering Library that PHPExcel is |
|||
* currently configured to use |
|||
* e.g. PHPExcel_Settings::PDF_RENDERER_TCPDF, |
|||
* PHPExcel_Settings::PDF_RENDERER_DOMPDF |
|||
* or PHPExcel_Settings::PDF_RENDERER_MPDF |
|||
*/ |
|||
public static function getPdfRendererName() |
|||
{ |
|||
return self::$_pdfRendererName; |
|||
} // function getPdfRendererName() |
|||
|
|||
|
|||
/** |
|||
* Return the directory path to the PDF Rendering Library that PHPExcel is currently configured to use |
|||
* |
|||
* @return string|NULL Directory Path to the PDF Rendering Library that PHPExcel is |
|||
* currently configured to use |
|||
*/ |
|||
public static function getPdfRendererPath() |
|||
{ |
|||
return self::$_pdfRendererPath; |
|||
} // function getPdfRendererPath() |
|||
|
|||
} |
|||
@ -0,0 +1,613 @@ |
|||
<?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 |
|||
* |
|||
* @category PHPExcel |
|||
* @package PHPExcel_Style |
|||
* @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) |
|||
*/ |
|||
class PHPExcel_Style extends PHPExcel_Style_Supervisor implements PHPExcel_IComparable |
|||
{ |
|||
/** |
|||
* Font |
|||
* |
|||
* @var PHPExcel_Style_Font |
|||
*/ |
|||
protected $_font; |
|||
|
|||
/** |
|||
* Fill |
|||
* |
|||
* @var PHPExcel_Style_Fill |
|||
*/ |
|||
protected $_fill; |
|||
|
|||
/** |
|||
* Borders |
|||
* |
|||
* @var PHPExcel_Style_Borders |
|||
*/ |
|||
protected $_borders; |
|||
|
|||
/** |
|||
* Alignment |
|||
* |
|||
* @var PHPExcel_Style_Alignment |
|||
*/ |
|||
protected $_alignment; |
|||
|
|||
/** |
|||
* Number Format |
|||
* |
|||
* @var PHPExcel_Style_NumberFormat |
|||
*/ |
|||
protected $_numberFormat; |
|||
|
|||
/** |
|||
* Conditional styles |
|||
* |
|||
* @var PHPExcel_Style_Conditional[] |
|||
*/ |
|||
protected $_conditionalStyles; |
|||
|
|||
/** |
|||
* Protection |
|||
* |
|||
* @var PHPExcel_Style_Protection |
|||
*/ |
|||
protected $_protection; |
|||
|
|||
/** |
|||
* Index of style in collection. Only used for real style. |
|||
* |
|||
* @var int |
|||
*/ |
|||
protected $_index; |
|||
|
|||
/** |
|||
* Create a new PHPExcel_Style |
|||
* |
|||
* @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? |
|||
$this->_isSupervisor = $isSupervisor; |
|||
|
|||
// Initialise values |
|||
$this->_conditionalStyles = array(); |
|||
$this->_font = new PHPExcel_Style_Font($isSupervisor, $isConditional); |
|||
$this->_fill = new PHPExcel_Style_Fill($isSupervisor, $isConditional); |
|||
$this->_borders = new PHPExcel_Style_Borders($isSupervisor, $isConditional); |
|||
$this->_alignment = new PHPExcel_Style_Alignment($isSupervisor, $isConditional); |
|||
$this->_numberFormat = new PHPExcel_Style_NumberFormat($isSupervisor, $isConditional); |
|||
$this->_protection = new PHPExcel_Style_Protection($isSupervisor, $isConditional); |
|||
|
|||
// bind parent if we are a supervisor |
|||
if ($isSupervisor) { |
|||
$this->_font->bindParent($this); |
|||
$this->_fill->bindParent($this); |
|||
$this->_borders->bindParent($this); |
|||
$this->_alignment->bindParent($this); |
|||
$this->_numberFormat->bindParent($this); |
|||
$this->_protection->bindParent($this); |
|||
} |
|||
} |
|||
|
|||
/** |
|||
* Get the shared style component for the currently active cell in currently active sheet. |
|||
* Only used for style supervisor |
|||
* |
|||
* @return PHPExcel_Style |
|||
*/ |
|||
public function getSharedComponent() |
|||
{ |
|||
$activeSheet = $this->getActiveSheet(); |
|||
$selectedCell = $this->getActiveCell(); // e.g. 'A1' |
|||
|
|||
if ($activeSheet->cellExists($selectedCell)) { |
|||
$xfIndex = $activeSheet->getCell($selectedCell)->getXfIndex(); |
|||
} else { |
|||
$xfIndex = 0; |
|||
} |
|||
|
|||
return $this->_parent->getCellXfByIndex($xfIndex); |
|||
} |
|||
|
|||
/** |
|||
* Get parent. Only used for style supervisor |
|||
* |
|||
* @return PHPExcel |
|||
*/ |
|||
public function getParent() |
|||
{ |
|||
return $this->_parent; |
|||
} |
|||
|
|||
/** |
|||
* Apply styles from array |
|||
* |
|||
* <code> |
|||
* $objPHPExcel->getActiveSheet()->getStyle('B2')->applyFromArray( |
|||
* array( |
|||
* 'font' => array( |
|||
* 'name' => 'Arial', |
|||
* 'bold' => true, |
|||
* 'italic' => false, |
|||
* 'underline' => PHPExcel_Style_Font::UNDERLINE_DOUBLE, |
|||
* 'strike' => false, |
|||
* 'color' => array( |
|||
* 'rgb' => '808080' |
|||
* ) |
|||
* ), |
|||
* 'borders' => array( |
|||
* 'bottom' => array( |
|||
* 'style' => PHPExcel_Style_Border::BORDER_DASHDOT, |
|||
* 'color' => array( |
|||
* 'rgb' => '808080' |
|||
* ) |
|||
* ), |
|||
* 'top' => array( |
|||
* 'style' => PHPExcel_Style_Border::BORDER_DASHDOT, |
|||
* 'color' => array( |
|||
* 'rgb' => '808080' |
|||
* ) |
|||
* ) |
|||
* ) |
|||
* ) |
|||
* ); |
|||
* </code> |
|||
* |
|||
* @param array $pStyles Array containing style information |
|||
* @param boolean $pAdvanced Advanced mode for setting borders. |
|||
* @throws PHPExcel_Exception |
|||
* @return PHPExcel_Style |
|||
*/ |
|||
public function applyFromArray($pStyles = null, $pAdvanced = true) |
|||
{ |
|||
if (is_array($pStyles)) { |
|||
if ($this->_isSupervisor) { |
|||
|
|||
$pRange = $this->getSelectedCells(); |
|||
|
|||
// Uppercase coordinate |
|||
$pRange = strtoupper($pRange); |
|||
|
|||
// Is it a cell range or a single cell? |
|||
if (strpos($pRange, ':') === false) { |
|||
$rangeA = $pRange; |
|||
$rangeB = $pRange; |
|||
} else { |
|||
list($rangeA, $rangeB) = explode(':', $pRange); |
|||
} |
|||
|
|||
// Calculate range outer borders |
|||
$rangeStart = PHPExcel_Cell::coordinateFromString($rangeA); |
|||
$rangeEnd = PHPExcel_Cell::coordinateFromString($rangeB); |
|||
|
|||
// Translate column into index |
|||
$rangeStart[0] = PHPExcel_Cell::columnIndexFromString($rangeStart[0]) - 1; |
|||
$rangeEnd[0] = PHPExcel_Cell::columnIndexFromString($rangeEnd[0]) - 1; |
|||
|
|||
// Make sure we can loop upwards on rows and columns |
|||
if ($rangeStart[0] > $rangeEnd[0] && $rangeStart[1] > $rangeEnd[1]) { |
|||
$tmp = $rangeStart; |
|||
$rangeStart = $rangeEnd; |
|||
$rangeEnd = $tmp; |
|||
} |
|||
|
|||
// ADVANCED MODE: |
|||
|
|||
if ($pAdvanced && isset($pStyles['borders'])) { |
|||
|
|||
// 'allborders' is a shorthand property for 'outline' and 'inside' and |
|||
// it applies to components that have not been set explicitly |
|||
if (isset($pStyles['borders']['allborders'])) { |
|||
foreach (array('outline', 'inside') as $component) { |
|||
if (!isset($pStyles['borders'][$component])) { |
|||
$pStyles['borders'][$component] = $pStyles['borders']['allborders']; |
|||
} |
|||
} |
|||
unset($pStyles['borders']['allborders']); // not needed any more |
|||
} |
|||
|
|||
// 'outline' is a shorthand property for 'top', 'right', 'bottom', 'left' |
|||
// it applies to components that have not been set explicitly |
|||
if (isset($pStyles['borders']['outline'])) { |
|||
foreach (array('top', 'right', 'bottom', 'left') as $component) { |
|||
if (!isset($pStyles['borders'][$component])) { |
|||
$pStyles['borders'][$component] = $pStyles['borders']['outline']; |
|||
} |
|||
} |
|||
unset($pStyles['borders']['outline']); // not needed any more |
|||
} |
|||
|
|||
// 'inside' is a shorthand property for 'vertical' and 'horizontal' |
|||
// it applies to components that have not been set explicitly |
|||
if (isset($pStyles['borders']['inside'])) { |
|||
foreach (array('vertical', 'horizontal') as $component) { |
|||
if (!isset($pStyles['borders'][$component])) { |
|||
$pStyles['borders'][$component] = $pStyles['borders']['inside']; |
|||
} |
|||
} |
|||
unset($pStyles['borders']['inside']); // not needed any more |
|||
} |
|||
|
|||
// width and height characteristics of selection, 1, 2, or 3 (for 3 or more) |
|||
$xMax = min($rangeEnd[0] - $rangeStart[0] + 1, 3); |
|||
$yMax = min($rangeEnd[1] - $rangeStart[1] + 1, 3); |
|||
|
|||
// loop through up to 3 x 3 = 9 regions |
|||
for ($x = 1; $x <= $xMax; ++$x) { |
|||
// start column index for region |
|||
$colStart = ($x == 3) ? |
|||
PHPExcel_Cell::stringFromColumnIndex($rangeEnd[0]) |
|||
: PHPExcel_Cell::stringFromColumnIndex($rangeStart[0] + $x - 1); |
|||
|
|||
// end column index for region |
|||
$colEnd = ($x == 1) ? |
|||
PHPExcel_Cell::stringFromColumnIndex($rangeStart[0]) |
|||
: PHPExcel_Cell::stringFromColumnIndex($rangeEnd[0] - $xMax + $x); |
|||
|
|||
for ($y = 1; $y <= $yMax; ++$y) { |
|||
|
|||
// which edges are touching the region |
|||
$edges = array(); |
|||
|
|||
// are we at left edge |
|||
if ($x == 1) { |
|||
$edges[] = 'left'; |
|||
} |
|||
|
|||
// are we at right edge |
|||
if ($x == $xMax) { |
|||
$edges[] = 'right'; |
|||
} |
|||
|
|||
// are we at top edge? |
|||
if ($y == 1) { |
|||
$edges[] = 'top'; |
|||
} |
|||
|
|||
// are we at bottom edge? |
|||
if ($y == $yMax) { |
|||
$edges[] = 'bottom'; |
|||
} |
|||
|
|||
// start row index for region |
|||
$rowStart = ($y == 3) ? |
|||
$rangeEnd[1] : $rangeStart[1] + $y - 1; |
|||
|
|||
// end row index for region |
|||
$rowEnd = ($y == 1) ? |
|||
$rangeStart[1] : $rangeEnd[1] - $yMax + $y; |
|||
|
|||
// build range for region |
|||
$range = $colStart . $rowStart . ':' . $colEnd . $rowEnd; |
|||
|
|||
// retrieve relevant style array for region |
|||
$regionStyles = $pStyles; |
|||
unset($regionStyles['borders']['inside']); |
|||
|
|||
// what are the inner edges of the region when looking at the selection |
|||
$innerEdges = array_diff( array('top', 'right', 'bottom', 'left'), $edges ); |
|||
|
|||
// inner edges that are not touching the region should take the 'inside' border properties if they have been set |
|||
foreach ($innerEdges as $innerEdge) { |
|||
switch ($innerEdge) { |
|||
case 'top': |
|||
case 'bottom': |
|||
// should pick up 'horizontal' border property if set |
|||
if (isset($pStyles['borders']['horizontal'])) { |
|||
$regionStyles['borders'][$innerEdge] = $pStyles['borders']['horizontal']; |
|||
} else { |
|||
unset($regionStyles['borders'][$innerEdge]); |
|||
} |
|||
break; |
|||
case 'left': |
|||
case 'right': |
|||
// should pick up 'vertical' border property if set |
|||
if (isset($pStyles['borders']['vertical'])) { |
|||
$regionStyles['borders'][$innerEdge] = $pStyles['borders']['vertical']; |
|||
} else { |
|||
unset($regionStyles['borders'][$innerEdge]); |
|||
} |
|||
break; |
|||
} |
|||
} |
|||
|
|||
// apply region style to region by calling applyFromArray() in simple mode |
|||
$this->getActiveSheet()->getStyle($range)->applyFromArray($regionStyles, false); |
|||
} |
|||
} |
|||
return $this; |
|||
} |
|||
|
|||
// SIMPLE MODE: |
|||
|
|||
// Selection type, inspect |
|||
if (preg_match('/^[A-Z]+1:[A-Z]+1048576$/', $pRange)) { |
|||
$selectionType = 'COLUMN'; |
|||
} else if (preg_match('/^A[0-9]+:XFD[0-9]+$/', $pRange)) { |
|||
$selectionType = 'ROW'; |
|||
} else { |
|||
$selectionType = 'CELL'; |
|||
} |
|||
|
|||
// First loop through columns, rows, or cells to find out which styles are affected by this operation |
|||
switch ($selectionType) { |
|||
case 'COLUMN': |
|||
$oldXfIndexes = array(); |
|||
for ($col = $rangeStart[0]; $col <= $rangeEnd[0]; ++$col) { |
|||
$oldXfIndexes[$this->getActiveSheet()->getColumnDimensionByColumn($col)->getXfIndex()] = true; |
|||
} |
|||
break; |
|||
|
|||
case 'ROW': |
|||
$oldXfIndexes = array(); |
|||
for ($row = $rangeStart[1]; $row <= $rangeEnd[1]; ++$row) { |
|||
if ($this->getActiveSheet()->getRowDimension($row)->getXfIndex() == null) { |
|||
$oldXfIndexes[0] = true; // row without explicit style should be formatted based on default style |
|||
} else { |
|||
$oldXfIndexes[$this->getActiveSheet()->getRowDimension($row)->getXfIndex()] = true; |
|||
} |
|||
} |
|||
break; |
|||
|
|||
case 'CELL': |
|||
$oldXfIndexes = array(); |
|||
for ($col = $rangeStart[0]; $col <= $rangeEnd[0]; ++$col) { |
|||
for ($row = $rangeStart[1]; $row <= $rangeEnd[1]; ++$row) { |
|||
$oldXfIndexes[$this->getActiveSheet()->getCellByColumnAndRow($col, $row)->getXfIndex()] = true; |
|||
} |
|||
} |
|||
break; |
|||
} |
|||
|
|||
// clone each of the affected styles, apply the style array, and add the new styles to the workbook |
|||
$workbook = $this->getActiveSheet()->getParent(); |
|||
foreach ($oldXfIndexes as $oldXfIndex => $dummy) { |
|||
$style = $workbook->getCellXfByIndex($oldXfIndex); |
|||
$newStyle = clone $style; |
|||
$newStyle->applyFromArray($pStyles); |
|||
|
|||
if ($workbook->cellXfExists($newStyle)) { |
|||
// there is already such cell Xf in our collection |
|||
$newXfIndexes[$oldXfIndex] = $existingStyle->getIndex(); |
|||
} else { |
|||
// we don't have such a cell Xf, need to add |
|||
$workbook->addCellXf($newStyle); |
|||
$newXfIndexes[$oldXfIndex] = $newStyle->getIndex(); |
|||
} |
|||
} |
|||
|
|||
// Loop through columns, rows, or cells again and update the XF index |
|||
switch ($selectionType) { |
|||
case 'COLUMN': |
|||
for ($col = $rangeStart[0]; $col <= $rangeEnd[0]; ++$col) { |
|||
$columnDimension = $this->getActiveSheet()->getColumnDimensionByColumn($col); |
|||
$oldXfIndex = $columnDimension->getXfIndex(); |
|||
$columnDimension->setXfIndex($newXfIndexes[$oldXfIndex]); |
|||
} |
|||
break; |
|||
|
|||
case 'ROW': |
|||
for ($row = $rangeStart[1]; $row <= $rangeEnd[1]; ++$row) { |
|||
$rowDimension = $this->getActiveSheet()->getRowDimension($row); |
|||
$oldXfIndex = $rowDimension->getXfIndex() === null ? |
|||
0 : $rowDimension->getXfIndex(); // row without explicit style should be formatted based on default style |
|||
$rowDimension->setXfIndex($newXfIndexes[$oldXfIndex]); |
|||
} |
|||
break; |
|||
|
|||
case 'CELL': |
|||
for ($col = $rangeStart[0]; $col <= $rangeEnd[0]; ++$col) { |
|||
for ($row = $rangeStart[1]; $row <= $rangeEnd[1]; ++$row) { |
|||
$cell = $this->getActiveSheet()->getCellByColumnAndRow($col, $row); |
|||
$oldXfIndex = $cell->getXfIndex(); |
|||
$cell->setXfIndex($newXfIndexes[$oldXfIndex]); |
|||
} |
|||
} |
|||
break; |
|||
} |
|||
|
|||
} else { |
|||
// not a supervisor, just apply the style array directly on style object |
|||
if (array_key_exists('fill', $pStyles)) { |
|||
$this->getFill()->applyFromArray($pStyles['fill']); |
|||
} |
|||
if (array_key_exists('font', $pStyles)) { |
|||
$this->getFont()->applyFromArray($pStyles['font']); |
|||
} |
|||
if (array_key_exists('borders', $pStyles)) { |
|||
$this->getBorders()->applyFromArray($pStyles['borders']); |
|||
} |
|||
if (array_key_exists('alignment', $pStyles)) { |
|||
$this->getAlignment()->applyFromArray($pStyles['alignment']); |
|||
} |
|||
if (array_key_exists('numberformat', $pStyles)) { |
|||
$this->getNumberFormat()->applyFromArray($pStyles['numberformat']); |
|||
} |
|||
if (array_key_exists('protection', $pStyles)) { |
|||
$this->getProtection()->applyFromArray($pStyles['protection']); |
|||
} |
|||
} |
|||
} else { |
|||
throw new PHPExcel_Exception("Invalid style array passed."); |
|||
} |
|||
return $this; |
|||
} |
|||
|
|||
/** |
|||
* Get Fill |
|||
* |
|||
* @return PHPExcel_Style_Fill |
|||
*/ |
|||
public function getFill() |
|||
{ |
|||
return $this->_fill; |
|||
} |
|||
|
|||
/** |
|||
* Get Font |
|||
* |
|||
* @return PHPExcel_Style_Font |
|||
*/ |
|||
public function getFont() |
|||
{ |
|||
return $this->_font; |
|||
} |
|||
|
|||
/** |
|||
* Set font |
|||
* |
|||
* @param PHPExcel_Style_Font $font |
|||
* @return PHPExcel_Style |
|||
*/ |
|||
public function setFont(PHPExcel_Style_Font $font) |
|||
{ |
|||
$this->_font = $font; |
|||
return $this; |
|||
} |
|||
|
|||
/** |
|||
* Get Borders |
|||
* |
|||
* @return PHPExcel_Style_Borders |
|||
*/ |
|||
public function getBorders() |
|||
{ |
|||
return $this->_borders; |
|||
} |
|||
|
|||
/** |
|||
* Get Alignment |
|||
* |
|||
* @return PHPExcel_Style_Alignment |
|||
*/ |
|||
public function getAlignment() |
|||
{ |
|||
return $this->_alignment; |
|||
} |
|||
|
|||
/** |
|||
* Get Number Format |
|||
* |
|||
* @return PHPExcel_Style_NumberFormat |
|||
*/ |
|||
public function getNumberFormat() |
|||
{ |
|||
return $this->_numberFormat; |
|||
} |
|||
|
|||
/** |
|||
* Get Conditional Styles. Only used on supervisor. |
|||
* |
|||
* @return PHPExcel_Style_Conditional[] |
|||
*/ |
|||
public function getConditionalStyles() |
|||
{ |
|||
return $this->getActiveSheet()->getConditionalStyles($this->getActiveCell()); |
|||
} |
|||
|
|||
/** |
|||
* Set Conditional Styles. Only used on supervisor. |
|||
* |
|||
* @param PHPExcel_Style_Conditional[] $pValue Array of condtional styles |
|||
* @return PHPExcel_Style |
|||
*/ |
|||
public function setConditionalStyles($pValue = null) |
|||
{ |
|||
if (is_array($pValue)) { |
|||
$this->getActiveSheet()->setConditionalStyles($this->getSelectedCells(), $pValue); |
|||
} |
|||
return $this; |
|||
} |
|||
|
|||
/** |
|||
* Get Protection |
|||
* |
|||
* @return PHPExcel_Style_Protection |
|||
*/ |
|||
public function getProtection() |
|||
{ |
|||
return $this->_protection; |
|||
} |
|||
|
|||
/** |
|||
* Get hash code |
|||
* |
|||
* @return string Hash code |
|||
*/ |
|||
public function getHashCode() |
|||
{ |
|||
$hashConditionals = ''; |
|||
foreach ($this->_conditionalStyles as $conditional) { |
|||
$hashConditionals .= $conditional->getHashCode(); |
|||
} |
|||
|
|||
return md5( |
|||
$this->_fill->getHashCode() |
|||
. $this->_font->getHashCode() |
|||
. $this->_borders->getHashCode() |
|||
. $this->_alignment->getHashCode() |
|||
. $this->_numberFormat->getHashCode() |
|||
. $hashConditionals |
|||
. $this->_protection->getHashCode() |
|||
. __CLASS__ |
|||
); |
|||
} |
|||
|
|||
/** |
|||
* Get own index in style collection |
|||
* |
|||
* @return int |
|||
*/ |
|||
public function getIndex() |
|||
{ |
|||
return $this->_index; |
|||
} |
|||
|
|||
/** |
|||
* Set own index in style collection |
|||
* |
|||
* @param int $pValue |
|||
*/ |
|||
public function setIndex($pValue) |
|||
{ |
|||
$this->_index = $pValue; |
|||
} |
|||
|
|||
} |
|||
@ -0,0 +1,132 @@ |
|||
<?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_Supervisor |
|||
* |
|||
* @category PHPExcel |
|||
* @package PHPExcel_Style |
|||
* @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) |
|||
*/ |
|||
abstract class PHPExcel_Style_Supervisor |
|||
{ |
|||
/** |
|||
* Supervisor? |
|||
* |
|||
* @var boolean |
|||
*/ |
|||
protected $_isSupervisor; |
|||
|
|||
/** |
|||
* Parent. Only used for supervisor |
|||
* |
|||
* @var PHPExcel_Style |
|||
*/ |
|||
protected $_parent; |
|||
|
|||
/** |
|||
* Create a new PHPExcel_Style_Alignment |
|||
* |
|||
* @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 |
|||
*/ |
|||
public function __construct($isSupervisor = FALSE) |
|||
{ |
|||
// Supervisor? |
|||
$this->_isSupervisor = $isSupervisor; |
|||
} |
|||
|
|||
/** |
|||
* Bind parent. Only used for supervisor |
|||
* |
|||
* @param PHPExcel $parent |
|||
* @return PHPExcel_Style_Supervisor |
|||
*/ |
|||
public function bindParent($parent, $parentPropertyName=NULL) |
|||
{ |
|||
$this->_parent = $parent; |
|||
return $this; |
|||
} |
|||
|
|||
/** |
|||
* Is this a supervisor or a cell style component? |
|||
* |
|||
* @return boolean |
|||
*/ |
|||
public function getIsSupervisor() |
|||
{ |
|||
return $this->_isSupervisor; |
|||
} |
|||
|
|||
/** |
|||
* Get the currently active sheet. Only used for supervisor |
|||
* |
|||
* @return PHPExcel_Worksheet |
|||
*/ |
|||
public function getActiveSheet() |
|||
{ |
|||
return $this->_parent->getActiveSheet(); |
|||
} |
|||
|
|||
/** |
|||
* Get the currently active cell coordinate in currently active sheet. |
|||
* Only used for supervisor |
|||
* |
|||
* @return string E.g. 'A1' |
|||
*/ |
|||
public function getSelectedCells() |
|||
{ |
|||
return $this->getActiveSheet()->getSelectedCells(); |
|||
} |
|||
|
|||
/** |
|||
* Get the currently active cell coordinate in currently active sheet. |
|||
* Only used for supervisor |
|||
* |
|||
* @return string E.g. 'A1' |
|||
*/ |
|||
public function getActiveCell() |
|||
{ |
|||
return $this->getActiveSheet()->getActiveCell(); |
|||
} |
|||
|
|||
/** |
|||
* 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)) && ($key != '_parent')) { |
|||
$this->$key = clone $value; |
|||
} else { |
|||
$this->$key = $value; |
|||
} |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,464 @@ |
|||
<?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_AutoFilter_Column_Rule |
|||
* |
|||
* @category PHPExcel |
|||
* @package PHPExcel_Worksheet |
|||
* @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) |
|||
*/ |
|||
class PHPExcel_Worksheet_AutoFilter_Column_Rule |
|||
{ |
|||
const AUTOFILTER_RULETYPE_FILTER = 'filter'; |
|||
const AUTOFILTER_RULETYPE_DATEGROUP = 'dateGroupItem'; |
|||
const AUTOFILTER_RULETYPE_CUSTOMFILTER = 'customFilter'; |
|||
const AUTOFILTER_RULETYPE_DYNAMICFILTER = 'dynamicFilter'; |
|||
const AUTOFILTER_RULETYPE_TOPTENFILTER = 'top10Filter'; |
|||
|
|||
private static $_ruleTypes = array( |
|||
// Currently we're not handling |
|||
// colorFilter |
|||
// extLst |
|||
// iconFilter |
|||
self::AUTOFILTER_RULETYPE_FILTER, |
|||
self::AUTOFILTER_RULETYPE_DATEGROUP, |
|||
self::AUTOFILTER_RULETYPE_CUSTOMFILTER, |
|||
self::AUTOFILTER_RULETYPE_DYNAMICFILTER, |
|||
self::AUTOFILTER_RULETYPE_TOPTENFILTER, |
|||
); |
|||
|
|||
const AUTOFILTER_RULETYPE_DATEGROUP_YEAR = 'year'; |
|||
const AUTOFILTER_RULETYPE_DATEGROUP_MONTH = 'month'; |
|||
const AUTOFILTER_RULETYPE_DATEGROUP_DAY = 'day'; |
|||
const AUTOFILTER_RULETYPE_DATEGROUP_HOUR = 'hour'; |
|||
const AUTOFILTER_RULETYPE_DATEGROUP_MINUTE = 'minute'; |
|||
const AUTOFILTER_RULETYPE_DATEGROUP_SECOND = 'second'; |
|||
|
|||
private static $_dateTimeGroups = array( |
|||
self::AUTOFILTER_RULETYPE_DATEGROUP_YEAR, |
|||
self::AUTOFILTER_RULETYPE_DATEGROUP_MONTH, |
|||
self::AUTOFILTER_RULETYPE_DATEGROUP_DAY, |
|||
self::AUTOFILTER_RULETYPE_DATEGROUP_HOUR, |
|||
self::AUTOFILTER_RULETYPE_DATEGROUP_MINUTE, |
|||
self::AUTOFILTER_RULETYPE_DATEGROUP_SECOND, |
|||
); |
|||
|
|||
const AUTOFILTER_RULETYPE_DYNAMIC_YESTERDAY = 'yesterday'; |
|||
const AUTOFILTER_RULETYPE_DYNAMIC_TODAY = 'today'; |
|||
const AUTOFILTER_RULETYPE_DYNAMIC_TOMORROW = 'tomorrow'; |
|||
const AUTOFILTER_RULETYPE_DYNAMIC_YEARTODATE = 'yearToDate'; |
|||
const AUTOFILTER_RULETYPE_DYNAMIC_THISYEAR = 'thisYear'; |
|||
const AUTOFILTER_RULETYPE_DYNAMIC_THISQUARTER = 'thisQuarter'; |
|||
const AUTOFILTER_RULETYPE_DYNAMIC_THISMONTH = 'thisMonth'; |
|||
const AUTOFILTER_RULETYPE_DYNAMIC_THISWEEK = 'thisWeek'; |
|||
const AUTOFILTER_RULETYPE_DYNAMIC_LASTYEAR = 'lastYear'; |
|||
const AUTOFILTER_RULETYPE_DYNAMIC_LASTQUARTER = 'lastQuarter'; |
|||
const AUTOFILTER_RULETYPE_DYNAMIC_LASTMONTH = 'lastMonth'; |
|||
const AUTOFILTER_RULETYPE_DYNAMIC_LASTWEEK = 'lastWeek'; |
|||
const AUTOFILTER_RULETYPE_DYNAMIC_NEXTYEAR = 'nextYear'; |
|||
const AUTOFILTER_RULETYPE_DYNAMIC_NEXTQUARTER = 'nextQuarter'; |
|||
const AUTOFILTER_RULETYPE_DYNAMIC_NEXTMONTH = 'nextMonth'; |
|||
const AUTOFILTER_RULETYPE_DYNAMIC_NEXTWEEK = 'nextWeek'; |
|||
const AUTOFILTER_RULETYPE_DYNAMIC_MONTH_1 = 'M1'; |
|||
const AUTOFILTER_RULETYPE_DYNAMIC_JANUARY = self::AUTOFILTER_RULETYPE_DYNAMIC_MONTH_1; |
|||
const AUTOFILTER_RULETYPE_DYNAMIC_MONTH_2 = 'M2'; |
|||
const AUTOFILTER_RULETYPE_DYNAMIC_FEBRUARY = self::AUTOFILTER_RULETYPE_DYNAMIC_MONTH_2; |
|||
const AUTOFILTER_RULETYPE_DYNAMIC_MONTH_3 = 'M3'; |
|||
const AUTOFILTER_RULETYPE_DYNAMIC_MARCH = self::AUTOFILTER_RULETYPE_DYNAMIC_MONTH_3; |
|||
const AUTOFILTER_RULETYPE_DYNAMIC_MONTH_4 = 'M4'; |
|||
const AUTOFILTER_RULETYPE_DYNAMIC_APRIL = self::AUTOFILTER_RULETYPE_DYNAMIC_MONTH_4; |
|||
const AUTOFILTER_RULETYPE_DYNAMIC_MONTH_5 = 'M5'; |
|||
const AUTOFILTER_RULETYPE_DYNAMIC_MAY = self::AUTOFILTER_RULETYPE_DYNAMIC_MONTH_5; |
|||
const AUTOFILTER_RULETYPE_DYNAMIC_MONTH_6 = 'M6'; |
|||
const AUTOFILTER_RULETYPE_DYNAMIC_JUNE = self::AUTOFILTER_RULETYPE_DYNAMIC_MONTH_6; |
|||
const AUTOFILTER_RULETYPE_DYNAMIC_MONTH_7 = 'M7'; |
|||
const AUTOFILTER_RULETYPE_DYNAMIC_JULY = self::AUTOFILTER_RULETYPE_DYNAMIC_MONTH_7; |
|||
const AUTOFILTER_RULETYPE_DYNAMIC_MONTH_8 = 'M8'; |
|||
const AUTOFILTER_RULETYPE_DYNAMIC_AUGUST = self::AUTOFILTER_RULETYPE_DYNAMIC_MONTH_8; |
|||
const AUTOFILTER_RULETYPE_DYNAMIC_MONTH_9 = 'M9'; |
|||
const AUTOFILTER_RULETYPE_DYNAMIC_SEPTEMBER = self::AUTOFILTER_RULETYPE_DYNAMIC_MONTH_9; |
|||
const AUTOFILTER_RULETYPE_DYNAMIC_MONTH_10 = 'M10'; |
|||
const AUTOFILTER_RULETYPE_DYNAMIC_OCTOBER = self::AUTOFILTER_RULETYPE_DYNAMIC_MONTH_10; |
|||
const AUTOFILTER_RULETYPE_DYNAMIC_MONTH_11 = 'M11'; |
|||
const AUTOFILTER_RULETYPE_DYNAMIC_NOVEMBER = self::AUTOFILTER_RULETYPE_DYNAMIC_MONTH_11; |
|||
const AUTOFILTER_RULETYPE_DYNAMIC_MONTH_12 = 'M12'; |
|||
const AUTOFILTER_RULETYPE_DYNAMIC_DECEMBER = self::AUTOFILTER_RULETYPE_DYNAMIC_MONTH_12; |
|||
const AUTOFILTER_RULETYPE_DYNAMIC_QUARTER_1 = 'Q1'; |
|||
const AUTOFILTER_RULETYPE_DYNAMIC_QUARTER_2 = 'Q2'; |
|||
const AUTOFILTER_RULETYPE_DYNAMIC_QUARTER_3 = 'Q3'; |
|||
const AUTOFILTER_RULETYPE_DYNAMIC_QUARTER_4 = 'Q4'; |
|||
const AUTOFILTER_RULETYPE_DYNAMIC_ABOVEAVERAGE = 'aboveAverage'; |
|||
const AUTOFILTER_RULETYPE_DYNAMIC_BELOWAVERAGE = 'belowAverage'; |
|||
|
|||
private static $_dynamicTypes = array( |
|||
self::AUTOFILTER_RULETYPE_DYNAMIC_YESTERDAY, |
|||
self::AUTOFILTER_RULETYPE_DYNAMIC_TODAY, |
|||
self::AUTOFILTER_RULETYPE_DYNAMIC_TOMORROW, |
|||
self::AUTOFILTER_RULETYPE_DYNAMIC_YEARTODATE, |
|||
self::AUTOFILTER_RULETYPE_DYNAMIC_THISYEAR, |
|||
self::AUTOFILTER_RULETYPE_DYNAMIC_THISQUARTER, |
|||
self::AUTOFILTER_RULETYPE_DYNAMIC_THISMONTH, |
|||
self::AUTOFILTER_RULETYPE_DYNAMIC_THISWEEK, |
|||
self::AUTOFILTER_RULETYPE_DYNAMIC_LASTYEAR, |
|||
self::AUTOFILTER_RULETYPE_DYNAMIC_LASTQUARTER, |
|||
self::AUTOFILTER_RULETYPE_DYNAMIC_LASTMONTH, |
|||
self::AUTOFILTER_RULETYPE_DYNAMIC_LASTWEEK, |
|||
self::AUTOFILTER_RULETYPE_DYNAMIC_NEXTYEAR, |
|||
self::AUTOFILTER_RULETYPE_DYNAMIC_NEXTQUARTER, |
|||
self::AUTOFILTER_RULETYPE_DYNAMIC_NEXTMONTH, |
|||
self::AUTOFILTER_RULETYPE_DYNAMIC_NEXTWEEK, |
|||
self::AUTOFILTER_RULETYPE_DYNAMIC_MONTH_1, |
|||
self::AUTOFILTER_RULETYPE_DYNAMIC_MONTH_2, |
|||
self::AUTOFILTER_RULETYPE_DYNAMIC_MONTH_3, |
|||
self::AUTOFILTER_RULETYPE_DYNAMIC_MONTH_4, |
|||
self::AUTOFILTER_RULETYPE_DYNAMIC_MONTH_5, |
|||
self::AUTOFILTER_RULETYPE_DYNAMIC_MONTH_6, |
|||
self::AUTOFILTER_RULETYPE_DYNAMIC_MONTH_7, |
|||
self::AUTOFILTER_RULETYPE_DYNAMIC_MONTH_8, |
|||
self::AUTOFILTER_RULETYPE_DYNAMIC_MONTH_9, |
|||
self::AUTOFILTER_RULETYPE_DYNAMIC_MONTH_10, |
|||
self::AUTOFILTER_RULETYPE_DYNAMIC_MONTH_11, |
|||
self::AUTOFILTER_RULETYPE_DYNAMIC_MONTH_12, |
|||
self::AUTOFILTER_RULETYPE_DYNAMIC_QUARTER_1, |
|||
self::AUTOFILTER_RULETYPE_DYNAMIC_QUARTER_2, |
|||
self::AUTOFILTER_RULETYPE_DYNAMIC_QUARTER_3, |
|||
self::AUTOFILTER_RULETYPE_DYNAMIC_QUARTER_4, |
|||
self::AUTOFILTER_RULETYPE_DYNAMIC_ABOVEAVERAGE, |
|||
self::AUTOFILTER_RULETYPE_DYNAMIC_BELOWAVERAGE, |
|||
); |
|||
|
|||
/* |
|||
* The only valid filter rule operators for filter and customFilter types are: |
|||
* <xsd:enumeration value="equal"/> |
|||
* <xsd:enumeration value="lessThan"/> |
|||
* <xsd:enumeration value="lessThanOrEqual"/> |
|||
* <xsd:enumeration value="notEqual"/> |
|||
* <xsd:enumeration value="greaterThanOrEqual"/> |
|||
* <xsd:enumeration value="greaterThan"/> |
|||
*/ |
|||
const AUTOFILTER_COLUMN_RULE_EQUAL = 'equal'; |
|||
const AUTOFILTER_COLUMN_RULE_NOTEQUAL = 'notEqual'; |
|||
const AUTOFILTER_COLUMN_RULE_GREATERTHAN = 'greaterThan'; |
|||
const AUTOFILTER_COLUMN_RULE_GREATERTHANOREQUAL = 'greaterThanOrEqual'; |
|||
const AUTOFILTER_COLUMN_RULE_LESSTHAN = 'lessThan'; |
|||
const AUTOFILTER_COLUMN_RULE_LESSTHANOREQUAL = 'lessThanOrEqual'; |
|||
|
|||
private static $_operators = array( |
|||
self::AUTOFILTER_COLUMN_RULE_EQUAL, |
|||
self::AUTOFILTER_COLUMN_RULE_NOTEQUAL, |
|||
self::AUTOFILTER_COLUMN_RULE_GREATERTHAN, |
|||
self::AUTOFILTER_COLUMN_RULE_GREATERTHANOREQUAL, |
|||
self::AUTOFILTER_COLUMN_RULE_LESSTHAN, |
|||
self::AUTOFILTER_COLUMN_RULE_LESSTHANOREQUAL, |
|||
); |
|||
|
|||
const AUTOFILTER_COLUMN_RULE_TOPTEN_BY_VALUE = 'byValue'; |
|||
const AUTOFILTER_COLUMN_RULE_TOPTEN_PERCENT = 'byPercent'; |
|||
|
|||
private static $_topTenValue = array( |
|||
self::AUTOFILTER_COLUMN_RULE_TOPTEN_BY_VALUE, |
|||
self::AUTOFILTER_COLUMN_RULE_TOPTEN_PERCENT, |
|||
); |
|||
|
|||
const AUTOFILTER_COLUMN_RULE_TOPTEN_TOP = 'top'; |
|||
const AUTOFILTER_COLUMN_RULE_TOPTEN_BOTTOM = 'bottom'; |
|||
|
|||
private static $_topTenType = array( |
|||
self::AUTOFILTER_COLUMN_RULE_TOPTEN_TOP, |
|||
self::AUTOFILTER_COLUMN_RULE_TOPTEN_BOTTOM, |
|||
); |
|||
|
|||
|
|||
/* Rule Operators (Numeric, Boolean etc) */ |
|||
// const AUTOFILTER_COLUMN_RULE_BETWEEN = 'between'; // greaterThanOrEqual 1 && lessThanOrEqual 2 |
|||
/* Rule Operators (Numeric Special) which are translated to standard numeric operators with calculated values */ |
|||
// const AUTOFILTER_COLUMN_RULE_TOPTEN = 'topTen'; // greaterThan calculated value |
|||
// const AUTOFILTER_COLUMN_RULE_TOPTENPERCENT = 'topTenPercent'; // greaterThan calculated value |
|||
// const AUTOFILTER_COLUMN_RULE_ABOVEAVERAGE = 'aboveAverage'; // Value is calculated as the average |
|||
// const AUTOFILTER_COLUMN_RULE_BELOWAVERAGE = 'belowAverage'; // Value is calculated as the average |
|||
/* Rule Operators (String) which are set as wild-carded values */ |
|||
// const AUTOFILTER_COLUMN_RULE_BEGINSWITH = 'beginsWith'; // A* |
|||
// const AUTOFILTER_COLUMN_RULE_ENDSWITH = 'endsWith'; // *Z |
|||
// const AUTOFILTER_COLUMN_RULE_CONTAINS = 'contains'; // *B* |
|||
// const AUTOFILTER_COLUMN_RULE_DOESNTCONTAIN = 'notEqual'; // notEqual *B* |
|||
/* Rule Operators (Date Special) which are translated to standard numeric operators with calculated values */ |
|||
// const AUTOFILTER_COLUMN_RULE_BEFORE = 'lessThan'; |
|||
// const AUTOFILTER_COLUMN_RULE_AFTER = 'greaterThan'; |
|||
// const AUTOFILTER_COLUMN_RULE_YESTERDAY = 'yesterday'; |
|||
// const AUTOFILTER_COLUMN_RULE_TODAY = 'today'; |
|||
// const AUTOFILTER_COLUMN_RULE_TOMORROW = 'tomorrow'; |
|||
// const AUTOFILTER_COLUMN_RULE_LASTWEEK = 'lastWeek'; |
|||
// const AUTOFILTER_COLUMN_RULE_THISWEEK = 'thisWeek'; |
|||
// const AUTOFILTER_COLUMN_RULE_NEXTWEEK = 'nextWeek'; |
|||
// const AUTOFILTER_COLUMN_RULE_LASTMONTH = 'lastMonth'; |
|||
// const AUTOFILTER_COLUMN_RULE_THISMONTH = 'thisMonth'; |
|||
// const AUTOFILTER_COLUMN_RULE_NEXTMONTH = 'nextMonth'; |
|||
// const AUTOFILTER_COLUMN_RULE_LASTQUARTER = 'lastQuarter'; |
|||
// const AUTOFILTER_COLUMN_RULE_THISQUARTER = 'thisQuarter'; |
|||
// const AUTOFILTER_COLUMN_RULE_NEXTQUARTER = 'nextQuarter'; |
|||
// const AUTOFILTER_COLUMN_RULE_LASTYEAR = 'lastYear'; |
|||
// const AUTOFILTER_COLUMN_RULE_THISYEAR = 'thisYear'; |
|||
// const AUTOFILTER_COLUMN_RULE_NEXTYEAR = 'nextYear'; |
|||
// const AUTOFILTER_COLUMN_RULE_YEARTODATE = 'yearToDate'; // <dynamicFilter val="40909" type="yearToDate" maxVal="41113"/> |
|||
// const AUTOFILTER_COLUMN_RULE_ALLDATESINMONTH = 'allDatesInMonth'; // <dynamicFilter type="M2"/> for Month/February |
|||
// const AUTOFILTER_COLUMN_RULE_ALLDATESINQUARTER = 'allDatesInQuarter'; // <dynamicFilter type="Q2"/> for Quarter 2 |
|||
|
|||
/** |
|||
* Autofilter Column |
|||
* |
|||
* @var PHPExcel_Worksheet_AutoFilter_Column |
|||
*/ |
|||
private $_parent = NULL; |
|||
|
|||
|
|||
/** |
|||
* Autofilter Rule Type |
|||
* |
|||
* @var string |
|||
*/ |
|||
private $_ruleType = self::AUTOFILTER_RULETYPE_FILTER; |
|||
|
|||
|
|||
/** |
|||
* Autofilter Rule Value |
|||
* |
|||
* @var string |
|||
*/ |
|||
private $_value = ''; |
|||
|
|||
/** |
|||
* Autofilter Rule Operator |
|||
* |
|||
* @var string |
|||
*/ |
|||
private $_operator = ''; |
|||
|
|||
/** |
|||
* DateTimeGrouping Group Value |
|||
* |
|||
* @var string |
|||
*/ |
|||
private $_grouping = ''; |
|||
|
|||
|
|||
/** |
|||
* Create a new PHPExcel_Worksheet_AutoFilter_Column_Rule |
|||
* |
|||
* @param PHPExcel_Worksheet_AutoFilter_Column $pParent |
|||
*/ |
|||
public function __construct(PHPExcel_Worksheet_AutoFilter_Column $pParent = NULL) |
|||
{ |
|||
$this->_parent = $pParent; |
|||
} |
|||
|
|||
/** |
|||
* Get AutoFilter Rule Type |
|||
* |
|||
* @return string |
|||
*/ |
|||
public function getRuleType() { |
|||
return $this->_ruleType; |
|||
} |
|||
|
|||
/** |
|||
* Set AutoFilter Rule Type |
|||
* |
|||
* @param string $pRuleType |
|||
* @throws PHPExcel_Exception |
|||
* @return PHPExcel_Worksheet_AutoFilter_Column |
|||
*/ |
|||
public function setRuleType($pRuleType = self::AUTOFILTER_RULETYPE_FILTER) { |
|||
if (!in_array($pRuleType,self::$_ruleTypes)) { |
|||
throw new PHPExcel_Exception('Invalid rule type for column AutoFilter Rule.'); |
|||
} |
|||
|
|||
$this->_ruleType = $pRuleType; |
|||
|
|||
return $this; |
|||
} |
|||
|
|||
/** |
|||
* Get AutoFilter Rule Value |
|||
* |
|||
* @return string |
|||
*/ |
|||
public function getValue() { |
|||
return $this->_value; |
|||
} |
|||
|
|||
/** |
|||
* Set AutoFilter Rule Value |
|||
* |
|||
* @param string|string[] $pValue |
|||
* @throws PHPExcel_Exception |
|||
* @return PHPExcel_Worksheet_AutoFilter_Column_Rule |
|||
*/ |
|||
public function setValue($pValue = '') { |
|||
if (is_array($pValue)) { |
|||
$grouping = -1; |
|||
foreach($pValue as $key => $value) { |
|||
// Validate array entries |
|||
if (!in_array($key,self::$_dateTimeGroups)) { |
|||
// Remove any invalid entries from the value array |
|||
unset($pValue[$key]); |
|||
} else { |
|||
// Work out what the dateTime grouping will be |
|||
$grouping = max($grouping,array_search($key,self::$_dateTimeGroups)); |
|||
} |
|||
} |
|||
if (count($pValue) == 0) { |
|||
throw new PHPExcel_Exception('Invalid rule value for column AutoFilter Rule.'); |
|||
} |
|||
// Set the dateTime grouping that we've anticipated |
|||
$this->setGrouping(self::$_dateTimeGroups[$grouping]); |
|||
} |
|||
$this->_value = $pValue; |
|||
|
|||
return $this; |
|||
} |
|||
|
|||
/** |
|||
* Get AutoFilter Rule Operator |
|||
* |
|||
* @return string |
|||
*/ |
|||
public function getOperator() { |
|||
return $this->_operator; |
|||
} |
|||
|
|||
/** |
|||
* Set AutoFilter Rule Operator |
|||
* |
|||
* @param string $pOperator |
|||
* @throws PHPExcel_Exception |
|||
* @return PHPExcel_Worksheet_AutoFilter_Column_Rule |
|||
*/ |
|||
public function setOperator($pOperator = self::AUTOFILTER_COLUMN_RULE_EQUAL) { |
|||
if (empty($pOperator)) |
|||
$pOperator = self::AUTOFILTER_COLUMN_RULE_EQUAL; |
|||
if ((!in_array($pOperator,self::$_operators)) && |
|||
(!in_array($pOperator,self::$_topTenValue))) { |
|||
throw new PHPExcel_Exception('Invalid operator for column AutoFilter Rule.'); |
|||
} |
|||
$this->_operator = $pOperator; |
|||
|
|||
return $this; |
|||
} |
|||
|
|||
/** |
|||
* Get AutoFilter Rule Grouping |
|||
* |
|||
* @return string |
|||
*/ |
|||
public function getGrouping() { |
|||
return $this->_grouping; |
|||
} |
|||
|
|||
/** |
|||
* Set AutoFilter Rule Grouping |
|||
* |
|||
* @param string $pGrouping |
|||
* @throws PHPExcel_Exception |
|||
* @return PHPExcel_Worksheet_AutoFilter_Column_Rule |
|||
*/ |
|||
public function setGrouping($pGrouping = NULL) { |
|||
if (($pGrouping !== NULL) && |
|||
(!in_array($pGrouping,self::$_dateTimeGroups)) && |
|||
(!in_array($pGrouping,self::$_dynamicTypes)) && |
|||
(!in_array($pGrouping,self::$_topTenType))) { |
|||
throw new PHPExcel_Exception('Invalid rule type for column AutoFilter Rule.'); |
|||
} |
|||
|
|||
$this->_grouping = $pGrouping; |
|||
|
|||
return $this; |
|||
} |
|||
|
|||
/** |
|||
* Set AutoFilter Rule |
|||
* |
|||
* @param string $pOperator |
|||
* @param string|string[] $pValue |
|||
* @param string $pGrouping |
|||
* @throws PHPExcel_Exception |
|||
* @return PHPExcel_Worksheet_AutoFilter_Column_Rule |
|||
*/ |
|||
public function setRule($pOperator = self::AUTOFILTER_COLUMN_RULE_EQUAL, $pValue = '', $pGrouping = NULL) { |
|||
$this->setOperator($pOperator); |
|||
$this->setValue($pValue); |
|||
// Only set grouping if it's been passed in as a user-supplied argument, |
|||
// otherwise we're calculating it when we setValue() and don't want to overwrite that |
|||
// If the user supplies an argumnet for grouping, then on their own head be it |
|||
if ($pGrouping !== NULL) |
|||
$this->setGrouping($pGrouping); |
|||
|
|||
return $this; |
|||
} |
|||
|
|||
/** |
|||
* Get this Rule's AutoFilter Column Parent |
|||
* |
|||
* @return PHPExcel_Worksheet_AutoFilter_Column |
|||
*/ |
|||
public function getParent() { |
|||
return $this->_parent; |
|||
} |
|||
|
|||
/** |
|||
* Set this Rule's AutoFilter Column Parent |
|||
* |
|||
* @param PHPExcel_Worksheet_AutoFilter_Column |
|||
* @return PHPExcel_Worksheet_AutoFilter_Column_Rule |
|||
*/ |
|||
public function setParent(PHPExcel_Worksheet_AutoFilter_Column $pParent = NULL) { |
|||
$this->_parent = $pParent; |
|||
|
|||
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)) { |
|||
if ($key == '_parent') { |
|||
// Detach from autofilter column parent |
|||
$this->$key = NULL; |
|||
} else { |
|||
$this->$key = clone $value; |
|||
} |
|||
} else { |
|||
$this->$key = $value; |
|||
} |
|||
} |
|||
} |
|||
|
|||
} |
|||
@ -0,0 +1,288 @@ |
|||
<?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_Drawing |
|||
* @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_Drawing_Shadow |
|||
* |
|||
* @category PHPExcel |
|||
* @package PHPExcel_Worksheet_Drawing |
|||
* @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) |
|||
*/ |
|||
class PHPExcel_Worksheet_Drawing_Shadow implements PHPExcel_IComparable |
|||
{ |
|||
/* Shadow alignment */ |
|||
const SHADOW_BOTTOM = 'b'; |
|||
const SHADOW_BOTTOM_LEFT = 'bl'; |
|||
const SHADOW_BOTTOM_RIGHT = 'br'; |
|||
const SHADOW_CENTER = 'ctr'; |
|||
const SHADOW_LEFT = 'l'; |
|||
const SHADOW_TOP = 't'; |
|||
const SHADOW_TOP_LEFT = 'tl'; |
|||
const SHADOW_TOP_RIGHT = 'tr'; |
|||
|
|||
/** |
|||
* Visible |
|||
* |
|||
* @var boolean |
|||
*/ |
|||
private $_visible; |
|||
|
|||
/** |
|||
* Blur radius |
|||
* |
|||
* Defaults to 6 |
|||
* |
|||
* @var int |
|||
*/ |
|||
private $_blurRadius; |
|||
|
|||
/** |
|||
* Shadow distance |
|||
* |
|||
* Defaults to 2 |
|||
* |
|||
* @var int |
|||
*/ |
|||
private $_distance; |
|||
|
|||
/** |
|||
* Shadow direction (in degrees) |
|||
* |
|||
* @var int |
|||
*/ |
|||
private $_direction; |
|||
|
|||
/** |
|||
* Shadow alignment |
|||
* |
|||
* @var int |
|||
*/ |
|||
private $_alignment; |
|||
|
|||
/** |
|||
* Color |
|||
* |
|||
* @var PHPExcel_Style_Color |
|||
*/ |
|||
private $_color; |
|||
|
|||
/** |
|||
* Alpha |
|||
* |
|||
* @var int |
|||
*/ |
|||
private $_alpha; |
|||
|
|||
/** |
|||
* Create a new PHPExcel_Worksheet_Drawing_Shadow |
|||
*/ |
|||
public function __construct() |
|||
{ |
|||
// Initialise values |
|||
$this->_visible = false; |
|||
$this->_blurRadius = 6; |
|||
$this->_distance = 2; |
|||
$this->_direction = 0; |
|||
$this->_alignment = PHPExcel_Worksheet_Drawing_Shadow::SHADOW_BOTTOM_RIGHT; |
|||
$this->_color = new PHPExcel_Style_Color(PHPExcel_Style_Color::COLOR_BLACK); |
|||
$this->_alpha = 50; |
|||
} |
|||
|
|||
/** |
|||
* Get Visible |
|||
* |
|||
* @return boolean |
|||
*/ |
|||
public function getVisible() { |
|||
return $this->_visible; |
|||
} |
|||
|
|||
/** |
|||
* Set Visible |
|||
* |
|||
* @param boolean $pValue |
|||
* @return PHPExcel_Worksheet_Drawing_Shadow |
|||
*/ |
|||
public function setVisible($pValue = false) { |
|||
$this->_visible = $pValue; |
|||
return $this; |
|||
} |
|||
|
|||
/** |
|||
* Get Blur radius |
|||
* |
|||
* @return int |
|||
*/ |
|||
public function getBlurRadius() { |
|||
return $this->_blurRadius; |
|||
} |
|||
|
|||
/** |
|||
* Set Blur radius |
|||
* |
|||
* @param int $pValue |
|||
* @return PHPExcel_Worksheet_Drawing_Shadow |
|||
*/ |
|||
public function setBlurRadius($pValue = 6) { |
|||
$this->_blurRadius = $pValue; |
|||
return $this; |
|||
} |
|||
|
|||
/** |
|||
* Get Shadow distance |
|||
* |
|||
* @return int |
|||
*/ |
|||
public function getDistance() { |
|||
return $this->_distance; |
|||
} |
|||
|
|||
/** |
|||
* Set Shadow distance |
|||
* |
|||
* @param int $pValue |
|||
* @return PHPExcel_Worksheet_Drawing_Shadow |
|||
*/ |
|||
public function setDistance($pValue = 2) { |
|||
$this->_distance = $pValue; |
|||
return $this; |
|||
} |
|||
|
|||
/** |
|||
* Get Shadow direction (in degrees) |
|||
* |
|||
* @return int |
|||
*/ |
|||
public function getDirection() { |
|||
return $this->_direction; |
|||
} |
|||
|
|||
/** |
|||
* Set Shadow direction (in degrees) |
|||
* |
|||
* @param int $pValue |
|||
* @return PHPExcel_Worksheet_Drawing_Shadow |
|||
*/ |
|||
public function setDirection($pValue = 0) { |
|||
$this->_direction = $pValue; |
|||
return $this; |
|||
} |
|||
|
|||
/** |
|||
* Get Shadow alignment |
|||
* |
|||
* @return int |
|||
*/ |
|||
public function getAlignment() { |
|||
return $this->_alignment; |
|||
} |
|||
|
|||
/** |
|||
* Set Shadow alignment |
|||
* |
|||
* @param int $pValue |
|||
* @return PHPExcel_Worksheet_Drawing_Shadow |
|||
*/ |
|||
public function setAlignment($pValue = 0) { |
|||
$this->_alignment = $pValue; |
|||
return $this; |
|||
} |
|||
|
|||
/** |
|||
* Get Color |
|||
* |
|||
* @return PHPExcel_Style_Color |
|||
*/ |
|||
public function getColor() { |
|||
return $this->_color; |
|||
} |
|||
|
|||
/** |
|||
* Set Color |
|||
* |
|||
* @param PHPExcel_Style_Color $pValue |
|||
* @throws PHPExcel_Exception |
|||
* @return PHPExcel_Worksheet_Drawing_Shadow |
|||
*/ |
|||
public function setColor(PHPExcel_Style_Color $pValue = null) { |
|||
$this->_color = $pValue; |
|||
return $this; |
|||
} |
|||
|
|||
/** |
|||
* Get Alpha |
|||
* |
|||
* @return int |
|||
*/ |
|||
public function getAlpha() { |
|||
return $this->_alpha; |
|||
} |
|||
|
|||
/** |
|||
* Set Alpha |
|||
* |
|||
* @param int $pValue |
|||
* @return PHPExcel_Worksheet_Drawing_Shadow |
|||
*/ |
|||
public function setAlpha($pValue = 0) { |
|||
$this->_alpha = $pValue; |
|||
return $this; |
|||
} |
|||
|
|||
/** |
|||
* Get hash code |
|||
* |
|||
* @return string Hash code |
|||
*/ |
|||
public function getHashCode() { |
|||
return md5( |
|||
($this->_visible ? 't' : 'f') |
|||
. $this->_blurRadius |
|||
. $this->_distance |
|||
. $this->_direction |
|||
. $this->_alignment |
|||
. $this->_color->getHashCode() |
|||
. $this->_alpha |
|||
. __CLASS__ |
|||
); |
|||
} |
|||
|
|||
/** |
|||
* 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; |
|||
} |
|||
} |
|||
} |
|||
} |
|||
@ -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_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_Row |
|||
* |
|||
* Represents a row in PHPExcel_Worksheet, used by PHPExcel_Worksheet_RowIterator |
|||
* |
|||
* @category PHPExcel |
|||
* @package PHPExcel_Worksheet |
|||
* @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) |
|||
*/ |
|||
class PHPExcel_Worksheet_Row |
|||
{ |
|||
/** |
|||
* PHPExcel_Worksheet |
|||
* |
|||
* @var PHPExcel_Worksheet |
|||
*/ |
|||
private $_parent; |
|||
|
|||
/** |
|||
* Row index |
|||
* |
|||
* @var int |
|||
*/ |
|||
private $_rowIndex = 0; |
|||
|
|||
/** |
|||
* Create a new row |
|||
* |
|||
* @param PHPExcel_Worksheet $parent |
|||
* @param int $rowIndex |
|||
*/ |
|||
public function __construct(PHPExcel_Worksheet $parent = null, $rowIndex = 1) { |
|||
// Set parent and row index |
|||
$this->_parent = $parent; |
|||
$this->_rowIndex = $rowIndex; |
|||
} |
|||
|
|||
/** |
|||
* Destructor |
|||
*/ |
|||
public function __destruct() { |
|||
unset($this->_parent); |
|||
} |
|||
|
|||
/** |
|||
* Get row index |
|||
* |
|||
* @return int |
|||
*/ |
|||
public function getRowIndex() { |
|||
return $this->_rowIndex; |
|||
} |
|||
|
|||
/** |
|||
* Get cell iterator |
|||
* |
|||
* @return PHPExcel_Worksheet_CellIterator |
|||
*/ |
|||
public function getCellIterator() { |
|||
return new PHPExcel_Worksheet_CellIterator($this->_parent, $this->_rowIndex); |
|||
} |
|||
} |
|||
@ -0,0 +1,225 @@ |
|||
<?php |
|||
|
|||
/** |
|||
* PHPExcel_Worksheet_RowCellIterator |
|||
* |
|||
* 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_Worksheet |
|||
* @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_Worksheet_RowCellIterator extends PHPExcel_Worksheet_CellIterator implements Iterator |
|||
{ |
|||
/** |
|||
* Row index |
|||
* |
|||
* @var int |
|||
*/ |
|||
protected $rowIndex; |
|||
|
|||
/** |
|||
* Start position |
|||
* |
|||
* @var int |
|||
*/ |
|||
protected $startColumn = 0; |
|||
|
|||
/** |
|||
* End position |
|||
* |
|||
* @var int |
|||
*/ |
|||
protected $endColumn = 0; |
|||
|
|||
/** |
|||
* Create a new column iterator |
|||
* |
|||
* @param PHPExcel_Worksheet $subject The worksheet to iterate over |
|||
* @param integer $rowIndex The row that we want to iterate |
|||
* @param string $startColumn The column address at which to start iterating |
|||
* @param string $endColumn Optionally, the column address at which to stop iterating |
|||
*/ |
|||
public function __construct(PHPExcel_Worksheet $subject = null, $rowIndex = 1, $startColumn = 'A', $endColumn = null) |
|||
{ |
|||
// Set subject and row index |
|||
$this->subject = $subject; |
|||
$this->rowIndex = $rowIndex; |
|||
$this->resetEnd($endColumn); |
|||
$this->resetStart($startColumn); |
|||
} |
|||
|
|||
/** |
|||
* Destructor |
|||
*/ |
|||
public function __destruct() |
|||
{ |
|||
unset($this->subject); |
|||
} |
|||
|
|||
/** |
|||
* (Re)Set the start column and the current column pointer |
|||
* |
|||
* @param integer $startColumn The column address at which to start iterating |
|||
* @return PHPExcel_Worksheet_RowCellIterator |
|||
* @throws PHPExcel_Exception |
|||
*/ |
|||
public function resetStart($startColumn = 'A') |
|||
{ |
|||
$startColumnIndex = PHPExcel_Cell::columnIndexFromString($startColumn) - 1; |
|||
$this->startColumn = $startColumnIndex; |
|||
$this->adjustForExistingOnlyRange(); |
|||
$this->seek(PHPExcel_Cell::stringFromColumnIndex($this->startColumn)); |
|||
|
|||
return $this; |
|||
} |
|||
|
|||
/** |
|||
* (Re)Set the end column |
|||
* |
|||
* @param string $endColumn The column address at which to stop iterating |
|||
* @return PHPExcel_Worksheet_RowCellIterator |
|||
* @throws PHPExcel_Exception |
|||
*/ |
|||
public function resetEnd($endColumn = null) |
|||
{ |
|||
$endColumn = ($endColumn) ? $endColumn : $this->subject->getHighestColumn(); |
|||
$this->endColumn = PHPExcel_Cell::columnIndexFromString($endColumn) - 1; |
|||
$this->adjustForExistingOnlyRange(); |
|||
|
|||
return $this; |
|||
} |
|||
|
|||
/** |
|||
* Set the column pointer to the selected column |
|||
* |
|||
* @param string $column The column address to set the current pointer at |
|||
* @return PHPExcel_Worksheet_RowCellIterator |
|||
* @throws PHPExcel_Exception |
|||
*/ |
|||
public function seek($column = 'A') |
|||
{ |
|||
$column = PHPExcel_Cell::columnIndexFromString($column) - 1; |
|||
if (($column < $this->startColumn) || ($column > $this->endColumn)) { |
|||
throw new PHPExcel_Exception("Column $column is out of range ({$this->startColumn} - {$this->endColumn})"); |
|||
} elseif ($this->onlyExistingCells && !($this->subject->cellExistsByColumnAndRow($column, $this->rowIndex))) { |
|||
throw new PHPExcel_Exception('In "IterateOnlyExistingCells" mode and Cell does not exist'); |
|||
} |
|||
$this->position = $column; |
|||
|
|||
return $this; |
|||
} |
|||
|
|||
/** |
|||
* Rewind the iterator to the starting column |
|||
*/ |
|||
public function rewind() |
|||
{ |
|||
$this->position = $this->startColumn; |
|||
} |
|||
|
|||
/** |
|||
* Return the current cell in this worksheet row |
|||
* |
|||
* @return PHPExcel_Cell |
|||
*/ |
|||
public function current() |
|||
{ |
|||
return $this->subject->getCellByColumnAndRow($this->position, $this->rowIndex); |
|||
} |
|||
|
|||
/** |
|||
* Return the current iterator key |
|||
* |
|||
* @return string |
|||
*/ |
|||
public function key() |
|||
{ |
|||
return PHPExcel_Cell::stringFromColumnIndex($this->position); |
|||
} |
|||
|
|||
/** |
|||
* Set the iterator to its next value |
|||
*/ |
|||
public function next() |
|||
{ |
|||
do { |
|||
++$this->position; |
|||
} while (($this->onlyExistingCells) && |
|||
(!$this->subject->cellExistsByColumnAndRow($this->position, $this->rowIndex)) && |
|||
($this->position <= $this->endColumn)); |
|||
} |
|||
|
|||
/** |
|||
* Set the iterator to its previous value |
|||
* |
|||
* @throws PHPExcel_Exception |
|||
*/ |
|||
public function prev() |
|||
{ |
|||
if ($this->position <= $this->startColumn) { |
|||
throw new PHPExcel_Exception( |
|||
"Column is already at the beginning of range (" . |
|||
PHPExcel_Cell::stringFromColumnIndex($this->endColumn) . " - " . |
|||
PHPExcel_Cell::stringFromColumnIndex($this->endColumn) . ")" |
|||
); |
|||
} |
|||
|
|||
do { |
|||
--$this->position; |
|||
} while (($this->onlyExistingCells) && |
|||
(!$this->subject->cellExistsByColumnAndRow($this->position, $this->rowIndex)) && |
|||
($this->position >= $this->startColumn)); |
|||
} |
|||
|
|||
/** |
|||
* Indicate if more columns exist in the worksheet range of columns that we're iterating |
|||
* |
|||
* @return boolean |
|||
*/ |
|||
public function valid() |
|||
{ |
|||
return $this->position <= $this->endColumn; |
|||
} |
|||
|
|||
/** |
|||
* Validate start/end values for "IterateOnlyExistingCells" mode, and adjust if necessary |
|||
* |
|||
* @throws PHPExcel_Exception |
|||
*/ |
|||
protected function adjustForExistingOnlyRange() |
|||
{ |
|||
if ($this->onlyExistingCells) { |
|||
while ((!$this->subject->cellExistsByColumnAndRow($this->startColumn, $this->rowIndex)) && |
|||
($this->startColumn <= $this->endColumn)) { |
|||
++$this->startColumn; |
|||
} |
|||
if ($this->startColumn > $this->endColumn) { |
|||
throw new PHPExcel_Exception('No cells exist within the specified range'); |
|||
} |
|||
while ((!$this->subject->cellExistsByColumnAndRow($this->endColumn, $this->rowIndex)) && |
|||
($this->endColumn >= $this->startColumn)) { |
|||
--$this->endColumn; |
|||
} |
|||
if ($this->endColumn < $this->startColumn) { |
|||
throw new PHPExcel_Exception('No cells exist within the specified range'); |
|||
} |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,265 @@ |
|||
<?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_RowDimension |
|||
* |
|||
* @category PHPExcel |
|||
* @package PHPExcel_Worksheet |
|||
* @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) |
|||
*/ |
|||
class PHPExcel_Worksheet_RowDimension |
|||
{ |
|||
/** |
|||
* Row index |
|||
* |
|||
* @var int |
|||
*/ |
|||
private $_rowIndex; |
|||
|
|||
/** |
|||
* Row height (in pt) |
|||
* |
|||
* When this is set to a negative value, the row height should be ignored by IWriter |
|||
* |
|||
* @var double |
|||
*/ |
|||
private $_rowHeight = -1; |
|||
|
|||
/** |
|||
* ZeroHeight for Row? |
|||
* |
|||
* @var bool |
|||
*/ |
|||
private $_zeroHeight = false; |
|||
|
|||
/** |
|||
* Visible? |
|||
* |
|||
* @var bool |
|||
*/ |
|||
private $_visible = true; |
|||
|
|||
/** |
|||
* Outline level |
|||
* |
|||
* @var int |
|||
*/ |
|||
private $_outlineLevel = 0; |
|||
|
|||
/** |
|||
* Collapsed |
|||
* |
|||
* @var bool |
|||
*/ |
|||
private $_collapsed = false; |
|||
|
|||
/** |
|||
* Index to cellXf. Null value means row has no explicit cellXf format. |
|||
* |
|||
* @var int|null |
|||
*/ |
|||
private $_xfIndex; |
|||
|
|||
/** |
|||
* Create a new PHPExcel_Worksheet_RowDimension |
|||
* |
|||
* @param int $pIndex Numeric row index |
|||
*/ |
|||
public function __construct($pIndex = 0) |
|||
{ |
|||
// Initialise values |
|||
$this->_rowIndex = $pIndex; |
|||
|
|||
// set row dimension as unformatted by default |
|||
$this->_xfIndex = null; |
|||
} |
|||
|
|||
/** |
|||
* Get Row Index |
|||
* |
|||
* @return int |
|||
*/ |
|||
public function getRowIndex() { |
|||
return $this->_rowIndex; |
|||
} |
|||
|
|||
/** |
|||
* Set Row Index |
|||
* |
|||
* @param int $pValue |
|||
* @return PHPExcel_Worksheet_RowDimension |
|||
*/ |
|||
public function setRowIndex($pValue) { |
|||
$this->_rowIndex = $pValue; |
|||
return $this; |
|||
} |
|||
|
|||
/** |
|||
* Get Row Height |
|||
* |
|||
* @return double |
|||
*/ |
|||
public function getRowHeight() { |
|||
return $this->_rowHeight; |
|||
} |
|||
|
|||
/** |
|||
* Set Row Height |
|||
* |
|||
* @param double $pValue |
|||
* @return PHPExcel_Worksheet_RowDimension |
|||
*/ |
|||
public function setRowHeight($pValue = -1) { |
|||
$this->_rowHeight = $pValue; |
|||
return $this; |
|||
} |
|||
|
|||
/** |
|||
* Get ZeroHeight |
|||
* |
|||
* @return bool |
|||
*/ |
|||
public function getzeroHeight() { |
|||
return $this->_zeroHeight; |
|||
} |
|||
|
|||
/** |
|||
* Set ZeroHeight |
|||
* |
|||
* @param bool $pValue |
|||
* @return PHPExcel_Worksheet_RowDimension |
|||
*/ |
|||
public function setzeroHeight($pValue = false) { |
|||
$this->_zeroHeight = $pValue; |
|||
return $this; |
|||
} |
|||
|
|||
/** |
|||
* Get Visible |
|||
* |
|||
* @return bool |
|||
*/ |
|||
public function getVisible() { |
|||
return $this->_visible; |
|||
} |
|||
|
|||
/** |
|||
* Set Visible |
|||
* |
|||
* @param bool $pValue |
|||
* @return PHPExcel_Worksheet_RowDimension |
|||
*/ |
|||
public function setVisible($pValue = true) { |
|||
$this->_visible = $pValue; |
|||
return $this; |
|||
} |
|||
|
|||
/** |
|||
* Get Outline Level |
|||
* |
|||
* @return int |
|||
*/ |
|||
public function getOutlineLevel() { |
|||
return $this->_outlineLevel; |
|||
} |
|||
|
|||
/** |
|||
* Set Outline Level |
|||
* |
|||
* Value must be between 0 and 7 |
|||
* |
|||
* @param int $pValue |
|||
* @throws PHPExcel_Exception |
|||
* @return PHPExcel_Worksheet_RowDimension |
|||
*/ |
|||
public function setOutlineLevel($pValue) { |
|||
if ($pValue < 0 || $pValue > 7) { |
|||
throw new PHPExcel_Exception("Outline level must range between 0 and 7."); |
|||
} |
|||
|
|||
$this->_outlineLevel = $pValue; |
|||
return $this; |
|||
} |
|||
|
|||
/** |
|||
* Get Collapsed |
|||
* |
|||
* @return bool |
|||
*/ |
|||
public function getCollapsed() { |
|||
return $this->_collapsed; |
|||
} |
|||
|
|||
/** |
|||
* Set Collapsed |
|||
* |
|||
* @param bool $pValue |
|||
* @return PHPExcel_Worksheet_RowDimension |
|||
*/ |
|||
public function setCollapsed($pValue = true) { |
|||
$this->_collapsed = $pValue; |
|||
return $this; |
|||
} |
|||
|
|||
/** |
|||
* Get index to cellXf |
|||
* |
|||
* @return int |
|||
*/ |
|||
public function getXfIndex() |
|||
{ |
|||
return $this->_xfIndex; |
|||
} |
|||
|
|||
/** |
|||
* Set index to cellXf |
|||
* |
|||
* @param int $pValue |
|||
* @return PHPExcel_Worksheet_RowDimension |
|||
*/ |
|||
public function setXfIndex($pValue = 0) |
|||
{ |
|||
$this->_xfIndex = $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; |
|||
} |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,148 @@ |
|||
<?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_RowIterator |
|||
* |
|||
* Used to iterate rows in a PHPExcel_Worksheet |
|||
* |
|||
* @category PHPExcel |
|||
* @package PHPExcel_Worksheet |
|||
* @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) |
|||
*/ |
|||
class PHPExcel_Worksheet_RowIterator implements Iterator |
|||
{ |
|||
/** |
|||
* PHPExcel_Worksheet to iterate |
|||
* |
|||
* @var PHPExcel_Worksheet |
|||
*/ |
|||
private $_subject; |
|||
|
|||
/** |
|||
* Current iterator position |
|||
* |
|||
* @var int |
|||
*/ |
|||
private $_position = 1; |
|||
|
|||
/** |
|||
* Start position |
|||
* |
|||
* @var int |
|||
*/ |
|||
private $_startRow = 1; |
|||
|
|||
|
|||
/** |
|||
* Create a new row iterator |
|||
* |
|||
* @param PHPExcel_Worksheet $subject The worksheet to iterate over |
|||
* @param integer $startRow The row number at which to start iterating |
|||
*/ |
|||
public function __construct(PHPExcel_Worksheet $subject = null, $startRow = 1) { |
|||
// Set subject |
|||
$this->_subject = $subject; |
|||
$this->resetStart($startRow); |
|||
} |
|||
|
|||
/** |
|||
* Destructor |
|||
*/ |
|||
public function __destruct() { |
|||
unset($this->_subject); |
|||
} |
|||
|
|||
/** |
|||
* (Re)Set the start row and the current row pointer |
|||
* |
|||
* @param integer $startRow The row number at which to start iterating |
|||
*/ |
|||
public function resetStart($startRow = 1) { |
|||
$this->_startRow = $startRow; |
|||
$this->seek($startRow); |
|||
} |
|||
|
|||
/** |
|||
* Set the row pointer to the selected row |
|||
* |
|||
* @param integer $row The row number to set the current pointer at |
|||
*/ |
|||
public function seek($row = 1) { |
|||
$this->_position = $row; |
|||
} |
|||
|
|||
/** |
|||
* Rewind the iterator to the starting row |
|||
*/ |
|||
public function rewind() { |
|||
$this->_position = $this->_startRow; |
|||
} |
|||
|
|||
/** |
|||
* Return the current row in this worksheet |
|||
* |
|||
* @return PHPExcel_Worksheet_Row |
|||
*/ |
|||
public function current() { |
|||
return new PHPExcel_Worksheet_Row($this->_subject, $this->_position); |
|||
} |
|||
|
|||
/** |
|||
* Return the current iterator key |
|||
* |
|||
* @return int |
|||
*/ |
|||
public function key() { |
|||
return $this->_position; |
|||
} |
|||
|
|||
/** |
|||
* Set the iterator to its next value |
|||
*/ |
|||
public function next() { |
|||
++$this->_position; |
|||
} |
|||
|
|||
/** |
|||
* Set the iterator to its previous value |
|||
*/ |
|||
public function prev() { |
|||
if ($this->_position > 1) |
|||
--$this->_position; |
|||
} |
|||
|
|||
/** |
|||
* Indicate if more rows exist in the worksheet |
|||
* |
|||
* @return boolean |
|||
*/ |
|||
public function valid() { |
|||
return $this->_position <= $this->_subject->getHighestRow(); |
|||
} |
|||
} |
|||
@ -0,0 +1,188 @@ |
|||
<?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_SheetView |
|||
* |
|||
* @category PHPExcel |
|||
* @package PHPExcel_Worksheet |
|||
* @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) |
|||
*/ |
|||
class PHPExcel_Worksheet_SheetView |
|||
{ |
|||
|
|||
/* Sheet View types */ |
|||
const SHEETVIEW_NORMAL = 'normal'; |
|||
const SHEETVIEW_PAGE_LAYOUT = 'pageLayout'; |
|||
const SHEETVIEW_PAGE_BREAK_PREVIEW = 'pageBreakPreview'; |
|||
|
|||
private static $_sheetViewTypes = array( |
|||
self::SHEETVIEW_NORMAL, |
|||
self::SHEETVIEW_PAGE_LAYOUT, |
|||
self::SHEETVIEW_PAGE_BREAK_PREVIEW, |
|||
); |
|||
|
|||
/** |
|||
* ZoomScale |
|||
* |
|||
* Valid values range from 10 to 400. |
|||
* |
|||
* @var int |
|||
*/ |
|||
private $_zoomScale = 100; |
|||
|
|||
/** |
|||
* ZoomScaleNormal |
|||
* |
|||
* Valid values range from 10 to 400. |
|||
* |
|||
* @var int |
|||
*/ |
|||
private $_zoomScaleNormal = 100; |
|||
|
|||
/** |
|||
* View |
|||
* |
|||
* Valid values range from 10 to 400. |
|||
* |
|||
* @var string |
|||
*/ |
|||
private $_sheetviewType = self::SHEETVIEW_NORMAL; |
|||
|
|||
/** |
|||
* Create a new PHPExcel_Worksheet_SheetView |
|||
*/ |
|||
public function __construct() |
|||
{ |
|||
} |
|||
|
|||
/** |
|||
* Get ZoomScale |
|||
* |
|||
* @return int |
|||
*/ |
|||
public function getZoomScale() { |
|||
return $this->_zoomScale; |
|||
} |
|||
|
|||
/** |
|||
* Set ZoomScale |
|||
* |
|||
* Valid values range from 10 to 400. |
|||
* |
|||
* @param int $pValue |
|||
* @throws PHPExcel_Exception |
|||
* @return PHPExcel_Worksheet_SheetView |
|||
*/ |
|||
public function setZoomScale($pValue = 100) { |
|||
// 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 >= 1 |
|||
if (($pValue >= 1) || is_null($pValue)) { |
|||
$this->_zoomScale = $pValue; |
|||
} else { |
|||
throw new PHPExcel_Exception("Scale must be greater than or equal to 1."); |
|||
} |
|||
return $this; |
|||
} |
|||
|
|||
/** |
|||
* Get ZoomScaleNormal |
|||
* |
|||
* @return int |
|||
*/ |
|||
public function getZoomScaleNormal() { |
|||
return $this->_zoomScaleNormal; |
|||
} |
|||
|
|||
/** |
|||
* Set ZoomScale |
|||
* |
|||
* Valid values range from 10 to 400. |
|||
* |
|||
* @param int $pValue |
|||
* @throws PHPExcel_Exception |
|||
* @return PHPExcel_Worksheet_SheetView |
|||
*/ |
|||
public function setZoomScaleNormal($pValue = 100) { |
|||
if (($pValue >= 1) || is_null($pValue)) { |
|||
$this->_zoomScaleNormal = $pValue; |
|||
} else { |
|||
throw new PHPExcel_Exception("Scale must be greater than or equal to 1."); |
|||
} |
|||
return $this; |
|||
} |
|||
|
|||
/** |
|||
* Get View |
|||
* |
|||
* @return string |
|||
*/ |
|||
public function getView() { |
|||
return $this->_sheetviewType; |
|||
} |
|||
|
|||
/** |
|||
* Set View |
|||
* |
|||
* Valid values are |
|||
* 'normal' self::SHEETVIEW_NORMAL |
|||
* 'pageLayout' self::SHEETVIEW_PAGE_LAYOUT |
|||
* 'pageBreakPreview' self::SHEETVIEW_PAGE_BREAK_PREVIEW |
|||
* |
|||
* @param string $pValue |
|||
* @throws PHPExcel_Exception |
|||
* @return PHPExcel_Worksheet_SheetView |
|||
*/ |
|||
public function setView($pValue = NULL) { |
|||
// MS Excel 2007 allows setting the view to 'normal', 'pageLayout' or 'pageBreakPreview' |
|||
// via the user interface |
|||
if ($pValue === NULL) |
|||
$pValue = self::SHEETVIEW_NORMAL; |
|||
if (in_array($pValue, self::$_sheetViewTypes)) { |
|||
$this->_sheetviewType = $pValue; |
|||
} else { |
|||
throw new PHPExcel_Exception("Invalid sheetview layout type."); |
|||
} |
|||
|
|||
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; |
|||
} |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,417 @@ |
|||
<?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_Excel2007 |
|||
* @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_Excel2007_Rels |
|||
* |
|||
* @category PHPExcel |
|||
* @package PHPExcel_Writer_Excel2007 |
|||
* @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) |
|||
*/ |
|||
class PHPExcel_Writer_Excel2007_Rels extends PHPExcel_Writer_Excel2007_WriterPart |
|||
{ |
|||
/** |
|||
* Write relationships to XML format |
|||
* |
|||
* @param PHPExcel $pPHPExcel |
|||
* @return string XML Output |
|||
* @throws PHPExcel_Writer_Exception |
|||
*/ |
|||
public function writeRelationships(PHPExcel $pPHPExcel = null) |
|||
{ |
|||
// Create XML writer |
|||
$objWriter = null; |
|||
if ($this->getParentWriter()->getUseDiskCaching()) { |
|||
$objWriter = new PHPExcel_Shared_XMLWriter(PHPExcel_Shared_XMLWriter::STORAGE_DISK, $this->getParentWriter()->getDiskCachingDirectory()); |
|||
} else { |
|||
$objWriter = new PHPExcel_Shared_XMLWriter(PHPExcel_Shared_XMLWriter::STORAGE_MEMORY); |
|||
} |
|||
|
|||
// XML header |
|||
$objWriter->startDocument('1.0','UTF-8','yes'); |
|||
|
|||
// Relationships |
|||
$objWriter->startElement('Relationships'); |
|||
$objWriter->writeAttribute('xmlns', 'http://schemas.openxmlformats.org/package/2006/relationships'); |
|||
|
|||
$customPropertyList = $pPHPExcel->getProperties()->getCustomProperties(); |
|||
if (!empty($customPropertyList)) { |
|||
// Relationship docProps/app.xml |
|||
$this->_writeRelationship( |
|||
$objWriter, |
|||
4, |
|||
'http://schemas.openxmlformats.org/officeDocument/2006/relationships/custom-properties', |
|||
'docProps/custom.xml' |
|||
); |
|||
|
|||
} |
|||
|
|||
// Relationship docProps/app.xml |
|||
$this->_writeRelationship( |
|||
$objWriter, |
|||
3, |
|||
'http://schemas.openxmlformats.org/officeDocument/2006/relationships/extended-properties', |
|||
'docProps/app.xml' |
|||
); |
|||
|
|||
// Relationship docProps/core.xml |
|||
$this->_writeRelationship( |
|||
$objWriter, |
|||
2, |
|||
'http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties', |
|||
'docProps/core.xml' |
|||
); |
|||
|
|||
// Relationship xl/workbook.xml |
|||
$this->_writeRelationship( |
|||
$objWriter, |
|||
1, |
|||
'http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument', |
|||
'xl/workbook.xml' |
|||
); |
|||
|
|||
$objWriter->endElement(); |
|||
|
|||
// Return |
|||
return $objWriter->getData(); |
|||
} |
|||
|
|||
/** |
|||
* Write workbook relationships to XML format |
|||
* |
|||
* @param PHPExcel $pPHPExcel |
|||
* @return string XML Output |
|||
* @throws PHPExcel_Writer_Exception |
|||
*/ |
|||
public function writeWorkbookRelationships(PHPExcel $pPHPExcel = null) |
|||
{ |
|||
// Create XML writer |
|||
$objWriter = null; |
|||
if ($this->getParentWriter()->getUseDiskCaching()) { |
|||
$objWriter = new PHPExcel_Shared_XMLWriter(PHPExcel_Shared_XMLWriter::STORAGE_DISK, $this->getParentWriter()->getDiskCachingDirectory()); |
|||
} else { |
|||
$objWriter = new PHPExcel_Shared_XMLWriter(PHPExcel_Shared_XMLWriter::STORAGE_MEMORY); |
|||
} |
|||
|
|||
// XML header |
|||
$objWriter->startDocument('1.0','UTF-8','yes'); |
|||
|
|||
// Relationships |
|||
$objWriter->startElement('Relationships'); |
|||
$objWriter->writeAttribute('xmlns', 'http://schemas.openxmlformats.org/package/2006/relationships'); |
|||
|
|||
// Relationship styles.xml |
|||
$this->_writeRelationship( |
|||
$objWriter, |
|||
1, |
|||
'http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles', |
|||
'styles.xml' |
|||
); |
|||
|
|||
// Relationship theme/theme1.xml |
|||
$this->_writeRelationship( |
|||
$objWriter, |
|||
2, |
|||
'http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme', |
|||
'theme/theme1.xml' |
|||
); |
|||
|
|||
// Relationship sharedStrings.xml |
|||
$this->_writeRelationship( |
|||
$objWriter, |
|||
3, |
|||
'http://schemas.openxmlformats.org/officeDocument/2006/relationships/sharedStrings', |
|||
'sharedStrings.xml' |
|||
); |
|||
|
|||
// Relationships with sheets |
|||
$sheetCount = $pPHPExcel->getSheetCount(); |
|||
for ($i = 0; $i < $sheetCount; ++$i) { |
|||
$this->_writeRelationship( |
|||
$objWriter, |
|||
($i + 1 + 3), |
|||
'http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet', |
|||
'worksheets/sheet' . ($i + 1) . '.xml' |
|||
); |
|||
} |
|||
|
|||
$objWriter->endElement(); |
|||
|
|||
// Return |
|||
return $objWriter->getData(); |
|||
} |
|||
|
|||
/** |
|||
* Write worksheet relationships to XML format |
|||
* |
|||
* Numbering is as follows: |
|||
* rId1 - Drawings |
|||
* rId_hyperlink_x - Hyperlinks |
|||
* |
|||
* @param PHPExcel_Worksheet $pWorksheet |
|||
* @param int $pWorksheetId |
|||
* @param boolean $includeCharts Flag indicating if we should write charts |
|||
* @return string XML Output |
|||
* @throws PHPExcel_Writer_Exception |
|||
*/ |
|||
public function writeWorksheetRelationships(PHPExcel_Worksheet $pWorksheet = null, $pWorksheetId = 1, $includeCharts = FALSE) |
|||
{ |
|||
// Create XML writer |
|||
$objWriter = null; |
|||
if ($this->getParentWriter()->getUseDiskCaching()) { |
|||
$objWriter = new PHPExcel_Shared_XMLWriter(PHPExcel_Shared_XMLWriter::STORAGE_DISK, $this->getParentWriter()->getDiskCachingDirectory()); |
|||
} else { |
|||
$objWriter = new PHPExcel_Shared_XMLWriter(PHPExcel_Shared_XMLWriter::STORAGE_MEMORY); |
|||
} |
|||
|
|||
// XML header |
|||
$objWriter->startDocument('1.0','UTF-8','yes'); |
|||
|
|||
// Relationships |
|||
$objWriter->startElement('Relationships'); |
|||
$objWriter->writeAttribute('xmlns', 'http://schemas.openxmlformats.org/package/2006/relationships'); |
|||
|
|||
// Write drawing relationships? |
|||
$d = 0; |
|||
if ($includeCharts) { |
|||
$charts = $pWorksheet->getChartCollection(); |
|||
} else { |
|||
$charts = array(); |
|||
} |
|||
if (($pWorksheet->getDrawingCollection()->count() > 0) || |
|||
(count($charts) > 0)) { |
|||
$this->_writeRelationship( |
|||
$objWriter, |
|||
++$d, |
|||
'http://schemas.openxmlformats.org/officeDocument/2006/relationships/drawing', |
|||
'../drawings/drawing' . $pWorksheetId . '.xml' |
|||
); |
|||
} |
|||
|
|||
// Write chart relationships? |
|||
// $chartCount = 0; |
|||
// $charts = $pWorksheet->getChartCollection(); |
|||
// echo 'Chart Rels: ' , count($charts) , '<br />'; |
|||
// if (count($charts) > 0) { |
|||
// foreach($charts as $chart) { |
|||
// $this->_writeRelationship( |
|||
// $objWriter, |
|||
// ++$d, |
|||
// 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/chart', |
|||
// '../charts/chart' . ++$chartCount . '.xml' |
|||
// ); |
|||
// } |
|||
// } |
|||
// |
|||
// Write hyperlink relationships? |
|||
$i = 1; |
|||
foreach ($pWorksheet->getHyperlinkCollection() as $hyperlink) { |
|||
if (!$hyperlink->isInternal()) { |
|||
$this->_writeRelationship( |
|||
$objWriter, |
|||
'_hyperlink_' . $i, |
|||
'http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink', |
|||
$hyperlink->getUrl(), |
|||
'External' |
|||
); |
|||
|
|||
++$i; |
|||
} |
|||
} |
|||
|
|||
// Write comments relationship? |
|||
$i = 1; |
|||
if (count($pWorksheet->getComments()) > 0) { |
|||
$this->_writeRelationship( |
|||
$objWriter, |
|||
'_comments_vml' . $i, |
|||
'http://schemas.openxmlformats.org/officeDocument/2006/relationships/vmlDrawing', |
|||
'../drawings/vmlDrawing' . $pWorksheetId . '.vml' |
|||
); |
|||
|
|||
$this->_writeRelationship( |
|||
$objWriter, |
|||
'_comments' . $i, |
|||
'http://schemas.openxmlformats.org/officeDocument/2006/relationships/comments', |
|||
'../comments' . $pWorksheetId . '.xml' |
|||
); |
|||
} |
|||
|
|||
// Write header/footer relationship? |
|||
$i = 1; |
|||
if (count($pWorksheet->getHeaderFooter()->getImages()) > 0) { |
|||
$this->_writeRelationship( |
|||
$objWriter, |
|||
'_headerfooter_vml' . $i, |
|||
'http://schemas.openxmlformats.org/officeDocument/2006/relationships/vmlDrawing', |
|||
'../drawings/vmlDrawingHF' . $pWorksheetId . '.vml' |
|||
); |
|||
} |
|||
|
|||
$objWriter->endElement(); |
|||
|
|||
// Return |
|||
return $objWriter->getData(); |
|||
} |
|||
|
|||
/** |
|||
* Write drawing relationships to XML format |
|||
* |
|||
* @param PHPExcel_Worksheet $pWorksheet |
|||
* @param int &$chartRef Chart ID |
|||
* @param boolean $includeCharts Flag indicating if we should write charts |
|||
* @return string XML Output |
|||
* @throws PHPExcel_Writer_Exception |
|||
*/ |
|||
public function writeDrawingRelationships(PHPExcel_Worksheet $pWorksheet = null, &$chartRef, $includeCharts = FALSE) |
|||
{ |
|||
// Create XML writer |
|||
$objWriter = null; |
|||
if ($this->getParentWriter()->getUseDiskCaching()) { |
|||
$objWriter = new PHPExcel_Shared_XMLWriter(PHPExcel_Shared_XMLWriter::STORAGE_DISK, $this->getParentWriter()->getDiskCachingDirectory()); |
|||
} else { |
|||
$objWriter = new PHPExcel_Shared_XMLWriter(PHPExcel_Shared_XMLWriter::STORAGE_MEMORY); |
|||
} |
|||
|
|||
// XML header |
|||
$objWriter->startDocument('1.0','UTF-8','yes'); |
|||
|
|||
// Relationships |
|||
$objWriter->startElement('Relationships'); |
|||
$objWriter->writeAttribute('xmlns', 'http://schemas.openxmlformats.org/package/2006/relationships'); |
|||
|
|||
// Loop through images and write relationships |
|||
$i = 1; |
|||
$iterator = $pWorksheet->getDrawingCollection()->getIterator(); |
|||
while ($iterator->valid()) { |
|||
if ($iterator->current() instanceof PHPExcel_Worksheet_Drawing |
|||
|| $iterator->current() instanceof PHPExcel_Worksheet_MemoryDrawing) { |
|||
// Write relationship for image drawing |
|||
$this->_writeRelationship( |
|||
$objWriter, |
|||
$i, |
|||
'http://schemas.openxmlformats.org/officeDocument/2006/relationships/image', |
|||
'../media/' . str_replace(' ', '', $iterator->current()->getIndexedFilename()) |
|||
); |
|||
} |
|||
|
|||
$iterator->next(); |
|||
++$i; |
|||
} |
|||
|
|||
if ($includeCharts) { |
|||
// Loop through charts and write relationships |
|||
$chartCount = $pWorksheet->getChartCount(); |
|||
if ($chartCount > 0) { |
|||
for ($c = 0; $c < $chartCount; ++$c) { |
|||
$this->_writeRelationship( |
|||
$objWriter, |
|||
$i++, |
|||
'http://schemas.openxmlformats.org/officeDocument/2006/relationships/chart', |
|||
'../charts/chart' . ++$chartRef . '.xml' |
|||
); |
|||
} |
|||
} |
|||
} |
|||
|
|||
$objWriter->endElement(); |
|||
|
|||
// Return |
|||
return $objWriter->getData(); |
|||
} |
|||
|
|||
/** |
|||
* Write header/footer drawing relationships to XML format |
|||
* |
|||
* @param PHPExcel_Worksheet $pWorksheet |
|||
* @return string XML Output |
|||
* @throws PHPExcel_Writer_Exception |
|||
*/ |
|||
public function writeHeaderFooterDrawingRelationships(PHPExcel_Worksheet $pWorksheet = null) |
|||
{ |
|||
// Create XML writer |
|||
$objWriter = null; |
|||
if ($this->getParentWriter()->getUseDiskCaching()) { |
|||
$objWriter = new PHPExcel_Shared_XMLWriter(PHPExcel_Shared_XMLWriter::STORAGE_DISK, $this->getParentWriter()->getDiskCachingDirectory()); |
|||
} else { |
|||
$objWriter = new PHPExcel_Shared_XMLWriter(PHPExcel_Shared_XMLWriter::STORAGE_MEMORY); |
|||
} |
|||
|
|||
// XML header |
|||
$objWriter->startDocument('1.0','UTF-8','yes'); |
|||
|
|||
// Relationships |
|||
$objWriter->startElement('Relationships'); |
|||
$objWriter->writeAttribute('xmlns', 'http://schemas.openxmlformats.org/package/2006/relationships'); |
|||
|
|||
// Loop through images and write relationships |
|||
foreach ($pWorksheet->getHeaderFooter()->getImages() as $key => $value) { |
|||
// Write relationship for image drawing |
|||
$this->_writeRelationship( |
|||
$objWriter, |
|||
$key, |
|||
'http://schemas.openxmlformats.org/officeDocument/2006/relationships/image', |
|||
'../media/' . $value->getIndexedFilename() |
|||
); |
|||
} |
|||
|
|||
$objWriter->endElement(); |
|||
|
|||
// Return |
|||
return $objWriter->getData(); |
|||
} |
|||
|
|||
/** |
|||
* Write Override content type |
|||
* |
|||
* @param PHPExcel_Shared_XMLWriter $objWriter XML Writer |
|||
* @param int $pId Relationship ID. rId will be prepended! |
|||
* @param string $pType Relationship type |
|||
* @param string $pTarget Relationship target |
|||
* @param string $pTargetMode Relationship target mode |
|||
* @throws PHPExcel_Writer_Exception |
|||
*/ |
|||
private function _writeRelationship(PHPExcel_Shared_XMLWriter $objWriter = null, $pId = 1, $pType = '', $pTarget = '', $pTargetMode = '') |
|||
{ |
|||
if ($pType != '' && $pTarget != '') { |
|||
// Write relationship |
|||
$objWriter->startElement('Relationship'); |
|||
$objWriter->writeAttribute('Id', 'rId' . $pId); |
|||
$objWriter->writeAttribute('Type', $pType); |
|||
$objWriter->writeAttribute('Target', $pTarget); |
|||
|
|||
if ($pTargetMode != '') { |
|||
$objWriter->writeAttribute('TargetMode', $pTargetMode); |
|||
} |
|||
|
|||
$objWriter->endElement(); |
|||
} else { |
|||
throw new PHPExcel_Writer_Exception("Invalid parameters passed."); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,67 @@ |
|||
<?php |
|||
|
|||
/** |
|||
* PHPExcel_Writer_Excel2007_RelsRibbon |
|||
* |
|||
* 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_Excel2007 |
|||
* @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_Excel2007_RelsRibbon extends PHPExcel_Writer_Excel2007_WriterPart |
|||
{ |
|||
/** |
|||
* Write relationships for additional objects of custom UI (ribbon) |
|||
* |
|||
* @param PHPExcel $pPHPExcel |
|||
* @return string XML Output |
|||
* @throws PHPExcel_Writer_Exception |
|||
*/ |
|||
public function writeRibbonRelationships(PHPExcel $pPHPExcel = null) |
|||
{ |
|||
// Create XML writer |
|||
$objWriter = null; |
|||
if ($this->getParentWriter()->getUseDiskCaching()) { |
|||
$objWriter = new PHPExcel_Shared_XMLWriter(PHPExcel_Shared_XMLWriter::STORAGE_DISK, $this->getParentWriter()->getDiskCachingDirectory()); |
|||
} else { |
|||
$objWriter = new PHPExcel_Shared_XMLWriter(PHPExcel_Shared_XMLWriter::STORAGE_MEMORY); |
|||
} |
|||
|
|||
// XML header |
|||
$objWriter->startDocument('1.0', 'UTF-8', 'yes'); |
|||
|
|||
// Relationships |
|||
$objWriter->startElement('Relationships'); |
|||
$objWriter->writeAttribute('xmlns', 'http://schemas.openxmlformats.org/package/2006/relationships'); |
|||
$localRels = $pPHPExcel->getRibbonBinObjects('names'); |
|||
if (is_array($localRels)) { |
|||
foreach ($localRels as $aId => $aTarget) { |
|||
$objWriter->startElement('Relationship'); |
|||
$objWriter->writeAttribute('Id', $aId); |
|||
$objWriter->writeAttribute('Type', 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/image'); |
|||
$objWriter->writeAttribute('Target', $aTarget); |
|||
$objWriter->endElement(); |
|||
} |
|||
} |
|||
$objWriter->endElement(); |
|||
|
|||
return $objWriter->getData(); |
|||
} |
|||
} |
|||
@ -0,0 +1,63 @@ |
|||
<?php |
|||
|
|||
/** |
|||
* PHPExcel_Writer_Excel2007_RelsVBA |
|||
* |
|||
* 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_Excel2007 |
|||
* @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_Excel2007_RelsVBA extends PHPExcel_Writer_Excel2007_WriterPart |
|||
{ |
|||
/** |
|||
* Write relationships for a signed VBA Project |
|||
* |
|||
* @param PHPExcel $pPHPExcel |
|||
* @return string XML Output |
|||
* @throws PHPExcel_Writer_Exception |
|||
*/ |
|||
public function writeVBARelationships(PHPExcel $pPHPExcel = null) |
|||
{ |
|||
// Create XML writer |
|||
$objWriter = null; |
|||
if ($this->getParentWriter()->getUseDiskCaching()) { |
|||
$objWriter = new PHPExcel_Shared_XMLWriter(PHPExcel_Shared_XMLWriter::STORAGE_DISK, $this->getParentWriter()->getDiskCachingDirectory()); |
|||
} else { |
|||
$objWriter = new PHPExcel_Shared_XMLWriter(PHPExcel_Shared_XMLWriter::STORAGE_MEMORY); |
|||
} |
|||
|
|||
// XML header |
|||
$objWriter->startDocument('1.0', 'UTF-8', 'yes'); |
|||
|
|||
// Relationships |
|||
$objWriter->startElement('Relationships'); |
|||
$objWriter->writeAttribute('xmlns', 'http://schemas.openxmlformats.org/package/2006/relationships'); |
|||
$objWriter->startElement('Relationship'); |
|||
$objWriter->writeAttribute('Id', 'rId1'); |
|||
$objWriter->writeAttribute('Type', 'http://schemas.microsoft.com/office/2006/relationships/vbaProjectSignature'); |
|||
$objWriter->writeAttribute('Target', 'vbaProjectSignature.bin'); |
|||
$objWriter->endElement(); |
|||
$objWriter->endElement(); |
|||
|
|||
return $objWriter->getData(); |
|||
|
|||
} |
|||
} |
|||
@ -0,0 +1,319 @@ |
|||
<?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_Excel2007 |
|||
* @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_Excel2007_StringTable |
|||
* |
|||
* @category PHPExcel |
|||
* @package PHPExcel_Writer_Excel2007 |
|||
* @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) |
|||
*/ |
|||
class PHPExcel_Writer_Excel2007_StringTable extends PHPExcel_Writer_Excel2007_WriterPart |
|||
{ |
|||
/** |
|||
* Create worksheet stringtable |
|||
* |
|||
* @param PHPExcel_Worksheet $pSheet Worksheet |
|||
* @param string[] $pExistingTable Existing table to eventually merge with |
|||
* @return string[] String table for worksheet |
|||
* @throws PHPExcel_Writer_Exception |
|||
*/ |
|||
public function createStringTable($pSheet = null, $pExistingTable = null) |
|||
{ |
|||
if ($pSheet !== NULL) { |
|||
// Create string lookup table |
|||
$aStringTable = array(); |
|||
$cellCollection = null; |
|||
$aFlippedStringTable = null; // For faster lookup |
|||
|
|||
// Is an existing table given? |
|||
if (($pExistingTable !== NULL) && is_array($pExistingTable)) { |
|||
$aStringTable = $pExistingTable; |
|||
} |
|||
|
|||
// Fill index array |
|||
$aFlippedStringTable = $this->flipStringTable($aStringTable); |
|||
|
|||
// Loop through cells |
|||
foreach ($pSheet->getCellCollection() as $cellID) { |
|||
$cell = $pSheet->getCell($cellID); |
|||
$cellValue = $cell->getValue(); |
|||
if (!is_object($cellValue) && |
|||
($cellValue !== NULL) && |
|||
$cellValue !== '' && |
|||
!isset($aFlippedStringTable[$cellValue]) && |
|||
($cell->getDataType() == PHPExcel_Cell_DataType::TYPE_STRING || $cell->getDataType() == PHPExcel_Cell_DataType::TYPE_STRING2 || $cell->getDataType() == PHPExcel_Cell_DataType::TYPE_NULL)) { |
|||
$aStringTable[] = $cellValue; |
|||
$aFlippedStringTable[$cellValue] = true; |
|||
} elseif ($cellValue instanceof PHPExcel_RichText && |
|||
($cellValue !== NULL) && |
|||
!isset($aFlippedStringTable[$cellValue->getHashCode()])) { |
|||
$aStringTable[] = $cellValue; |
|||
$aFlippedStringTable[$cellValue->getHashCode()] = true; |
|||
} |
|||
} |
|||
|
|||
// Return |
|||
return $aStringTable; |
|||
} else { |
|||
throw new PHPExcel_Writer_Exception("Invalid PHPExcel_Worksheet object passed."); |
|||
} |
|||
} |
|||
|
|||
/** |
|||
* Write string table to XML format |
|||
* |
|||
* @param string[] $pStringTable |
|||
* @return string XML Output |
|||
* @throws PHPExcel_Writer_Exception |
|||
*/ |
|||
public function writeStringTable($pStringTable = null) |
|||
{ |
|||
if ($pStringTable !== NULL) { |
|||
// Create XML writer |
|||
$objWriter = null; |
|||
if ($this->getParentWriter()->getUseDiskCaching()) { |
|||
$objWriter = new PHPExcel_Shared_XMLWriter(PHPExcel_Shared_XMLWriter::STORAGE_DISK, $this->getParentWriter()->getDiskCachingDirectory()); |
|||
} else { |
|||
$objWriter = new PHPExcel_Shared_XMLWriter(PHPExcel_Shared_XMLWriter::STORAGE_MEMORY); |
|||
} |
|||
|
|||
// XML header |
|||
$objWriter->startDocument('1.0','UTF-8','yes'); |
|||
|
|||
// String table |
|||
$objWriter->startElement('sst'); |
|||
$objWriter->writeAttribute('xmlns', 'http://schemas.openxmlformats.org/spreadsheetml/2006/main'); |
|||
$objWriter->writeAttribute('uniqueCount', count($pStringTable)); |
|||
|
|||
// Loop through string table |
|||
foreach ($pStringTable as $textElement) { |
|||
$objWriter->startElement('si'); |
|||
|
|||
if (! $textElement instanceof PHPExcel_RichText) { |
|||
$textToWrite = PHPExcel_Shared_String::ControlCharacterPHP2OOXML( $textElement ); |
|||
$objWriter->startElement('t'); |
|||
if ($textToWrite !== trim($textToWrite)) { |
|||
$objWriter->writeAttribute('xml:space', 'preserve'); |
|||
} |
|||
$objWriter->writeRawData($textToWrite); |
|||
$objWriter->endElement(); |
|||
} else if ($textElement instanceof PHPExcel_RichText) { |
|||
$this->writeRichText($objWriter, $textElement); |
|||
} |
|||
|
|||
$objWriter->endElement(); |
|||
} |
|||
|
|||
$objWriter->endElement(); |
|||
|
|||
// Return |
|||
return $objWriter->getData(); |
|||
} else { |
|||
throw new PHPExcel_Writer_Exception("Invalid string table array passed."); |
|||
} |
|||
} |
|||
|
|||
/** |
|||
* Write Rich Text |
|||
* |
|||
* @param PHPExcel_Shared_XMLWriter $objWriter XML Writer |
|||
* @param PHPExcel_RichText $pRichText Rich text |
|||
* @param string $prefix Optional Namespace prefix |
|||
* @throws PHPExcel_Writer_Exception |
|||
*/ |
|||
public function writeRichText(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_RichText $pRichText = null, $prefix=NULL) |
|||
{ |
|||
if ($prefix !== NULL) |
|||
$prefix .= ':'; |
|||
// Loop through rich text elements |
|||
$elements = $pRichText->getRichTextElements(); |
|||
foreach ($elements as $element) { |
|||
// r |
|||
$objWriter->startElement($prefix.'r'); |
|||
|
|||
// rPr |
|||
if ($element instanceof PHPExcel_RichText_Run) { |
|||
// rPr |
|||
$objWriter->startElement($prefix.'rPr'); |
|||
|
|||
// rFont |
|||
$objWriter->startElement($prefix.'rFont'); |
|||
$objWriter->writeAttribute('val', $element->getFont()->getName()); |
|||
$objWriter->endElement(); |
|||
|
|||
// Bold |
|||
$objWriter->startElement($prefix.'b'); |
|||
$objWriter->writeAttribute('val', ($element->getFont()->getBold() ? 'true' : 'false')); |
|||
$objWriter->endElement(); |
|||
|
|||
// Italic |
|||
$objWriter->startElement($prefix.'i'); |
|||
$objWriter->writeAttribute('val', ($element->getFont()->getItalic() ? 'true' : 'false')); |
|||
$objWriter->endElement(); |
|||
|
|||
// Superscript / subscript |
|||
if ($element->getFont()->getSuperScript() || $element->getFont()->getSubScript()) { |
|||
$objWriter->startElement($prefix.'vertAlign'); |
|||
if ($element->getFont()->getSuperScript()) { |
|||
$objWriter->writeAttribute('val', 'superscript'); |
|||
} else if ($element->getFont()->getSubScript()) { |
|||
$objWriter->writeAttribute('val', 'subscript'); |
|||
} |
|||
$objWriter->endElement(); |
|||
} |
|||
|
|||
// Strikethrough |
|||
$objWriter->startElement($prefix.'strike'); |
|||
$objWriter->writeAttribute('val', ($element->getFont()->getStrikethrough() ? 'true' : 'false')); |
|||
$objWriter->endElement(); |
|||
|
|||
// Color |
|||
$objWriter->startElement($prefix.'color'); |
|||
$objWriter->writeAttribute('rgb', $element->getFont()->getColor()->getARGB()); |
|||
$objWriter->endElement(); |
|||
|
|||
// Size |
|||
$objWriter->startElement($prefix.'sz'); |
|||
$objWriter->writeAttribute('val', $element->getFont()->getSize()); |
|||
$objWriter->endElement(); |
|||
|
|||
// Underline |
|||
$objWriter->startElement($prefix.'u'); |
|||
$objWriter->writeAttribute('val', $element->getFont()->getUnderline()); |
|||
$objWriter->endElement(); |
|||
|
|||
$objWriter->endElement(); |
|||
} |
|||
|
|||
// t |
|||
$objWriter->startElement($prefix.'t'); |
|||
$objWriter->writeAttribute('xml:space', 'preserve'); |
|||
$objWriter->writeRawData(PHPExcel_Shared_String::ControlCharacterPHP2OOXML( $element->getText() )); |
|||
$objWriter->endElement(); |
|||
|
|||
$objWriter->endElement(); |
|||
} |
|||
} |
|||
|
|||
/** |
|||
* Write Rich Text |
|||
* |
|||
* @param PHPExcel_Shared_XMLWriter $objWriter XML Writer |
|||
* @param string|PHPExcel_RichText $pRichText text string or Rich text |
|||
* @param string $prefix Optional Namespace prefix |
|||
* @throws PHPExcel_Writer_Exception |
|||
*/ |
|||
public function writeRichTextForCharts(PHPExcel_Shared_XMLWriter $objWriter = null, $pRichText = null, $prefix=NULL) |
|||
{ |
|||
if (!$pRichText instanceof PHPExcel_RichText) { |
|||
$textRun = $pRichText; |
|||
$pRichText = new PHPExcel_RichText(); |
|||
$pRichText->createTextRun($textRun); |
|||
} |
|||
|
|||
if ($prefix !== NULL) |
|||
$prefix .= ':'; |
|||
// Loop through rich text elements |
|||
$elements = $pRichText->getRichTextElements(); |
|||
foreach ($elements as $element) { |
|||
// r |
|||
$objWriter->startElement($prefix.'r'); |
|||
|
|||
// rPr |
|||
$objWriter->startElement($prefix.'rPr'); |
|||
|
|||
// Bold |
|||
$objWriter->writeAttribute('b', ($element->getFont()->getBold() ? 1 : 0)); |
|||
// Italic |
|||
$objWriter->writeAttribute('i', ($element->getFont()->getItalic() ? 1 : 0)); |
|||
// Underline |
|||
$underlineType = $element->getFont()->getUnderline(); |
|||
switch($underlineType) { |
|||
case 'single' : |
|||
$underlineType = 'sng'; |
|||
break; |
|||
case 'double' : |
|||
$underlineType = 'dbl'; |
|||
break; |
|||
} |
|||
$objWriter->writeAttribute('u', $underlineType); |
|||
// Strikethrough |
|||
$objWriter->writeAttribute('strike', ($element->getFont()->getStrikethrough() ? 'sngStrike' : 'noStrike')); |
|||
|
|||
// rFont |
|||
$objWriter->startElement($prefix.'latin'); |
|||
$objWriter->writeAttribute('typeface', $element->getFont()->getName()); |
|||
$objWriter->endElement(); |
|||
|
|||
// Superscript / subscript |
|||
// if ($element->getFont()->getSuperScript() || $element->getFont()->getSubScript()) { |
|||
// $objWriter->startElement($prefix.'vertAlign'); |
|||
// if ($element->getFont()->getSuperScript()) { |
|||
// $objWriter->writeAttribute('val', 'superscript'); |
|||
// } else if ($element->getFont()->getSubScript()) { |
|||
// $objWriter->writeAttribute('val', 'subscript'); |
|||
// } |
|||
// $objWriter->endElement(); |
|||
// } |
|||
// |
|||
$objWriter->endElement(); |
|||
|
|||
// t |
|||
$objWriter->startElement($prefix.'t'); |
|||
// $objWriter->writeAttribute('xml:space', 'preserve'); // Excel2010 accepts, Excel2007 complains |
|||
$objWriter->writeRawData(PHPExcel_Shared_String::ControlCharacterPHP2OOXML( $element->getText() )); |
|||
$objWriter->endElement(); |
|||
|
|||
$objWriter->endElement(); |
|||
} |
|||
} |
|||
|
|||
/** |
|||
* Flip string table (for index searching) |
|||
* |
|||
* @param array $stringTable Stringtable |
|||
* @return array |
|||
*/ |
|||
public function flipStringTable($stringTable = array()) { |
|||
// Return value |
|||
$returnValue = array(); |
|||
|
|||
// Loop through stringtable and add flipped items to $returnValue |
|||
foreach ($stringTable as $key => $value) { |
|||
if (! $value instanceof PHPExcel_RichText) { |
|||
$returnValue[$value] = $key; |
|||
} else if ($value instanceof PHPExcel_RichText) { |
|||
$returnValue[$value->getHashCode()] = $key; |
|||
} |
|||
} |
|||
|
|||
// Return |
|||
return $returnValue; |
|||
} |
|||
} |
|||
@ -0,0 +1,701 @@ |
|||
<?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_Excel2007 |
|||
* @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_Excel2007_Style |
|||
* |
|||
* @category PHPExcel |
|||
* @package PHPExcel_Writer_Excel2007 |
|||
* @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) |
|||
*/ |
|||
class PHPExcel_Writer_Excel2007_Style extends PHPExcel_Writer_Excel2007_WriterPart |
|||
{ |
|||
/** |
|||
* Write styles to XML format |
|||
* |
|||
* @param PHPExcel $pPHPExcel |
|||
* @return string XML Output |
|||
* @throws PHPExcel_Writer_Exception |
|||
*/ |
|||
public function writeStyles(PHPExcel $pPHPExcel = null) |
|||
{ |
|||
// Create XML writer |
|||
$objWriter = null; |
|||
if ($this->getParentWriter()->getUseDiskCaching()) { |
|||
$objWriter = new PHPExcel_Shared_XMLWriter(PHPExcel_Shared_XMLWriter::STORAGE_DISK, $this->getParentWriter()->getDiskCachingDirectory()); |
|||
} else { |
|||
$objWriter = new PHPExcel_Shared_XMLWriter(PHPExcel_Shared_XMLWriter::STORAGE_MEMORY); |
|||
} |
|||
|
|||
// XML header |
|||
$objWriter->startDocument('1.0','UTF-8','yes'); |
|||
|
|||
// styleSheet |
|||
$objWriter->startElement('styleSheet'); |
|||
$objWriter->writeAttribute('xml:space', 'preserve'); |
|||
$objWriter->writeAttribute('xmlns', 'http://schemas.openxmlformats.org/spreadsheetml/2006/main'); |
|||
|
|||
// numFmts |
|||
$objWriter->startElement('numFmts'); |
|||
$objWriter->writeAttribute('count', $this->getParentWriter()->getNumFmtHashTable()->count()); |
|||
|
|||
// numFmt |
|||
for ($i = 0; $i < $this->getParentWriter()->getNumFmtHashTable()->count(); ++$i) { |
|||
$this->_writeNumFmt($objWriter, $this->getParentWriter()->getNumFmtHashTable()->getByIndex($i), $i); |
|||
} |
|||
|
|||
$objWriter->endElement(); |
|||
|
|||
// font |
|||
$objWriter->startElement('font'); |
|||
$objWriter->writeAttribute('count', $this->getParentWriter()->getFontHashTable()->count()); |
|||
|
|||
// font |
|||
for ($i = 0; $i < $this->getParentWriter()->getFontHashTable()->count(); ++$i) { |
|||
$this->_writeFont($objWriter, $this->getParentWriter()->getFontHashTable()->getByIndex($i)); |
|||
} |
|||
|
|||
$objWriter->endElement(); |
|||
|
|||
// fills |
|||
$objWriter->startElement('fills'); |
|||
$objWriter->writeAttribute('count', $this->getParentWriter()->getFillHashTable()->count()); |
|||
|
|||
// fill |
|||
for ($i = 0; $i < $this->getParentWriter()->getFillHashTable()->count(); ++$i) { |
|||
$this->_writeFill($objWriter, $this->getParentWriter()->getFillHashTable()->getByIndex($i)); |
|||
} |
|||
|
|||
$objWriter->endElement(); |
|||
|
|||
// borders |
|||
$objWriter->startElement('borders'); |
|||
$objWriter->writeAttribute('count', $this->getParentWriter()->getBordersHashTable()->count()); |
|||
|
|||
// border |
|||
for ($i = 0; $i < $this->getParentWriter()->getBordersHashTable()->count(); ++$i) { |
|||
$this->_writeBorder($objWriter, $this->getParentWriter()->getBordersHashTable()->getByIndex($i)); |
|||
} |
|||
|
|||
$objWriter->endElement(); |
|||
|
|||
// cellStyleXfs |
|||
$objWriter->startElement('cellStyleXfs'); |
|||
$objWriter->writeAttribute('count', 1); |
|||
|
|||
// xf |
|||
$objWriter->startElement('xf'); |
|||
$objWriter->writeAttribute('numFmtId', 0); |
|||
$objWriter->writeAttribute('fontId', 0); |
|||
$objWriter->writeAttribute('fillId', 0); |
|||
$objWriter->writeAttribute('borderId', 0); |
|||
$objWriter->endElement(); |
|||
|
|||
$objWriter->endElement(); |
|||
|
|||
// cellXfs |
|||
$objWriter->startElement('cellXfs'); |
|||
$objWriter->writeAttribute('count', count($pPHPExcel->getCellXfCollection())); |
|||
|
|||
// xf |
|||
foreach ($pPHPExcel->getCellXfCollection() as $cellXf) { |
|||
$this->_writeCellStyleXf($objWriter, $cellXf, $pPHPExcel); |
|||
} |
|||
|
|||
$objWriter->endElement(); |
|||
|
|||
// cellStyles |
|||
$objWriter->startElement('cellStyles'); |
|||
$objWriter->writeAttribute('count', 1); |
|||
|
|||
// cellStyle |
|||
$objWriter->startElement('cellStyle'); |
|||
$objWriter->writeAttribute('name', 'Normal'); |
|||
$objWriter->writeAttribute('xfId', 0); |
|||
$objWriter->writeAttribute('builtinId', 0); |
|||
$objWriter->endElement(); |
|||
|
|||
$objWriter->endElement(); |
|||
|
|||
// dxfs |
|||
$objWriter->startElement('dxfs'); |
|||
$objWriter->writeAttribute('count', $this->getParentWriter()->getStylesConditionalHashTable()->count()); |
|||
|
|||
// dxf |
|||
for ($i = 0; $i < $this->getParentWriter()->getStylesConditionalHashTable()->count(); ++$i) { |
|||
$this->_writeCellStyleDxf($objWriter, $this->getParentWriter()->getStylesConditionalHashTable()->getByIndex($i)->getStyle()); |
|||
} |
|||
|
|||
$objWriter->endElement(); |
|||
|
|||
// tableStyles |
|||
$objWriter->startElement('tableStyles'); |
|||
$objWriter->writeAttribute('defaultTableStyle', 'TableStyleMedium9'); |
|||
$objWriter->writeAttribute('defaultPivotStyle', 'PivotTableStyle1'); |
|||
$objWriter->endElement(); |
|||
|
|||
$objWriter->endElement(); |
|||
|
|||
// Return |
|||
return $objWriter->getData(); |
|||
} |
|||
|
|||
/** |
|||
* Write Fill |
|||
* |
|||
* @param PHPExcel_Shared_XMLWriter $objWriter XML Writer |
|||
* @param PHPExcel_Style_Fill $pFill Fill style |
|||
* @throws PHPExcel_Writer_Exception |
|||
*/ |
|||
private function _writeFill(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Style_Fill $pFill = null) |
|||
{ |
|||
// Check if this is a pattern type or gradient type |
|||
if ($pFill->getFillType() === PHPExcel_Style_Fill::FILL_GRADIENT_LINEAR || |
|||
$pFill->getFillType() === PHPExcel_Style_Fill::FILL_GRADIENT_PATH) { |
|||
// Gradient fill |
|||
$this->_writeGradientFill($objWriter, $pFill); |
|||
} elseif($pFill->getFillType() !== NULL) { |
|||
// Pattern fill |
|||
$this->_writePatternFill($objWriter, $pFill); |
|||
} |
|||
} |
|||
|
|||
/** |
|||
* Write Gradient Fill |
|||
* |
|||
* @param PHPExcel_Shared_XMLWriter $objWriter XML Writer |
|||
* @param PHPExcel_Style_Fill $pFill Fill style |
|||
* @throws PHPExcel_Writer_Exception |
|||
*/ |
|||
private function _writeGradientFill(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Style_Fill $pFill = null) |
|||
{ |
|||
// fill |
|||
$objWriter->startElement('fill'); |
|||
|
|||
// gradientFill |
|||
$objWriter->startElement('gradientFill'); |
|||
$objWriter->writeAttribute('type', $pFill->getFillType()); |
|||
$objWriter->writeAttribute('degree', $pFill->getRotation()); |
|||
|
|||
// stop |
|||
$objWriter->startElement('stop'); |
|||
$objWriter->writeAttribute('position', '0'); |
|||
|
|||
// color |
|||
$objWriter->startElement('color'); |
|||
$objWriter->writeAttribute('rgb', $pFill->getStartColor()->getARGB()); |
|||
$objWriter->endElement(); |
|||
|
|||
$objWriter->endElement(); |
|||
|
|||
// stop |
|||
$objWriter->startElement('stop'); |
|||
$objWriter->writeAttribute('position', '1'); |
|||
|
|||
// color |
|||
$objWriter->startElement('color'); |
|||
$objWriter->writeAttribute('rgb', $pFill->getEndColor()->getARGB()); |
|||
$objWriter->endElement(); |
|||
|
|||
$objWriter->endElement(); |
|||
|
|||
$objWriter->endElement(); |
|||
|
|||
$objWriter->endElement(); |
|||
} |
|||
|
|||
/** |
|||
* Write Pattern Fill |
|||
* |
|||
* @param PHPExcel_Shared_XMLWriter $objWriter XML Writer |
|||
* @param PHPExcel_Style_Fill $pFill Fill style |
|||
* @throws PHPExcel_Writer_Exception |
|||
*/ |
|||
private function _writePatternFill(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Style_Fill $pFill = null) |
|||
{ |
|||
// fill |
|||
$objWriter->startElement('fill'); |
|||
|
|||
// patternFill |
|||
$objWriter->startElement('patternFill'); |
|||
$objWriter->writeAttribute('patternType', $pFill->getFillType()); |
|||
|
|||
if ($pFill->getFillType() !== PHPExcel_Style_Fill::FILL_NONE) { |
|||
// fgColor |
|||
if ($pFill->getStartColor()->getARGB()) { |
|||
$objWriter->startElement('fgColor'); |
|||
$objWriter->writeAttribute('rgb', $pFill->getStartColor()->getARGB()); |
|||
$objWriter->endElement(); |
|||
} |
|||
} |
|||
if ($pFill->getFillType() !== PHPExcel_Style_Fill::FILL_NONE) { |
|||
// bgColor |
|||
if ($pFill->getEndColor()->getARGB()) { |
|||
$objWriter->startElement('bgColor'); |
|||
$objWriter->writeAttribute('rgb', $pFill->getEndColor()->getARGB()); |
|||
$objWriter->endElement(); |
|||
} |
|||
} |
|||
|
|||
$objWriter->endElement(); |
|||
|
|||
$objWriter->endElement(); |
|||
} |
|||
|
|||
/** |
|||
* Write Font |
|||
* |
|||
* @param PHPExcel_Shared_XMLWriter $objWriter XML Writer |
|||
* @param PHPExcel_Style_Font $pFont Font style |
|||
* @throws PHPExcel_Writer_Exception |
|||
*/ |
|||
private function _writeFont(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Style_Font $pFont = null) |
|||
{ |
|||
// font |
|||
$objWriter->startElement('font'); |
|||
// Weird! The order of these elements actually makes a difference when opening Excel2007 |
|||
// files in Excel2003 with the compatibility pack. It's not documented behaviour, |
|||
// and makes for a real WTF! |
|||
|
|||
// Bold. We explicitly write this element also when false (like MS Office Excel 2007 does |
|||
// for conditional formatting). Otherwise it will apparently not be picked up in conditional |
|||
// formatting style dialog |
|||
if ($pFont->getBold() !== NULL) { |
|||
$objWriter->startElement('b'); |
|||
$objWriter->writeAttribute('val', $pFont->getBold() ? '1' : '0'); |
|||
$objWriter->endElement(); |
|||
} |
|||
|
|||
// Italic |
|||
if ($pFont->getItalic() !== NULL) { |
|||
$objWriter->startElement('i'); |
|||
$objWriter->writeAttribute('val', $pFont->getItalic() ? '1' : '0'); |
|||
$objWriter->endElement(); |
|||
} |
|||
|
|||
// Strikethrough |
|||
if ($pFont->getStrikethrough() !== NULL) { |
|||
$objWriter->startElement('strike'); |
|||
$objWriter->writeAttribute('val', $pFont->getStrikethrough() ? '1' : '0'); |
|||
$objWriter->endElement(); |
|||
} |
|||
|
|||
// Underline |
|||
if ($pFont->getUnderline() !== NULL) { |
|||
$objWriter->startElement('u'); |
|||
$objWriter->writeAttribute('val', $pFont->getUnderline()); |
|||
$objWriter->endElement(); |
|||
} |
|||
|
|||
// Superscript / subscript |
|||
if ($pFont->getSuperScript() === TRUE || $pFont->getSubScript() === TRUE) { |
|||
$objWriter->startElement('vertAlign'); |
|||
if ($pFont->getSuperScript() === TRUE) { |
|||
$objWriter->writeAttribute('val', 'superscript'); |
|||
} else if ($pFont->getSubScript() === TRUE) { |
|||
$objWriter->writeAttribute('val', 'subscript'); |
|||
} |
|||
$objWriter->endElement(); |
|||
} |
|||
|
|||
// Size |
|||
if ($pFont->getSize() !== NULL) { |
|||
$objWriter->startElement('sz'); |
|||
$objWriter->writeAttribute('val', $pFont->getSize()); |
|||
$objWriter->endElement(); |
|||
} |
|||
|
|||
// Foreground color |
|||
if ($pFont->getColor()->getARGB() !== NULL) { |
|||
$objWriter->startElement('color'); |
|||
$objWriter->writeAttribute('rgb', $pFont->getColor()->getARGB()); |
|||
$objWriter->endElement(); |
|||
} |
|||
|
|||
// Name |
|||
if ($pFont->getName() !== NULL) { |
|||
$objWriter->startElement('name'); |
|||
$objWriter->writeAttribute('val', $pFont->getName()); |
|||
$objWriter->endElement(); |
|||
} |
|||
|
|||
$objWriter->endElement(); |
|||
} |
|||
|
|||
/** |
|||
* Write Border |
|||
* |
|||
* @param PHPExcel_Shared_XMLWriter $objWriter XML Writer |
|||
* @param PHPExcel_Style_Borders $pBorders Borders style |
|||
* @throws PHPExcel_Writer_Exception |
|||
*/ |
|||
private function _writeBorder(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Style_Borders $pBorders = null) |
|||
{ |
|||
// Write border |
|||
$objWriter->startElement('border'); |
|||
// Diagonal? |
|||
switch ($pBorders->getDiagonalDirection()) { |
|||
case PHPExcel_Style_Borders::DIAGONAL_UP: |
|||
$objWriter->writeAttribute('diagonalUp', 'true'); |
|||
$objWriter->writeAttribute('diagonalDown', 'false'); |
|||
break; |
|||
case PHPExcel_Style_Borders::DIAGONAL_DOWN: |
|||
$objWriter->writeAttribute('diagonalUp', 'false'); |
|||
$objWriter->writeAttribute('diagonalDown', 'true'); |
|||
break; |
|||
case PHPExcel_Style_Borders::DIAGONAL_BOTH: |
|||
$objWriter->writeAttribute('diagonalUp', 'true'); |
|||
$objWriter->writeAttribute('diagonalDown', 'true'); |
|||
break; |
|||
} |
|||
|
|||
// BorderPr |
|||
$this->_writeBorderPr($objWriter, 'left', $pBorders->getLeft()); |
|||
$this->_writeBorderPr($objWriter, 'right', $pBorders->getRight()); |
|||
$this->_writeBorderPr($objWriter, 'top', $pBorders->getTop()); |
|||
$this->_writeBorderPr($objWriter, 'bottom', $pBorders->getBottom()); |
|||
$this->_writeBorderPr($objWriter, 'diagonal', $pBorders->getDiagonal()); |
|||
$objWriter->endElement(); |
|||
} |
|||
|
|||
/** |
|||
* Write Cell Style Xf |
|||
* |
|||
* @param PHPExcel_Shared_XMLWriter $objWriter XML Writer |
|||
* @param PHPExcel_Style $pStyle Style |
|||
* @param PHPExcel $pPHPExcel Workbook |
|||
* @throws PHPExcel_Writer_Exception |
|||
*/ |
|||
private function _writeCellStyleXf(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Style $pStyle = null, PHPExcel $pPHPExcel = null) |
|||
{ |
|||
// xf |
|||
$objWriter->startElement('xf'); |
|||
$objWriter->writeAttribute('xfId', 0); |
|||
$objWriter->writeAttribute('fontId', (int)$this->getParentWriter()->getFontHashTable()->getIndexForHashCode($pStyle->getFont()->getHashCode())); |
|||
|
|||
if ($pStyle->getNumberFormat()->getBuiltInFormatCode() === false) { |
|||
$objWriter->writeAttribute('numFmtId', (int)($this->getParentWriter()->getNumFmtHashTable()->getIndexForHashCode($pStyle->getNumberFormat()->getHashCode()) + 164) ); |
|||
} else { |
|||
$objWriter->writeAttribute('numFmtId', (int)$pStyle->getNumberFormat()->getBuiltInFormatCode()); |
|||
} |
|||
|
|||
$objWriter->writeAttribute('fillId', (int)$this->getParentWriter()->getFillHashTable()->getIndexForHashCode($pStyle->getFill()->getHashCode())); |
|||
$objWriter->writeAttribute('borderId', (int)$this->getParentWriter()->getBordersHashTable()->getIndexForHashCode($pStyle->getBorders()->getHashCode())); |
|||
|
|||
// Apply styles? |
|||
$objWriter->writeAttribute('applyFont', ($pPHPExcel->getDefaultStyle()->getFont()->getHashCode() != $pStyle->getFont()->getHashCode()) ? '1' : '0'); |
|||
$objWriter->writeAttribute('applyNumberFormat', ($pPHPExcel->getDefaultStyle()->getNumberFormat()->getHashCode() != $pStyle->getNumberFormat()->getHashCode()) ? '1' : '0'); |
|||
$objWriter->writeAttribute('applyFill', ($pPHPExcel->getDefaultStyle()->getFill()->getHashCode() != $pStyle->getFill()->getHashCode()) ? '1' : '0'); |
|||
$objWriter->writeAttribute('applyBorder', ($pPHPExcel->getDefaultStyle()->getBorders()->getHashCode() != $pStyle->getBorders()->getHashCode()) ? '1' : '0'); |
|||
$objWriter->writeAttribute('applyAlignment', ($pPHPExcel->getDefaultStyle()->getAlignment()->getHashCode() != $pStyle->getAlignment()->getHashCode()) ? '1' : '0'); |
|||
if ($pStyle->getProtection()->getLocked() != PHPExcel_Style_Protection::PROTECTION_INHERIT || $pStyle->getProtection()->getHidden() != PHPExcel_Style_Protection::PROTECTION_INHERIT) { |
|||
$objWriter->writeAttribute('applyProtection', 'true'); |
|||
} |
|||
|
|||
// alignment |
|||
$objWriter->startElement('alignment'); |
|||
$objWriter->writeAttribute('horizontal', $pStyle->getAlignment()->getHorizontal()); |
|||
$objWriter->writeAttribute('vertical', $pStyle->getAlignment()->getVertical()); |
|||
|
|||
$textRotation = 0; |
|||
if ($pStyle->getAlignment()->getTextRotation() >= 0) { |
|||
$textRotation = $pStyle->getAlignment()->getTextRotation(); |
|||
} else if ($pStyle->getAlignment()->getTextRotation() < 0) { |
|||
$textRotation = 90 - $pStyle->getAlignment()->getTextRotation(); |
|||
} |
|||
$objWriter->writeAttribute('textRotation', $textRotation); |
|||
|
|||
$objWriter->writeAttribute('wrapText', ($pStyle->getAlignment()->getWrapText() ? 'true' : 'false')); |
|||
$objWriter->writeAttribute('shrinkToFit', ($pStyle->getAlignment()->getShrinkToFit() ? 'true' : 'false')); |
|||
|
|||
if ($pStyle->getAlignment()->getIndent() > 0) { |
|||
$objWriter->writeAttribute('indent', $pStyle->getAlignment()->getIndent()); |
|||
} |
|||
$objWriter->endElement(); |
|||
|
|||
// protection |
|||
if ($pStyle->getProtection()->getLocked() != PHPExcel_Style_Protection::PROTECTION_INHERIT || $pStyle->getProtection()->getHidden() != PHPExcel_Style_Protection::PROTECTION_INHERIT) { |
|||
$objWriter->startElement('protection'); |
|||
if ($pStyle->getProtection()->getLocked() != PHPExcel_Style_Protection::PROTECTION_INHERIT) { |
|||
$objWriter->writeAttribute('locked', ($pStyle->getProtection()->getLocked() == PHPExcel_Style_Protection::PROTECTION_PROTECTED ? 'true' : 'false')); |
|||
} |
|||
if ($pStyle->getProtection()->getHidden() != PHPExcel_Style_Protection::PROTECTION_INHERIT) { |
|||
$objWriter->writeAttribute('hidden', ($pStyle->getProtection()->getHidden() == PHPExcel_Style_Protection::PROTECTION_PROTECTED ? 'true' : 'false')); |
|||
} |
|||
$objWriter->endElement(); |
|||
} |
|||
|
|||
$objWriter->endElement(); |
|||
} |
|||
|
|||
/** |
|||
* Write Cell Style Dxf |
|||
* |
|||
* @param PHPExcel_Shared_XMLWriter $objWriter XML Writer |
|||
* @param PHPExcel_Style $pStyle Style |
|||
* @throws PHPExcel_Writer_Exception |
|||
*/ |
|||
private function _writeCellStyleDxf(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Style $pStyle = null) |
|||
{ |
|||
// dxf |
|||
$objWriter->startElement('dxf'); |
|||
|
|||
// font |
|||
$this->_writeFont($objWriter, $pStyle->getFont()); |
|||
|
|||
// numFmt |
|||
$this->_writeNumFmt($objWriter, $pStyle->getNumberFormat()); |
|||
|
|||
// fill |
|||
$this->_writeFill($objWriter, $pStyle->getFill()); |
|||
|
|||
// alignment |
|||
$objWriter->startElement('alignment'); |
|||
if ($pStyle->getAlignment()->getHorizontal() !== NULL) { |
|||
$objWriter->writeAttribute('horizontal', $pStyle->getAlignment()->getHorizontal()); |
|||
} |
|||
if ($pStyle->getAlignment()->getVertical() !== NULL) { |
|||
$objWriter->writeAttribute('vertical', $pStyle->getAlignment()->getVertical()); |
|||
} |
|||
|
|||
if ($pStyle->getAlignment()->getTextRotation() !== NULL) { |
|||
$textRotation = 0; |
|||
if ($pStyle->getAlignment()->getTextRotation() >= 0) { |
|||
$textRotation = $pStyle->getAlignment()->getTextRotation(); |
|||
} else if ($pStyle->getAlignment()->getTextRotation() < 0) { |
|||
$textRotation = 90 - $pStyle->getAlignment()->getTextRotation(); |
|||
} |
|||
$objWriter->writeAttribute('textRotation', $textRotation); |
|||
} |
|||
$objWriter->endElement(); |
|||
|
|||
// border |
|||
$this->_writeBorder($objWriter, $pStyle->getBorders()); |
|||
|
|||
// protection |
|||
if (($pStyle->getProtection()->getLocked() !== NULL) || |
|||
($pStyle->getProtection()->getHidden() !== NULL)) { |
|||
if ($pStyle->getProtection()->getLocked() !== PHPExcel_Style_Protection::PROTECTION_INHERIT || |
|||
$pStyle->getProtection()->getHidden() !== PHPExcel_Style_Protection::PROTECTION_INHERIT) { |
|||
$objWriter->startElement('protection'); |
|||
if (($pStyle->getProtection()->getLocked() !== NULL) && |
|||
($pStyle->getProtection()->getLocked() !== PHPExcel_Style_Protection::PROTECTION_INHERIT)) { |
|||
$objWriter->writeAttribute('locked', ($pStyle->getProtection()->getLocked() == PHPExcel_Style_Protection::PROTECTION_PROTECTED ? 'true' : 'false')); |
|||
} |
|||
if (($pStyle->getProtection()->getHidden() !== NULL) && |
|||
($pStyle->getProtection()->getHidden() !== PHPExcel_Style_Protection::PROTECTION_INHERIT)) { |
|||
$objWriter->writeAttribute('hidden', ($pStyle->getProtection()->getHidden() == PHPExcel_Style_Protection::PROTECTION_PROTECTED ? 'true' : 'false')); |
|||
} |
|||
$objWriter->endElement(); |
|||
} |
|||
} |
|||
|
|||
$objWriter->endElement(); |
|||
} |
|||
|
|||
/** |
|||
* Write BorderPr |
|||
* |
|||
* @param PHPExcel_Shared_XMLWriter $objWriter XML Writer |
|||
* @param string $pName Element name |
|||
* @param PHPExcel_Style_Border $pBorder Border style |
|||
* @throws PHPExcel_Writer_Exception |
|||
*/ |
|||
private function _writeBorderPr(PHPExcel_Shared_XMLWriter $objWriter = null, $pName = 'left', PHPExcel_Style_Border $pBorder = null) |
|||
{ |
|||
// Write BorderPr |
|||
if ($pBorder->getBorderStyle() != PHPExcel_Style_Border::BORDER_NONE) { |
|||
$objWriter->startElement($pName); |
|||
$objWriter->writeAttribute('style', $pBorder->getBorderStyle()); |
|||
|
|||
// color |
|||
$objWriter->startElement('color'); |
|||
$objWriter->writeAttribute('rgb', $pBorder->getColor()->getARGB()); |
|||
$objWriter->endElement(); |
|||
|
|||
$objWriter->endElement(); |
|||
} |
|||
} |
|||
|
|||
/** |
|||
* Write NumberFormat |
|||
* |
|||
* @param PHPExcel_Shared_XMLWriter $objWriter XML Writer |
|||
* @param PHPExcel_Style_NumberFormat $pNumberFormat Number Format |
|||
* @param int $pId Number Format identifier |
|||
* @throws PHPExcel_Writer_Exception |
|||
*/ |
|||
private function _writeNumFmt(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Style_NumberFormat $pNumberFormat = null, $pId = 0) |
|||
{ |
|||
// Translate formatcode |
|||
$formatCode = $pNumberFormat->getFormatCode(); |
|||
|
|||
// numFmt |
|||
if ($formatCode !== NULL) { |
|||
$objWriter->startElement('numFmt'); |
|||
$objWriter->writeAttribute('numFmtId', ($pId + 164)); |
|||
$objWriter->writeAttribute('formatCode', $formatCode); |
|||
$objWriter->endElement(); |
|||
} |
|||
} |
|||
|
|||
/** |
|||
* Get an array of all styles |
|||
* |
|||
* @param PHPExcel $pPHPExcel |
|||
* @return PHPExcel_Style[] All styles in PHPExcel |
|||
* @throws PHPExcel_Writer_Exception |
|||
*/ |
|||
public function allStyles(PHPExcel $pPHPExcel = null) |
|||
{ |
|||
$aStyles = $pPHPExcel->getCellXfCollection(); |
|||
|
|||
return $aStyles; |
|||
} |
|||
|
|||
/** |
|||
* Get an array of all conditional styles |
|||
* |
|||
* @param PHPExcel $pPHPExcel |
|||
* @return PHPExcel_Style_Conditional[] All conditional styles in PHPExcel |
|||
* @throws PHPExcel_Writer_Exception |
|||
*/ |
|||
public function allConditionalStyles(PHPExcel $pPHPExcel = null) |
|||
{ |
|||
// Get an array of all styles |
|||
$aStyles = array(); |
|||
|
|||
$sheetCount = $pPHPExcel->getSheetCount(); |
|||
for ($i = 0; $i < $sheetCount; ++$i) { |
|||
foreach ($pPHPExcel->getSheet($i)->getConditionalStylesCollection() as $conditionalStyles) { |
|||
foreach ($conditionalStyles as $conditionalStyle) { |
|||
$aStyles[] = $conditionalStyle; |
|||
} |
|||
} |
|||
} |
|||
|
|||
return $aStyles; |
|||
} |
|||
|
|||
/** |
|||
* Get an array of all fills |
|||
* |
|||
* @param PHPExcel $pPHPExcel |
|||
* @return PHPExcel_Style_Fill[] All fills in PHPExcel |
|||
* @throws PHPExcel_Writer_Exception |
|||
*/ |
|||
public function allFills(PHPExcel $pPHPExcel = null) |
|||
{ |
|||
// Get an array of unique fills |
|||
$aFills = array(); |
|||
|
|||
// Two first fills are predefined |
|||
$fill0 = new PHPExcel_Style_Fill(); |
|||
$fill0->setFillType(PHPExcel_Style_Fill::FILL_NONE); |
|||
$aFills[] = $fill0; |
|||
|
|||
$fill1 = new PHPExcel_Style_Fill(); |
|||
$fill1->setFillType(PHPExcel_Style_Fill::FILL_PATTERN_GRAY125); |
|||
$aFills[] = $fill1; |
|||
// The remaining fills |
|||
$aStyles = $this->allStyles($pPHPExcel); |
|||
foreach ($aStyles as $style) { |
|||
if (!array_key_exists($style->getFill()->getHashCode(), $aFills)) { |
|||
$aFills[ $style->getFill()->getHashCode() ] = $style->getFill(); |
|||
} |
|||
} |
|||
|
|||
return $aFills; |
|||
} |
|||
|
|||
/** |
|||
* Get an array of all font |
|||
* |
|||
* @param PHPExcel $pPHPExcel |
|||
* @return PHPExcel_Style_Font[] All font in PHPExcel |
|||
* @throws PHPExcel_Writer_Exception |
|||
*/ |
|||
public function allFonts(PHPExcel $pPHPExcel = null) |
|||
{ |
|||
// Get an array of unique font |
|||
$aFonts = array(); |
|||
$aStyles = $this->allStyles($pPHPExcel); |
|||
|
|||
foreach ($aStyles as $style) { |
|||
if (!array_key_exists($style->getFont()->getHashCode(), $aFonts)) { |
|||
$aFonts[ $style->getFont()->getHashCode() ] = $style->getFont(); |
|||
} |
|||
} |
|||
|
|||
return $aFonts; |
|||
} |
|||
|
|||
/** |
|||
* Get an array of all borders |
|||
* |
|||
* @param PHPExcel $pPHPExcel |
|||
* @return PHPExcel_Style_Borders[] All borders in PHPExcel |
|||
* @throws PHPExcel_Writer_Exception |
|||
*/ |
|||
public function allBorders(PHPExcel $pPHPExcel = null) |
|||
{ |
|||
// Get an array of unique borders |
|||
$aBorders = array(); |
|||
$aStyles = $this->allStyles($pPHPExcel); |
|||
|
|||
foreach ($aStyles as $style) { |
|||
if (!array_key_exists($style->getBorders()->getHashCode(), $aBorders)) { |
|||
$aBorders[ $style->getBorders()->getHashCode() ] = $style->getBorders(); |
|||
} |
|||
} |
|||
|
|||
return $aBorders; |
|||
} |
|||
|
|||
/** |
|||
* Get an array of all number formats |
|||
* |
|||
* @param PHPExcel $pPHPExcel |
|||
* @return PHPExcel_Style_NumberFormat[] All number formats in PHPExcel |
|||
* @throws PHPExcel_Writer_Exception |
|||
*/ |
|||
public function allNumberFormats(PHPExcel $pPHPExcel = null) |
|||
{ |
|||
// Get an array of unique number formats |
|||
$aNumFmts = array(); |
|||
$aStyles = $this->allStyles($pPHPExcel); |
|||
|
|||
foreach ($aStyles as $style) { |
|||
if ($style->getNumberFormat()->getBuiltInFormatCode() === false && !array_key_exists($style->getNumberFormat()->getHashCode(), $aNumFmts)) { |
|||
$aNumFmts[ $style->getNumberFormat()->getHashCode() ] = $style->getNumberFormat(); |
|||
} |
|||
} |
|||
|
|||
return $aNumFmts; |
|||
} |
|||
} |
|||
@ -0,0 +1,76 @@ |
|||
<?php |
|||
|
|||
/** |
|||
* PHPExcel_Writer_OpenDocument_Settings |
|||
* |
|||
* 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_Settings extends PHPExcel_Writer_OpenDocument_WriterPart |
|||
{ |
|||
/** |
|||
* Write settings.xml to XML format |
|||
* |
|||
* @param PHPExcel $pPHPExcel |
|||
* @return string XML Output |
|||
* @throws PHPExcel_Writer_Exception |
|||
*/ |
|||
public function write(PHPExcel $pPHPExcel = null) |
|||
{ |
|||
if (!$pPHPExcel) { |
|||
$pPHPExcel = $this->getParentWriter()->getPHPExcel(); |
|||
} |
|||
|
|||
$objWriter = null; |
|||
if ($this->getParentWriter()->getUseDiskCaching()) { |
|||
$objWriter = new PHPExcel_Shared_XMLWriter(PHPExcel_Shared_XMLWriter::STORAGE_DISK, $this->getParentWriter()->getDiskCachingDirectory()); |
|||
} else { |
|||
$objWriter = new PHPExcel_Shared_XMLWriter(PHPExcel_Shared_XMLWriter::STORAGE_MEMORY); |
|||
} |
|||
|
|||
// XML header |
|||
$objWriter->startDocument('1.0', 'UTF-8'); |
|||
|
|||
// Settings |
|||
$objWriter->startElement('office:document-settings'); |
|||
$objWriter->writeAttribute('xmlns:office', 'urn:oasis:names:tc:opendocument:xmlns:office:1.0'); |
|||
$objWriter->writeAttribute('xmlns:xlink', 'http://www.w3.org/1999/xlink'); |
|||
$objWriter->writeAttribute('xmlns:config', 'urn:oasis:names:tc:opendocument:xmlns:config:1.0'); |
|||
$objWriter->writeAttribute('xmlns:ooo', 'http://openoffice.org/2004/office'); |
|||
$objWriter->writeAttribute('office:version', '1.2'); |
|||
|
|||
$objWriter->startElement('office:settings'); |
|||
$objWriter->startElement('config:config-item-set'); |
|||
$objWriter->writeAttribute('config:name', 'ooo:view-settings'); |
|||
$objWriter->startElement('config:config-item-map-indexed'); |
|||
$objWriter->writeAttribute('config:name', 'Views'); |
|||
$objWriter->endElement(); |
|||
$objWriter->endElement(); |
|||
$objWriter->startElement('config:config-item-set'); |
|||
$objWriter->writeAttribute('config:name', 'ooo:configuration-settings'); |
|||
$objWriter->endElement(); |
|||
$objWriter->endElement(); |
|||
$objWriter->endElement(); |
|||
|
|||
return $objWriter->getData(); |
|||
} |
|||
} |
|||
@ -0,0 +1,92 @@ |
|||
<?php |
|||
|
|||
/** |
|||
* PHPExcel_Writer_OpenDocument_Styles |
|||
* |
|||
* 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_Styles extends PHPExcel_Writer_OpenDocument_WriterPart |
|||
{ |
|||
/** |
|||
* Write styles.xml to XML format |
|||
* |
|||
* @param PHPExcel $pPHPExcel |
|||
* @return string XML Output |
|||
* @throws PHPExcel_Writer_Exception |
|||
*/ |
|||
public function write(PHPExcel $pPHPExcel = null) |
|||
{ |
|||
if (!$pPHPExcel) { |
|||
$pPHPExcel = $this->getParentWriter()->getPHPExcel(); |
|||
} |
|||
|
|||
$objWriter = null; |
|||
if ($this->getParentWriter()->getUseDiskCaching()) { |
|||
$objWriter = new PHPExcel_Shared_XMLWriter(PHPExcel_Shared_XMLWriter::STORAGE_DISK, $this->getParentWriter()->getDiskCachingDirectory()); |
|||
} else { |
|||
$objWriter = new PHPExcel_Shared_XMLWriter(PHPExcel_Shared_XMLWriter::STORAGE_MEMORY); |
|||
} |
|||
|
|||
// XML header |
|||
$objWriter->startDocument('1.0', 'UTF-8'); |
|||
|
|||
// Content |
|||
$objWriter->startElement('office:document-styles'); |
|||
$objWriter->writeAttribute('xmlns:office', 'urn:oasis:names:tc:opendocument:xmlns:office:1.0'); |
|||
$objWriter->writeAttribute('xmlns:style', 'urn:oasis:names:tc:opendocument:xmlns:style:1.0'); |
|||
$objWriter->writeAttribute('xmlns:text', 'urn:oasis:names:tc:opendocument:xmlns:text:1.0'); |
|||
$objWriter->writeAttribute('xmlns:table', 'urn:oasis:names:tc:opendocument:xmlns:table:1.0'); |
|||
$objWriter->writeAttribute('xmlns:draw', 'urn:oasis:names:tc:opendocument:xmlns:drawing:1.0'); |
|||
$objWriter->writeAttribute('xmlns:fo', 'urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0'); |
|||
$objWriter->writeAttribute('xmlns:xlink', 'http://www.w3.org/1999/xlink'); |
|||
$objWriter->writeAttribute('xmlns:dc', 'http://purl.org/dc/elements/1.1/'); |
|||
$objWriter->writeAttribute('xmlns:meta', 'urn:oasis:names:tc:opendocument:xmlns:meta:1.0'); |
|||
$objWriter->writeAttribute('xmlns:number', 'urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0'); |
|||
$objWriter->writeAttribute('xmlns:presentation', 'urn:oasis:names:tc:opendocument:xmlns:presentation:1.0'); |
|||
$objWriter->writeAttribute('xmlns:svg', 'urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0'); |
|||
$objWriter->writeAttribute('xmlns:chart', 'urn:oasis:names:tc:opendocument:xmlns:chart:1.0'); |
|||
$objWriter->writeAttribute('xmlns:dr3d', 'urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0'); |
|||
$objWriter->writeAttribute('xmlns:math', 'http://www.w3.org/1998/Math/MathML'); |
|||
$objWriter->writeAttribute('xmlns:form', 'urn:oasis:names:tc:opendocument:xmlns:form:1.0'); |
|||
$objWriter->writeAttribute('xmlns:script', 'urn:oasis:names:tc:opendocument:xmlns:script:1.0'); |
|||
$objWriter->writeAttribute('xmlns:ooo', 'http://openoffice.org/2004/office'); |
|||
$objWriter->writeAttribute('xmlns:ooow', 'http://openoffice.org/2004/writer'); |
|||
$objWriter->writeAttribute('xmlns:oooc', 'http://openoffice.org/2004/calc'); |
|||
$objWriter->writeAttribute('xmlns:dom', 'http://www.w3.org/2001/xml-events'); |
|||
$objWriter->writeAttribute('xmlns:rpt', 'http://openoffice.org/2005/report'); |
|||
$objWriter->writeAttribute('xmlns:of', 'urn:oasis:names:tc:opendocument:xmlns:of:1.2'); |
|||
$objWriter->writeAttribute('xmlns:xhtml', 'http://www.w3.org/1999/xhtml'); |
|||
$objWriter->writeAttribute('xmlns:grddl', 'http://www.w3.org/2003/g/data-view#'); |
|||
$objWriter->writeAttribute('xmlns:tableooo', 'http://openoffice.org/2009/table'); |
|||
$objWriter->writeAttribute('xmlns:css3t', 'http://www.w3.org/TR/css3-text/'); |
|||
$objWriter->writeAttribute('office:version', '1.2'); |
|||
|
|||
$objWriter->writeElement('office:font-face-decls'); |
|||
$objWriter->writeElement('office:styles'); |
|||
$objWriter->writeElement('office:automatic-styles'); |
|||
$objWriter->writeElement('office:master-styles'); |
|||
$objWriter->endElement(); |
|||
|
|||
return $objWriter->getData(); |
|||
} |
|||
} |
|||
@ -0,0 +1,136 @@ |
|||
<?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 |
|||
*/ |
|||
|
|||
|
|||
/** Require tcPDF library */ |
|||
$pdfRendererClassFile = PHPExcel_Settings::getPdfRendererPath() . '/tcpdf.php'; |
|||
if (file_exists($pdfRendererClassFile)) { |
|||
$k_path_url = PHPExcel_Settings::getPdfRendererPath(); |
|||
require_once $pdfRendererClassFile; |
|||
} else { |
|||
throw new PHPExcel_Writer_Exception('Unable to load PDF Rendering library'); |
|||
} |
|||
|
|||
/** |
|||
* PHPExcel_Writer_PDF_tcPDF |
|||
* |
|||
* @category PHPExcel |
|||
* @package PHPExcel_Writer_PDF |
|||
* @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) |
|||
*/ |
|||
class PHPExcel_Writer_PDF_tcPDF extends PHPExcel_Writer_PDF_Core implements PHPExcel_Writer_IWriter |
|||
{ |
|||
/** |
|||
* Create a new PHPExcel_Writer_PDF |
|||
* |
|||
* @param PHPExcel $phpExcel PHPExcel object |
|||
*/ |
|||
public function __construct(PHPExcel $phpExcel) |
|||
{ |
|||
parent::__construct($phpExcel); |
|||
} |
|||
|
|||
/** |
|||
* Save PHPExcel to file |
|||
* |
|||
* @param string $pFilename Name of the file to save as |
|||
* @throws PHPExcel_Writer_Exception |
|||
*/ |
|||
public function save($pFilename = NULL) |
|||
{ |
|||
$fileHandle = parent::prepareForSave($pFilename); |
|||
|
|||
// Default PDF paper size |
|||
$paperSize = 'LETTER'; // Letter (8.5 in. by 11 in.) |
|||
|
|||
// Check for paper size and page orientation |
|||
if (is_null($this->getSheetIndex())) { |
|||
$orientation = ($this->_phpExcel->getSheet(0)->getPageSetup()->getOrientation() |
|||
== PHPExcel_Worksheet_PageSetup::ORIENTATION_LANDSCAPE) |
|||
? 'L' |
|||
: 'P'; |
|||
$printPaperSize = $this->_phpExcel->getSheet(0)->getPageSetup()->getPaperSize(); |
|||
$printMargins = $this->_phpExcel->getSheet(0)->getPageMargins(); |
|||
} else { |
|||
$orientation = ($this->_phpExcel->getSheet($this->getSheetIndex())->getPageSetup()->getOrientation() |
|||
== PHPExcel_Worksheet_PageSetup::ORIENTATION_LANDSCAPE) |
|||
? 'L' |
|||
: 'P'; |
|||
$printPaperSize = $this->_phpExcel->getSheet($this->getSheetIndex())->getPageSetup()->getPaperSize(); |
|||
$printMargins = $this->_phpExcel->getSheet($this->getSheetIndex())->getPageMargins(); |
|||
} |
|||
|
|||
// Override Page Orientation |
|||
if (!is_null($this->getOrientation())) { |
|||
$orientation = ($this->getOrientation() == PHPExcel_Worksheet_PageSetup::ORIENTATION_LANDSCAPE) |
|||
? 'L' |
|||
: 'P'; |
|||
} |
|||
// Override Paper Size |
|||
if (!is_null($this->getPaperSize())) { |
|||
$printPaperSize = $this->getPaperSize(); |
|||
} |
|||
|
|||
if (isset(self::$_paperSizes[$printPaperSize])) { |
|||
$paperSize = self::$_paperSizes[$printPaperSize]; |
|||
} |
|||
|
|||
|
|||
// Create PDF |
|||
$pdf = new TCPDF($orientation, 'pt', $paperSize); |
|||
$pdf->setFontSubsetting(FALSE); |
|||
// Set margins, converting inches to points (using 72 dpi) |
|||
$pdf->SetMargins($printMargins->getLeft() * 72, $printMargins->getTop() * 72, $printMargins->getRight() * 72); |
|||
$pdf->SetAutoPageBreak(TRUE, $printMargins->getBottom() * 72); |
|||
|
|||
$pdf->setPrintHeader(FALSE); |
|||
$pdf->setPrintFooter(FALSE); |
|||
|
|||
$pdf->AddPage(); |
|||
|
|||
// Set the appropriate font |
|||
$pdf->SetFont($this->getFont()); |
|||
$pdf->writeHTML( |
|||
$this->generateHTMLHeader(FALSE) . |
|||
$this->generateSheetData() . |
|||
$this->generateHTMLFooter() |
|||
); |
|||
|
|||
// Document info |
|||
$pdf->SetTitle($this->_phpExcel->getProperties()->getTitle()); |
|||
$pdf->SetAuthor($this->_phpExcel->getProperties()->getCreator()); |
|||
$pdf->SetSubject($this->_phpExcel->getProperties()->getSubject()); |
|||
$pdf->SetKeywords($this->_phpExcel->getProperties()->getKeywords()); |
|||
$pdf->SetCreator($this->_phpExcel->getProperties()->getCreator()); |
|||
|
|||
// Write to file |
|||
fwrite($fileHandle, $pdf->output($pFilename, 'S')); |
|||
|
|||
parent::restoreStateAfterSave($fileHandle); |
|||
} |
|||
|
|||
} |
|||
@ -0,0 +1,148 @@ |
|||
<?php |
|||
defined('IN_IA') or exit('Access Denied'); |
|||
|
|||
function template($filename, $flag = TEMPLATE_DISPLAY) |
|||
{ |
|||
global $_W; |
|||
$source = IA_ROOT . "/web/themes/{$_W['template']}/{$filename}.html"; |
|||
$compile = IA_ROOT . "/data/tpl/web/{$_W['template']}/{$filename}.tpl.php"; |
|||
if (!is_file($source)) { |
|||
$source = IA_ROOT . "/web/themes/default/{$filename}.html"; |
|||
$compile = IA_ROOT . "/data/tpl/web/default/{$filename}.tpl.php"; |
|||
} |
|||
|
|||
if (!is_file($source)) { |
|||
echo "template source '{$filename}' is not exist!"; |
|||
|
|||
return ''; |
|||
} |
|||
if (DEVELOPMENT || !is_file($compile) || filemtime($source) > filemtime($compile)) { |
|||
template_compile($source, $compile); |
|||
} |
|||
switch ($flag) { |
|||
case TEMPLATE_DISPLAY: |
|||
default: |
|||
extract($GLOBALS, EXTR_SKIP); |
|||
include $compile; |
|||
break; |
|||
case TEMPLATE_FETCH: |
|||
extract($GLOBALS, EXTR_SKIP); |
|||
ob_flush(); |
|||
ob_clean(); |
|||
ob_start(); |
|||
include $compile; |
|||
$contents = ob_get_contents(); |
|||
ob_clean(); |
|||
|
|||
return $contents; |
|||
break; |
|||
case TEMPLATE_INCLUDEPATH: |
|||
return $compile; |
|||
break; |
|||
} |
|||
} |
|||
|
|||
|
|||
function template_compile($from, $to, $inmodule = false) |
|||
{ |
|||
global $_W; |
|||
$path = dirname($to); |
|||
if (!is_dir($path)) { |
|||
load()->func('file'); |
|||
mkdirs($path); |
|||
} |
|||
$content = template_parse(file_get_contents($from), $inmodule); |
|||
file_put_contents($to, $content); |
|||
} |
|||
|
|||
|
|||
function template_parse($str, $inmodule = false) |
|||
{ |
|||
$str = preg_replace('/<!--{(.+?)}-->/s', '{$1}', $str); |
|||
$str = preg_replace('/{template\s+(.+?)}/', '<?php (!empty($this) && $this instanceof WeModuleSite || ' . intval($inmodule) . ') ? (include $this->template($1, TEMPLATE_INCLUDEPATH)) : (include template($1, TEMPLATE_INCLUDEPATH));?>', $str); |
|||
$str = preg_replace('/{php\s+(.+?)}/', '<?php $1?>', $str); |
|||
$str = preg_replace('/{if\s+(.+?)}/', '<?php if($1) { ?>', $str); |
|||
$str = preg_replace('/{else}/', '<?php } else { ?>', $str); |
|||
$str = preg_replace('/{else ?if\s+(.+?)}/', '<?php } else if($1) { ?>', $str); |
|||
$str = preg_replace('/{\/if}/', '<?php } ?>', $str); |
|||
$str = preg_replace('/{loop\s+(\S+)\s+(\S+)}/', '<?php if(is_array($1)) { foreach($1 as $2) { ?>', $str); |
|||
$str = preg_replace('/{loop\s+(\S+)\s+(\S+)\s+(\S+)}/', '<?php if(is_array($1)) { foreach($1 as $2 => $3) { ?>', $str); |
|||
$str = preg_replace('/{\/loop}/', '<?php } } ?>', $str); |
|||
$str = preg_replace('/{(\$[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*)}/', '<?php echo $1;?>', $str); |
|||
$str = preg_replace('/{(\$[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff\[\]\'\"\$]*)}/', '<?php echo $1;?>', $str); |
|||
$str = preg_replace('/{url\s+(\S+)}/', '<?php echo url($1);?>', $str); |
|||
$str = preg_replace('/{url\s+(\S+)\s+(array\(.+?\))}/', '<?php echo url($1, $2);?>', $str); |
|||
$str = preg_replace('/{media\s+(\S+)}/', '<?php echo tomedia($1);?>', $str); |
|||
$str = preg_replace_callback('/<\?php([^\?]+)\?>/s', 'template_addquote', $str); |
|||
$str = preg_replace_callback('/{hook\s+(.+?)}/s', 'template_modulehook_parser', $str); |
|||
$str = preg_replace('/{\/hook}/', '<?php ; ?>', $str); |
|||
$str = preg_replace('/{([A-Z_\x7f-\xff][A-Z0-9_\x7f-\xff]*)}/s', '<?php echo $1;?>', $str); |
|||
$str = str_replace('{##', '{', $str); |
|||
$str = str_replace('##}', '}', $str); |
|||
if (!empty($GLOBALS['_W']['setting']['remote']['type'])) { |
|||
$str = str_replace('</body>', "<script>$(function(){\$('img').attr('onerror', '').on('error', function(){if (!\$(this).data('check-src') && (this.src.indexOf('http://') > -1 || this.src.indexOf('https://') > -1)) {this.src = this.src.indexOf('{$GLOBALS['_W']['attachurl_local']}') == -1 ? this.src.replace('{$GLOBALS['_W']['attachurl_remote']}', '{$GLOBALS['_W']['attachurl_local']}') : this.src.replace('{$GLOBALS['_W']['attachurl_local']}', '{$GLOBALS['_W']['attachurl_remote']}');\$(this).data('check-src', true);}});});</script></body>", $str); |
|||
} |
|||
$str = "<?php defined('IN_IA') or exit('Access Denied');?>" . $str; |
|||
|
|||
return $str; |
|||
} |
|||
|
|||
function template_addquote($matchs) |
|||
{ |
|||
$code = "<?php {$matchs[1]}?>"; |
|||
$code = preg_replace('/\[([a-zA-Z0-9_\-\.\x7f-\xff]+)\](?![a-zA-Z0-9_\-\.\x7f-\xff\[\]]*[\'"])/s', "['$1']", $code); |
|||
|
|||
return str_replace('\\\"', '\"', $code); |
|||
} |
|||
|
|||
function template_modulehook_parser($params = array()) |
|||
{ |
|||
load()->model('module'); |
|||
if (empty($params[1])) { |
|||
return ''; |
|||
} |
|||
$params = explode(' ', $params[1]); |
|||
if (empty($params)) { |
|||
return ''; |
|||
} |
|||
$plugin = array(); |
|||
foreach ($params as $row) { |
|||
$row = explode('=', $row); |
|||
$plugin[$row[0]] = str_replace(array("'", '"'), '', $row[1]); |
|||
$row[1] = urldecode($row[1]); |
|||
} |
|||
$plugin_info = module_fetch($plugin['module']); |
|||
if (empty($plugin_info)) { |
|||
return false; |
|||
} |
|||
|
|||
if (empty($plugin['return']) || 'false' == $plugin['return']) { |
|||
} else { |
|||
} |
|||
if (empty($plugin['func']) || empty($plugin['module'])) { |
|||
return false; |
|||
} |
|||
|
|||
if (defined('IN_SYS')) { |
|||
$plugin['func'] = "hookWeb{$plugin['func']}"; |
|||
} else { |
|||
$plugin['func'] = "hookMobile{$plugin['func']}"; |
|||
} |
|||
|
|||
$plugin_module = WeUtility::createModuleHook($plugin_info['name']); |
|||
if (method_exists($plugin_module, $plugin['func']) && $plugin_module instanceof WeModuleHook) { |
|||
$hookparams = var_export($plugin, true); |
|||
if (!empty($hookparams)) { |
|||
$hookparams = preg_replace("/'(\\$[a-zA-Z_\x7f-\xff\[\]\']*?)'/", '$1', $hookparams); |
|||
} else { |
|||
$hookparams = 'array()'; |
|||
} |
|||
$php = "<?php \$plugin_module = WeUtility::createModuleHook('{$plugin_info['name']}');call_user_func_array(array(\$plugin_module, '{$plugin['func']}'), array('params' => {$hookparams})); ?>"; |
|||
|
|||
return $php; |
|||
} else { |
|||
$php = "<!--模块 {$plugin_info['name']} 不存在嵌入点 {$plugin['func']}-->"; |
|||
|
|||
return $php; |
|||
} |
|||
} |
|||
@ -0,0 +1 @@ |
|||
.icon-selection h3{padding-left:1em}.icon-selection a{display:block;float:left;text-align:center;width:5em;height:6em;overflow:hidden;margin:auto .3em}.icon-selection a:hover{text-decoration:none}.icon-selection a i{display:block;font-size:2em;color:#000}.icon-selection a span{display:block;height:1.2em;overflow:hidden;word-break:break-all} |
|||
|
After Width: | Height: | Size: 35 KiB |
|
After Width: | Height: | Size: 484 B |
|
After Width: | Height: | Size: 481 B |
@ -0,0 +1,712 @@ |
|||
/******************************************************************************* |
|||
* 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('table', function(K) { |
|||
var self = this, name = 'table', lang = self.lang(name + '.'), zeroborder = 'ke-zeroborder'; |
|||
// 设置颜色
|
|||
function _setColor(box, color) { |
|||
color = color.toUpperCase(); |
|||
box.css('background-color', color); |
|||
box.css('color', color === '#000000' ? '#FFFFFF' : '#000000'); |
|||
box.html(color); |
|||
} |
|||
// 初始化取色器
|
|||
var pickerList = []; |
|||
function _initColorPicker(dialogDiv, colorBox) { |
|||
colorBox.bind('click,mousedown', function(e){ |
|||
e.stopPropagation(); |
|||
}); |
|||
function removePicker() { |
|||
K.each(pickerList, function() { |
|||
this.remove(); |
|||
}); |
|||
pickerList = []; |
|||
K(document).unbind('click,mousedown', removePicker); |
|||
dialogDiv.unbind('click,mousedown', removePicker); |
|||
} |
|||
colorBox.click(function(e) { |
|||
removePicker(); |
|||
var box = K(this), |
|||
pos = box.pos(); |
|||
var picker = K.colorpicker({ |
|||
x : pos.x, |
|||
y : pos.y + box.height(), |
|||
z : 811214, |
|||
selectedColor : K(this).html(), |
|||
colors : self.colorTable, |
|||
noColor : self.lang('noColor'), |
|||
shadowMode : self.shadowMode, |
|||
click : function(color) { |
|||
_setColor(box, color); |
|||
removePicker(); |
|||
} |
|||
}); |
|||
pickerList.push(picker); |
|||
K(document).bind('click,mousedown', removePicker); |
|||
dialogDiv.bind('click,mousedown', removePicker); |
|||
}); |
|||
} |
|||
// 取得下一行cell的index
|
|||
function _getCellIndex(table, row, cell) { |
|||
var rowSpanCount = 0; |
|||
for (var i = 0, len = row.cells.length; i < len; i++) { |
|||
if (row.cells[i] == cell) { |
|||
break; |
|||
} |
|||
rowSpanCount += row.cells[i].rowSpan - 1; |
|||
} |
|||
return cell.cellIndex - rowSpanCount; |
|||
} |
|||
self.plugin.table = { |
|||
//insert or modify table
|
|||
prop : function(isInsert) { |
|||
var html = [ |
|||
'<div style="padding:20px;">', |
|||
//rows, cols
|
|||
'<div class="ke-dialog-row">', |
|||
'<label for="keRows" style="width:90px;">' + lang.cells + '</label>', |
|||
lang.rows + ' <input type="text" id="keRows" class="ke-input-text ke-input-number" name="rows" value="" maxlength="4" /> ', |
|||
lang.cols + ' <input type="text" class="ke-input-text ke-input-number" name="cols" value="" maxlength="4" />', |
|||
'</div>', |
|||
//width, height
|
|||
'<div class="ke-dialog-row">', |
|||
'<label for="keWidth" style="width:90px;">' + lang.size + '</label>', |
|||
lang.width + ' <input type="text" id="keWidth" class="ke-input-text ke-input-number" name="width" value="" maxlength="4" /> ', |
|||
'<select name="widthType">', |
|||
'<option value="%">' + lang.percent + '</option>', |
|||
'<option value="px">' + lang.px + '</option>', |
|||
'</select> ', |
|||
lang.height + ' <input type="text" class="ke-input-text ke-input-number" name="height" value="" maxlength="4" /> ', |
|||
'<select name="heightType">', |
|||
'<option value="%">' + lang.percent + '</option>', |
|||
'<option value="px">' + lang.px + '</option>', |
|||
'</select>', |
|||
'</div>', |
|||
//space, padding
|
|||
'<div class="ke-dialog-row">', |
|||
'<label for="kePadding" style="width:90px;">' + lang.space + '</label>', |
|||
lang.padding + ' <input type="text" id="kePadding" class="ke-input-text ke-input-number" name="padding" value="" maxlength="4" /> ', |
|||
lang.spacing + ' <input type="text" class="ke-input-text ke-input-number" name="spacing" value="" maxlength="4" />', |
|||
'</div>', |
|||
//align
|
|||
'<div class="ke-dialog-row">', |
|||
'<label for="keAlign" style="width:90px;">' + lang.align + '</label>', |
|||
'<select id="keAlign" name="align">', |
|||
'<option value="">' + lang.alignDefault + '</option>', |
|||
'<option value="left">' + lang.alignLeft + '</option>', |
|||
'<option value="center">' + lang.alignCenter + '</option>', |
|||
'<option value="right">' + lang.alignRight + '</option>', |
|||
'</select>', |
|||
'</div>', |
|||
//border
|
|||
'<div class="ke-dialog-row">', |
|||
'<label for="keBorder" style="width:90px;">' + lang.border + '</label>', |
|||
lang.borderWidth + ' <input type="text" id="keBorder" class="ke-input-text ke-input-number" name="border" value="" maxlength="4" /> ', |
|||
lang.borderColor + ' <span class="ke-inline-block ke-input-color"></span>', |
|||
'</div>', |
|||
//background color
|
|||
'<div class="ke-dialog-row">', |
|||
'<label for="keBgColor" style="width:90px;">' + lang.backgroundColor + '</label>', |
|||
'<span class="ke-inline-block ke-input-color"></span>', |
|||
'</div>', |
|||
'</div>' |
|||
].join(''); |
|||
var bookmark = self.cmd.range.createBookmark(); |
|||
var dialog = self.createDialog({ |
|||
name : name, |
|||
width : 500, |
|||
title : self.lang(name), |
|||
body : html, |
|||
beforeRemove : function() { |
|||
colorBox.unbind(); |
|||
}, |
|||
yesBtn : { |
|||
name : self.lang('yes'), |
|||
click : function(e) { |
|||
var rows = rowsBox.val(), |
|||
cols = colsBox.val(), |
|||
width = widthBox.val(), |
|||
height = heightBox.val(), |
|||
widthType = widthTypeBox.val(), |
|||
heightType = heightTypeBox.val(), |
|||
padding = paddingBox.val(), |
|||
spacing = spacingBox.val(), |
|||
align = alignBox.val(), |
|||
border = borderBox.val(), |
|||
borderColor = K(colorBox[0]).html() || '', |
|||
bgColor = K(colorBox[1]).html() || ''; |
|||
if (rows == 0 || !/^\d+$/.test(rows)) { |
|||
alert(self.lang('invalidRows')); |
|||
rowsBox[0].focus(); |
|||
return; |
|||
} |
|||
if (cols == 0 || !/^\d+$/.test(cols)) { |
|||
alert(self.lang('invalidRows')); |
|||
colsBox[0].focus(); |
|||
return; |
|||
} |
|||
if (!/^\d*$/.test(width)) { |
|||
alert(self.lang('invalidWidth')); |
|||
widthBox[0].focus(); |
|||
return; |
|||
} |
|||
if (!/^\d*$/.test(height)) { |
|||
alert(self.lang('invalidHeight')); |
|||
heightBox[0].focus(); |
|||
return; |
|||
} |
|||
if (!/^\d*$/.test(padding)) { |
|||
alert(self.lang('invalidPadding')); |
|||
paddingBox[0].focus(); |
|||
return; |
|||
} |
|||
if (!/^\d*$/.test(spacing)) { |
|||
alert(self.lang('invalidSpacing')); |
|||
spacingBox[0].focus(); |
|||
return; |
|||
} |
|||
if (!/^\d*$/.test(border)) { |
|||
alert(self.lang('invalidBorder')); |
|||
borderBox[0].focus(); |
|||
return; |
|||
} |
|||
//modify table
|
|||
if (table) { |
|||
if (width !== '') { |
|||
table.width(width + widthType); |
|||
} else { |
|||
table.css('width', ''); |
|||
} |
|||
if (table[0].width !== undefined) { |
|||
table.removeAttr('width'); |
|||
} |
|||
if (height !== '') { |
|||
table.height(height + heightType); |
|||
} else { |
|||
table.css('height', ''); |
|||
} |
|||
if (table[0].height !== undefined) { |
|||
table.removeAttr('height'); |
|||
} |
|||
table.css('background-color', bgColor); |
|||
if (table[0].bgColor !== undefined) { |
|||
table.removeAttr('bgColor'); |
|||
} |
|||
if (padding !== '') { |
|||
table[0].cellPadding = padding; |
|||
} else { |
|||
table.removeAttr('cellPadding'); |
|||
} |
|||
if (spacing !== '') { |
|||
table[0].cellSpacing = spacing; |
|||
} else { |
|||
table.removeAttr('cellSpacing'); |
|||
} |
|||
if (align !== '') { |
|||
table[0].align = align; |
|||
} else { |
|||
table.removeAttr('align'); |
|||
} |
|||
if (border !== '') { |
|||
table.attr('border', border); |
|||
} else { |
|||
table.removeAttr('border'); |
|||
} |
|||
if (border === '' || border === '0') { |
|||
table.addClass(zeroborder); |
|||
} else { |
|||
table.removeClass(zeroborder); |
|||
} |
|||
if (borderColor !== '') { |
|||
table.attr('borderColor', borderColor); |
|||
} else { |
|||
table.removeAttr('borderColor'); |
|||
} |
|||
self.hideDialog().focus(); |
|||
self.cmd.range.moveToBookmark(bookmark); |
|||
self.cmd.select(); |
|||
self.addBookmark(); |
|||
return; |
|||
} |
|||
//insert new table
|
|||
var style = ''; |
|||
if (width !== '') { |
|||
style += 'width:' + width + widthType + ';'; |
|||
} |
|||
if (height !== '') { |
|||
style += 'height:' + height + heightType + ';'; |
|||
} |
|||
if (bgColor !== '') { |
|||
style += 'background-color:' + bgColor + ';'; |
|||
} |
|||
var html = '<table'; |
|||
if (style !== '') { |
|||
html += ' style="' + style + '"'; |
|||
} |
|||
if (padding !== '') { |
|||
html += ' cellpadding="' + padding + '"'; |
|||
} |
|||
if (spacing !== '') { |
|||
html += ' cellspacing="' + spacing + '"'; |
|||
} |
|||
if (align !== '') { |
|||
html += ' align="' + align + '"'; |
|||
} |
|||
if (border !== '') { |
|||
html += ' border="' + border + '"'; |
|||
} |
|||
if (border === '' || border === '0') { |
|||
html += ' class="' + zeroborder + '"'; |
|||
} |
|||
if (borderColor !== '') { |
|||
html += ' bordercolor="' + borderColor + '"'; |
|||
} |
|||
html += '>'; |
|||
for (var i = 0; i < rows; i++) { |
|||
html += '<tr>'; |
|||
for (var j = 0; j < cols; j++) { |
|||
html += '<td>' + (K.IE ? ' ' : '<br />') + '</td>'; |
|||
} |
|||
html += '</tr>'; |
|||
} |
|||
html += '</table>'; |
|||
if (!K.IE) { |
|||
html += '<br />'; |
|||
} |
|||
self.insertHtml(html); |
|||
self.select().hideDialog().focus(); |
|||
self.addBookmark(); |
|||
} |
|||
} |
|||
}), |
|||
div = dialog.div, |
|||
rowsBox = K('[name="rows"]', div).val(3), |
|||
colsBox = K('[name="cols"]', div).val(2), |
|||
widthBox = K('[name="width"]', div).val(100), |
|||
heightBox = K('[name="height"]', div), |
|||
widthTypeBox = K('[name="widthType"]', div), |
|||
heightTypeBox = K('[name="heightType"]', div), |
|||
paddingBox = K('[name="padding"]', div).val(2), |
|||
spacingBox = K('[name="spacing"]', div).val(0), |
|||
alignBox = K('[name="align"]', div), |
|||
borderBox = K('[name="border"]', div).val(1), |
|||
colorBox = K('.ke-input-color', div); |
|||
_initColorPicker(div, colorBox.eq(0)); |
|||
_initColorPicker(div, colorBox.eq(1)); |
|||
_setColor(colorBox.eq(0), '#000000'); |
|||
_setColor(colorBox.eq(1), ''); |
|||
// foucs and select
|
|||
rowsBox[0].focus(); |
|||
rowsBox[0].select(); |
|||
var table; |
|||
if (isInsert) { |
|||
return; |
|||
} |
|||
//get selected table node
|
|||
table = self.plugin.getSelectedTable(); |
|||
if (table) { |
|||
rowsBox.val(table[0].rows.length); |
|||
colsBox.val(table[0].rows.length > 0 ? table[0].rows[0].cells.length : 0); |
|||
rowsBox.attr('disabled', true); |
|||
colsBox.attr('disabled', true); |
|||
var match, |
|||
tableWidth = table[0].style.width || table[0].width, |
|||
tableHeight = table[0].style.height || table[0].height; |
|||
if (tableWidth !== undefined && (match = /^(\d+)((?:px|%)*)$/.exec(tableWidth))) { |
|||
widthBox.val(match[1]); |
|||
widthTypeBox.val(match[2]); |
|||
} else { |
|||
widthBox.val(''); |
|||
} |
|||
if (tableHeight !== undefined && (match = /^(\d+)((?:px|%)*)$/.exec(tableHeight))) { |
|||
heightBox.val(match[1]); |
|||
heightTypeBox.val(match[2]); |
|||
} |
|||
paddingBox.val(table[0].cellPadding || ''); |
|||
spacingBox.val(table[0].cellSpacing || ''); |
|||
alignBox.val(table[0].align || ''); |
|||
borderBox.val(table[0].border === undefined ? '' : table[0].border); |
|||
_setColor(colorBox.eq(0), K.toHex(table.attr('borderColor') || '')); |
|||
_setColor(colorBox.eq(1), K.toHex(table[0].style.backgroundColor || table[0].bgColor || '')); |
|||
widthBox[0].focus(); |
|||
widthBox[0].select(); |
|||
} |
|||
}, |
|||
//modify cell
|
|||
cellprop : function() { |
|||
var html = [ |
|||
'<div style="padding:20px;">', |
|||
//width, height
|
|||
'<div class="ke-dialog-row">', |
|||
'<label for="keWidth" style="width:90px;">' + lang.size + '</label>', |
|||
lang.width + ' <input type="text" id="keWidth" class="ke-input-text ke-input-number" name="width" value="" maxlength="4" /> ', |
|||
'<select name="widthType">', |
|||
'<option value="%">' + lang.percent + '</option>', |
|||
'<option value="px">' + lang.px + '</option>', |
|||
'</select> ', |
|||
lang.height + ' <input type="text" class="ke-input-text ke-input-number" name="height" value="" maxlength="4" /> ', |
|||
'<select name="heightType">', |
|||
'<option value="%">' + lang.percent + '</option>', |
|||
'<option value="px">' + lang.px + '</option>', |
|||
'</select>', |
|||
'</div>', |
|||
//align
|
|||
'<div class="ke-dialog-row">', |
|||
'<label for="keAlign" style="width:90px;">' + lang.align + '</label>', |
|||
lang.textAlign + ' <select id="keAlign" name="textAlign">', |
|||
'<option value="">' + lang.alignDefault + '</option>', |
|||
'<option value="left">' + lang.alignLeft + '</option>', |
|||
'<option value="center">' + lang.alignCenter + '</option>', |
|||
'<option value="right">' + lang.alignRight + '</option>', |
|||
'</select> ', |
|||
lang.verticalAlign + ' <select name="verticalAlign">', |
|||
'<option value="">' + lang.alignDefault + '</option>', |
|||
'<option value="top">' + lang.alignTop + '</option>', |
|||
'<option value="middle">' + lang.alignMiddle + '</option>', |
|||
'<option value="bottom">' + lang.alignBottom + '</option>', |
|||
'<option value="baseline">' + lang.alignBaseline + '</option>', |
|||
'</select>', |
|||
'</div>', |
|||
//border
|
|||
'<div class="ke-dialog-row">', |
|||
'<label for="keBorder" style="width:90px;">' + lang.border + '</label>', |
|||
lang.borderWidth + ' <input type="text" id="keBorder" class="ke-input-text ke-input-number" name="border" value="" maxlength="4" /> ', |
|||
lang.borderColor + ' <span class="ke-inline-block ke-input-color"></span>', |
|||
'</div>', |
|||
//background color
|
|||
'<div class="ke-dialog-row">', |
|||
'<label for="keBgColor" style="width:90px;">' + lang.backgroundColor + '</label>', |
|||
'<span class="ke-inline-block ke-input-color"></span>', |
|||
'</div>', |
|||
'</div>' |
|||
].join(''); |
|||
var bookmark = self.cmd.range.createBookmark(); |
|||
var dialog = self.createDialog({ |
|||
name : name, |
|||
width : 500, |
|||
title : self.lang('tablecell'), |
|||
body : html, |
|||
beforeRemove : function() { |
|||
colorBox.unbind(); |
|||
}, |
|||
yesBtn : { |
|||
name : self.lang('yes'), |
|||
click : function(e) { |
|||
var width = widthBox.val(), |
|||
height = heightBox.val(), |
|||
widthType = widthTypeBox.val(), |
|||
heightType = heightTypeBox.val(), |
|||
padding = paddingBox.val(), |
|||
spacing = spacingBox.val(), |
|||
textAlign = textAlignBox.val(), |
|||
verticalAlign = verticalAlignBox.val(), |
|||
border = borderBox.val(), |
|||
borderColor = K(colorBox[0]).html() || '', |
|||
bgColor = K(colorBox[1]).html() || ''; |
|||
if (!/^\d*$/.test(width)) { |
|||
alert(self.lang('invalidWidth')); |
|||
widthBox[0].focus(); |
|||
return; |
|||
} |
|||
if (!/^\d*$/.test(height)) { |
|||
alert(self.lang('invalidHeight')); |
|||
heightBox[0].focus(); |
|||
return; |
|||
} |
|||
if (!/^\d*$/.test(border)) { |
|||
alert(self.lang('invalidBorder')); |
|||
borderBox[0].focus(); |
|||
return; |
|||
} |
|||
cell.css({ |
|||
width : width !== '' ? (width + widthType) : '', |
|||
height : height !== '' ? (height + heightType) : '', |
|||
'background-color' : bgColor, |
|||
'text-align' : textAlign, |
|||
'vertical-align' : verticalAlign, |
|||
'border-width' : border, |
|||
'border-style' : border !== '' ? 'solid' : '', |
|||
'border-color' : borderColor |
|||
}); |
|||
self.hideDialog().focus(); |
|||
self.cmd.range.moveToBookmark(bookmark); |
|||
self.cmd.select(); |
|||
self.addBookmark(); |
|||
} |
|||
} |
|||
}), |
|||
div = dialog.div, |
|||
widthBox = K('[name="width"]', div).val(100), |
|||
heightBox = K('[name="height"]', div), |
|||
widthTypeBox = K('[name="widthType"]', div), |
|||
heightTypeBox = K('[name="heightType"]', div), |
|||
paddingBox = K('[name="padding"]', div).val(2), |
|||
spacingBox = K('[name="spacing"]', div).val(0), |
|||
textAlignBox = K('[name="textAlign"]', div), |
|||
verticalAlignBox = K('[name="verticalAlign"]', div), |
|||
borderBox = K('[name="border"]', div).val(1), |
|||
colorBox = K('.ke-input-color', div); |
|||
_initColorPicker(div, colorBox.eq(0)); |
|||
_initColorPicker(div, colorBox.eq(1)); |
|||
_setColor(colorBox.eq(0), '#000000'); |
|||
_setColor(colorBox.eq(1), ''); |
|||
// foucs and select
|
|||
widthBox[0].focus(); |
|||
widthBox[0].select(); |
|||
// get selected cell
|
|||
var cell = self.plugin.getSelectedCell(); |
|||
var match, |
|||
cellWidth = cell[0].style.width || cell[0].width || '', |
|||
cellHeight = cell[0].style.height || cell[0].height || ''; |
|||
if ((match = /^(\d+)((?:px|%)*)$/.exec(cellWidth))) { |
|||
widthBox.val(match[1]); |
|||
widthTypeBox.val(match[2]); |
|||
} else { |
|||
widthBox.val(''); |
|||
} |
|||
if ((match = /^(\d+)((?:px|%)*)$/.exec(cellHeight))) { |
|||
heightBox.val(match[1]); |
|||
heightTypeBox.val(match[2]); |
|||
} |
|||
textAlignBox.val(cell[0].style.textAlign || ''); |
|||
verticalAlignBox.val(cell[0].style.verticalAlign || ''); |
|||
var border = cell[0].style.borderWidth || ''; |
|||
if (border) { |
|||
border = parseInt(border); |
|||
} |
|||
borderBox.val(border); |
|||
_setColor(colorBox.eq(0), K.toHex(cell[0].style.borderColor || '')); |
|||
_setColor(colorBox.eq(1), K.toHex(cell[0].style.backgroundColor || '')); |
|||
widthBox[0].focus(); |
|||
widthBox[0].select(); |
|||
}, |
|||
insert : function() { |
|||
this.prop(true); |
|||
}, |
|||
'delete' : function() { |
|||
var table = self.plugin.getSelectedTable(); |
|||
self.cmd.range.setStartBefore(table[0]).collapse(true); |
|||
self.cmd.select(); |
|||
table.remove(); |
|||
self.addBookmark(); |
|||
}, |
|||
colinsert : function(offset) { |
|||
var table = self.plugin.getSelectedTable()[0], |
|||
row = self.plugin.getSelectedRow()[0], |
|||
cell = self.plugin.getSelectedCell()[0], |
|||
index = cell.cellIndex + offset; |
|||
// 取得第一行的index
|
|||
index += table.rows[0].cells.length - row.cells.length; |
|||
|
|||
for (var i = 0, len = table.rows.length; i < len; i++) { |
|||
var newRow = table.rows[i], |
|||
newCell = newRow.insertCell(index); |
|||
newCell.innerHTML = K.IE ? '' : '<br />'; |
|||
// 调整下一行的单元格index
|
|||
index = _getCellIndex(table, newRow, newCell); |
|||
} |
|||
self.cmd.range.selectNodeContents(cell).collapse(true); |
|||
self.cmd.select(); |
|||
self.addBookmark(); |
|||
}, |
|||
colinsertleft : function() { |
|||
this.colinsert(0); |
|||
}, |
|||
colinsertright : function() { |
|||
this.colinsert(1); |
|||
}, |
|||
rowinsert : function(offset) { |
|||
var table = self.plugin.getSelectedTable()[0], |
|||
row = self.plugin.getSelectedRow()[0], |
|||
cell = self.plugin.getSelectedCell()[0]; |
|||
var rowIndex = row.rowIndex; |
|||
if (offset === 1) { |
|||
rowIndex = row.rowIndex + (cell.rowSpan - 1) + offset; |
|||
} |
|||
var newRow = table.insertRow(rowIndex); |
|||
|
|||
for (var i = 0, len = row.cells.length; i < len; i++) { |
|||
// 调整cell个数
|
|||
if (row.cells[i].rowSpan > 1) { |
|||
len -= row.cells[i].rowSpan - 1; |
|||
} |
|||
var newCell = newRow.insertCell(i); |
|||
// copy colspan
|
|||
if (offset === 1 && row.cells[i].colSpan > 1) { |
|||
newCell.colSpan = row.cells[i].colSpan; |
|||
} |
|||
newCell.innerHTML = K.IE ? '' : '<br />'; |
|||
} |
|||
// 调整rowspan
|
|||
for (var j = rowIndex; j >= 0; j--) { |
|||
var cells = table.rows[j].cells; |
|||
if (cells.length > i) { |
|||
for (var k = cell.cellIndex; k >= 0; k--) { |
|||
if (cells[k].rowSpan > 1) { |
|||
cells[k].rowSpan += 1; |
|||
} |
|||
} |
|||
break; |
|||
} |
|||
} |
|||
self.cmd.range.selectNodeContents(cell).collapse(true); |
|||
self.cmd.select(); |
|||
self.addBookmark(); |
|||
}, |
|||
rowinsertabove : function() { |
|||
this.rowinsert(0); |
|||
}, |
|||
rowinsertbelow : function() { |
|||
this.rowinsert(1); |
|||
}, |
|||
rowmerge : function() { |
|||
var table = self.plugin.getSelectedTable()[0], |
|||
row = self.plugin.getSelectedRow()[0], |
|||
cell = self.plugin.getSelectedCell()[0], |
|||
rowIndex = row.rowIndex, // 当前行的index
|
|||
nextRowIndex = rowIndex + cell.rowSpan, // 下一行的index
|
|||
nextRow = table.rows[nextRowIndex]; // 下一行
|
|||
// 最后一行不能合并
|
|||
if (table.rows.length <= nextRowIndex) { |
|||
return; |
|||
} |
|||
var cellIndex = cell.cellIndex; // 下一行单元格的index
|
|||
if (nextRow.cells.length <= cellIndex) { |
|||
return; |
|||
} |
|||
var nextCell = nextRow.cells[cellIndex]; // 下一行单元格
|
|||
// 上下行的colspan不一致时不能合并
|
|||
if (cell.colSpan !== nextCell.colSpan) { |
|||
return; |
|||
} |
|||
cell.rowSpan += nextCell.rowSpan; |
|||
nextRow.deleteCell(cellIndex); |
|||
self.cmd.range.selectNodeContents(cell).collapse(true); |
|||
self.cmd.select(); |
|||
self.addBookmark(); |
|||
}, |
|||
colmerge : function() { |
|||
var table = self.plugin.getSelectedTable()[0], |
|||
row = self.plugin.getSelectedRow()[0], |
|||
cell = self.plugin.getSelectedCell()[0], |
|||
rowIndex = row.rowIndex, // 当前行的index
|
|||
cellIndex = cell.cellIndex, |
|||
nextCellIndex = cellIndex + 1; |
|||
// 最后一列不能合并
|
|||
if (row.cells.length <= nextCellIndex) { |
|||
return; |
|||
} |
|||
var nextCell = row.cells[nextCellIndex]; |
|||
// 左右列的rowspan不一致时不能合并
|
|||
if (cell.rowSpan !== nextCell.rowSpan) { |
|||
return; |
|||
} |
|||
cell.colSpan += nextCell.colSpan; |
|||
row.deleteCell(nextCellIndex); |
|||
self.cmd.range.selectNodeContents(cell).collapse(true); |
|||
self.cmd.select(); |
|||
self.addBookmark(); |
|||
}, |
|||
rowsplit : function() { |
|||
var table = self.plugin.getSelectedTable()[0], |
|||
row = self.plugin.getSelectedRow()[0], |
|||
cell = self.plugin.getSelectedCell()[0], |
|||
rowIndex = row.rowIndex; |
|||
// 不是可分割单元格
|
|||
if (cell.rowSpan === 1) { |
|||
return; |
|||
} |
|||
var cellIndex = _getCellIndex(table, row, cell); |
|||
for (var i = 1, len = cell.rowSpan; i < len; i++) { |
|||
var newRow = table.rows[rowIndex + i], |
|||
newCell = newRow.insertCell(cellIndex); |
|||
if (cell.colSpan > 1) { |
|||
newCell.colSpan = cell.colSpan; |
|||
} |
|||
newCell.innerHTML = K.IE ? '' : '<br />'; |
|||
// 调整下一行的单元格index
|
|||
cellIndex = _getCellIndex(table, newRow, newCell); |
|||
} |
|||
K(cell).removeAttr('rowSpan'); |
|||
self.cmd.range.selectNodeContents(cell).collapse(true); |
|||
self.cmd.select(); |
|||
self.addBookmark(); |
|||
}, |
|||
colsplit : function() { |
|||
var table = self.plugin.getSelectedTable()[0], |
|||
row = self.plugin.getSelectedRow()[0], |
|||
cell = self.plugin.getSelectedCell()[0], |
|||
cellIndex = cell.cellIndex; |
|||
// 不是可分割单元格
|
|||
if (cell.colSpan === 1) { |
|||
return; |
|||
} |
|||
for (var i = 1, len = cell.colSpan; i < len; i++) { |
|||
var newCell = row.insertCell(cellIndex + i); |
|||
if (cell.rowSpan > 1) { |
|||
newCell.rowSpan = cell.rowSpan; |
|||
} |
|||
newCell.innerHTML = K.IE ? '' : '<br />'; |
|||
} |
|||
K(cell).removeAttr('colSpan'); |
|||
self.cmd.range.selectNodeContents(cell).collapse(true); |
|||
self.cmd.select(); |
|||
self.addBookmark(); |
|||
}, |
|||
coldelete : function() { |
|||
var table = self.plugin.getSelectedTable()[0], |
|||
row = self.plugin.getSelectedRow()[0], |
|||
cell = self.plugin.getSelectedCell()[0], |
|||
index = cell.cellIndex; |
|||
for (var i = 0, len = table.rows.length; i < len; i++) { |
|||
var newRow = table.rows[i], |
|||
newCell = newRow.cells[index]; |
|||
if (newCell.colSpan > 1) { |
|||
newCell.colSpan -= 1; |
|||
if (newCell.colSpan === 1) { |
|||
K(newCell).removeAttr('colSpan'); |
|||
} |
|||
} else { |
|||
newRow.deleteCell(index); |
|||
} |
|||
// 跳过不需要删除的行
|
|||
if (newCell.rowSpan > 1) { |
|||
i += newCell.rowSpan - 1; |
|||
} |
|||
} |
|||
if (row.cells.length === 0) { |
|||
self.cmd.range.setStartBefore(table).collapse(true); |
|||
self.cmd.select(); |
|||
K(table).remove(); |
|||
} else { |
|||
self.cmd.selection(true); |
|||
} |
|||
self.addBookmark(); |
|||
}, |
|||
rowdelete : function() { |
|||
var table = self.plugin.getSelectedTable()[0], |
|||
row = self.plugin.getSelectedRow()[0], |
|||
cell = self.plugin.getSelectedCell()[0], |
|||
rowIndex = row.rowIndex; |
|||
// 从下到上删除
|
|||
for (var i = cell.rowSpan - 1; i >= 0; i--) { |
|||
table.deleteRow(rowIndex + i); |
|||
} |
|||
if (table.rows.length === 0) { |
|||
self.cmd.range.setStartBefore(table).collapse(true); |
|||
self.cmd.select(); |
|||
K(table).remove(); |
|||
} else { |
|||
self.cmd.selection(true); |
|||
} |
|||
self.addBookmark(); |
|||
} |
|||
}; |
|||
self.clickToolbar(name, self.plugin.table.prop); |
|||
}); |
|||
@ -0,0 +1,58 @@ |
|||
/******************************************************************************* |
|||
* 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('template', function(K) { |
|||
var self = this, name = 'template', lang = self.lang(name + '.'), |
|||
htmlPath = self.pluginsPath + name + '/html/'; |
|||
function getFilePath(fileName) { |
|||
return htmlPath + fileName + '?ver=' + encodeURIComponent(K.DEBUG ? K.TIME : K.VERSION); |
|||
} |
|||
self.clickToolbar(name, function() { |
|||
var lang = self.lang(name + '.'), |
|||
arr = ['<div style="padding:10px 20px;">', |
|||
'<div class="ke-header">', |
|||
// left start
|
|||
'<div class="ke-left">', |
|||
lang. selectTemplate + ' <select>']; |
|||
K.each(lang.fileList, function(key, val) { |
|||
arr.push('<option value="' + key + '">' + val + '</option>'); |
|||
}); |
|||
html = [arr.join(''), |
|||
'</select></div>', |
|||
// right start
|
|||
'<div class="ke-right">', |
|||
'<input type="checkbox" id="keReplaceFlag" name="replaceFlag" value="1" /> <label for="keReplaceFlag">' + lang.replaceContent + '</label>', |
|||
'</div>', |
|||
'<div class="ke-clearfix"></div>', |
|||
'</div>', |
|||
'<iframe class="ke-textarea" frameborder="0" style="width:458px;height:260px;background-color:#FFF;"></iframe>', |
|||
'</div>'].join(''); |
|||
var dialog = self.createDialog({ |
|||
name : name, |
|||
width : 500, |
|||
title : self.lang(name), |
|||
body : html, |
|||
yesBtn : { |
|||
name : self.lang('yes'), |
|||
click : function(e) { |
|||
var doc = K.iframeDoc(iframe); |
|||
self[checkbox[0].checked ? 'html' : 'insertHtml'](doc.body.innerHTML).hideDialog().focus(); |
|||
} |
|||
} |
|||
}); |
|||
var selectBox = K('select', dialog.div), |
|||
checkbox = K('[name="replaceFlag"]', dialog.div), |
|||
iframe = K('iframe', dialog.div); |
|||
checkbox[0].checked = true; |
|||
iframe.attr('src', getFilePath(selectBox.val())); |
|||
selectBox.change(function() { |
|||
iframe.attr('src', getFilePath(this.value)); |
|||
}); |
|||
}); |
|||
}); |
|||
|
After Width: | Height: | Size: 989 B |
@ -0,0 +1,100 @@ |
|||
/* container */ |
|||
.ke-container-simple { |
|||
display: block; |
|||
border: 1px solid #CCC; |
|||
background-color: #FFF; |
|||
overflow: hidden; |
|||
} |
|||
/* toolbar */ |
|||
.ke-container-simple .ke-toolbar { |
|||
border-bottom: 1px solid #CCC; |
|||
background-color: #FFF; |
|||
padding: 2px 5px; |
|||
overflow: hidden; |
|||
} |
|||
.ke-container-simple .ke-toolbar .ke-outline { |
|||
border: 1px solid #FFF; |
|||
background-color: transparent; |
|||
margin: 1px; |
|||
padding: 1px 2px; |
|||
font-size: 0; |
|||
line-height: 0; |
|||
overflow: hidden; |
|||
cursor: pointer; |
|||
} |
|||
.ke-container-simple .ke-toolbar .ke-on { |
|||
border: 1px solid #5690D2; |
|||
} |
|||
.ke-container-simple .ke-toolbar .ke-selected { |
|||
border: 1px solid #5690D2; |
|||
background-color: #E9EFF6; |
|||
} |
|||
.ke-container-simple .ke-toolbar .ke-disabled { |
|||
cursor: default; |
|||
} |
|||
/* statusbar */ |
|||
.ke-container-simple .ke-statusbar { |
|||
position: relative; |
|||
background-color: #FFF; |
|||
border-top: 1px solid #CCCCCC; |
|||
font-size: 0; |
|||
line-height: 0; |
|||
*height: 12px; |
|||
overflow: hidden; |
|||
text-align: center; |
|||
cursor: s-resize; |
|||
} |
|||
/* menu */ |
|||
.ke-menu-simple { |
|||
border: 1px solid #A0A0A0; |
|||
background-color: #FFF; |
|||
color: #222222; |
|||
padding: 2px; |
|||
font-family: "sans serif",tahoma,verdana,helvetica; |
|||
font-size: 12px; |
|||
text-align: left; |
|||
overflow: hidden; |
|||
} |
|||
.ke-menu-simple .ke-menu-item { |
|||
border: 1px solid #FFF; |
|||
background-color: #FFF; |
|||
color: #222222; |
|||
height: 24px; |
|||
overflow: hidden; |
|||
cursor: pointer; |
|||
} |
|||
.ke-menu-simple .ke-menu-item-on { |
|||
border: 1px solid #5690D2; |
|||
background-color: #FFF; |
|||
} |
|||
/* colorpicker */ |
|||
.ke-colorpicker-simple { |
|||
border: 1px solid #A0A0A0; |
|||
background-color: #FEFEFE; |
|||
color: #222222; |
|||
padding: 2px; |
|||
} |
|||
.ke-colorpicker-simple .ke-colorpicker-cell { |
|||
font-size: 0; |
|||
line-height: 0; |
|||
border: 1px solid #FEFEFE; |
|||
cursor: pointer; |
|||
margin:3px; |
|||
padding:0; |
|||
} |
|||
.ke-colorpicker-simple .ke-colorpicker-cell-top { |
|||
font-family: "sans serif",tahoma,verdana,helvetica; |
|||
font-size: 12px; |
|||
line-height: 24px; |
|||
border: 1px solid #FEFEFE; |
|||
cursor: pointer; |
|||
margin:0; |
|||
padding:0; |
|||
text-align: center; |
|||
} |
|||
.ke-colorpicker-simple .ke-colorpicker-cell-on { |
|||
border: 1px solid #5690D2; |
|||
} |
|||
.ke-colorpicker-simple .ke-colorpicker-cell-selected { |
|||
border: 1px solid #2446AB; |
|||
} |
|||
|
After Width: | Height: | Size: 354 B |
|
After Width: | Height: | Size: 329 B |
|
After Width: | Height: | Size: 331 B |
|
After Width: | Height: | Size: 342 B |
|
After Width: | Height: | Size: 340 B |
|
After Width: | Height: | Size: 336 B |
|
After Width: | Height: | Size: 338 B |
|
After Width: | Height: | Size: 343 B |
|
After Width: | Height: | Size: 321 B |
|
After Width: | Height: | Size: 323 B |
|
After Width: | Height: | Size: 344 B |
|
After Width: | Height: | Size: 338 B |
|
After Width: | Height: | Size: 328 B |
|
After Width: | Height: | Size: 337 B |
|
After Width: | Height: | Size: 350 B |
|
After Width: | Height: | Size: 336 B |
|
After Width: | Height: | Size: 445 B |
|
After Width: | Height: | Size: 1.6 KiB |
|
After Width: | Height: | Size: 1.6 KiB |
|
After Width: | Height: | Size: 445 B |
|
After Width: | Height: | Size: 1.6 KiB |
@ -0,0 +1,118 @@ |
|||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" |
|||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
|||
<html xmlns="http://www.w3.org/1999/xhtml"> |
|||
<head> |
|||
<meta charset="utf-8"/> |
|||
<meta name="keywords" content="百度地图,百度地图API,百度地图自定义工具,百度地图所见即所得工具"/> |
|||
<meta name="description" content="百度地图API自定义地图,帮助用户在可视化操作下生成百度地图"/> |
|||
<title>百度地图API自定义地图</title> |
|||
<!--引用百度地图API--> |
|||
<style type="text/css"> |
|||
html, body { |
|||
margin: 0; |
|||
padding: 0; |
|||
overflow: hidden; |
|||
} |
|||
</style> |
|||
<script type="text/javascript" src="./api.js?key=&v=1.1&services=true"></script> |
|||
</head> |
|||
|
|||
<body onload="initMap();"> |
|||
<!--百度地图容器--> |
|||
<div style="width:697px;height:550px;border:#ccc solid 1px;" id="dituContent"></div> |
|||
</body> |
|||
<script type="text/javascript"> |
|||
function getParam(name) { |
|||
return location.href.match(new RegExp('[?#&]' + name + '=([^?#&]+)', 'i')) ? RegExp.$1 : ''; |
|||
} |
|||
var map, marker; |
|||
var centerParam = getParam('center'); |
|||
var zoomParam = getParam('zoom'); |
|||
var widthParam = getParam('width'); |
|||
var heightParam = getParam('height'); |
|||
var markersParam = getParam('markers'); |
|||
var markerStylesParam = getParam('markerStyles'); |
|||
|
|||
//创建和初始化地图函数: |
|||
function initMap() { |
|||
// [FF]切换模式后报错 |
|||
if (!window.BMap) { |
|||
return; |
|||
} |
|||
var dituContent = document.getElementById('dituContent'); |
|||
dituContent.style.width = widthParam + 'px'; |
|||
dituContent.style.height = heightParam + 'px'; |
|||
|
|||
createMap();//创建地图 |
|||
setMapEvent();//设置地图事件 |
|||
addMapControl();//向地图添加控件 |
|||
|
|||
// 创建标注 |
|||
var markersArr = markersParam.split(','); |
|||
var point = new BMap.Point(markersArr[0], markersArr[1]); |
|||
marker = new BMap.Marker(point); |
|||
marker.enableDragging(); |
|||
map.addOverlay(marker); // 将标注添加到地图中 |
|||
|
|||
if(parent.editor && parent.document.body.contentEditable=="true") { //在编辑状态下 |
|||
setMapListener();//地图改变修改外层的iframe标签src属性 |
|||
} |
|||
} |
|||
|
|||
//创建地图函数: |
|||
function createMap() { |
|||
map = new BMap.Map("dituContent");//在百度地图容器中创建一个地图 |
|||
var centerArr = centerParam.split(','); |
|||
var point = new BMap.Point(parseFloat(centerArr[0]), parseFloat(centerArr[1]));//定义一个中心点坐标 |
|||
map.centerAndZoom(point, parseInt(zoomParam));//设定地图的中心点和坐标并将地图显示在地图容器中 |
|||
} |
|||
|
|||
//地图事件设置函数: |
|||
function setMapEvent() { |
|||
map.enableDragging();//启用地图拖拽事件,默认启用(可不写) |
|||
map.enableScrollWheelZoom();//启用地图滚轮放大缩小 |
|||
map.enableDoubleClickZoom();//启用鼠标双击放大,默认启用(可不写) |
|||
map.enableKeyboard();//启用键盘上下左右键移动地图 |
|||
} |
|||
|
|||
//地图控件添加函数: |
|||
function addMapControl() { |
|||
//向地图中添加缩放控件 |
|||
var ctrl_nav = new BMap.NavigationControl({anchor: BMAP_ANCHOR_TOP_LEFT, type: BMAP_NAVIGATION_CONTROL_LARGE}); |
|||
map.addControl(ctrl_nav); |
|||
//向地图中添加缩略图控件 |
|||
var ctrl_ove = new BMap.OverviewMapControl({anchor: BMAP_ANCHOR_BOTTOM_RIGHT, isOpen: 1}); |
|||
map.addControl(ctrl_ove); |
|||
//向地图中添加比例尺控件 |
|||
var ctrl_sca = new BMap.ScaleControl({anchor: BMAP_ANCHOR_BOTTOM_LEFT}); |
|||
map.addControl(ctrl_sca); |
|||
} |
|||
|
|||
function setMapListener() { |
|||
var editor = parent.editor, containerIframe, |
|||
iframes = parent.document.getElementsByTagName('iframe'); |
|||
for (var key in iframes) { |
|||
if (iframes[key].contentWindow == window) { |
|||
containerIframe = iframes[key]; |
|||
break; |
|||
} |
|||
} |
|||
if (containerIframe) { |
|||
map.addEventListener('moveend', mapListenerHandler); |
|||
map.addEventListener('zoomend', mapListenerHandler); |
|||
marker.addEventListener('dragend', mapListenerHandler); |
|||
} |
|||
|
|||
function mapListenerHandler() { |
|||
var zoom = map.getZoom(), |
|||
center = map.getCenter(), |
|||
marker = window.marker.getPoint(); |
|||
containerIframe.src = containerIframe.src. |
|||
replace(new RegExp('([?#&])center=([^?#&]+)', 'i'), '$1center=' + center.lng + ',' + center.lat). |
|||
replace(new RegExp('([?#&])markers=([^?#&]+)', 'i'), '$1markers=' + marker.lng + ',' + marker.lat). |
|||
replace(new RegExp('([?#&])zoom=([^?#&]+)', 'i'), '$1zoom=' + zoom); |
|||
editor.fireEvent('saveScene'); |
|||
} |
|||
} |
|||
</script> |
|||
</html> |
|||
|
After Width: | Height: | Size: 435 B |
|
After Width: | Height: | Size: 330 B |
|
After Width: | Height: | Size: 775 B |
@ -0,0 +1 @@ |
|||
.border_style1,.colorBar a{box-shadow:2px 2px 5px #d3d6da}body{margin:0}table{width:100%}table td{padding:2px 4px;vertical-align:middle}a{text-decoration:none}em{font-style:normal}.border_style1{border:1px solid #ccc;border-radius:5px}.main{margin:8px;overflow:hidden}.colorBar,.operateBar{margin-top:10px;font-size:12px;text-align:center}.hot{float:left;height:335px}.drawBoard{position:relative;cursor:crosshair}.brushBorad{position:absolute;left:0;top:0;z-index:998}.picBoard{border:none;text-align:center;line-height:300px;cursor:default}.operateBar span{margin-left:10px}.drawToolbar{float:right;width:110px;height:300px;overflow:hidden}.colorBar a{display:block;width:10px;height:10px;border:1px solid #1006F1;border-radius:3px;opacity:.3}.sectionBar{margin-top:15px;font-size:12px;text-align:center}.sectionBar a{display:inline-block;width:10px;height:12px;color:#888;text-indent:-999px;opacity:.3}.size1{background:url(images/size.png) 1px center no-repeat}.size2{background:url(images/size.png) -10px center no-repeat}.size3{background:url(images/size.png) -22px center no-repeat}.size4{background:url(images/size.png) -35px center no-repeat}.addImgH{position:relative}.addImgH_form{position:absolute;left:18px;top:-1px;width:75px;height:21px;opacity:0;cursor:pointer}.addImgH_form input,.maskLayer{width:100%}.maskLayerNull{display:none}.maskLayer{position:absolute;top:0;left:0;height:100%;opacity:.7;background-color:#fff;text-align:center;font-weight:700;line-height:300px;z-index:1000}.addImgH .icon,.brushIcon,.clearBoard .icon,.clearBoardH .icon,.eraserIcon,.nextStep .icon,.nextStepH .icon,.previousStep .icon,.previousStepH .icon,.removeImg .icon,.removeImgH .icon,.scaleBoard .icon{display:inline-block;width:16px;height:16px}.previousStepH .icon{background-image:url(images/undoH.png);cursor:pointer}.previousStepH .text{color:#888;cursor:pointer}.previousStep .icon{background-image:url(images/undo.png);cursor:default}.previousStep .text{color:#ccc;cursor:default}.nextStepH .icon{background-image:url(images/redoH.png);cursor:pointer}.nextStepH .text{color:#888;cursor:pointer}.nextStep .icon{background-image:url(images/redo.png);cursor:default}.nextStep .text{color:#ccc;cursor:default}.clearBoardH .icon{background-image:url(images/emptyH.png);cursor:pointer}.clearBoardH .text{color:#888;cursor:pointer}.clearBoard .icon{background-image:url(images/empty.png);cursor:default}.clearBoard .text{color:#ccc;cursor:default}.scaleBoardH .icon{display:inline-block;width:16px;height:16px;background-image:url(images/scaleH.png);cursor:pointer}.scaleBoardH .text{color:#888;cursor:pointer}.scaleBoard .icon{background-image:url(images/scale.png);cursor:default}.scaleBoard .text{color:#ccc;cursor:default}.removeImgH .icon{background-image:url(images/delimgH.png);cursor:pointer}.removeImgH .text{color:#888;cursor:pointer}.removeImg .icon{background-image:url(images/delimg.png);cursor:default}.removeImg .text{color:#ccc;cursor:default}.addImgH .icon{vertical-align:top;background-image:url(images/addimg.png)}.addImgH .text{color:#888;cursor:pointer}.brushIcon{background-image:url(images/brush.png)}.eraserIcon{background-image:url(images/eraser.png)} |
|||
@ -0,0 +1,95 @@ |
|||
<!DOCTYPE html> |
|||
<html> |
|||
<head> |
|||
<title></title> |
|||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> |
|||
<meta name="robots" content="noindex, nofollow"/> |
|||
<script type="text/javascript" src="../internal.js"></script> |
|||
<link rel="stylesheet" type="text/css" href="scrawl.css"> |
|||
</head> |
|||
<body> |
|||
<div class="main" id="J_wrap"> |
|||
<div class="hot"> |
|||
<div class="drawBoard border_style1"> |
|||
<canvas id="J_brushBoard" class="brushBorad" width="360" height="300"></canvas> |
|||
<div id="J_picBoard" class="picBoard" style="width: 360px;height: 300px"></div> |
|||
</div> |
|||
<div id="J_operateBar" class="operateBar"> |
|||
<span id="J_previousStep" class="previousStep"> |
|||
<em class="icon"></em> |
|||
<em class="text"><var id="lang_input_previousStep"></var></em> |
|||
</span> |
|||
<span id="J_nextStep" class="nextStep"> |
|||
<em class="icon"></em> |
|||
<em class="text"><var id="lang_input_nextsStep"></var></em> |
|||
</span> |
|||
<span id="J_clearBoard" class="clearBoard"> |
|||
<em class="icon"></em> |
|||
<em class="text"><var id="lang_input_clear"></var></em> |
|||
</span> |
|||
<span id="J_sacleBoard" class="scaleBoard"> |
|||
<em class="icon"></em> |
|||
<em class="text"><var id="lang_input_ScalePic"></var></em> |
|||
</span> |
|||
</div> |
|||
</div> |
|||
<div class="drawToolbar border_style1"> |
|||
<div id="J_colorBar" class="colorBar"></div> |
|||
<div id="J_brushBar" class="sectionBar"> |
|||
<em class="brushIcon"></em> |
|||
<a href="javascript:void(0)" class="size1">1</a> |
|||
<a href="javascript:void(0)" class="size2">3</a> |
|||
<a href="javascript:void(0)" class="size3">5</a> |
|||
<a href="javascript:void(0)" class="size4">7</a> |
|||
</div> |
|||
<div id="J_eraserBar" class="sectionBar"> |
|||
<em class="eraserIcon"></em> |
|||
<a href="javascript:void(0)" class="size1">1</a> |
|||
<a href="javascript:void(0)" class="size2">3</a> |
|||
<a href="javascript:void(0)" class="size3">5</a> |
|||
<a href="javascript:void(0)" class="size4">7</a> |
|||
</div> |
|||
<div class="sectionBar"> |
|||
<div id="J_addImg" class="addImgH"> |
|||
<em class="icon"></em> |
|||
<em class="text"><var id="lang_input_addPic"></var></em> |
|||
<form method="post" id="fileForm" enctype="multipart/form-data" class="addImgH_form" target="up"> |
|||
<input type="file" name="upfile" id="J_imgTxt" |
|||
accept="image/gif,image/jpeg,image/png,image/jpg,image/bmp"/> |
|||
</form> |
|||
<iframe name="up" style="display: none"></iframe> |
|||
</div> |
|||
</div> |
|||
<div class="sectionBar"> |
|||
<span id="J_removeImg" class="removeImg"> |
|||
<em class="icon"></em> |
|||
<em class="text"><var id="lang_input_removePic"></var></em> |
|||
</span> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
<div id="J_maskLayer" class="maskLayerNull"></div> |
|||
|
|||
<script type="text/javascript" src="scrawl.js"></script> |
|||
<script type="text/javascript"> |
|||
var settings = { |
|||
drawBrushSize:3, //画笔初始大小 |
|||
drawBrushColor:"#4bacc6", //画笔初始颜色 |
|||
colorList:['c00000', 'ff0000', 'ffc000', 'ffff00', '92d050', '00b050', '00b0f0', '0070c0', '002060', '7030a0', 'ffffff', |
|||
'000000', 'eeece1', '1f497d', '4f81bd', 'c0504d', '9bbb59', '8064a2', '4bacc6', 'f79646'], //画笔选择颜色 |
|||
saveNum:10 //撤销次数 |
|||
}; |
|||
|
|||
var scrawlObj = new scrawl( settings ); |
|||
scrawlObj.isCancelScrawl = false; |
|||
|
|||
dialog.onok = function () { |
|||
exec( scrawlObj ); |
|||
return false; |
|||
}; |
|||
dialog.oncancel = function () { |
|||
scrawlObj.isCancelScrawl = true; |
|||
}; |
|||
</script> |
|||
</body> |
|||
</html> |
|||
@ -0,0 +1,671 @@ |
|||
/** |
|||
* Created with JetBrains PhpStorm. |
|||
* User: xuheng |
|||
* Date: 12-5-22 |
|||
* Time: 上午11:38 |
|||
* To change this template use File | Settings | File Templates. |
|||
*/ |
|||
var scrawl = function (options) { |
|||
options && this.initOptions(options); |
|||
}; |
|||
(function () { |
|||
var canvas = $G("J_brushBoard"), |
|||
context = canvas.getContext('2d'), |
|||
drawStep = [], //undo redo存储
|
|||
drawStepIndex = 0; //undo redo指针
|
|||
|
|||
scrawl.prototype = { |
|||
isScrawl:false, //是否涂鸦
|
|||
brushWidth:-1, //画笔粗细
|
|||
brushColor:"", //画笔颜色
|
|||
|
|||
initOptions:function (options) { |
|||
var me = this; |
|||
me.originalState(options);//初始页面状态
|
|||
me._buildToolbarColor(options.colorList);//动态生成颜色选择集合
|
|||
|
|||
me._addBoardListener(options.saveNum);//添加画板处理
|
|||
me._addOPerateListener(options.saveNum);//添加undo redo clearBoard处理
|
|||
me._addColorBarListener();//添加颜色选择处理
|
|||
me._addBrushBarListener();//添加画笔大小处理
|
|||
me._addEraserBarListener();//添加橡皮大小处理
|
|||
me._addAddImgListener();//添加增添背景图片处理
|
|||
me._addRemoveImgListenter();//删除背景图片处理
|
|||
me._addScalePicListenter();//添加缩放处理
|
|||
me._addClearSelectionListenter();//添加清楚选中状态处理
|
|||
|
|||
me._originalColorSelect(options.drawBrushColor);//初始化颜色选中
|
|||
me._originalBrushSelect(options.drawBrushSize);//初始化画笔选中
|
|||
me._clearSelection();//清楚选中状态
|
|||
}, |
|||
|
|||
originalState:function (options) { |
|||
var me = this; |
|||
|
|||
me.brushWidth = options.drawBrushSize;//同步画笔粗细
|
|||
me.brushColor = options.drawBrushColor;//同步画笔颜色
|
|||
|
|||
context.lineWidth = me.brushWidth;//初始画笔大小
|
|||
context.strokeStyle = me.brushColor;//初始画笔颜色
|
|||
context.fillStyle = "transparent";//初始画布背景颜色
|
|||
context.lineCap = "round";//去除锯齿
|
|||
context.fill(); |
|||
}, |
|||
_buildToolbarColor:function (colorList) { |
|||
var tmp = null, arr = []; |
|||
arr.push("<table id='J_colorList'>"); |
|||
for (var i = 0, color; color = colorList[i++];) { |
|||
if ((i - 1) % 5 == 0) { |
|||
if (i != 1) { |
|||
arr.push("</tr>"); |
|||
} |
|||
arr.push("<tr>"); |
|||
} |
|||
tmp = '#' + color; |
|||
arr.push("<td><a title='" + tmp + "' href='javascript:void(0)' style='background-color:" + tmp + "'></a></td>"); |
|||
} |
|||
arr.push("</tr></table>"); |
|||
$G("J_colorBar").innerHTML = arr.join(""); |
|||
}, |
|||
|
|||
_addBoardListener:function (saveNum) { |
|||
var me = this, |
|||
margin = 0, |
|||
startX = -1, |
|||
startY = -1, |
|||
isMouseDown = false, |
|||
isMouseMove = false, |
|||
isMouseUp = false, |
|||
buttonPress = 0, button, flag = ''; |
|||
|
|||
margin = parseInt(domUtils.getComputedStyle($G("J_wrap"), "margin-left")); |
|||
drawStep.push(context.getImageData(0, 0, context.canvas.width, context.canvas.height)); |
|||
drawStepIndex += 1; |
|||
|
|||
domUtils.on(canvas, ["mousedown", "mousemove", "mouseup", "mouseout"], function (e) { |
|||
button = browser.webkit ? e.which : buttonPress; |
|||
switch (e.type) { |
|||
case 'mousedown': |
|||
buttonPress = 1; |
|||
flag = 1; |
|||
isMouseDown = true; |
|||
isMouseUp = false; |
|||
isMouseMove = false; |
|||
me.isScrawl = true; |
|||
startX = e.clientX - margin;//10为外边距总和
|
|||
startY = e.clientY - margin; |
|||
context.beginPath(); |
|||
break; |
|||
case 'mousemove' : |
|||
if (!flag && button == 0) { |
|||
return; |
|||
} |
|||
if (!flag && button) { |
|||
startX = e.clientX - margin;//10为外边距总和
|
|||
startY = e.clientY - margin; |
|||
context.beginPath(); |
|||
flag = 1; |
|||
} |
|||
if (isMouseUp || !isMouseDown) { |
|||
return; |
|||
} |
|||
var endX = e.clientX - margin, |
|||
endY = e.clientY - margin; |
|||
|
|||
context.moveTo(startX, startY); |
|||
context.lineTo(endX, endY); |
|||
context.stroke(); |
|||
startX = endX; |
|||
startY = endY; |
|||
isMouseMove = true; |
|||
break; |
|||
case 'mouseup': |
|||
buttonPress = 0; |
|||
if (!isMouseDown)return; |
|||
if (!isMouseMove) { |
|||
context.arc(startX, startY, context.lineWidth, 0, Math.PI * 2, false); |
|||
context.fillStyle = context.strokeStyle; |
|||
context.fill(); |
|||
} |
|||
context.closePath(); |
|||
me._saveOPerate(saveNum); |
|||
isMouseDown = false; |
|||
isMouseMove = false; |
|||
isMouseUp = true; |
|||
startX = -1; |
|||
startY = -1; |
|||
break; |
|||
case 'mouseout': |
|||
flag = ''; |
|||
buttonPress = 0; |
|||
if (button == 1) return; |
|||
context.closePath(); |
|||
break; |
|||
} |
|||
}); |
|||
}, |
|||
_addOPerateListener:function (saveNum) { |
|||
var me = this; |
|||
domUtils.on($G("J_previousStep"), "click", function () { |
|||
if (drawStepIndex > 1) { |
|||
drawStepIndex -= 1; |
|||
context.clearRect(0, 0, context.canvas.width, context.canvas.height); |
|||
context.putImageData(drawStep[drawStepIndex - 1], 0, 0); |
|||
me.btn2Highlight("J_nextStep"); |
|||
drawStepIndex == 1 && me.btn2disable("J_previousStep"); |
|||
} |
|||
}); |
|||
domUtils.on($G("J_nextStep"), "click", function () { |
|||
if (drawStepIndex > 0 && drawStepIndex < drawStep.length) { |
|||
context.clearRect(0, 0, context.canvas.width, context.canvas.height); |
|||
context.putImageData(drawStep[drawStepIndex], 0, 0); |
|||
drawStepIndex += 1; |
|||
me.btn2Highlight("J_previousStep"); |
|||
drawStepIndex == drawStep.length && me.btn2disable("J_nextStep"); |
|||
} |
|||
}); |
|||
domUtils.on($G("J_clearBoard"), "click", function () { |
|||
context.clearRect(0, 0, context.canvas.width, context.canvas.height); |
|||
drawStep = []; |
|||
me._saveOPerate(saveNum); |
|||
drawStepIndex = 1; |
|||
me.isScrawl = false; |
|||
me.btn2disable("J_previousStep"); |
|||
me.btn2disable("J_nextStep"); |
|||
me.btn2disable("J_clearBoard"); |
|||
}); |
|||
}, |
|||
_addColorBarListener:function () { |
|||
var me = this; |
|||
domUtils.on($G("J_colorBar"), "click", function (e) { |
|||
var target = me.getTarget(e), |
|||
color = target.title; |
|||
if (!!color) { |
|||
me._addColorSelect(target); |
|||
|
|||
me.brushColor = color; |
|||
context.globalCompositeOperation = "source-over"; |
|||
context.lineWidth = me.brushWidth; |
|||
context.strokeStyle = color; |
|||
} |
|||
}); |
|||
}, |
|||
_addBrushBarListener:function () { |
|||
var me = this; |
|||
domUtils.on($G("J_brushBar"), "click", function (e) { |
|||
var target = me.getTarget(e), |
|||
size = browser.ie ? target.innerText : target.text; |
|||
if (!!size) { |
|||
me._addBESelect(target); |
|||
|
|||
context.globalCompositeOperation = "source-over"; |
|||
context.lineWidth = parseInt(size); |
|||
context.strokeStyle = me.brushColor; |
|||
me.brushWidth = context.lineWidth; |
|||
} |
|||
}); |
|||
}, |
|||
_addEraserBarListener:function () { |
|||
var me = this; |
|||
domUtils.on($G("J_eraserBar"), "click", function (e) { |
|||
var target = me.getTarget(e), |
|||
size = browser.ie ? target.innerText : target.text; |
|||
if (!!size) { |
|||
me._addBESelect(target); |
|||
|
|||
context.lineWidth = parseInt(size); |
|||
context.globalCompositeOperation = "destination-out"; |
|||
context.strokeStyle = "#FFF"; |
|||
} |
|||
}); |
|||
}, |
|||
_addAddImgListener:function () { |
|||
var file = $G("J_imgTxt"); |
|||
if (!window.FileReader) { |
|||
$G("J_addImg").style.display = 'none'; |
|||
$G("J_removeImg").style.display = 'none'; |
|||
$G("J_sacleBoard").style.display = 'none'; |
|||
} |
|||
domUtils.on(file, "change", function (e) { |
|||
var frm = file.parentNode; |
|||
addMaskLayer(lang.backgroundUploading); |
|||
|
|||
var target = e.target || e.srcElement, |
|||
reader = new FileReader(); |
|||
reader.onload = function(evt){ |
|||
var target = evt.target || evt.srcElement; |
|||
ue_callback(target.result, 'SUCCESS'); |
|||
}; |
|||
reader.readAsDataURL(target.files[0]); |
|||
frm.reset(); |
|||
}); |
|||
}, |
|||
_addRemoveImgListenter:function () { |
|||
var me = this; |
|||
domUtils.on($G("J_removeImg"), "click", function () { |
|||
$G("J_picBoard").innerHTML = ""; |
|||
me.btn2disable("J_removeImg"); |
|||
me.btn2disable("J_sacleBoard"); |
|||
}); |
|||
}, |
|||
_addScalePicListenter:function () { |
|||
domUtils.on($G("J_sacleBoard"), "click", function () { |
|||
var picBoard = $G("J_picBoard"), |
|||
scaleCon = $G("J_scaleCon"), |
|||
img = picBoard.children[0]; |
|||
|
|||
if (img) { |
|||
if (!scaleCon) { |
|||
picBoard.style.cssText = "position:relative;z-index:999;"+picBoard.style.cssText; |
|||
img.style.cssText = "position: absolute;top:" + (canvas.height - img.height) / 2 + "px;left:" + (canvas.width - img.width) / 2 + "px;"; |
|||
var scale = new ScaleBoy(); |
|||
picBoard.appendChild(scale.init()); |
|||
scale.startScale(img); |
|||
} else { |
|||
if (scaleCon.style.visibility == "visible") { |
|||
scaleCon.style.visibility = "hidden"; |
|||
picBoard.style.position = ""; |
|||
picBoard.style.zIndex = ""; |
|||
} else { |
|||
scaleCon.style.visibility = "visible"; |
|||
picBoard.style.cssText += "position:relative;z-index:999"; |
|||
} |
|||
} |
|||
} |
|||
}); |
|||
}, |
|||
_addClearSelectionListenter:function () { |
|||
var doc = document; |
|||
domUtils.on(doc, 'mousemove', function (e) { |
|||
if (browser.ie && browser.version < 11) |
|||
doc.selection.clear(); |
|||
else |
|||
window.getSelection().removeAllRanges(); |
|||
}); |
|||
}, |
|||
_clearSelection:function () { |
|||
var list = ["J_operateBar", "J_colorBar", "J_brushBar", "J_eraserBar", "J_picBoard"]; |
|||
for (var i = 0, group; group = list[i++];) { |
|||
domUtils.unSelectable($G(group)); |
|||
} |
|||
}, |
|||
|
|||
_saveOPerate:function (saveNum) { |
|||
var me = this; |
|||
if (drawStep.length <= saveNum) { |
|||
if(drawStepIndex<drawStep.length){ |
|||
me.btn2disable("J_nextStep"); |
|||
drawStep.splice(drawStepIndex); |
|||
} |
|||
drawStep.push(context.getImageData(0, 0, context.canvas.width, context.canvas.height)); |
|||
drawStepIndex = drawStep.length; |
|||
} else { |
|||
drawStep.shift(); |
|||
drawStep.push(context.getImageData(0, 0, context.canvas.width, context.canvas.height)); |
|||
drawStepIndex = drawStep.length; |
|||
} |
|||
me.btn2Highlight("J_previousStep"); |
|||
me.btn2Highlight("J_clearBoard"); |
|||
}, |
|||
|
|||
_originalColorSelect:function (title) { |
|||
var colorList = $G("J_colorList").getElementsByTagName("td"); |
|||
for (var j = 0, cell; cell = colorList[j++];) { |
|||
if (cell.children[0].title.toLowerCase() == title) { |
|||
cell.children[0].style.opacity = 1; |
|||
} |
|||
} |
|||
}, |
|||
_originalBrushSelect:function (text) { |
|||
var brushList = $G("J_brushBar").children; |
|||
for (var i = 0, ele; ele = brushList[i++];) { |
|||
if (ele.tagName.toLowerCase() == "a") { |
|||
var size = browser.ie ? ele.innerText : ele.text; |
|||
if (size.toLowerCase() == text) { |
|||
ele.style.opacity = 1; |
|||
} |
|||
} |
|||
} |
|||
}, |
|||
_addColorSelect:function (target) { |
|||
var me = this, |
|||
colorList = $G("J_colorList").getElementsByTagName("td"), |
|||
eraserList = $G("J_eraserBar").children, |
|||
brushList = $G("J_brushBar").children; |
|||
|
|||
for (var i = 0, cell; cell = colorList[i++];) { |
|||
cell.children[0].style.opacity = 0.3; |
|||
} |
|||
for (var k = 0, ele; ele = brushList[k++];) { |
|||
if (ele.tagName.toLowerCase() == "a") { |
|||
ele.style.opacity = 0.3; |
|||
var size = browser.ie ? ele.innerText : ele.text; |
|||
if (size.toLowerCase() == this.brushWidth) { |
|||
ele.style.opacity = 1; |
|||
} |
|||
} |
|||
} |
|||
for (var j = 0, node; node = eraserList[j++];) { |
|||
if (node.tagName.toLowerCase() == "a") { |
|||
node.style.opacity = 0.3; |
|||
} |
|||
} |
|||
|
|||
target.style.opacity = 1; |
|||
target.blur(); |
|||
}, |
|||
_addBESelect:function (target) { |
|||
var brushList = $G("J_brushBar").children; |
|||
var eraserList = $G("J_eraserBar").children; |
|||
|
|||
for (var i = 0, ele; ele = brushList[i++];) { |
|||
if (ele.tagName.toLowerCase() == "a") { |
|||
ele.style.opacity = 0.3; |
|||
} |
|||
} |
|||
for (var j = 0, node; node = eraserList[j++];) { |
|||
if (node.tagName.toLowerCase() == "a") { |
|||
node.style.opacity = 0.3; |
|||
} |
|||
} |
|||
|
|||
target.style.opacity = 1; |
|||
target.blur(); |
|||
}, |
|||
getCanvasData:function () { |
|||
var picContainer = $G("J_picBoard"), |
|||
img = picContainer.children[0]; |
|||
if (img) { |
|||
var x, y; |
|||
if (img.style.position == "absolute") { |
|||
x = parseInt(img.style.left); |
|||
y = parseInt(img.style.top); |
|||
} else { |
|||
x = (picContainer.offsetWidth - img.width) / 2; |
|||
y = (picContainer.offsetHeight - img.height) / 2; |
|||
} |
|||
context.globalCompositeOperation = "destination-over"; |
|||
context.drawImage(img, x, y, img.width, img.height); |
|||
} else { |
|||
context.globalCompositeOperation = "destination-atop"; |
|||
context.fillStyle = "#fff";//重置画布背景白色
|
|||
context.fillRect(0, 0, canvas.width, canvas.height); |
|||
} |
|||
try { |
|||
return canvas.toDataURL("image/png").substring(22); |
|||
} catch (e) { |
|||
return ""; |
|||
} |
|||
}, |
|||
btn2Highlight:function (id) { |
|||
var cur = $G(id); |
|||
cur.className.indexOf("H") == -1 && (cur.className += "H"); |
|||
}, |
|||
btn2disable:function (id) { |
|||
var cur = $G(id); |
|||
cur.className.indexOf("H") != -1 && (cur.className = cur.className.replace("H", "")); |
|||
}, |
|||
getTarget:function (evt) { |
|||
return evt.target || evt.srcElement; |
|||
} |
|||
}; |
|||
})(); |
|||
|
|||
var ScaleBoy = function () { |
|||
this.dom = null; |
|||
this.scalingElement = null; |
|||
}; |
|||
(function () { |
|||
function _appendStyle() { |
|||
var doc = document, |
|||
head = doc.getElementsByTagName('head')[0], |
|||
style = doc.createElement('style'), |
|||
cssText = '.scale{visibility:hidden;cursor:move;position:absolute;left:0;top:0;width:100px;height:50px;background-color:#fff;font-size:0;line-height:0;opacity:.4;filter:Alpha(opacity=40);}' |
|||
+ '.scale span{position:absolute;left:0;top:0;width:6px;height:6px;background-color:#006DAE;}' |
|||
+ '.scale .hand0, .scale .hand7{cursor:nw-resize;}' |
|||
+ '.scale .hand1, .scale .hand6{left:50%;margin-left:-3px;cursor:n-resize;}' |
|||
+ '.scale .hand2, .scale .hand4, .scale .hand7{left:100%;margin-left:-6px;}' |
|||
+ '.scale .hand3, .scale .hand4{top:50%;margin-top:-3px;cursor:w-resize;}' |
|||
+ '.scale .hand5, .scale .hand6, .scale .hand7{margin-top:-6px;top:100%;}' |
|||
+ '.scale .hand2, .scale .hand5{cursor:ne-resize;}'; |
|||
style.type = 'text/css'; |
|||
|
|||
try { |
|||
style.appendChild(doc.createTextNode(cssText)); |
|||
} catch (e) { |
|||
style.styleSheet.cssText = cssText; |
|||
} |
|||
head.appendChild(style); |
|||
} |
|||
|
|||
function _getDom() { |
|||
var doc = document, |
|||
hand, |
|||
arr = [], |
|||
scale = doc.createElement('div'); |
|||
|
|||
scale.id = 'J_scaleCon'; |
|||
scale.className = 'scale'; |
|||
for (var i = 0; i < 8; i++) { |
|||
arr.push("<span class='hand" + i + "'></span>"); |
|||
} |
|||
scale.innerHTML = arr.join(""); |
|||
return scale; |
|||
} |
|||
|
|||
var rect = [ |
|||
//[left, top, width, height]
|
|||
[1, 1, -1, -1], |
|||
[0, 1, 0, -1], |
|||
[0, 1, 1, -1], |
|||
[1, 0, -1, 0], |
|||
[0, 0, 1, 0], |
|||
[1, 0, -1, 1], |
|||
[0, 0, 0, 1], |
|||
[0, 0, 1, 1] |
|||
]; |
|||
ScaleBoy.prototype = { |
|||
init:function () { |
|||
_appendStyle(); |
|||
var me = this, |
|||
scale = me.dom = _getDom(); |
|||
|
|||
me.scaleMousemove.fp = me; |
|||
domUtils.on(scale, 'mousedown', function (e) { |
|||
var target = e.target || e.srcElement; |
|||
me.start = {x:e.clientX, y:e.clientY}; |
|||
if (target.className.indexOf('hand') != -1) { |
|||
me.dir = target.className.replace('hand', ''); |
|||
} |
|||
domUtils.on(document.body, 'mousemove', me.scaleMousemove); |
|||
e.stopPropagation ? e.stopPropagation() : e.cancelBubble = true; |
|||
}); |
|||
domUtils.on(document.body, 'mouseup', function (e) { |
|||
if (me.start) { |
|||
domUtils.un(document.body, 'mousemove', me.scaleMousemove); |
|||
if (me.moved) { |
|||
me.updateScaledElement({position:{x:scale.style.left, y:scale.style.top}, size:{w:scale.style.width, h:scale.style.height}}); |
|||
} |
|||
delete me.start; |
|||
delete me.moved; |
|||
delete me.dir; |
|||
} |
|||
}); |
|||
return scale; |
|||
}, |
|||
startScale:function (objElement) { |
|||
var me = this, Idom = me.dom; |
|||
|
|||
Idom.style.cssText = 'visibility:visible;top:' + objElement.style.top + ';left:' + objElement.style.left + ';width:' + objElement.offsetWidth + 'px;height:' + objElement.offsetHeight + 'px;'; |
|||
me.scalingElement = objElement; |
|||
}, |
|||
updateScaledElement:function (objStyle) { |
|||
var cur = this.scalingElement, |
|||
pos = objStyle.position, |
|||
size = objStyle.size; |
|||
if (pos) { |
|||
typeof pos.x != 'undefined' && (cur.style.left = pos.x); |
|||
typeof pos.y != 'undefined' && (cur.style.top = pos.y); |
|||
} |
|||
if (size) { |
|||
size.w && (cur.style.width = size.w); |
|||
size.h && (cur.style.height = size.h); |
|||
} |
|||
}, |
|||
updateStyleByDir:function (dir, offset) { |
|||
var me = this, |
|||
dom = me.dom, tmp; |
|||
|
|||
rect['def'] = [1, 1, 0, 0]; |
|||
if (rect[dir][0] != 0) { |
|||
tmp = parseInt(dom.style.left) + offset.x; |
|||
dom.style.left = me._validScaledProp('left', tmp) + 'px'; |
|||
} |
|||
if (rect[dir][1] != 0) { |
|||
tmp = parseInt(dom.style.top) + offset.y; |
|||
dom.style.top = me._validScaledProp('top', tmp) + 'px'; |
|||
} |
|||
if (rect[dir][2] != 0) { |
|||
tmp = dom.clientWidth + rect[dir][2] * offset.x; |
|||
dom.style.width = me._validScaledProp('width', tmp) + 'px'; |
|||
} |
|||
if (rect[dir][3] != 0) { |
|||
tmp = dom.clientHeight + rect[dir][3] * offset.y; |
|||
dom.style.height = me._validScaledProp('height', tmp) + 'px'; |
|||
} |
|||
if (dir === 'def') { |
|||
me.updateScaledElement({position:{x:dom.style.left, y:dom.style.top}}); |
|||
} |
|||
}, |
|||
scaleMousemove:function (e) { |
|||
var me = arguments.callee.fp, |
|||
start = me.start, |
|||
dir = me.dir || 'def', |
|||
offset = {x:e.clientX - start.x, y:e.clientY - start.y}; |
|||
|
|||
me.updateStyleByDir(dir, offset); |
|||
arguments.callee.fp.start = {x:e.clientX, y:e.clientY}; |
|||
arguments.callee.fp.moved = 1; |
|||
}, |
|||
_validScaledProp:function (prop, value) { |
|||
var ele = this.dom, |
|||
wrap = $G("J_picBoard"); |
|||
|
|||
value = isNaN(value) ? 0 : value; |
|||
switch (prop) { |
|||
case 'left': |
|||
return value < 0 ? 0 : (value + ele.clientWidth) > wrap.clientWidth ? wrap.clientWidth - ele.clientWidth : value; |
|||
case 'top': |
|||
return value < 0 ? 0 : (value + ele.clientHeight) > wrap.clientHeight ? wrap.clientHeight - ele.clientHeight : value; |
|||
case 'width': |
|||
return value <= 0 ? 1 : (value + ele.offsetLeft) > wrap.clientWidth ? wrap.clientWidth - ele.offsetLeft : value; |
|||
case 'height': |
|||
return value <= 0 ? 1 : (value + ele.offsetTop) > wrap.clientHeight ? wrap.clientHeight - ele.offsetTop : value; |
|||
} |
|||
} |
|||
}; |
|||
})(); |
|||
|
|||
//后台回调
|
|||
function ue_callback(url, state) { |
|||
var doc = document, |
|||
picBorard = $G("J_picBoard"), |
|||
img = doc.createElement("img"); |
|||
|
|||
//图片缩放
|
|||
function scale(img, max, oWidth, oHeight) { |
|||
var width = 0, height = 0, percent, ow = img.width || oWidth, oh = img.height || oHeight; |
|||
if (ow > max || oh > max) { |
|||
if (ow >= oh) { |
|||
if (width = ow - max) { |
|||
percent = (width / ow).toFixed(2); |
|||
img.height = oh - oh * percent; |
|||
img.width = max; |
|||
} |
|||
} else { |
|||
if (height = oh - max) { |
|||
percent = (height / oh).toFixed(2); |
|||
img.width = ow - ow * percent; |
|||
img.height = max; |
|||
} |
|||
} |
|||
} |
|||
} |
|||
|
|||
//移除遮罩层
|
|||
removeMaskLayer(); |
|||
//状态响应
|
|||
if (state == "SUCCESS") { |
|||
picBorard.innerHTML = ""; |
|||
img.onload = function () { |
|||
scale(this, 300); |
|||
picBorard.appendChild(img); |
|||
|
|||
var obj = new scrawl(); |
|||
obj.btn2Highlight("J_removeImg"); |
|||
//trace 2457
|
|||
obj.btn2Highlight("J_sacleBoard"); |
|||
}; |
|||
img.src = url; |
|||
} else { |
|||
alert(state); |
|||
} |
|||
} |
|||
//去掉遮罩层
|
|||
function removeMaskLayer() { |
|||
var maskLayer = $G("J_maskLayer"); |
|||
maskLayer.className = "maskLayerNull"; |
|||
maskLayer.innerHTML = ""; |
|||
dialog.buttons[0].setDisabled(false); |
|||
} |
|||
//添加遮罩层
|
|||
function addMaskLayer(html) { |
|||
var maskLayer = $G("J_maskLayer"); |
|||
dialog.buttons[0].setDisabled(true); |
|||
maskLayer.className = "maskLayer"; |
|||
maskLayer.innerHTML = html; |
|||
} |
|||
//执行确认按钮方法
|
|||
function exec(scrawlObj) { |
|||
if (scrawlObj.isScrawl) { |
|||
addMaskLayer(lang.scrawlUpLoading); |
|||
var base64 = scrawlObj.getCanvasData(); |
|||
if (!!base64) { |
|||
var options = { |
|||
timeout:100000, |
|||
onsuccess:function (xhr) { |
|||
if (!scrawlObj.isCancelScrawl) { |
|||
var responseObj; |
|||
responseObj = eval("(" + xhr.responseText + ")"); |
|||
if (responseObj.state == "SUCCESS") { |
|||
var imgObj = {}, |
|||
url = editor.options.scrawlUrlPrefix + responseObj.url; |
|||
imgObj.src = url; |
|||
imgObj._src = url; |
|||
imgObj.alt = responseObj.original || ''; |
|||
imgObj.title = responseObj.title || ''; |
|||
editor.execCommand("insertImage", imgObj); |
|||
dialog.close(); |
|||
} else { |
|||
alert(responseObj.state); |
|||
} |
|||
|
|||
} |
|||
}, |
|||
onerror:function () { |
|||
alert(lang.imageError); |
|||
dialog.close(); |
|||
} |
|||
}; |
|||
options[editor.getOpt('scrawlFieldName')] = base64; |
|||
|
|||
var actionUrl = editor.getActionUrl(editor.getOpt('scrawlActionName')), |
|||
params = utils.serializeParam(editor.queryCommandValue('serverparam')) || '', |
|||
url = utils.formatUrl(actionUrl + (actionUrl.indexOf('?') == -1 ? '?':'&') + params); |
|||
ajax.request(url, options); |
|||
} |
|||
} else { |
|||
addMaskLayer(lang.noScarwl + " <input type='button' value='" + lang.continueBtn + "' onclick='removeMaskLayer()'/>"); |
|||
} |
|||
} |
|||
|
|||
@ -0,0 +1,102 @@ |
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" |
|||
"http://www.w3.org/TR/html4/loose.dtd"> |
|||
<html> |
|||
<head> |
|||
<title></title> |
|||
<meta content="text/html; charset=utf-8" http-equiv="Content-Type"/> |
|||
<script type="text/javascript" src="../internal.js"></script> |
|||
<style type="text/css"> |
|||
.warpper{ position:relative;width: 380px; height: 100%; margin: 10px auto;} |
|||
.tabbody{height: 160px;} |
|||
.tabbody table{width:100%;border-collapse: separate;border-spacing: 3px;} |
|||
.tabbody .panel{width:373px;height:100%;padding-left: 5px;position: absolute;background-color: #fff;} |
|||
.tabbody input.int{ width:190px;height:21px;border:1px solid #d7d7d7;line-height:21px;} |
|||
.tabbody input.btn{padding: 0 5px; text-align:center;line-height:24px; text-decoration: none;height:24px;background:url("../../themes/default/images/dialog-title-bg.png") repeat-x;border:1px solid #ccc; } |
|||
</style> |
|||
</head> |
|||
<body> |
|||
<div class="warpper" id="searchtab"> |
|||
<div id="head" class="tabhead"> |
|||
<span tabsrc="find" class="focus"><var id="lang_tab_search"></var></span> |
|||
<span tabsrc="replace" ><var id="lang_tab_replace"></var></span> |
|||
</div> |
|||
<div class="tabbody"> |
|||
<div class="panel" id="find"> |
|||
<table> |
|||
<tr> |
|||
<td width="80"><var id="lang_search1"></var>: </td> |
|||
<td><input id="findtxt" type="text" class="int" /></td> |
|||
</tr> |
|||
<!--<tr>--> |
|||
|
|||
<!--<td colspan="2"><span style="color:red"><var id="lang_searchReg"></var></span></td>--> |
|||
<!--</tr>--> |
|||
<tr> |
|||
<td><var id="lang_case_sensitive1"></var></td> |
|||
<td> |
|||
<input id="matchCase" type="checkbox" /> |
|||
</td> |
|||
</tr> |
|||
<tr> |
|||
<td colspan="2"> |
|||
<input id="nextFindBtn" type="button" class="btn" /> |
|||
<input id="preFindBtn" type="button" class="btn" /> |
|||
</td> |
|||
</tr> |
|||
<tr> |
|||
<td colspan="2"> |
|||
|
|||
</td> |
|||
</tr> |
|||
<tr> |
|||
<td colspan="2"> |
|||
<span id="search-msg" style="color:red"></span> |
|||
</td> |
|||
</tr> |
|||
</table> |
|||
</div> |
|||
<div class="panel" id="replace"> |
|||
<table> |
|||
<tr> |
|||
<td width="80"><var id="lang_search2"></var>: </td> |
|||
<td><input id="findtxt1" type="text" class="int" /></td> |
|||
</tr> |
|||
<!--<tr>--> |
|||
|
|||
<!--<td colspan="2"><span style="color:red"><var id="lang_searchReg1"></var></span></td>--> |
|||
<!--</tr>--> |
|||
<tr> |
|||
<td><var id="lang_replace"></var>: </td> |
|||
<td><input id="replacetxt" type="text" class="int" /></td> |
|||
</tr> |
|||
<tr> |
|||
<td><var id="lang_case_sensitive2"></var></td> |
|||
<td> |
|||
<input id="matchCase1" type="checkbox" /> |
|||
</td> |
|||
</tr> |
|||
<tr> |
|||
<td colspan="2"> |
|||
<input id="nextReplaceBtn" type="button" class="btn" /> |
|||
<input id="preReplaceBtn" type="button" class="btn" /> |
|||
<input id="repalceBtn" type="button" class="btn" /> |
|||
<input id="repalceAllBtn" type="button" class="btn" /> |
|||
</td> |
|||
</tr> |
|||
<tr> |
|||
<td colspan="2"> |
|||
|
|||
</td> |
|||
</tr> |
|||
<tr> |
|||
<td colspan="2"> |
|||
<span id="replace-msg" style="color:red"></span> |
|||
</td> |
|||
</tr> |
|||
</table> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
<script type="text/javascript" src="searchreplace.js"></script> |
|||
</body> |
|||
</html> |
|||
@ -0,0 +1,164 @@ |
|||
/** |
|||
* Created with JetBrains PhpStorm. |
|||
* User: xuheng |
|||
* Date: 12-9-26 |
|||
* Time: 下午12:29 |
|||
* To change this template use File | Settings | File Templates. |
|||
*/ |
|||
|
|||
//清空上次查选的痕迹
|
|||
editor.firstForSR = 0; |
|||
editor.currentRangeForSR = null; |
|||
//给tab注册切换事件
|
|||
/** |
|||
* tab点击处理事件 |
|||
* @param tabHeads |
|||
* @param tabBodys |
|||
* @param obj |
|||
*/ |
|||
function clickHandler( tabHeads,tabBodys,obj ) { |
|||
//head样式更改
|
|||
for ( var k = 0, len = tabHeads.length; k < len; k++ ) { |
|||
tabHeads[k].className = ""; |
|||
} |
|||
obj.className = "focus"; |
|||
//body显隐
|
|||
var tabSrc = obj.getAttribute( "tabSrc" ); |
|||
for ( var j = 0, length = tabBodys.length; j < length; j++ ) { |
|||
var body = tabBodys[j], |
|||
id = body.getAttribute( "id" ); |
|||
if ( id != tabSrc ) { |
|||
body.style.zIndex = 1; |
|||
} else { |
|||
body.style.zIndex = 200; |
|||
} |
|||
} |
|||
|
|||
} |
|||
|
|||
/** |
|||
* TAB切换 |
|||
* @param tabParentId tab的父节点ID或者对象本身 |
|||
*/ |
|||
function switchTab( tabParentId ) { |
|||
var tabElements = $G( tabParentId ).children, |
|||
tabHeads = tabElements[0].children, |
|||
tabBodys = tabElements[1].children; |
|||
|
|||
for ( var i = 0, length = tabHeads.length; i < length; i++ ) { |
|||
var head = tabHeads[i]; |
|||
if ( head.className === "focus" )clickHandler(tabHeads,tabBodys, head ); |
|||
head.onclick = function () { |
|||
clickHandler(tabHeads,tabBodys,this); |
|||
} |
|||
} |
|||
} |
|||
$G('searchtab').onmousedown = function(){ |
|||
$G('search-msg').innerHTML = ''; |
|||
$G('replace-msg').innerHTML = '' |
|||
} |
|||
//是否区分大小写
|
|||
function getMatchCase(id) { |
|||
return $G(id).checked ? true : false; |
|||
} |
|||
//查找
|
|||
$G("nextFindBtn").onclick = function (txt, dir, mcase) { |
|||
var findtxt = $G("findtxt").value, obj; |
|||
if (!findtxt) { |
|||
return false; |
|||
} |
|||
obj = { |
|||
searchStr:findtxt, |
|||
dir:1, |
|||
casesensitive:getMatchCase("matchCase") |
|||
}; |
|||
if (!frCommond(obj)) { |
|||
var bk = editor.selection.getRange().createBookmark(); |
|||
$G('search-msg').innerHTML = lang.getEnd; |
|||
editor.selection.getRange().moveToBookmark(bk).select(); |
|||
|
|||
|
|||
} |
|||
}; |
|||
$G("nextReplaceBtn").onclick = function (txt, dir, mcase) { |
|||
var findtxt = $G("findtxt1").value, obj; |
|||
if (!findtxt) { |
|||
return false; |
|||
} |
|||
obj = { |
|||
searchStr:findtxt, |
|||
dir:1, |
|||
casesensitive:getMatchCase("matchCase1") |
|||
}; |
|||
frCommond(obj); |
|||
}; |
|||
$G("preFindBtn").onclick = function (txt, dir, mcase) { |
|||
var findtxt = $G("findtxt").value, obj; |
|||
if (!findtxt) { |
|||
return false; |
|||
} |
|||
obj = { |
|||
searchStr:findtxt, |
|||
dir:-1, |
|||
casesensitive:getMatchCase("matchCase") |
|||
}; |
|||
if (!frCommond(obj)) { |
|||
$G('search-msg').innerHTML = lang.getStart; |
|||
} |
|||
}; |
|||
$G("preReplaceBtn").onclick = function (txt, dir, mcase) { |
|||
var findtxt = $G("findtxt1").value, obj; |
|||
if (!findtxt) { |
|||
return false; |
|||
} |
|||
obj = { |
|||
searchStr:findtxt, |
|||
dir:-1, |
|||
casesensitive:getMatchCase("matchCase1") |
|||
}; |
|||
frCommond(obj); |
|||
}; |
|||
//替换
|
|||
$G("repalceBtn").onclick = function () { |
|||
var findtxt = $G("findtxt1").value.replace(/^\s|\s$/g, ""), obj, |
|||
replacetxt = $G("replacetxt").value.replace(/^\s|\s$/g, ""); |
|||
if (!findtxt) { |
|||
return false; |
|||
} |
|||
if (findtxt == replacetxt || (!getMatchCase("matchCase1") && findtxt.toLowerCase() == replacetxt.toLowerCase())) { |
|||
return false; |
|||
} |
|||
obj = { |
|||
searchStr:findtxt, |
|||
dir:1, |
|||
casesensitive:getMatchCase("matchCase1"), |
|||
replaceStr:replacetxt |
|||
}; |
|||
frCommond(obj); |
|||
}; |
|||
//全部替换
|
|||
$G("repalceAllBtn").onclick = function () { |
|||
var findtxt = $G("findtxt1").value.replace(/^\s|\s$/g, ""), obj, |
|||
replacetxt = $G("replacetxt").value.replace(/^\s|\s$/g, ""); |
|||
if (!findtxt) { |
|||
return false; |
|||
} |
|||
if (findtxt == replacetxt || (!getMatchCase("matchCase1") && findtxt.toLowerCase() == replacetxt.toLowerCase())) { |
|||
return false; |
|||
} |
|||
obj = { |
|||
searchStr:findtxt, |
|||
casesensitive:getMatchCase("matchCase1"), |
|||
replaceStr:replacetxt, |
|||
all:true |
|||
}; |
|||
var num = frCommond(obj); |
|||
if (num) { |
|||
$G('replace-msg').innerHTML = lang.countMsg.replace("{#count}", num); |
|||
} |
|||
}; |
|||
//执行
|
|||
var frCommond = function (obj) { |
|||
return editor.execCommand("searchreplace", obj); |
|||
}; |
|||
switchTab("searchtab"); |
|||
@ -0,0 +1,58 @@ |
|||
<!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> |
|||
<style type="text/css"> |
|||
*{color: #838383} |
|||
html,body { |
|||
font-size: 12px; |
|||
width:100%; |
|||
height:100%; |
|||
overflow: hidden; |
|||
margin:0px; |
|||
padding:0px; |
|||
} |
|||
h2 { font-size: 16px; margin: 20px auto;} |
|||
.content{ |
|||
padding:5px 15px 0 15px; |
|||
height:100%; |
|||
} |
|||
dt,dd { margin-left: 0; padding-left: 0;} |
|||
dt a { display: block; |
|||
height: 30px; |
|||
line-height: 30px; |
|||
width: 55px; |
|||
background: #EFEFEF; |
|||
border: 1px solid #CCC; |
|||
padding: 0 10px; |
|||
text-decoration: none; |
|||
} |
|||
dt a:hover{ |
|||
background: #e0e0e0; |
|||
border-color: #999 |
|||
} |
|||
dt a:active{ |
|||
background: #ccc; |
|||
border-color: #999; |
|||
color: #666; |
|||
} |
|||
dd { line-height:20px;margin-top: 10px;} |
|||
span{ padding-right:4px;} |
|||
input{width:210px;height:21px;background: #FFF;border:1px solid #d7d7d7;padding: 0px; margin: 0px; } |
|||
|
|||
|
|||
</style> |
|||
</head> |
|||
<body> |
|||
<div class="content"> |
|||
<h2><var id="lang_showMsg"></var></h2> |
|||
<dl> |
|||
<dt><a href="../../third-party/snapscreen/UEditorSnapscreen.exe" target="_blank" id="downlink"><var id="lang_download"></var></a></dt> |
|||
<dd><var id="lang_step1"></var></dd> |
|||
<dd><var id="lang_step2"></var></dd> |
|||
</dl> |
|||
</div> |
|||
</body> |
|||
</html> |
|||
@ -0,0 +1,21 @@ |
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" |
|||
"http://www.w3.org/TR/html4/loose.dtd"> |
|||
<html> |
|||
<head> |
|||
<title></title> |
|||
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/> |
|||
<script type="text/javascript" src="../internal.js"></script> |
|||
<style type="text/css"> |
|||
html,body{overflow:hidden;} |
|||
#specharsTab{width: 97%;margin: 10px auto; zoom:1;position: relative} |
|||
.tabbody {height:447px;} |
|||
.tabbody span{ margin: 5px 3px;text-align: center;display:inline-block;width: 40px;height:16px;line-height: 16px;cursor: pointer; } |
|||
</style> |
|||
</head> |
|||
<body> |
|||
<div id="specharsTab"> |
|||
<div id="tabHeads" class="tabhead"></div><div id="tabBodys" class="tabbody"></div> |
|||
</div> |
|||
<script type="text/javascript" src="spechars.js"></script> |
|||
</body> |
|||
</html> |
|||
@ -0,0 +1,57 @@ |
|||
/** |
|||
* Created with JetBrains PhpStorm. |
|||
* User: xuheng |
|||
* Date: 12-9-26 |
|||
* Time: 下午1:09 |
|||
* To change this template use File | Settings | File Templates. |
|||
*/ |
|||
var charsContent = [ |
|||
{ name:"tsfh", title:lang.tsfh, content:toArray("、,。,·,ˉ,ˇ,¨,〃,々,—,~,‖,…,‘,’,“,”,〔,〕,〈,〉,《,》,「,」,『,』,〖,〗,【,】,±,×,÷,∶,∧,∨,∑,∏,∪,∩,∈,∷,√,⊥,∥,∠,⌒,⊙,∫,∮,≡,≌,≈,∽,∝,≠,≮,≯,≤,≥,∞,∵,∴,♂,♀,°,′,″,℃,$,¤,¢,£,‰,§,№,☆,★,○,●,◎,◇,◆,□,■,△,▲,※,→,←,↑,↓,〓,〡,〢,〣,〤,〥,〦,〧,〨,〩,㊣,㎎,㎏,㎜,㎝,㎞,㎡,㏄,㏎,㏑,㏒,㏕,︰,¬,¦,℡,ˊ,ˋ,˙,–,―,‥,‵,℅,℉,↖,↗,↘,↙,∕,∟,∣,≒,≦,≧,⊿,═,║,╒,╓,╔,╕,╖,╗,╘,╙,╚,╛,╜,╝,╞,╟,╠,╡,╢,╣,╤,╥,╦,╧,╨,╩,╪,╫,╬,╭,╮,╯,╰,╱,╲,╳,▁,▂,▃,▄,▅,▆,▇,�,█,▉,▊,▋,▌,▍,▎,▏,▓,▔,▕,▼,▽,◢,◣,◤,◥,☉,⊕,〒,〝,〞")}, |
|||
{ name:"lmsz", title:lang.lmsz, content:toArray("ⅰ,ⅱ,ⅲ,ⅳ,ⅴ,ⅵ,ⅶ,ⅷ,ⅸ,ⅹ,Ⅰ,Ⅱ,Ⅲ,Ⅳ,Ⅴ,Ⅵ,Ⅶ,Ⅷ,Ⅸ,Ⅹ,Ⅺ,Ⅻ")}, |
|||
{ name:"szfh", title:lang.szfh, content:toArray("⒈,⒉,⒊,⒋,⒌,⒍,⒎,⒏,⒐,⒑,⒒,⒓,⒔,⒕,⒖,⒗,⒘,⒙,⒚,⒛,⑴,⑵,⑶,⑷,⑸,⑹,⑺,⑻,⑼,⑽,⑾,⑿,⒀,⒁,⒂,⒃,⒄,⒅,⒆,⒇,①,②,③,④,⑤,⑥,⑦,⑧,⑨,⑩,㈠,㈡,㈢,㈣,㈤,㈥,㈦,㈧,㈨,㈩")}, |
|||
{ name:"rwfh", title:lang.rwfh, content:toArray("ぁ,あ,ぃ,い,ぅ,う,ぇ,え,ぉ,お,か,が,き,ぎ,く,ぐ,け,げ,こ,ご,さ,ざ,し,じ,す,ず,せ,ぜ,そ,ぞ,た,だ,ち,ぢ,っ,つ,づ,て,で,と,ど,な,に,ぬ,ね,の,は,ば,ぱ,ひ,び,ぴ,ふ,ぶ,ぷ,へ,べ,ぺ,ほ,ぼ,ぽ,ま,み,む,め,も,ゃ,や,ゅ,ゆ,ょ,よ,ら,り,る,れ,ろ,ゎ,わ,ゐ,ゑ,を,ん,ァ,ア,ィ,イ,ゥ,ウ,ェ,エ,ォ,オ,カ,ガ,キ,ギ,ク,グ,ケ,ゲ,コ,ゴ,サ,ザ,シ,ジ,ス,ズ,セ,ゼ,ソ,ゾ,タ,ダ,チ,ヂ,ッ,ツ,ヅ,テ,デ,ト,ド,ナ,ニ,ヌ,ネ,ノ,ハ,バ,パ,ヒ,ビ,ピ,フ,ブ,プ,ヘ,ベ,ペ,ホ,ボ,ポ,マ,ミ,ム,メ,モ,ャ,ヤ,ュ,ユ,ョ,ヨ,ラ,リ,ル,レ,ロ,ヮ,ワ,ヰ,ヱ,ヲ,ン,ヴ,ヵ,ヶ")}, |
|||
{ name:"xlzm", title:lang.xlzm, content:toArray("Α,Β,Γ,Δ,Ε,Ζ,Η,Θ,Ι,Κ,Λ,Μ,Ν,Ξ,Ο,Π,Ρ,Σ,Τ,Υ,Φ,Χ,Ψ,Ω,α,β,γ,δ,ε,ζ,η,θ,ι,κ,λ,μ,ν,ξ,ο,π,ρ,σ,τ,υ,φ,χ,ψ,ω")}, |
|||
{ name:"ewzm", title:lang.ewzm, content:toArray("А,Б,В,Г,Д,Е,Ё,Ж,З,И,Й,К,Л,М,Н,О,П,Р,С,Т,У,Ф,Х,Ц,Ч,Ш,Щ,Ъ,Ы,Ь,Э,Ю,Я,а,б,в,г,д,е,ё,ж,з,и,й,к,л,м,н,о,п,р,с,т,у,ф,х,ц,ч,ш,щ,ъ,ы,ь,э,ю,я")}, |
|||
{ name:"pyzm", title:lang.pyzm, content:toArray("ā,á,ǎ,à,ē,é,ě,è,ī,í,ǐ,ì,ō,ó,ǒ,ò,ū,ú,ǔ,ù,ǖ,ǘ,ǚ,ǜ,ü")}, |
|||
{ name:"yyyb", title:lang.yyyb, content:toArray("i:,i,e,æ,ʌ,ə:,ə,u:,u,ɔ:,ɔ,a:,ei,ai,ɔi,əu,au,iə,εə,uə,p,t,k,b,d,g,f,s,ʃ,θ,h,v,z,ʒ,ð,tʃ,tr,ts,dʒ,dr,dz,m,n,ŋ,l,r,w,j,")}, |
|||
{ name:"zyzf", title:lang.zyzf, content:toArray("ㄅ,ㄆ,ㄇ,ㄈ,ㄉ,ㄊ,ㄋ,ㄌ,ㄍ,ㄎ,ㄏ,ㄐ,ㄑ,ㄒ,ㄓ,ㄔ,ㄕ,ㄖ,ㄗ,ㄘ,ㄙ,ㄚ,ㄛ,ㄜ,ㄝ,ㄞ,ㄟ,ㄠ,ㄡ,ㄢ,ㄣ,ㄤ,ㄥ,ㄦ,ㄧ,ㄨ")} |
|||
]; |
|||
(function createTab(content) { |
|||
for (var i = 0, ci; ci = content[i++];) { |
|||
var span = document.createElement("span"); |
|||
span.setAttribute("tabSrc", ci.name); |
|||
span.innerHTML = ci.title; |
|||
if (i == 1)span.className = "focus"; |
|||
domUtils.on(span, "click", function () { |
|||
var tmps = $G("tabHeads").children; |
|||
for (var k = 0, sk; sk = tmps[k++];) { |
|||
sk.className = ""; |
|||
} |
|||
tmps = $G("tabBodys").children; |
|||
for (var k = 0, sk; sk = tmps[k++];) { |
|||
sk.style.display = "none"; |
|||
} |
|||
this.className = "focus"; |
|||
$G(this.getAttribute("tabSrc")).style.display = ""; |
|||
}); |
|||
$G("tabHeads").appendChild(span); |
|||
domUtils.insertAfter(span, document.createTextNode("\n")); |
|||
var div = document.createElement("div"); |
|||
div.id = ci.name; |
|||
div.style.display = (i == 1) ? "" : "none"; |
|||
var cons = ci.content; |
|||
for (var j = 0, con; con = cons[j++];) { |
|||
var charSpan = document.createElement("span"); |
|||
charSpan.innerHTML = con; |
|||
domUtils.on(charSpan, "click", function () { |
|||
editor.execCommand("insertHTML", this.innerHTML); |
|||
dialog.close(); |
|||
}); |
|||
div.appendChild(charSpan); |
|||
} |
|||
$G("tabBodys").appendChild(div); |
|||
} |
|||
})(charsContent); |
|||
function toArray(str) { |
|||
return str.split(","); |
|||
} |
|||
@ -0,0 +1 @@ |
|||
.clear,li,table{clear:both}.wrap{padding:5px;font-size:14px}.left{width:425px;float:left}.right{width:160px;border:1px solid #ccc;float:right;padding:5px;margin-right:5px}.right .pre{height:332px;overflow-y:auto}.right .preitem{border:1px solid #fff;margin:5px 0;padding:2px 0}.right .preitem:hover{background-color:#fffacd;cursor:pointer;border:1px solid #ccc}.right .preitem img{display:block;margin:0 auto;width:100px}.top{height:26px;line-height:26px;padding:5px}.bottom{height:320px;width:100%;margin:0 auto}.transparent{background:url(images/bg.gif)}.bottom table tr td{border:1px dashed #ccc}#colorPicker{width:17px;height:17px;border:1px solid #CCC;display:inline-block;border-radius:3px;box-shadow:2px 2px 5px #D3D6DA}.border_style1{padding:2px;border:1px solid #ccc;border-radius:5px;box-shadow:2px 2px 5px #d3d6da}p{margin:5px 0}table{margin-bottom:10px;border-collapse:collapse;word-break:break-all}ol{padding-left:40px} |
|||
@ -0,0 +1,26 @@ |
|||
<!DOCTYPE HTML> |
|||
<html> |
|||
<head> |
|||
<title></title> |
|||
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/> |
|||
<script type="text/javascript" src="../internal.js"></script> |
|||
<link rel="stylesheet" type="text/css" href="template.css"> |
|||
</head> |
|||
<body> |
|||
<div class="wrap"> |
|||
<div class="left"> |
|||
<div class="top"> |
|||
<label><var id="lang_template_clear"></var>:<input id="issave" type="checkbox"></label> |
|||
</div> |
|||
<div class="bottom border_style1" id="preview"></div> |
|||
</div> |
|||
<fieldset class="right border_style1"> |
|||
<legend><var id="lang_template_select"></var></legend> |
|||
<div class="pre" id="preitem"></div> |
|||
</fieldset> |
|||
<div class="clear"></div> |
|||
</div> |
|||
<script type="text/javascript" src="config.js"></script> |
|||
<script type="text/javascript" src="template.js"></script> |
|||
</body> |
|||
</html> |
|||
@ -0,0 +1,53 @@ |
|||
/** |
|||
* Created with JetBrains PhpStorm. |
|||
* User: xuheng |
|||
* Date: 12-8-8 |
|||
* Time: 下午2:09 |
|||
* To change this template use File | Settings | File Templates. |
|||
*/ |
|||
(function () { |
|||
var me = editor, |
|||
preview = $G( "preview" ), |
|||
preitem = $G( "preitem" ), |
|||
tmps = templates, |
|||
currentTmp; |
|||
var initPre = function () { |
|||
var str = ""; |
|||
for ( var i = 0, tmp; tmp = tmps[i++]; ) { |
|||
str += '<div class="preitem" onclick="pre(' + i + ')"><img src="' + "images/" + tmp.pre + '" ' + (tmp.title ? "alt=" + tmp.title + " title=" + tmp.title + "" : "") + '></div>'; |
|||
} |
|||
preitem.innerHTML = str; |
|||
}; |
|||
var pre = function ( n ) { |
|||
var tmp = tmps[n - 1]; |
|||
currentTmp = tmp; |
|||
clearItem(); |
|||
domUtils.setStyles( preitem.childNodes[n - 1], { |
|||
"background-color":"lemonChiffon", |
|||
"border":"#ccc 1px solid" |
|||
} ); |
|||
preview.innerHTML = tmp.preHtml ? tmp.preHtml : ""; |
|||
}; |
|||
var clearItem = function () { |
|||
var items = preitem.children; |
|||
for ( var i = 0, item; item = items[i++]; ) { |
|||
domUtils.setStyles( item, { |
|||
"background-color":"", |
|||
"border":"white 1px solid" |
|||
} ); |
|||
} |
|||
}; |
|||
dialog.onok = function () { |
|||
if ( !$G( "issave" ).checked ){ |
|||
me.execCommand( "cleardoc" ); |
|||
} |
|||
var obj = { |
|||
html:currentTmp && currentTmp.html |
|||
}; |
|||
me.execCommand( "template", obj ); |
|||
}; |
|||
initPre(); |
|||
window.pre = pre; |
|||
pre(2) |
|||
|
|||
})(); |
|||
|
After Width: | Height: | Size: 11 KiB |
|
After Width: | Height: | Size: 445 B |
|
After Width: | Height: | Size: 1.6 KiB |
|
After Width: | Height: | Size: 719 B |
|
After Width: | Height: | Size: 952 B |
|
After Width: | Height: | Size: 754 B |
|
After Width: | Height: | Size: 1007 B |
|
After Width: | Height: | Size: 167 B |
|
After Width: | Height: | Size: 2.8 KiB |
|
After Width: | Height: | Size: 43 B |
|
After Width: | Height: | Size: 122 B |
|
After Width: | Height: | Size: 1.8 KiB |
|
After Width: | Height: | Size: 17 KiB |
@ -0,0 +1,17 @@ |
|||
/* |
|||
Highcharts JS v3.0.6 (2013-10-04) |
|||
|
|||
Standalone Highcharts Framework |
|||
|
|||
License: MIT License |
|||
*/ |
|||
var HighchartsAdapter=function(){function o(c){function a(a,b,d){a.removeEventListener(b,d,!1)}function d(a,b,d){d=a.HCProxiedMethods[d.toString()];a.detachEvent("on"+b,d)}function b(b,c){var f=b.HCEvents,i,g,k,j;if(b.removeEventListener)i=a;else if(b.attachEvent)i=d;else return;c?(g={},g[c]=!0):g=f;for(j in g)if(f[j])for(k=f[j].length;k--;)i(b,j,f[j][k])}c.HCExtended||Highcharts.extend(c,{HCExtended:!0,HCEvents:{},bind:function(b,a){var d=this,c=this.HCEvents,g;if(d.addEventListener)d.addEventListener(b, |
|||
a,!1);else if(d.attachEvent){g=function(b){a.call(d,b)};if(!d.HCProxiedMethods)d.HCProxiedMethods={};d.HCProxiedMethods[a.toString()]=g;d.attachEvent("on"+b,g)}c[b]===r&&(c[b]=[]);c[b].push(a)},unbind:function(c,h){var f,i;c?(f=this.HCEvents[c]||[],h?(i=HighchartsAdapter.inArray(h,f),i>-1&&(f.splice(i,1),this.HCEvents[c]=f),this.removeEventListener?a(this,c,h):this.attachEvent&&d(this,c,h)):(b(this,c),this.HCEvents[c]=[])):(b(this),this.HCEvents={})},trigger:function(b,a){var d=this.HCEvents[b]|| |
|||
[],c=d.length,g,k,j;k=function(){a.defaultPrevented=!0};for(g=0;g<c;g++){j=d[g];if(a.stopped)break;a.preventDefault=k;a.target=this;a.type=b;j.call(this,a)===!1&&a.preventDefault()}}});return c}var r,l=document,p=[],m=[],q,n;Math.easeInOutSine=function(c,a,d,b){return-d/2*(Math.cos(Math.PI*c/b)-1)+a};return{init:function(c){if(!l.defaultView)this._getStyle=function(a,d){var b;return a.style[d]?a.style[d]:(d==="opacity"&&(d="filter"),b=a.currentStyle[d.replace(/\-(\w)/g,function(a,b){return b.toUpperCase()})], |
|||
d==="filter"&&(b=b.replace(/alpha\(opacity=([0-9]+)\)/,function(b,a){return a/100})),b===""?1:b)},this.adapterRun=function(a,d){var b={width:"clientWidth",height:"clientHeight"}[d];if(b)return a.style.zoom=1,a[b]-2*parseInt(HighchartsAdapter._getStyle(a,"padding"),10)};if(!Array.prototype.forEach)this.each=function(a,d){for(var b=0,c=a.length;b<c;b++)if(d.call(a[b],a[b],b,a)===!1)return b};if(!Array.prototype.indexOf)this.inArray=function(a,d){var b,c=0;if(d)for(b=d.length;c<b;c++)if(d[c]===a)return c; |
|||
return-1};if(!Array.prototype.filter)this.grep=function(a,d){for(var b=[],c=0,h=a.length;c<h;c++)d(a[c],c)&&b.push(a[c]);return b};n=function(a,c,b){this.options=c;this.elem=a;this.prop=b};n.prototype={update:function(){var a;a=this.paths;var d=this.elem,b=d.element;a&&b?d.attr("d",c.step(a[0],a[1],this.now,this.toD)):d.attr?b&&d.attr(this.prop,this.now):(a={},a[d]=this.now+this.unit,Highcharts.css(d,a));this.options.step&&this.options.step.call(this.elem,this.now,this)},custom:function(a,c,b){var e= |
|||
this,h=function(a){return e.step(a)},f;this.startTime=+new Date;this.start=a;this.end=c;this.unit=b;this.now=this.start;this.pos=this.state=0;h.elem=this.elem;h()&&m.push(h)===1&&(q=setInterval(function(){for(f=0;f<m.length;f++)m[f]()||m.splice(f--,1);m.length||clearInterval(q)},13))},step:function(a){var c=+new Date,b;b=this.options;var e;if(this.elem.stopAnimation)b=!1;else if(a||c>=b.duration+this.startTime){this.now=this.end;this.pos=this.state=1;this.update();a=this.options.curAnim[this.prop]= |
|||
!0;for(e in b.curAnim)b.curAnim[e]!==!0&&(a=!1);a&&b.complete&&b.complete.call(this.elem);b=!1}else e=c-this.startTime,this.state=e/b.duration,this.pos=b.easing(e,0,1,b.duration),this.now=this.start+(this.end-this.start)*this.pos,this.update(),b=!0;return b}};this.animate=function(a,d,b){var e,h="",f,i,g;a.stopAnimation=!1;if(typeof b!=="object"||b===null)e=arguments,b={duration:e[2],easing:e[3],complete:e[4]};if(typeof b.duration!=="number")b.duration=400;b.easing=Math[b.easing]||Math.easeInOutSine; |
|||
b.curAnim=Highcharts.extend({},d);for(g in d)i=new n(a,b,g),f=null,g==="d"?(i.paths=c.init(a,a.d,d.d),i.toD=d.d,e=0,f=1):a.attr?e=a.attr(g):(e=parseFloat(HighchartsAdapter._getStyle(a,g))||0,g!=="opacity"&&(h="px")),f||(f=parseFloat(d[g])),i.custom(e,f,h)}},_getStyle:function(c,a){return window.getComputedStyle(c).getPropertyValue(a)},getScript:function(c,a){var d=l.getElementsByTagName("head")[0],b=l.createElement("script");b.type="text/javascript";b.src=c;b.onload=a;d.appendChild(b)},inArray:function(c, |
|||
a){return a.indexOf?a.indexOf(c):p.indexOf.call(a,c)},adapterRun:function(c,a){return parseInt(HighchartsAdapter._getStyle(c,a),10)},grep:function(c,a){return p.filter.call(c,a)},map:function(c,a){for(var d=[],b=0,e=c.length;b<e;b++)d[b]=a.call(c[b],c[b],b,c);return d},offset:function(c){for(var a=0,d=0;c;)a+=c.offsetLeft,d+=c.offsetTop,c=c.offsetParent;return{left:a,top:d}},addEvent:function(c,a,d){o(c).bind(a,d)},removeEvent:function(c,a,d){o(c).unbind(a,d)},fireEvent:function(c,a,d,b){var e;l.createEvent&& |
|||
(c.dispatchEvent||c.fireEvent)?(e=l.createEvent("Events"),e.initEvent(a,!0,!0),e.target=c,Highcharts.extend(e,d),c.dispatchEvent?c.dispatchEvent(e):c.fireEvent(a,e)):c.HCExtended===!0&&(d=d||{},c.trigger(a,d));d&&d.defaultPrevented&&(b=null);b&&b(d)},washMouseEvent:function(c){return c},stop:function(c){c.stopAnimation=!0},each:function(c,a){return Array.prototype.forEach.call(c,a)}}}(); |
|||
@ -0,0 +1,583 @@ |
|||
/** |
|||
* @license Highcharts JS v3.0.6 (2013-10-04) |
|||
* |
|||
* Standalone Highcharts Framework |
|||
* |
|||
* License: MIT License |
|||
*/ |
|||
|
|||
|
|||
/*global Highcharts */ |
|||
var HighchartsAdapter = (function () { |
|||
|
|||
var UNDEFINED, |
|||
doc = document, |
|||
emptyArray = [], |
|||
timers = [], |
|||
timerId, |
|||
Fx; |
|||
|
|||
Math.easeInOutSine = function (t, b, c, d) { |
|||
return -c / 2 * (Math.cos(Math.PI * t / d) - 1) + b; |
|||
}; |
|||
|
|||
|
|||
|
|||
/** |
|||
* Extend given object with custom events |
|||
*/ |
|||
function augment(obj) { |
|||
function removeOneEvent(el, type, fn) { |
|||
el.removeEventListener(type, fn, false); |
|||
} |
|||
|
|||
function IERemoveOneEvent(el, type, fn) { |
|||
fn = el.HCProxiedMethods[fn.toString()]; |
|||
el.detachEvent('on' + type, fn); |
|||
} |
|||
|
|||
function removeAllEvents(el, type) { |
|||
var events = el.HCEvents, |
|||
remove, |
|||
types, |
|||
len, |
|||
n; |
|||
|
|||
if (el.removeEventListener) { |
|||
remove = removeOneEvent; |
|||
} else if (el.attachEvent) { |
|||
remove = IERemoveOneEvent; |
|||
} else { |
|||
return; // break on non-DOM events
|
|||
} |
|||
|
|||
|
|||
if (type) { |
|||
types = {}; |
|||
types[type] = true; |
|||
} else { |
|||
types = events; |
|||
} |
|||
|
|||
for (n in types) { |
|||
if (events[n]) { |
|||
len = events[n].length; |
|||
while (len--) { |
|||
remove(el, n, events[n][len]); |
|||
} |
|||
} |
|||
} |
|||
} |
|||
|
|||
if (!obj.HCExtended) { |
|||
Highcharts.extend(obj, { |
|||
HCExtended: true, |
|||
|
|||
HCEvents: {}, |
|||
|
|||
bind: function (name, fn) { |
|||
var el = this, |
|||
events = this.HCEvents, |
|||
wrappedFn; |
|||
|
|||
// handle DOM events in modern browsers
|
|||
if (el.addEventListener) { |
|||
el.addEventListener(name, fn, false); |
|||
|
|||
// handle old IE implementation
|
|||
} else if (el.attachEvent) { |
|||
|
|||
wrappedFn = function (e) { |
|||
fn.call(el, e); |
|||
}; |
|||
|
|||
if (!el.HCProxiedMethods) { |
|||
el.HCProxiedMethods = {}; |
|||
} |
|||
|
|||
// link wrapped fn with original fn, so we can get this in removeEvent
|
|||
el.HCProxiedMethods[fn.toString()] = wrappedFn; |
|||
|
|||
el.attachEvent('on' + name, wrappedFn); |
|||
} |
|||
|
|||
|
|||
if (events[name] === UNDEFINED) { |
|||
events[name] = []; |
|||
} |
|||
|
|||
events[name].push(fn); |
|||
}, |
|||
|
|||
unbind: function (name, fn) { |
|||
var events, |
|||
index; |
|||
|
|||
if (name) { |
|||
events = this.HCEvents[name] || []; |
|||
if (fn) { |
|||
index = HighchartsAdapter.inArray(fn, events); |
|||
if (index > -1) { |
|||
events.splice(index, 1); |
|||
this.HCEvents[name] = events; |
|||
} |
|||
if (this.removeEventListener) { |
|||
removeOneEvent(this, name, fn); |
|||
} else if (this.attachEvent) { |
|||
IERemoveOneEvent(this, name, fn); |
|||
} |
|||
} else { |
|||
removeAllEvents(this, name); |
|||
this.HCEvents[name] = []; |
|||
} |
|||
} else { |
|||
removeAllEvents(this); |
|||
this.HCEvents = {}; |
|||
} |
|||
}, |
|||
|
|||
trigger: function (name, args) { |
|||
var events = this.HCEvents[name] || [], |
|||
target = this, |
|||
len = events.length, |
|||
i, |
|||
preventDefault, |
|||
fn; |
|||
|
|||
// Attach a simple preventDefault function to skip default handler if called
|
|||
preventDefault = function () { |
|||
args.defaultPrevented = true; |
|||
}; |
|||
|
|||
for (i = 0; i < len; i++) { |
|||
fn = events[i]; |
|||
|
|||
// args is never null here
|
|||
if (args.stopped) { |
|||
return; |
|||
} |
|||
|
|||
args.preventDefault = preventDefault; |
|||
args.target = target; |
|||
args.type = name; // #2297
|
|||
|
|||
// If the event handler return false, prevent the default handler from executing
|
|||
if (fn.call(this, args) === false) { |
|||
args.preventDefault(); |
|||
} |
|||
} |
|||
} |
|||
}); |
|||
} |
|||
|
|||
return obj; |
|||
} |
|||
|
|||
|
|||
return { |
|||
/** |
|||
* Initialize the adapter. This is run once as Highcharts is first run. |
|||
*/ |
|||
init: function (pathAnim) { |
|||
|
|||
/** |
|||
* Compatibility section to add support for legacy IE. This can be removed if old IE |
|||
* support is not needed. |
|||
*/ |
|||
if (!doc.defaultView) { |
|||
this._getStyle = function (el, prop) { |
|||
var val; |
|||
if (el.style[prop]) { |
|||
return el.style[prop]; |
|||
} else { |
|||
if (prop === 'opacity') { |
|||
prop = 'filter'; |
|||
} |
|||
/*jslint unparam: true*/ |
|||
val = el.currentStyle[prop.replace(/\-(\w)/g, function (a, b) { return b.toUpperCase(); })]; |
|||
if (prop === 'filter') { |
|||
val = val.replace( |
|||
/alpha\(opacity=([0-9]+)\)/, |
|||
function (a, b) { |
|||
return b / 100; |
|||
} |
|||
); |
|||
} |
|||
/*jslint unparam: false*/ |
|||
return val === '' ? 1 : val; |
|||
} |
|||
}; |
|||
this.adapterRun = function (elem, method) { |
|||
var alias = { width: 'clientWidth', height: 'clientHeight' }[method]; |
|||
|
|||
if (alias) { |
|||
elem.style.zoom = 1; |
|||
return elem[alias] - 2 * parseInt(HighchartsAdapter._getStyle(elem, 'padding'), 10); |
|||
} |
|||
}; |
|||
} |
|||
|
|||
if (!Array.prototype.forEach) { |
|||
this.each = function (arr, fn) { // legacy
|
|||
var i = 0, |
|||
len = arr.length; |
|||
for (; i < len; i++) { |
|||
if (fn.call(arr[i], arr[i], i, arr) === false) { |
|||
return i; |
|||
} |
|||
} |
|||
}; |
|||
} |
|||
|
|||
if (!Array.prototype.indexOf) { |
|||
this.inArray = function (item, arr) { |
|||
var len, |
|||
i = 0; |
|||
|
|||
if (arr) { |
|||
len = arr.length; |
|||
|
|||
for (; i < len; i++) { |
|||
if (arr[i] === item) { |
|||
return i; |
|||
} |
|||
} |
|||
} |
|||
|
|||
return -1; |
|||
}; |
|||
} |
|||
|
|||
if (!Array.prototype.filter) { |
|||
this.grep = function (elements, callback) { |
|||
var ret = [], |
|||
i = 0, |
|||
length = elements.length; |
|||
|
|||
for (; i < length; i++) { |
|||
if (!!callback(elements[i], i)) { |
|||
ret.push(elements[i]); |
|||
} |
|||
} |
|||
|
|||
return ret; |
|||
}; |
|||
} |
|||
|
|||
//--- End compatibility section ---
|
|||
|
|||
|
|||
/** |
|||
* Start of animation specific code |
|||
*/ |
|||
Fx = function (elem, options, prop) { |
|||
this.options = options; |
|||
this.elem = elem; |
|||
this.prop = prop; |
|||
}; |
|||
Fx.prototype = { |
|||
|
|||
update: function () { |
|||
var styles, |
|||
paths = this.paths, |
|||
elem = this.elem, |
|||
elemelem = elem.element; // if destroyed, it is null
|
|||
|
|||
// Animating a path definition on SVGElement
|
|||
if (paths && elemelem) { |
|||
elem.attr('d', pathAnim.step(paths[0], paths[1], this.now, this.toD)); |
|||
|
|||
// Other animations on SVGElement
|
|||
} else if (elem.attr) { |
|||
if (elemelem) { |
|||
elem.attr(this.prop, this.now); |
|||
} |
|||
|
|||
// HTML styles
|
|||
} else { |
|||
styles = {}; |
|||
styles[elem] = this.now + this.unit; |
|||
Highcharts.css(elem, styles); |
|||
} |
|||
|
|||
if (this.options.step) { |
|||
this.options.step.call(this.elem, this.now, this); |
|||
} |
|||
|
|||
}, |
|||
custom: function (from, to, unit) { |
|||
var self = this, |
|||
t = function (gotoEnd) { |
|||
return self.step(gotoEnd); |
|||
}, |
|||
i; |
|||
|
|||
this.startTime = +new Date(); |
|||
this.start = from; |
|||
this.end = to; |
|||
this.unit = unit; |
|||
this.now = this.start; |
|||
this.pos = this.state = 0; |
|||
|
|||
t.elem = this.elem; |
|||
|
|||
if (t() && timers.push(t) === 1) { |
|||
timerId = setInterval(function () { |
|||
|
|||
for (i = 0; i < timers.length; i++) { |
|||
if (!timers[i]()) { |
|||
timers.splice(i--, 1); |
|||
} |
|||
} |
|||
|
|||
if (!timers.length) { |
|||
clearInterval(timerId); |
|||
} |
|||
}, 13); |
|||
} |
|||
}, |
|||
|
|||
step: function (gotoEnd) { |
|||
var t = +new Date(), |
|||
ret, |
|||
done, |
|||
options = this.options, |
|||
i; |
|||
|
|||
if (this.elem.stopAnimation) { |
|||
ret = false; |
|||
|
|||
} else if (gotoEnd || t >= options.duration + this.startTime) { |
|||
this.now = this.end; |
|||
this.pos = this.state = 1; |
|||
this.update(); |
|||
|
|||
this.options.curAnim[this.prop] = true; |
|||
|
|||
done = true; |
|||
for (i in options.curAnim) { |
|||
if (options.curAnim[i] !== true) { |
|||
done = false; |
|||
} |
|||
} |
|||
|
|||
if (done) { |
|||
if (options.complete) { |
|||
options.complete.call(this.elem); |
|||
} |
|||
} |
|||
ret = false; |
|||
|
|||
} else { |
|||
var n = t - this.startTime; |
|||
this.state = n / options.duration; |
|||
this.pos = options.easing(n, 0, 1, options.duration); |
|||
this.now = this.start + ((this.end - this.start) * this.pos); |
|||
this.update(); |
|||
ret = true; |
|||
} |
|||
return ret; |
|||
} |
|||
}; |
|||
|
|||
/** |
|||
* The adapter animate method |
|||
*/ |
|||
this.animate = function (el, prop, opt) { |
|||
var start, |
|||
unit = '', |
|||
end, |
|||
fx, |
|||
args, |
|||
name; |
|||
|
|||
el.stopAnimation = false; // ready for new
|
|||
|
|||
if (typeof opt !== 'object' || opt === null) { |
|||
args = arguments; |
|||
opt = { |
|||
duration: args[2], |
|||
easing: args[3], |
|||
complete: args[4] |
|||
}; |
|||
} |
|||
if (typeof opt.duration !== 'number') { |
|||
opt.duration = 400; |
|||
} |
|||
opt.easing = Math[opt.easing] || Math.easeInOutSine; |
|||
opt.curAnim = Highcharts.extend({}, prop); |
|||
|
|||
for (name in prop) { |
|||
fx = new Fx(el, opt, name); |
|||
end = null; |
|||
|
|||
if (name === 'd') { |
|||
fx.paths = pathAnim.init( |
|||
el, |
|||
el.d, |
|||
prop.d |
|||
); |
|||
fx.toD = prop.d; |
|||
start = 0; |
|||
end = 1; |
|||
} else if (el.attr) { |
|||
start = el.attr(name); |
|||
} else { |
|||
start = parseFloat(HighchartsAdapter._getStyle(el, name)) || 0; |
|||
if (name !== 'opacity') { |
|||
unit = 'px'; |
|||
} |
|||
} |
|||
|
|||
if (!end) { |
|||
end = parseFloat(prop[name]); |
|||
} |
|||
fx.custom(start, end, unit); |
|||
} |
|||
}; |
|||
}, |
|||
|
|||
/** |
|||
* Internal method to return CSS value for given element and property |
|||
*/ |
|||
_getStyle: function (el, prop) { |
|||
return window.getComputedStyle(el).getPropertyValue(prop); |
|||
}, |
|||
|
|||
/** |
|||
* Downloads a script and executes a callback when done. |
|||
* @param {String} scriptLocation |
|||
* @param {Function} callback |
|||
*/ |
|||
getScript: function (scriptLocation, callback) { |
|||
// We cannot assume that Assets class from mootools-more is available so instead insert a script tag to download script.
|
|||
var head = doc.getElementsByTagName('head')[0], |
|||
script = doc.createElement('script'); |
|||
|
|||
script.type = 'text/javascript'; |
|||
script.src = scriptLocation; |
|||
script.onload = callback; |
|||
|
|||
head.appendChild(script); |
|||
}, |
|||
|
|||
/** |
|||
* Return the index of an item in an array, or -1 if not found |
|||
*/ |
|||
inArray: function (item, arr) { |
|||
return arr.indexOf ? arr.indexOf(item) : emptyArray.indexOf.call(arr, item); |
|||
}, |
|||
|
|||
|
|||
/** |
|||
* A direct link to adapter methods |
|||
*/ |
|||
adapterRun: function (elem, method) { |
|||
return parseInt(HighchartsAdapter._getStyle(elem, method), 10); |
|||
}, |
|||
|
|||
/** |
|||
* Filter an array |
|||
*/ |
|||
grep: function (elements, callback) { |
|||
return emptyArray.filter.call(elements, callback); |
|||
}, |
|||
|
|||
/** |
|||
* Map an array |
|||
*/ |
|||
map: function (arr, fn) { |
|||
var results = [], i = 0, len = arr.length; |
|||
|
|||
for (; i < len; i++) { |
|||
results[i] = fn.call(arr[i], arr[i], i, arr); |
|||
} |
|||
|
|||
return results; |
|||
}, |
|||
|
|||
offset: function (el) { |
|||
var left = 0, |
|||
top = 0; |
|||
|
|||
while (el) { |
|||
left += el.offsetLeft; |
|||
top += el.offsetTop; |
|||
el = el.offsetParent; |
|||
} |
|||
|
|||
return { |
|||
left: left, |
|||
top: top |
|||
}; |
|||
}, |
|||
|
|||
/** |
|||
* Add an event listener |
|||
*/ |
|||
addEvent: function (el, type, fn) { |
|||
augment(el).bind(type, fn); |
|||
}, |
|||
|
|||
/** |
|||
* Remove event added with addEvent |
|||
*/ |
|||
removeEvent: function (el, type, fn) { |
|||
augment(el).unbind(type, fn); |
|||
}, |
|||
|
|||
/** |
|||
* Fire an event on a custom object |
|||
*/ |
|||
fireEvent: function (el, type, eventArguments, defaultFunction) { |
|||
var e; |
|||
|
|||
if (doc.createEvent && (el.dispatchEvent || el.fireEvent)) { |
|||
e = doc.createEvent('Events'); |
|||
e.initEvent(type, true, true); |
|||
e.target = el; |
|||
|
|||
Highcharts.extend(e, eventArguments); |
|||
|
|||
if (el.dispatchEvent) { |
|||
el.dispatchEvent(e); |
|||
} else { |
|||
el.fireEvent(type, e); |
|||
} |
|||
|
|||
} else if (el.HCExtended === true) { |
|||
eventArguments = eventArguments || {}; |
|||
el.trigger(type, eventArguments); |
|||
} |
|||
|
|||
if (eventArguments && eventArguments.defaultPrevented) { |
|||
defaultFunction = null; |
|||
} |
|||
|
|||
if (defaultFunction) { |
|||
defaultFunction(eventArguments); |
|||
} |
|||
}, |
|||
|
|||
washMouseEvent: function (e) { |
|||
return e; |
|||
}, |
|||
|
|||
|
|||
/** |
|||
* Stop running animation |
|||
*/ |
|||
stop: function (el) { |
|||
el.stopAnimation = true; |
|||
}, |
|||
|
|||
/** |
|||
* Utility for iterating over an array. Parameters are reversed compared to jQuery. |
|||
* @param {Array} arr |
|||
* @param {Function} fn |
|||
*/ |
|||
each: function (arr, fn) { // modern browsers
|
|||
return Array.prototype.forEach.call(arr, fn); |
|||
} |
|||
}; |
|||
}()); |
|||
@ -0,0 +1,89 @@ |
|||
/** |
|||
* Skies theme for Highcharts JS |
|||
* @author Torstein Hønsi |
|||
*/ |
|||
|
|||
Highcharts.theme = { |
|||
colors: ["#514F78", "#42A07B", "#9B5E4A", "#72727F", "#1F949A", "#82914E", "#86777F", "#42A07B"], |
|||
chart: { |
|||
className: 'skies', |
|||
borderWidth: 0, |
|||
plotShadow: true, |
|||
plotBackgroundImage: 'http://www.highcharts.com/demo/gfx/skies.jpg', |
|||
plotBackgroundColor: { |
|||
linearGradient: [0, 0, 250, 500], |
|||
stops: [ |
|||
[0, 'rgba(255, 255, 255, 1)'], |
|||
[1, 'rgba(255, 255, 255, 0)'] |
|||
] |
|||
}, |
|||
plotBorderWidth: 1 |
|||
}, |
|||
title: { |
|||
style: { |
|||
color: '#3E576F', |
|||
font: '16px Lucida Grande, Lucida Sans Unicode, Verdana, Arial, Helvetica, sans-serif' |
|||
} |
|||
}, |
|||
subtitle: { |
|||
style: { |
|||
color: '#6D869F', |
|||
font: '12px Lucida Grande, Lucida Sans Unicode, Verdana, Arial, Helvetica, sans-serif' |
|||
} |
|||
}, |
|||
xAxis: { |
|||
gridLineWidth: 0, |
|||
lineColor: '#C0D0E0', |
|||
tickColor: '#C0D0E0', |
|||
labels: { |
|||
style: { |
|||
color: '#666', |
|||
fontWeight: 'bold' |
|||
} |
|||
}, |
|||
title: { |
|||
style: { |
|||
color: '#666', |
|||
font: '12px Lucida Grande, Lucida Sans Unicode, Verdana, Arial, Helvetica, sans-serif' |
|||
} |
|||
} |
|||
}, |
|||
yAxis: { |
|||
alternateGridColor: 'rgba(255, 255, 255, .5)', |
|||
lineColor: '#C0D0E0', |
|||
tickColor: '#C0D0E0', |
|||
tickWidth: 1, |
|||
labels: { |
|||
style: { |
|||
color: '#666', |
|||
fontWeight: 'bold' |
|||
} |
|||
}, |
|||
title: { |
|||
style: { |
|||
color: '#666', |
|||
font: '12px Lucida Grande, Lucida Sans Unicode, Verdana, Arial, Helvetica, sans-serif' |
|||
} |
|||
} |
|||
}, |
|||
legend: { |
|||
itemStyle: { |
|||
font: '9pt Trebuchet MS, Verdana, sans-serif', |
|||
color: '#3E576F' |
|||
}, |
|||
itemHoverStyle: { |
|||
color: 'black' |
|||
}, |
|||
itemHiddenStyle: { |
|||
color: 'silver' |
|||
} |
|||
}, |
|||
labels: { |
|||
style: { |
|||
color: '#3E576F' |
|||
} |
|||
} |
|||
}; |
|||
|
|||
// Apply the theme
|
|||
var highchartsOptions = Highcharts.setOptions(Highcharts.theme); |
|||
|
After Width: | Height: | Size: 1.6 KiB |
@ -0,0 +1,362 @@ |
|||
(function (e) { |
|||
function t(t) { |
|||
for (var r, o, i = t[0], u = t[1], s = t[2], f = 0, l = []; f < i.length; f++) o = i[f], a[o] && l.push(a[o][0]), a[o] = 0; |
|||
for (r in u) Object.prototype.hasOwnProperty.call(u, r) && (e[r] = u[r]); |
|||
p && p(t); |
|||
while (l.length) l.shift()(); |
|||
return c.push.apply(c, s || []), n() |
|||
} |
|||
|
|||
function n() { |
|||
for (var e, t = 0; t < c.length; t++) { |
|||
for (var n = c[t], r = !0, o = 1; o < n.length; o++) { |
|||
var i = n[o]; |
|||
0 !== a[i] && (r = !1) |
|||
} |
|||
r && (c.splice(t--, 1), e = u(u.s = n[0])) |
|||
} |
|||
return e |
|||
} |
|||
|
|||
var r = {}, o = {star: 0}, a = {star: 0}, c = []; |
|||
|
|||
function i(e) { |
|||
return u.p + "js/" + ({}[e] || e) + ".star.js" |
|||
} |
|||
|
|||
function u(t) { |
|||
if (r[t]) return r[t].exports; |
|||
var n = r[t] = {i: t, l: !1, exports: {}}; |
|||
return e[t].call(n.exports, n, n.exports, u), n.l = !0, n.exports |
|||
} |
|||
|
|||
u.e = function (e) { |
|||
var t = [], n = {"chunk-17fcbe22": 1, "chunk-225ab4a4": 1, "chunk-43bc671b": 1, "chunk-a7ffc2ce": 1}; |
|||
o[e] ? t.push(o[e]) : 0 !== o[e] && n[e] && t.push(o[e] = new Promise(function (t, n) { |
|||
for (var r = "css/" + ({}[e] || e) + ".css", a = u.p + r, c = document.getElementsByTagName("link"), i = 0; i < c.length; i++) { |
|||
var s = c[i], f = s.getAttribute("data-href") || s.getAttribute("href"); |
|||
if ("stylesheet" === s.rel && (f === r || f === a)) return t() |
|||
} |
|||
var l = document.getElementsByTagName("style"); |
|||
for (i = 0; i < l.length; i++) { |
|||
s = l[i], f = s.getAttribute("data-href"); |
|||
if (f === r || f === a) return t() |
|||
} |
|||
var p = document.createElement("link"); |
|||
p.rel = "stylesheet", p.type = "text/css", p.onload = t, p.onerror = function (t) { |
|||
var r = t && t.target && t.target.src || a, |
|||
c = new Error("Loading CSS chunk " + e + " failed.\n(" + r + ")"); |
|||
c.code = "CSS_CHUNK_LOAD_FAILED", c.request = r, delete o[e], p.parentNode.removeChild(p), n(c) |
|||
}, p.href = a; |
|||
var d = document.getElementsByTagName("head")[0]; |
|||
d.appendChild(p) |
|||
}).then(function () { |
|||
o[e] = 0 |
|||
})); |
|||
var r = a[e]; |
|||
if (0 !== r) if (r) t.push(r[2]); else { |
|||
var c = new Promise(function (t, n) { |
|||
r = a[e] = [t, n] |
|||
}); |
|||
t.push(r[2] = c); |
|||
var s, f = document.createElement("script"); |
|||
f.charset = "utf-8", f.timeout = 120, u.nc && f.setAttribute("nonce", u.nc), f.src = i(e), s = function (t) { |
|||
f.onerror = f.onload = null, clearTimeout(l); |
|||
var n = a[e]; |
|||
if (0 !== n) { |
|||
if (n) { |
|||
var r = t && ("load" === t.type ? "missing" : t.type), o = t && t.target && t.target.src, |
|||
c = new Error("Loading chunk " + e + " failed.\n(" + r + ": " + o + ")"); |
|||
c.type = r, c.request = o, n[1](c) |
|||
} |
|||
a[e] = void 0 |
|||
} |
|||
}; |
|||
var l = setTimeout(function () { |
|||
s({type: "timeout", target: f}) |
|||
}, 12e4); |
|||
f.onerror = f.onload = s, document.head.appendChild(f) |
|||
} |
|||
return Promise.all(t) |
|||
}, u.m = e, u.c = r, u.d = function (e, t, n) { |
|||
u.o(e, t) || Object.defineProperty(e, t, {enumerable: !0, get: n}) |
|||
}, u.r = function (e) { |
|||
"undefined" !== typeof Symbol && Symbol.toStringTag && Object.defineProperty(e, Symbol.toStringTag, {value: "Module"}), Object.defineProperty(e, "__esModule", {value: !0}) |
|||
}, u.t = function (e, t) { |
|||
if (1 & t && (e = u(e)), 8 & t) return e; |
|||
if (4 & t && "object" === typeof e && e && e.__esModule) return e; |
|||
var n = Object.create(null); |
|||
if (u.r(n), Object.defineProperty(n, "default", { |
|||
enumerable: !0, |
|||
value: e |
|||
}), 2 & t && "string" != typeof e) for (var r in e) u.d(n, r, function (t) { |
|||
return e[t] |
|||
}.bind(null, r)); |
|||
return n |
|||
}, u.n = function (e) { |
|||
var t = e && e.__esModule ? function () { |
|||
return e["default"] |
|||
} : function () { |
|||
return e |
|||
}; |
|||
return u.d(t, "a", t), t |
|||
}, u.o = function (e, t) { |
|||
return Object.prototype.hasOwnProperty.call(e, t) |
|||
}, u.p = "resource/home/", u.oe = function (e) { |
|||
throw console.error(e), e |
|||
}; |
|||
var s = window["webpackJsonp"] = window["webpackJsonp"] || [], f = s.push.bind(s); |
|||
s.push = t, s = s.slice(); |
|||
for (var l = 0; l < s.length; l++) t(s[l]); |
|||
var p = f; |
|||
c.push([0, "chunk-vendors"]), n() |
|||
})({ |
|||
0: function (e, t, n) { |
|||
e.exports = n("0588") |
|||
}, "0588": function (e, t, n) { |
|||
"use strict"; |
|||
n.r(t); |
|||
n("cadf"), n("551c"), n("f751"), n("097d"); |
|||
var r = n("2b0e"), o = n("8c4f"); |
|||
r["default"].use(o["a"]); |
|||
var a = new o["a"]({ |
|||
routes: [{ |
|||
path: "/appList/:uniacid", name: "app", component: function () { |
|||
return n.e("chunk-43bc671b").then(n.bind(null, "ef9b")) |
|||
}, meta: {noCommon: !0} |
|||
}, { |
|||
path: "/", name: "index", component: function () { |
|||
return n.e("chunk-a7ffc2ce").then(n.bind(null, "452d")) |
|||
}, meta: {noCommon: !0}, beforeEnter: function (e, t, n) { |
|||
if ("/" == e.path) { |
|||
var r = window.localStorage.getItem("we7StarRoute") && "/" != window.localStorage.getItem("we7StarRoute") ? window.localStorage.getItem("we7StarRoute") : "platform"; |
|||
n({path: r}) |
|||
} else n() |
|||
}, children: [{ |
|||
path: "/account_recycle", name: "accountRecycle", component: function () { |
|||
return n.e("chunk-17fcbe22").then(n.bind(null, "4e8e")) |
|||
}, meta: {noCommon: !0} |
|||
}, { |
|||
path: ":key", name: "info", component: function () { |
|||
return n.e("chunk-225ab4a4").then(n.bind(null, "f60e")) |
|||
}, meta: {noCommon: !0} |
|||
}, { |
|||
path: ":key/:type", name: "info", component: function () { |
|||
return n.e("chunk-225ab4a4").then(n.bind(null, "f60e")) |
|||
}, meta: {noCommon: !0} |
|||
}] |
|||
}], mode: "" |
|||
}), c = (n("8e6e"), n("ac6a"), n("456d"), n("a481"), n("4917"), n("bd86")), i = n("7618"), |
|||
u = (n("28a5"), function () { |
|||
var e = this, t = e.$createElement, n = e._self._c || t; |
|||
return n("div", {attrs: {id: "we7"}}, [n("router-view")], 1) |
|||
}), s = [], f = n("2877"), l = {}, p = Object(f["a"])(l, u, s, !1, null, null, null), d = p.exports, |
|||
A = n("4360"), m = n("5c96"), g = n.n(m), h = (n("24ab"), n("adcf"), n("a27e")), b = { |
|||
inserted: function (e, t) { |
|||
var n = t.value, r = A["a"].state && A["a"].state.permission; |
|||
"string" === typeof n && (n = [n]); |
|||
var o = !1; |
|||
n && n instanceof Array && n.length > 0 && r instanceof Array && (o = n.some(function (e) { |
|||
return -1 !== r.indexOf(e) |
|||
})), o || e.parentNode && e.parentNode.removeChild(e) |
|||
}, install: function (e) { |
|||
e.directive("permission", b) |
|||
} |
|||
}, y = b, E = n("4eb5"), O = n.n(E), w = n("caf9"); |
|||
|
|||
function S(e, t) { |
|||
var n = Object.keys(e); |
|||
if (Object.getOwnPropertySymbols) { |
|||
var r = Object.getOwnPropertySymbols(e); |
|||
t && (r = r.filter(function (t) { |
|||
return Object.getOwnPropertyDescriptor(e, t).enumerable |
|||
})), n.push.apply(n, r) |
|||
} |
|||
return n |
|||
} |
|||
|
|||
function v(e) { |
|||
for (var t = 1; t < arguments.length; t++) { |
|||
var n = null != arguments[t] ? arguments[t] : {}; |
|||
t % 2 ? S(n, !0).forEach(function (t) { |
|||
Object(c["a"])(e, t, n[t]) |
|||
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(n)) : S(n).forEach(function (t) { |
|||
Object.defineProperty(e, t, Object.getOwnPropertyDescriptor(n, t)) |
|||
}) |
|||
} |
|||
return e |
|||
} |
|||
|
|||
r["default"].mixin({ |
|||
methods: { |
|||
openRoute: function (e, t) { |
|||
var n = location.pathname.split("/"); |
|||
return location.origin + "/" + n[1] + "/" + n[2] + "/" + e + t |
|||
} |
|||
}, data: function () { |
|||
return {VUE_APP_FOR: "star"} |
|||
} |
|||
}), r["default"].prototype.$http = h["a"], r["default"].use(g.a), r["default"].use(y), r["default"].use(O.a), r["default"].use(w["a"], { |
|||
preLoad: 1.3, |
|||
error: n("ca87"), |
|||
attempt: 1, |
|||
filter: { |
|||
index: function (e) { |
|||
-1 != e.el.className.indexOf("account-logo") && (e.error = n("11ad")), -1 != e.el.className.indexOf("module-logo") && (e.error = n("8d29")), -1 != e.el.className.indexOf("user-logo") && (e.error = n("6c37")) |
|||
} |
|||
} |
|||
}), r["default"].config.productionTip = !1, r["default"].prototype.$message = function (e) { |
|||
var t = "object" == Object(i["a"])(e) ? e : {title: e}; |
|||
return t = Object.assign({duration: 500}, t), Object(m["Message"])(t) |
|||
}, r["default"].prototype.$alert = function (e, t, n) { |
|||
return n = Object.assign({center: !0}, n), m["MessageBox"].alert(e, t || "系统提示", n) |
|||
}, r["default"].prototype.$confirm = function (e, t, n) { |
|||
return m["MessageBox"].confirm(e, t || "系统提示", v({}, n, {type: "warning", center: !0})) |
|||
}; |
|||
var _ = function (e) { |
|||
return e.beforeEach(function (e, t, n) { |
|||
if (e.meta.noCommon) n(); else { |
|||
var r = A["a"].state && A["a"].state.permission; |
|||
r && r.length ? n() : A["a"].dispatch("getCommon").then(function () { |
|||
n() |
|||
}).catch(function (e) { |
|||
console.log("测试console1" + e) |
|||
}) |
|||
} |
|||
}), e.onError(function (t) { |
|||
var n = /Loading chunk (\d)+ failed/g; |
|||
console.log(t); |
|||
var r = t.message.match(n), o = e.history.pending.fullPath; |
|||
r && e.replace(o) |
|||
}), window.test = Object({ |
|||
NODE_ENV: "production", |
|||
VUE_APP_FOR: "star", |
|||
BASE_URL: "resource/home/" |
|||
}), new r["default"]({ |
|||
router: e, store: A["a"], render: function (e) { |
|||
return e(d) |
|||
} |
|||
}).$mount("#app") |
|||
}, N = _; |
|||
N(a) |
|||
}, "11ad": function (e, t) { |
|||
e.exports = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADwAAAA8BAMAAADI0sRBAAAAIVBMVEX3+PrMzMzc3N3k5OXS0tPy8/X09fft7e/g4eLX19fq6+wMXGroAAAApUlEQVQ4y2MYBQMGghwFBQWdQSwTIENEFVWWSxAM3BgYUiCsBSjSgRBBSQaGiRCWKIq0oiAEFLBDGUIo0o5Q0QYOKEMERVoQChSYYKxhIg3ztwEzVn8bQkUDWKEMYRRpFqggXKEDijTbRIjZDAwQ0yUTUGOUvUlJSckUxAoGMjQKKE0/hA0n7DTCHiMcLIhAHZmJCZGJCGRBAhmYQPYnUHiMgoECALOsNDOyCrlXAAAAAElFTkSuQmCC" |
|||
}, "24ab": function (e, t, n) { |
|||
}, 4360: function (e, t, n) { |
|||
"use strict"; |
|||
var r = n("2b0e"), o = n("2f62"), a = n("a27e"); |
|||
r["default"].use(o["a"]), t["a"] = new o["a"].Store({ |
|||
state: { |
|||
permission: [], |
|||
uni_account_type: {}, |
|||
uni_account_type_sign: {}, |
|||
role: "", |
|||
accoutInfo: {}, |
|||
userInfo: {}, |
|||
extra_fileds: {}, |
|||
CONSTANT: {}, |
|||
COMMON: {}, |
|||
starMenu: {} |
|||
}, mutations: { |
|||
SET_PERMISSION: function (e, t) { |
|||
e.permission = t |
|||
}, SET_UNI_ACCOUNT_TYPE: function (e, t) { |
|||
e.uni_account_type = t |
|||
}, SET_UNI_ACCOUNT_TYPE_SIGN: function (e, t) { |
|||
e.uni_account_type_sign = t |
|||
}, SET_CONSTANT: function (e, t) { |
|||
e.CONSTANT = t |
|||
}, SET_COMMON: function (e, t) { |
|||
e.COMMON = t |
|||
}, SET_ACCOUNT_INFO: function (e, t) { |
|||
e.accoutInfo = t |
|||
}, SET_USER_INFO: function (e, t) { |
|||
e.userInfo = t |
|||
}, SET_EXTRA_FILEDS: function (e, t) { |
|||
e.extra_fileds = t |
|||
}, SET_STAR_MENU_LIST: function (e, t) { |
|||
e.starMenu = t |
|||
} |
|||
}, actions: { |
|||
getCommon: function (e) { |
|||
var t = e.commit; |
|||
return a["a"].get("index.php?c=account&a=common-info").then(function (e) { |
|||
t("SET_PERMISSION", e.permission), t("SET_UNI_ACCOUNT_TYPE", e.uni_account_type), t("SET_UNI_ACCOUNT_TYPE_SIGN", e.uni_account_type_sign), t("SET_CONSTANT", e.defined_constants), delete e.permission, delete e.uni_account_type, delete e.uni_account_type_sign, delete e.defined_constants, t("SET_COMMON", e) |
|||
}) |
|||
}, getAccountInfo: function (e, t) { |
|||
var n = e.commit, r = e.state; |
|||
return a["a"].get("index.php?c=account&a=post", {params: {uniacid: t}}).then(function (e) { |
|||
r.uni_account_type_sign && (e.type_text = r.uni_account_type_sign[e.type_sign] ? r.uni_account_type_sign[e.type_sign]["title"] : "", e.type_class = r.uni_account_type_sign[e.type_sign] ? r.uni_account_type_sign[e.type_sign]["icon"] : ""), n("SET_ACCOUNT_INFO", e) |
|||
}) |
|||
}, getUserInfo: function (e, t) { |
|||
var n = e.commit; |
|||
return a["a"].get("/index.php?c=user&a=edit&uid=" + t).then(function (e) { |
|||
n("SET_USER_INFO", Object.assign(e.user, e.profile)), n("SET_EXTRA_FILEDS", e.extra_fileds) |
|||
}) |
|||
}, getStarMenu: function (e) { |
|||
var t = e.commit; |
|||
return a["a"].get("/home.php?getmenu=1").then(function (e) { |
|||
return t("SET_STAR_MENU_LIST", e), e |
|||
}) |
|||
} |
|||
} |
|||
}) |
|||
}, "6c37": function (e, t) { |
|||
e.exports = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADwAAAA8BAMAAADI0sRBAAAAIVBMVEXm5ub////7+/vv7+/p6en29vb4+Pjy8vLr6+vs7Ozx8fE6upbrAAAAsElEQVQ4y+3QzQqCUBCG4alO9LNqjhS1S4jWFrQXr6AIcltdQUQXYNtWdcfpGZED+im6FN/tAx/DUFebm971GevEZeYN5B3HaR+oYtMa8FDYAdwT1oB/LMHLJL8Rv8vH+6JzwCPhFYFcw0fEQaILQqlTzA/Cfgg9wn0u2zCCujcv9/Blxr+FOuA0B75cKpofc9YSfVzSaBuv3yy+5pmtZhVcezywLo/yrJ6Zvqirpf0B2jobVf8Ek0cAAAAASUVORK5CYII=" |
|||
}, "8d29": function (e, t) { |
|||
e.exports = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADwAAAA8BAMAAADI0sRBAAAAJ1BMVEX3+PrMzMzy8/XQ0NDd3d7Y2Nnw8fLi4uPq6+zm5+jl5efU1NTS0tPPbE0FAAAA3klEQVQ4y+3TPQ6CQBCG4YlR/InNJxoLLTTRA1AZrdQTiAU1DT3EC3AACxIvYMIJvIF2HkvUQWBgaSnkLffZ7M4WS3VV51hlugD2am0bgO6qtBtp5EGxajd8mthF2tiBG84K+IRfq7xekGottYVMB+leWsdS9zwZz7YQrLuaCW5ktw3B0INO/G6/a0AwrwK8TzCfCfAtgnkigGcUzO9xLPKgYmyIQqgZ9z7KeDD/MzazPBLceaR56pOoZySsXylXM+EtFeTErPjE5y8/SVH45g0p2w3mQ1KnHZc21VXbC7bOMldobTdrAAAAAElFTkSuQmCC" |
|||
}, a27e: function (e, t, n) { |
|||
"use strict"; |
|||
n("8e6e"), n("ac6a"), n("456d"); |
|||
var r = n("bd86"), o = n("7618"), a = n("bc3a"), c = n.n(a), i = n("4328"), u = n.n(i), s = n("5c96"), |
|||
f = n("4360"); |
|||
|
|||
function l(e, t) { |
|||
var n = Object.keys(e); |
|||
if (Object.getOwnPropertySymbols) { |
|||
var r = Object.getOwnPropertySymbols(e); |
|||
t && (r = r.filter(function (t) { |
|||
return Object.getOwnPropertyDescriptor(e, t).enumerable |
|||
})), n.push.apply(n, r) |
|||
} |
|||
return n |
|||
} |
|||
|
|||
function p(e) { |
|||
for (var t = 1; t < arguments.length; t++) { |
|||
var n = null != arguments[t] ? arguments[t] : {}; |
|||
t % 2 ? l(n, !0).forEach(function (t) { |
|||
Object(r["a"])(e, t, n[t]) |
|||
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(n)) : l(n).forEach(function (t) { |
|||
Object.defineProperty(e, t, Object.getOwnPropertyDescriptor(n, t)) |
|||
}) |
|||
} |
|||
return e |
|||
} |
|||
|
|||
var d = c.a.create({baseURL: "/web/", withCredentials: !0, headers: {"X-Requested-With": "XMLHttpRequest"}}); |
|||
d.interceptors.request.use(function (e) { |
|||
return window.we7Info && (e.baseURL = (window.we7Info.url || "") + "/web/"), e.transformRequest = [function (e) { |
|||
return "object" !== Object(o["a"])(e) || e instanceof FormData ? e : u.a.stringify(e) |
|||
}], e.params = p({}, e.params, { |
|||
token: f["a"].state.COMMON.submit_token, |
|||
access_token: window.we7Info && window.we7Info.access_token |
|||
}), e |
|||
}), d.interceptors.response.use(function (e) { |
|||
if (!e.data.message || e.data.message.errno) { |
|||
var t = e.data.message.errno; |
|||
return 403 == t ? window.location.reload() : 401 == t ? window.location.href = e.data.message.message ? e.data.message.message.login_url : "" : e.data.message && "string" === typeof e.data.message.message && !e.config.params.hideError && s["MessageBox"].alert(e.data.message.message, "系统提示", { |
|||
center: !0, |
|||
type: "warning", |
|||
dangerouslyUseHTMLString: !0 |
|||
}), Promise.reject(e.data.message) |
|||
} |
|||
return e.data.message.message |
|||
}, function (e) { |
|||
return Promise.reject(e.response) |
|||
}), t["a"] = d |
|||
}, adcf: function (e, t, n) { |
|||
}, ca87: function (e, t) { |
|||
e.exports = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGsAAABrCAMAAABHYYw+AAAAV1BMVEXg3t+ZmZni4eHf3t6Xl5eUk5Td29zW1dWlpaXOzc2vrq+op6eioqLZ2dm0s7Tk4+O+vL25uLnn5ebLysvR0NCgn5+sq6zHxcbEw8O3trbJyMjBwMDq6Ol/S+RoAAAGBUlEQVRo3uyW3ZKqMBCEk56ZBCEQFRF03/89DxP/VkpLNmidG9uIVSnho4fOEPPVV1999dX/F6UBIhjKOp/0CwPg5fnQ4TCKkC/nQMAcZwDVfolqvQTm1ADYNaELOnJVtgRyr2HAsROWBWIWuzavfYHgC7Fii6rIUlUVdqTZNtIM1lqYQ1+7XNWrSiyXhBmsRtgeARjkygeWqp5TxL1wcHCgvAUGMiiZw2sWAXvmKi2xzLUMg0bmsAC9qcLBOIMsljPKkmoOi0rhamSBbm1rvhz0Fhv+A0tPwMVomlXNJjbCRQZLp1I7JUf0cZaBagvg0yyA4PxxaD3h0zUkQ23ZWbah2eGzLELdWBFmFgkDnscSy1ipBbhG7FlsezztJkSLWErDIGz1o5LOP2IRok4vZtXVaOvqTDZP0khLnxcZxNYy24tYihp4VD9gIQsErGVE6FAxd7sHtgAYApbVkAiHE6u7sFZbTOIHUPSb5uhAKUxm/Ob4MvGHE0SPCbqDo+l2MtaliC1XACEpx9fped1qaCXUAE18mVWl5qU7eKRVQshZXwa+UtKVtdY6/SY5xD6co8phnaKT4wtwQG/lyuLgcV9DEzF06op1jIShjpFyMp8Oh5sr2xJNSug29vpEdUjVu4ictZz64cEKp4YYeg3ZhUUg2rqS5QpKSLZli4Yl6/0F9HuNfNH4eL+xAPxeMfcSCU1lOZMF44996x0me7MUnIn4bE4qn8HSWkaoiO58oa2ET+WbKLGy9xuGJihD+NGg80NnNo+lpJECwqjf/1ufFwNPLPHpJ/w180hpI9x0mqZYHxLqqf6cQ0qNgeD6ZuMTSWcV7rUDvpNFgDMAdqUVKQY60ZACKInzPlYKG/ym0wsLly3h9ApZFZIWkuW3seAQ6yHYS/uxzQ7RAUMhl5b0Pl+R2tLy7fUlYyPfpqzftJzlkMr3rz1z0XEbBKKod0aCAjYDBr/z/9/ZO6YPVX3FjVVV6t449oIXzt5hQjaT+O20SPCwbLjcyzI02tS3feGzmkUs3q2snmlYwvfTgqxd9/oakOc/MqCom31NHuHDpN/zbvfVVuWHGziOm1m/1DvrP2VpPepF1pPvy9D5+rqBFZ5kvY56qkbEZP7aejFxvIU1PxFDFnzyv4G1PVNRIoPC6GsCqrf8TAzJ+pddBUdPlTqZBveqrBj6LYvOeu2LklFN8RPfE5mXaczdMxHk9pv8os6June96zWRvtDkU5GDW7PtBJ+upB2f63mMn4XREm3RNVQrDzlLxERAEoTpcBDa3DqEmqQzREvBEC47kd69xGKmwYZjsENdjhQzmlvwsw/ezyFbGeIpr88VXsY5ChvykZrhS2JKb9Mc+uRDTksB20ApGMaFpE5pX/xayl580Bj4rJQIlsb74nLREEoqhnx5nFHTqs2YvRATDjsNj2XaUkp1DZgerJFojFmELsfQyDLFPkQXQww+diwjFDPAIx62H9Yprsm/7ceMqSX66ooLobrd0NVEJFMXhM/Na5lTJZMyHn3AKaWDbb/6FJ31SZRF3fZhy3nDM2Z7jWQ6MluY38K2BSLvxs6UfS+pX5dl35edbF8HytPbbLs0azbAscio5uVqzjNJtXbbTdyRgRUuReixButJILAOBHd3OfjNa9779JARLHAvijXpuxiCDzNS3VJLGJ9tGPQWWEupPqbF2hRO1oeM/N/iQNBFli5Yf5TidrcENzKsipuMskACywxrSTGbxxEEQQ/Z1mqXN3eZBZqyfDz1wZHaMiFJVZadB+ShC7Dtk+h6SZ2qwN0w/QFLB5iwOlWZHani3IFlxoeblEVs6543c3hCauDERMrSsVdRbKaYoS33VQwNcTZqKZUCqJ2Ch3SXmmaSZaqksm9/wsLJxGNd12U9ou10+zEjE7m05VTF+lJhuVZnUyIqTtoSHwMGXmcBJqMQ8ngwTKZ2giXr0BQh3ROb5KwwjgQxczeeAy+x2n93cmYIt6YIiIRuavr6V50NHKYTYh14lcVt0lbnZTboaQ094y6xSlmAfHnfNM1eY10XncfPIwNMM9Ma73rXP66POolgFItdoGEAAAAASUVORK5CYII=" |
|||
} |
|||
}); |
|||
|
After Width: | Height: | Size: 2.9 KiB |
|
After Width: | Height: | Size: 895 B |