Commit eabbb35971c63ee2befe8ac969e1753cfd0814fe

Authored by Jarrett Jordaan
1 parent 64ac6f46

Story Id:1166869 Daily Commit

Committed by: Jarrett Jordaan

Reviewed by: Paul Barrett
Showing 94 changed files with 13722 additions and 0 deletions
setup/migrate/batches/lucene_uninstall.bat 0 → 100644
  1 +sc delete KTLuceneTest
0 \ No newline at end of file 2 \ No newline at end of file
setup/migrate/batches/scheduler_uninstall.bat 0 → 100644
  1 +sc delete KTSchedulerTest
0 \ No newline at end of file 2 \ No newline at end of file
setup/migrate/config/config.xml 0 → 100644
  1 +<?xml version="1.0" encoding="UTF-8"?>
  2 +
  3 +<!--
  4 + Document : config.xml
  5 + Created on : 01 July 2009, 9:57 AM
  6 + Author : KnowledgeTree Team
  7 + Description: Migrateer steps
  8 +-->
  9 +
  10 +<migrate version="3.7" type="Commercial Edition">
  11 + <steps>
  12 + <step name="Welcome">welcome</step>
  13 + <step name="Current Installation" mode="silent">installation</step>
  14 + <step name="Deactivate Services" order="3" mode="silent">services</step>
  15 + <step name="Database Migration" order="1">database</step>
  16 + <step name="Complete">complete</step>
  17 + </steps>
  18 + </migrate>
0 \ No newline at end of file 19 \ No newline at end of file
setup/migrate/config/databases.xml 0 → 100644
  1 +<?xml version="1.0" encoding="UTF-8"?>
  2 +
  3 +<!--
  4 + Document : database.xml
  5 + Created on : 01 July 2009, 1:13 PM
  6 + Author : KnowledgeTree Team
  7 + Description: Migrateer Default MySql Database Configuration
  8 +-->
  9 +
  10 +<database>
  11 + <dtypes>
  12 + <dtype>mysql</dtype>
  13 + </dtypes>
  14 + <dhost>localhost</dhost>
  15 + <dport>3306</dport>
  16 + <dname>dms</dname>
  17 + <duname>root</duname>
  18 + <dmsadminuser>dmsadminuser</dmsadminuser>
  19 + <dmsaupass>js9281djw</dmsaupass>
  20 + <dmsuser>dmsuser</dmsuser>
  21 + <dmsupass>djw9281js</dmsupass>
  22 +</database>
setup/migrate/dbUtil.php 0 → 100644
  1 +<?php
  2 +/**
  3 +* Migrater Database Control.
  4 +*
  5 +* KnowledgeTree Community Edition
  6 +* Document Management Made Simple
  7 +* Copyright (C) 2008,2009 KnowledgeTree Inc.
  8 +* Portions copyright The Jam Warehouse Software (Pty) Limited
  9 +*
  10 +* This program is free software; you can redistribute it and/or modify it under
  11 +* the terms of the GNU General Public License version 3 as published by the
  12 +* Free Software Foundation.
  13 +*
  14 +* This program is distributed in the hope that it will be useful, but WITHOUT
  15 +* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  16 +* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
  17 +* details.
  18 +*
  19 +* You should have received a copy of the GNU General Public License
  20 +* along with this program. If not, see <http://www.gnu.org/licenses/>.
  21 +*
  22 +* You can contact KnowledgeTree Inc., PO Box 7775 #87847, San Francisco,
  23 +* California 94120-7775, or email info@knowledgetree.com.
  24 +*
  25 +* The interactive user interfaces in modified source and object code versions
  26 +* of this program must display Appropriate Legal Notices, as required under
  27 +* Section 5 of the GNU General Public License version 3.
  28 +*
  29 +* In accordance with Section 7(b) of the GNU General Public License version 3,
  30 +* these Appropriate Legal Notices must retain the display of the "Powered by
  31 +* KnowledgeTree" logo and retain the original copyright notice. If the display of the
  32 +* logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices
  33 +* must display the words "Powered by KnowledgeTree" and retain the original
  34 +* copyright notice.
  35 +*
  36 +* @copyright 2008-2009, KnowledgeTree Inc.
  37 +* @license GNU General Public License version 3
  38 +* @author KnowledgeTree Team
  39 +* @package Migrater
  40 +* @version Version 0.1
  41 +*/
  42 +class dbUtil {
  43 + /**
  44 + * Host
  45 + *
  46 + * @author KnowledgeTree Team
  47 + * @access protected
  48 + * @var string
  49 + */
  50 + protected $dbhost = '';
  51 +
  52 + /**
  53 + * Host
  54 + *
  55 + * @author KnowledgeTree Team
  56 + * @access protected
  57 + * @var string
  58 + */
  59 + protected $dbname = '';
  60 +
  61 + /**
  62 + * Host
  63 + *
  64 + * @author KnowledgeTree Team
  65 + * @access protected
  66 + * @var string
  67 + */
  68 + protected $dbuname = '';
  69 +
  70 + /**
  71 + * Host
  72 + *
  73 + * @author KnowledgeTree Team
  74 + * @access protected
  75 + * @var string
  76 + */
  77 + protected $dbpassword = '';
  78 +
  79 + /**
  80 + * Host
  81 + *
  82 + * @author KnowledgeTree Team
  83 + * @access protected
  84 + * @var object mysql connection
  85 + */
  86 + protected $dbconnection = '';
  87 +
  88 + /**
  89 + * Any errors encountered
  90 + *
  91 + * @author KnowledgeTree Team
  92 + * @access protected
  93 + * @var array
  94 + */
  95 + protected $error = array();
  96 +
  97 + /**
  98 + * Constructs database connection object
  99 + *
  100 + * @author KnowledgeTree Team
  101 + * @access public
  102 + */
  103 + public function __construct() {
  104 +
  105 + }
  106 +
  107 + public function load($dhost = 'localhost', $duname, $dpassword, $dbname) {
  108 + $this->dbhost = $dhost;
  109 + $this->dbuname = $duname;
  110 + $this->dbpassword = $dpassword;
  111 + $this->dbconnection = @mysql_connect($dhost, $duname, $dpassword);
  112 + if($dbname != '') {
  113 + $this->setDb($dbname);
  114 + $this->useDb($dbname);
  115 + }
  116 + if($this->dbconnection)
  117 + return $this->dbconnection;
  118 + else {
  119 + $this->error[] = @mysql_error($this->dbconnection);
  120 + return false;
  121 + }
  122 + }
  123 +
  124 + /**
  125 + * Choose a database to use
  126 + *
  127 + * @param string $dbname name of the database
  128 + * @access public
  129 + * @return boolean
  130 + */
  131 + public function useDb($dbname = '') {
  132 + if($dbname != '') {
  133 + $this->setDb($dbname);
  134 + }
  135 +
  136 + if(@mysql_select_db($this->dbname, $this->dbconnection))
  137 + return true;
  138 + else {
  139 + $this->error[] = @mysql_error($this->dbconnection);
  140 + return false;
  141 + }
  142 + }
  143 +
  144 + public function setDb($dbname) {
  145 + $this->dbname = $dbname;
  146 + }
  147 +
  148 + /**
  149 + * Query the database.
  150 + *
  151 + * @param $query the sql query.
  152 + * @access public
  153 + * @return object The result of the query.
  154 + */
  155 + public function query($query) {
  156 + $result = @mysql_query($query, $this->dbconnection);
  157 + if($result) {
  158 + return $result;
  159 + } else {
  160 + $this->error[] = @mysql_error($this->dbconnection);
  161 + return false;
  162 + }
  163 + }
  164 +
  165 + /**
  166 + * Do the same as query.
  167 + *
  168 + * @param $query the sql query.
  169 + * @access public
  170 + * @return boolean
  171 + */
  172 + public function execute($query) {
  173 + $result = @mysql_query($query, $this->dbconnection);
  174 + if($result) {
  175 + return true;
  176 + } else {
  177 + $this->error[] = @mysql_error($this->dbconnection);
  178 + return false;
  179 + }
  180 + }
  181 +
  182 + /**
  183 + * Convenience method for mysql_fetch_object().
  184 + *
  185 + * @param $result The resource returned by query().
  186 + * @access public
  187 + * @return object An object representing a data row.
  188 + */
  189 + public function fetchNextObject($result = NULL) {
  190 + if ($result == NULL || @mysql_num_rows($result) < 1)
  191 + return NULL;
  192 + else
  193 + return @mysql_fetch_object($result);
  194 + }
  195 +
  196 + /**
  197 + * Convenience method for mysql_fetch_assoc().
  198 + *
  199 + * @param $result The resource returned by query().
  200 + * @access public
  201 + * @return array Returns an associative array of strings.
  202 + */
  203 + public function fetchAssoc($result = NULL) {
  204 + $r = array();
  205 + if ($result == NULL || @mysql_num_rows($result) < 1)
  206 + return NULL;
  207 + else {
  208 + $row = @mysql_fetch_assoc($result);
  209 + while ($row) {
  210 + $r[] = $row;
  211 + }
  212 + return $r;
  213 + }
  214 + }
  215 +
  216 + /**
  217 + * Close the connection with the database server.
  218 + *
  219 + * @param none.
  220 + * @access public
  221 + * @return void.
  222 + */
  223 + public function close() {
  224 + @mysql_close($this->dbconnection);
  225 + }
  226 +
  227 + /**
  228 + * Get database errors.
  229 + *
  230 + * @param none.
  231 + * @access public
  232 + * @return array.
  233 + */
  234 + public function getErrors() {
  235 + return $this->error;
  236 + }
  237 +
  238 + /**
  239 + * Fetches the last generated error
  240 +
  241 + * @return string
  242 + */
  243 + function getLastError() {
  244 + return end($this->error);
  245 + }
  246 +
  247 + /**
  248 + * Start a database transaction
  249 + */
  250 + public function startTransaction() {
  251 + $this->query("START TRANSACTION");
  252 + }
  253 +
  254 + /**
  255 + * Roll back a database transaction
  256 + */
  257 + public function rollback() {
  258 + $this->query("ROLLBACK");
  259 + }
  260 +}
  261 +?>
0 \ No newline at end of file 262 \ No newline at end of file
setup/migrate/index.php 0 → 100644
  1 +<?php
  2 +/**
  3 +* Migrater Index.
  4 +*
  5 +* KnowledgeTree Community Edition
  6 +* Document Management Made Simple
  7 +* Copyright (C) 2008,2009 KnowledgeTree Inc.
  8 +* Portions copyright The Jam Warehouse Software (Pty) Limited
  9 +*
  10 +* This program is free software; you can redistribute it and/or modify it under
  11 +* the terms of the GNU General Public License version 3 as published by the
  12 +* Free Software Foundation.
  13 +*
  14 +* This program is distributed in the hope that it will be useful, but WITHOUT
  15 +* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  16 +* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
  17 +* details.
  18 +*
  19 +* You should have received a copy of the GNU General Public License
  20 +* along with this program. If not, see <http://www.gnu.org/licenses/>.
  21 +*
  22 +* You can contact KnowledgeTree Inc., PO Box 7775 #87847, San Francisco,
  23 +* California 94120-7775, or email info@knowledgetree.com.
  24 +*
  25 +* The interactive user interfaces in modified source and object code versions
  26 +* of this program must display Appropriate Legal Notices, as required under
  27 +* Section 5 of the GNU General Public License version 3.
  28 +*
  29 +* In accordance with Section 7(b) of the GNU General Public License version 3,
  30 +* these Appropriate Legal Notices must retain the display of the "Powered by
  31 +* KnowledgeTree" logo and retain the original copyright notice. If the display of the
  32 +* logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices
  33 +* must display the words "Powered by KnowledgeTree" and retain the original
  34 +* copyright notice.
  35 +*
  36 +* @copyright 2008-2009, KnowledgeTree Inc.
  37 +* @license GNU General Public License version 3
  38 +* @author KnowledgeTree Team
  39 +* @package Migrater
  40 +* @version Version 0.1
  41 +*/
  42 +require_once("migrateWizard.php");
  43 +?>
0 \ No newline at end of file 44 \ No newline at end of file
setup/migrate/ini.php 0 → 100644
  1 +<?php
  2 +/**
  3 + * $Id:$
  4 + *
  5 + * KnowledgeTree Community Edition
  6 + * Document Management Made Simple
  7 + * Copyright (C) 2008, 2009 KnowledgeTree Inc.
  8 + * Portions copyright The Jam Warehouse Software (Pty) Limited
  9 + *
  10 + * This program is free software; you can redistribute it and/or modify it under
  11 + * the terms of the GNU General Public License version 3 as published by the
  12 + * Free Software Foundation.
  13 + *
  14 + * This program is distributed in the hope that it will be useful, but WITHOUT
  15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  16 + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
  17 + * details.
  18 + *
  19 + * You should have received a copy of the GNU General Public License
  20 + * along with this program. If not, see <http://www.gnu.org/licenses/>.
  21 + *
  22 + * You can contact KnowledgeTree Inc., PO Box 7775 #87847, San Francisco,
  23 + * California 94120-7775, or email info@knowledgetree.com.
  24 + *
  25 + * The interactive user interfaces in modified source and object code versions
  26 + * of this program must display Appropriate Legal Notices, as required under
  27 + * Section 5 of the GNU General Public License version 3.
  28 + *
  29 + * In accordance with Section 7(b) of the GNU General Public License version 3,
  30 + * these Appropriate Legal Notices must retain the display of the "Powered by
  31 + * KnowledgeTree" logo and retain the original copyright notice. If the display of the
  32 + * logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices
  33 + * must display the words "Powered by KnowledgeTree" and retain the original
  34 + * copyright notice.
  35 + * Contributor( s): ______________________________________
  36 + *
  37 + */
  38 +
  39 +class Ini {
  40 +
  41 + private $cleanArray = array();
  42 + private $iniFile = '';
  43 + private $lineNum = 0;
  44 + private $exists = '';
  45 +
  46 + function Ini($iniFile = '../../config.ini') {
  47 + $this->iniFile = $iniFile;
  48 + $this->backupIni($iniFile);
  49 + $this->read($iniFile);
  50 + }
  51 +
  52 + /**
  53 + * Create a backup with the date as an extension in the same location as the original config.ini
  54 + *
  55 + * @param string $iniFile
  56 + * @return boolean
  57 + */
  58 + function backupIni($iniFile)
  59 + {
  60 + $content = file_get_contents($iniFile);
  61 + if ($content === false)
  62 + {
  63 + return false;
  64 + }
  65 + $date = date('YmdHis');
  66 +
  67 + $backupFile = $iniFile . '.' .$date;
  68 + if (is_writeable($backupFile)) {
  69 + file_put_contents($backupFile, $content);
  70 + }
  71 + }
  72 +
  73 + function read($iniFile) {
  74 +
  75 + $iniArray = file($iniFile);
  76 + $section = '';
  77 + foreach($iniArray as $iniLine) {
  78 + $this->lineNum++;
  79 + $iniLine = trim($iniLine);
  80 + $firstChar = substr($iniLine, 0, 1);
  81 + if($firstChar == ';') {
  82 + if($section == ''){
  83 + $this->cleanArray['_comment_'.$this->lineNum]=$iniLine;
  84 + }else {
  85 + $this->cleanArray[$section]['_comment_'.$this->lineNum]=$iniLine;
  86 + }
  87 + continue;
  88 + }
  89 + if($iniLine == '') {
  90 + if($section == ''){
  91 + $this->cleanArray['_blankline_'.$this->lineNum]='';
  92 + }else {
  93 + $this->cleanArray[$section]['_blankline_'.$this->lineNum]='';
  94 + }
  95 + continue;
  96 + }
  97 +
  98 + if ($firstChar == '[' && substr($iniLine, -1, 1) == ']') {
  99 + $section = substr($iniLine, 1, -1);
  100 + $this->sections[] = $section;
  101 + } else {
  102 + $equalsPos = strpos($iniLine, '=');
  103 + if ($equalsPos > 0 && $equalsPos != sizeof($iniLine)) {
  104 + $key = trim(substr($iniLine, 0, $equalsPos));
  105 + $value = trim(substr($iniLine, $equalsPos+1));
  106 + if (substr($value, 1, 1) == '"' && substr( $value, -1, 1) == '"') {
  107 + $value = substr($value, 1, -1);
  108 + }
  109 + $this->cleanArray[$section][$key] = stripcslashes($value);
  110 + } else {
  111 + $this->cleanArray[$section][trim($iniLine)]='';
  112 + }
  113 + }
  114 + }
  115 + return $this->cleanArray;
  116 + }
  117 +
  118 + function write($iniFile = "") {
  119 +
  120 + if(empty($iniFile)) {
  121 + $iniFile = $this->iniFile;
  122 + }
  123 + if (!is_writeable($iniFile)) {
  124 + return;
  125 + }
  126 +
  127 + $fileHandle = fopen($iniFile, 'wb');
  128 + foreach ($this->cleanArray as $section => $items) {
  129 + if (substr($section, 0, strlen('_blankline_')) === '_blankline_' ) {
  130 + fwrite ($fileHandle, "\r\n");
  131 + continue;
  132 + }
  133 + if (substr($section, 0, strlen('_comment_')) === '_comment_' ) {
  134 + fwrite ($fileHandle, "$items\r\n");
  135 + continue;
  136 + }
  137 + fwrite ($fileHandle, "[".$section."]\r\n");
  138 + foreach ($items as $key => $value) {
  139 + if (substr($key, 0, strlen('_blankline_')) === '_blankline_' ) {
  140 + fwrite ($fileHandle, "\r\n");
  141 + continue;
  142 + }
  143 + if (substr($key, 0, strlen('_comment_')) === '_comment_' ) {
  144 + fwrite ($fileHandle, "$value\r\n");
  145 + continue;
  146 + }
  147 +
  148 + $value = addcslashes($value,'');
  149 + //fwrite ($fileHandle, $key.' = "'.$value."\"\r\n");
  150 + fwrite ($fileHandle, $key.' = '.$value."\r\n");
  151 + }
  152 + }
  153 + fclose($fileHandle);
  154 + }
  155 +
  156 + function itemExists($checkSection, $checkItem) {
  157 +
  158 + $this->exists = '';
  159 + foreach($this->cleanArray as $section => $items) {
  160 + if($section == $checkSection) {
  161 + $this->exists = 'section';
  162 + foreach ($items as $key => $value) {
  163 + if($key == $checkItem) {
  164 + return true;
  165 + }
  166 + }
  167 + }
  168 + }
  169 + return false;
  170 + }
  171 +
  172 + function addItem($addSection, $addItem, $value, $itemComment = '', $sectionComment = '') {
  173 +
  174 + if($this->itemExists($addSection, $addItem)) {
  175 + $this->delItem($addSection, $addItem);
  176 + }
  177 +
  178 + if($this->exists != 'section') {
  179 + $this->cleanArray['_blankline_'.$this->lineNum++]='';
  180 + if(!empty($sectionComment)) $this->cleanArray['_comment_'.$this->lineNum++] = '; '.$sectionComment;
  181 + }
  182 + if(!empty($itemComment)) {
  183 + $this->cleanArray[$addSection]['_comment_'.$this->lineNum++] = '; '.$itemComment;
  184 + }
  185 + $this->cleanArray[$addSection][$addItem] = stripcslashes($value);
  186 + return true;
  187 + }
  188 +
  189 + function updateItem($addSection, $addItem, $value) {
  190 +
  191 + $this->cleanArray[$addSection][$addItem] = stripcslashes($value);
  192 + return true;
  193 + }
  194 +
  195 + function delItem($delSection, $delItem) {
  196 +
  197 + if(!$this->itemExists($delSection, $delItem)) return false;
  198 +
  199 + unset($this->cleanArray[$delSection][$delItem]);
  200 + return true;
  201 + }
  202 +
  203 + function delSection($delSection) {
  204 +
  205 + unset($this->cleanArray[$delSection]);
  206 + return true;
  207 + }
  208 +
  209 +}
  210 +?>
setup/migrate/lib/helpers/phpinfo.php 0 → 100644
  1 +<?php echo phpinfo(); ?>
0 \ No newline at end of file 2 \ No newline at end of file
setup/migrate/lib/services/service.php 0 → 100644
  1 +<?php
  2 +/**
  3 +* Service Controller.
  4 +*
  5 +* KnowledgeTree Community Edition
  6 +* Document Management Made Simple
  7 +* Copyright(C) 2008,2009 KnowledgeTree Inc.
  8 +* Portions copyright The Jam Warehouse Software(Pty) Limited
  9 +*
  10 +* This program is free software; you can redistribute it and/or modify it under
  11 +* the terms of the GNU General Public License version 3 as published by the
  12 +* Free Software Foundation.
  13 +*
  14 +* This program is distributed in the hope that it will be useful, but WITHOUT
  15 +* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  16 +* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
  17 +* details.
  18 +*
  19 +* You should have received a copy of the GNU General Public License
  20 +* along with this program. If not, see <http://www.gnu.org/licenses/>.
  21 +*
  22 +* You can contact KnowledgeTree Inc., PO Box 7775 #87847, San Francisco,
  23 +* California 94120-7775, or email info@knowledgetree.com.
  24 +*
  25 +* The interactive user interfaces in modified source and object code versions
  26 +* of this program must display Appropriate Legal Notices, as required under
  27 +* Section 5 of the GNU General Public License version 3.
  28 +*
  29 +* In accordance with Section 7(b) of the GNU General Public License version 3,
  30 +* these Appropriate Legal Notices must retain the display of the "Powered by
  31 +* KnowledgeTree" logo and retain the original copyright notice. If the display of the
  32 +* logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices
  33 +* must display the words "Powered by KnowledgeTree" and retain the original
  34 +* copyright notice.
  35 +*
  36 +* @copyright 2008-2009, KnowledgeTree Inc.
  37 +* @license GNU General Public License version 3
  38 +* @author KnowledgeTree Team
  39 +* @package Migrateer
  40 +* @version Version 0.1
  41 +*/
  42 +
  43 +class Service {
  44 + public function __construct() {}
  45 +
  46 + public function load() {}
  47 +
  48 + public function start() {}
  49 +
  50 + public function stop() {}
  51 +
  52 + public function migrate() {}
  53 +
  54 + public function restart() {}
  55 +
  56 + public function unmigrate() {}
  57 +
  58 + public function status() {}
  59 +
  60 + public function pause() {}
  61 +
  62 + public function cont() {}
  63 +}
  64 +?>
0 \ No newline at end of file 65 \ No newline at end of file
setup/migrate/lib/services/unixAgent.php 0 → 100644
  1 +<?php
  2 +/**
  3 +* Unix Agent Service Controller.
  4 +*
  5 +* KnowledgeTree Community Edition
  6 +* Document Management Made Simple
  7 +* Copyright(C) 2008,2009 KnowledgeTree Inc.
  8 +* Portions copyright The Jam Warehouse Software(Pty) Limited
  9 +*
  10 +* This program is free software; you can redistribute it and/or modify it under
  11 +* the terms of the GNU General Public License version 3 as published by the
  12 +* Free Software Foundation.
  13 +*
  14 +* This program is distributed in the hope that it will be useful, but WITHOUT
  15 +* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  16 +* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
  17 +* details.
  18 +*
  19 +* You should have received a copy of the GNU General Public License
  20 +* along with this program. If not, see <http://www.gnu.org/licenses/>.
  21 +*
  22 +* You can contact KnowledgeTree Inc., PO Box 7775 #87847, San Francisco,
  23 +* California 94120-7775, or email info@knowledgetree.com.
  24 +*
  25 +* The interactive user interfaces in modified source and object code versions
  26 +* of this program must display Appropriate Legal Notices, as required under
  27 +* Section 5 of the GNU General Public License version 3.
  28 +*
  29 +* In accordance with Section 7(b) of the GNU General Public License version 3,
  30 +* these Appropriate Legal Notices must retain the display of the "Powered by
  31 +* KnowledgeTree" logo and retain the original copyright notice. If the display of the
  32 +* logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices
  33 +* must display the words "Powered by KnowledgeTree" and retain the original
  34 +* copyright notice.
  35 +*
  36 +* @copyright 2008-2009, KnowledgeTree Inc.
  37 +* @license GNU General Public License version 3
  38 +* @author KnowledgeTree Team
  39 +* @package Migrateer
  40 +* @version Version 0.1
  41 +*/
  42 +
  43 +class unixAgent extends unixService {
  44 +
  45 + public function __construct() {
  46 + $this->name = "KTAgentTest";
  47 + }
  48 +
  49 +
  50 +}
  51 +?>
0 \ No newline at end of file 52 \ No newline at end of file
setup/migrate/lib/services/unixLucene.php 0 → 100644
  1 +<?php
  2 +/**
  3 +* Unix Lucene Service Controller.
  4 +*
  5 +* KnowledgeTree Community Edition
  6 +* Document Management Made Simple
  7 +* Copyright(C) 2008,2009 KnowledgeTree Inc.
  8 +* Portions copyright The Jam Warehouse Software(Pty) Limited
  9 +*
  10 +* This program is free software; you can redistribute it and/or modify it under
  11 +* the terms of the GNU General Public License version 3 as published by the
  12 +* Free Software Foundation.
  13 +*
  14 +* This program is distributed in the hope that it will be useful, but WITHOUT
  15 +* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  16 +* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
  17 +* details.
  18 +*
  19 +* You should have received a copy of the GNU General Public License
  20 +* along with this program. If not, see <http://www.gnu.org/licenses/>.
  21 +*
  22 +* You can contact KnowledgeTree Inc., PO Box 7775 #87847, San Francisco,
  23 +* California 94120-7775, or email info@knowledgetree.com.
  24 +*
  25 +* The interactive user interfaces in modified source and object code versions
  26 +* of this program must display Appropriate Legal Notices, as required under
  27 +* Section 5 of the GNU General Public License version 3.
  28 +*
  29 +* In accordance with Section 7(b) of the GNU General Public License version 3,
  30 +* these Appropriate Legal Notices must retain the display of the "Powered by
  31 +* KnowledgeTree" logo and retain the original copyright notice. If the display of the
  32 +* logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices
  33 +* must display the words "Powered by KnowledgeTree" and retain the original
  34 +* copyright notice.
  35 +*
  36 +* @copyright 2008-2009, KnowledgeTree Inc.
  37 +* @license GNU General Public License version 3
  38 +* @author KnowledgeTree Team
  39 +* @package Migrateer
  40 +* @version Version 0.1
  41 +*/
  42 +
  43 +class unixLucene extends unixService {
  44 + public $util;
  45 + private $shutdownScript;
  46 + private $indexerDir;
  47 + private $lucenePidFile;
  48 + private $luceneDir;
  49 + private $luceneSource;
  50 + private $luceneSourceLoc;
  51 + private $javaXms;
  52 + private $javaXmx;
  53 +
  54 + public function __construct() {
  55 + $this->name = "KTLuceneTest";
  56 + $this->setLuceneSource("ktlucene.jar");
  57 + $this->util = new MigrateUtil();
  58 + }
  59 +
  60 + public function load() {
  61 + $this->setLuceneDir(SYSTEM_DIR."bin".DS."luceneserver".DS);
  62 + $this->setIndexerDir(SYSTEM_DIR."search2".DS."indexing".DS."bin".DS);
  63 + $this->setLucenePidFile("lucene_test.pid");
  64 + $this->setJavaXms(512);
  65 + $this->setJavaXmx(512);
  66 + $this->setLuceneSourceLoc("ktlucene.jar");
  67 + $this->setShutdownScript("shutdown.php");
  68 + }
  69 +
  70 + public function setIndexerDir($indexerDir) {
  71 + $this->indexerDir = $indexerDir;
  72 + }
  73 +
  74 + private function getIndexerDir() {
  75 + return $this->indexerDir;
  76 + }
  77 +
  78 + private function setShutdownScript($shutdownScript) {
  79 + $this->shutdownScript = $shutdownScript;
  80 + }
  81 +
  82 + public function getShutdownScript() {
  83 + return $this->shutdownScript;
  84 + }
  85 +
  86 + private function setLucenePidFile($lucenePidFile) {
  87 + $this->lucenePidFile = $lucenePidFile;
  88 + }
  89 +
  90 + private function getLucenePidFile() {
  91 + return $this->lucenePidFile;
  92 + }
  93 +
  94 + private function setLuceneDir($luceneDir) {
  95 + $this->luceneDir = $luceneDir;
  96 + }
  97 +
  98 + public function getLuceneDir() {
  99 + return $this->luceneDir;
  100 + }
  101 +
  102 + private function setJavaXms($javaXms) {
  103 + $this->javaXms = "-Xms$javaXms";
  104 + }
  105 +
  106 + public function getJavaXms() {
  107 + return $this->javaXms;
  108 + }
  109 +
  110 + private function setJavaXmx($javaXmx) {
  111 + $this->javaXmx = "-Xmx$javaXmx";
  112 + }
  113 +
  114 + public function getJavaXmx() {
  115 + return $this->javaXmx;
  116 + }
  117 +
  118 + private function setLuceneSource($luceneSource) {
  119 + $this->luceneSource = $luceneSource;
  120 + }
  121 +
  122 + public function getLuceneSource() {
  123 + return $this->luceneSource;
  124 + }
  125 +
  126 + private function setLuceneSourceLoc($luceneSourceLoc) {
  127 + $this->luceneSourceLoc = $this->getLuceneDir().$luceneSourceLoc;
  128 + }
  129 +
  130 + public function getLuceneSourceLoc() {
  131 + return $this->luceneSourceLoc;
  132 + }
  133 +
  134 + public function getJavaOptions() {
  135 + return " {$this->getJavaXmx()} {$this->getJavaXmx()} -jar ";
  136 + }
  137 +
  138 + public function stop() {
  139 + // TODO: Breaks things
  140 + $state = $this->status();
  141 + if($state != '') {
  142 + $cmd = "pkill -f ".$this->getLuceneSource();
  143 + $response = $this->util->pexec($cmd);
  144 + return $response;
  145 + }
  146 +
  147 + }
  148 +
  149 + public function migrate() {
  150 + $status = $this->status();
  151 + if($status == '') {
  152 + return $this->start();
  153 + } else {
  154 + return $status;
  155 + }
  156 + }
  157 +
  158 + public function status() {
  159 + $cmd = "ps ax | grep ".$this->getLuceneSource();
  160 + $response = $this->util->pexec($cmd);
  161 + if(is_array($response['out'])) {
  162 + if(count($response['out']) > 1) {
  163 + foreach ($response['out'] as $r) {
  164 + preg_match('/grep/', $r, $matches); // Ignore grep
  165 + if(!$matches) {
  166 + return 'STARTED';
  167 + }
  168 + }
  169 + } else {
  170 + return '';
  171 + }
  172 + }
  173 +
  174 + return '';
  175 + }
  176 +
  177 + public function unmigrate() {
  178 + $this->stop();
  179 + }
  180 +
  181 + public function start() {
  182 + $state = $this->status();
  183 + return ;
  184 + if($state != 'STARTED') {
  185 + $cmd = "cd ".$this->getLuceneDir()."; ";
  186 + $cmd .= "nohup java -jar ".$this->getLuceneSource()." > ".SYS_LOG_DIR."lucene.log 2>&1 & echo $!";
  187 + $response = $this->util->pexec($cmd);
  188 +
  189 + return $response;
  190 + } elseif ($state == '') {
  191 + // Start Service
  192 + return true;
  193 + } else {
  194 + // Service Running Already
  195 + return true;
  196 + }
  197 +
  198 + return false;
  199 + }
  200 +
  201 +
  202 +}
  203 +?>
0 \ No newline at end of file 204 \ No newline at end of file
setup/migrate/lib/services/unixOpenOffice.php 0 → 100644
  1 +<?php
  2 +/**
  3 +* Unix Agent Service Controller.
  4 +*
  5 +* KnowledgeTree Community Edition
  6 +* Document Management Made Simple
  7 +* Copyright(C) 2008,2009 KnowledgeTree Inc.
  8 +* Portions copyright The Jam Warehouse Software(Pty) Limited
  9 +*
  10 +* This program is free software; you can redistribute it and/or modify it under
  11 +* the terms of the GNU General Public License version 3 as published by the
  12 +* Free Software Foundation.
  13 +*
  14 +* This program is distributed in the hope that it will be useful, but WITHOUT
  15 +* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  16 +* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
  17 +* details.
  18 +*
  19 +* You should have received a copy of the GNU General Public License
  20 +* along with this program. If not, see <http://www.gnu.org/licenses/>.
  21 +*
  22 +* You can contact KnowledgeTree Inc., PO Box 7775 #87847, San Francisco,
  23 +* California 94120-7775, or email info@knowledgetree.com.
  24 +*
  25 +* The interactive user interfaces in modified source and object code versions
  26 +* of this program must display Appropriate Legal Notices, as required under
  27 +* Section 5 of the GNU General Public License version 3.
  28 +*
  29 +* In accordance with Section 7(b) of the GNU General Public License version 3,
  30 +* these Appropriate Legal Notices must retain the display of the "Powered by
  31 +* KnowledgeTree" logo and retain the original copyright notice. If the display of the
  32 +* logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices
  33 +* must display the words "Powered by KnowledgeTree" and retain the original
  34 +* copyright notice.
  35 +*
  36 +* @copyright 2008-2009, KnowledgeTree Inc.
  37 +* @license GNU General Public License version 3
  38 +* @author KnowledgeTree Team
  39 +* @package Migrateer
  40 +* @version Version 0.1
  41 +*/
  42 +
  43 +class unixOpenOffice extends unixService {
  44 +
  45 + // utility
  46 + public $util;
  47 + // path to office
  48 + private $path;
  49 + // host
  50 + private $host;
  51 + // pid running
  52 + private $pidFile;
  53 + // port to bind to
  54 + private $port;
  55 + // bin folder
  56 + private $bin;
  57 + // office executable
  58 + private $soffice;
  59 + // office log file
  60 + private $log;
  61 + private $options;
  62 +
  63 + # nohup /home/jarrett/ktdms/openoffice/program/soffice.bin -nofirststartwizard -nologo -headless -accept=socket,host=127.0.0.1,port=8100;urp;StarOffice.ServiceManager &> /home/jarrett/ktdms/var/log/dmsctl.log &
  64 + public function __construct() {
  65 + $this->name = "openoffice";
  66 + $this->util = new MigrateUtil();
  67 + }
  68 +
  69 + public function load() {
  70 + $this->setPort("8100");
  71 + $this->setHost("localhost");
  72 + $this->setLog("openoffice.log");
  73 + $this->setBin("soffice");
  74 + $this->setOption();
  75 + }
  76 +
  77 + private function setPort($port = "8100") {
  78 + $this->port = $port;
  79 + }
  80 +
  81 + public function getPort() {
  82 + return $this->port;
  83 + }
  84 +
  85 + private function setHost($host = "localhost") {
  86 + $this->host = $host;
  87 + }
  88 +
  89 + public function getHost() {
  90 + return $this->host;
  91 + }
  92 +
  93 + private function setLog($log = "openoffice.log") {
  94 + $this->log = $log;
  95 + }
  96 +
  97 + public function getLog() {
  98 + return $this->log;
  99 + }
  100 +
  101 + private function setBin($bin = "soffice") {
  102 + $this->bin = $bin;
  103 + }
  104 +
  105 + public function getBin() {
  106 + return $this->bin;
  107 + }
  108 +
  109 + private function setOption() {
  110 + $this->options = "-nofirststartwizard -nologo -headless -accept=\"socket,host={$this->getHost()},port={$this->getPort()};urp;StarOffice.ServiceManager\"";
  111 + }
  112 +
  113 + public function getOption() {
  114 + return $this->options;
  115 + }
  116 +
  117 + public function migrate() {
  118 + $status = $this->status();
  119 + if($status == '') {
  120 + return $this->start();
  121 + } else {
  122 + return $status;
  123 + }
  124 + }
  125 +
  126 + public function start() {
  127 + $state = $this->status();
  128 + return ;
  129 + if($state != 'STARTED') {
  130 + $cmd = "nohup {$this->getBin()} ".$this->getOption()." > ".SYS_LOG_DIR."{$this->getLog()} 2>&1 & echo $!";
  131 + $response = $this->util->pexec($cmd);
  132 +
  133 + return $response;
  134 + } elseif ($state == '') {
  135 + // Start Service
  136 + return true;
  137 + } else {
  138 + // Service Running Already
  139 + return true;
  140 + }
  141 +
  142 + return false;
  143 + }
  144 +}
  145 +?>
0 \ No newline at end of file 146 \ No newline at end of file
setup/migrate/lib/services/unixScheduler.php 0 → 100644
  1 +<?php
  2 +/**
  3 +* Unix Scheduler Service Controller.
  4 +*
  5 +* KnowledgeTree Community Edition
  6 +* Document Management Made Simple
  7 +* Copyright(C) 2008,2009 KnowledgeTree Inc.
  8 +* Portions copyright The Jam Warehouse Software(Pty) Limited
  9 +*
  10 +* This program is free software; you can redistribute it and/or modify it under
  11 +* the terms of the GNU General Public License version 3 as published by the
  12 +* Free Software Foundation.
  13 +*
  14 +* This program is distributed in the hope that it will be useful, but WITHOUT
  15 +* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  16 +* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
  17 +* details.
  18 +*
  19 +* You should have received a copy of the GNU General Public License
  20 +* along with this program. If not, see <http://www.gnu.org/licenses/>.
  21 +*
  22 +* You can contact KnowledgeTree Inc., PO Box 7775 #87847, San Francisco,
  23 +* California 94120-7775, or email info@knowledgetree.com.
  24 +*
  25 +* The interactive user interfaces in modified source and object code versions
  26 +* of this program must display Appropriate Legal Notices, as required under
  27 +* Section 5 of the GNU General Public License version 3.
  28 +*
  29 +* In accordance with Section 7(b) of the GNU General Public License version 3,
  30 +* these Appropriate Legal Notices must retain the display of the "Powered by
  31 +* KnowledgeTree" logo and retain the original copyright notice. If the display of the
  32 +* logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices
  33 +* must display the words "Powered by KnowledgeTree" and retain the original
  34 +* copyright notice.
  35 +*
  36 +* @copyright 2008-2009, KnowledgeTree Inc.
  37 +* @license GNU General Public License version 3
  38 +* @author KnowledgeTree Team
  39 +* @package Migrateer
  40 +* @version Version 0.1
  41 +*/
  42 +
  43 +class unixScheduler extends unixService {
  44 + private $schedulerDir;
  45 + private $schedulerSource;
  46 + private $schedulerSourceLoc;
  47 + private $systemDir;
  48 +
  49 + public function __construct() {
  50 + $this->name = "KTSchedulerTest";
  51 + $this->util = new MigrateUtil();
  52 + }
  53 +
  54 + public function load() {
  55 + $this->setSystemDir(SYSTEM_ROOT."bin".DS);
  56 + $this->setSchedulerDir(SYSTEM_DIR."bin".DS);
  57 + $this->setSchedulerSource('schedulerTask.sh');
  58 + $this->setSchedulerSourceLoc('schedulerTask.sh');
  59 + }
  60 +
  61 + function setSystemDir($systemDir) {
  62 + $this->systemDir = $systemDir;
  63 + }
  64 +
  65 + function getSystemDir() {
  66 + if(file_exists($this->systemDir))
  67 + return $this->systemDir;
  68 + return false;
  69 + }
  70 +
  71 + function setSchedulerDir($schedulerDir) {
  72 + $this->schedulerDir = $schedulerDir;
  73 + }
  74 +
  75 + function getSchedulerDir() {
  76 + return $this->schedulerDir;
  77 + }
  78 +
  79 + function setSchedulerSource($schedulerSource) {
  80 + $this->schedulerSource = $schedulerSource;
  81 + }
  82 +
  83 + function getSchedulerSource() {
  84 + return $this->schedulerSource;
  85 + }
  86 +
  87 + function setSchedulerSourceLoc($schedulerSourceLoc) {
  88 + $this->schedulerSourceLoc = $this->getSchedulerDir().$schedulerSourceLoc;
  89 + }
  90 +
  91 + function getSchedulerSourceLoc() {
  92 + if(file_exists($this->schedulerSourceLoc))
  93 + return $this->schedulerSourceLoc;
  94 + return false;
  95 + }
  96 +
  97 + function writeSchedulerTask() {
  98 + $fLoc = $this->getSchedulerDir().$this->getSchedulerSource();
  99 + $fp = @fopen($fLoc, "w+");
  100 + $content = "#!/bin/sh\n";
  101 + $content .= "cd ".$this->getSchedulerDir()."\n";
  102 + $content .= "while true; do\n";
  103 + // TODO : This will not work without CLI
  104 + $content .= "php -Cq scheduler.php\n";
  105 + $content .= "sleep 30\n";
  106 + $content .= "done";
  107 + @fwrite($fp, $content);
  108 + @fclose($fp);
  109 + @chmod($fLoc, '0644');
  110 + }
  111 +
  112 + function migrate() {
  113 + $status = $this->status();
  114 + if($status == '') {
  115 + return $this->start();
  116 + } else {
  117 + return $status;
  118 + }
  119 + }
  120 +
  121 + function unmigrate() {
  122 + $this->stop();
  123 + }
  124 +
  125 + function stop() {
  126 + $cmd = "pkill -f ".$this->schedulerSource;
  127 + $response = $this->util->pexec($cmd);
  128 + return $response;
  129 + }
  130 +
  131 + function status() {
  132 + $cmd = "ps ax | grep ".$this->getSchedulerSource();
  133 + $response = $this->util->pexec($cmd);
  134 + if(is_array($response['out'])) {
  135 + if(count($response['out']) > 1) {
  136 + foreach ($response['out'] as $r) {
  137 + preg_match('/grep/', $r, $matches); // Ignore grep
  138 + if(!$matches) {
  139 + return 'STARTED';
  140 + }
  141 + }
  142 + } else {
  143 + return '';
  144 + }
  145 + }
  146 +
  147 + return '';
  148 + }
  149 +
  150 + function start() {
  151 + // TODO : Write sh on the fly? Not sure the reasoning here
  152 + $source = $this->getSchedulerSourceLoc();
  153 + return ;
  154 + if($source) { // Source
  155 + $cmd = "nohup ".$source." > ".SYS_LOG_DIR."scheduler.log 2>&1 & echo $!";
  156 + $response = $this->util->pexec($cmd);
  157 + return $response;
  158 + } else { // Could be Stack
  159 + $source = SYS_BIN_DIR.$this->schedulerSource;
  160 + if(!file_exists($source)) {
  161 + // Write it
  162 + $this->writeSchedulerTask();
  163 + }
  164 + $cmd = "nohup ".$source." > ".SYS_LOG_DIR."scheduler.log 2>&1 & echo $!";
  165 + $response = $this->util->pexec($cmd);
  166 + return $response;
  167 + }
  168 +
  169 + return false;
  170 + }
  171 +
  172 +
  173 +
  174 +}
  175 +?>
0 \ No newline at end of file 176 \ No newline at end of file
setup/migrate/lib/services/unixService.php 0 → 100644
  1 +<?php
  2 +/**
  3 +* Unix Service Controller.
  4 +*
  5 +* KnowledgeTree Community Edition
  6 +* Document Management Made Simple
  7 +* Copyright(C) 2008,2009 KnowledgeTree Inc.
  8 +* Portions copyright The Jam Warehouse Software(Pty) Limited
  9 +*
  10 +* This program is free software; you can redistribute it and/or modify it under
  11 +* the terms of the GNU General Public License version 3 as published by the
  12 +* Free Software Foundation.
  13 +*
  14 +* This program is distributed in the hope that it will be useful, but WITHOUT
  15 +* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  16 +* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
  17 +* details.
  18 +*
  19 +* You should have received a copy of the GNU General Public License
  20 +* along with this program. If not, see <http://www.gnu.org/licenses/>.
  21 +*
  22 +* You can contact KnowledgeTree Inc., PO Box 7775 #87847, San Francisco,
  23 +* California 94120-7775, or email info@knowledgetree.com.
  24 +*
  25 +* The interactive user interfaces in modified source and object code versions
  26 +* of this program must display Appropriate Legal Notices, as required under
  27 +* Section 5 of the GNU General Public License version 3.
  28 +*
  29 +* In accordance with Section 7(b) of the GNU General Public License version 3,
  30 +* these Appropriate Legal Notices must retain the display of the "Powered by
  31 +* KnowledgeTree" logo and retain the original copyright notice. If the display of the
  32 +* logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices
  33 +* must display the words "Powered by KnowledgeTree" and retain the original
  34 +* copyright notice.
  35 +*
  36 +* @copyright 2008-2009, KnowledgeTree Inc.
  37 +* @license GNU General Public License version 3
  38 +* @author KnowledgeTree Team
  39 +* @package Migrateer
  40 +* @version Version 0.1
  41 +*/
  42 +
  43 +class unixService extends Service {
  44 + /**
  45 + * Retrieve Service name
  46 + *
  47 + * @author KnowledgeTree Team
  48 + * @access public
  49 + * @param none
  50 + * @return string
  51 + */
  52 + public function getName() {
  53 + return $this->name;
  54 + }
  55 +
  56 + public function load() {}
  57 +
  58 + /**
  59 + * Start Service
  60 + *
  61 + * @author KnowledgeTree Team
  62 + * @access public
  63 + * @param none
  64 + * @return mixed
  65 + */
  66 + public function start() {
  67 +
  68 + }
  69 +
  70 + /**
  71 + * Stop Service
  72 + *
  73 + * @author KnowledgeTree Team
  74 + * @access public
  75 + * @param none
  76 + * @return mixed
  77 + */
  78 + public function stop() {
  79 +
  80 + }
  81 +
  82 + public function migrate() {}
  83 +
  84 + /**
  85 + * Restart Service
  86 + *
  87 + * @author KnowledgeTree Team
  88 + * @access public
  89 + * @param none
  90 + * @return mixed
  91 + */
  92 + public function restart() {
  93 +
  94 + }
  95 +
  96 + /**
  97 + * Unmigrate Service
  98 + *
  99 + * @author KnowledgeTree Team
  100 + * @access public
  101 + * @param none
  102 + * @return mixed
  103 + */
  104 + public function unmigrate() {
  105 +
  106 + }
  107 +
  108 + /**
  109 + * Retrieve Status Service
  110 + *
  111 + * @author KnowledgeTree Team
  112 + * @access public
  113 + * @param none
  114 + * @return mixed
  115 + */
  116 + public function status() {
  117 +
  118 + }
  119 +
  120 + /**
  121 + * Pause Service
  122 + *
  123 + * @author KnowledgeTree Team
  124 + * @access public
  125 + * @param none
  126 + * @return mixed
  127 + */
  128 + public function pause() {
  129 +
  130 + }
  131 +
  132 + /**
  133 + * Continue Service
  134 + *
  135 + * @author KnowledgeTree Team
  136 + * @access public
  137 + * @param none
  138 + * @return mixed
  139 + */
  140 + public function cont() {
  141 +
  142 + }
  143 +
  144 +
  145 +}
  146 +?>
0 \ No newline at end of file 147 \ No newline at end of file
setup/migrate/lib/services/windowsAgent.php 0 → 100644
  1 +<?php
  2 +/**
  3 +* Windows Agent Service Controller.
  4 +*
  5 +* KnowledgeTree Community Edition
  6 +* Document Management Made Simple
  7 +* Copyright(C) 2008,2009 KnowledgeTree Inc.
  8 +* Portions copyright The Jam Warehouse Software(Pty) Limited
  9 +*
  10 +* This program is free software; you can redistribute it and/or modify it under
  11 +* the terms of the GNU General Public License version 3 as published by the
  12 +* Free Software Foundation.
  13 +*
  14 +* This program is distributed in the hope that it will be useful, but WITHOUT
  15 +* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  16 +* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
  17 +* details.
  18 +*
  19 +* You should have received a copy of the GNU General Public License
  20 +* along with this program. If not, see <http://www.gnu.org/licenses/>.
  21 +*
  22 +* You can contact KnowledgeTree Inc., PO Box 7775 #87847, San Francisco,
  23 +* California 94120-7775, or email info@knowledgetree.com.
  24 +*
  25 +* The interactive user interfaces in modified source and object code versions
  26 +* of this program must display Appropriate Legal Notices, as required under
  27 +* Section 5 of the GNU General Public License version 3.
  28 +*
  29 +* In accordance with Section 7(b) of the GNU General Public License version 3,
  30 +* these Appropriate Legal Notices must retain the display of the "Powered by
  31 +* KnowledgeTree" logo and retain the original copyright notice. If the display of the
  32 +* logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices
  33 +* must display the words "Powered by KnowledgeTree" and retain the original
  34 +* copyright notice.
  35 +*
  36 +* @copyright 2008-2009, KnowledgeTree Inc.
  37 +* @license GNU General Public License version 3
  38 +* @author KnowledgeTree Team
  39 +* @package Migrateer
  40 +* @version Version 0.1
  41 +*/
  42 +
  43 +class windowsAgent extends windowsService {
  44 +
  45 +
  46 + public function __construct() {
  47 + $this->name = "KTAgentTest";
  48 + }
  49 +
  50 +}
  51 +?>
0 \ No newline at end of file 52 \ No newline at end of file
setup/migrate/lib/services/windowsLucene.php 0 → 100644
  1 +<?php
  2 +/**
  3 +* Windows Lucene Service Controller.
  4 +*
  5 +* KnowledgeTree Community Edition
  6 +* Document Management Made Simple
  7 +* Copyright (C) 2008,2009 KnowledgeTree Inc.
  8 +* Portions copyright The Jam Warehouse Software (Pty) Limited
  9 +*
  10 +* This program is free software; you can redistribute it and/or modify it under
  11 +* the terms of the GNU General Public License version 3 as published by the
  12 +* Free Software Foundation.
  13 +*
  14 +* This program is distributed in the hope that it will be useful, but WITHOUT
  15 +* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  16 +* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
  17 +* details.
  18 +*
  19 +* You should have received a copy of the GNU General Public License
  20 +* along with this program. If not, see <http://www.gnu.org/licenses/>.
  21 +*
  22 +* You can contact KnowledgeTree Inc., PO Box 7775 #87847, San Francisco,
  23 +* California 94120-7775, or email info@knowledgetree.com.
  24 +*
  25 +* The interactive user interfaces in modified source and object code versions
  26 +* of this program must display Appropriate Legal Notices, as required under
  27 +* Section 5 of the GNU General Public License version 3.
  28 +*
  29 +* In accordance with Section 7(b) of the GNU General Public License version 3,
  30 +* these Appropriate Legal Notices must retain the display of the "Powered by
  31 +* KnowledgeTree" logo and retain the original copyright notice. If the display of the
  32 +* logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices
  33 +* must display the words "Powered by KnowledgeTree" and retain the original
  34 +* copyright notice.
  35 +*
  36 +* @copyright 2008-2009, KnowledgeTree Inc.
  37 +* @license GNU General Public License version 3
  38 +* @author KnowledgeTree Team
  39 +* @package Migrateer
  40 +* @version Version 0.1
  41 +*/
  42 +class windowsLucene extends windowsService {
  43 + /**
  44 + * Java Directory path
  45 + *
  46 + * @author KnowledgeTree Team
  47 + * @access private
  48 + * @var string
  49 + */
  50 + private $javaBin;
  51 +
  52 + /**
  53 + * Java JVM path
  54 + *
  55 + * @author KnowledgeTree Team
  56 + * @access private
  57 + * @var string
  58 + */
  59 + private $javaJVM;
  60 +
  61 + /**
  62 + * Java System object
  63 + *
  64 + * @author KnowledgeTree Team
  65 + * @access private
  66 + * @var object
  67 + */
  68 + private $javaSystem;
  69 +
  70 + /**
  71 + * Lucene executable path
  72 + *
  73 + * @author KnowledgeTree Team
  74 + * @access private
  75 + * @var string
  76 + */
  77 + private $luceneExe;
  78 +
  79 + /**
  80 + * Lucene jar path
  81 + *
  82 + * @author KnowledgeTree Team
  83 + * @access private
  84 + * @var string
  85 + */
  86 + private $luceneSource;
  87 +
  88 + /**
  89 + * Lucene package name
  90 + *
  91 + * @author KnowledgeTree Team
  92 + * @access private
  93 + * @var string
  94 + */
  95 + private $luceneServer;
  96 +
  97 + /**
  98 + * Lucene output log path
  99 + *
  100 + * @author KnowledgeTree Team
  101 + * @access private
  102 + * @var string
  103 + */
  104 + private $luceneOut;
  105 +
  106 + /**
  107 + * Lucene error log path
  108 + *
  109 + * @author KnowledgeTree Team
  110 + * @access private
  111 + * @var string
  112 + */
  113 + private $luceneError;
  114 +
  115 + /**
  116 + * Lucene directory path
  117 + *
  118 + * @author KnowledgeTree Team
  119 + * @access private
  120 + * @var string
  121 + */
  122 + private $luceneDir;
  123 +
  124 + /**
  125 + * Load defaults needed by service
  126 + *
  127 + * @author KnowledgeTree Team
  128 + * @access public
  129 + * @param string
  130 + * @return void
  131 + */
  132 + public function load() {
  133 + $this->name = "KTLuceneTest";
  134 + $this->javaSystem = new Java('java.lang.System');
  135 + $this->setJavaBin($this->javaSystem->getProperty('java.home').DS."bin");
  136 + $this->setLuceneDIR(SYSTEM_DIR."bin".DS."luceneserver");
  137 + $this->setLuceneExe("KTLuceneService.exe");
  138 + $this->setJavaJVM();
  139 + $this->setLuceneSource("ktlucene.jar");
  140 + $this->setLuceneServer("com.knowledgetree.lucene.KTLuceneServer");
  141 + $this->setLuceneOut("lucene-out.txt");
  142 + $this->setLuceneError("lucene-err.txt");
  143 + }
  144 +
  145 + /**
  146 + * Set Java Directory path
  147 + *
  148 + * @author KnowledgeTree Team
  149 + * @access private
  150 + * @param string
  151 + * @return void
  152 + */
  153 + private function setJavaBin($javaBin) {
  154 + $this->javaBin = $javaBin;
  155 + }
  156 +
  157 + /**
  158 + * Get Java Directory path
  159 + *
  160 + * @author KnowledgeTree Team
  161 + * @access public
  162 + * @param none
  163 + * @return string
  164 + */
  165 + public function getJavaBin() {
  166 + return $this->javaBin;
  167 + }
  168 +
  169 + /**
  170 + * Set Lucene directory path
  171 + *
  172 + * @author KnowledgeTree Team
  173 + * @access private
  174 + * @param string
  175 + * @return void
  176 + */
  177 + private function setLuceneDIR($luceneDir) {
  178 + $this->luceneDir = $luceneDir;
  179 + }
  180 +
  181 + /**
  182 + * Get Lucene directory path
  183 + *
  184 + * @author KnowledgeTree Team
  185 + * @access public
  186 + * @param none
  187 + * @return string
  188 + */
  189 + public function getluceneDir() {
  190 + if(file_exists($this->luceneDir))
  191 + return $this->luceneDir;
  192 + return false;
  193 + }
  194 +
  195 + /**
  196 + * Set Lucene executable path
  197 + *
  198 + * @author KnowledgeTree Team
  199 + * @access private
  200 + * @param string
  201 + * @return void
  202 + */
  203 + private function setLuceneExe($luceneExe) {
  204 + $this->luceneExe = $this->getluceneDir().DS.$luceneExe;
  205 + }
  206 +
  207 + /**
  208 + * Get Lucene executable path
  209 + *
  210 + * @author KnowledgeTree Team
  211 + * @access public
  212 + * @param string
  213 + * @return void
  214 + */
  215 + public function getLuceneExe() {
  216 + if(file_exists($this->luceneExe))
  217 + return $this->luceneExe;
  218 + return false;
  219 + }
  220 +
  221 + /**
  222 + * Set Lucene source path
  223 + *
  224 + * @author KnowledgeTree Team
  225 + * @access private
  226 + * @param string
  227 + * @return void
  228 + */
  229 + private function setLuceneSource($luceneSource) {
  230 + $this->luceneSource = $this->getluceneDir().DS.$luceneSource;
  231 + }
  232 +
  233 + /**
  234 + * Get Lucene source path
  235 + *
  236 + * @author KnowledgeTree Team
  237 + * @access public
  238 + * @param none
  239 + * @return string
  240 + */
  241 + public function getLuceneSource() {
  242 + if(file_exists($this->luceneSource))
  243 + return $this->luceneSource;
  244 + return false;
  245 + }
  246 +
  247 + /**
  248 + * Set Lucene package name
  249 + *
  250 + * @author KnowledgeTree Team
  251 + * @access private
  252 + * @param string
  253 + * @return void
  254 + */
  255 + private function setLuceneServer($luceneServer) {
  256 + $this->luceneServer = $luceneServer;
  257 + }
  258 +
  259 + /**
  260 + * Get Lucene package name
  261 + *
  262 + * @author KnowledgeTree Team
  263 + * @access public
  264 + * @param none
  265 + * @return string
  266 + */
  267 + public function getLuceneServer() {
  268 + return $this->luceneServer;
  269 + }
  270 +
  271 + /**
  272 + * Set Lucene output file path
  273 + *
  274 + * @author KnowledgeTree Team
  275 + * @access private
  276 + * @param string
  277 + * @return void
  278 + */
  279 + private function setLuceneOut($luceneOut) {
  280 + $this->luceneOut = SYS_LOG_DIR.$luceneOut;
  281 + }
  282 +
  283 + /**
  284 + * Get Lucene output file path
  285 + *
  286 + * @author KnowledgeTree Team
  287 + * @access public
  288 + * @param none
  289 + * @return string
  290 + */
  291 + public function getLuceneOut() {
  292 + return $this->luceneOut;
  293 + }
  294 +
  295 + /**
  296 + * Set Lucene error file path
  297 + *
  298 + * @author KnowledgeTree Team
  299 + * @access private
  300 + * @param string
  301 + * @return void
  302 + */
  303 + private function setLuceneError($luceneError) {
  304 + $this->luceneError = SYS_LOG_DIR.$luceneError;
  305 + }
  306 +
  307 + /**
  308 + * Get Lucene error file path
  309 + *
  310 + * @author KnowledgeTree Team
  311 + * @access public
  312 + * @param none
  313 + * @return string
  314 + */
  315 + public function getLuceneError() {
  316 + return $this->luceneError;
  317 + }
  318 +
  319 + /**
  320 + * Set Java JVM path
  321 + *
  322 + * @author KnowledgeTree Team
  323 + * @access private
  324 + * @param string
  325 + * @return void
  326 + */
  327 + private function setJavaJVM() {
  328 + if(file_exists($this->getJavaBin().DS."client".DS."jvm.dll")) {
  329 + $this->javaJVM = $this->getJavaBin().DS."client".DS."jvm.dll";
  330 + } elseif (file_exists($this->getJavaBin().DS."server".DS."jvm.dll")) {
  331 + $this->javaJVM = $this->getJavaBin().DS."server".DS."jvm.dll";
  332 + } else {
  333 + return false;
  334 + }
  335 + }
  336 +
  337 + /**
  338 + * Get Java JVM path
  339 + *
  340 + * @author KnowledgeTree Team
  341 + * @access public
  342 + * @param none
  343 + * @return string
  344 + */
  345 + public function getJavaJVM() {
  346 + return $this->javaJVM;
  347 + }
  348 +
  349 + /**
  350 + * Migrate Lucene Service
  351 + *
  352 + * @author KnowledgeTree Team
  353 + * @access public
  354 + * @param none
  355 + * @return array
  356 + */
  357 + function migrate() {
  358 + $state = $this->status();
  359 + if($state == '') {
  360 + $luceneExe = $this->getLuceneExe();
  361 + $luceneSource = $this->getLuceneSource();
  362 + $luceneDir = $this->getluceneDir();
  363 + if($luceneExe && $luceneSource && $luceneDir) {
  364 + $cmd = "\"{$luceneExe}\""." -migrate \"".$this->getName()."\" \"".$this->getJavaJVM(). "\" -Djava.class.path=\"".$luceneSource."\"". " -start ".$this->getLuceneServer(). " -out \"".$this->getLuceneOut()."\" -err \"".$this->getLuceneError()."\" -current \"".$luceneDir."\" -auto";
  365 + $response = $this->util->pexec($cmd);
  366 + return $response;
  367 + }
  368 + return $state;
  369 + }
  370 +
  371 + return $state;
  372 + }
  373 +
  374 +}
  375 +?>
0 \ No newline at end of file 376 \ No newline at end of file
setup/migrate/lib/services/windowsOpenOffice.php 0 → 100644
  1 +<?php
  2 +/**
  3 +* Windows Agent Service Controller.
  4 +*
  5 +* KnowledgeTree Community Edition
  6 +* Document Management Made Simple
  7 +* Copyright(C) 2008,2009 KnowledgeTree Inc.
  8 +* Portions copyright The Jam Warehouse Software(Pty) Limited
  9 +*
  10 +* This program is free software; you can redistribute it and/or modify it under
  11 +* the terms of the GNU General Public License version 3 as published by the
  12 +* Free Software Foundation.
  13 +*
  14 +* This program is distributed in the hope that it will be useful, but WITHOUT
  15 +* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  16 +* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
  17 +* details.
  18 +*
  19 +* You should have received a copy of the GNU General Public License
  20 +* along with this program. If not, see <http://www.gnu.org/licenses/>.
  21 +*
  22 +* You can contact KnowledgeTree Inc., PO Box 7775 #87847, San Francisco,
  23 +* California 94120-7775, or email info@knowledgetree.com.
  24 +*
  25 +* The interactive user interfaces in modified source and object code versions
  26 +* of this program must display Appropriate Legal Notices, as required under
  27 +* Section 5 of the GNU General Public License version 3.
  28 +*
  29 +* In accordance with Section 7(b) of the GNU General Public License version 3,
  30 +* these Appropriate Legal Notices must retain the display of the "Powered by
  31 +* KnowledgeTree" logo and retain the original copyright notice. If the display of the
  32 +* logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices
  33 +* must display the words "Powered by KnowledgeTree" and retain the original
  34 +* copyright notice.
  35 +*
  36 +* @copyright 2008-2009, KnowledgeTree Inc.
  37 +* @license GNU General Public License version 3
  38 +* @author KnowledgeTree Team
  39 +* @package Migrateer
  40 +* @version Version 0.1
  41 +*/
  42 +
  43 +class windowsOpenOffice extends windowsService {
  44 +
  45 + // utility
  46 + public $util;
  47 + // path to office
  48 + private $path;
  49 + // host
  50 + private $host;
  51 + // pid running
  52 + private $pidFile;
  53 + // port to bind to
  54 + private $port;
  55 + // bin folder
  56 + private $bin;
  57 + // office executable
  58 + private $soffice;
  59 + // office log file
  60 + private $log;
  61 + private $options;
  62 + private $winservice;
  63 +
  64 + public function __construct() {
  65 + $this->name = "openoffice";
  66 + $this->util = new MigrateUtil();
  67 + }
  68 +
  69 + public function load() {
  70 + // hack for testing
  71 + $this->setPort("8100");
  72 + $this->setHost("127.0.0.1");
  73 + $this->setLog("openoffice.log");
  74 + $this->setBin("C:\Program Files (x86)\OpenOffice.org 3\program\soffice.bin");
  75 + $this->setBin("C:\Program Files (x86)\ktdms\openoffice\program\soffice.bin");
  76 + $this->setBin("C:\Program Files (x86)\ktdms\openoffice.2.4\program\soffice.bin");
  77 + $this->setWinservice("winserv.exe");
  78 + $this->setOption();
  79 + }
  80 +
  81 + private function setPort($port = "8100") {
  82 + $this->port = $port;
  83 + }
  84 +
  85 + public function getPort() {
  86 + return $this->port;
  87 + }
  88 +
  89 + private function setHost($host = "127.0.0.1") {
  90 + $this->host = $host;
  91 + }
  92 +
  93 + public function getHost() {
  94 + return $this->host;
  95 + }
  96 +
  97 + private function setLog($log = "openoffice.log") {
  98 + $this->log = $log;
  99 + }
  100 +
  101 + public function getLog() {
  102 + return $this->log;
  103 + }
  104 +
  105 + private function setBin($bin = "soffice") {
  106 + $this->bin = $bin;
  107 + }
  108 +
  109 + public function getBin() {
  110 + return $this->bin;
  111 + }
  112 +
  113 + private function setWinservice($winservice = "winserv.exe") {
  114 + $this->winservice = SYS_BIN_DIR . $winservice;
  115 + }
  116 +
  117 + public function getWinservice() {
  118 + return $this->winservice;
  119 + }
  120 +
  121 + private function setOption() {
  122 + $this->options = "-displayname {$this->name} -start auto \"{$this->bin}\" -headless -invisible "
  123 + . "-accept=socket,host={$this->host},port={$this->port};urp;";
  124 + }
  125 +
  126 + public function getOption() {
  127 + return $this->options;
  128 + }
  129 +
  130 + public function migrate() {
  131 + $status = $this->status();
  132 +
  133 + if($status == '') {
  134 + $cmd = "\"{$this->winservice}\" migrate $this->name $this->options";
  135 + $response = $this->util->pexec($cmd);
  136 + return $response;
  137 + }
  138 + else {
  139 + return $status;
  140 + }
  141 + }
  142 +
  143 +// public function start() {
  144 +// $state = $this->status();
  145 +// if($state != 'STARTED') {
  146 +// $cmd = 'sc start ' . $this->name;
  147 +// $response = $this->util->pexec($cmd);
  148 +//
  149 +// return $response;
  150 +// } elseif ($state == '') {
  151 +// // Start Service
  152 +// return true;
  153 +// } else {
  154 +// // Service Running Already
  155 +// return true;
  156 +// }
  157 +//
  158 +// return false;
  159 +// }
  160 +
  161 +}
  162 +?>
0 \ No newline at end of file 163 \ No newline at end of file
setup/migrate/lib/services/windowsScheduler.php 0 → 100644
  1 +<?php
  2 +/**
  3 +* Windows Scheduler Service Controller.
  4 +*
  5 +* KnowledgeTree Community Edition
  6 +* Document Management Made Simple
  7 +* Copyright (C) 2008,2009 KnowledgeTree Inc.
  8 +* Portions copyright The Jam Warehouse Software (Pty) Limited
  9 +*
  10 +* This program is free software; you can redistribute it and/or modify it under
  11 +* the terms of the GNU General Public License version 3 as published by the
  12 +* Free Software Foundation.
  13 +*
  14 +* This program is distributed in the hope that it will be useful, but WITHOUT
  15 +* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  16 +* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
  17 +* details.
  18 +*
  19 +* You should have received a copy of the GNU General Public License
  20 +* along with this program. If not, see <http://www.gnu.org/licenses/>.
  21 +*
  22 +* You can contact KnowledgeTree Inc., PO Box 7775 #87847, San Francisco,
  23 +* California 94120-7775, or email info@knowledgetree.com.
  24 +*
  25 +* The interactive user interfaces in modified source and object code versions
  26 +* of this program must display Appropriate Legal Notices, as required under
  27 +* Section 5 of the GNU General Public License version 3.
  28 +*
  29 +* In accordance with Section 7(b) of the GNU General Public License version 3,
  30 +* these Appropriate Legal Notices must retain the display of the "Powered by
  31 +* KnowledgeTree" logo and retain the original copyright notice. If the display of the
  32 +* logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices
  33 +* must display the words "Powered by KnowledgeTree" and retain the original
  34 +* copyright notice.
  35 +*
  36 +* @copyright 2008-2009, KnowledgeTree Inc.
  37 +* @license GNU General Public License version 3
  38 +* @author KnowledgeTree Team
  39 +* @package Migrateer
  40 +* @version Version 0.1
  41 +*/
  42 +class windowsScheduler extends windowsService {
  43 + /**
  44 + * Batch Script to execute
  45 + *
  46 + * @author KnowledgeTree Team
  47 + * @access private
  48 + * @var string
  49 + */
  50 + private $schedulerScriptPath;
  51 +
  52 + /**
  53 + * Php Script to execute
  54 + *
  55 + * @author KnowledgeTree Team
  56 + * @access private
  57 + * @var string
  58 + */
  59 + private $schedulerSource;
  60 +
  61 + /**
  62 + * Scheduler Directory
  63 + *
  64 + * @author KnowledgeTree Team
  65 + * @access private
  66 + * @var string
  67 + */
  68 + private $schedulerDir;
  69 +
  70 + /**
  71 + * Load defaults needed by service
  72 + *
  73 + * @author KnowledgeTree Team
  74 + * @access public
  75 + * @param string
  76 + * @return void
  77 + */
  78 + function load() {
  79 + $this->name = "KTSchedulerTest";
  80 + $this->setSchedulerDIR(SYSTEM_DIR."bin".DS."win32");
  81 +// $this->setSchedulerScriptPath("taskrunner_test.bat");
  82 + $this->setSchedulerScriptPath("taskrunner.bat");
  83 + $this->setSchedulerSource("schedulerService.php");
  84 + }
  85 +
  86 + /**
  87 + * Set Batch Script path
  88 + *
  89 + * @author KnowledgeTree Team
  90 + * @access private
  91 + * @param string
  92 + * @return void
  93 + */
  94 + private function setSchedulerScriptPath($schedulerScriptPath) {
  95 + $this->schedulerScriptPath = "{$this->getSchedulerDir()}".DS."$schedulerScriptPath";
  96 + }
  97 +
  98 + /**
  99 + * Retrieve Batch Script path
  100 + *
  101 + * @author KnowledgeTree Team
  102 + * @access public
  103 + * @param none
  104 + * @return string
  105 + */
  106 + public function getSchedulerScriptPath() {
  107 + if(file_exists($this->schedulerScriptPath))
  108 + return $this->schedulerScriptPath;
  109 + return false;
  110 + }
  111 +
  112 + /**
  113 + * Set Scheduler Directory path
  114 + *
  115 + * @author KnowledgeTree Team
  116 + * @access private
  117 + * @param none
  118 + * @return string
  119 + */
  120 + private function setSchedulerDIR($schedulerDIR) {
  121 + $this->schedulerDir = $schedulerDIR;
  122 + }
  123 +
  124 + /**
  125 + * Retrieve Scheduler Directory path
  126 + *
  127 + * @author KnowledgeTree Team
  128 + * @access public
  129 + * @param none
  130 + * @return string
  131 + */
  132 + public function getSchedulerDir() {
  133 + if(file_exists($this->schedulerDir))
  134 + return $this->schedulerDir;
  135 + return false;
  136 + }
  137 +
  138 + /**
  139 + * Set Php Script path
  140 + *
  141 + * @author KnowledgeTree Team
  142 + * @access private
  143 + * @param none
  144 + * @return string
  145 + */
  146 + private function setSchedulerSource($schedulerSource) {
  147 + $this->schedulerSource = $this->getSchedulerDir().DS.$schedulerSource;
  148 + }
  149 +
  150 + /**
  151 + * Retrieve Php Script path
  152 + *
  153 + * @author KnowledgeTree Team
  154 + * @access public
  155 + * @param none
  156 + * @return string
  157 + */
  158 + public function getSchedulerSource() {
  159 + if(file_exists($this->schedulerSource))
  160 + return $this->schedulerSource;
  161 + return false;
  162 + }
  163 +
  164 + /**
  165 + * Migrate Scheduler Service
  166 + *
  167 + * @author KnowledgeTree Team
  168 + * @access public
  169 + * @param none
  170 + * @return array
  171 + */
  172 + public function migrate() {
  173 + $state = $this->status();
  174 + if($state == '') {
  175 + if(is_readable(SYS_BIN_DIR) && is_writable(SYS_BIN_DIR)) {
  176 + if(!file_exists($this->getSchedulerScriptPath())) {
  177 + $fp = fopen($this->getSchedulerScriptPath(), "w+");
  178 + $content = "@echo off\n";
  179 + $content .= "\"".PHP_DIR."php.exe\" "."\"{$this->getSchedulerSource()}\"";
  180 + fwrite($fp, $content);
  181 + fclose($fp);
  182 + }
  183 + }
  184 +
  185 + // TODO what if it does not exist? check how the dmsctl.bat does this
  186 + if (function_exists('win32_create_service'))
  187 + {
  188 + $response = win32_create_service(array(
  189 + 'service' => $this->name,
  190 + 'display' => $this->name,
  191 + 'path' => $this->getSchedulerScriptPath()
  192 + ));
  193 + return $response;
  194 + }
  195 + }
  196 + return $state;
  197 + }
  198 +}
  199 +?>
0 \ No newline at end of file 200 \ No newline at end of file
setup/migrate/lib/services/windowsService.php 0 → 100644
  1 +<?php
  2 +/**
  3 +* Service Controller.
  4 +*
  5 +* KnowledgeTree Community Edition
  6 +* Document Management Made Simple
  7 +* Copyright(C) 2008,2009 KnowledgeTree Inc.
  8 +* Portions copyright The Jam Warehouse Software(Pty) Limited
  9 +*
  10 +* This program is free software; you can redistribute it and/or modify it under
  11 +* the terms of the GNU General Public License version 3 as published by the
  12 +* Free Software Foundation.
  13 +*
  14 +* This program is distributed in the hope that it will be useful, but WITHOUT
  15 +* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  16 +* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
  17 +* details.
  18 +*
  19 +* You should have received a copy of the GNU General Public License
  20 +* along with this program. If not, see <http://www.gnu.org/licenses/>.
  21 +*
  22 +* You can contact KnowledgeTree Inc., PO Box 7775 #87847, San Francisco,
  23 +* California 94120-7775, or email info@knowledgetree.com.
  24 +*
  25 +* The interactive user interfaces in modified source and object code versions
  26 +* of this program must display Appropriate Legal Notices, as required under
  27 +* Section 5 of the GNU General Public License version 3.
  28 +*
  29 +* In accordance with Section 7(b) of the GNU General Public License version 3,
  30 +* these Appropriate Legal Notices must retain the display of the "Powered by
  31 +* KnowledgeTree" logo and retain the original copyright notice. If the display of the
  32 +* logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices
  33 +* must display the words "Powered by KnowledgeTree" and retain the original
  34 +* copyright notice.
  35 +*
  36 +* @copyright 2008-2009, KnowledgeTree Inc.
  37 +* @license GNU General Public License version 3
  38 +* @author KnowledgeTree Team
  39 +* @package Migrateer
  40 +* @version Version 0.1
  41 +*/
  42 +
  43 +class windowsService extends Service {
  44 + public $name;
  45 + public $util;
  46 +
  47 + public function __construct() {
  48 + $this->util = new MigrateUtil();
  49 + }
  50 +
  51 + /**
  52 + * Retrieve Service name
  53 + *
  54 + * @author KnowledgeTree Team
  55 + * @access public
  56 + * @param none
  57 + * @return string
  58 + */
  59 + public function getName() {
  60 + return $this->name;
  61 + }
  62 +
  63 + /**
  64 + * Start Service
  65 + *
  66 + * @author KnowledgeTree Team
  67 + * @access public
  68 + * @param none
  69 + * @return array
  70 + */
  71 + public function start() {
  72 + $status = $this->status();
  73 + if ($status != 'RUNNING') {
  74 + $cmd = "sc start {$this->name}";
  75 + $response = $this->util->pexec($cmd);
  76 + return $response;
  77 + }
  78 + return $status;
  79 + }
  80 +
  81 + /**
  82 + * Stop Service
  83 + *
  84 + * @author KnowledgeTree Team
  85 + * @access public
  86 + * @param none
  87 + * @return array
  88 + */
  89 + public function stop() {
  90 + $status = $this->status();
  91 + if ($status != 'STOPPED') {
  92 + $cmd = "sc stop {$this->name}";
  93 + $response = $this->util->pexec($cmd);
  94 + return $response;
  95 + }
  96 + return $status;
  97 + }
  98 +
  99 + public function migrate() {}
  100 +
  101 + /**
  102 + * Restart Service
  103 + *
  104 + * @author KnowledgeTree Team
  105 + * @access public
  106 + * @param none
  107 + * @return array
  108 + */
  109 + public function restart() {
  110 + $response = $this->stop();
  111 + sleep(10);
  112 + $this->start();
  113 + }
  114 +
  115 + /**
  116 + * Unmigrate Service
  117 + *
  118 + * @author KnowledgeTree Team
  119 + * @access public
  120 + * @param none
  121 + * @return array
  122 + */
  123 + public function unmigrate() {
  124 + $status = $this->status();
  125 + if ($status != '') {
  126 + $cmd = "sc delete {$this->name}";
  127 + $response = $this->util->pexec($cmd);
  128 + sleep(10);
  129 + return $response;
  130 + }
  131 + return $status;
  132 + }
  133 +
  134 + /**
  135 + * Retrieve Status Service
  136 + *
  137 + * @author KnowledgeTree Team
  138 + * @access public
  139 + * @param none
  140 + * @return string
  141 + */
  142 + public function status() {
  143 + $cmd = "sc query {$this->name}";
  144 + $response = $this->util->pexec($cmd);
  145 + if($response['out']) {
  146 + $state = preg_replace('/^STATE *\: *\d */', '', trim($response['out'][3])); // Status store in third key
  147 + return $state;
  148 + }
  149 +
  150 + return '';
  151 + }
  152 +
  153 + /**
  154 + * Pause Service
  155 + *
  156 + * @author KnowledgeTree Team
  157 + * @access public
  158 + * @param none
  159 + * @return array
  160 + */
  161 + public function pause() {
  162 + $cmd = "sc pause {$this->name}";
  163 + $response = $this->util->pexec($cmd);
  164 + return $response;
  165 + }
  166 +
  167 + /**
  168 + * Continue Service
  169 + *
  170 + * @author KnowledgeTree Team
  171 + * @access public
  172 + * @param none
  173 + * @return array
  174 + */
  175 + public function cont() {
  176 + $cmd = "sc continue {$this->name}";
  177 + $response = $this->util->pexec($cmd);
  178 + return $response;
  179 + }
  180 +}
  181 +?>
0 \ No newline at end of file 182 \ No newline at end of file
setup/migrate/migrate.php 0 → 100644
  1 +<?php
  2 +/**
  3 +* Migrater Controller.
  4 +*
  5 +* KnowledgeTree Community Edition
  6 +* Document Management Made Simple
  7 +* Copyright (C) 2008,2009 KnowledgeTree Inc.
  8 +* Portions copyright The Jam Warehouse Software (Pty) Limited
  9 +*
  10 +* This program is free software; you can redistribute it and/or modify it under
  11 +* the terms of the GNU General Public License version 3 as published by the
  12 +* Free Software Foundation.
  13 +*
  14 +* This program is distributed in the hope that it will be useful, but WITHOUT
  15 +* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  16 +* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
  17 +* details.
  18 +*
  19 +* You should have received a copy of the GNU General Public License
  20 +* along with this program. If not, see <http://www.gnu.org/licenses/>.
  21 +*
  22 +* You can contact KnowledgeTree Inc., PO Box 7775 #87847, San Francisco,
  23 +* California 94120-7775, or email info@knowledgetree.com.
  24 +*
  25 +* The interactive user interfaces in modified source and object code versions
  26 +* of this program must display Appropriate Legal Notices, as required under
  27 +* Section 5 of the GNU General Public License version 3.
  28 +*
  29 +* In accordance with Section 7(b) of the GNU General Public License version 3,
  30 +* these Appropriate Legal Notices must retain the display of the "Powered by
  31 +* KnowledgeTree" logo and retain the original copyright notice. If the display of the
  32 +* logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices
  33 +* must display the words "Powered by KnowledgeTree" and retain the original
  34 +* copyright notice.
  35 +*
  36 +* @copyright 2008-2009, KnowledgeTree Inc.
  37 +* @license GNU General Public License version 3
  38 +* @author KnowledgeTree Team
  39 +* @package Migrater
  40 +* @version Version 0.1
  41 +*/
  42 +
  43 +class Migrater {
  44 + /**
  45 + * Reference to simple xml object
  46 + *
  47 + * @author KnowledgeTree Team
  48 + * @access protected
  49 + * @var object SimpleXMLElement
  50 + */
  51 + protected $simpleXmlObj = null;
  52 +
  53 + /**
  54 + * Reference to step action object
  55 + *
  56 + * @author KnowledgeTree Team
  57 + * @access protected
  58 + * @var object StepAction
  59 + */
  60 + protected $stepAction = null;
  61 +
  62 + /**
  63 + * Reference to session object
  64 + *
  65 + * @author KnowledgeTree Team
  66 + * @access protected
  67 + * @var object Session
  68 + */
  69 + protected $session = null;
  70 +
  71 + /**
  72 + * List of migrateation steps as strings
  73 + *
  74 + * @author KnowledgeTree Team
  75 + * @access protected
  76 + * @var array string
  77 + */
  78 + protected $stepClassNames = array();
  79 +
  80 + /**
  81 + * List of migrateation steps as human readable strings
  82 + *
  83 + * @author KnowledgeTree Team
  84 + * @access protected
  85 + * @var array string
  86 + */
  87 + protected $stepNames = array();
  88 +
  89 + /**
  90 + * List of migrateation steps as human readable strings
  91 + *
  92 + * @author KnowledgeTree Team
  93 + * @access protected
  94 + * @var array string
  95 + */
  96 + protected $stepObjects = array();
  97 +
  98 + /**
  99 + * Order in which steps have to be migrateed
  100 + *
  101 + * @author KnowledgeTree Team
  102 + * @access protected
  103 + * @var array string
  104 + */
  105 + protected $migrateOrders = array();
  106 +
  107 + /**
  108 + * List of migrateation properties
  109 + *
  110 + * @author KnowledgeTree Team
  111 + * @access protected
  112 + * @var array string
  113 + */
  114 + protected $migrateProperties = array();
  115 +
  116 + /**
  117 + * Flag if a step object needs confirmation
  118 + *
  119 + * @author KnowledgeTree Team
  120 + * @access protected
  121 + * @var boolean
  122 + */
  123 + protected $stepConfirmation = false;
  124 +
  125 + /**
  126 + * Flag if a step object needs confirmation
  127 + *
  128 + * @author KnowledgeTree Team
  129 + * @access protected
  130 + * @var boolean
  131 + */
  132 + protected $stepDisplayFirst = false;
  133 +
  134 + private $migrateerAction = '';
  135 +
  136 + /**
  137 + * Constructs migrateation object
  138 + *
  139 + * @author KnowledgeTree Team
  140 + * @access public
  141 + * @param object Session $session Instance of the Session object
  142 + */
  143 + public function __construct($session = null) {
  144 + $this->session = $session;
  145 + }
  146 +
  147 + /**
  148 + * Read xml configuration file
  149 + *
  150 + * @author KnowledgeTree Team
  151 + * @param string $name of config file
  152 + * @access private
  153 + * @return object
  154 + */
  155 + private function _readXml($name = "config.xml") {
  156 + try {
  157 + $this->simpleXmlObj = simplexml_load_file(CONF_DIR.$name);
  158 + } catch (Exception $e) {
  159 + $iutil = new MigrateUtil();
  160 + $iutil->error("Error reading configuration file: $name");
  161 + exit();
  162 + }
  163 + }
  164 +
  165 + /**
  166 + * Checks if first step of migrateer
  167 + *
  168 + * @author KnowledgeTree Team
  169 + * @param none
  170 + * @access private
  171 + * @return boolean
  172 + */
  173 + private function _firstStep() {
  174 + if(isset($_GET['step_name'])) {
  175 + return false;
  176 + }
  177 +
  178 + return true;
  179 + }
  180 +
  181 + /**
  182 + * Checks if first step of migrateer
  183 + *
  184 + * @author KnowledgeTree Team
  185 + * @param none
  186 + * @access private
  187 + * @return boolean
  188 + */
  189 + private function _firstStepPeriod() {
  190 + if(isset($_GET['step_name'])) {
  191 + if($_GET['step_name'] != 'welcome')
  192 + return false;
  193 + }
  194 +
  195 + return true;
  196 + }
  197 +
  198 + /**
  199 + * Returns next step
  200 + *
  201 + * @author KnowledgeTree Team
  202 + * @param none
  203 + * @access private
  204 + * @return string
  205 + */
  206 + private function _getNextStep() {
  207 + return $this->_getStepName(1);
  208 + }
  209 +
  210 + /**
  211 + * Returns previous step
  212 + *
  213 + * @author KnowledgeTree Team
  214 + * @param none
  215 + * @access private
  216 + * @return string
  217 + */
  218 + private function _getPreviousStep() {
  219 + return $this->_getStepName(-1);
  220 + }
  221 +
  222 + /**
  223 + * Returns the step name, given a position
  224 + *
  225 + * @author KnowledgeTree Team
  226 + * @param integer $pos current position
  227 + * @access private
  228 + * @return string $name
  229 + */
  230 + private function _getStepName($pos = 0) {
  231 + if($this->_firstStep()) {
  232 + $step = (string) $this->simpleXmlObj->steps->step[0];
  233 + } else {
  234 + $pos += $this->getStepPosition();
  235 + $step = (string) $this->simpleXmlObj->steps->step[$pos];
  236 + }
  237 +
  238 + return $step;
  239 + }
  240 +
  241 + /**
  242 + * Executes next step
  243 + *
  244 + * @author KnowledgeTree Team
  245 + * @param none
  246 + * @access private
  247 + * @return string
  248 + */
  249 + private function _proceed() {
  250 + $step_name = $this->_getNextStep();
  251 +
  252 + return $this->_runStepAction($step_name);
  253 + }
  254 +
  255 + /**
  256 + * Executes previous step
  257 + *
  258 + * @author KnowledgeTree Team
  259 + * @param none
  260 + * @access private
  261 + * @return string
  262 + */
  263 + private function _backward() {
  264 + $step_name = $this->_getPreviousStep();
  265 +
  266 + return $this->_runStepAction($step_name);
  267 + }
  268 +
  269 + /**
  270 + * Executes step landing
  271 + *
  272 + * @author KnowledgeTree Team
  273 + * @param none
  274 + * @access private
  275 + * @return string
  276 + */
  277 + private function _landing() {
  278 + $step_name = $this->_getStepName();
  279 +
  280 + return $this->_runStepAction($step_name);
  281 + }
  282 +
  283 + /**
  284 + * Executes step based on step class name
  285 + *
  286 + * @author KnowledgeTree Team
  287 + * @param string $step_name
  288 + * @access private
  289 + * @return string
  290 + */
  291 + private function _runStepAction($stepName) {
  292 + $this->stepAction = new stepAction($stepName);
  293 + $this->stepAction->setUpStepAction($this->getSteps(), $this->getStepNames(), $this->getStepConfirmation(), $this->stepDisplayFirst(), $this->getSession(), $this->getMigrateProperties());
  294 +
  295 + return $this->stepAction->doAction();
  296 + }
  297 +
  298 + private function stepDisplayFirst() {
  299 + if($this->migrateerAction == 'edit')
  300 + return false; //
  301 + $class = $this->stepAction->createStep(); // Get step class
  302 + return $class->displayFirst(); // Check if class needs to display first
  303 + }
  304 +
  305 + /**
  306 + * Set steps class names in string format
  307 + *
  308 + * @author KnowledgeTree Team
  309 + * @param none
  310 + * @access private
  311 + * @return array
  312 + */
  313 + private function _getMigrateOrders() {
  314 + return $this->migrateOrders;
  315 + }
  316 +
  317 + /**
  318 + * Set steps as names
  319 + *
  320 + * @author KnowledgeTree Team
  321 + * @param none
  322 + * @access private
  323 + * @return void
  324 + */
  325 + private function _xmlStepsToArray() {
  326 + if(isset($this->simpleXmlObj)) {
  327 + foreach($this->simpleXmlObj->steps->step as $d_step) {
  328 + $step_name = (string) $d_step[0];
  329 + $this->stepClassNames[] = $step_name;
  330 + }
  331 + $this->_loadToSession('stepClassNames', $this->stepClassNames);
  332 + }
  333 + }
  334 +
  335 + /**
  336 + * Set steps as human readable strings
  337 + *
  338 + * @author KnowledgeTree Team
  339 + * @param none
  340 + * @access private
  341 + * @return void
  342 + */
  343 + private function _xmlStepsNames() {
  344 + if(isset($this->simpleXmlObj)) {
  345 + foreach($this->simpleXmlObj->steps->step as $d_step) {
  346 + $step_name = (string) $d_step[0];
  347 + $this->stepNames[$step_name] = (string) $d_step['name'];
  348 + }
  349 + $this->_loadToSession('stepNames', $this->stepNames);
  350 + }
  351 + }
  352 +
  353 + /**
  354 + * Set steps migrate order
  355 + *
  356 + * @author KnowledgeTree Team
  357 + * @param none
  358 + * @access private
  359 + * @return void
  360 + */
  361 + private function _xmlStepsOrders() {
  362 + if(isset($this->simpleXmlObj)) {
  363 + foreach($this->simpleXmlObj->steps->step as $d_step) {
  364 + if(isset($d_step['order'])) {
  365 + $step_name = (string) $d_step[0];
  366 + $order = (string) $d_step['order'];
  367 + $this->migrateOrders[$order] = $step_name; // Store step migrate order
  368 + }
  369 + }
  370 + $this->_loadToSession('migrateOrders', $this->migrateOrders);
  371 + }
  372 + }
  373 +
  374 + /**
  375 + * Set migrate properties
  376 + *
  377 + * @author KnowledgeTree Team
  378 + * @param none
  379 + * @access private
  380 + * @return void
  381 + */
  382 + private function _xmlMigrateProperties() {
  383 + if(isset($this->simpleXmlObj)) {
  384 + $this->migrateProperties['migrate_version'] = (string) $this->simpleXmlObj['version'];
  385 + $this->migrateProperties['migrate_type'] = (string) $this->simpleXmlObj['type'];
  386 + $this->_loadToSession('migrateProperties', $this->migrateProperties);
  387 + }
  388 + }
  389 +
  390 + /**
  391 + * Migrate steps
  392 + *
  393 + * @author KnowledgeTree Team
  394 + * @param none
  395 + * @access private
  396 + * @return void
  397 + */
  398 + private function _runStepsMigraters() {
  399 + $steps = $this->_getMigrateOrders();
  400 + for ($i=1; $i< count($steps)+1; $i++) {
  401 + $this->_migrateHelper($steps[$i]);
  402 + }
  403 +
  404 + $this->_completeMigrate();
  405 + }
  406 +
  407 + /**
  408 + * Complete migrate cleanup process
  409 + *
  410 + * @author KnowledgeTree Team
  411 + * @param none
  412 + * @access private
  413 + * @return void
  414 + */
  415 + private function _completeMigrate() {
  416 + @touch("migrate");
  417 + }
  418 +
  419 + /**
  420 + * Migrate steps helper
  421 + *
  422 + * @author KnowledgeTree Team
  423 + * @param none
  424 + * @access private
  425 + * @return void
  426 + */
  427 + private function _migrateHelper($className) {
  428 + $stepAction = new stepAction($className); // Instantiate a step action
  429 + $class = $stepAction->createStep(); // Get step class
  430 + if($class) { // Check if class Exists
  431 + if($class->runMigrate()) { // Check if step needs to be migrateed
  432 + $class->setDataFromSession($className); // Set Session Information
  433 + $class->setPostConfig(); // Set any posted variables
  434 + $response = $class->migrateStep(); // Run migrate step
  435 + // TODO : Break on error response
  436 + }
  437 + } else {
  438 + $iutil = new MigrateUtil();
  439 + $iutil->error("Class File Missing in Step Directory: $className");
  440 + exit();
  441 + }
  442 + }
  443 +
  444 + /**
  445 + * Reset all session information on welcome landing
  446 + *
  447 + * @author KnowledgeTree Team
  448 + * @param none
  449 + * @access private
  450 + * @return void
  451 + */
  452 + private function _resetSessions() {
  453 + if($this->session) {
  454 + if($this->_firstStepPeriod()) {
  455 + foreach ($this->getSteps() as $class) {
  456 + $this->session->un_setClass($class);
  457 + }
  458 + foreach ($this->getStepNames() as $class) {
  459 + $this->session->un_setClass($class);
  460 + }
  461 + foreach ($this->_getMigrateOrders() as $class) {
  462 + $this->session->un_setClass($class);
  463 + }
  464 + }
  465 + }
  466 + }
  467 +
  468 + function _loadFromSessions() {
  469 + $this->stepClassNames = $this->session->get('stepClassNames');
  470 + if(!$this->stepClassNames) {
  471 + $this->_xmlStepsToArray(); // String steps
  472 + }
  473 + $this->stepNames = $this->session->get('stepNames');
  474 + if(!$this->stepNames) {
  475 + $this->_xmlStepsNames();
  476 + }
  477 + $this->migrateOrders = $this->session->get('migrateOrders');
  478 + if(!$this->migrateOrders) {
  479 + $this->_xmlStepsOrders();
  480 + }
  481 + $this->migrateProperties = $this->session->get('migrateProperties');
  482 + if(!$this->migrateProperties) {
  483 + $this->_xmlMigrateProperties();
  484 + }
  485 + }
  486 +
  487 + private function loadNeeded() {
  488 + $this->_readXml(); // Xml steps
  489 + // Make sure session is cleared
  490 + $this->_resetSessions();
  491 + $this->_loadFromSessions();
  492 + if(isset($_POST['Next'])) {
  493 + $this->migrateerAction = 'next';
  494 + $this->response = 'next';
  495 + } elseif (isset($_POST['Previous'])) {
  496 + $this->migrateerAction = 'previous';
  497 + $this->response = 'previous';
  498 + } elseif (isset($_POST['Confirm'])) {
  499 + $this->migrateerAction = 'confirm';
  500 + $this->response = 'next';
  501 + } elseif (isset($_POST['Migrate'])) {
  502 + $this->migrateerAction = 'migrate';
  503 + $this->response = 'next';
  504 + } elseif (isset($_POST['Edit'])) {
  505 + $this->migrateerAction = 'edit';
  506 + $this->response = 'next';
  507 + } else {
  508 + $this->response = '';
  509 + $this->migrateerAction = '';
  510 + }
  511 + }
  512 +
  513 + /**
  514 + * Main control to handle the flow of migrate
  515 + *
  516 + * @author KnowledgeTree Team
  517 + * @param none
  518 + * @access public
  519 + * @return void
  520 + */
  521 + public function step() {
  522 + $this->loadNeeded();
  523 + switch($this->response) {
  524 + case 'next':
  525 + $step_name = $this->_getStepName();
  526 + $res = $this->_runStepAction($step_name);
  527 + if($res == 'next')
  528 + $this->_proceed(); // Load next window
  529 + elseif ($res == 'migrate') {
  530 + $this->_runStepsMigraters(); // Load landing
  531 + $this->_proceed(); // Load next window
  532 + } elseif ($res == 'confirm') {
  533 + if(!$this->stepDisplayFirst())
  534 + $this->stepConfirmation = true;
  535 + $this->_landing();
  536 + } elseif ($res == 'landing') {
  537 + $this->_landing();
  538 + } else {
  539 + }
  540 + break;
  541 + case 'previous':
  542 + $this->_backward(); // Load previous page
  543 + break;
  544 + default:
  545 + // TODO : handle silent
  546 + $this->_landing();
  547 + break;
  548 + }
  549 + $this->stepAction->paintAction(); // Display step
  550 + }
  551 +
  552 + /**
  553 + * Returns the step number
  554 + *
  555 + * @author KnowledgeTree Team
  556 + * @param none
  557 + * @access public
  558 + * @return integer $pos
  559 + */
  560 + public function getStepPosition() {
  561 + $pos = 0;
  562 + foreach($this->simpleXmlObj->steps->step as $d_step) {
  563 + $step = (string) $d_step;
  564 + if ($step == $_GET['step_name']) {
  565 + break;
  566 + }
  567 + $pos++;
  568 + }
  569 + if(isset($_GET['step'])) {
  570 + if($_GET['step'] == "next")
  571 + $pos = $pos+1;
  572 + else
  573 + $pos = $pos-1;
  574 + }
  575 +
  576 + return $pos;
  577 + }
  578 +
  579 + /**
  580 + * Returns the step names for classes
  581 + *
  582 + * @author KnowledgeTree Team
  583 + * @param none
  584 + * @access public
  585 + * @return array
  586 + */
  587 + public function getSteps() {
  588 + return $this->stepClassNames;
  589 + }
  590 +
  591 + /**
  592 + * Returns the steps as human readable string
  593 + *
  594 + * @author KnowledgeTree Team
  595 + * @param none
  596 + * @access public
  597 + * @return array
  598 + */
  599 + public function getStepNames() {
  600 + return $this->stepNames;
  601 + }
  602 +
  603 + /**
  604 + * Returns whether or not a confirmation step is needed
  605 + *
  606 + * @author KnowledgeTree Team
  607 + * @param none
  608 + * @access public
  609 + * @return boolean
  610 + */
  611 + public function getStepConfirmation() {
  612 + return $this->stepConfirmation;
  613 + }
  614 +
  615 + /**
  616 + * Return migrate properties
  617 + *
  618 + * @author KnowledgeTree Team
  619 + * @param string
  620 + * @access public
  621 + * @return string
  622 + */
  623 + public function getMigrateProperties() {
  624 + return $this->migrateProperties;
  625 + }
  626 +
  627 + /**
  628 + * Returns session
  629 + *
  630 + * @author KnowledgeTree Team
  631 + * @param none
  632 + * @access public
  633 + * @return boolean
  634 + */
  635 + public function getSession() {
  636 + return $this->session;
  637 + }
  638 +
  639 + /**
  640 + * Dump of SESSION
  641 + *
  642 + * @author KnowledgeTree Team
  643 + * @param none
  644 + * @access public
  645 + * @return array
  646 + */
  647 + public function showSession() {
  648 + echo '<pre>';
  649 + print_r($_SESSION);
  650 + echo '</pre>';
  651 + }
  652 +
  653 + /**
  654 + * Display errors that are not allowing the migrateer to operate
  655 + *
  656 + * @author KnowledgeTree Team
  657 + * @param none
  658 + * @access public
  659 + * @return void
  660 + */
  661 + public function resolveErrors($errors) {
  662 + echo $errors;
  663 + exit();
  664 + }
  665 +
  666 + private function _loadToSession($type, $values) {
  667 + if($values) {
  668 + $this->session->set($type , $values);
  669 + }
  670 + }
  671 +}
  672 +
  673 +?>
setup/migrate/migrateUtil.php 0 → 100644
  1 +<?php
  2 +/**
  3 +* Migrater Utilities Library
  4 +*
  5 +* KnowledgeTree Community Edition
  6 +* Document Management Made Simple
  7 +* Copyright(C) 2008,2009 KnowledgeTree Inc.
  8 +* Portions copyright The Jam Warehouse Software(Pty) Limited
  9 +*
  10 +* This program is free software; you can redistribute it and/or modify it under
  11 +* the terms of the GNU General Public License version 3 as published by the
  12 +* Free Software Foundation.
  13 +*
  14 +* This program is distributed in the hope that it will be useful, but WITHOUT
  15 +* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  16 +* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
  17 +* details.
  18 +*
  19 +* You should have received a copy of the GNU General Public License
  20 +* along with this program. If not, see <http://www.gnu.org/licenses/>.
  21 +*
  22 +* You can contact KnowledgeTree Inc., PO Box 7775 #87847, San Francisco,
  23 +* California 94120-7775, or email info@knowledgetree.com.
  24 +*
  25 +* The interactive user interfaces in modified source and object code versions
  26 +* of this program must display Appropriate Legal Notices, as required under
  27 +* Section 5 of the GNU General Public License version 3.
  28 +*
  29 +* In accordance with Section 7(b) of the GNU General Public License version 3,
  30 +* these Appropriate Legal Notices must retain the display of the "Powered by
  31 +* KnowledgeTree" logo and retain the original copyright notice. If the display of the
  32 +* logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices
  33 +* must display the words "Powered by KnowledgeTree" and retain the original
  34 +* copyright notice.
  35 +*
  36 +* @copyright 2008-2009, KnowledgeTree Inc.
  37 +* @license GNU General Public License version 3
  38 +* @author KnowledgeTree Team
  39 +* @package Migrater
  40 +* @version Version 0.1
  41 +*/
  42 +class MigrateUtil {
  43 + /**
  44 + * Constructs migrateation object
  45 + *
  46 + * @author KnowledgeTree Team
  47 + * @access public
  48 + */
  49 + public function __construct() {
  50 + }
  51 +
  52 + /**
  53 + * Check if system needs to be migrateed
  54 + *
  55 + * @author KnowledgeTree Team
  56 + * @access public
  57 + * @param none
  58 + * @return boolean
  59 + */
  60 + public function isSystemMigrateed() {
  61 + if (file_exists(dirname(__FILE__)."/migrate")) {
  62 +
  63 + return true;
  64 + }
  65 +
  66 + return false;
  67 + }
  68 +
  69 + public function error($error) {
  70 + $template_vars['error'] = $error;
  71 + $file = "templates/error.tpl";
  72 + if (!file_exists($file)) {
  73 + return false;
  74 + }
  75 + extract($template_vars); // Extract the vars to local namespace
  76 + ob_start();
  77 + include($file);
  78 + $contents = ob_get_contents();
  79 + ob_end_clean();
  80 + echo $contents;
  81 + }
  82 + /**
  83 + * Check if system needs to be migrateed
  84 + *
  85 + * @author KnowledgeTree Team
  86 + * @access public
  87 + * @param none
  88 + * @return mixed
  89 + */
  90 + public function checkStructurePermissions() {
  91 + // Check if Wizard Directory is writable
  92 + if(!$this->_checkPermission(WIZARD_DIR)) {
  93 + return 'wizard';
  94 + }
  95 +
  96 + return true;
  97 + }
  98 +
  99 + /**
  100 + * Redirect
  101 + *
  102 + * This function redirects the client. This is done by issuing
  103 + * a "Location" header and exiting if wanted. If you set $rfc2616 to true
  104 + * HTTP will output a hypertext note with the location of the redirect.
  105 + *
  106 + * @static
  107 + * @access public
  108 + * have already been sent.
  109 + * @param string $url URL where the redirect should go to.
  110 + * @param bool $exit Whether to exit immediately after redirection.
  111 + * @param bool $rfc2616 Wheter to output a hypertext note where we're
  112 + * redirecting to (Redirecting to <a href="...">...</a>.)
  113 + * @return mixed Returns true on succes (or exits) or false if headers
  114 + */
  115 + public function redirect($url, $exit = true, $rfc2616 = false)
  116 + {
  117 + if (headers_sent()) {
  118 + return false;
  119 + }
  120 +
  121 + $url = $this->absoluteURI($url);
  122 + header('Location: '. $url);
  123 +
  124 + if ( $rfc2616 && isset($_SERVER['REQUEST_METHOD']) &&
  125 + $_SERVER['REQUEST_METHOD'] != 'HEAD') {
  126 + printf('Redirecting to: <a href="%s">%s</a>.', $url, $url);
  127 + }
  128 + if ($exit) {
  129 + exit;
  130 + }
  131 + return true;
  132 + }
  133 +
  134 + /**
  135 + * Absolute URI
  136 + *
  137 + * This function returns the absolute URI for the partial URL passed.
  138 + * The current scheme (HTTP/HTTPS), host server, port, current script
  139 + * location are used if necessary to resolve any relative URLs.
  140 + *
  141 + * Offsets potentially created by PATH_INFO are taken care of to resolve
  142 + * relative URLs to the current script.
  143 + *
  144 + * You can choose a new protocol while resolving the URI. This is
  145 + * particularly useful when redirecting a web browser using relative URIs
  146 + * and to switch from HTTP to HTTPS, or vice-versa, at the same time.
  147 + *
  148 + * @author Philippe Jausions <Philippe.Jausions@11abacus.com>
  149 + * @static
  150 + * @access public
  151 + * @param string $url Absolute or relative URI the redirect should go to.
  152 + * @param string $protocol Protocol to use when redirecting URIs.
  153 + * @param integer $port A new port number.
  154 + * @return string The absolute URI.
  155 + */
  156 + public function absoluteURI($url = null, $protocol = null, $port = null)
  157 + {
  158 + // filter CR/LF
  159 + $url = str_replace(array("\r", "\n"), ' ', $url);
  160 +
  161 + // Mess around with already absolute URIs
  162 + if (preg_match('!^([a-z0-9]+)://!i', $url)) {
  163 + if (empty($protocol) && empty($port)) {
  164 + return $url;
  165 + }
  166 + if (!empty($protocol)) {
  167 + $url = $protocol .':'. end($array = explode(':', $url, 2));
  168 + }
  169 + if (!empty($port)) {
  170 + $url = preg_replace('!^(([a-z0-9]+)://[^/:]+)(:[\d]+)?!i',
  171 + '\1:'. $port, $url);
  172 + }
  173 + return $url;
  174 + }
  175 +
  176 + $host = 'localhost';
  177 + if (!empty($_SERVER['HTTP_HOST'])) {
  178 + list($host) = explode(':', $_SERVER['HTTP_HOST']);
  179 + } elseif (!empty($_SERVER['SERVER_NAME'])) {
  180 + list($host) = explode(':', $_SERVER['SERVER_NAME']);
  181 + }
  182 +
  183 + if (empty($protocol)) {
  184 + if (isset($_SERVER['HTTPS']) && !strcasecmp($_SERVER['HTTPS'], 'on')) {
  185 + $protocol = 'https';
  186 + } else {
  187 + $protocol = 'http';
  188 + }
  189 + if (!isset($port) || $port != intval($port)) {
  190 + $port = isset($_SERVER['SERVER_PORT']) ? $_SERVER['SERVER_PORT'] : 80;
  191 + }
  192 + }
  193 +
  194 + if ($protocol == 'http' && $port == 80) {
  195 + unset($port);
  196 + }
  197 + if ($protocol == 'https' && $port == 443) {
  198 + unset($port);
  199 + }
  200 +
  201 + $server = $protocol .'://'. $host . (isset($port) ? ':'. $port : '');
  202 +
  203 + if (!strlen($url)) {
  204 + $url = isset($_SERVER['REQUEST_URI']) ?
  205 + $_SERVER['REQUEST_URI'] : $_SERVER['PHP_SELF'];
  206 + }
  207 +
  208 + if ($url{0} == '/') {
  209 + return $server . $url;
  210 + }
  211 +
  212 + // Check for PATH_INFO
  213 + if (isset($_SERVER['PATH_INFO']) && strlen($_SERVER['PATH_INFO']) &&
  214 + $_SERVER['PHP_SELF'] != $_SERVER['PATH_INFO']) {
  215 + $path = dirname(substr($_SERVER['PHP_SELF'], 0, -strlen($_SERVER['PATH_INFO'])));
  216 + } else {
  217 + $path = dirname($_SERVER['PHP_SELF']);
  218 + }
  219 +
  220 + if (substr($path = strtr($path, '\\', '/'), -1) != '/') {
  221 + $path .= '/';
  222 + }
  223 +
  224 + return $server . $path . $url;
  225 + }
  226 +
  227 + /**
  228 + * Check whether a given directory / file path exists and is writable
  229 + *
  230 + * @author KnowledgeTree Team
  231 + * @access private
  232 + * @param string $dir The directory / file to check
  233 + * @param boolean $create Whether to create the directory if it doesn't exist
  234 + * @return array The message and css class to use
  235 + */
  236 + private function _checkPermission($dir)
  237 + {
  238 + if(is_readable($dir) && is_writable($dir)) {
  239 + return true;
  240 + } else {
  241 + return false;
  242 + }
  243 +
  244 + }
  245 +
  246 + /**
  247 + * Check whether a given directory / file path exists and is writable
  248 + *
  249 + * @author KnowledgeTree Team
  250 + * @access private
  251 + * @param string $dir The directory / file to check
  252 + * @param boolean $create Whether to create the directory if it doesn't exist
  253 + * @return array The message and css class to use
  254 + */
  255 + public function checkPermission($dir, $create=false)
  256 + {
  257 + $exist = 'Directory doesn\'t exist';
  258 + $write = 'Directory not writable';
  259 + $ret = array('class' => 'cross');
  260 +
  261 + if(!file_exists($dir)){
  262 + if($create === false){
  263 + $this->done = false;
  264 + $ret['msg'] = $exist;
  265 + return $ret;
  266 + }
  267 + $par_dir = dirname($dir);
  268 + if(!file_exists($par_dir)){
  269 + $this->done = false;
  270 + $ret['msg'] = $exist;
  271 + return $ret;
  272 + }
  273 + if(!is_writable($par_dir)){
  274 + $this->done = false;
  275 + $ret['msg'] = $exist;
  276 + return $ret;
  277 + }
  278 + mkdir($dir, '0755');
  279 + }
  280 +
  281 + if(is_writable($dir)){
  282 + $ret['class'] = 'tick';
  283 +
  284 + return $ret;
  285 + }
  286 +
  287 + $this->done = false;
  288 + $ret['msg'] = $write;
  289 + return $ret;
  290 + }
  291 +
  292 + /**
  293 + * Change permissions on a directory helper
  294 + *
  295 + * @author KnowledgeTree Team
  296 + * @access public
  297 + * @param string $folderPath The directory / file to check
  298 + * @return boolean
  299 + */
  300 + public function canChangePermissions($folderPath) {
  301 + return $this->_chmodRecursive($folderPath, 0755);
  302 + }
  303 +
  304 + /**
  305 + * Change permissions on a directory (recursive)
  306 + *
  307 + * @author KnowledgeTree Team
  308 + * @access private
  309 + * @param string $folderPath The directory / file to check
  310 + * @param boolean $create Whether to create the directory if it doesn't exist
  311 + * @return boolean
  312 + */
  313 + private function _chmodRecursive($path, $filemode) {
  314 + if (!is_dir($path))
  315 + return chmod($path, $filemode);
  316 + $dh = opendir($path);
  317 + while (($file = readdir($dh)) !== false) {
  318 + if($file != '.' && $file != '..') {
  319 + $fullpath = $path.'/'.$file;
  320 + if(is_link($fullpath))
  321 + return false;
  322 + elseif(!is_dir($fullpath)) {
  323 + $perms = substr(sprintf('%o', fileperms($fullpath)), -4);
  324 + if($perms != $filemode)
  325 + if (!chmod($fullpath, $filemode))
  326 + return false;
  327 + } elseif(!$this->chmodRecursive($fullpath, $filemode))
  328 + return false;
  329 + }
  330 + }
  331 + closedir($dh);
  332 + $perms = substr(sprintf('%o', fileperms($path)), -4);
  333 + if($perms != $filemode) {
  334 + if(chmod($path, $filemode))
  335 + return true;
  336 + else
  337 + return false;
  338 + } else {
  339 + return true;
  340 + }
  341 + }
  342 +
  343 + /**
  344 + * Check if a file can be written to a folder
  345 + *
  346 + * @author KnowledgeTree Team
  347 + * @access public
  348 + * @param string $filename the path to the file to create
  349 + * @return boolean
  350 + */
  351 + public function canWriteFile($filename) {
  352 + $fh = fopen($filename, "w+");
  353 + if($fr = fwrite($fh, 'test') === false) {
  354 + return false;
  355 + }
  356 +
  357 + fclose($fh);
  358 + return true;
  359 + }
  360 +
  361 + /**
  362 + * Attempt using the php-java bridge
  363 + *
  364 + * @author KnowledgeTree Team
  365 + * @access public
  366 + * @param none
  367 + * @return boolean
  368 + */
  369 + public function javaBridge() {
  370 + try {
  371 + $javaSystem = new Java('java.lang.System');
  372 + } catch (JavaException $e) {
  373 + return false;
  374 + }
  375 + return true;
  376 + }
  377 +
  378 + /**
  379 + * Attempt java detection
  380 + *
  381 + * @author KnowledgeTree Team
  382 + * @access public
  383 + * @param none
  384 + * @return boolean
  385 + */
  386 + public function tryJava1() {
  387 + $response = $this->pexec("java -version"); // Java Runtime Check
  388 + if(empty($response['out'])) {
  389 + return false;
  390 + }
  391 +
  392 + return 'java';
  393 + }
  394 +
  395 + /**
  396 + * Attempt java detection
  397 + *
  398 + * @author KnowledgeTree Team
  399 + * @access public
  400 + * @param none
  401 + * @return boolean
  402 + */
  403 + public function tryJava2() {
  404 + $response = $this->pexec("java"); // Java Runtime Check
  405 + if(empty($response['out'])) {
  406 + return false;
  407 + }
  408 +
  409 + return 'java';
  410 + }
  411 +
  412 + /**
  413 + * Attempt java detection
  414 + *
  415 + * @author KnowledgeTree Team
  416 + * @access public
  417 + * @param none
  418 + * @return boolean
  419 + */
  420 + public function tryJava3() {
  421 + $response = $this->pexec("whereis java"); // Java Runtime Check
  422 + if(empty($response['out'])) {
  423 + return false;
  424 + }
  425 + $broke = explode(' ', $response['out'][0]);
  426 + foreach ($broke as $r) {
  427 + $match = preg_match('/bin/', $r);
  428 + if($match) {
  429 + return preg_replace('/java:/', '', $r);
  430 + }
  431 + }
  432 + }
  433 +
  434 + /**
  435 + * Check if user entered location of JRE
  436 + *
  437 + * @author KnowledgeTree Team
  438 + * @param none
  439 + * @access private
  440 + * @return mixed
  441 + */
  442 + public function javaSpecified() {
  443 + if(isset($_POST['java'])) {
  444 + if($_POST['java'] != '') {
  445 + return $_POST['java'];
  446 + } else {
  447 + return false;
  448 + }
  449 + } else {
  450 + return false;
  451 + }
  452 + }
  453 +
  454 + /**
  455 + * Check if user entered location of PHP
  456 + *
  457 + * @author KnowledgeTree Team
  458 + * @param none
  459 + * @access private
  460 + * @return mixed
  461 + */
  462 + public function phpSpecified() {
  463 + if(isset($_POST['php'])) {
  464 + if($_POST['php'] != '') {
  465 + return $_POST['php'];
  466 + } else {
  467 + return false;
  468 + }
  469 + } else {
  470 + return false;
  471 + }
  472 + }
  473 +
  474 + /**
  475 + * Determine the location of JAVA_HOME
  476 + *
  477 + * @author KnowledgeTree Team
  478 + * @param none
  479 + * @access private
  480 + * @return mixed
  481 + */
  482 + function getJava() {
  483 + $response = $this->tryJava1();
  484 + if(!is_array($response)) {
  485 + $response = $this->tryJava2();
  486 + if(!is_array($response)) {
  487 + $response = $this->tryJava3();
  488 + }
  489 + }
  490 +// return false;
  491 + return $response;
  492 + }
  493 +
  494 + /**
  495 + * Determine the location of PHP
  496 + *
  497 + * @author KnowledgeTree Team
  498 + * @param none
  499 + * @access private
  500 + * @return mixed
  501 + */
  502 + function getPhp() {
  503 + $cmd = "whereis php";
  504 + $res = $this->getPhpHelper($cmd);
  505 + if($res != '') {
  506 + return $res;
  507 + }
  508 + $cmd = "which php";
  509 + return $this->getPhpHelper($cmd);
  510 + }
  511 +
  512 + function getPhpHelper($cmd) {
  513 + $response = $this->pexec($cmd);
  514 + if(is_array($response['out'])) {
  515 + if (isset($response['out'][0])) {
  516 + $broke = explode(' ', $response['out'][0]);
  517 + foreach ($broke as $r) {
  518 + $match = preg_match('/bin/', $r);
  519 + if($match) {
  520 + return preg_replace('/php:/', '', $r);
  521 + }
  522 + }
  523 + }
  524 + }
  525 +
  526 + return '';
  527 + }
  528 +
  529 + function getOpenOffice() {
  530 + $cmd = "whereis soffice";
  531 + $response = $this->pexec($cmd);
  532 + if(is_array($response['out'])) {
  533 + if (isset($response['out'][0])) {
  534 + $broke = explode(' ', $response['out'][0]);
  535 + foreach ($broke as $r) {
  536 + $match = preg_match('/bin/', $r);
  537 + if($match) {
  538 + return preg_replace('/soffice:/', '', $r);
  539 + }
  540 + }
  541 + }
  542 + }
  543 +
  544 + return '';
  545 + }
  546 + /**
  547 + * Portably execute a command on any of the supported platforms.
  548 + *
  549 + * @author KnowledgeTree Team
  550 + * @access public
  551 + * @param string $aCmd
  552 + * @param array $aOptions
  553 + * @return array
  554 + */
  555 + public function pexec($aCmd, $aOptions = null) {
  556 + if (is_array($aCmd)) {
  557 + $sCmd = $this->safeShellString($aCmd);
  558 + } else {
  559 + $sCmd = $aCmd;
  560 + }
  561 + $sAppend = $this->arrayGet($aOptions, 'append');
  562 + if ($sAppend) {
  563 + $sCmd .= " >> " . escapeshellarg($sAppend);
  564 + }
  565 + $sPopen = $this->arrayGet($aOptions, 'popen');
  566 + if ($sPopen) {
  567 + if (WINDOWS_OS) {
  568 + $sCmd = "start /b \"kt\" " . $sCmd;
  569 + }
  570 + return popen($sCmd, $sPopen);
  571 + }
  572 + // for exec, check return code and output...
  573 + $aRet = array();
  574 + $aOutput = array();
  575 + $iRet = '';
  576 + if(WINDOWS_OS) {
  577 + $sCmd = 'call '.$sCmd;
  578 + }
  579 +
  580 + exec($sCmd, $aOutput, $iRet);
  581 + $aRet['ret'] = $iRet;
  582 + $aRet['out'] = $aOutput;
  583 +
  584 + return $aRet;
  585 + }
  586 +
  587 + /**
  588 + *
  589 + *
  590 + * @author KnowledgeTree Team
  591 + * @access public
  592 + * @return string
  593 + */
  594 + public function arrayGet($aArray, $sKey, $mDefault = null, $bDefaultIfEmpty = true) {
  595 + if (!is_array($aArray)) {
  596 + $aArray = (array) $aArray;
  597 + }
  598 +
  599 + if ($aArray !== 0 && $aArray !== '0' && empty($aArray)) {
  600 + return $mDefault;
  601 + }
  602 + if (array_key_exists($sKey, $aArray)) {
  603 + $mVal =& $aArray[$sKey];
  604 + if (empty($mVal) && $bDefaultIfEmpty) {
  605 + return $mDefault;
  606 + }
  607 + return $mVal;
  608 + }
  609 + return $mDefault;
  610 + }
  611 +
  612 + /**
  613 + *
  614 + *
  615 + * @author KnowledgeTree Team
  616 + * @access public
  617 + * @return string
  618 + */
  619 + public function safeShellString () {
  620 + $aArgs = func_get_args();
  621 + $aSafeArgs = array();
  622 + if (is_array($aArgs[0])) {
  623 + $aArgs = $aArgs[0];
  624 + }
  625 + $aSafeArgs[] = escapeshellarg(array_shift($aArgs));
  626 + if (is_array($aArgs[0])) {
  627 + $aArgs = $aArgs;
  628 + }
  629 + foreach ($aArgs as $sArg) {
  630 + if (empty($sArg)) {
  631 + $aSafeArgs[] = "''";
  632 + } else {
  633 + $aSafeArgs[] = escapeshellarg($sArg);
  634 + }
  635 + }
  636 + return join(" ", $aSafeArgs);
  637 + }
  638 +
  639 +}
  640 +?>
0 \ No newline at end of file 641 \ No newline at end of file
setup/migrate/migrateWizard.php 0 → 100644
  1 +<?php
  2 +/**
  3 +* Migrater Index.
  4 +*
  5 +* KnowledgeTree Community Edition
  6 +* Document Management Made Simple
  7 +* Copyright (C) 2008,2009 KnowledgeTree Inc.
  8 +* Portions copyright The Jam Warehouse Software (Pty) Limited
  9 +*
  10 +* This program is free software; you can redistribute it and/or modify it under
  11 +* the terms of the GNU General Public License version 3 as published by the
  12 +* Free Software Foundation.
  13 +*
  14 +* This program is distributed in the hope that it will be useful, but WITHOUT
  15 +* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  16 +* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
  17 +* details.
  18 +*
  19 +* You should have received a copy of the GNU General Public License
  20 +* along with this program. If not, see <http://www.gnu.org/licenses/>.
  21 +*
  22 +* You can contact KnowledgeTree Inc., PO Box 7775 #87847, San Francisco,
  23 +* California 94120-7775, or email info@knowledgetree.com.
  24 +*
  25 +* The interactive user interfaces in modified source and object code versions
  26 +* of this program must display Appropriate Legal Notices, as required under
  27 +* Section 5 of the GNU General Public License version 3.
  28 +*
  29 +* In accordance with Section 7(b) of the GNU General Public License version 3,
  30 +* these Appropriate Legal Notices must retain the display of the "Powered by
  31 +* KnowledgeTree" logo and retain the original copyright notice. If the display of the
  32 +* logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices
  33 +* must display the words "Powered by KnowledgeTree" and retain the original
  34 +* copyright notice.
  35 +*
  36 +* @copyright 2008-2009, KnowledgeTree Inc.
  37 +* @license GNU General Public License version 3
  38 +* @author KnowledgeTree Team
  39 +* @package Migrater
  40 +* @version Version 0.1
  41 +*/
  42 +include("path.php"); // Paths
  43 +
  44 +/**
  45 + * Auto loader to bind migrateer package
  46 + *
  47 + * @param string $class
  48 + * @return void
  49 + */
  50 +function __autoload($class) { // Attempt and autoload classes
  51 + $class = strtolower(substr($class,0,1)).substr($class,1); // Linux Systems.
  52 + if(file_exists(WIZARD_DIR."$class.php")) {
  53 + require_once(WIZARD_DIR."$class.php");
  54 + } elseif (file_exists(STEP_DIR."$class.php")) {
  55 + require_once(STEP_DIR."$class.php");
  56 + } elseif (file_exists(WIZARD_LIB."$class.php")) {
  57 + require_once(WIZARD_LIB."$class.php");
  58 + } elseif (file_exists(SERVICE_LIB."$class.php")) {
  59 + require_once(SERVICE_LIB."$class.php");
  60 + } else {
  61 + return null;
  62 + }
  63 +}
  64 +
  65 +class MigrateWizard {
  66 + /**
  67 + * Migrate bypass flag
  68 + *
  69 + * @author KnowledgeTree Team
  70 + * @access protected
  71 + * @var mixed
  72 + */
  73 + protected $bypass = null;
  74 +
  75 + /**
  76 + * Reference to migrateer utility object
  77 + *
  78 + * @author KnowledgeTree Team
  79 + * @access protected
  80 + * @var boolean
  81 + */
  82 + protected $iutil = null;
  83 +
  84 + /**
  85 + * Constructs migrateation wizard object
  86 + *
  87 + * @author KnowledgeTree Team
  88 + * @access public
  89 + */
  90 + public function __construct(){}
  91 +
  92 + /**
  93 + * Check if system has been migrate
  94 + *
  95 + * @author KnowledgeTree Team
  96 + * @access private
  97 + * @param none
  98 + * @return boolean
  99 + */
  100 + private function isSystemMigrateed() {
  101 + return $this->iutil->isSystemMigrateed();
  102 + }
  103 +
  104 + /**
  105 + * Display the wizard
  106 + *
  107 + * @author KnowledgeTree Team
  108 + * @access private
  109 + * @param string
  110 + * @return void
  111 + */
  112 + public function displayMigrater($response = null) {
  113 + if($response) {
  114 + $ins = new Migrater(); // Instantiate the migrateer
  115 + $ins->resolveErrors($response); // Run step
  116 + } else {
  117 + $ins = new Migrater(new Session()); // Instantiate the migrateer and pass the session class
  118 + $ins->step(); // Run step
  119 + }
  120 + }
  121 +
  122 + /**
  123 + * Set bypass flag
  124 + *
  125 + * @author KnowledgeTree Team
  126 + * @access private
  127 + * @param boolean
  128 + * @return void
  129 + */
  130 + private function setBypass($bypass) {
  131 + $this->bypass = $bypass;
  132 + }
  133 +
  134 + /**
  135 + * Set util reference
  136 + *
  137 + * @author KnowledgeTree Team
  138 + * @access private
  139 + * @param object migrateer utility
  140 + * @return void
  141 + */
  142 + private function setIUtil($iutil) {
  143 + $this->iutil = $iutil;
  144 + }
  145 +
  146 + /**
  147 + * Get bypass flag
  148 + *
  149 + * @author KnowledgeTree Team
  150 + * @access public
  151 + * @param none
  152 + * @return boolean
  153 + */
  154 + public function getBypass() {
  155 + return $this->bypass;
  156 + }
  157 +
  158 + /**
  159 + * Bypass and force an migrate
  160 + *
  161 + * @author KnowledgeTree Team
  162 + * @access private
  163 + * @param none
  164 + * @return boolean
  165 + */
  166 + private function bypass() {
  167 +
  168 + }
  169 +
  170 + /**
  171 + * Create migrate file
  172 + *
  173 + * @author KnowledgeTree Team
  174 + * @access private
  175 + * @param none
  176 + * @return void
  177 + */
  178 + private function createMigrateFile() {
  179 + @touch("migrate");
  180 + }
  181 +
  182 + /**
  183 + * Remove migrate file
  184 + *
  185 + * @author KnowledgeTree Team
  186 + * @access private
  187 + * @param none
  188 + * @return void
  189 + */
  190 + private function removeMigrateFile() {
  191 + @unlink("migrate");
  192 + }
  193 +
  194 + /**
  195 + * Load default values
  196 + *
  197 + * @author KnowledgeTree Team
  198 + * @access private
  199 + * @param none
  200 + * @return void
  201 + */
  202 + function load() {
  203 + if(isset($_GET['bypass'])) {
  204 + $this->setBypass($_GET['bypass']);
  205 + }
  206 + $this->setIUtil(new MigrateUtil());
  207 + }
  208 +
  209 + /**
  210 + * Run pre-migrateation system checks
  211 + *
  212 + * @author KnowledgeTree Team
  213 + * @access public
  214 + * @param none
  215 + * @return mixed
  216 + */
  217 + public function systemChecks() {
  218 + $res = $this->iutil->checkStructurePermissions();
  219 + if($res === true) return $res;
  220 + switch ($res) {
  221 + case "wizard":
  222 + $this->iutil->error("Migrater directory is not writable (KT_Migrateation_Directory/setup/wizard/)");
  223 + return 'Migrater directory is not writable (KT_Migrateation_Directory/setup/wizard/)';
  224 + break;
  225 + case "/":
  226 + $this->iutil->error("System root is not writable (KT_Migrateation_Directory/)");
  227 + return "System root is not writable (KT_Migrateation_Directory/)";
  228 + break;
  229 + default:
  230 + return true;
  231 + break;
  232 + }
  233 +
  234 + return $res;
  235 + }
  236 +
  237 + /**
  238 + * Control all requests to wizard
  239 + *
  240 + * @author KnowledgeTree Team
  241 + * @access public
  242 + * @param none
  243 + * @return void
  244 + */
  245 + public function dispatch() {
  246 + $this->load();
  247 + if($this->getBypass() === "1") {
  248 + $this->removeMigrateFile();
  249 + } elseif ($this->getBypass() === "0") {
  250 + $this->createMigrateFile();
  251 + }
  252 + if(!$this->isSystemMigrateed()) { // Check if the systems not migrateed
  253 + $response = $this->systemChecks();
  254 + if($response === true) {
  255 + $this->displayMigrater();
  256 + } else {
  257 + exit();
  258 + }
  259 + } else {
  260 + // TODO: Die gracefully
  261 + $this->iutil->error("System has been migrateed <div class=\"buttons\"><a href='../../'>Goto Login</a></div>");
  262 + }
  263 + }
  264 +}
  265 +
  266 +$ic = new MigrateWizard();
  267 +$ic->dispatch();
  268 +?>
0 \ No newline at end of file 269 \ No newline at end of file
setup/migrate/path.php 0 → 100644
  1 +<?php
  2 +/**
  3 +* Migrater Paths.
  4 +*
  5 +* KnowledgeTree Community Edition
  6 +* Document Management Made Simple
  7 +* Copyright (C) 2008,2009 KnowledgeTree Inc.
  8 +* Portions copyright The Jam Warehouse Software (Pty) Limited
  9 +*
  10 +* This program is free software; you can redistribute it and/or modify it under
  11 +* the terms of the GNU General Public License version 3 as published by the
  12 +* Free Software Foundation.
  13 +*
  14 +* This program is distributed in the hope that it will be useful, but WITHOUT
  15 +* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  16 +* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
  17 +* details.
  18 +*
  19 +* You should have received a copy of the GNU General Public License
  20 +* along with this program. If not, see <http://www.gnu.org/licenses/>.
  21 +*
  22 +* You can contact KnowledgeTree Inc., PO Box 7775 #87847, San Francisco,
  23 +* California 94120-7775, or email info@knowledgetree.com.
  24 +*
  25 +* The interactive user interfaces in modified source and object code versions
  26 +* of this program must display Appropriate Legal Notices, as required under
  27 +* Section 5 of the GNU General Public License version 3.
  28 +*
  29 +* In accordance with Section 7(b) of the GNU General Public License version 3,
  30 +* these Appropriate Legal Notices must retain the display of the "Powered by
  31 +* KnowledgeTree" logo and retain the original copyright notice. If the display of the
  32 +* logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices
  33 +* must display the words "Powered by KnowledgeTree" and retain the original
  34 +* copyright notice.
  35 +*
  36 +* @copyright 2008-2009, KnowledgeTree Inc.
  37 +* @license GNU General Public License version 3
  38 +* @author KnowledgeTree Team
  39 +* @package Migrater
  40 +* @version Version 0.1
  41 +*/
  42 + // Define migrateer environment
  43 + if (substr(php_uname(), 0, 7) == "Windows"){
  44 + define('WINDOWS_OS', true);
  45 + define('UNIX_OS', false);
  46 + define('OS', 'windows');
  47 + } else {
  48 + define('WINDOWS_OS', false);
  49 + define('UNIX_OS', true);
  50 + define('OS', 'unix');
  51 + }
  52 + if(WINDOWS_OS) {
  53 + define('DS', '\\');
  54 + } else {
  55 + define('DS', '/');
  56 + }
  57 + // Define environment root
  58 + $wizard = realpath(dirname(__FILE__));
  59 + $xdir = explode(DS, $wizard);
  60 + array_pop($xdir);
  61 + array_pop($xdir);
  62 + $sys = '';
  63 + foreach ($xdir as $k=>$v) {
  64 + $sys .= $v.DS;
  65 + }
  66 + // Define paths to wizard
  67 + define('WIZARD_DIR', $wizard.DS);
  68 + define('WIZARD_LIB', WIZARD_DIR."lib".DS);
  69 + define('SERVICE_LIB', WIZARD_LIB."services".DS);
  70 + define('SQL_DIR', WIZARD_DIR."sql".DS);
  71 + define('SQL_UPGRADE_DIR', SQL_DIR."upgrades".DS);
  72 + define('CONF_DIR', WIZARD_DIR."config".DS);
  73 + define('RES_DIR', WIZARD_DIR."resources".DS);
  74 + define('STEP_DIR', WIZARD_DIR."steps".DS);
  75 + define('TEMP_DIR', WIZARD_DIR."templates".DS);
  76 + define('SHELL_DIR', WIZARD_DIR."shells".DS);
  77 + define('OUTPUT_DIR', WIZARD_DIR."output".DS);
  78 + // Define paths to system webroot
  79 + define('SYSTEM_DIR', $sys);
  80 + define('SYS_BIN_DIR', SYSTEM_DIR."bin".DS);
  81 + define('SYS_LOG_DIR', SYSTEM_DIR."var".DS."log".DS);
  82 + // Define paths to system
  83 + array_pop($xdir);
  84 + $asys = '';
  85 + foreach ($xdir as $k=>$v) {
  86 + $asys .= $v.DS;
  87 + }
  88 + define('SYSTEM_ROOT', $asys);
  89 + // Migrate Type
  90 + preg_match('/Zend/', $sys, $matches); // TODO: Dirty
  91 + if($matches) {
  92 + $sysdir = explode(DS, $sys);
  93 + array_pop($sysdir);
  94 + array_pop($sysdir);
  95 + array_pop($sysdir);
  96 + array_pop($sysdir);
  97 + $zendsys = '';
  98 + foreach ($sysdir as $k=>$v) {
  99 + $zendsys .= $v.DS;
  100 + }
  101 + define('INSTALL_TYPE', 'Zend');
  102 + define('PHP_DIR', $zendsys."ZendServer".DS."bin".DS);
  103 + } else {
  104 + $modules = get_loaded_extensions();
  105 + // TODO: Dirty
  106 + if(in_array('Zend Download Server', $modules) || in_array('Zend Monitor', $modules) || in_array('Zend Utils', $modules) || in_array('Zend Page Cache', $modules)) {
  107 + define('INSTALL_TYPE', 'Zend');
  108 + define('PHP_DIR', '');
  109 + } else {
  110 + define('INSTALL_TYPE', '');
  111 + define('PHP_DIR', '');
  112 + }
  113 + }
  114 + // Other
  115 + date_default_timezone_set('Africa/Johannesburg');
  116 + if(WINDOWS_OS) { // Mysql bin [Windows]
  117 + $serverPaths = explode(';',$_SERVER['PATH']);
  118 + foreach ($serverPaths as $apath) {
  119 + preg_match('/mysql/i', $apath, $matches);
  120 + if($matches) {
  121 + define('MYSQL_BIN', $apath.DS);
  122 + break;
  123 + }
  124 + }
  125 + } else {
  126 + define('MYSQL_BIN', ''); // Assume its linux and can be executed from command line
  127 + }
  128 +
  129 +?>
setup/migrate/resources/graphics/active.png 0 → 100644

1.25 KB

setup/migrate/resources/graphics/background.gif 0 → 100644

914 Bytes

setup/migrate/resources/graphics/big-ok.png 0 → 100644

3.14 KB

setup/migrate/resources/graphics/cross.png 0 → 100644

846 Bytes

setup/migrate/resources/graphics/cross_orange.png 0 → 100644

1.43 KB

setup/migrate/resources/graphics/dame/dot.png 0 → 100644

3.22 KB

setup/migrate/resources/graphics/dame/finish.png 0 → 100644

7.22 KB

setup/migrate/resources/graphics/dame/gradiant.gif 0 → 100644

2.11 KB

setup/migrate/resources/graphics/dame/kt_gradient.jpg 0 → 100644

13.2 KB

setup/migrate/resources/graphics/dame/loginbg.png 0 → 100644

769 Bytes

setup/migrate/resources/graphics/dame/migrater-header_logo.png 0 → 100644

2.85 KB

setup/migrate/resources/graphics/dame/migrater_head.png 0 → 100644

2.78 KB

setup/migrate/resources/graphics/dame/navbar.png 0 → 100644

1.57 KB

setup/migrate/resources/graphics/dame/powered-by-kt.png 0 → 100644

7.34 KB

setup/migrate/resources/graphics/dame/tick1.png 0 → 100644

3.43 KB

setup/migrate/resources/graphics/dame/tick2.png 0 → 100644

3.41 KB

setup/migrate/resources/graphics/dropbox.png 0 → 100644

182 KB

setup/migrate/resources/graphics/dropbox_old.png 0 → 100644

13.6 KB

setup/migrate/resources/graphics/footer.png 0 → 100644

1.04 KB

setup/migrate/resources/graphics/gradient.png 0 → 100644

1.82 KB

setup/migrate/resources/graphics/inactive.png 0 → 100644

1.2 KB

setup/migrate/resources/graphics/indicator.png 0 → 100644

1.22 KB

setup/migrate/resources/graphics/kt_browse.png 0 → 100644

34.1 KB

setup/migrate/resources/graphics/left.png 0 → 100644

1.08 KB

setup/migrate/resources/graphics/logo.png 0 → 100644

1.36 KB

setup/migrate/resources/graphics/powered-by-kt.png 0 → 100644

8.27 KB

setup/migrate/resources/graphics/question.gif 0 → 100644

1.03 KB

setup/migrate/resources/graphics/tick.png 0 → 100644

917 Bytes

setup/migrate/resources/graphics/tree.jpg 0 → 100644

2.2 KB

setup/migrate/resources/jquery-tooltip/changelog.txt 0 → 100644
  1 +1.3
  2 +---
  3 +
  4 +* Added fade option (duration in ms) for fading in/out tooltips; IE <= 6 is excluded when bgiframe plugin is included
  5 +* Fixed imagemaps in IE, added back example
  6 +* Added positionLeft-option - positions the tooltip to the left of the cursor
  7 +* Remove deprecated $.fn.Tooltip in favor of $.fn.tooltip
  8 +
  9 +1.2
  10 +---
  11 +
  12 +* Improved bodyHandler option to accept HTML strings, DOM elements and jQuery objects as the return value
  13 +* Fixed bug in Safari 3 where to tooltip is initially visible, by first appending to DOM then hiding it
  14 +* Improvement for viewport-border-positioning: Add the classes "viewport-right" and "viewport-bottom" when the element is moved at the viewport border.
  15 +* Moved and enhanced documentation to docs.jquery.com
  16 +* Added examples for bodyHandler: footnote-tooltip and thumbnail
  17 +* Added id option, defaults to "tooltip", override to use a different id in your stylesheet
  18 +* Moved demo tooltip style to screen.css
  19 +* Moved demo files to demo folder and dependencies to lib folder
  20 +* Dropped image map example - completely incompatible with IE; image maps aren't supported anymore
  21 +
  22 +1.1
  23 +---
  24 +
  25 +* Use bgiframe-plugin if available
  26 +* Use dimensions-plugin to calculate viewport
  27 +* Expose global blocked-property via $.Tooltip.blocked to programmatically disable all tooltips
  28 +* Fixed image maps in IE by setting the alt-attribute to an empty string
  29 +* Removed event-option (only hover-tooltips now)
  30 +* Simplified event-handling (using hover instead of mouseover und mouseout)
  31 +* Added another "pretty" example
  32 +* Added top and left options to specify tooltip offset
  33 +* Reworked example page: New layout, code examples
  34 +
  35 +1.0
  36 +---
  37 +
  38 +* first release considered stable
0 \ No newline at end of file 39 \ No newline at end of file
setup/migrate/resources/jquery-tooltip/demo/bg.gif 0 → 100644

1.15 KB

setup/migrate/resources/jquery-tooltip/demo/chili-1.7.pack.js 0 → 100644
  1 +eval(function(p,a,c,k,e,d){e=function(c){return(c<a?"":e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)d[e(c)]=k[c]||e(c);k=[function(e){return d[e]}];e=function(){return'\\w+'};c=1;};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p;}('8={3b:"1.6",2o:"1B.1Y,1B.23,1B.2e",2i:"",2H:1a,12:"",2C:1a,Z:"",2a:\'<H V="$0">$$</H>\',R:"&#F;",1j:"&#F;&#F;&#F;&#F;",1f:"&#F;<1W/>",3c:5(){9 $(y).39("1k")[0]},I:{},N:{}};(5($){$(5(){5 1J(l,a){5 2I(A,h){4 3=(1v h.3=="1h")?h.3:h.3.1w;k.1m({A:A,3:"("+3+")",u:1+(3.c(/\\\\./g,"%").c(/\\[.*?\\]/g,"%").3a(/\\((?!\\?)/g)||[]).u,z:(h.z)?h.z:8.2a})}5 2z(){4 1E=0;4 1x=x 2A;Q(4 i=0;i<k.u;i++){4 3=k[i].3;3=3.c(/\\\\\\\\|\\\\(\\d+)/g,5(m,1F){9!1F?m:"\\\\"+(1E+1+1t(1F))});1x.1m(3);1E+=k[i].u}4 1w=1x.3d("|");9 x 1u(1w,(a.3g)?"2j":"g")}5 1S(o){9 o.c(/&/g,"&3h;").c(/</g,"&3e;")}5 1R(o){9 o.c(/ +/g,5(1X){9 1X.c(/ /g,R)})}5 G(o){o=1S(o);7(R){o=1R(o)}9 o}5 2m(2E){4 i=0;4 j=1;4 h;19(h=k[i++]){4 1b=D;7(1b[j]){4 1U=/(\\\\\\$)|(?:\\$\\$)|(?:\\$(\\d+))/g;4 z=h.z.c(1U,5(m,1V,K){4 3f=\'\';7(1V){9"$"}v 7(!K){9 G(1b[j])}v 7(K=="0"){9 h.A}v{9 G(1b[j+1t(K,10)])}});4 1A=D[D.u-2];4 2h=D[D.u-1];4 2G=2h.2v(11,1A);11=1A+2E.u;14+=G(2G)+z;9 z}v{j+=h.u}}}4 R=8.R;4 k=x 2A;Q(4 A 2r a.k){2I(A,a.k[A])}4 14="";4 11=0;l.c(2z(),2m);4 2y=l.2v(11,l.u);14+=G(2y);9 14}5 2B(X){7(!8.N[X]){4 Y=\'<Y 32="1p" 33="p/2u"\'+\' 30="\'+X+\'">\';8.N[X]=1H;7($.31.34){4 W=J.1L(Y);4 $W=$(W);$("2d").1O($W)}v{$("2d").1O(Y)}}}5 1q(e,a){4 l=e&&e.1g&&e.1g[0]&&e.1g[0].37;7(!l)l="";l=l.c(/\\r\\n?/g,"\\n");4 C=1J(l,a);7(8.1j){C=C.c(/\\t/g,8.1j)}7(8.1f){C=C.c(/\\n/g,8.1f)}$(e).38(C)}5 1o(q,13){4 1l={12:8.12,2x:q+".1d",Z:8.Z,2w:q+".2u"};4 B;7(13&&1v 13=="2l")B=$.35(1l,13);v B=1l;9{a:B.12+B.2x,1p:B.Z+B.2w}}7($.2q)$.2q({36:"2l.15"});4 2n=x 1u("\\\\b"+8.2i+"\\\\b","2j");4 1e=[];$(8.2o).2D(5(){4 e=y;4 1n=$(e).3i("V");7(!1n){9}4 q=$.3u(1n.c(2n,""));7(\'\'!=q){1e.1m(e);4 f=1o(q,e.15);7(8.2H||e.15){7(!8.N[f.a]){1D{8.N[f.a]=1H;$.3v(f.a,5(M){M.f=f.a;8.I[f.a]=M;7(8.2C){2B(f.1p)}$("."+q).2D(5(){4 f=1o(q,y.15);7(M.f==f.a){1q(y,M)}})})}1I(3s){3t("a 3w Q: "+q+\'@\'+3z)}}}v{4 a=8.I[f.a];7(a){1q(e,a)}}}});7(J.1i&&J.1i.29){5 22(p){7(\'\'==p){9""}1z{4 16=(x 3A()).2k()}19(p.3x(16)>-1);p=p.c(/\\<1W[^>]*?\\>/3y,16);4 e=J.1L(\'<1k>\');e.3l=p;p=e.3m.c(x 1u(16,"g"),\'\\r\\n\');9 p}4 T="";4 18=1G;$(1e).3j().G("1k").U("2c",5(){18=y}).U("1M",5(){7(18==y)T=J.1i.29().3k});$("3n").U("3q",5(){7(\'\'!=T){2p.3r.3o(\'3p\',22(T));2V.2R=1a}}).U("2c",5(){T=""}).U("1M",5(){18=1G})}})})(1Z);8.I["1Y.1d"]={k:{2M:{3:/\\/\\*[^*]*\\*+(?:[^\\/][^*]*\\*+)*\\//},25:{3:/\\<!--(?:.|\\n)*?--\\>/},2f:{3:/\\/\\/.*/},2P:{3:/2L|2T|2J|2O|2N|2X|2K|2Z|2U|2S|2W|2Y|2Q|51|c-50/},53:{3:/\\/[^\\/\\\\\\n]*(?:\\\\.[^\\/\\\\\\n]*)*\\/[52]*/},1h:{3:/(?:\\\'[^\\\'\\\\\\n]*(?:\\\\.[^\\\'\\\\\\n]*)*\\\')|(?:\\"[^\\"\\\\\\n]*(?:\\\\.[^\\"\\\\\\n]*)*\\")/},27:{3:/\\b[+-]?(?:\\d*\\.?\\d+|\\d+\\.?\\d*)(?:[1r][+-]?\\d+)?\\b/},4X:{3:/\\b(D|1N|1K|1I|2t|2s|4W|1z|v|1a|Q|5|7|2r|4Z|x|1G|9|1Q|y|1H|1D|1v|4|4Y|19|59)\\b/},1y:{3:/\\b(58|2k|2p|5b|5a|55|J|54|57|1t|56|4L|4K|4N|4M|4H|4G|4J)\\b/},1C:{3:/(?:\\<\\w+)|(?:\\>)|(?:\\<\\/\\w+\\>)|(?:\\/\\>)/},26:{3:/\\s+\\w+(?=\\s*=)/},20:{3:/([\\"\\\'])(?:(?:[^\\1\\\\\\r\\n]*?(?:\\1\\1|\\\\.))*[^\\1\\\\\\r\\n]*?)\\1/},21:{3:/&[\\w#]+?;/},4I:{3:/(\\$|1Z)/}}};8.I["23.1d"]={k:{25:{3:/\\<!--(?:.|\\n)*?--\\>/},1h:{3:/(?:\\\'[^\\\'\\\\\\n]*(?:\\\\.[^\\\'\\\\\\n]*)*\\\')|(?:\\"[^\\"\\\\\\n]*(?:\\\\.[^\\"\\\\\\n]*)*\\")/},27:{3:/\\b[+-]?(?:\\d*\\.?\\d+|\\d+\\.?\\d*)(?:[1r][+-]?\\d+)?\\b/},1C:{3:/(?:\\<\\w+)|(?:\\>)|(?:\\<\\/\\w+\\>)|(?:\\/\\>)/},26:{3:/\\s+\\w+(?=\\s*=)/},20:{3:/([\\"\\\'])(?:(?:[^\\1\\\\\\r\\n]*?(?:\\1\\1|\\\\.))*[^\\1\\\\\\r\\n]*?)\\1/},21:{3:/&[\\w#]+?;/}}};8.I["2e.1d"]={k:{4S:{3:/\\/\\*[^*]*\\*+([^\\/][^*]*\\*+)*\\//},2f:{3:/(?:\\/\\/.*)|(?:[^\\\\]\\#.*)/},4V:{3:/\\\'[^\\\'\\\\]*(?:\\\\.[^\\\'\\\\]*)*\\\'/},4U:{3:/\\"[^\\"\\\\]*(?:\\\\.[^\\"\\\\]*)*\\"/},4P:{3:/\\b(?:[4O][2b][1s][1s]|[4R][4Q][2b][1P]|[5c][5v][1s][5u][1P])\\b/},5x:{3:/\\b[+-]?(\\d*\\.?\\d+|\\d+\\.?\\d*)([1r][+-]?\\d+)?\\b/},5y:{3:/\\b(?:5z|5w(?:5A|5E(?:5F(?:17|1c)|5G(?:17|1c))|17|1T|5B|5C|5D(?:17|1T|1c)|1c)|P(?:5h(?:5k|5j)|5e(?:5d|5g(?:5f|5l)|5r|E(?:5t|5s)|5n(?:5m|5p)|L(?:3X|3W)|O(?:S|3Y(?:3T|3S|3V))|3U|S(?:44|47|46)|41))|40)\\b/},1y:{3:/(?:\\$43|\\$42|\\$3R|\\$3G|\\$3F|\\$3I|\\$3H|\\$3C|\\$3B|\\$3D)\\b/},28:{3:/\\b(?:3O|3N|3P|3K|3J|3M|3L|48|4v|1N|1K|1I|4u|V|4x|4w|2t|4r|2s|4q|1z|4t|v|4s|4D|4C|4F|4E|4z|4y|4B|4A|4p|4d|2F|2F|4g|Q|4f|5|1y|7|4a|4m|4l|4o|4i|4k|x|4j|4h|4n|4b|4c|49|4e|3Q|3E|9|45|1Q|y|3Z|1D|5o|5q|4|19|5i)\\b/},2g:{3:/\\$(\\w+)/,z:\'<H V="28">$</H><H V="2g">$1</H>\'},1C:{3:/(?:\\<\\?[24][4T][24])|(?:\\<\\?)|(?:\\?\\>)/}}}',62,353,'|||exp|var|function||if|ChiliBook|return|recipe||replace||el|path||step|||steps|ingredients|||str|text|recipeName||||length|else||new|this|replacement|stepName|settings|dish|arguments||160|filter|span|recipes|document|||recipeLoaded|required|||for|replaceSpace||insidePRE|bind|class|domLink|stylesheetPath|link|stylesheetFolder||lastIndex|recipeFolder|options|perfect|chili|newline|ERROR|downPRE|while|false|aux|WARNING|js|codes|replaceNewLine|childNodes|string|selection|replaceTab|pre|settingsDef|push|elClass|getPath|stylesheet|makeDish|eE|Ll|parseInt|RegExp|typeof|source|exps|global|do|offset|code|tag|try|prevLength|aNum|null|true|catch|cook|case|createElement|mouseup|break|append|Ee|switch|replaceSpaces|escapeHTML|NOTICE|pattern|escaped|br|spaces|mix|jQuery|avalue|entity|preformatted|xml|Pp|htcom|aname|numbers|keyword|createRange|defaultReplacement|Uu|mousedown|head|php|com|variable|input|elementClass|gi|valueOf|object|chef|selectClass|elementPath|window|metaobjects|in|default|continue|css|substring|stylesheetFile|recipeFile|lastUnmatched|knowHow|Array|checkCSS|stylesheetLoading|each|matched|extends|unmatched|recipeLoading|prepareStep|unblockUI|ajaxSubmit|silverlight|jscom|unblock|block|plugin|clearFields|returnValue|fieldValue|blockUI|formSerialize|event|resetForm|ajaxForm|clearForm|fieldSerialize|href|browser|rel|type|msie|extend|selector|data|html|next|match|version|getPRE|join|lt|bit|ignoreCase|amp|attr|parents|htmlText|innerHTML|innerText|body|setData|Text|copy|clipboardData|recipeNotAvailable|alert|trim|getJSON|unavailable|indexOf|ig|recipePath|Date|_SESSION|_SERVER|php_errormsg|require_once|_GET|_FILES|_REQUEST|_POST|__METHOD__|__LINE__|and|abstract|__FILE__|__CLASS__|__FUNCTION__|require|_ENV|END|CONT|PREFIX|START|OCALSTATEDIR|IBDIR|UTPUT_HANDLER_|throw|__COMPILER_HALT_OFFSET__|VERSION|_COOKIE|GLOBALS|API|static|YSCONFDIR|HLIB_SUFFIX|array|protected|implements|print|private|exit|public|foreach|final|or|isset|old_function|list|include_once|include|php_user_filter|interface|exception|die|declare|elseif|echo|cfunction|as|const|clone|endswitch|endif|eval|endwhile|enddeclare|empty|endforeach|endfor|isNaN|NaN|jquery|Infinity|clearTimeout|setTimeout|clearInterval|setInterval|Nn|value|Rr|Tt|mlcom|Hh|string2|string1|delete|keywords|void|instanceof|content|taconite|gim|regexp|escape|constructor|parseFloat|unescape|toString|with|prototype|element|Ff|BINDIR|HP_|PATH|CONFIG_FILE_|EAR_|xor|INSTALL_DIR|EXTENSION_DIR|SCAN_DIR|MAX|INT_|unset|SIZE|use|DATADIR|XTENSION_DIR|OL|Ss|Aa|E_|number|const1|DEFAULT_INCLUDE_PATH|ALL|PARSE|STRICT|USER_|CO|MPILE_|RE_'.split('|'),0,{}))
setup/migrate/resources/jquery-tooltip/demo/formtip.html 0 → 100644
  1 +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2 +<html xmlns="http://www.w3.org/1999/xhtml">
  3 +<head>
  4 +<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
  5 +<title>jQuery Tooltip Plugin Demo</title>
  6 +
  7 +<link rel="stylesheet" href="../jquery.formtip.css" />
  8 +<link rel="stylesheet" href="screen.css" />
  9 +<script src="../lib/jquery.js" type="text/javascript"></script>
  10 +<script src="../lib/jquery.bgiframe.js" type="text/javascript"></script>
  11 +<script src="../lib/jquery.dimensions.js" type="text/javascript"></script>
  12 +<script src="../lib/jquery.delegate.js" type="text/javascript"></script>
  13 +<script src="../jquery.formtip.js" type="text/javascript"></script>
  14 +
  15 +<script src="chili-1.7.pack.js" type="text/javascript"></script>
  16 +
  17 +<script type="text/javascript">
  18 +$(function() {
  19 + $("form:first").formtip();
  20 + $("form.test").formtip({
  21 + positionParent: function(element) {
  22 + return element.parent();
  23 + },
  24 + left: -5
  25 + });
  26 +});
  27 +</script>
  28 +
  29 +<style type="text/css">
  30 +form.test div {
  31 + width: 250px;
  32 + border: 1px solid black;
  33 + float: left;
  34 + margin: 1em;
  35 +}
  36 +form.test p {
  37 + border: 1px solid #999;
  38 +}
  39 +</style>
  40 +
  41 +</head>
  42 +<body>
  43 +<h1 id="banner"><a href="http://bassistance.de/jquery-plugins/jquery-plugin-tooltip/">jQuery Tooltip Plugin</a> Demo</h1>
  44 +<div id="main">
  45 + <form>
  46 + <fieldset id="set1">
  47 + <legend>Three elements with tooltips, default settings</legend>
  48 + <a title="A tooltip with default settings, the href is displayed below the title" href="http://google.de">Link to google</a>
  49 + <br/>
  50 + <label title="A label with a title and default settings, no href here" for="text1">Input something please!</label>
  51 + <br/>
  52 + <input title="Note that the tooltip disappears when clicking the input elementthe input elementthe input element" type="text" value="Test" name="action" id="text1"/>
  53 +
  54 + <h3>Code</h3>
  55 + <pre><code class="mix">$('#set1 *').tooltip();</code></pre>
  56 + <input title="Another tooltip element I" type="text" value="Test"/>
  57 + </fieldset>
  58 + </form>
  59 +
  60 + <form class="test">
  61 + <div>
  62 + <p>
  63 + <label>II</label><input title="Another tooltip element II" type="text" value="Test"/>
  64 + </p>
  65 + <p>
  66 + <label>III</label><input title="Another tooltip element III" type="text" value="Test"/>
  67 + </p>
  68 + </div>
  69 + <div style="width: 200px">
  70 + <input title="Another tooltip element IV" type="text" value="Test"/>
  71 + <br/>
  72 + <input type="text" value="Test"/>
  73 + <br/>
  74 + <input title="Another tooltip element VI" type="text" value="Test"/>
  75 + </div>
  76 + </form>
  77 +
  78 +</div>
  79 +<script src="http://www.google-analytics.com/urchin.js" type="text/javascript">
  80 +</script>
  81 +<script type="text/javascript">
  82 +_uacct = "UA-2623402-1";
  83 +urchinTracker();
  84 +</script>
  85 +</body>
  86 +</html>
0 \ No newline at end of file 87 \ No newline at end of file
setup/migrate/resources/jquery-tooltip/demo/image.png 0 → 100644

10.9 KB

setup/migrate/resources/jquery-tooltip/demo/index.html 0 → 100644
  1 +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2 +<html xmlns="http://www.w3.org/1999/xhtml">
  3 +<head>
  4 +<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
  5 +<title>jQuery Tooltip Plugin Demo</title>
  6 +
  7 +<link rel="stylesheet" href="../jquery.tooltip.css" />
  8 +<link rel="stylesheet" href="screen.css" />
  9 +<script src="../lib/jquery.js" type="text/javascript"></script>
  10 +<script src="../lib/jquery.bgiframe.js" type="text/javascript"></script>
  11 +<script src="../lib/jquery.dimensions.js" type="text/javascript"></script>
  12 +<script src="../jquery.tooltip.js" type="text/javascript"></script>
  13 +
  14 +<script src="chili-1.7.pack.js" type="text/javascript"></script>
  15 +
  16 +<script type="text/javascript">
  17 +$(function() {
  18 +$('#set1 *').tooltip();
  19 +
  20 +$("#foottip a").tooltip({
  21 + bodyHandler: function() {
  22 + return $($(this).attr("href")).html();
  23 + },
  24 + showURL: false
  25 +});
  26 +
  27 +$('#tonus').tooltip({
  28 + delay: 0,
  29 + showURL: false,
  30 + bodyHandler: function() {
  31 + return $("<img/>").attr("src", this.src);
  32 + }
  33 +});
  34 +
  35 +$('#yahoo a').tooltip({
  36 + track: true,
  37 + delay: 0,
  38 + showURL: false,
  39 + showBody: " - ",
  40 + fade: 250
  41 +});
  42 +
  43 +$("select").tooltip({
  44 + left: 25
  45 +});
  46 +
  47 +$("map > area").tooltip({ positionLeft: true });
  48 +
  49 +$("#fancy, #fancy2").tooltip({
  50 + track: true,
  51 + delay: 0,
  52 + showURL: false,
  53 + fixPNG: true,
  54 + showBody: " - ",
  55 + extraClass: "pretty fancy",
  56 + top: -15,
  57 + left: 5
  58 +});
  59 +
  60 +$('#pretty').tooltip({
  61 + track: true,
  62 + delay: 0,
  63 + showURL: false,
  64 + showBody: " - ",
  65 + extraClass: "pretty",
  66 + fixPNG: true,
  67 + left: -120
  68 +});
  69 +
  70 +$('#right a').tooltip({
  71 + track: true,
  72 + delay: 0,
  73 + showURL: false,
  74 + extraClass: "right"
  75 +});
  76 +$('#right2 a').tooltip({ showURL: false, positionLeft: true });
  77 +
  78 +$("#block").click($.tooltip.block);
  79 +
  80 +});
  81 +</script>
  82 +
  83 +</head>
  84 +<body>
  85 +<h1 id="banner"><a href="http://bassistance.de/jquery-plugins/jquery-plugin-tooltip/">jQuery Tooltip Plugin</a> Demo</h1>
  86 +<div id="main">
  87 + <fieldset id="set1">
  88 + <legend>Three elements with tooltips, default settings</legend>
  89 + <a title="A tooltip with default settings, the href is displayed below the title" href="http://google.de">Link to google</a>
  90 + <br/>
  91 + <label title="A label with a title and default settings, no href here" for="text1">Input something please!</label>
  92 + <br/>
  93 + <input title="Note that the tooltip disappears when clicking the input element" type="text" value="Test" name="action" id="text1"/>
  94 +
  95 + <h3>Code</h3>
  96 + <pre><code class="mix">$('#set1 *').tooltip();</code></pre>
  97 + </fieldset>
  98 +
  99 + <fieldset id="foottip">
  100 + <legend>Using bodyHandler to display footnotes in the tooltip</legend>
  101 + Some text referring to a <a href="#footnote">footnote</a>.
  102 + <br/>
  103 + <br/>
  104 + <br/>
  105 + <br/>
  106 + <br/>
  107 + <div id="footnote"><em>And here</em> is the actual footnote, complete with nested <strong>HTML</strong>.</div>
  108 +
  109 + <h3>Code</h3>
  110 + <pre><code class="mix">$("#foottip a").tooltip({
  111 + bodyHandler: function() {
  112 + return $($(this).attr("href")).html();
  113 + },
  114 + showURL: false
  115 +});</code></pre>
  116 + </fieldset>
  117 +
  118 + <fieldset>
  119 + <legend>An image with a tooltip</legend>
  120 + <img id="tonus" src="image.png" height="80" title="No delay. The src value is displayed below the title" />
  121 + <h3>Code</h3>
  122 + <pre><code class="mix">$('#tonus').tooltip({
  123 + delay: 0,
  124 + showURL: false,
  125 + bodyHandler: function() {
  126 + return $("&lt;img/&gt;").attr("src", this.src);
  127 + }
  128 +});</code></pre>
  129 + </fieldset>
  130 +
  131 + <fieldset>
  132 + <legend>Blocking tooltips</legend>
  133 + <button id="block">Click this button to block/unblock all tooltips</button>
  134 + <pre><code class="mix">$("#block").click($.tooltip.block);</code></pre>
  135 + </fieldset>
  136 +
  137 + <fieldset>
  138 + <legend>The next four links have no delay with tracking and fading, with extra content:</legend>
  139 + <div id="yahoo">
  140 + <a title="Yahoo doo - more content" href="http://yahoo.com">Link to yahoo</a>
  141 + <a title="Yahoo doo2 - wohooo" href="http://yahoo.com">Link to yahoo1</a>
  142 + <a title="Yahoo doo3" href="http://yahoo.com">Link to yahoo2</a>
  143 + <a title="Yahoo doo4 - buga!" href="http://yahoo.com">Link to yahoo3</a>
  144 + </div>
  145 + <select><option>bgiframe test</option></select>
  146 + <h3>Code</h3>
  147 + <pre><code class="mix">$('#yahoo a').tooltip({
  148 + track: true,
  149 + delay: 0,
  150 + showURL: false,
  151 + showBody: " - ",
  152 + fade: 250
  153 +});</code></pre>
  154 + </fieldset>
  155 +
  156 + <fieldset>
  157 + <legend>Tooltips with extra classes. Useful for different tooltip styles on a single page.</legend>
  158 + <em>Note how the one on the right gets a different background image when at the right viewport border.</em>
  159 + <br/>
  160 + <span id="fancy" title="You are dead, this is hell. - Please note the custom positioning here!">A fancy tooltip, now with some custom positioning.</span>
  161 + <span id="fancy2" title="You are dead, this is hell. - Please note the custom positioning here!">A fancy tooltip, now with some custom positioning.</span>
  162 + <p><span id="pretty" title="I am pretty! - I am a very pretty tooltip, I need lot's of attention from buggers like you! Yes!">And now, for the fancy stuff, a tooltip with an extra class for nice shadows, and some extra content</span></p>
  163 + <br/>
  164 + <br/>
  165 + <br/>
  166 + <select><option>bgiframe test</option></select>
  167 + <h3>Code</h3>
  168 + <pre><code class="mix">$("#fancy, #fancy2").tooltip({
  169 + track: true,
  170 + delay: 0,
  171 + showURL: false,
  172 + opacity: 1,
  173 + fixPNG: true,
  174 + showBody: " - ",
  175 + extraClass: "pretty fancy",
  176 + top: -15,
  177 + left: 5
  178 +});
  179 +
  180 +$('#pretty').tooltip({
  181 + track: true,
  182 + delay: 0,
  183 + showURL: false,
  184 + showBody: " - ",
  185 + extraClass: "pretty",
  186 + fixPNG: true,
  187 + opacity: 0.95,
  188 + left: -120
  189 +});</code></pre>
  190 + </fieldset>
  191 +
  192 + <fieldset>
  193 + <legend>Selects</legend>
  194 + <select title="fancy select with a tooltip">
  195 + <option>1. option</option>
  196 + <option>2. option</option>
  197 + <option>3. option</option>
  198 + </select>
  199 + </fieldset>
  200 +
  201 + <fieldset>
  202 + <legend>Image map with tooltips.</legend>
  203 +
  204 + <img id="map" src="karte.png" width="345" height="312" border="0" usemap="#Landkarte">
  205 + <map name="Landkarte">
  206 + <area shape="rect" coords="11,10,59,29"
  207 + href="http://www.koblenz.de/" alt="Koblenz" title="Koblenz">
  208 + <area shape="rect" coords="42,36,96,57"
  209 + href="http://www.wiesbaden.de/" alt="Wiesbaden" title="Wiesbaden">
  210 + <area shape="rect" coords="42,59,78,80"
  211 + href="http://www.mainz.de/" alt="Mainz" title="Mainz">
  212 + <area shape="rect" coords="100,26,152,58"
  213 + href="http://www.frankfurt.de/" alt="Frankfurt" title="Frankfurt">
  214 + <area shape="rect" coords="27,113,93,134"
  215 + href="http://www.mannheim.de/" alt="Mannheim" title="Mannheim">
  216 + <area shape="rect" coords="100,138,163,159"
  217 + href="http://www.heidelberg.de/" alt="Heidelberg" title="Heidelberg">
  218 + <area shape="rect" coords="207,77,266,101"
  219 + href="http://www.wuerzburg.de/" alt="W&uuml;rzburg" title="W&uuml;rzburg">
  220 + <area shape="rect" coords="282,62,344,85"
  221 + href="http://www.bamberg.de/" alt="Bamberg" title="Bamberg">
  222 + <area shape="rect" coords="255,132,316,150"
  223 + href="http://www.nuernberg.de/" alt="N&uuml;rnberg" title="N&uuml;rnberg">
  224 + <area shape="rect" coords="78,182,132,200"
  225 + href="http://www.karlsruhe.de/" alt="Karlsruhe" title="Karlsruhe">
  226 + <area shape="rect" coords="142,169,200,193"
  227 + href="http://www.heilbronn.de/" alt="Heilbronn" title="Heilbronn">
  228 + <area shape="rect" coords="140,209,198,230"
  229 + href="http://www.stuttgart.de/" alt="Stuttgart" title="Stuttgart">
  230 + <area shape="rect" coords="187,263,222,281"
  231 + href="http://www.ulm.de/" alt="Ulm" title="Ulm">
  232 + <area shape="rect" coords="249,278,304,297"
  233 + href="http://www.augsburg.de/" alt="Augsburg" title="Augsburg">
  234 + <area shape="poly" coords="48,311,105,248,96,210,75,205,38,234,8,310"
  235 + href="http://www.baden-aktuell.de/" alt="Baden" title="Baden">
  236 + </map>
  237 + <h3>Code</h3>
  238 + <pre><code class="mix">$("map *").tooltip({ positionLeft: true });</code></pre>
  239 + </fieldset>
  240 +
  241 + <fieldset>
  242 + <legend>Testing repositioning at viewport borders</legend>
  243 + <p id="right">
  244 + Tooltip with fixed width<br/>
  245 + <a title="Short title" href="http://goggle">Google me!</a><br/>
  246 + <a title="Rather a very very long title with no meaning but yet quite long long long" href="http://goggle">Google me!</a>
  247 + </p>
  248 + <p id="right2">
  249 + Tooltip width auto width<br/>
  250 + <a title="Short title" href="http://goggle">Google me!</a><br/>
  251 + <a title="Rather a very very long title with no meaning but yet quite long long long" href="http://goggle">Google me!</a>
  252 + </p>
  253 + <h3>Code</h3>
  254 + <pre><code class="mix">$('#right a').tooltip({
  255 + track: true,
  256 + delay: 0,
  257 + showURL: false,
  258 + extraClass: "right"
  259 +});
  260 +$('#right2 a').tooltip({ showURL: false, positionLeft: true });</code></pre>
  261 + </fieldset>
  262 +</div>
  263 +<script src="http://www.google-analytics.com/urchin.js" type="text/javascript">
  264 +</script>
  265 +<script type="text/javascript">
  266 +_uacct = "UA-2623402-1";
  267 +urchinTracker();
  268 +</script>
  269 +</body>
  270 +</html>
0 \ No newline at end of file 271 \ No newline at end of file
setup/migrate/resources/jquery-tooltip/demo/karte.png 0 → 100644

27.6 KB

setup/migrate/resources/jquery-tooltip/demo/screen.css 0 → 100644
  1 +html, body, div, span, applet, object, iframe,
  2 +h1, h2, h3, h4, h5, h6, p, blockquote, pre,
  3 +a, abbr, acronym, address, big, cite, code,
  4 +del, dfn, em, font, img, ins, kbd, q, s, samp,
  5 +small, strike, strong, sub, sup, tt, var,
  6 +dl, dt, dd, ol, ul, li,
  7 +fieldset, form, label, legend,
  8 +table, caption, tbody, tfoot, thead, tr, th, td {
  9 + margin: 0;
  10 + padding: 0;
  11 + border: 0;
  12 + outline: 0;
  13 + font-weight: inherit;
  14 + font-style: inherit;
  15 + font-size: 100%;
  16 + font-family: inherit;
  17 + vertical-align: baseline;
  18 +}
  19 +fieldset {
  20 + border: 1px solid black; padding: 8px; margin: 8px 0;
  21 +}
  22 +/* remember to define focus styles! */
  23 +:focus {
  24 + outline: 0;
  25 +}
  26 +body {
  27 + line-height: 1;
  28 + color: black;
  29 + background: white;
  30 +}
  31 +
  32 +body, div { font-family: 'lucida grande', helvetica, verdana, arial, sans-serif }
  33 +body { margin: 0; padding: 0; font-size: small; color: #333 }
  34 +h1, h2 { font-family: 'trebuchet ms', verdana, arial; padding: 10px; margin: 0 }
  35 +h1 { font-size: large }
  36 +#main { padding: 1em; }
  37 +#banner { padding: 15px; background-color: #06b; color: white; font-size: large; border-bottom: 1px solid #ccc;
  38 + background: url(bg.gif) repeat-x; text-align: center }
  39 +#banner a { color: white; }
  40 +legend { font-weight: bold; }
  41 +
  42 +button { padding: 0 6px; margin: 0; }
  43 +
  44 +pre, code { white-space: pre; font-family: "Courier New"; }
  45 +pre { margin: 8px 0; }
  46 +h3 {
  47 + font-size: 110%;
  48 + font-weight: bold;
  49 + margin: .2em 0 .5em 0;
  50 +}
  51 +p { margin: 1em 0; }
  52 +strong { font-weight: bolder; }
  53 +em { font-style: italic; }
  54 +
  55 +.jscom, .mix htcom { color: #4040c2; }
  56 +.com { color: green; }
  57 +.regexp { color: maroon; }
  58 +.string { color: teal; }
  59 +.keywords { color: blue; }
  60 +.global { color: #008; }
  61 +.numbers { color: #880; }
  62 +.comm { color: green; }
  63 +.tag { color: blue; }
  64 +.entity { color: blue; }
  65 +.string { color: teal; }
  66 +.aname { color: maroon; }
  67 +.avalue { color: maroon; }
  68 +.jquery { color: #00a; }
  69 +.plugin { color: red; }
  70 +
  71 +#tooltip.pretty {
  72 + font-family: Arial;
  73 + border: none;
  74 + width: 210px;
  75 + padding:20px;
  76 + height: 135px;
  77 + opacity: 0.8;
  78 + background: url('shadow.png');
  79 +}
  80 +#tooltip.pretty h3 {
  81 + margin-bottom: 0.75em;
  82 + font-size: 12pt;
  83 + width: 220px;
  84 + text-align: center;
  85 +}
  86 +#tooltip.pretty div { width: 220px; text-align: left; }
  87 +
  88 +#tooltip.fancy {
  89 + background: url('shadow2.png');
  90 + padding-top: 5em;
  91 + height: 100px;
  92 +}
  93 +#tooltip.fancy.viewport-right {
  94 + background: url('shadow2-reverse.png');
  95 +}
  96 +
  97 +#extended { margin: 2em 0; }
  98 +#extended label { text-decoration: underline; }
  99 +#yahoo { width: 7em; }
  100 +#right, #right2 { text-align: right; }
  101 +#tooltip.right { width: 250px; }
  102 +#fancy2 { float: right; }
0 \ No newline at end of file 103 \ No newline at end of file
setup/migrate/resources/jquery-tooltip/demo/shadow.png 0 → 100644

4.54 KB

setup/migrate/resources/jquery-tooltip/demo/shadow2-reverse.png 0 → 100644

4.91 KB

setup/migrate/resources/jquery-tooltip/demo/shadow2.png 0 → 100644

5.23 KB

setup/migrate/resources/jquery-tooltip/jquery.tooltip.css 0 → 100644
  1 +#tooltip {
  2 + position: absolute;
  3 + z-index: 3000;
  4 + border: 1px solid #111;
  5 + background-color: #eee;
  6 + padding: 5px;
  7 + opacity: 0.85;
  8 +}
  9 +#tooltip h3, #tooltip div { margin: 0; }
setup/migrate/resources/jquery-tooltip/jquery.tooltip.js 0 → 100644
  1 +/*
  2 + * jQuery Tooltip plugin 1.3
  3 + *
  4 + * http://bassistance.de/jquery-plugins/jquery-plugin-tooltip/
  5 + * http://docs.jquery.com/Plugins/Tooltip
  6 + *
  7 + * Copyright (c) 2006 - 2008 Jörn Zaefferer
  8 + *
  9 + * $Id: jquery.tooltip.js 5741 2008-06-21 15:22:16Z joern.zaefferer $
  10 + *
  11 + * Dual licensed under the MIT and GPL licenses:
  12 + * http://www.opensource.org/licenses/mit-license.php
  13 + * http://www.gnu.org/licenses/gpl.html
  14 + */
  15 +
  16 +;(function($) {
  17 +
  18 + // the tooltip element
  19 + var helper = {},
  20 + // the current tooltipped element
  21 + current,
  22 + // the title of the current element, used for restoring
  23 + title,
  24 + // timeout id for delayed tooltips
  25 + tID,
  26 + // IE 5.5 or 6
  27 + IE = $.browser.msie && /MSIE\s(5\.5|6\.)/.test(navigator.userAgent),
  28 + // flag for mouse tracking
  29 + track = false;
  30 +
  31 + $.tooltip = {
  32 + blocked: false,
  33 + defaults: {
  34 + delay: 200,
  35 + fade: false,
  36 + showURL: true,
  37 + extraClass: "",
  38 + top: 15,
  39 + left: 15,
  40 + id: "tooltip"
  41 + },
  42 + block: function() {
  43 + $.tooltip.blocked = !$.tooltip.blocked;
  44 + }
  45 + };
  46 +
  47 + $.fn.extend({
  48 + tooltip: function(settings) {
  49 + settings = $.extend({}, $.tooltip.defaults, settings);
  50 + createHelper(settings);
  51 + return this.each(function() {
  52 + $.data(this, "tooltip", settings);
  53 + this.tOpacity = helper.parent.css("opacity");
  54 + // copy tooltip into its own expando and remove the title
  55 + this.tooltipText = this.title;
  56 + $(this).removeAttr("title");
  57 + // also remove alt attribute to prevent default tooltip in IE
  58 + this.alt = "";
  59 + })
  60 + .mouseover(save)
  61 + .mouseout(hide)
  62 + .click(hide);
  63 + },
  64 + fixPNG: IE ? function() {
  65 + return this.each(function () {
  66 + var image = $(this).css('backgroundImage');
  67 + if (image.match(/^url\(["']?(.*\.png)["']?\)$/i)) {
  68 + image = RegExp.$1;
  69 + $(this).css({
  70 + 'backgroundImage': 'none',
  71 + 'filter': "progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true, sizingMethod=crop, src='" + image + "')"
  72 + }).each(function () {
  73 + var position = $(this).css('position');
  74 + if (position != 'absolute' && position != 'relative')
  75 + $(this).css('position', 'relative');
  76 + });
  77 + }
  78 + });
  79 + } : function() { return this; },
  80 + unfixPNG: IE ? function() {
  81 + return this.each(function () {
  82 + $(this).css({'filter': '', backgroundImage: ''});
  83 + });
  84 + } : function() { return this; },
  85 + hideWhenEmpty: function() {
  86 + return this.each(function() {
  87 + $(this)[ $(this).html() ? "show" : "hide" ]();
  88 + });
  89 + },
  90 + url: function() {
  91 + return this.attr('href') || this.attr('src');
  92 + }
  93 + });
  94 +
  95 + function createHelper(settings) {
  96 + // there can be only one tooltip helper
  97 + if( helper.parent )
  98 + return;
  99 + // create the helper, h3 for title, div for url
  100 + helper.parent = $('<div id="' + settings.id + '"><h3></h3><div class="body"></div><div class="url"></div></div>')
  101 + // add to document
  102 + .appendTo(document.body)
  103 + // hide it at first
  104 + .hide();
  105 +
  106 + // apply bgiframe if available
  107 + if ( $.fn.bgiframe )
  108 + helper.parent.bgiframe();
  109 +
  110 + // save references to title and url elements
  111 + helper.title = $('h3', helper.parent);
  112 + helper.body = $('div.body', helper.parent);
  113 + helper.url = $('div.url', helper.parent);
  114 + }
  115 +
  116 + function settings(element) {
  117 + return $.data(element, "tooltip");
  118 + }
  119 +
  120 + // main event handler to start showing tooltips
  121 + function handle(event) {
  122 + // show helper, either with timeout or on instant
  123 + if( settings(this).delay )
  124 + tID = setTimeout(show, settings(this).delay);
  125 + else
  126 + show();
  127 +
  128 + // if selected, update the helper position when the mouse moves
  129 + track = !!settings(this).track;
  130 + $(document.body).bind('mousemove', update);
  131 +
  132 + // update at least once
  133 + update(event);
  134 + }
  135 +
  136 + // save elements title before the tooltip is displayed
  137 + function save() {
  138 + // if this is the current source, or it has no title (occurs with click event), stop
  139 + if ( $.tooltip.blocked || this == current || (!this.tooltipText && !settings(this).bodyHandler) )
  140 + return;
  141 +
  142 + // save current
  143 + current = this;
  144 + title = this.tooltipText;
  145 +
  146 + if ( settings(this).bodyHandler ) {
  147 + helper.title.hide();
  148 + var bodyContent = settings(this).bodyHandler.call(this);
  149 + if (bodyContent.nodeType || bodyContent.jquery) {
  150 + helper.body.empty().append(bodyContent)
  151 + } else {
  152 + helper.body.html( bodyContent );
  153 + }
  154 + helper.body.show();
  155 + } else if ( settings(this).showBody ) {
  156 + var parts = title.split(settings(this).showBody);
  157 + helper.title.html(parts.shift()).show();
  158 + helper.body.empty();
  159 + for(var i = 0, part; (part = parts[i]); i++) {
  160 + if(i > 0)
  161 + helper.body.append("<br/>");
  162 + helper.body.append(part);
  163 + }
  164 + helper.body.hideWhenEmpty();
  165 + } else {
  166 + helper.title.html(title).show();
  167 + helper.body.hide();
  168 + }
  169 +
  170 + // if element has href or src, add and show it, otherwise hide it
  171 + if( settings(this).showURL && $(this).url() )
  172 + helper.url.html( $(this).url().replace('http://', '') ).show();
  173 + else
  174 + helper.url.hide();
  175 +
  176 + // add an optional class for this tip
  177 + helper.parent.addClass(settings(this).extraClass);
  178 +
  179 + // fix PNG background for IE
  180 + if (settings(this).fixPNG )
  181 + helper.parent.fixPNG();
  182 +
  183 + handle.apply(this, arguments);
  184 + }
  185 +
  186 + // delete timeout and show helper
  187 + function show() {
  188 + tID = null;
  189 + if ((!IE || !$.fn.bgiframe) && settings(current).fade) {
  190 + if (helper.parent.is(":animated"))
  191 + helper.parent.stop().show().fadeTo(settings(current).fade, current.tOpacity);
  192 + else
  193 + helper.parent.is(':visible') ? helper.parent.fadeTo(settings(current).fade, current.tOpacity) : helper.parent.fadeIn(settings(current).fade);
  194 + } else {
  195 + helper.parent.show();
  196 + }
  197 + update();
  198 + }
  199 +
  200 + /**
  201 + * callback for mousemove
  202 + * updates the helper position
  203 + * removes itself when no current element
  204 + */
  205 + function update(event) {
  206 + if($.tooltip.blocked)
  207 + return;
  208 +
  209 + if (event && event.target.tagName == "OPTION") {
  210 + return;
  211 + }
  212 +
  213 + // stop updating when tracking is disabled and the tooltip is visible
  214 + if ( !track && helper.parent.is(":visible")) {
  215 + $(document.body).unbind('mousemove', update)
  216 + }
  217 +
  218 + // if no current element is available, remove this listener
  219 + if( current == null ) {
  220 + $(document.body).unbind('mousemove', update);
  221 + return;
  222 + }
  223 +
  224 + // remove position helper classes
  225 + helper.parent.removeClass("viewport-right").removeClass("viewport-bottom");
  226 +
  227 + var left = helper.parent[0].offsetLeft;
  228 + var top = helper.parent[0].offsetTop;
  229 + if (event) {
  230 + // position the helper 15 pixel to bottom right, starting from mouse position
  231 + left = event.pageX + settings(current).left;
  232 + top = event.pageY + settings(current).top;
  233 + var right='auto';
  234 + if (settings(current).positionLeft) {
  235 + right = $(window).width() - left;
  236 + left = 'auto';
  237 + }
  238 + helper.parent.css({
  239 + left: left,
  240 + right: right,
  241 + top: top
  242 + });
  243 + }
  244 +
  245 + var v = viewport(),
  246 + h = helper.parent[0];
  247 + // check horizontal position
  248 + if (v.x + v.cx < h.offsetLeft + h.offsetWidth) {
  249 + left -= h.offsetWidth + 20 + settings(current).left;
  250 + helper.parent.css({left: left + 'px'}).addClass("viewport-right");
  251 + }
  252 + // check vertical position
  253 + if (v.y + v.cy < h.offsetTop + h.offsetHeight) {
  254 + top -= h.offsetHeight + 20 + settings(current).top;
  255 + helper.parent.css({top: top + 'px'}).addClass("viewport-bottom");
  256 + }
  257 + }
  258 +
  259 + function viewport() {
  260 + return {
  261 + x: $(window).scrollLeft(),
  262 + y: $(window).scrollTop(),
  263 + cx: $(window).width(),
  264 + cy: $(window).height()
  265 + };
  266 + }
  267 +
  268 + // hide helper and restore added classes and the title
  269 + function hide(event) {
  270 + if($.tooltip.blocked)
  271 + return;
  272 + // clear timeout if possible
  273 + if(tID)
  274 + clearTimeout(tID);
  275 + // no more current element
  276 + current = null;
  277 +
  278 + var tsettings = settings(this);
  279 + function complete() {
  280 + helper.parent.removeClass( tsettings.extraClass ).hide().css("opacity", "");
  281 + }
  282 + if ((!IE || !$.fn.bgiframe) && tsettings.fade) {
  283 + if (helper.parent.is(':animated'))
  284 + helper.parent.stop().fadeTo(tsettings.fade, 0, complete);
  285 + else
  286 + helper.parent.stop().fadeOut(tsettings.fade, complete);
  287 + } else
  288 + complete();
  289 +
  290 + if( settings(this).fixPNG )
  291 + helper.parent.unfixPNG();
  292 + }
  293 +
  294 +})(jQuery);
setup/migrate/resources/jquery-tooltip/jquery.tooltip.min.js 0 → 100644
  1 +/*
  2 + * jQuery Tooltip plugin 1.3
  3 + *
  4 + * http://bassistance.de/jquery-plugins/jquery-plugin-tooltip/
  5 + * http://docs.jquery.com/Plugins/Tooltip
  6 + *
  7 + * Copyright (c) 2006 - 2008 Jörn Zaefferer
  8 + *
  9 + * $Id: jquery.tooltip.js 5741 2008-06-21 15:22:16Z joern.zaefferer $
  10 + *
  11 + * Dual licensed under the MIT and GPL licenses:
  12 + * http://www.opensource.org/licenses/mit-license.php
  13 + * http://www.gnu.org/licenses/gpl.html
  14 + */;(function($){var helper={},current,title,tID,IE=$.browser.msie&&/MSIE\s(5\.5|6\.)/.test(navigator.userAgent),track=false;$.tooltip={blocked:false,defaults:{delay:200,fade:false,showURL:true,extraClass:"",top:15,left:15,id:"tooltip"},block:function(){$.tooltip.blocked=!$.tooltip.blocked;}};$.fn.extend({tooltip:function(settings){settings=$.extend({},$.tooltip.defaults,settings);createHelper(settings);return this.each(function(){$.data(this,"tooltip",settings);this.tOpacity=helper.parent.css("opacity");this.tooltipText=this.title;$(this).removeAttr("title");this.alt="";}).mouseover(save).mouseout(hide).click(hide);},fixPNG:IE?function(){return this.each(function(){var image=$(this).css('backgroundImage');if(image.match(/^url\(["']?(.*\.png)["']?\)$/i)){image=RegExp.$1;$(this).css({'backgroundImage':'none','filter':"progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true, sizingMethod=crop, src='"+image+"')"}).each(function(){var position=$(this).css('position');if(position!='absolute'&&position!='relative')$(this).css('position','relative');});}});}:function(){return this;},unfixPNG:IE?function(){return this.each(function(){$(this).css({'filter':'',backgroundImage:''});});}:function(){return this;},hideWhenEmpty:function(){return this.each(function(){$(this)[$(this).html()?"show":"hide"]();});},url:function(){return this.attr('href')||this.attr('src');}});function createHelper(settings){if(helper.parent)return;helper.parent=$('<div id="'+settings.id+'"><h3></h3><div class="body"></div><div class="url"></div></div>').appendTo(document.body).hide();if($.fn.bgiframe)helper.parent.bgiframe();helper.title=$('h3',helper.parent);helper.body=$('div.body',helper.parent);helper.url=$('div.url',helper.parent);}function settings(element){return $.data(element,"tooltip");}function handle(event){if(settings(this).delay)tID=setTimeout(show,settings(this).delay);else
  15 +show();track=!!settings(this).track;$(document.body).bind('mousemove',update);update(event);}function save(){if($.tooltip.blocked||this==current||(!this.tooltipText&&!settings(this).bodyHandler))return;current=this;title=this.tooltipText;if(settings(this).bodyHandler){helper.title.hide();var bodyContent=settings(this).bodyHandler.call(this);if(bodyContent.nodeType||bodyContent.jquery){helper.body.empty().append(bodyContent)}else{helper.body.html(bodyContent);}helper.body.show();}else if(settings(this).showBody){var parts=title.split(settings(this).showBody);helper.title.html(parts.shift()).show();helper.body.empty();for(var i=0,part;(part=parts[i]);i++){if(i>0)helper.body.append("<br/>");helper.body.append(part);}helper.body.hideWhenEmpty();}else{helper.title.html(title).show();helper.body.hide();}if(settings(this).showURL&&$(this).url())helper.url.html($(this).url().replace('http://','')).show();else
  16 +helper.url.hide();helper.parent.addClass(settings(this).extraClass);if(settings(this).fixPNG)helper.parent.fixPNG();handle.apply(this,arguments);}function show(){tID=null;if((!IE||!$.fn.bgiframe)&&settings(current).fade){if(helper.parent.is(":animated"))helper.parent.stop().show().fadeTo(settings(current).fade,current.tOpacity);else
  17 +helper.parent.is(':visible')?helper.parent.fadeTo(settings(current).fade,current.tOpacity):helper.parent.fadeIn(settings(current).fade);}else{helper.parent.show();}update();}function update(event){if($.tooltip.blocked)return;if(event&&event.target.tagName=="OPTION"){return;}if(!track&&helper.parent.is(":visible")){$(document.body).unbind('mousemove',update)}if(current==null){$(document.body).unbind('mousemove',update);return;}helper.parent.removeClass("viewport-right").removeClass("viewport-bottom");var left=helper.parent[0].offsetLeft;var top=helper.parent[0].offsetTop;if(event){left=event.pageX+settings(current).left;top=event.pageY+settings(current).top;var right='auto';if(settings(current).positionLeft){right=$(window).width()-left;left='auto';}helper.parent.css({left:left,right:right,top:top});}var v=viewport(),h=helper.parent[0];if(v.x+v.cx<h.offsetLeft+h.offsetWidth){left-=h.offsetWidth+20+settings(current).left;helper.parent.css({left:left+'px'}).addClass("viewport-right");}if(v.y+v.cy<h.offsetTop+h.offsetHeight){top-=h.offsetHeight+20+settings(current).top;helper.parent.css({top:top+'px'}).addClass("viewport-bottom");}}function viewport(){return{x:$(window).scrollLeft(),y:$(window).scrollTop(),cx:$(window).width(),cy:$(window).height()};}function hide(event){if($.tooltip.blocked)return;if(tID)clearTimeout(tID);current=null;var tsettings=settings(this);function complete(){helper.parent.removeClass(tsettings.extraClass).hide().css("opacity","");}if((!IE||!$.fn.bgiframe)&&tsettings.fade){if(helper.parent.is(':animated'))helper.parent.stop().fadeTo(tsettings.fade,0,complete);else
  18 +helper.parent.stop().fadeOut(tsettings.fade,complete);}else
  19 +complete();if(settings(this).fixPNG)helper.parent.unfixPNG();}})(jQuery);
0 \ No newline at end of file 20 \ No newline at end of file
setup/migrate/resources/jquery-tooltip/jquery.tooltip.pack.js 0 → 100644
  1 +/*
  2 + * jQuery Tooltip plugin 1.3
  3 + *
  4 + * http://bassistance.de/jquery-plugins/jquery-plugin-tooltip/
  5 + * http://docs.jquery.com/Plugins/Tooltip
  6 + *
  7 + * Copyright (c) 2006 - 2008 Jörn Zaefferer
  8 + *
  9 + * $Id: jquery.tooltip.js 5741 2008-06-21 15:22:16Z joern.zaefferer $
  10 + *
  11 + * Dual licensed under the MIT and GPL licenses:
  12 + * http://www.opensource.org/licenses/mit-license.php
  13 + * http://www.gnu.org/licenses/gpl.html
  14 + */
  15 +eval(function(p,a,c,k,e,r){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}(';(8($){j e={},9,m,B,A=$.2u.2g&&/29\\s(5\\.5|6\\.)/.1M(1H.2t),M=12;$.k={w:12,1h:{Z:25,r:12,1d:19,X:"",G:15,E:15,16:"k"},2s:8(){$.k.w=!$.k.w}};$.N.1v({k:8(a){a=$.1v({},$.k.1h,a);1q(a);g 2.F(8(){$.1j(2,"k",a);2.11=e.3.n("1g");2.13=2.m;$(2).24("m");2.22=""}).21(1e).1U(q).1S(q)},H:A?8(){g 2.F(8(){j b=$(2).n(\'Y\');4(b.1J(/^o\\(["\']?(.*\\.1I)["\']?\\)$/i)){b=1F.$1;$(2).n({\'Y\':\'1D\',\'1B\':"2r:2q.2m.2l(2j=19, 2i=2h, 1p=\'"+b+"\')"}).F(8(){j a=$(2).n(\'1o\');4(a!=\'2f\'&&a!=\'1u\')$(2).n(\'1o\',\'1u\')})}})}:8(){g 2},1l:A?8(){g 2.F(8(){$(2).n({\'1B\':\'\',Y:\'\'})})}:8(){g 2},1x:8(){g 2.F(8(){$(2)[$(2).D()?"l":"q"]()})},o:8(){g 2.1k(\'28\')||2.1k(\'1p\')}});8 1q(a){4(e.3)g;e.3=$(\'<t 16="\'+a.16+\'"><10></10><t 1i="f"></t><t 1i="o"></t></t>\').27(K.f).q();4($.N.L)e.3.L();e.m=$(\'10\',e.3);e.f=$(\'t.f\',e.3);e.o=$(\'t.o\',e.3)}8 7(a){g $.1j(a,"k")}8 1f(a){4(7(2).Z)B=26(l,7(2).Z);p l();M=!!7(2).M;$(K.f).23(\'W\',u);u(a)}8 1e(){4($.k.w||2==9||(!2.13&&!7(2).U))g;9=2;m=2.13;4(7(2).U){e.m.q();j a=7(2).U.1Z(2);4(a.1Y||a.1V){e.f.1c().T(a)}p{e.f.D(a)}e.f.l()}p 4(7(2).18){j b=m.1T(7(2).18);e.m.D(b.1R()).l();e.f.1c();1Q(j i=0,R;(R=b[i]);i++){4(i>0)e.f.T("<1P/>");e.f.T(R)}e.f.1x()}p{e.m.D(m).l();e.f.q()}4(7(2).1d&&$(2).o())e.o.D($(2).o().1O(\'1N://\',\'\')).l();p e.o.q();e.3.P(7(2).X);4(7(2).H)e.3.H();1f.1L(2,1K)}8 l(){B=S;4((!A||!$.N.L)&&7(9).r){4(e.3.I(":17"))e.3.Q().l().O(7(9).r,9.11);p e.3.I(\':1a\')?e.3.O(7(9).r,9.11):e.3.1G(7(9).r)}p{e.3.l()}u()}8 u(c){4($.k.w)g;4(c&&c.1W.1X=="1E"){g}4(!M&&e.3.I(":1a")){$(K.f).1b(\'W\',u)}4(9==S){$(K.f).1b(\'W\',u);g}e.3.V("z-14").V("z-1A");j b=e.3[0].1z;j a=e.3[0].1y;4(c){b=c.2o+7(9).E;a=c.2n+7(9).G;j d=\'1w\';4(7(9).2k){d=$(C).1r()-b;b=\'1w\'}e.3.n({E:b,14:d,G:a})}j v=z(),h=e.3[0];4(v.x+v.1s<h.1z+h.1n){b-=h.1n+20+7(9).E;e.3.n({E:b+\'1C\'}).P("z-14")}4(v.y+v.1t<h.1y+h.1m){a-=h.1m+20+7(9).G;e.3.n({G:a+\'1C\'}).P("z-1A")}}8 z(){g{x:$(C).2e(),y:$(C).2d(),1s:$(C).1r(),1t:$(C).2p()}}8 q(a){4($.k.w)g;4(B)2c(B);9=S;j b=7(2);8 J(){e.3.V(b.X).q().n("1g","")}4((!A||!$.N.L)&&b.r){4(e.3.I(\':17\'))e.3.Q().O(b.r,0,J);p e.3.Q().2b(b.r,J)}p J();4(7(2).H)e.3.1l()}})(2a);',62,155,'||this|parent|if|||settings|function|current||||||body|return|||var|tooltip|show|title|css|url|else|hide|fade||div|update||blocked|||viewport|IE|tID|window|html|left|each|top|fixPNG|is|complete|document|bgiframe|track|fn|fadeTo|addClass|stop|part|null|append|bodyHandler|removeClass|mousemove|extraClass|backgroundImage|delay|h3|tOpacity|false|tooltipText|right||id|animated|showBody|true|visible|unbind|empty|showURL|save|handle|opacity|defaults|class|data|attr|unfixPNG|offsetHeight|offsetWidth|position|src|createHelper|width|cx|cy|relative|extend|auto|hideWhenEmpty|offsetTop|offsetLeft|bottom|filter|px|none|OPTION|RegExp|fadeIn|navigator|png|match|arguments|apply|test|http|replace|br|for|shift|click|split|mouseout|jquery|target|tagName|nodeType|call||mouseover|alt|bind|removeAttr|200|setTimeout|appendTo|href|MSIE|jQuery|fadeOut|clearTimeout|scrollTop|scrollLeft|absolute|msie|crop|sizingMethod|enabled|positionLeft|AlphaImageLoader|Microsoft|pageY|pageX|height|DXImageTransform|progid|block|userAgent|browser'.split('|'),0,{}))
0 \ No newline at end of file 16 \ No newline at end of file
setup/migrate/resources/jquery-tooltip/lib/jquery.bgiframe.js 0 → 100644
  1 +/* Copyright (c) 2006 Brandon Aaron (http://brandonaaron.net)
  2 + * Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php)
  3 + * and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses.
  4 + *
  5 + * $LastChangedDate: 2007-06-20 03:23:36 +0200 (Mi, 20 Jun 2007) $
  6 + * $Rev: 2110 $
  7 + *
  8 + * Version 2.1
  9 + */
  10 +
  11 +(function($){
  12 +
  13 +/**
  14 + * The bgiframe is chainable and applies the iframe hack to get
  15 + * around zIndex issues in IE6. It will only apply itself in IE
  16 + * and adds a class to the iframe called 'bgiframe'. The iframe
  17 + * is appeneded as the first child of the matched element(s)
  18 + * with a tabIndex and zIndex of -1.
  19 + *
  20 + * By default the plugin will take borders, sized with pixel units,
  21 + * into account. If a different unit is used for the border's width,
  22 + * then you will need to use the top and left settings as explained below.
  23 + *
  24 + * NOTICE: This plugin has been reported to cause perfromance problems
  25 + * when used on elements that change properties (like width, height and
  26 + * opacity) a lot in IE6. Most of these problems have been caused by
  27 + * the expressions used to calculate the elements width, height and
  28 + * borders. Some have reported it is due to the opacity filter. All
  29 + * these settings can be changed if needed as explained below.
  30 + *
  31 + * @example $('div').bgiframe();
  32 + * @before <div><p>Paragraph</p></div>
  33 + * @result <div><iframe class="bgiframe".../><p>Paragraph</p></div>
  34 + *
  35 + * @param Map settings Optional settings to configure the iframe.
  36 + * @option String|Number top The iframe must be offset to the top
  37 + * by the width of the top border. This should be a negative
  38 + * number representing the border-top-width. If a number is
  39 + * is used here, pixels will be assumed. Otherwise, be sure
  40 + * to specify a unit. An expression could also be used.
  41 + * By default the value is "auto" which will use an expression
  42 + * to get the border-top-width if it is in pixels.
  43 + * @option String|Number left The iframe must be offset to the left
  44 + * by the width of the left border. This should be a negative
  45 + * number representing the border-left-width. If a number is
  46 + * is used here, pixels will be assumed. Otherwise, be sure
  47 + * to specify a unit. An expression could also be used.
  48 + * By default the value is "auto" which will use an expression
  49 + * to get the border-left-width if it is in pixels.
  50 + * @option String|Number width This is the width of the iframe. If
  51 + * a number is used here, pixels will be assume. Otherwise, be sure
  52 + * to specify a unit. An experssion could also be used.
  53 + * By default the value is "auto" which will use an experssion
  54 + * to get the offsetWidth.
  55 + * @option String|Number height This is the height of the iframe. If
  56 + * a number is used here, pixels will be assume. Otherwise, be sure
  57 + * to specify a unit. An experssion could also be used.
  58 + * By default the value is "auto" which will use an experssion
  59 + * to get the offsetHeight.
  60 + * @option Boolean opacity This is a boolean representing whether or not
  61 + * to use opacity. If set to true, the opacity of 0 is applied. If
  62 + * set to false, the opacity filter is not applied. Default: true.
  63 + * @option String src This setting is provided so that one could change
  64 + * the src of the iframe to whatever they need.
  65 + * Default: "javascript:false;"
  66 + *
  67 + * @name bgiframe
  68 + * @type jQuery
  69 + * @cat Plugins/bgiframe
  70 + * @author Brandon Aaron (brandon.aaron@gmail.com || http://brandonaaron.net)
  71 + */
  72 +$.fn.bgIframe = $.fn.bgiframe = function(s) {
  73 + // This is only for IE6
  74 + if ( $.browser.msie && parseInt($.browser.version) <= 6 ) {
  75 + s = $.extend({
  76 + top : 'auto', // auto == .currentStyle.borderTopWidth
  77 + left : 'auto', // auto == .currentStyle.borderLeftWidth
  78 + width : 'auto', // auto == offsetWidth
  79 + height : 'auto', // auto == offsetHeight
  80 + opacity : true,
  81 + src : 'javascript:false;'
  82 + }, s || {});
  83 + var prop = function(n){return n&&n.constructor==Number?n+'px':n;},
  84 + html = '<iframe class="bgiframe"frameborder="0"tabindex="-1"src="'+s.src+'"'+
  85 + 'style="display:block;position:absolute;z-index:-1;'+
  86 + (s.opacity !== false?'filter:Alpha(Opacity=\'0\');':'')+
  87 + 'top:'+(s.top=='auto'?'expression(((parseInt(this.parentNode.currentStyle.borderTopWidth)||0)*-1)+\'px\')':prop(s.top))+';'+
  88 + 'left:'+(s.left=='auto'?'expression(((parseInt(this.parentNode.currentStyle.borderLeftWidth)||0)*-1)+\'px\')':prop(s.left))+';'+
  89 + 'width:'+(s.width=='auto'?'expression(this.parentNode.offsetWidth+\'px\')':prop(s.width))+';'+
  90 + 'height:'+(s.height=='auto'?'expression(this.parentNode.offsetHeight+\'px\')':prop(s.height))+';'+
  91 + '"/>';
  92 + return this.each(function() {
  93 + if ( $('> iframe.bgiframe', this).length == 0 )
  94 + this.insertBefore( document.createElement(html), this.firstChild );
  95 + });
  96 + }
  97 + return this;
  98 +};
  99 +
  100 +// Add browser.version if it doesn't exist
  101 +if (!$.browser.version)
  102 + $.browser.version = navigator.userAgent.toLowerCase().match(/.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/)[1];
  103 +
  104 +})(jQuery);
0 \ No newline at end of file 105 \ No newline at end of file
setup/migrate/resources/jquery-tooltip/lib/jquery.delegate.js 0 → 100644
  1 +/*
  2 + * jQuery delegate plug-in v1.0
  3 + *
  4 + * Copyright (c) 2007 Jörn Zaefferer
  5 + *
  6 + * $Id: jquery.delegate.js 4786 2008-02-19 20:02:34Z joern.zaefferer $
  7 + *
  8 + * Dual licensed under the MIT and GPL licenses:
  9 + * http://www.opensource.org/licenses/mit-license.php
  10 + * http://www.gnu.org/licenses/gpl.html
  11 + */
  12 +
  13 +// provides cross-browser focusin and focusout events
  14 +// IE has native support, in other browsers, use event caputuring (neither bubbles)
  15 +
  16 +// provides delegate(type: String, delegate: Selector, handler: Callback) plugin for easier event delegation
  17 +// handler is only called when $(event.target).is(delegate), in the scope of the jQuery-object for event.target
  18 +
  19 +// provides triggerEvent(type: String, target: Element) to trigger delegated events
  20 +;(function($) {
  21 + $.each({
  22 + focus: 'focusin',
  23 + blur: 'focusout'
  24 + }, function( original, fix ){
  25 + $.event.special[fix] = {
  26 + setup:function() {
  27 + if ( $.browser.msie ) return false;
  28 + this.addEventListener( original, $.event.special[fix].handler, true );
  29 + },
  30 + teardown:function() {
  31 + if ( $.browser.msie ) return false;
  32 + this.removeEventListener( original,
  33 + $.event.special[fix].handler, true );
  34 + },
  35 + handler: function(e) {
  36 + arguments[0] = $.event.fix(e);
  37 + arguments[0].type = fix;
  38 + return $.event.handle.apply(this, arguments);
  39 + }
  40 + };
  41 + });
  42 +
  43 + $.extend($.fn, {
  44 + delegate: function(type, delegate, handler) {
  45 + return this.bind(type, function(event) {
  46 + var target = $(event.target);
  47 + if (target.is(delegate)) {
  48 + return handler.apply(target, arguments);
  49 + }
  50 + });
  51 + },
  52 + triggerEvent: function(type, target) {
  53 + return this.triggerHandler(type, [jQuery.event.fix({ type: type, target: target })]);
  54 + }
  55 + })
  56 +})(jQuery);
setup/migrate/resources/jquery-tooltip/lib/jquery.dimensions.js 0 → 100644
  1 +/* Copyright (c) 2007 Paul Bakaus (paul.bakaus@googlemail.com) and Brandon Aaron (brandon.aaron@gmail.com || http://brandonaaron.net)
  2 + * Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php)
  3 + * and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses.
  4 + *
  5 + * $LastChangedDate: 2007-06-22 04:38:37 +0200 (Fr, 22 Jun 2007) $
  6 + * $Rev: 2141 $
  7 + *
  8 + * Version: 1.0b2
  9 + */
  10 +
  11 +(function($){
  12 +
  13 +// store a copy of the core height and width methods
  14 +var height = $.fn.height,
  15 + width = $.fn.width;
  16 +
  17 +$.fn.extend({
  18 + /**
  19 + * If used on document, returns the document's height (innerHeight)
  20 + * If used on window, returns the viewport's (window) height
  21 + * See core docs on height() to see what happens when used on an element.
  22 + *
  23 + * @example $("#testdiv").height()
  24 + * @result 200
  25 + *
  26 + * @example $(document).height()
  27 + * @result 800
  28 + *
  29 + * @example $(window).height()
  30 + * @result 400
  31 + *
  32 + * @name height
  33 + * @type Object
  34 + * @cat Plugins/Dimensions
  35 + */
  36 + height: function() {
  37 + if ( this[0] == window )
  38 + return self.innerHeight ||
  39 + $.boxModel && document.documentElement.clientHeight ||
  40 + document.body.clientHeight;
  41 +
  42 + if ( this[0] == document )
  43 + return Math.max( document.body.scrollHeight, document.body.offsetHeight );
  44 +
  45 + return height.apply(this, arguments);
  46 + },
  47 +
  48 + /**
  49 + * If used on document, returns the document's width (innerWidth)
  50 + * If used on window, returns the viewport's (window) width
  51 + * See core docs on height() to see what happens when used on an element.
  52 + *
  53 + * @example $("#testdiv").width()
  54 + * @result 200
  55 + *
  56 + * @example $(document).width()
  57 + * @result 800
  58 + *
  59 + * @example $(window).width()
  60 + * @result 400
  61 + *
  62 + * @name width
  63 + * @type Object
  64 + * @cat Plugins/Dimensions
  65 + */
  66 + width: function() {
  67 + if ( this[0] == window )
  68 + return self.innerWidth ||
  69 + $.boxModel && document.documentElement.clientWidth ||
  70 + document.body.clientWidth;
  71 +
  72 + if ( this[0] == document )
  73 + return Math.max( document.body.scrollWidth, document.body.offsetWidth );
  74 +
  75 + return width.apply(this, arguments);
  76 + },
  77 +
  78 + /**
  79 + * Returns the inner height value (without border) for the first matched element.
  80 + * If used on document, returns the document's height (innerHeight)
  81 + * If used on window, returns the viewport's (window) height
  82 + *
  83 + * @example $("#testdiv").innerHeight()
  84 + * @result 800
  85 + *
  86 + * @name innerHeight
  87 + * @type Number
  88 + * @cat Plugins/Dimensions
  89 + */
  90 + innerHeight: function() {
  91 + return this[0] == window || this[0] == document ?
  92 + this.height() :
  93 + this.is(':visible') ?
  94 + this[0].offsetHeight - num(this, 'borderTopWidth') - num(this, 'borderBottomWidth') :
  95 + this.height() + num(this, 'paddingTop') + num(this, 'paddingBottom');
  96 + },
  97 +
  98 + /**
  99 + * Returns the inner width value (without border) for the first matched element.
  100 + * If used on document, returns the document's Width (innerWidth)
  101 + * If used on window, returns the viewport's (window) width
  102 + *
  103 + * @example $("#testdiv").innerWidth()
  104 + * @result 1000
  105 + *
  106 + * @name innerWidth
  107 + * @type Number
  108 + * @cat Plugins/Dimensions
  109 + */
  110 + innerWidth: function() {
  111 + return this[0] == window || this[0] == document ?
  112 + this.width() :
  113 + this.is(':visible') ?
  114 + this[0].offsetWidth - num(this, 'borderLeftWidth') - num(this, 'borderRightWidth') :
  115 + this.width() + num(this, 'paddingLeft') + num(this, 'paddingRight');
  116 + },
  117 +
  118 + /**
  119 + * Returns the outer height value (including border) for the first matched element.
  120 + * Cannot be used on document or window.
  121 + *
  122 + * @example $("#testdiv").outerHeight()
  123 + * @result 1000
  124 + *
  125 + * @name outerHeight
  126 + * @type Number
  127 + * @cat Plugins/Dimensions
  128 + */
  129 + outerHeight: function() {
  130 + return this[0] == window || this[0] == document ?
  131 + this.height() :
  132 + this.is(':visible') ?
  133 + this[0].offsetHeight :
  134 + this.height() + num(this,'borderTopWidth') + num(this, 'borderBottomWidth') + num(this, 'paddingTop') + num(this, 'paddingBottom');
  135 + },
  136 +
  137 + /**
  138 + * Returns the outer width value (including border) for the first matched element.
  139 + * Cannot be used on document or window.
  140 + *
  141 + * @example $("#testdiv").outerHeight()
  142 + * @result 1000
  143 + *
  144 + * @name outerHeight
  145 + * @type Number
  146 + * @cat Plugins/Dimensions
  147 + */
  148 + outerWidth: function() {
  149 + return this[0] == window || this[0] == document ?
  150 + this.width() :
  151 + this.is(':visible') ?
  152 + this[0].offsetWidth :
  153 + this.width() + num(this, 'borderLeftWidth') + num(this, 'borderRightWidth') + num(this, 'paddingLeft') + num(this, 'paddingRight');
  154 + },
  155 +
  156 + /**
  157 + * Returns how many pixels the user has scrolled to the right (scrollLeft).
  158 + * Works on containers with overflow: auto and window/document.
  159 + *
  160 + * @example $("#testdiv").scrollLeft()
  161 + * @result 100
  162 + *
  163 + * @name scrollLeft
  164 + * @type Number
  165 + * @cat Plugins/Dimensions
  166 + */
  167 + /**
  168 + * Sets the scrollLeft property and continues the chain.
  169 + * Works on containers with overflow: auto and window/document.
  170 + *
  171 + * @example $("#testdiv").scrollLeft(10).scrollLeft()
  172 + * @result 10
  173 + *
  174 + * @name scrollLeft
  175 + * @param Number value A positive number representing the desired scrollLeft.
  176 + * @type jQuery
  177 + * @cat Plugins/Dimensions
  178 + */
  179 + scrollLeft: function(val) {
  180 + if ( val != undefined )
  181 + // set the scroll left
  182 + return this.each(function() {
  183 + if (this == window || this == document)
  184 + window.scrollTo( val, $(window).scrollTop() );
  185 + else
  186 + this.scrollLeft = val;
  187 + });
  188 +
  189 + // return the scroll left offest in pixels
  190 + if ( this[0] == window || this[0] == document )
  191 + return self.pageXOffset ||
  192 + $.boxModel && document.documentElement.scrollLeft ||
  193 + document.body.scrollLeft;
  194 +
  195 + return this[0].scrollLeft;
  196 + },
  197 +
  198 + /**
  199 + * Returns how many pixels the user has scrolled to the bottom (scrollTop).
  200 + * Works on containers with overflow: auto and window/document.
  201 + *
  202 + * @example $("#testdiv").scrollTop()
  203 + * @result 100
  204 + *
  205 + * @name scrollTop
  206 + * @type Number
  207 + * @cat Plugins/Dimensions
  208 + */
  209 + /**
  210 + * Sets the scrollTop property and continues the chain.
  211 + * Works on containers with overflow: auto and window/document.
  212 + *
  213 + * @example $("#testdiv").scrollTop(10).scrollTop()
  214 + * @result 10
  215 + *
  216 + * @name scrollTop
  217 + * @param Number value A positive number representing the desired scrollTop.
  218 + * @type jQuery
  219 + * @cat Plugins/Dimensions
  220 + */
  221 + scrollTop: function(val) {
  222 + if ( val != undefined )
  223 + // set the scroll top
  224 + return this.each(function() {
  225 + if (this == window || this == document)
  226 + window.scrollTo( $(window).scrollLeft(), val );
  227 + else
  228 + this.scrollTop = val;
  229 + });
  230 +
  231 + // return the scroll top offset in pixels
  232 + if ( this[0] == window || this[0] == document )
  233 + return self.pageYOffset ||
  234 + $.boxModel && document.documentElement.scrollTop ||
  235 + document.body.scrollTop;
  236 +
  237 + return this[0].scrollTop;
  238 + },
  239 +
  240 + /**
  241 + * Returns the top and left positioned offset in pixels.
  242 + * The positioned offset is the offset between a positioned
  243 + * parent and the element itself.
  244 + *
  245 + * @example $("#testdiv").position()
  246 + * @result { top: 100, left: 100 }
  247 + *
  248 + * @name position
  249 + * @param Map options Optional settings to configure the way the offset is calculated.
  250 + * @option Boolean margin Should the margin of the element be included in the calculations? False by default.
  251 + * @option Boolean border Should the border of the element be included in the calculations? False by default.
  252 + * @option Boolean padding Should the padding of the element be included in the calculations? False by default.
  253 + * @param Object returnObject An object to store the return value in, so as not to break the chain. If passed in the
  254 + * chain will not be broken and the result will be assigned to this object.
  255 + * @type Object
  256 + * @cat Plugins/Dimensions
  257 + */
  258 + position: function(options, returnObject) {
  259 + var elem = this[0], parent = elem.parentNode, op = elem.offsetParent,
  260 + options = $.extend({ margin: false, border: false, padding: false, scroll: false }, options || {}),
  261 + x = elem.offsetLeft,
  262 + y = elem.offsetTop,
  263 + sl = elem.scrollLeft,
  264 + st = elem.scrollTop;
  265 +
  266 + // Mozilla and IE do not add the border
  267 + if ($.browser.mozilla || $.browser.msie) {
  268 + // add borders to offset
  269 + x += num(elem, 'borderLeftWidth');
  270 + y += num(elem, 'borderTopWidth');
  271 + }
  272 +
  273 + if ($.browser.mozilla) {
  274 + do {
  275 + // Mozilla does not add the border for a parent that has overflow set to anything but visible
  276 + if ($.browser.mozilla && parent != elem && $.css(parent, 'overflow') != 'visible') {
  277 + x += num(parent, 'borderLeftWidth');
  278 + y += num(parent, 'borderTopWidth');
  279 + }
  280 +
  281 + if (parent == op) break; // break if we are already at the offestParent
  282 + } while ((parent = parent.parentNode) && (parent.tagName.toLowerCase() != 'body' || parent.tagName.toLowerCase() != 'html'));
  283 + }
  284 +
  285 + var returnValue = handleOffsetReturn(elem, options, x, y, sl, st);
  286 +
  287 + if (returnObject) { $.extend(returnObject, returnValue); return this; }
  288 + else { return returnValue; }
  289 + },
  290 +
  291 + /**
  292 + * Returns the location of the element in pixels from the top left corner of the viewport.
  293 + *
  294 + * For accurate readings make sure to use pixel values for margins, borders and padding.
  295 + *
  296 + * Known issues:
  297 + * - Issue: A div positioned relative or static without any content before it and its parent will report an offsetTop of 0 in Safari
  298 + * Workaround: Place content before the relative div ... and set height and width to 0 and overflow to hidden
  299 + *
  300 + * @example $("#testdiv").offset()
  301 + * @result { top: 100, left: 100, scrollTop: 10, scrollLeft: 10 }
  302 + *
  303 + * @example $("#testdiv").offset({ scroll: false })
  304 + * @result { top: 90, left: 90 }
  305 + *
  306 + * @example var offset = {}
  307 + * $("#testdiv").offset({ scroll: false }, offset)
  308 + * @result offset = { top: 90, left: 90 }
  309 + *
  310 + * @name offset
  311 + * @param Map options Optional settings to configure the way the offset is calculated.
  312 + * @option Boolean margin Should the margin of the element be included in the calculations? True by default.
  313 + * @option Boolean border Should the border of the element be included in the calculations? False by default.
  314 + * @option Boolean padding Should the padding of the element be included in the calculations? False by default.
  315 + * @option Boolean scroll Should the scroll offsets of the parent elements be included in the calculations? True by default.
  316 + * When true it adds the totla scroll offets of all parents to the total offset and also adds two properties
  317 + * to the returned object, scrollTop and scrollLeft.
  318 + * @options Boolean lite Will use offsetLite instead of offset when set to true. False by default.
  319 + * @param Object returnObject An object to store the return value in, so as not to break the chain. If passed in the
  320 + * chain will not be broken and the result will be assigned to this object.
  321 + * @type Object
  322 + * @cat Plugins/Dimensions
  323 + */
  324 + offset: function(options, returnObject) {
  325 + var x = 0, y = 0, sl = 0, st = 0,
  326 + elem = this[0], parent = this[0], op, parPos, elemPos = $.css(elem, 'position'),
  327 + mo = $.browser.mozilla, ie = $.browser.msie, sf = $.browser.safari, oa = $.browser.opera,
  328 + absparent = false, relparent = false,
  329 + options = $.extend({ margin: true, border: false, padding: false, scroll: true, lite: false }, options || {});
  330 +
  331 + // Use offsetLite if lite option is true
  332 + if (options.lite) return this.offsetLite(options, returnObject);
  333 +
  334 + if (elem.tagName.toLowerCase() == 'body') {
  335 + // Safari is the only one to get offsetLeft and offsetTop properties of the body "correct"
  336 + // Except they all mess up when the body is positioned absolute or relative
  337 + x = elem.offsetLeft;
  338 + y = elem.offsetTop;
  339 + // Mozilla ignores margin and subtracts border from body element
  340 + if (mo) {
  341 + x += num(elem, 'marginLeft') + (num(elem, 'borderLeftWidth')*2);
  342 + y += num(elem, 'marginTop') + (num(elem, 'borderTopWidth') *2);
  343 + } else
  344 + // Opera ignores margin
  345 + if (oa) {
  346 + x += num(elem, 'marginLeft');
  347 + y += num(elem, 'marginTop');
  348 + } else
  349 + // IE does not add the border in Standards Mode
  350 + if (ie && jQuery.boxModel) {
  351 + x += num(elem, 'borderLeftWidth');
  352 + y += num(elem, 'borderTopWidth');
  353 + }
  354 + } else {
  355 + do {
  356 + parPos = $.css(parent, 'position');
  357 +
  358 + x += parent.offsetLeft;
  359 + y += parent.offsetTop;
  360 +
  361 + // Mozilla and IE do not add the border
  362 + if (mo || ie) {
  363 + // add borders to offset
  364 + x += num(parent, 'borderLeftWidth');
  365 + y += num(parent, 'borderTopWidth');
  366 +
  367 + // Mozilla does not include the border on body if an element isn't positioned absolute and is without an absolute parent
  368 + if (mo && parPos == 'absolute') absparent = true;
  369 + // IE does not include the border on the body if an element is position static and without an absolute or relative parent
  370 + if (ie && parPos == 'relative') relparent = true;
  371 + }
  372 +
  373 + op = parent.offsetParent;
  374 + if (options.scroll || mo) {
  375 + do {
  376 + if (options.scroll) {
  377 + // get scroll offsets
  378 + sl += parent.scrollLeft;
  379 + st += parent.scrollTop;
  380 + }
  381 +
  382 + // Mozilla does not add the border for a parent that has overflow set to anything but visible
  383 + if (mo && parent != elem && $.css(parent, 'overflow') != 'visible') {
  384 + x += num(parent, 'borderLeftWidth');
  385 + y += num(parent, 'borderTopWidth');
  386 + }
  387 +
  388 + parent = parent.parentNode;
  389 + } while (parent != op);
  390 + }
  391 + parent = op;
  392 +
  393 + if (parent.tagName.toLowerCase() == 'body' || parent.tagName.toLowerCase() == 'html') {
  394 + // Safari and IE Standards Mode doesn't add the body margin for elments positioned with static or relative
  395 + if ((sf || (ie && $.boxModel)) && elemPos != 'absolute' && elemPos != 'fixed') {
  396 + x += num(parent, 'marginLeft');
  397 + y += num(parent, 'marginTop');
  398 + }
  399 + // Mozilla does not include the border on body if an element isn't positioned absolute and is without an absolute parent
  400 + // IE does not include the border on the body if an element is positioned static and without an absolute or relative parent
  401 + if ( (mo && !absparent && elemPos != 'fixed') ||
  402 + (ie && elemPos == 'static' && !relparent) ) {
  403 + x += num(parent, 'borderLeftWidth');
  404 + y += num(parent, 'borderTopWidth');
  405 + }
  406 + break; // Exit the loop
  407 + }
  408 + } while (parent);
  409 + }
  410 +
  411 + var returnValue = handleOffsetReturn(elem, options, x, y, sl, st);
  412 +
  413 + if (returnObject) { $.extend(returnObject, returnValue); return this; }
  414 + else { return returnValue; }
  415 + },
  416 +
  417 + /**
  418 + * Returns the location of the element in pixels from the top left corner of the viewport.
  419 + * This method is much faster than offset but not as accurate. This method can be invoked
  420 + * by setting the lite option to true in the offset method.
  421 + *
  422 + * @name offsetLite
  423 + * @param Map options Optional settings to configure the way the offset is calculated.
  424 + * @option Boolean margin Should the margin of the element be included in the calculations? True by default.
  425 + * @option Boolean border Should the border of the element be included in the calculations? False by default.
  426 + * @option Boolean padding Should the padding of the element be included in the calculations? False by default.
  427 + * @option Boolean scroll Should the scroll offsets of the parent elements be included in the calculations? True by default.
  428 + * When true it adds the totla scroll offets of all parents to the total offset and also adds two properties
  429 + * to the returned object, scrollTop and scrollLeft.
  430 + * @param Object returnObject An object to store the return value in, so as not to break the chain. If passed in the
  431 + * chain will not be broken and the result will be assigned to this object.
  432 + * @type Object
  433 + * @cat Plugins/Dimensions
  434 + */
  435 + offsetLite: function(options, returnObject) {
  436 + var x = 0, y = 0, sl = 0, st = 0, parent = this[0], op,
  437 + options = $.extend({ margin: true, border: false, padding: false, scroll: true }, options || {});
  438 +
  439 + do {
  440 + x += parent.offsetLeft;
  441 + y += parent.offsetTop;
  442 +
  443 + op = parent.offsetParent;
  444 + if (options.scroll) {
  445 + // get scroll offsets
  446 + do {
  447 + sl += parent.scrollLeft;
  448 + st += parent.scrollTop;
  449 + parent = parent.parentNode;
  450 + } while(parent != op);
  451 + }
  452 + parent = op;
  453 + } while (parent && parent.tagName.toLowerCase() != 'body' && parent.tagName.toLowerCase() != 'html');
  454 +
  455 + var returnValue = handleOffsetReturn(this[0], options, x, y, sl, st);
  456 +
  457 + if (returnObject) { $.extend(returnObject, returnValue); return this; }
  458 + else { return returnValue; }
  459 + }
  460 +});
  461 +
  462 +/**
  463 + * Handles converting a CSS Style into an Integer.
  464 + * @private
  465 + */
  466 +var num = function(el, prop) {
  467 + return parseInt($.css(el.jquery?el[0]:el,prop))||0;
  468 +};
  469 +
  470 +/**
  471 + * Handles the return value of the offset and offsetLite methods.
  472 + * @private
  473 + */
  474 +var handleOffsetReturn = function(elem, options, x, y, sl, st) {
  475 + if ( !options.margin ) {
  476 + x -= num(elem, 'marginLeft');
  477 + y -= num(elem, 'marginTop');
  478 + }
  479 +
  480 + // Safari and Opera do not add the border for the element
  481 + if ( options.border && ($.browser.safari || $.browser.opera) ) {
  482 + x += num(elem, 'borderLeftWidth');
  483 + y += num(elem, 'borderTopWidth');
  484 + } else if ( !options.border && !($.browser.safari || $.browser.opera) ) {
  485 + x -= num(elem, 'borderLeftWidth');
  486 + y -= num(elem, 'borderTopWidth');
  487 + }
  488 +
  489 + if ( options.padding ) {
  490 + x += num(elem, 'paddingLeft');
  491 + y += num(elem, 'paddingTop');
  492 + }
  493 +
  494 + // do not include scroll offset on the element
  495 + if ( options.scroll ) {
  496 + sl -= elem.scrollLeft;
  497 + st -= elem.scrollTop;
  498 + }
  499 +
  500 + return options.scroll ? { top: y - st, left: x - sl, scrollTop: st, scrollLeft: sl }
  501 + : { top: y, left: x };
  502 +};
  503 +
  504 +})(jQuery);
0 \ No newline at end of file 505 \ No newline at end of file
setup/migrate/resources/jquery-tooltip/lib/jquery.js 0 → 100644
  1 +(function(){
  2 +/*
  3 + * jQuery 1.2.2 - New Wave Javascript
  4 + *
  5 + * Copyright (c) 2007 John Resig (jquery.com)
  6 + * Dual licensed under the MIT (MIT-LICENSE.txt)
  7 + * and GPL (GPL-LICENSE.txt) licenses.
  8 + *
  9 + * $Date: 2008-01-14 17:56:07 -0500 (Mon, 14 Jan 2008) $
  10 + * $Rev: 4454 $
  11 + */
  12 +
  13 +// Map over jQuery in case of overwrite
  14 +if ( window.jQuery )
  15 + var _jQuery = window.jQuery;
  16 +
  17 +var jQuery = window.jQuery = function( selector, context ) {
  18 + // The jQuery object is actually just the init constructor 'enhanced'
  19 + return new jQuery.prototype.init( selector, context );
  20 +};
  21 +
  22 +// Map over the $ in case of overwrite
  23 +if ( window.$ )
  24 + var _$ = window.$;
  25 +
  26 +// Map the jQuery namespace to the '$' one
  27 +window.$ = jQuery;
  28 +
  29 +// A simple way to check for HTML strings or ID strings
  30 +// (both of which we optimize for)
  31 +var quickExpr = /^[^<]*(<(.|\s)+>)[^>]*$|^#(\w+)$/;
  32 +
  33 +// Is it a simple selector
  34 +var isSimple = /^.[^:#\[\.]*$/;
  35 +
  36 +jQuery.fn = jQuery.prototype = {
  37 + init: function( selector, context ) {
  38 + // Make sure that a selection was provided
  39 + selector = selector || document;
  40 +
  41 + // Handle $(DOMElement)
  42 + if ( selector.nodeType ) {
  43 + this[0] = selector;
  44 + this.length = 1;
  45 + return this;
  46 +
  47 + // Handle HTML strings
  48 + } else if ( typeof selector == "string" ) {
  49 + // Are we dealing with HTML string or an ID?
  50 + var match = quickExpr.exec( selector );
  51 +
  52 + // Verify a match, and that no context was specified for #id
  53 + if ( match && (match[1] || !context) ) {
  54 +
  55 + // HANDLE: $(html) -> $(array)
  56 + if ( match[1] )
  57 + selector = jQuery.clean( [ match[1] ], context );
  58 +
  59 + // HANDLE: $("#id")
  60 + else {
  61 + var elem = document.getElementById( match[3] );
  62 +
  63 + // Make sure an element was located
  64 + if ( elem )
  65 + // Handle the case where IE and Opera return items
  66 + // by name instead of ID
  67 + if ( elem.id != match[3] )
  68 + return jQuery().find( selector );
  69 +
  70 + // Otherwise, we inject the element directly into the jQuery object
  71 + else {
  72 + this[0] = elem;
  73 + this.length = 1;
  74 + return this;
  75 + }
  76 +
  77 + else
  78 + selector = [];
  79 + }
  80 +
  81 + // HANDLE: $(expr, [context])
  82 + // (which is just equivalent to: $(content).find(expr)
  83 + } else
  84 + return new jQuery( context ).find( selector );
  85 +
  86 + // HANDLE: $(function)
  87 + // Shortcut for document ready
  88 + } else if ( jQuery.isFunction( selector ) )
  89 + return new jQuery( document )[ jQuery.fn.ready ? "ready" : "load" ]( selector );
  90 +
  91 + return this.setArray(
  92 + // HANDLE: $(array)
  93 + selector.constructor == Array && selector ||
  94 +
  95 + // HANDLE: $(arraylike)
  96 + // Watch for when an array-like object, contains DOM nodes, is passed in as the selector
  97 + (selector.jquery || selector.length && selector != window && !selector.nodeType && selector[0] != undefined && selector[0].nodeType) && jQuery.makeArray( selector ) ||
  98 +
  99 + // HANDLE: $(*)
  100 + [ selector ] );
  101 + },
  102 +
  103 + // The current version of jQuery being used
  104 + jquery: "1.2.2",
  105 +
  106 + // The number of elements contained in the matched element set
  107 + size: function() {
  108 + return this.length;
  109 + },
  110 +
  111 + // The number of elements contained in the matched element set
  112 + length: 0,
  113 +
  114 + // Get the Nth element in the matched element set OR
  115 + // Get the whole matched element set as a clean array
  116 + get: function( num ) {
  117 + return num == undefined ?
  118 +
  119 + // Return a 'clean' array
  120 + jQuery.makeArray( this ) :
  121 +
  122 + // Return just the object
  123 + this[ num ];
  124 + },
  125 +
  126 + // Take an array of elements and push it onto the stack
  127 + // (returning the new matched element set)
  128 + pushStack: function( elems ) {
  129 + // Build a new jQuery matched element set
  130 + var ret = jQuery( elems );
  131 +
  132 + // Add the old object onto the stack (as a reference)
  133 + ret.prevObject = this;
  134 +
  135 + // Return the newly-formed element set
  136 + return ret;
  137 + },
  138 +
  139 + // Force the current matched set of elements to become
  140 + // the specified array of elements (destroying the stack in the process)
  141 + // You should use pushStack() in order to do this, but maintain the stack
  142 + setArray: function( elems ) {
  143 + // Resetting the length to 0, then using the native Array push
  144 + // is a super-fast way to populate an object with array-like properties
  145 + this.length = 0;
  146 + Array.prototype.push.apply( this, elems );
  147 +
  148 + return this;
  149 + },
  150 +
  151 + // Execute a callback for every element in the matched set.
  152 + // (You can seed the arguments with an array of args, but this is
  153 + // only used internally.)
  154 + each: function( callback, args ) {
  155 + return jQuery.each( this, callback, args );
  156 + },
  157 +
  158 + // Determine the position of an element within
  159 + // the matched set of elements
  160 + index: function( elem ) {
  161 + var ret = -1;
  162 +
  163 + // Locate the position of the desired element
  164 + this.each(function(i){
  165 + if ( this == elem )
  166 + ret = i;
  167 + });
  168 +
  169 + return ret;
  170 + },
  171 +
  172 + attr: function( name, value, type ) {
  173 + var options = name;
  174 +
  175 + // Look for the case where we're accessing a style value
  176 + if ( name.constructor == String )
  177 + if ( value == undefined )
  178 + return this.length && jQuery[ type || "attr" ]( this[0], name ) || undefined;
  179 +
  180 + else {
  181 + options = {};
  182 + options[ name ] = value;
  183 + }
  184 +
  185 + // Check to see if we're setting style values
  186 + return this.each(function(i){
  187 + // Set all the styles
  188 + for ( name in options )
  189 + jQuery.attr(
  190 + type ?
  191 + this.style :
  192 + this,
  193 + name, jQuery.prop( this, options[ name ], type, i, name )
  194 + );
  195 + });
  196 + },
  197 +
  198 + css: function( key, value ) {
  199 + // ignore negative width and height values
  200 + if ( (key == 'width' || key == 'height') && parseFloat(value) < 0 )
  201 + value = undefined;
  202 + return this.attr( key, value, "curCSS" );
  203 + },
  204 +
  205 + text: function( text ) {
  206 + if ( typeof text != "object" && text != null )
  207 + return this.empty().append( (this[0] && this[0].ownerDocument || document).createTextNode( text ) );
  208 +
  209 + var ret = "";
  210 +
  211 + jQuery.each( text || this, function(){
  212 + jQuery.each( this.childNodes, function(){
  213 + if ( this.nodeType != 8 )
  214 + ret += this.nodeType != 1 ?
  215 + this.nodeValue :
  216 + jQuery.fn.text( [ this ] );
  217 + });
  218 + });
  219 +
  220 + return ret;
  221 + },
  222 +
  223 + wrapAll: function( html ) {
  224 + if ( this[0] )
  225 + // The elements to wrap the target around
  226 + jQuery( html, this[0].ownerDocument )
  227 + .clone()
  228 + .insertBefore( this[0] )
  229 + .map(function(){
  230 + var elem = this;
  231 +
  232 + while ( elem.firstChild )
  233 + elem = elem.firstChild;
  234 +
  235 + return elem;
  236 + })
  237 + .append(this);
  238 +
  239 + return this;
  240 + },
  241 +
  242 + wrapInner: function( html ) {
  243 + return this.each(function(){
  244 + jQuery( this ).contents().wrapAll( html );
  245 + });
  246 + },
  247 +
  248 + wrap: function( html ) {
  249 + return this.each(function(){
  250 + jQuery( this ).wrapAll( html );
  251 + });
  252 + },
  253 +
  254 + append: function() {
  255 + return this.domManip(arguments, true, false, function(elem){
  256 + if (this.nodeType == 1)
  257 + this.appendChild( elem );
  258 + });
  259 + },
  260 +
  261 + prepend: function() {
  262 + return this.domManip(arguments, true, true, function(elem){
  263 + if (this.nodeType == 1)
  264 + this.insertBefore( elem, this.firstChild );
  265 + });
  266 + },
  267 +
  268 + before: function() {
  269 + return this.domManip(arguments, false, false, function(elem){
  270 + this.parentNode.insertBefore( elem, this );
  271 + });
  272 + },
  273 +
  274 + after: function() {
  275 + return this.domManip(arguments, false, true, function(elem){
  276 + this.parentNode.insertBefore( elem, this.nextSibling );
  277 + });
  278 + },
  279 +
  280 + end: function() {
  281 + return this.prevObject || jQuery( [] );
  282 + },
  283 +
  284 + find: function( selector ) {
  285 + var elems = jQuery.map(this, function(elem){
  286 + return jQuery.find( selector, elem );
  287 + });
  288 +
  289 + return this.pushStack( /[^+>] [^+>]/.test( selector ) || selector.indexOf("..") > -1 ?
  290 + jQuery.unique( elems ) :
  291 + elems );
  292 + },
  293 +
  294 + clone: function( events ) {
  295 + // Do the clone
  296 + var ret = this.map(function(){
  297 + if ( jQuery.browser.msie && !jQuery.isXMLDoc(this) ) {
  298 + // IE copies events bound via attachEvent when
  299 + // using cloneNode. Calling detachEvent on the
  300 + // clone will also remove the events from the orignal
  301 + // In order to get around this, we use innerHTML.
  302 + // Unfortunately, this means some modifications to
  303 + // attributes in IE that are actually only stored
  304 + // as properties will not be copied (such as the
  305 + // the name attribute on an input).
  306 + var clone = this.cloneNode(true),
  307 + container = document.createElement("div"),
  308 + container2 = document.createElement("div");
  309 + container.appendChild(clone);
  310 + container2.innerHTML = container.innerHTML;
  311 + return container2.firstChild;
  312 + } else
  313 + return this.cloneNode(true);
  314 + });
  315 +
  316 + // Need to set the expando to null on the cloned set if it exists
  317 + // removeData doesn't work here, IE removes it from the original as well
  318 + // this is primarily for IE but the data expando shouldn't be copied over in any browser
  319 + var clone = ret.find("*").andSelf().each(function(){
  320 + if ( this[ expando ] != undefined )
  321 + this[ expando ] = null;
  322 + });
  323 +
  324 + // Copy the events from the original to the clone
  325 + if ( events === true )
  326 + this.find("*").andSelf().each(function(i){
  327 + if (this.nodeType == 3)
  328 + return;
  329 + var events = jQuery.data( this, "events" );
  330 +
  331 + for ( var type in events )
  332 + for ( var handler in events[ type ] )
  333 + jQuery.event.add( clone[ i ], type, events[ type ][ handler ], events[ type ][ handler ].data );
  334 + });
  335 +
  336 + // Return the cloned set
  337 + return ret;
  338 + },
  339 +
  340 + filter: function( selector ) {
  341 + return this.pushStack(
  342 + jQuery.isFunction( selector ) &&
  343 + jQuery.grep(this, function(elem, i){
  344 + return selector.call( elem, i );
  345 + }) ||
  346 +
  347 + jQuery.multiFilter( selector, this ) );
  348 + },
  349 +
  350 + not: function( selector ) {
  351 + if ( selector.constructor == String )
  352 + // test special case where just one selector is passed in
  353 + if ( isSimple.test( selector ) )
  354 + return this.pushStack( jQuery.multiFilter( selector, this, true ) );
  355 + else
  356 + selector = jQuery.multiFilter( selector, this );
  357 +
  358 + var isArrayLike = selector.length && selector[selector.length - 1] !== undefined && !selector.nodeType;
  359 + return this.filter(function() {
  360 + return isArrayLike ? jQuery.inArray( this, selector ) < 0 : this != selector;
  361 + });
  362 + },
  363 +
  364 + add: function( selector ) {
  365 + return !selector ? this : this.pushStack( jQuery.merge(
  366 + this.get(),
  367 + selector.constructor == String ?
  368 + jQuery( selector ).get() :
  369 + selector.length != undefined && (!selector.nodeName || jQuery.nodeName(selector, "form")) ?
  370 + selector : [selector] ) );
  371 + },
  372 +
  373 + is: function( selector ) {
  374 + return selector ?
  375 + jQuery.multiFilter( selector, this ).length > 0 :
  376 + false;
  377 + },
  378 +
  379 + hasClass: function( selector ) {
  380 + return this.is( "." + selector );
  381 + },
  382 +
  383 + val: function( value ) {
  384 + if ( value == undefined ) {
  385 +
  386 + if ( this.length ) {
  387 + var elem = this[0];
  388 +
  389 + // We need to handle select boxes special
  390 + if ( jQuery.nodeName( elem, "select" ) ) {
  391 + var index = elem.selectedIndex,
  392 + values = [],
  393 + options = elem.options,
  394 + one = elem.type == "select-one";
  395 +
  396 + // Nothing was selected
  397 + if ( index < 0 )
  398 + return null;
  399 +
  400 + // Loop through all the selected options
  401 + for ( var i = one ? index : 0, max = one ? index + 1 : options.length; i < max; i++ ) {
  402 + var option = options[ i ];
  403 +
  404 + if ( option.selected ) {
  405 + // Get the specifc value for the option
  406 + value = jQuery.browser.msie && !option.attributes.value.specified ? option.text : option.value;
  407 +
  408 + // We don't need an array for one selects
  409 + if ( one )
  410 + return value;
  411 +
  412 + // Multi-Selects return an array
  413 + values.push( value );
  414 + }
  415 + }
  416 +
  417 + return values;
  418 +
  419 + // Everything else, we just grab the value
  420 + } else
  421 + return (this[0].value || "").replace(/\r/g, "");
  422 +
  423 + }
  424 +
  425 + return undefined;
  426 + }
  427 +
  428 + return this.each(function(){
  429 + if ( this.nodeType != 1 )
  430 + return;
  431 +
  432 + if ( value.constructor == Array && /radio|checkbox/.test( this.type ) )
  433 + this.checked = (jQuery.inArray(this.value, value) >= 0 ||
  434 + jQuery.inArray(this.name, value) >= 0);
  435 +
  436 + else if ( jQuery.nodeName( this, "select" ) ) {
  437 + var values = value.constructor == Array ?
  438 + value :
  439 + [ value ];
  440 +
  441 + jQuery( "option", this ).each(function(){
  442 + this.selected = (jQuery.inArray( this.value, values ) >= 0 ||
  443 + jQuery.inArray( this.text, values ) >= 0);
  444 + });
  445 +
  446 + if ( !values.length )
  447 + this.selectedIndex = -1;
  448 +
  449 + } else
  450 + this.value = value;
  451 + });
  452 + },
  453 +
  454 + html: function( value ) {
  455 + return value == undefined ?
  456 + (this.length ?
  457 + this[0].innerHTML :
  458 + null) :
  459 + this.empty().append( value );
  460 + },
  461 +
  462 + replaceWith: function( value ) {
  463 + return this.after( value ).remove();
  464 + },
  465 +
  466 + eq: function( i ) {
  467 + return this.slice( i, i + 1 );
  468 + },
  469 +
  470 + slice: function() {
  471 + return this.pushStack( Array.prototype.slice.apply( this, arguments ) );
  472 + },
  473 +
  474 + map: function( callback ) {
  475 + return this.pushStack( jQuery.map(this, function(elem, i){
  476 + return callback.call( elem, i, elem );
  477 + }));
  478 + },
  479 +
  480 + andSelf: function() {
  481 + return this.add( this.prevObject );
  482 + },
  483 +
  484 + domManip: function( args, table, reverse, callback ) {
  485 + var clone = this.length > 1, elems;
  486 +
  487 + return this.each(function(){
  488 + if ( !elems ) {
  489 + elems = jQuery.clean( args, this.ownerDocument );
  490 +
  491 + if ( reverse )
  492 + elems.reverse();
  493 + }
  494 +
  495 + var obj = this;
  496 +
  497 + if ( table && jQuery.nodeName( this, "table" ) && jQuery.nodeName( elems[0], "tr" ) )
  498 + obj = this.getElementsByTagName("tbody")[0] || this.appendChild( this.ownerDocument.createElement("tbody") );
  499 +
  500 + var scripts = jQuery( [] );
  501 +
  502 + jQuery.each(elems, function(){
  503 + var elem = clone ?
  504 + jQuery( this ).clone( true )[0] :
  505 + this;
  506 +
  507 + // execute all scripts after the elements have been injected
  508 + if ( jQuery.nodeName( elem, "script" ) ) {
  509 + scripts = scripts.add( elem );
  510 + } else {
  511 + // Remove any inner scripts for later evaluation
  512 + if ( elem.nodeType == 1 )
  513 + scripts = scripts.add( jQuery( "script", elem ).remove() );
  514 +
  515 + // Inject the elements into the document
  516 + callback.call( obj, elem );
  517 + }
  518 + });
  519 +
  520 + scripts.each( evalScript );
  521 + });
  522 + }
  523 +};
  524 +
  525 +// Give the init function the jQuery prototype for later instantiation
  526 +jQuery.prototype.init.prototype = jQuery.prototype;
  527 +
  528 +function evalScript( i, elem ) {
  529 + if ( elem.src )
  530 + jQuery.ajax({
  531 + url: elem.src,
  532 + async: false,
  533 + dataType: "script"
  534 + });
  535 +
  536 + else
  537 + jQuery.globalEval( elem.text || elem.textContent || elem.innerHTML || "" );
  538 +
  539 + if ( elem.parentNode )
  540 + elem.parentNode.removeChild( elem );
  541 +}
  542 +
  543 +jQuery.extend = jQuery.fn.extend = function() {
  544 + // copy reference to target object
  545 + var target = arguments[0] || {}, i = 1, length = arguments.length, deep = false, options;
  546 +
  547 + // Handle a deep copy situation
  548 + if ( target.constructor == Boolean ) {
  549 + deep = target;
  550 + target = arguments[1] || {};
  551 + // skip the boolean and the target
  552 + i = 2;
  553 + }
  554 +
  555 + // Handle case when target is a string or something (possible in deep copy)
  556 + if ( typeof target != "object" && typeof target != "function" )
  557 + target = {};
  558 +
  559 + // extend jQuery itself if only one argument is passed
  560 + if ( length == 1 ) {
  561 + target = this;
  562 + i = 0;
  563 + }
  564 +
  565 + for ( ; i < length; i++ )
  566 + // Only deal with non-null/undefined values
  567 + if ( (options = arguments[ i ]) != null )
  568 + // Extend the base object
  569 + for ( var name in options ) {
  570 + // Prevent never-ending loop
  571 + if ( target === options[ name ] )
  572 + continue;
  573 +
  574 + // Recurse if we're merging object values
  575 + if ( deep && options[ name ] && typeof options[ name ] == "object" && target[ name ] && !options[ name ].nodeType )
  576 + target[ name ] = jQuery.extend( target[ name ], options[ name ] );
  577 +
  578 + // Don't bring in undefined values
  579 + else if ( options[ name ] != undefined )
  580 + target[ name ] = options[ name ];
  581 +
  582 + }
  583 +
  584 + // Return the modified object
  585 + return target;
  586 +};
  587 +
  588 +var expando = "jQuery" + (new Date()).getTime(), uuid = 0, windowData = {};
  589 +
  590 +// exclude the following css properties to add px
  591 +var exclude = /z-?index|font-?weight|opacity|zoom|line-?height/i;
  592 +
  593 +jQuery.extend({
  594 + noConflict: function( deep ) {
  595 + window.$ = _$;
  596 +
  597 + if ( deep )
  598 + window.jQuery = _jQuery;
  599 +
  600 + return jQuery;
  601 + },
  602 +
  603 + // See test/unit/core.js for details concerning this function.
  604 + isFunction: function( fn ) {
  605 + return !!fn && typeof fn != "string" && !fn.nodeName &&
  606 + fn.constructor != Array && /function/i.test( fn + "" );
  607 + },
  608 +
  609 + // check if an element is in a (or is an) XML document
  610 + isXMLDoc: function( elem ) {
  611 + return elem.documentElement && !elem.body ||
  612 + elem.tagName && elem.ownerDocument && !elem.ownerDocument.body;
  613 + },
  614 +
  615 + // Evalulates a script in a global context
  616 + globalEval: function( data ) {
  617 + data = jQuery.trim( data );
  618 +
  619 + if ( data ) {
  620 + // Inspired by code by Andrea Giammarchi
  621 + // http://webreflection.blogspot.com/2007/08/global-scope-evaluation-and-dom.html
  622 + var head = document.getElementsByTagName("head")[0] || document.documentElement,
  623 + script = document.createElement("script");
  624 +
  625 + script.type = "text/javascript";
  626 + if ( jQuery.browser.msie )
  627 + script.text = data;
  628 + else
  629 + script.appendChild( document.createTextNode( data ) );
  630 +
  631 + head.appendChild( script );
  632 + head.removeChild( script );
  633 + }
  634 + },
  635 +
  636 + nodeName: function( elem, name ) {
  637 + return elem.nodeName && elem.nodeName.toUpperCase() == name.toUpperCase();
  638 + },
  639 +
  640 + cache: {},
  641 +
  642 + data: function( elem, name, data ) {
  643 + elem = elem == window ?
  644 + windowData :
  645 + elem;
  646 +
  647 + var id = elem[ expando ];
  648 +
  649 + // Compute a unique ID for the element
  650 + if ( !id )
  651 + id = elem[ expando ] = ++uuid;
  652 +
  653 + // Only generate the data cache if we're
  654 + // trying to access or manipulate it
  655 + if ( name && !jQuery.cache[ id ] )
  656 + jQuery.cache[ id ] = {};
  657 +
  658 + // Prevent overriding the named cache with undefined values
  659 + if ( data != undefined )
  660 + jQuery.cache[ id ][ name ] = data;
  661 +
  662 + // Return the named cache data, or the ID for the element
  663 + return name ?
  664 + jQuery.cache[ id ][ name ] :
  665 + id;
  666 + },
  667 +
  668 + removeData: function( elem, name ) {
  669 + elem = elem == window ?
  670 + windowData :
  671 + elem;
  672 +
  673 + var id = elem[ expando ];
  674 +
  675 + // If we want to remove a specific section of the element's data
  676 + if ( name ) {
  677 + if ( jQuery.cache[ id ] ) {
  678 + // Remove the section of cache data
  679 + delete jQuery.cache[ id ][ name ];
  680 +
  681 + // If we've removed all the data, remove the element's cache
  682 + name = "";
  683 +
  684 + for ( name in jQuery.cache[ id ] )
  685 + break;
  686 +
  687 + if ( !name )
  688 + jQuery.removeData( elem );
  689 + }
  690 +
  691 + // Otherwise, we want to remove all of the element's data
  692 + } else {
  693 + // Clean up the element expando
  694 + try {
  695 + delete elem[ expando ];
  696 + } catch(e){
  697 + // IE has trouble directly removing the expando
  698 + // but it's ok with using removeAttribute
  699 + if ( elem.removeAttribute )
  700 + elem.removeAttribute( expando );
  701 + }
  702 +
  703 + // Completely remove the data cache
  704 + delete jQuery.cache[ id ];
  705 + }
  706 + },
  707 +
  708 + // args is for internal usage only
  709 + each: function( object, callback, args ) {
  710 + if ( args ) {
  711 + if ( object.length == undefined ) {
  712 + for ( var name in object )
  713 + if ( callback.apply( object[ name ], args ) === false )
  714 + break;
  715 + } else
  716 + for ( var i = 0, length = object.length; i < length; i++ )
  717 + if ( callback.apply( object[ i ], args ) === false )
  718 + break;
  719 +
  720 + // A special, fast, case for the most common use of each
  721 + } else {
  722 + if ( object.length == undefined ) {
  723 + for ( var name in object )
  724 + if ( callback.call( object[ name ], name, object[ name ] ) === false )
  725 + break;
  726 + } else
  727 + for ( var i = 0, length = object.length, value = object[0];
  728 + i < length && callback.call( value, i, value ) !== false; value = object[++i] ){}
  729 + }
  730 +
  731 + return object;
  732 + },
  733 +
  734 + prop: function( elem, value, type, i, name ) {
  735 + // Handle executable functions
  736 + if ( jQuery.isFunction( value ) )
  737 + value = value.call( elem, i );
  738 +
  739 + // Handle passing in a number to a CSS property
  740 + return value && value.constructor == Number && type == "curCSS" && !exclude.test( name ) ?
  741 + value + "px" :
  742 + value;
  743 + },
  744 +
  745 + className: {
  746 + // internal only, use addClass("class")
  747 + add: function( elem, classNames ) {
  748 + jQuery.each((classNames || "").split(/\s+/), function(i, className){
  749 + if ( elem.nodeType == 1 && !jQuery.className.has( elem.className, className ) )
  750 + elem.className += (elem.className ? " " : "") + className;
  751 + });
  752 + },
  753 +
  754 + // internal only, use removeClass("class")
  755 + remove: function( elem, classNames ) {
  756 + if (elem.nodeType == 1)
  757 + elem.className = classNames != undefined ?
  758 + jQuery.grep(elem.className.split(/\s+/), function(className){
  759 + return !jQuery.className.has( classNames, className );
  760 + }).join(" ") :
  761 + "";
  762 + },
  763 +
  764 + // internal only, use is(".class")
  765 + has: function( elem, className ) {
  766 + return jQuery.inArray( className, (elem.className || elem).toString().split(/\s+/) ) > -1;
  767 + }
  768 + },
  769 +
  770 + // A method for quickly swapping in/out CSS properties to get correct calculations
  771 + swap: function( elem, options, callback ) {
  772 + var old = {};
  773 + // Remember the old values, and insert the new ones
  774 + for ( var name in options ) {
  775 + old[ name ] = elem.style[ name ];
  776 + elem.style[ name ] = options[ name ];
  777 + }
  778 +
  779 + callback.call( elem );
  780 +
  781 + // Revert the old values
  782 + for ( var name in options )
  783 + elem.style[ name ] = old[ name ];
  784 + },
  785 +
  786 + css: function( elem, name, force ) {
  787 + if ( name == "width" || name == "height" ) {
  788 + var val, props = { position: "absolute", visibility: "hidden", display:"block" }, which = name == "width" ? [ "Left", "Right" ] : [ "Top", "Bottom" ];
  789 +
  790 + function getWH() {
  791 + val = name == "width" ? elem.offsetWidth : elem.offsetHeight;
  792 + var padding = 0, border = 0;
  793 + jQuery.each( which, function() {
  794 + padding += parseFloat(jQuery.curCSS( elem, "padding" + this, true)) || 0;
  795 + border += parseFloat(jQuery.curCSS( elem, "border" + this + "Width", true)) || 0;
  796 + });
  797 + val -= Math.round(padding + border);
  798 + }
  799 +
  800 + if ( jQuery(elem).is(":visible") )
  801 + getWH();
  802 + else
  803 + jQuery.swap( elem, props, getWH );
  804 +
  805 + return Math.max(0, val);
  806 + }
  807 +
  808 + return jQuery.curCSS( elem, name, force );
  809 + },
  810 +
  811 + curCSS: function( elem, name, force ) {
  812 + var ret;
  813 +
  814 + // A helper method for determining if an element's values are broken
  815 + function color( elem ) {
  816 + if ( !jQuery.browser.safari )
  817 + return false;
  818 +
  819 + var ret = document.defaultView.getComputedStyle( elem, null );
  820 + return !ret || ret.getPropertyValue("color") == "";
  821 + }
  822 +
  823 + // We need to handle opacity special in IE
  824 + if ( name == "opacity" && jQuery.browser.msie ) {
  825 + ret = jQuery.attr( elem.style, "opacity" );
  826 +
  827 + return ret == "" ?
  828 + "1" :
  829 + ret;
  830 + }
  831 + // Opera sometimes will give the wrong display answer, this fixes it, see #2037
  832 + if ( jQuery.browser.opera && name == "display" ) {
  833 + var save = elem.style.display;
  834 + elem.style.display = "block";
  835 + elem.style.display = save;
  836 + }
  837 +
  838 + // Make sure we're using the right name for getting the float value
  839 + if ( name.match( /float/i ) )
  840 + name = styleFloat;
  841 +
  842 + if ( !force && elem.style && elem.style[ name ] )
  843 + ret = elem.style[ name ];
  844 +
  845 + else if ( document.defaultView && document.defaultView.getComputedStyle ) {
  846 +
  847 + // Only "float" is needed here
  848 + if ( name.match( /float/i ) )
  849 + name = "float";
  850 +
  851 + name = name.replace( /([A-Z])/g, "-$1" ).toLowerCase();
  852 +
  853 + var getComputedStyle = document.defaultView.getComputedStyle( elem, null );
  854 +
  855 + if ( getComputedStyle && !color( elem ) )
  856 + ret = getComputedStyle.getPropertyValue( name );
  857 +
  858 + // If the element isn't reporting its values properly in Safari
  859 + // then some display: none elements are involved
  860 + else {
  861 + var swap = [], stack = [];
  862 +
  863 + // Locate all of the parent display: none elements
  864 + for ( var a = elem; a && color(a); a = a.parentNode )
  865 + stack.unshift(a);
  866 +
  867 + // Go through and make them visible, but in reverse
  868 + // (It would be better if we knew the exact display type that they had)
  869 + for ( var i = 0; i < stack.length; i++ )
  870 + if ( color( stack[ i ] ) ) {
  871 + swap[ i ] = stack[ i ].style.display;
  872 + stack[ i ].style.display = "block";
  873 + }
  874 +
  875 + // Since we flip the display style, we have to handle that
  876 + // one special, otherwise get the value
  877 + ret = name == "display" && swap[ stack.length - 1 ] != null ?
  878 + "none" :
  879 + ( getComputedStyle && getComputedStyle.getPropertyValue( name ) ) || "";
  880 +
  881 + // Finally, revert the display styles back
  882 + for ( var i = 0; i < swap.length; i++ )
  883 + if ( swap[ i ] != null )
  884 + stack[ i ].style.display = swap[ i ];
  885 + }
  886 +
  887 + // We should always get a number back from opacity
  888 + if ( name == "opacity" && ret == "" )
  889 + ret = "1";
  890 +
  891 + } else if ( elem.currentStyle ) {
  892 + var camelCase = name.replace(/\-(\w)/g, function(all, letter){
  893 + return letter.toUpperCase();
  894 + });
  895 +
  896 + ret = elem.currentStyle[ name ] || elem.currentStyle[ camelCase ];
  897 +
  898 + // From the awesome hack by Dean Edwards
  899 + // http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291
  900 +
  901 + // If we're not dealing with a regular pixel number
  902 + // but a number that has a weird ending, we need to convert it to pixels
  903 + if ( !/^\d+(px)?$/i.test( ret ) && /^\d/.test( ret ) ) {
  904 + // Remember the original values
  905 + var style = elem.style.left, runtimeStyle = elem.runtimeStyle.left;
  906 +
  907 + // Put in the new values to get a computed value out
  908 + elem.runtimeStyle.left = elem.currentStyle.left;
  909 + elem.style.left = ret || 0;
  910 + ret = elem.style.pixelLeft + "px";
  911 +
  912 + // Revert the changed values
  913 + elem.style.left = style;
  914 + elem.runtimeStyle.left = runtimeStyle;
  915 + }
  916 + }
  917 +
  918 + return ret;
  919 + },
  920 +
  921 + clean: function( elems, context ) {
  922 + var ret = [];
  923 + context = context || document;
  924 + // !context.createElement fails in IE with an error but returns typeof 'object'
  925 + if (typeof context.createElement == 'undefined')
  926 + context = context.ownerDocument || context[0] && context[0].ownerDocument || document;
  927 +
  928 + jQuery.each(elems, function(i, elem){
  929 + if ( !elem )
  930 + return;
  931 +
  932 + if ( elem.constructor == Number )
  933 + elem = elem.toString();
  934 +
  935 + // Convert html string into DOM nodes
  936 + if ( typeof elem == "string" ) {
  937 + // Fix "XHTML"-style tags in all browsers
  938 + elem = elem.replace(/(<(\w+)[^>]*?)\/>/g, function(all, front, tag){
  939 + return tag.match(/^(abbr|br|col|img|input|link|meta|param|hr|area|embed)$/i) ?
  940 + all :
  941 + front + "></" + tag + ">";
  942 + });
  943 +
  944 + // Trim whitespace, otherwise indexOf won't work as expected
  945 + var tags = jQuery.trim( elem ).toLowerCase(), div = context.createElement("div");
  946 +
  947 + var wrap =
  948 + // option or optgroup
  949 + !tags.indexOf("<opt") &&
  950 + [ 1, "<select multiple='multiple'>", "</select>" ] ||
  951 +
  952 + !tags.indexOf("<leg") &&
  953 + [ 1, "<fieldset>", "</fieldset>" ] ||
  954 +
  955 + tags.match(/^<(thead|tbody|tfoot|colg|cap)/) &&
  956 + [ 1, "<table>", "</table>" ] ||
  957 +
  958 + !tags.indexOf("<tr") &&
  959 + [ 2, "<table><tbody>", "</tbody></table>" ] ||
  960 +
  961 + // <thead> matched above
  962 + (!tags.indexOf("<td") || !tags.indexOf("<th")) &&
  963 + [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ] ||
  964 +
  965 + !tags.indexOf("<col") &&
  966 + [ 2, "<table><tbody></tbody><colgroup>", "</colgroup></table>" ] ||
  967 +
  968 + // IE can't serialize <link> and <script> tags normally
  969 + jQuery.browser.msie &&
  970 + [ 1, "div<div>", "</div>" ] ||
  971 +
  972 + [ 0, "", "" ];
  973 +
  974 + // Go to html and back, then peel off extra wrappers
  975 + div.innerHTML = wrap[1] + elem + wrap[2];
  976 +
  977 + // Move to the right depth
  978 + while ( wrap[0]-- )
  979 + div = div.lastChild;
  980 +
  981 + // Remove IE's autoinserted <tbody> from table fragments
  982 + if ( jQuery.browser.msie ) {
  983 +
  984 + // String was a <table>, *may* have spurious <tbody>
  985 + var tbody = !tags.indexOf("<table") && tags.indexOf("<tbody") < 0 ?
  986 + div.firstChild && div.firstChild.childNodes :
  987 +
  988 + // String was a bare <thead> or <tfoot>
  989 + wrap[1] == "<table>" && tags.indexOf("<tbody") < 0 ?
  990 + div.childNodes :
  991 + [];
  992 +
  993 + for ( var j = tbody.length - 1; j >= 0 ; --j )
  994 + if ( jQuery.nodeName( tbody[ j ], "tbody" ) && !tbody[ j ].childNodes.length )
  995 + tbody[ j ].parentNode.removeChild( tbody[ j ] );
  996 +
  997 + // IE completely kills leading whitespace when innerHTML is used
  998 + if ( /^\s/.test( elem ) )
  999 + div.insertBefore( context.createTextNode( elem.match(/^\s*/)[0] ), div.firstChild );
  1000 +
  1001 + }
  1002 +
  1003 + elem = jQuery.makeArray( div.childNodes );
  1004 + }
  1005 +
  1006 + if ( elem.length === 0 && (!jQuery.nodeName( elem, "form" ) && !jQuery.nodeName( elem, "select" )) )
  1007 + return;
  1008 +
  1009 + if ( elem[0] == undefined || jQuery.nodeName( elem, "form" ) || elem.options )
  1010 + ret.push( elem );
  1011 +
  1012 + else
  1013 + ret = jQuery.merge( ret, elem );
  1014 +
  1015 + });
  1016 +
  1017 + return ret;
  1018 + },
  1019 +
  1020 + attr: function( elem, name, value ) {
  1021 + // don't set attributes on text and comment nodes
  1022 + if (!elem || elem.nodeType == 3 || elem.nodeType == 8)
  1023 + return undefined;
  1024 +
  1025 + var fix = jQuery.isXMLDoc( elem ) ?
  1026 + {} :
  1027 + jQuery.props;
  1028 +
  1029 + // Safari mis-reports the default selected property of a hidden option
  1030 + // Accessing the parent's selectedIndex property fixes it
  1031 + if ( name == "selected" && jQuery.browser.safari )
  1032 + elem.parentNode.selectedIndex;
  1033 +
  1034 + // Certain attributes only work when accessed via the old DOM 0 way
  1035 + if ( fix[ name ] ) {
  1036 + if ( value != undefined )
  1037 + elem[ fix[ name ] ] = value;
  1038 +
  1039 + return elem[ fix[ name ] ];
  1040 +
  1041 + } else if ( jQuery.browser.msie && name == "style" )
  1042 + return jQuery.attr( elem.style, "cssText", value );
  1043 +
  1044 + else if ( value == undefined && jQuery.browser.msie && jQuery.nodeName( elem, "form" ) && (name == "action" || name == "method") )
  1045 + return elem.getAttributeNode( name ).nodeValue;
  1046 +
  1047 + // IE elem.getAttribute passes even for style
  1048 + else if ( elem.tagName ) {
  1049 +
  1050 + if ( value != undefined ) {
  1051 + // We can't allow the type property to be changed (since it causes problems in IE)
  1052 + if ( name == "type" && jQuery.nodeName( elem, "input" ) && elem.parentNode )
  1053 + throw "type property can't be changed";
  1054 +
  1055 + // convert the value to a string (all browsers do this but IE) see #1070
  1056 + elem.setAttribute( name, "" + value );
  1057 + }
  1058 +
  1059 + if ( jQuery.browser.msie && /href|src/.test( name ) && !jQuery.isXMLDoc( elem ) )
  1060 + return elem.getAttribute( name, 2 );
  1061 +
  1062 + return elem.getAttribute( name );
  1063 +
  1064 + // elem is actually elem.style ... set the style
  1065 + } else {
  1066 + // IE actually uses filters for opacity
  1067 + if ( name == "opacity" && jQuery.browser.msie ) {
  1068 + if ( value != undefined ) {
  1069 + // IE has trouble with opacity if it does not have layout
  1070 + // Force it by setting the zoom level
  1071 + elem.zoom = 1;
  1072 +
  1073 + // Set the alpha filter to set the opacity
  1074 + elem.filter = (elem.filter || "").replace( /alpha\([^)]*\)/, "" ) +
  1075 + (parseFloat( value ).toString() == "NaN" ? "" : "alpha(opacity=" + value * 100 + ")");
  1076 + }
  1077 +
  1078 + return elem.filter && elem.filter.indexOf("opacity=") >= 0 ?
  1079 + (parseFloat( elem.filter.match(/opacity=([^)]*)/)[1] ) / 100).toString() :
  1080 + "";
  1081 + }
  1082 +
  1083 + name = name.replace(/-([a-z])/ig, function(all, letter){
  1084 + return letter.toUpperCase();
  1085 + });
  1086 +
  1087 + if ( value != undefined )
  1088 + elem[ name ] = value;
  1089 +
  1090 + return elem[ name ];
  1091 + }
  1092 + },
  1093 +
  1094 + trim: function( text ) {
  1095 + return (text || "").replace( /^\s+|\s+$/g, "" );
  1096 + },
  1097 +
  1098 + makeArray: function( array ) {
  1099 + var ret = [];
  1100 +
  1101 + // Need to use typeof to fight Safari childNodes crashes
  1102 + if ( typeof array != "array" )
  1103 + for ( var i = 0, length = array.length; i < length; i++ )
  1104 + ret.push( array[ i ] );
  1105 + else
  1106 + ret = array.slice( 0 );
  1107 +
  1108 + return ret;
  1109 + },
  1110 +
  1111 + inArray: function( elem, array ) {
  1112 + for ( var i = 0, length = array.length; i < length; i++ )
  1113 + if ( array[ i ] == elem )
  1114 + return i;
  1115 +
  1116 + return -1;
  1117 + },
  1118 +
  1119 + merge: function( first, second ) {
  1120 + // We have to loop this way because IE & Opera overwrite the length
  1121 + // expando of getElementsByTagName
  1122 +
  1123 + // Also, we need to make sure that the correct elements are being returned
  1124 + // (IE returns comment nodes in a '*' query)
  1125 + if ( jQuery.browser.msie ) {
  1126 + for ( var i = 0; second[ i ]; i++ )
  1127 + if ( second[ i ].nodeType != 8 )
  1128 + first.push( second[ i ] );
  1129 +
  1130 + } else
  1131 + for ( var i = 0; second[ i ]; i++ )
  1132 + first.push( second[ i ] );
  1133 +
  1134 + return first;
  1135 + },
  1136 +
  1137 + unique: function( array ) {
  1138 + var ret = [], done = {};
  1139 +
  1140 + try {
  1141 +
  1142 + for ( var i = 0, length = array.length; i < length; i++ ) {
  1143 + var id = jQuery.data( array[ i ] );
  1144 +
  1145 + if ( !done[ id ] ) {
  1146 + done[ id ] = true;
  1147 + ret.push( array[ i ] );
  1148 + }
  1149 + }
  1150 +
  1151 + } catch( e ) {
  1152 + ret = array;
  1153 + }
  1154 +
  1155 + return ret;
  1156 + },
  1157 +
  1158 + grep: function( elems, callback, inv ) {
  1159 + // If a string is passed in for the function, make a function
  1160 + // for it (a handy shortcut)
  1161 + if ( typeof callback == "string" )
  1162 + callback = eval("false||function(a,i){return " + callback + "}");
  1163 +
  1164 + var ret = [];
  1165 +
  1166 + // Go through the array, only saving the items
  1167 + // that pass the validator function
  1168 + for ( var i = 0, length = elems.length; i < length; i++ )
  1169 + if ( !inv && callback( elems[ i ], i ) || inv && !callback( elems[ i ], i ) )
  1170 + ret.push( elems[ i ] );
  1171 +
  1172 + return ret;
  1173 + },
  1174 +
  1175 + map: function( elems, callback ) {
  1176 + var ret = [];
  1177 +
  1178 + // Go through the array, translating each of the items to their
  1179 + // new value (or values).
  1180 + for ( var i = 0, length = elems.length; i < length; i++ ) {
  1181 + var value = callback( elems[ i ], i );
  1182 +
  1183 + if ( value !== null && value != undefined ) {
  1184 + if ( value.constructor != Array )
  1185 + value = [ value ];
  1186 +
  1187 + ret = ret.concat( value );
  1188 + }
  1189 + }
  1190 +
  1191 + return ret;
  1192 + }
  1193 +});
  1194 +
  1195 +var userAgent = navigator.userAgent.toLowerCase();
  1196 +
  1197 +// Figure out what browser is being used
  1198 +jQuery.browser = {
  1199 + version: (userAgent.match( /.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/ ) || [])[1],
  1200 + safari: /webkit/.test( userAgent ),
  1201 + opera: /opera/.test( userAgent ),
  1202 + msie: /msie/.test( userAgent ) && !/opera/.test( userAgent ),
  1203 + mozilla: /mozilla/.test( userAgent ) && !/(compatible|webkit)/.test( userAgent )
  1204 +};
  1205 +
  1206 +var styleFloat = jQuery.browser.msie ?
  1207 + "styleFloat" :
  1208 + "cssFloat";
  1209 +
  1210 +jQuery.extend({
  1211 + // Check to see if the W3C box model is being used
  1212 + boxModel: !jQuery.browser.msie || document.compatMode == "CSS1Compat",
  1213 +
  1214 + props: {
  1215 + "for": "htmlFor",
  1216 + "class": "className",
  1217 + "float": styleFloat,
  1218 + cssFloat: styleFloat,
  1219 + styleFloat: styleFloat,
  1220 + innerHTML: "innerHTML",
  1221 + className: "className",
  1222 + value: "value",
  1223 + disabled: "disabled",
  1224 + checked: "checked",
  1225 + readonly: "readOnly",
  1226 + selected: "selected",
  1227 + maxlength: "maxLength",
  1228 + selectedIndex: "selectedIndex",
  1229 + defaultValue: "defaultValue",
  1230 + tagName: "tagName",
  1231 + nodeName: "nodeName"
  1232 + }
  1233 +});
  1234 +
  1235 +jQuery.each({
  1236 + parent: "elem.parentNode",
  1237 + parents: "jQuery.dir(elem,'parentNode')",
  1238 + next: "jQuery.nth(elem,2,'nextSibling')",
  1239 + prev: "jQuery.nth(elem,2,'previousSibling')",
  1240 + nextAll: "jQuery.dir(elem,'nextSibling')",
  1241 + prevAll: "jQuery.dir(elem,'previousSibling')",
  1242 + siblings: "jQuery.sibling(elem.parentNode.firstChild,elem)",
  1243 + children: "jQuery.sibling(elem.firstChild)",
  1244 + contents: "jQuery.nodeName(elem,'iframe')?elem.contentDocument||elem.contentWindow.document:jQuery.makeArray(elem.childNodes)"
  1245 +}, function(name, fn){
  1246 + fn = eval("false||function(elem){return " + fn + "}");
  1247 +
  1248 + jQuery.fn[ name ] = function( selector ) {
  1249 + var ret = jQuery.map( this, fn );
  1250 +
  1251 + if ( selector && typeof selector == "string" )
  1252 + ret = jQuery.multiFilter( selector, ret );
  1253 +
  1254 + return this.pushStack( jQuery.unique( ret ) );
  1255 + };
  1256 +});
  1257 +
  1258 +jQuery.each({
  1259 + appendTo: "append",
  1260 + prependTo: "prepend",
  1261 + insertBefore: "before",
  1262 + insertAfter: "after",
  1263 + replaceAll: "replaceWith"
  1264 +}, function(name, original){
  1265 + jQuery.fn[ name ] = function() {
  1266 + var args = arguments;
  1267 +
  1268 + return this.each(function(){
  1269 + for ( var i = 0, length = args.length; i < length; i++ )
  1270 + jQuery( args[ i ] )[ original ]( this );
  1271 + });
  1272 + };
  1273 +});
  1274 +
  1275 +jQuery.each({
  1276 + removeAttr: function( name ) {
  1277 + jQuery.attr( this, name, "" );
  1278 + if (this.nodeType == 1)
  1279 + this.removeAttribute( name );
  1280 + },
  1281 +
  1282 + addClass: function( classNames ) {
  1283 + jQuery.className.add( this, classNames );
  1284 + },
  1285 +
  1286 + removeClass: function( classNames ) {
  1287 + jQuery.className.remove( this, classNames );
  1288 + },
  1289 +
  1290 + toggleClass: function( classNames ) {
  1291 + jQuery.className[ jQuery.className.has( this, classNames ) ? "remove" : "add" ]( this, classNames );
  1292 + },
  1293 +
  1294 + remove: function( selector ) {
  1295 + if ( !selector || jQuery.filter( selector, [ this ] ).r.length ) {
  1296 + // Prevent memory leaks
  1297 + jQuery( "*", this ).add(this).each(function(){
  1298 + jQuery.event.remove(this);
  1299 + jQuery.removeData(this);
  1300 + });
  1301 + if (this.parentNode)
  1302 + this.parentNode.removeChild( this );
  1303 + }
  1304 + },
  1305 +
  1306 + empty: function() {
  1307 + // Remove element nodes and prevent memory leaks
  1308 + jQuery( ">*", this ).remove();
  1309 +
  1310 + // Remove any remaining nodes
  1311 + while ( this.firstChild )
  1312 + this.removeChild( this.firstChild );
  1313 + }
  1314 +}, function(name, fn){
  1315 + jQuery.fn[ name ] = function(){
  1316 + return this.each( fn, arguments );
  1317 + };
  1318 +});
  1319 +
  1320 +jQuery.each([ "Height", "Width" ], function(i, name){
  1321 + var type = name.toLowerCase();
  1322 +
  1323 + jQuery.fn[ type ] = function( size ) {
  1324 + // Get window width or height
  1325 + return this[0] == window ?
  1326 + // Opera reports document.body.client[Width/Height] properly in both quirks and standards
  1327 + jQuery.browser.opera && document.body[ "client" + name ] ||
  1328 +
  1329 + // Safari reports inner[Width/Height] just fine (Mozilla and Opera include scroll bar widths)
  1330 + jQuery.browser.safari && window[ "inner" + name ] ||
  1331 +
  1332 + // Everyone else use document.documentElement or document.body depending on Quirks vs Standards mode
  1333 + document.compatMode == "CSS1Compat" && document.documentElement[ "client" + name ] || document.body[ "client" + name ] :
  1334 +
  1335 + // Get document width or height
  1336 + this[0] == document ?
  1337 + // Either scroll[Width/Height] or offset[Width/Height], whichever is greater
  1338 + Math.max(
  1339 + Math.max(document.body["scroll" + name], document.documentElement["scroll" + name]),
  1340 + Math.max(document.body["offset" + name], document.documentElement["offset" + name])
  1341 + ) :
  1342 +
  1343 + // Get or set width or height on the element
  1344 + size == undefined ?
  1345 + // Get width or height on the element
  1346 + (this.length ? jQuery.css( this[0], type ) : null) :
  1347 +
  1348 + // Set the width or height on the element (default to pixels if value is unitless)
  1349 + this.css( type, size.constructor == String ? size : size + "px" );
  1350 + };
  1351 +});
  1352 +
  1353 +var chars = jQuery.browser.safari && parseInt(jQuery.browser.version) < 417 ?
  1354 + "(?:[\\w*_-]|\\\\.)" :
  1355 + "(?:[\\w\u0128-\uFFFF*_-]|\\\\.)",
  1356 + quickChild = new RegExp("^>\\s*(" + chars + "+)"),
  1357 + quickID = new RegExp("^(" + chars + "+)(#)(" + chars + "+)"),
  1358 + quickClass = new RegExp("^([#.]?)(" + chars + "*)");
  1359 +
  1360 +jQuery.extend({
  1361 + expr: {
  1362 + "": "m[2]=='*'||jQuery.nodeName(a,m[2])",
  1363 + "#": "a.getAttribute('id')==m[2]",
  1364 + ":": {
  1365 + // Position Checks
  1366 + lt: "i<m[3]-0",
  1367 + gt: "i>m[3]-0",
  1368 + nth: "m[3]-0==i",
  1369 + eq: "m[3]-0==i",
  1370 + first: "i==0",
  1371 + last: "i==r.length-1",
  1372 + even: "i%2==0",
  1373 + odd: "i%2",
  1374 +
  1375 + // Child Checks
  1376 + "first-child": "a.parentNode.getElementsByTagName('*')[0]==a",
  1377 + "last-child": "jQuery.nth(a.parentNode.lastChild,1,'previousSibling')==a",
  1378 + "only-child": "!jQuery.nth(a.parentNode.lastChild,2,'previousSibling')",
  1379 +
  1380 + // Parent Checks
  1381 + parent: "a.firstChild",
  1382 + empty: "!a.firstChild",
  1383 +
  1384 + // Text Check
  1385 + contains: "(a.textContent||a.innerText||jQuery(a).text()||'').indexOf(m[3])>=0",
  1386 +
  1387 + // Visibility
  1388 + visible: '"hidden"!=a.type&&jQuery.css(a,"display")!="none"&&jQuery.css(a,"visibility")!="hidden"',
  1389 + hidden: '"hidden"==a.type||jQuery.css(a,"display")=="none"||jQuery.css(a,"visibility")=="hidden"',
  1390 +
  1391 + // Form attributes
  1392 + enabled: "!a.disabled",
  1393 + disabled: "a.disabled",
  1394 + checked: "a.checked",
  1395 + selected: "a.selected||jQuery.attr(a,'selected')",
  1396 +
  1397 + // Form elements
  1398 + text: "'text'==a.type",
  1399 + radio: "'radio'==a.type",
  1400 + checkbox: "'checkbox'==a.type",
  1401 + file: "'file'==a.type",
  1402 + password: "'password'==a.type",
  1403 + submit: "'submit'==a.type",
  1404 + image: "'image'==a.type",
  1405 + reset: "'reset'==a.type",
  1406 + button: '"button"==a.type||jQuery.nodeName(a,"button")',
  1407 + input: "/input|select|textarea|button/i.test(a.nodeName)",
  1408 +
  1409 + // :has()
  1410 + has: "jQuery.find(m[3],a).length",
  1411 +
  1412 + // :header
  1413 + header: "/h\\d/i.test(a.nodeName)",
  1414 +
  1415 + // :animated
  1416 + animated: "jQuery.grep(jQuery.timers,function(fn){return a==fn.elem;}).length"
  1417 + }
  1418 + },
  1419 +
  1420 + // The regular expressions that power the parsing engine
  1421 + parse: [
  1422 + // Match: [@value='test'], [@foo]
  1423 + /^(\[) *@?([\w-]+) *([!*$^~=]*) *('?"?)(.*?)\4 *\]/,
  1424 +
  1425 + // Match: :contains('foo')
  1426 + /^(:)([\w-]+)\("?'?(.*?(\(.*?\))?[^(]*?)"?'?\)/,
  1427 +
  1428 + // Match: :even, :last-chlid, #id, .class
  1429 + new RegExp("^([:.#]*)(" + chars + "+)")
  1430 + ],
  1431 +
  1432 + multiFilter: function( expr, elems, not ) {
  1433 + var old, cur = [];
  1434 +
  1435 + while ( expr && expr != old ) {
  1436 + old = expr;
  1437 + var f = jQuery.filter( expr, elems, not );
  1438 + expr = f.t.replace(/^\s*,\s*/, "" );
  1439 + cur = not ? elems = f.r : jQuery.merge( cur, f.r );
  1440 + }
  1441 +
  1442 + return cur;
  1443 + },
  1444 +
  1445 + find: function( t, context ) {
  1446 + // Quickly handle non-string expressions
  1447 + if ( typeof t != "string" )
  1448 + return [ t ];
  1449 +
  1450 + // check to make sure context is a DOM element or a document
  1451 + if ( context && context.nodeType != 1 && context.nodeType != 9)
  1452 + return [ ];
  1453 +
  1454 + // Set the correct context (if none is provided)
  1455 + context = context || document;
  1456 +
  1457 + // Initialize the search
  1458 + var ret = [context], done = [], last, nodeName;
  1459 +
  1460 + // Continue while a selector expression exists, and while
  1461 + // we're no longer looping upon ourselves
  1462 + while ( t && last != t ) {
  1463 + var r = [];
  1464 + last = t;
  1465 +
  1466 + t = jQuery.trim(t);
  1467 +
  1468 + var foundToken = false;
  1469 +
  1470 + // An attempt at speeding up child selectors that
  1471 + // point to a specific element tag
  1472 + var re = quickChild;
  1473 + var m = re.exec(t);
  1474 +
  1475 + if ( m ) {
  1476 + nodeName = m[1].toUpperCase();
  1477 +
  1478 + // Perform our own iteration and filter
  1479 + for ( var i = 0; ret[i]; i++ )
  1480 + for ( var c = ret[i].firstChild; c; c = c.nextSibling )
  1481 + if ( c.nodeType == 1 && (nodeName == "*" || c.nodeName.toUpperCase() == nodeName) )
  1482 + r.push( c );
  1483 +
  1484 + ret = r;
  1485 + t = t.replace( re, "" );
  1486 + if ( t.indexOf(" ") == 0 ) continue;
  1487 + foundToken = true;
  1488 + } else {
  1489 + re = /^([>+~])\s*(\w*)/i;
  1490 +
  1491 + if ( (m = re.exec(t)) != null ) {
  1492 + r = [];
  1493 +
  1494 + var merge = {};
  1495 + nodeName = m[2].toUpperCase();
  1496 + m = m[1];
  1497 +
  1498 + for ( var j = 0, rl = ret.length; j < rl; j++ ) {
  1499 + var n = m == "~" || m == "+" ? ret[j].nextSibling : ret[j].firstChild;
  1500 + for ( ; n; n = n.nextSibling )
  1501 + if ( n.nodeType == 1 ) {
  1502 + var id = jQuery.data(n);
  1503 +
  1504 + if ( m == "~" && merge[id] ) break;
  1505 +
  1506 + if (!nodeName || n.nodeName.toUpperCase() == nodeName ) {
  1507 + if ( m == "~" ) merge[id] = true;
  1508 + r.push( n );
  1509 + }
  1510 +
  1511 + if ( m == "+" ) break;
  1512 + }
  1513 + }
  1514 +
  1515 + ret = r;
  1516 +
  1517 + // And remove the token
  1518 + t = jQuery.trim( t.replace( re, "" ) );
  1519 + foundToken = true;
  1520 + }
  1521 + }
  1522 +
  1523 + // See if there's still an expression, and that we haven't already
  1524 + // matched a token
  1525 + if ( t && !foundToken ) {
  1526 + // Handle multiple expressions
  1527 + if ( !t.indexOf(",") ) {
  1528 + // Clean the result set
  1529 + if ( context == ret[0] ) ret.shift();
  1530 +
  1531 + // Merge the result sets
  1532 + done = jQuery.merge( done, ret );
  1533 +
  1534 + // Reset the context
  1535 + r = ret = [context];
  1536 +
  1537 + // Touch up the selector string
  1538 + t = " " + t.substr(1,t.length);
  1539 +
  1540 + } else {
  1541 + // Optimize for the case nodeName#idName
  1542 + var re2 = quickID;
  1543 + var m = re2.exec(t);
  1544 +
  1545 + // Re-organize the results, so that they're consistent
  1546 + if ( m ) {
  1547 + m = [ 0, m[2], m[3], m[1] ];
  1548 +
  1549 + } else {
  1550 + // Otherwise, do a traditional filter check for
  1551 + // ID, class, and element selectors
  1552 + re2 = quickClass;
  1553 + m = re2.exec(t);
  1554 + }
  1555 +
  1556 + m[2] = m[2].replace(/\\/g, "");
  1557 +
  1558 + var elem = ret[ret.length-1];
  1559 +
  1560 + // Try to do a global search by ID, where we can
  1561 + if ( m[1] == "#" && elem && elem.getElementById && !jQuery.isXMLDoc(elem) ) {
  1562 + // Optimization for HTML document case
  1563 + var oid = elem.getElementById(m[2]);
  1564 +
  1565 + // Do a quick check for the existence of the actual ID attribute
  1566 + // to avoid selecting by the name attribute in IE
  1567 + // also check to insure id is a string to avoid selecting an element with the name of 'id' inside a form
  1568 + if ( (jQuery.browser.msie||jQuery.browser.opera) && oid && typeof oid.id == "string" && oid.id != m[2] )
  1569 + oid = jQuery('[@id="'+m[2]+'"]', elem)[0];
  1570 +
  1571 + // Do a quick check for node name (where applicable) so
  1572 + // that div#foo searches will be really fast
  1573 + ret = r = oid && (!m[3] || jQuery.nodeName(oid, m[3])) ? [oid] : [];
  1574 + } else {
  1575 + // We need to find all descendant elements
  1576 + for ( var i = 0; ret[i]; i++ ) {
  1577 + // Grab the tag name being searched for
  1578 + var tag = m[1] == "#" && m[3] ? m[3] : m[1] != "" || m[0] == "" ? "*" : m[2];
  1579 +
  1580 + // Handle IE7 being really dumb about <object>s
  1581 + if ( tag == "*" && ret[i].nodeName.toLowerCase() == "object" )
  1582 + tag = "param";
  1583 +
  1584 + r = jQuery.merge( r, ret[i].getElementsByTagName( tag ));
  1585 + }
  1586 +
  1587 + // It's faster to filter by class and be done with it
  1588 + if ( m[1] == "." )
  1589 + r = jQuery.classFilter( r, m[2] );
  1590 +
  1591 + // Same with ID filtering
  1592 + if ( m[1] == "#" ) {
  1593 + var tmp = [];
  1594 +
  1595 + // Try to find the element with the ID
  1596 + for ( var i = 0; r[i]; i++ )
  1597 + if ( r[i].getAttribute("id") == m[2] ) {
  1598 + tmp = [ r[i] ];
  1599 + break;
  1600 + }
  1601 +
  1602 + r = tmp;
  1603 + }
  1604 +
  1605 + ret = r;
  1606 + }
  1607 +
  1608 + t = t.replace( re2, "" );
  1609 + }
  1610 +
  1611 + }
  1612 +
  1613 + // If a selector string still exists
  1614 + if ( t ) {
  1615 + // Attempt to filter it
  1616 + var val = jQuery.filter(t,r);
  1617 + ret = r = val.r;
  1618 + t = jQuery.trim(val.t);
  1619 + }
  1620 + }
  1621 +
  1622 + // An error occurred with the selector;
  1623 + // just return an empty set instead
  1624 + if ( t )
  1625 + ret = [];
  1626 +
  1627 + // Remove the root context
  1628 + if ( ret && context == ret[0] )
  1629 + ret.shift();
  1630 +
  1631 + // And combine the results
  1632 + done = jQuery.merge( done, ret );
  1633 +
  1634 + return done;
  1635 + },
  1636 +
  1637 + classFilter: function(r,m,not){
  1638 + m = " " + m + " ";
  1639 + var tmp = [];
  1640 + for ( var i = 0; r[i]; i++ ) {
  1641 + var pass = (" " + r[i].className + " ").indexOf( m ) >= 0;
  1642 + if ( !not && pass || not && !pass )
  1643 + tmp.push( r[i] );
  1644 + }
  1645 + return tmp;
  1646 + },
  1647 +
  1648 + filter: function(t,r,not) {
  1649 + var last;
  1650 +
  1651 + // Look for common filter expressions
  1652 + while ( t && t != last ) {
  1653 + last = t;
  1654 +
  1655 + var p = jQuery.parse, m;
  1656 +
  1657 + for ( var i = 0; p[i]; i++ ) {
  1658 + m = p[i].exec( t );
  1659 +
  1660 + if ( m ) {
  1661 + // Remove what we just matched
  1662 + t = t.substring( m[0].length );
  1663 +
  1664 + m[2] = m[2].replace(/\\/g, "");
  1665 + break;
  1666 + }
  1667 + }
  1668 +
  1669 + if ( !m )
  1670 + break;
  1671 +
  1672 + // :not() is a special case that can be optimized by
  1673 + // keeping it out of the expression list
  1674 + if ( m[1] == ":" && m[2] == "not" )
  1675 + // optimize if only one selector found (most common case)
  1676 + r = isSimple.test( m[3] ) ?
  1677 + jQuery.filter(m[3], r, true).r :
  1678 + jQuery( r ).not( m[3] );
  1679 +
  1680 + // We can get a big speed boost by filtering by class here
  1681 + else if ( m[1] == "." )
  1682 + r = jQuery.classFilter(r, m[2], not);
  1683 +
  1684 + else if ( m[1] == "[" ) {
  1685 + var tmp = [], type = m[3];
  1686 +
  1687 + for ( var i = 0, rl = r.length; i < rl; i++ ) {
  1688 + var a = r[i], z = a[ jQuery.props[m[2]] || m[2] ];
  1689 +
  1690 + if ( z == null || /href|src|selected/.test(m[2]) )
  1691 + z = jQuery.attr(a,m[2]) || '';
  1692 +
  1693 + if ( (type == "" && !!z ||
  1694 + type == "=" && z == m[5] ||
  1695 + type == "!=" && z != m[5] ||
  1696 + type == "^=" && z && !z.indexOf(m[5]) ||
  1697 + type == "$=" && z.substr(z.length - m[5].length) == m[5] ||
  1698 + (type == "*=" || type == "~=") && z.indexOf(m[5]) >= 0) ^ not )
  1699 + tmp.push( a );
  1700 + }
  1701 +
  1702 + r = tmp;
  1703 +
  1704 + // We can get a speed boost by handling nth-child here
  1705 + } else if ( m[1] == ":" && m[2] == "nth-child" ) {
  1706 + var merge = {}, tmp = [],
  1707 + // parse equations like 'even', 'odd', '5', '2n', '3n+2', '4n-1', '-n+6'
  1708 + test = /(-?)(\d*)n((?:\+|-)?\d*)/.exec(
  1709 + m[3] == "even" && "2n" || m[3] == "odd" && "2n+1" ||
  1710 + !/\D/.test(m[3]) && "0n+" + m[3] || m[3]),
  1711 + // calculate the numbers (first)n+(last) including if they are negative
  1712 + first = (test[1] + (test[2] || 1)) - 0, last = test[3] - 0;
  1713 +
  1714 + // loop through all the elements left in the jQuery object
  1715 + for ( var i = 0, rl = r.length; i < rl; i++ ) {
  1716 + var node = r[i], parentNode = node.parentNode, id = jQuery.data(parentNode);
  1717 +
  1718 + if ( !merge[id] ) {
  1719 + var c = 1;
  1720 +
  1721 + for ( var n = parentNode.firstChild; n; n = n.nextSibling )
  1722 + if ( n.nodeType == 1 )
  1723 + n.nodeIndex = c++;
  1724 +
  1725 + merge[id] = true;
  1726 + }
  1727 +
  1728 + var add = false;
  1729 +
  1730 + if ( first == 0 ) {
  1731 + if ( node.nodeIndex == last )
  1732 + add = true;
  1733 + } else if ( (node.nodeIndex - last) % first == 0 && (node.nodeIndex - last) / first >= 0 )
  1734 + add = true;
  1735 +
  1736 + if ( add ^ not )
  1737 + tmp.push( node );
  1738 + }
  1739 +
  1740 + r = tmp;
  1741 +
  1742 + // Otherwise, find the expression to execute
  1743 + } else {
  1744 + var f = jQuery.expr[m[1]];
  1745 + if ( typeof f != "string" )
  1746 + f = jQuery.expr[m[1]][m[2]];
  1747 +
  1748 + // Build a custom macro to enclose it
  1749 + f = eval("false||function(a,i){return " + f + "}");
  1750 +
  1751 + // Execute it against the current filter
  1752 + r = jQuery.grep( r, f, not );
  1753 + }
  1754 + }
  1755 +
  1756 + // Return an array of filtered elements (r)
  1757 + // and the modified expression string (t)
  1758 + return { r: r, t: t };
  1759 + },
  1760 +
  1761 + dir: function( elem, dir ){
  1762 + var matched = [];
  1763 + var cur = elem[dir];
  1764 + while ( cur && cur != document ) {
  1765 + if ( cur.nodeType == 1 )
  1766 + matched.push( cur );
  1767 + cur = cur[dir];
  1768 + }
  1769 + return matched;
  1770 + },
  1771 +
  1772 + nth: function(cur,result,dir,elem){
  1773 + result = result || 1;
  1774 + var num = 0;
  1775 +
  1776 + for ( ; cur; cur = cur[dir] )
  1777 + if ( cur.nodeType == 1 && ++num == result )
  1778 + break;
  1779 +
  1780 + return cur;
  1781 + },
  1782 +
  1783 + sibling: function( n, elem ) {
  1784 + var r = [];
  1785 +
  1786 + for ( ; n; n = n.nextSibling ) {
  1787 + if ( n.nodeType == 1 && (!elem || n != elem) )
  1788 + r.push( n );
  1789 + }
  1790 +
  1791 + return r;
  1792 + }
  1793 +});
  1794 +
  1795 +/*
  1796 + * A number of helper functions used for managing events.
  1797 + * Many of the ideas behind this code orignated from
  1798 + * Dean Edwards' addEvent library.
  1799 + */
  1800 +jQuery.event = {
  1801 +
  1802 + // Bind an event to an element
  1803 + // Original by Dean Edwards
  1804 + add: function(elem, types, handler, data) {
  1805 + if ( elem.nodeType == 3 || elem.nodeType == 8 )
  1806 + return;
  1807 +
  1808 + // For whatever reason, IE has trouble passing the window object
  1809 + // around, causing it to be cloned in the process
  1810 + if ( jQuery.browser.msie && elem.setInterval != undefined )
  1811 + elem = window;
  1812 +
  1813 + // Make sure that the function being executed has a unique ID
  1814 + if ( !handler.guid )
  1815 + handler.guid = this.guid++;
  1816 +
  1817 + // if data is passed, bind to handler
  1818 + if( data != undefined ) {
  1819 + // Create temporary function pointer to original handler
  1820 + var fn = handler;
  1821 +
  1822 + // Create unique handler function, wrapped around original handler
  1823 + handler = function() {
  1824 + // Pass arguments and context to original handler
  1825 + return fn.apply(this, arguments);
  1826 + };
  1827 +
  1828 + // Store data in unique handler
  1829 + handler.data = data;
  1830 +
  1831 + // Set the guid of unique handler to the same of original handler, so it can be removed
  1832 + handler.guid = fn.guid;
  1833 + }
  1834 +
  1835 + // Init the element's event structure
  1836 + var events = jQuery.data(elem, "events") || jQuery.data(elem, "events", {}),
  1837 + handle = jQuery.data(elem, "handle") || jQuery.data(elem, "handle", function(){
  1838 + // returned undefined or false
  1839 + var val;
  1840 +
  1841 + // Handle the second event of a trigger and when
  1842 + // an event is called after a page has unloaded
  1843 + if ( typeof jQuery == "undefined" || jQuery.event.triggered )
  1844 + return val;
  1845 +
  1846 + val = jQuery.event.handle.apply(arguments.callee.elem, arguments);
  1847 +
  1848 + return val;
  1849 + });
  1850 + // Add elem as a property of the handle function
  1851 + // This is to prevent a memory leak with non-native
  1852 + // event in IE.
  1853 + handle.elem = elem;
  1854 +
  1855 + // Handle multiple events seperated by a space
  1856 + // jQuery(...).bind("mouseover mouseout", fn);
  1857 + jQuery.each(types.split(/\s+/), function(index, type) {
  1858 + // Namespaced event handlers
  1859 + var parts = type.split(".");
  1860 + type = parts[0];
  1861 + handler.type = parts[1];
  1862 +
  1863 + // Get the current list of functions bound to this event
  1864 + var handlers = events[type];
  1865 +
  1866 + // Init the event handler queue
  1867 + if (!handlers) {
  1868 + handlers = events[type] = {};
  1869 +
  1870 + // Check for a special event handler
  1871 + // Only use addEventListener/attachEvent if the special
  1872 + // events handler returns false
  1873 + if ( !jQuery.event.special[type] || jQuery.event.special[type].setup.call(elem) === false ) {
  1874 + // Bind the global event handler to the element
  1875 + if (elem.addEventListener)
  1876 + elem.addEventListener(type, handle, false);
  1877 + else if (elem.attachEvent)
  1878 + elem.attachEvent("on" + type, handle);
  1879 + }
  1880 + }
  1881 +
  1882 + // Add the function to the element's handler list
  1883 + handlers[handler.guid] = handler;
  1884 +
  1885 + // Keep track of which events have been used, for global triggering
  1886 + jQuery.event.global[type] = true;
  1887 + });
  1888 +
  1889 + // Nullify elem to prevent memory leaks in IE
  1890 + elem = null;
  1891 + },
  1892 +
  1893 + guid: 1,
  1894 + global: {},
  1895 +
  1896 + // Detach an event or set of events from an element
  1897 + remove: function(elem, types, handler) {
  1898 + // don't do events on text and comment nodes
  1899 + if ( elem.nodeType == 3 || elem.nodeType == 8 )
  1900 + return;
  1901 +
  1902 + var events = jQuery.data(elem, "events"), ret, index;
  1903 +
  1904 + if ( events ) {
  1905 + // Unbind all events for the element
  1906 + if ( types == undefined )
  1907 + for ( var type in events )
  1908 + this.remove( elem, type );
  1909 + else {
  1910 + // types is actually an event object here
  1911 + if ( types.type ) {
  1912 + handler = types.handler;
  1913 + types = types.type;
  1914 + }
  1915 +
  1916 + // Handle multiple events seperated by a space
  1917 + // jQuery(...).unbind("mouseover mouseout", fn);
  1918 + jQuery.each(types.split(/\s+/), function(index, type){
  1919 + // Namespaced event handlers
  1920 + var parts = type.split(".");
  1921 + type = parts[0];
  1922 +
  1923 + if ( events[type] ) {
  1924 + // remove the given handler for the given type
  1925 + if ( handler )
  1926 + delete events[type][handler.guid];
  1927 +
  1928 + // remove all handlers for the given type
  1929 + else
  1930 + for ( handler in events[type] )
  1931 + // Handle the removal of namespaced events
  1932 + if ( !parts[1] || events[type][handler].type == parts[1] )
  1933 + delete events[type][handler];
  1934 +
  1935 + // remove generic event handler if no more handlers exist
  1936 + for ( ret in events[type] ) break;
  1937 + if ( !ret ) {
  1938 + if ( !jQuery.event.special[type] || jQuery.event.special[type].teardown.call(elem) === false ) {
  1939 + if (elem.removeEventListener)
  1940 + elem.removeEventListener(type, jQuery.data(elem, "handle"), false);
  1941 + else if (elem.detachEvent)
  1942 + elem.detachEvent("on" + type, jQuery.data(elem, "handle"));
  1943 + }
  1944 + ret = null;
  1945 + delete events[type];
  1946 + }
  1947 + }
  1948 + });
  1949 + }
  1950 +
  1951 + // Remove the expando if it's no longer used
  1952 + for ( ret in events ) break;
  1953 + if ( !ret ) {
  1954 + var handle = jQuery.data( elem, "handle" );
  1955 + if ( handle ) handle.elem = null;
  1956 + jQuery.removeData( elem, "events" );
  1957 + jQuery.removeData( elem, "handle" );
  1958 + }
  1959 + }
  1960 + },
  1961 +
  1962 + trigger: function(type, data, elem, donative, extra) {
  1963 + // Clone the incoming data, if any
  1964 + data = jQuery.makeArray(data || []);
  1965 +
  1966 + // Handle a global trigger
  1967 + if ( !elem ) {
  1968 + // Only trigger if we've ever bound an event for it
  1969 + if ( this.global[type] )
  1970 + jQuery("*").add([window, document]).trigger(type, data);
  1971 +
  1972 + // Handle triggering a single element
  1973 + } else {
  1974 + // don't do events on text and comment nodes
  1975 + if ( elem.nodeType == 3 || elem.nodeType == 8 )
  1976 + return undefined;
  1977 +
  1978 + var val, ret, fn = jQuery.isFunction( elem[ type ] || null ),
  1979 + // Check to see if we need to provide a fake event, or not
  1980 + event = !data[0] || !data[0].preventDefault;
  1981 +
  1982 + // Pass along a fake event
  1983 + if ( event )
  1984 + data.unshift( this.fix({ type: type, target: elem }) );
  1985 +
  1986 + // Enforce the right trigger type
  1987 + data[0].type = type;
  1988 +
  1989 + // Trigger the event
  1990 + if ( jQuery.isFunction( jQuery.data(elem, "handle") ) )
  1991 + val = jQuery.data(elem, "handle").apply( elem, data );
  1992 +
  1993 + // Handle triggering native .onfoo handlers
  1994 + if ( !fn && elem["on"+type] && elem["on"+type].apply( elem, data ) === false )
  1995 + val = false;
  1996 +
  1997 + // Extra functions don't get the custom event object
  1998 + if ( event )
  1999 + data.shift();
  2000 +
  2001 + // Handle triggering of extra function
  2002 + if ( extra && jQuery.isFunction( extra ) ) {
  2003 + // call the extra function and tack the current return value on the end for possible inspection
  2004 + ret = extra.apply( elem, val == null ? data : data.concat( val ) );
  2005 + // if anything is returned, give it precedence and have it overwrite the previous value
  2006 + if (ret !== undefined)
  2007 + val = ret;
  2008 + }
  2009 +
  2010 + // Trigger the native events (except for clicks on links)
  2011 + if ( fn && donative !== false && val !== false && !(jQuery.nodeName(elem, 'a') && type == "click") ) {
  2012 + this.triggered = true;
  2013 + try {
  2014 + elem[ type ]();
  2015 + // prevent IE from throwing an error for some hidden elements
  2016 + } catch (e) {}
  2017 + }
  2018 +
  2019 + this.triggered = false;
  2020 + }
  2021 +
  2022 + return val;
  2023 + },
  2024 +
  2025 + handle: function(event) {
  2026 + // returned undefined or false
  2027 + var val;
  2028 +
  2029 + // Empty object is for triggered events with no data
  2030 + event = jQuery.event.fix( event || window.event || {} );
  2031 +
  2032 + // Namespaced event handlers
  2033 + var parts = event.type.split(".");
  2034 + event.type = parts[0];
  2035 +
  2036 + var handlers = jQuery.data(this, "events") && jQuery.data(this, "events")[event.type], args = Array.prototype.slice.call( arguments, 1 );
  2037 + args.unshift( event );
  2038 +
  2039 + for ( var j in handlers ) {
  2040 + var handler = handlers[j];
  2041 + // Pass in a reference to the handler function itself
  2042 + // So that we can later remove it
  2043 + args[0].handler = handler;
  2044 + args[0].data = handler.data;
  2045 +
  2046 + // Filter the functions by class
  2047 + if ( !parts[1] || handler.type == parts[1] ) {
  2048 + var ret = handler.apply( this, args );
  2049 +
  2050 + if ( val !== false )
  2051 + val = ret;
  2052 +
  2053 + if ( ret === false ) {
  2054 + event.preventDefault();
  2055 + event.stopPropagation();
  2056 + }
  2057 + }
  2058 + }
  2059 +
  2060 + // Clean up added properties in IE to prevent memory leak
  2061 + if (jQuery.browser.msie)
  2062 + event.target = event.preventDefault = event.stopPropagation =
  2063 + event.handler = event.data = null;
  2064 +
  2065 + return val;
  2066 + },
  2067 +
  2068 + fix: function(event) {
  2069 + // store a copy of the original event object
  2070 + // and clone to set read-only properties
  2071 + var originalEvent = event;
  2072 + event = jQuery.extend({}, originalEvent);
  2073 +
  2074 + // add preventDefault and stopPropagation since
  2075 + // they will not work on the clone
  2076 + event.preventDefault = function() {
  2077 + // if preventDefault exists run it on the original event
  2078 + if (originalEvent.preventDefault)
  2079 + originalEvent.preventDefault();
  2080 + // otherwise set the returnValue property of the original event to false (IE)
  2081 + originalEvent.returnValue = false;
  2082 + };
  2083 + event.stopPropagation = function() {
  2084 + // if stopPropagation exists run it on the original event
  2085 + if (originalEvent.stopPropagation)
  2086 + originalEvent.stopPropagation();
  2087 + // otherwise set the cancelBubble property of the original event to true (IE)
  2088 + originalEvent.cancelBubble = true;
  2089 + };
  2090 +
  2091 + // Fix target property, if necessary
  2092 + if ( !event.target )
  2093 + event.target = event.srcElement || document; // Fixes #1925 where srcElement might not be defined either
  2094 +
  2095 + // check if target is a textnode (safari)
  2096 + if ( event.target.nodeType == 3 )
  2097 + event.target = originalEvent.target.parentNode;
  2098 +
  2099 + // Add relatedTarget, if necessary
  2100 + if ( !event.relatedTarget && event.fromElement )
  2101 + event.relatedTarget = event.fromElement == event.target ? event.toElement : event.fromElement;
  2102 +
  2103 + // Calculate pageX/Y if missing and clientX/Y available
  2104 + if ( event.pageX == null && event.clientX != null ) {
  2105 + var doc = document.documentElement, body = document.body;
  2106 + event.pageX = event.clientX + (doc && doc.scrollLeft || body && body.scrollLeft || 0) - (doc.clientLeft || 0);
  2107 + event.pageY = event.clientY + (doc && doc.scrollTop || body && body.scrollTop || 0) - (doc.clientTop || 0);
  2108 + }
  2109 +
  2110 + // Add which for key events
  2111 + if ( !event.which && ((event.charCode || event.charCode === 0) ? event.charCode : event.keyCode) )
  2112 + event.which = event.charCode || event.keyCode;
  2113 +
  2114 + // Add metaKey to non-Mac browsers (use ctrl for PC's and Meta for Macs)
  2115 + if ( !event.metaKey && event.ctrlKey )
  2116 + event.metaKey = event.ctrlKey;
  2117 +
  2118 + // Add which for click: 1 == left; 2 == middle; 3 == right
  2119 + // Note: button is not normalized, so don't use it
  2120 + if ( !event.which && event.button )
  2121 + event.which = (event.button & 1 ? 1 : ( event.button & 2 ? 3 : ( event.button & 4 ? 2 : 0 ) ));
  2122 +
  2123 + return event;
  2124 + },
  2125 +
  2126 + special: {
  2127 + ready: {
  2128 + setup: function() {
  2129 + // Make sure the ready event is setup
  2130 + bindReady();
  2131 + return;
  2132 + },
  2133 +
  2134 + teardown: function() { return; }
  2135 + },
  2136 +
  2137 + mouseenter: {
  2138 + setup: function() {
  2139 + if ( jQuery.browser.msie ) return false;
  2140 + jQuery(this).bind("mouseover", jQuery.event.special.mouseenter.handler);
  2141 + return true;
  2142 + },
  2143 +
  2144 + teardown: function() {
  2145 + if ( jQuery.browser.msie ) return false;
  2146 + jQuery(this).unbind("mouseover", jQuery.event.special.mouseenter.handler);
  2147 + return true;
  2148 + },
  2149 +
  2150 + handler: function(event) {
  2151 + // If we actually just moused on to a sub-element, ignore it
  2152 + if ( withinElement(event, this) ) return true;
  2153 + // Execute the right handlers by setting the event type to mouseenter
  2154 + arguments[0].type = "mouseenter";
  2155 + return jQuery.event.handle.apply(this, arguments);
  2156 + }
  2157 + },
  2158 +
  2159 + mouseleave: {
  2160 + setup: function() {
  2161 + if ( jQuery.browser.msie ) return false;
  2162 + jQuery(this).bind("mouseout", jQuery.event.special.mouseleave.handler);
  2163 + return true;
  2164 + },
  2165 +
  2166 + teardown: function() {
  2167 + if ( jQuery.browser.msie ) return false;
  2168 + jQuery(this).unbind("mouseout", jQuery.event.special.mouseleave.handler);
  2169 + return true;
  2170 + },
  2171 +
  2172 + handler: function(event) {
  2173 + // If we actually just moused on to a sub-element, ignore it
  2174 + if ( withinElement(event, this) ) return true;
  2175 + // Execute the right handlers by setting the event type to mouseleave
  2176 + arguments[0].type = "mouseleave";
  2177 + return jQuery.event.handle.apply(this, arguments);
  2178 + }
  2179 + }
  2180 + }
  2181 +};
  2182 +
  2183 +jQuery.fn.extend({
  2184 + bind: function( type, data, fn ) {
  2185 + return type == "unload" ? this.one(type, data, fn) : this.each(function(){
  2186 + jQuery.event.add( this, type, fn || data, fn && data );
  2187 + });
  2188 + },
  2189 +
  2190 + one: function( type, data, fn ) {
  2191 + return this.each(function(){
  2192 + jQuery.event.add( this, type, function(event) {
  2193 + jQuery(this).unbind(event);
  2194 + return (fn || data).apply( this, arguments);
  2195 + }, fn && data);
  2196 + });
  2197 + },
  2198 +
  2199 + unbind: function( type, fn ) {
  2200 + return this.each(function(){
  2201 + jQuery.event.remove( this, type, fn );
  2202 + });
  2203 + },
  2204 +
  2205 + trigger: function( type, data, fn ) {
  2206 + return this.each(function(){
  2207 + jQuery.event.trigger( type, data, this, true, fn );
  2208 + });
  2209 + },
  2210 +
  2211 + triggerHandler: function( type, data, fn ) {
  2212 + if ( this[0] )
  2213 + return jQuery.event.trigger( type, data, this[0], false, fn );
  2214 + return undefined;
  2215 + },
  2216 +
  2217 + toggle: function() {
  2218 + // Save reference to arguments for access in closure
  2219 + var args = arguments;
  2220 +
  2221 + return this.click(function(event) {
  2222 + // Figure out which function to execute
  2223 + this.lastToggle = 0 == this.lastToggle ? 1 : 0;
  2224 +
  2225 + // Make sure that clicks stop
  2226 + event.preventDefault();
  2227 +
  2228 + // and execute the function
  2229 + return args[this.lastToggle].apply( this, arguments ) || false;
  2230 + });
  2231 + },
  2232 +
  2233 + hover: function(fnOver, fnOut) {
  2234 + return this.bind('mouseenter', fnOver).bind('mouseleave', fnOut);
  2235 + },
  2236 +
  2237 + ready: function(fn) {
  2238 + // Attach the listeners
  2239 + bindReady();
  2240 +
  2241 + // If the DOM is already ready
  2242 + if ( jQuery.isReady )
  2243 + // Execute the function immediately
  2244 + fn.call( document, jQuery );
  2245 +
  2246 + // Otherwise, remember the function for later
  2247 + else
  2248 + // Add the function to the wait list
  2249 + jQuery.readyList.push( function() { return fn.call(this, jQuery); } );
  2250 +
  2251 + return this;
  2252 + }
  2253 +});
  2254 +
  2255 +jQuery.extend({
  2256 + isReady: false,
  2257 + readyList: [],
  2258 + // Handle when the DOM is ready
  2259 + ready: function() {
  2260 + // Make sure that the DOM is not already loaded
  2261 + if ( !jQuery.isReady ) {
  2262 + // Remember that the DOM is ready
  2263 + jQuery.isReady = true;
  2264 +
  2265 + // If there are functions bound, to execute
  2266 + if ( jQuery.readyList ) {
  2267 + // Execute all of them
  2268 + jQuery.each( jQuery.readyList, function(){
  2269 + this.apply( document );
  2270 + });
  2271 +
  2272 + // Reset the list of functions
  2273 + jQuery.readyList = null;
  2274 + }
  2275 +
  2276 + // Trigger any bound ready events
  2277 + jQuery(document).triggerHandler("ready");
  2278 + }
  2279 + }
  2280 +});
  2281 +
  2282 +var readyBound = false;
  2283 +
  2284 +function bindReady(){
  2285 + if ( readyBound ) return;
  2286 + readyBound = true;
  2287 +
  2288 + // Mozilla, Opera (see further below for it) and webkit nightlies currently support this event
  2289 + if ( document.addEventListener && !jQuery.browser.opera)
  2290 + // Use the handy event callback
  2291 + document.addEventListener( "DOMContentLoaded", jQuery.ready, false );
  2292 +
  2293 + // If IE is used and is not in a frame
  2294 + // Continually check to see if the document is ready
  2295 + if ( jQuery.browser.msie && window == top ) (function(){
  2296 + if (jQuery.isReady) return;
  2297 + try {
  2298 + // If IE is used, use the trick by Diego Perini
  2299 + // http://javascript.nwbox.com/IEContentLoaded/
  2300 + document.documentElement.doScroll("left");
  2301 + } catch( error ) {
  2302 + setTimeout( arguments.callee, 0 );
  2303 + return;
  2304 + }
  2305 + // and execute any waiting functions
  2306 + jQuery.ready();
  2307 + })();
  2308 +
  2309 + if ( jQuery.browser.opera )
  2310 + document.addEventListener( "DOMContentLoaded", function () {
  2311 + if (jQuery.isReady) return;
  2312 + for (var i = 0; i < document.styleSheets.length; i++)
  2313 + if (document.styleSheets[i].disabled) {
  2314 + setTimeout( arguments.callee, 0 );
  2315 + return;
  2316 + }
  2317 + // and execute any waiting functions
  2318 + jQuery.ready();
  2319 + }, false);
  2320 +
  2321 + if ( jQuery.browser.safari ) {
  2322 + var numStyles;
  2323 + (function(){
  2324 + if (jQuery.isReady) return;
  2325 + if ( document.readyState != "loaded" && document.readyState != "complete" ) {
  2326 + setTimeout( arguments.callee, 0 );
  2327 + return;
  2328 + }
  2329 + if ( numStyles === undefined )
  2330 + numStyles = jQuery("style, link[rel=stylesheet]").length;
  2331 + if ( document.styleSheets.length != numStyles ) {
  2332 + setTimeout( arguments.callee, 0 );
  2333 + return;
  2334 + }
  2335 + // and execute any waiting functions
  2336 + jQuery.ready();
  2337 + })();
  2338 + }
  2339 +
  2340 + // A fallback to window.onload, that will always work
  2341 + jQuery.event.add( window, "load", jQuery.ready );
  2342 +}
  2343 +
  2344 +jQuery.each( ("blur,focus,load,resize,scroll,unload,click,dblclick," +
  2345 + "mousedown,mouseup,mousemove,mouseover,mouseout,change,select," +
  2346 + "submit,keydown,keypress,keyup,error").split(","), function(i, name){
  2347 +
  2348 + // Handle event binding
  2349 + jQuery.fn[name] = function(fn){
  2350 + return fn ? this.bind(name, fn) : this.trigger(name);
  2351 + };
  2352 +});
  2353 +
  2354 +// Checks if an event happened on an element within another element
  2355 +// Used in jQuery.event.special.mouseenter and mouseleave handlers
  2356 +var withinElement = function(event, elem) {
  2357 + // Check if mouse(over|out) are still within the same parent element
  2358 + var parent = event.relatedTarget;
  2359 + // Traverse up the tree
  2360 + while ( parent && parent != elem ) try { parent = parent.parentNode; } catch(error) { parent = elem; }
  2361 + // Return true if we actually just moused on to a sub-element
  2362 + return parent == elem;
  2363 +};
  2364 +
  2365 +// Prevent memory leaks in IE
  2366 +// And prevent errors on refresh with events like mouseover in other browsers
  2367 +// Window isn't included so as not to unbind existing unload events
  2368 +jQuery(window).bind("unload", function() {
  2369 + jQuery("*").add(document).unbind();
  2370 +});
  2371 +jQuery.fn.extend({
  2372 + load: function( url, params, callback ) {
  2373 + if ( jQuery.isFunction( url ) )
  2374 + return this.bind("load", url);
  2375 +
  2376 + var off = url.indexOf(" ");
  2377 + if ( off >= 0 ) {
  2378 + var selector = url.slice(off, url.length);
  2379 + url = url.slice(0, off);
  2380 + }
  2381 +
  2382 + callback = callback || function(){};
  2383 +
  2384 + // Default to a GET request
  2385 + var type = "GET";
  2386 +
  2387 + // If the second parameter was provided
  2388 + if ( params )
  2389 + // If it's a function
  2390 + if ( jQuery.isFunction( params ) ) {
  2391 + // We assume that it's the callback
  2392 + callback = params;
  2393 + params = null;
  2394 +
  2395 + // Otherwise, build a param string
  2396 + } else {
  2397 + params = jQuery.param( params );
  2398 + type = "POST";
  2399 + }
  2400 +
  2401 + var self = this;
  2402 +
  2403 + // Request the remote document
  2404 + jQuery.ajax({
  2405 + url: url,
  2406 + type: type,
  2407 + dataType: "html",
  2408 + data: params,
  2409 + complete: function(res, status){
  2410 + // If successful, inject the HTML into all the matched elements
  2411 + if ( status == "success" || status == "notmodified" )
  2412 + // See if a selector was specified
  2413 + self.html( selector ?
  2414 + // Create a dummy div to hold the results
  2415 + jQuery("<div/>")
  2416 + // inject the contents of the document in, removing the scripts
  2417 + // to avoid any 'Permission Denied' errors in IE
  2418 + .append(res.responseText.replace(/<script(.|\s)*?\/script>/g, ""))
  2419 +
  2420 + // Locate the specified elements
  2421 + .find(selector) :
  2422 +
  2423 + // If not, just inject the full result
  2424 + res.responseText );
  2425 +
  2426 + self.each( callback, [res.responseText, status, res] );
  2427 + }
  2428 + });
  2429 + return this;
  2430 + },
  2431 +
  2432 + serialize: function() {
  2433 + return jQuery.param(this.serializeArray());
  2434 + },
  2435 + serializeArray: function() {
  2436 + return this.map(function(){
  2437 + return jQuery.nodeName(this, "form") ?
  2438 + jQuery.makeArray(this.elements) : this;
  2439 + })
  2440 + .filter(function(){
  2441 + return this.name && !this.disabled &&
  2442 + (this.checked || /select|textarea/i.test(this.nodeName) ||
  2443 + /text|hidden|password/i.test(this.type));
  2444 + })
  2445 + .map(function(i, elem){
  2446 + var val = jQuery(this).val();
  2447 + return val == null ? null :
  2448 + val.constructor == Array ?
  2449 + jQuery.map( val, function(val, i){
  2450 + return {name: elem.name, value: val};
  2451 + }) :
  2452 + {name: elem.name, value: val};
  2453 + }).get();
  2454 + }
  2455 +});
  2456 +
  2457 +// Attach a bunch of functions for handling common AJAX events
  2458 +jQuery.each( "ajaxStart,ajaxStop,ajaxComplete,ajaxError,ajaxSuccess,ajaxSend".split(","), function(i,o){
  2459 + jQuery.fn[o] = function(f){
  2460 + return this.bind(o, f);
  2461 + };
  2462 +});
  2463 +
  2464 +var jsc = (new Date).getTime();
  2465 +
  2466 +jQuery.extend({
  2467 + get: function( url, data, callback, type ) {
  2468 + // shift arguments if data argument was ommited
  2469 + if ( jQuery.isFunction( data ) ) {
  2470 + callback = data;
  2471 + data = null;
  2472 + }
  2473 +
  2474 + return jQuery.ajax({
  2475 + type: "GET",
  2476 + url: url,
  2477 + data: data,
  2478 + success: callback,
  2479 + dataType: type
  2480 + });
  2481 + },
  2482 +
  2483 + getScript: function( url, callback ) {
  2484 + return jQuery.get(url, null, callback, "script");
  2485 + },
  2486 +
  2487 + getJSON: function( url, data, callback ) {
  2488 + return jQuery.get(url, data, callback, "json");
  2489 + },
  2490 +
  2491 + post: function( url, data, callback, type ) {
  2492 + if ( jQuery.isFunction( data ) ) {
  2493 + callback = data;
  2494 + data = {};
  2495 + }
  2496 +
  2497 + return jQuery.ajax({
  2498 + type: "POST",
  2499 + url: url,
  2500 + data: data,
  2501 + success: callback,
  2502 + dataType: type
  2503 + });
  2504 + },
  2505 +
  2506 + ajaxSetup: function( settings ) {
  2507 + jQuery.extend( jQuery.ajaxSettings, settings );
  2508 + },
  2509 +
  2510 + ajaxSettings: {
  2511 + global: true,
  2512 + type: "GET",
  2513 + timeout: 0,
  2514 + contentType: "application/x-www-form-urlencoded",
  2515 + processData: true,
  2516 + async: true,
  2517 + data: null,
  2518 + username: null,
  2519 + password: null,
  2520 + accepts: {
  2521 + xml: "application/xml, text/xml",
  2522 + html: "text/html",
  2523 + script: "text/javascript, application/javascript",
  2524 + json: "application/json, text/javascript",
  2525 + text: "text/plain",
  2526 + _default: "*/*"
  2527 + }
  2528 + },
  2529 +
  2530 + // Last-Modified header cache for next request
  2531 + lastModified: {},
  2532 +
  2533 + ajax: function( s ) {
  2534 + var jsonp, jsre = /=\?(&|$)/g, status, data;
  2535 +
  2536 + // Extend the settings, but re-extend 's' so that it can be
  2537 + // checked again later (in the test suite, specifically)
  2538 + s = jQuery.extend(true, s, jQuery.extend(true, {}, jQuery.ajaxSettings, s));
  2539 +
  2540 + // convert data if not already a string
  2541 + if ( s.data && s.processData && typeof s.data != "string" )
  2542 + s.data = jQuery.param(s.data);
  2543 +
  2544 + // Handle JSONP Parameter Callbacks
  2545 + if ( s.dataType == "jsonp" ) {
  2546 + if ( s.type.toLowerCase() == "get" ) {
  2547 + if ( !s.url.match(jsre) )
  2548 + s.url += (s.url.match(/\?/) ? "&" : "?") + (s.jsonp || "callback") + "=?";
  2549 + } else if ( !s.data || !s.data.match(jsre) )
  2550 + s.data = (s.data ? s.data + "&" : "") + (s.jsonp || "callback") + "=?";
  2551 + s.dataType = "json";
  2552 + }
  2553 +
  2554 + // Build temporary JSONP function
  2555 + if ( s.dataType == "json" && (s.data && s.data.match(jsre) || s.url.match(jsre)) ) {
  2556 + jsonp = "jsonp" + jsc++;
  2557 +
  2558 + // Replace the =? sequence both in the query string and the data
  2559 + if ( s.data )
  2560 + s.data = (s.data + "").replace(jsre, "=" + jsonp + "$1");
  2561 + s.url = s.url.replace(jsre, "=" + jsonp + "$1");
  2562 +
  2563 + // We need to make sure
  2564 + // that a JSONP style response is executed properly
  2565 + s.dataType = "script";
  2566 +
  2567 + // Handle JSONP-style loading
  2568 + window[ jsonp ] = function(tmp){
  2569 + data = tmp;
  2570 + success();
  2571 + complete();
  2572 + // Garbage collect
  2573 + window[ jsonp ] = undefined;
  2574 + try{ delete window[ jsonp ]; } catch(e){}
  2575 + if ( head )
  2576 + head.removeChild( script );
  2577 + };
  2578 + }
  2579 +
  2580 + if ( s.dataType == "script" && s.cache == null )
  2581 + s.cache = false;
  2582 +
  2583 + if ( s.cache === false && s.type.toLowerCase() == "get" ) {
  2584 + var ts = (new Date()).getTime();
  2585 + // try replacing _= if it is there
  2586 + var ret = s.url.replace(/(\?|&)_=.*?(&|$)/, "$1_=" + ts + "$2");
  2587 + // if nothing was replaced, add timestamp to the end
  2588 + s.url = ret + ((ret == s.url) ? (s.url.match(/\?/) ? "&" : "?") + "_=" + ts : "");
  2589 + }
  2590 +
  2591 + // If data is available, append data to url for get requests
  2592 + if ( s.data && s.type.toLowerCase() == "get" ) {
  2593 + s.url += (s.url.match(/\?/) ? "&" : "?") + s.data;
  2594 +
  2595 + // IE likes to send both get and post data, prevent this
  2596 + s.data = null;
  2597 + }
  2598 +
  2599 + // Watch for a new set of requests
  2600 + if ( s.global && ! jQuery.active++ )
  2601 + jQuery.event.trigger( "ajaxStart" );
  2602 +
  2603 + // If we're requesting a remote document
  2604 + // and trying to load JSON or Script with a GET
  2605 + if ( (!s.url.indexOf("http") || !s.url.indexOf("//")) && ( s.dataType == "script" || s.dataType =="json" ) && s.type.toLowerCase() == "get" ) {
  2606 + var head = document.getElementsByTagName("head")[0];
  2607 + var script = document.createElement("script");
  2608 + script.src = s.url;
  2609 + if (s.scriptCharset)
  2610 + script.charset = s.scriptCharset;
  2611 +
  2612 + // Handle Script loading
  2613 + if ( !jsonp ) {
  2614 + var done = false;
  2615 +
  2616 + // Attach handlers for all browsers
  2617 + script.onload = script.onreadystatechange = function(){
  2618 + if ( !done && (!this.readyState ||
  2619 + this.readyState == "loaded" || this.readyState == "complete") ) {
  2620 + done = true;
  2621 + success();
  2622 + complete();
  2623 + head.removeChild( script );
  2624 + }
  2625 + };
  2626 + }
  2627 +
  2628 + head.appendChild(script);
  2629 +
  2630 + // We handle everything using the script element injection
  2631 + return undefined;
  2632 + }
  2633 +
  2634 + var requestDone = false;
  2635 +
  2636 + // Create the request object; Microsoft failed to properly
  2637 + // implement the XMLHttpRequest in IE7, so we use the ActiveXObject when it is available
  2638 + var xml = window.ActiveXObject ? new ActiveXObject("Microsoft.XMLHTTP") : new XMLHttpRequest();
  2639 +
  2640 + // Open the socket
  2641 + xml.open(s.type, s.url, s.async, s.username, s.password);
  2642 +
  2643 + // Need an extra try/catch for cross domain requests in Firefox 3
  2644 + try {
  2645 + // Set the correct header, if data is being sent
  2646 + if ( s.data )
  2647 + xml.setRequestHeader("Content-Type", s.contentType);
  2648 +
  2649 + // Set the If-Modified-Since header, if ifModified mode.
  2650 + if ( s.ifModified )
  2651 + xml.setRequestHeader("If-Modified-Since",
  2652 + jQuery.lastModified[s.url] || "Thu, 01 Jan 1970 00:00:00 GMT" );
  2653 +
  2654 + // Set header so the called script knows that it's an XMLHttpRequest
  2655 + xml.setRequestHeader("X-Requested-With", "XMLHttpRequest");
  2656 +
  2657 + // Set the Accepts header for the server, depending on the dataType
  2658 + xml.setRequestHeader("Accept", s.dataType && s.accepts[ s.dataType ] ?
  2659 + s.accepts[ s.dataType ] + ", */*" :
  2660 + s.accepts._default );
  2661 + } catch(e){}
  2662 +
  2663 + // Allow custom headers/mimetypes
  2664 + if ( s.beforeSend )
  2665 + s.beforeSend(xml);
  2666 +
  2667 + if ( s.global )
  2668 + jQuery.event.trigger("ajaxSend", [xml, s]);
  2669 +
  2670 + // Wait for a response to come back
  2671 + var onreadystatechange = function(isTimeout){
  2672 + // The transfer is complete and the data is available, or the request timed out
  2673 + if ( !requestDone && xml && (xml.readyState == 4 || isTimeout == "timeout") ) {
  2674 + requestDone = true;
  2675 +
  2676 + // clear poll interval
  2677 + if (ival) {
  2678 + clearInterval(ival);
  2679 + ival = null;
  2680 + }
  2681 +
  2682 + status = isTimeout == "timeout" && "timeout" ||
  2683 + !jQuery.httpSuccess( xml ) && "error" ||
  2684 + s.ifModified && jQuery.httpNotModified( xml, s.url ) && "notmodified" ||
  2685 + "success";
  2686 +
  2687 + if ( status == "success" ) {
  2688 + // Watch for, and catch, XML document parse errors
  2689 + try {
  2690 + // process the data (runs the xml through httpData regardless of callback)
  2691 + data = jQuery.httpData( xml, s.dataType );
  2692 + } catch(e) {
  2693 + status = "parsererror";
  2694 + }
  2695 + }
  2696 +
  2697 + // Make sure that the request was successful or notmodified
  2698 + if ( status == "success" ) {
  2699 + // Cache Last-Modified header, if ifModified mode.
  2700 + var modRes;
  2701 + try {
  2702 + modRes = xml.getResponseHeader("Last-Modified");
  2703 + } catch(e) {} // swallow exception thrown by FF if header is not available
  2704 +
  2705 + if ( s.ifModified && modRes )
  2706 + jQuery.lastModified[s.url] = modRes;
  2707 +
  2708 + // JSONP handles its own success callback
  2709 + if ( !jsonp )
  2710 + success();
  2711 + } else
  2712 + jQuery.handleError(s, xml, status);
  2713 +
  2714 + // Fire the complete handlers
  2715 + complete();
  2716 +
  2717 + // Stop memory leaks
  2718 + if ( s.async )
  2719 + xml = null;
  2720 + }
  2721 + };
  2722 +
  2723 + if ( s.async ) {
  2724 + // don't attach the handler to the request, just poll it instead
  2725 + var ival = setInterval(onreadystatechange, 13);
  2726 +
  2727 + // Timeout checker
  2728 + if ( s.timeout > 0 )
  2729 + setTimeout(function(){
  2730 + // Check to see if the request is still happening
  2731 + if ( xml ) {
  2732 + // Cancel the request
  2733 + xml.abort();
  2734 +
  2735 + if( !requestDone )
  2736 + onreadystatechange( "timeout" );
  2737 + }
  2738 + }, s.timeout);
  2739 + }
  2740 +
  2741 + // Send the data
  2742 + try {
  2743 + xml.send(s.data);
  2744 + } catch(e) {
  2745 + jQuery.handleError(s, xml, null, e);
  2746 + }
  2747 +
  2748 + // firefox 1.5 doesn't fire statechange for sync requests
  2749 + if ( !s.async )
  2750 + onreadystatechange();
  2751 +
  2752 + function success(){
  2753 + // If a local callback was specified, fire it and pass it the data
  2754 + if ( s.success )
  2755 + s.success( data, status );
  2756 +
  2757 + // Fire the global callback
  2758 + if ( s.global )
  2759 + jQuery.event.trigger( "ajaxSuccess", [xml, s] );
  2760 + }
  2761 +
  2762 + function complete(){
  2763 + // Process result
  2764 + if ( s.complete )
  2765 + s.complete(xml, status);
  2766 +
  2767 + // The request was completed
  2768 + if ( s.global )
  2769 + jQuery.event.trigger( "ajaxComplete", [xml, s] );
  2770 +
  2771 + // Handle the global AJAX counter
  2772 + if ( s.global && ! --jQuery.active )
  2773 + jQuery.event.trigger( "ajaxStop" );
  2774 + }
  2775 +
  2776 + // return XMLHttpRequest to allow aborting the request etc.
  2777 + return xml;
  2778 + },
  2779 +
  2780 + handleError: function( s, xml, status, e ) {
  2781 + // If a local callback was specified, fire it
  2782 + if ( s.error ) s.error( xml, status, e );
  2783 +
  2784 + // Fire the global callback
  2785 + if ( s.global )
  2786 + jQuery.event.trigger( "ajaxError", [xml, s, e] );
  2787 + },
  2788 +
  2789 + // Counter for holding the number of active queries
  2790 + active: 0,
  2791 +
  2792 + // Determines if an XMLHttpRequest was successful or not
  2793 + httpSuccess: function( r ) {
  2794 + try {
  2795 + // IE error sometimes returns 1223 when it should be 204 so treat it as success, see #1450
  2796 + return !r.status && location.protocol == "file:" ||
  2797 + ( r.status >= 200 && r.status < 300 ) || r.status == 304 || r.status == 1223 ||
  2798 + jQuery.browser.safari && r.status == undefined;
  2799 + } catch(e){}
  2800 + return false;
  2801 + },
  2802 +
  2803 + // Determines if an XMLHttpRequest returns NotModified
  2804 + httpNotModified: function( xml, url ) {
  2805 + try {
  2806 + var xmlRes = xml.getResponseHeader("Last-Modified");
  2807 +
  2808 + // Firefox always returns 200. check Last-Modified date
  2809 + return xml.status == 304 || xmlRes == jQuery.lastModified[url] ||
  2810 + jQuery.browser.safari && xml.status == undefined;
  2811 + } catch(e){}
  2812 + return false;
  2813 + },
  2814 +
  2815 + httpData: function( r, type ) {
  2816 + var ct = r.getResponseHeader("content-type");
  2817 + var xml = type == "xml" || !type && ct && ct.indexOf("xml") >= 0;
  2818 + var data = xml ? r.responseXML : r.responseText;
  2819 +
  2820 + if ( xml && data.documentElement.tagName == "parsererror" )
  2821 + throw "parsererror";
  2822 +
  2823 + // If the type is "script", eval it in global context
  2824 + if ( type == "script" )
  2825 + jQuery.globalEval( data );
  2826 +
  2827 + // Get the JavaScript object, if JSON is used.
  2828 + if ( type == "json" )
  2829 + data = eval("(" + data + ")");
  2830 +
  2831 + return data;
  2832 + },
  2833 +
  2834 + // Serialize an array of form elements or a set of
  2835 + // key/values into a query string
  2836 + param: function( a ) {
  2837 + var s = [];
  2838 +
  2839 + // If an array was passed in, assume that it is an array
  2840 + // of form elements
  2841 + if ( a.constructor == Array || a.jquery )
  2842 + // Serialize the form elements
  2843 + jQuery.each( a, function(){
  2844 + s.push( encodeURIComponent(this.name) + "=" + encodeURIComponent( this.value ) );
  2845 + });
  2846 +
  2847 + // Otherwise, assume that it's an object of key/value pairs
  2848 + else
  2849 + // Serialize the key/values
  2850 + for ( var j in a )
  2851 + // If the value is an array then the key names need to be repeated
  2852 + if ( a[j] && a[j].constructor == Array )
  2853 + jQuery.each( a[j], function(){
  2854 + s.push( encodeURIComponent(j) + "=" + encodeURIComponent( this ) );
  2855 + });
  2856 + else
  2857 + s.push( encodeURIComponent(j) + "=" + encodeURIComponent( a[j] ) );
  2858 +
  2859 + // Return the resulting serialization
  2860 + return s.join("&").replace(/%20/g, "+");
  2861 + }
  2862 +
  2863 +});
  2864 +jQuery.fn.extend({
  2865 + show: function(speed,callback){
  2866 + return speed ?
  2867 + this.animate({
  2868 + height: "show", width: "show", opacity: "show"
  2869 + }, speed, callback) :
  2870 +
  2871 + this.filter(":hidden").each(function(){
  2872 + this.style.display = this.oldblock || "";
  2873 + if ( jQuery.css(this,"display") == "none" ) {
  2874 + var elem = jQuery("<" + this.tagName + " />").appendTo("body");
  2875 + this.style.display = elem.css("display");
  2876 + // handle an edge condition where css is - div { display:none; } or similar
  2877 + if (this.style.display == "none")
  2878 + this.style.display = "block";
  2879 + elem.remove();
  2880 + }
  2881 + }).end();
  2882 + },
  2883 +
  2884 + hide: function(speed,callback){
  2885 + return speed ?
  2886 + this.animate({
  2887 + height: "hide", width: "hide", opacity: "hide"
  2888 + }, speed, callback) :
  2889 +
  2890 + this.filter(":visible").each(function(){
  2891 + this.oldblock = this.oldblock || jQuery.css(this,"display");
  2892 + this.style.display = "none";
  2893 + }).end();
  2894 + },
  2895 +
  2896 + // Save the old toggle function
  2897 + _toggle: jQuery.fn.toggle,
  2898 +
  2899 + toggle: function( fn, fn2 ){
  2900 + return jQuery.isFunction(fn) && jQuery.isFunction(fn2) ?
  2901 + this._toggle( fn, fn2 ) :
  2902 + fn ?
  2903 + this.animate({
  2904 + height: "toggle", width: "toggle", opacity: "toggle"
  2905 + }, fn, fn2) :
  2906 + this.each(function(){
  2907 + jQuery(this)[ jQuery(this).is(":hidden") ? "show" : "hide" ]();
  2908 + });
  2909 + },
  2910 +
  2911 + slideDown: function(speed,callback){
  2912 + return this.animate({height: "show"}, speed, callback);
  2913 + },
  2914 +
  2915 + slideUp: function(speed,callback){
  2916 + return this.animate({height: "hide"}, speed, callback);
  2917 + },
  2918 +
  2919 + slideToggle: function(speed, callback){
  2920 + return this.animate({height: "toggle"}, speed, callback);
  2921 + },
  2922 +
  2923 + fadeIn: function(speed, callback){
  2924 + return this.animate({opacity: "show"}, speed, callback);
  2925 + },
  2926 +
  2927 + fadeOut: function(speed, callback){
  2928 + return this.animate({opacity: "hide"}, speed, callback);
  2929 + },
  2930 +
  2931 + fadeTo: function(speed,to,callback){
  2932 + return this.animate({opacity: to}, speed, callback);
  2933 + },
  2934 +
  2935 + animate: function( prop, speed, easing, callback ) {
  2936 + var optall = jQuery.speed(speed, easing, callback);
  2937 +
  2938 + return this[ optall.queue === false ? "each" : "queue" ](function(){
  2939 + if ( this.nodeType != 1)
  2940 + return false;
  2941 +
  2942 + var opt = jQuery.extend({}, optall);
  2943 + var hidden = jQuery(this).is(":hidden"), self = this;
  2944 +
  2945 + for ( var p in prop ) {
  2946 + if ( prop[p] == "hide" && hidden || prop[p] == "show" && !hidden )
  2947 + return jQuery.isFunction(opt.complete) && opt.complete.apply(this);
  2948 +
  2949 + if ( p == "height" || p == "width" ) {
  2950 + // Store display property
  2951 + opt.display = jQuery.css(this, "display");
  2952 +
  2953 + // Make sure that nothing sneaks out
  2954 + opt.overflow = this.style.overflow;
  2955 + }
  2956 + }
  2957 +
  2958 + if ( opt.overflow != null )
  2959 + this.style.overflow = "hidden";
  2960 +
  2961 + opt.curAnim = jQuery.extend({}, prop);
  2962 +
  2963 + jQuery.each( prop, function(name, val){
  2964 + var e = new jQuery.fx( self, opt, name );
  2965 +
  2966 + if ( /toggle|show|hide/.test(val) )
  2967 + e[ val == "toggle" ? hidden ? "show" : "hide" : val ]( prop );
  2968 + else {
  2969 + var parts = val.toString().match(/^([+-]=)?([\d+-.]+)(.*)$/),
  2970 + start = e.cur(true) || 0;
  2971 +
  2972 + if ( parts ) {
  2973 + var end = parseFloat(parts[2]),
  2974 + unit = parts[3] || "px";
  2975 +
  2976 + // We need to compute starting value
  2977 + if ( unit != "px" ) {
  2978 + self.style[ name ] = (end || 1) + unit;
  2979 + start = ((end || 1) / e.cur(true)) * start;
  2980 + self.style[ name ] = start + unit;
  2981 + }
  2982 +
  2983 + // If a +=/-= token was provided, we're doing a relative animation
  2984 + if ( parts[1] )
  2985 + end = ((parts[1] == "-=" ? -1 : 1) * end) + start;
  2986 +
  2987 + e.custom( start, end, unit );
  2988 + } else
  2989 + e.custom( start, val, "" );
  2990 + }
  2991 + });
  2992 +
  2993 + // For JS strict compliance
  2994 + return true;
  2995 + });
  2996 + },
  2997 +
  2998 + queue: function(type, fn){
  2999 + if ( jQuery.isFunction(type) || ( type && type.constructor == Array )) {
  3000 + fn = type;
  3001 + type = "fx";
  3002 + }
  3003 +
  3004 + if ( !type || (typeof type == "string" && !fn) )
  3005 + return queue( this[0], type );
  3006 +
  3007 + return this.each(function(){
  3008 + if ( fn.constructor == Array )
  3009 + queue(this, type, fn);
  3010 + else {
  3011 + queue(this, type).push( fn );
  3012 +
  3013 + if ( queue(this, type).length == 1 )
  3014 + fn.apply(this);
  3015 + }
  3016 + });
  3017 + },
  3018 +
  3019 + stop: function(clearQueue, gotoEnd){
  3020 + var timers = jQuery.timers;
  3021 +
  3022 + if (clearQueue)
  3023 + this.queue([]);
  3024 +
  3025 + this.each(function(){
  3026 + // go in reverse order so anything added to the queue during the loop is ignored
  3027 + for ( var i = timers.length - 1; i >= 0; i-- )
  3028 + if ( timers[i].elem == this ) {
  3029 + if (gotoEnd)
  3030 + // force the next step to be the last
  3031 + timers[i](true);
  3032 + timers.splice(i, 1);
  3033 + }
  3034 + });
  3035 +
  3036 + // start the next in the queue if the last step wasn't forced
  3037 + if (!gotoEnd)
  3038 + this.dequeue();
  3039 +
  3040 + return this;
  3041 + }
  3042 +
  3043 +});
  3044 +
  3045 +var queue = function( elem, type, array ) {
  3046 + if ( !elem )
  3047 + return undefined;
  3048 +
  3049 + type = type || "fx";
  3050 +
  3051 + var q = jQuery.data( elem, type + "queue" );
  3052 +
  3053 + if ( !q || array )
  3054 + q = jQuery.data( elem, type + "queue",
  3055 + array ? jQuery.makeArray(array) : [] );
  3056 +
  3057 + return q;
  3058 +};
  3059 +
  3060 +jQuery.fn.dequeue = function(type){
  3061 + type = type || "fx";
  3062 +
  3063 + return this.each(function(){
  3064 + var q = queue(this, type);
  3065 +
  3066 + q.shift();
  3067 +
  3068 + if ( q.length )
  3069 + q[0].apply( this );
  3070 + });
  3071 +};
  3072 +
  3073 +jQuery.extend({
  3074 +
  3075 + speed: function(speed, easing, fn) {
  3076 + var opt = speed && speed.constructor == Object ? speed : {
  3077 + complete: fn || !fn && easing ||
  3078 + jQuery.isFunction( speed ) && speed,
  3079 + duration: speed,
  3080 + easing: fn && easing || easing && easing.constructor != Function && easing
  3081 + };
  3082 +
  3083 + opt.duration = (opt.duration && opt.duration.constructor == Number ?
  3084 + opt.duration :
  3085 + { slow: 600, fast: 200 }[opt.duration]) || 400;
  3086 +
  3087 + // Queueing
  3088 + opt.old = opt.complete;
  3089 + opt.complete = function(){
  3090 + if ( opt.queue !== false )
  3091 + jQuery(this).dequeue();
  3092 + if ( jQuery.isFunction( opt.old ) )
  3093 + opt.old.apply( this );
  3094 + };
  3095 +
  3096 + return opt;
  3097 + },
  3098 +
  3099 + easing: {
  3100 + linear: function( p, n, firstNum, diff ) {
  3101 + return firstNum + diff * p;
  3102 + },
  3103 + swing: function( p, n, firstNum, diff ) {
  3104 + return ((-Math.cos(p*Math.PI)/2) + 0.5) * diff + firstNum;
  3105 + }
  3106 + },
  3107 +
  3108 + timers: [],
  3109 + timerId: null,
  3110 +
  3111 + fx: function( elem, options, prop ){
  3112 + this.options = options;
  3113 + this.elem = elem;
  3114 + this.prop = prop;
  3115 +
  3116 + if ( !options.orig )
  3117 + options.orig = {};
  3118 + }
  3119 +
  3120 +});
  3121 +
  3122 +jQuery.fx.prototype = {
  3123 +
  3124 + // Simple function for setting a style value
  3125 + update: function(){
  3126 + if ( this.options.step )
  3127 + this.options.step.apply( this.elem, [ this.now, this ] );
  3128 +
  3129 + (jQuery.fx.step[this.prop] || jQuery.fx.step._default)( this );
  3130 +
  3131 + // Set display property to block for height/width animations
  3132 + if ( this.prop == "height" || this.prop == "width" )
  3133 + this.elem.style.display = "block";
  3134 + },
  3135 +
  3136 + // Get the current size
  3137 + cur: function(force){
  3138 + if ( this.elem[this.prop] != null && this.elem.style[this.prop] == null )
  3139 + return this.elem[ this.prop ];
  3140 +
  3141 + var r = parseFloat(jQuery.css(this.elem, this.prop, force));
  3142 + return r && r > -10000 ? r : parseFloat(jQuery.curCSS(this.elem, this.prop)) || 0;
  3143 + },
  3144 +
  3145 + // Start an animation from one number to another
  3146 + custom: function(from, to, unit){
  3147 + this.startTime = (new Date()).getTime();
  3148 + this.start = from;
  3149 + this.end = to;
  3150 + this.unit = unit || this.unit || "px";
  3151 + this.now = this.start;
  3152 + this.pos = this.state = 0;
  3153 + this.update();
  3154 +
  3155 + var self = this;
  3156 + function t(gotoEnd){
  3157 + return self.step(gotoEnd);
  3158 + }
  3159 +
  3160 + t.elem = this.elem;
  3161 +
  3162 + jQuery.timers.push(t);
  3163 +
  3164 + if ( jQuery.timerId == null ) {
  3165 + jQuery.timerId = setInterval(function(){
  3166 + var timers = jQuery.timers;
  3167 +
  3168 + for ( var i = 0; i < timers.length; i++ )
  3169 + if ( !timers[i]() )
  3170 + timers.splice(i--, 1);
  3171 +
  3172 + if ( !timers.length ) {
  3173 + clearInterval( jQuery.timerId );
  3174 + jQuery.timerId = null;
  3175 + }
  3176 + }, 13);
  3177 + }
  3178 + },
  3179 +
  3180 + // Simple 'show' function
  3181 + show: function(){
  3182 + // Remember where we started, so that we can go back to it later
  3183 + this.options.orig[this.prop] = jQuery.attr( this.elem.style, this.prop );
  3184 + this.options.show = true;
  3185 +
  3186 + // Begin the animation
  3187 + this.custom(0, this.cur());
  3188 +
  3189 + // Make sure that we start at a small width/height to avoid any
  3190 + // flash of content
  3191 + if ( this.prop == "width" || this.prop == "height" )
  3192 + this.elem.style[this.prop] = "1px";
  3193 +
  3194 + // Start by showing the element
  3195 + jQuery(this.elem).show();
  3196 + },
  3197 +
  3198 + // Simple 'hide' function
  3199 + hide: function(){
  3200 + // Remember where we started, so that we can go back to it later
  3201 + this.options.orig[this.prop] = jQuery.attr( this.elem.style, this.prop );
  3202 + this.options.hide = true;
  3203 +
  3204 + // Begin the animation
  3205 + this.custom(this.cur(), 0);
  3206 + },
  3207 +
  3208 + // Each step of an animation
  3209 + step: function(gotoEnd){
  3210 + var t = (new Date()).getTime();
  3211 +
  3212 + if ( gotoEnd || t > this.options.duration + this.startTime ) {
  3213 + this.now = this.end;
  3214 + this.pos = this.state = 1;
  3215 + this.update();
  3216 +
  3217 + this.options.curAnim[ this.prop ] = true;
  3218 +
  3219 + var done = true;
  3220 + for ( var i in this.options.curAnim )
  3221 + if ( this.options.curAnim[i] !== true )
  3222 + done = false;
  3223 +
  3224 + if ( done ) {
  3225 + if ( this.options.display != null ) {
  3226 + // Reset the overflow
  3227 + this.elem.style.overflow = this.options.overflow;
  3228 +
  3229 + // Reset the display
  3230 + this.elem.style.display = this.options.display;
  3231 + if ( jQuery.css(this.elem, "display") == "none" )
  3232 + this.elem.style.display = "block";
  3233 + }
  3234 +
  3235 + // Hide the element if the "hide" operation was done
  3236 + if ( this.options.hide )
  3237 + this.elem.style.display = "none";
  3238 +
  3239 + // Reset the properties, if the item has been hidden or shown
  3240 + if ( this.options.hide || this.options.show )
  3241 + for ( var p in this.options.curAnim )
  3242 + jQuery.attr(this.elem.style, p, this.options.orig[p]);
  3243 + }
  3244 +
  3245 + // If a callback was provided, execute it
  3246 + if ( done && jQuery.isFunction( this.options.complete ) )
  3247 + // Execute the complete function
  3248 + this.options.complete.apply( this.elem );
  3249 +
  3250 + return false;
  3251 + } else {
  3252 + var n = t - this.startTime;
  3253 + this.state = n / this.options.duration;
  3254 +
  3255 + // Perform the easing function, defaults to swing
  3256 + this.pos = jQuery.easing[this.options.easing || (jQuery.easing.swing ? "swing" : "linear")](this.state, n, 0, 1, this.options.duration);
  3257 + this.now = this.start + ((this.end - this.start) * this.pos);
  3258 +
  3259 + // Perform the next step of the animation
  3260 + this.update();
  3261 + }
  3262 +
  3263 + return true;
  3264 + }
  3265 +
  3266 +};
  3267 +
  3268 +jQuery.fx.step = {
  3269 + scrollLeft: function(fx){
  3270 + fx.elem.scrollLeft = fx.now;
  3271 + },
  3272 +
  3273 + scrollTop: function(fx){
  3274 + fx.elem.scrollTop = fx.now;
  3275 + },
  3276 +
  3277 + opacity: function(fx){
  3278 + jQuery.attr(fx.elem.style, "opacity", fx.now);
  3279 + },
  3280 +
  3281 + _default: function(fx){
  3282 + fx.elem.style[ fx.prop ] = fx.now + fx.unit;
  3283 + }
  3284 +};
  3285 +// The Offset Method
  3286 +// Originally By Brandon Aaron, part of the Dimension Plugin
  3287 +// http://jquery.com/plugins/project/dimensions
  3288 +jQuery.fn.offset = function() {
  3289 + var left = 0, top = 0, elem = this[0], results;
  3290 +
  3291 + if ( elem ) with ( jQuery.browser ) {
  3292 + var parent = elem.parentNode,
  3293 + offsetChild = elem,
  3294 + offsetParent = elem.offsetParent,
  3295 + doc = elem.ownerDocument,
  3296 + safari2 = safari && parseInt(version) < 522,
  3297 + fixed = jQuery.css(elem, "position") == "fixed";
  3298 +
  3299 + // Use getBoundingClientRect if available
  3300 + if ( elem.getBoundingClientRect ) {
  3301 + var box = elem.getBoundingClientRect();
  3302 +
  3303 + // Add the document scroll offsets
  3304 + add(box.left + Math.max(doc.documentElement.scrollLeft, doc.body.scrollLeft),
  3305 + box.top + Math.max(doc.documentElement.scrollTop, doc.body.scrollTop));
  3306 +
  3307 + // IE adds the HTML element's border, by default it is medium which is 2px
  3308 + // IE 6 and 7 quirks mode the border width is overwritable by the following css html { border: 0; }
  3309 + // IE 7 standards mode, the border is always 2px
  3310 + // This border/offset is typically represented by the clientLeft and clientTop properties
  3311 + // However, in IE6 and 7 quirks mode the clientLeft and clientTop properties are not updated when overwriting it via CSS
  3312 + // Therefore this method will be off by 2px in IE while in quirksmode
  3313 + add( -doc.documentElement.clientLeft, -doc.documentElement.clientTop );
  3314 +
  3315 + // Otherwise loop through the offsetParents and parentNodes
  3316 + } else {
  3317 +
  3318 + // Initial element offsets
  3319 + add( elem.offsetLeft, elem.offsetTop );
  3320 +
  3321 + // Get parent offsets
  3322 + while ( offsetParent ) {
  3323 + // Add offsetParent offsets
  3324 + add( offsetParent.offsetLeft, offsetParent.offsetTop );
  3325 +
  3326 + // Mozilla and Safari > 2 does not include the border on offset parents
  3327 + // However Mozilla adds the border for table or table cells
  3328 + if ( mozilla && !/^t(able|d|h)$/i.test(offsetParent.tagName) || safari && !safari2 )
  3329 + border( offsetParent );
  3330 +
  3331 + // Add the document scroll offsets if position is fixed on any offsetParent
  3332 + if ( !fixed && jQuery.css(offsetParent, "position") == "fixed" )
  3333 + fixed = true;
  3334 +
  3335 + // Set offsetChild to previous offsetParent unless it is the body element
  3336 + offsetChild = /^body$/i.test(offsetParent.tagName) ? offsetChild : offsetParent;
  3337 + // Get next offsetParent
  3338 + offsetParent = offsetParent.offsetParent;
  3339 + }
  3340 +
  3341 + // Get parent scroll offsets
  3342 + while ( parent && parent.tagName && !/^body|html$/i.test(parent.tagName) ) {
  3343 + // Remove parent scroll UNLESS that parent is inline or a table to work around Opera inline/table scrollLeft/Top bug
  3344 + if ( !/^inline|table.*$/i.test(jQuery.css(parent, "display")) )
  3345 + // Subtract parent scroll offsets
  3346 + add( -parent.scrollLeft, -parent.scrollTop );
  3347 +
  3348 + // Mozilla does not add the border for a parent that has overflow != visible
  3349 + if ( mozilla && jQuery.css(parent, "overflow") != "visible" )
  3350 + border( parent );
  3351 +
  3352 + // Get next parent
  3353 + parent = parent.parentNode;
  3354 + }
  3355 +
  3356 + // Safari <= 2 doubles body offsets with a fixed position element/offsetParent or absolutely positioned offsetChild
  3357 + // Mozilla doubles body offsets with a non-absolutely positioned offsetChild
  3358 + if ( (safari2 && (fixed || jQuery.css(offsetChild, "position") == "absolute")) ||
  3359 + (mozilla && jQuery.css(offsetChild, "position") != "absolute") )
  3360 + add( -doc.body.offsetLeft, -doc.body.offsetTop );
  3361 +
  3362 + // Add the document scroll offsets if position is fixed
  3363 + if ( fixed )
  3364 + add(Math.max(doc.documentElement.scrollLeft, doc.body.scrollLeft),
  3365 + Math.max(doc.documentElement.scrollTop, doc.body.scrollTop));
  3366 + }
  3367 +
  3368 + // Return an object with top and left properties
  3369 + results = { top: top, left: left };
  3370 + }
  3371 +
  3372 + function border(elem) {
  3373 + add( jQuery.curCSS(elem, "borderLeftWidth", true), jQuery.curCSS(elem, "borderTopWidth", true) );
  3374 + }
  3375 +
  3376 + function add(l, t) {
  3377 + left += parseInt(l) || 0;
  3378 + top += parseInt(t) || 0;
  3379 + }
  3380 +
  3381 + return results;
  3382 +};
  3383 +})();
setup/migrate/resources/jquery-tooltip/todo 0 → 100644
  1 +1.3
  2 +---
  3 +
  4 +* leverage advanced background-styling, eg. see http://www.google.com/intl/en_ALL/mapfiles/iw2.png
  5 +* add ability to display remote tooltip for other elements, eg. an invalid input
  6 +* Add stop-queue stuff for fadein/out without nasty queues
  7 +* add delay on hide
  8 +* add stick on hover of tooltip (with track:false)
  9 +* offer hoverIntent support
setup/migrate/resources/wizard.css 0 → 100644
  1 +* { margin: 0; padding: 0; }
  2 +
  3 +body {
  4 + background-attachment:scroll;
  5 + background-color:transparent;
  6 + background-image:url("graphics/dame/loginbg.png");
  7 + background-position:0 0;
  8 + background-repeat:repeat-x;
  9 + font-family:sans-serif;
  10 + color:grey;
  11 +}
  12 +
  13 +h1 {
  14 + font-size:165%;
  15 + margin-bottom:5px;
  16 + margin-top:0;
  17 +}
  18 +
  19 +h2 {
  20 + font-size: 1.5em;
  21 + font-weight: normal;
  22 + padding: 10px 0;
  23 + color: #555;
  24 +}
  25 +
  26 +h3 {
  27 + font-size: 1.2em;
  28 + font-weight: normal;
  29 + padding: 10px 0;
  30 + color: #555;
  31 +}
  32 +
  33 +
  34 +p {
  35 + padding-bottom: 10px;
  36 + word-wrap: break-word;
  37 +}
  38 +
  39 +p.title {
  40 + font-size: 165%;
  41 + margin-bottom: 5px;
  42 + margin-top: 0px;
  43 +}
  44 +
  45 +a {
  46 + color: #EC7725;
  47 +}
  48 +
  49 +th {
  50 + font-weight: bold;
  51 + text-align: left;
  52 + padding: 5px 5px;
  53 +}
  54 +
  55 +td {
  56 + padding: 2px 5px;
  57 +}
  58 +
  59 +select {
  60 + width: 320px;
  61 +}
  62 +
  63 +/* *** Layout Styles *** */
  64 +
  65 +#outer-wrapper {
  66 + border:1px solid #B7B7B7;
  67 + left:215px;
  68 + position:relative;
  69 + top:20px;
  70 + width:1024px;
  71 +}
  72 +
  73 +#header {
  74 + background: transparent url("graphics/dame/migrater_head.png") repeat scroll 0% 0%;
  75 + text-align: right;
  76 + font-size: 100%;
  77 + color: rgb(167, 167, 167);
  78 + font-family: sans-serif;
  79 + height: 71px;
  80 + font-family:sans-serif;
  81 + padding-right:15px;
  82 +}
  83 +
  84 +#wrapper {
  85 + background: white url("graphics/background.gif") repeat-y left;
  86 +}
  87 +
  88 +#container {
  89 + width: 100%;
  90 + background: white url("graphics/background.gif") repeat-y left;
  91 + float: right;
  92 +}
  93 +
  94 +#content {
  95 + margin-left: 220px;
  96 + height:515px;
  97 +}
  98 +
  99 +#content_container {
  100 + padding:20px;
  101 + vertical-align: middle;
  102 + font-size: 10pt;
  103 +}
  104 +
  105 +#step_content {
  106 + border: 1px solid rgb(207, 207, 207);
  107 + padding: 5px;
  108 + overflow: auto;
  109 + height: 400px;
  110 +}
  111 +
  112 +#step_content_dependencies {
  113 + border: 1px solid rgb(207, 207, 207);
  114 + padding: 5px;
  115 + min-height:265px;
  116 +}
  117 +
  118 +#step_content_configuration {
  119 + border: 1px solid rgb(207, 207, 207);
  120 + padding: 5px;
  121 + min-height:290px;
  122 +}
  123 +
  124 +#step_content_registration {
  125 + border: 1px solid rgb(207, 207, 207);
  126 + padding: 5px;
  127 + height:295px;
  128 +}
  129 +
  130 +#step_content_registration_confirm {
  131 + border: 1px solid rgb(207, 207, 207);
  132 + padding: 5px;
  133 + height:400px;
  134 +}
  135 +
  136 +#step_content_migrate {
  137 + border: 1px solid rgb(207, 207, 207);
  138 + padding: 5px;
  139 + height:290px;
  140 +}
  141 +
  142 +#step_content_database {
  143 + border: 1px solid rgb(207, 207, 207);
  144 + padding: 5px;
  145 + min-height:355px;
  146 +}
  147 +
  148 +#step_content_database_confirm {
  149 + border: 1px solid rgb(207, 207, 207);
  150 + padding: 5px;
  151 + height:375px;
  152 +}
  153 +
  154 +#step_content_complete {
  155 + border: 1px solid rgb(207, 207, 207);
  156 + padding: 5px;
  157 + min-height:355px;
  158 +}
  159 +
  160 +#sidebar {
  161 + /*background: rgb(239, 239, 239) none repeat scroll 0% 0%;*/
  162 + font-size: 90%;
  163 + color: grey;
  164 + font-family: sans-serif;
  165 + margin-top: 0px;
  166 + /*width: 235px;*/
  167 + float: left;
  168 + padding-top: 20px;
  169 + padding-bottom: 20px;
  170 + /*height:475px;*/
  171 + /*color:#616161;*/
  172 + line-height:3;
  173 + padding-left:20px;
  174 + text-align:left;
  175 +}
  176 +
  177 +#footer {
  178 + background-image:url("graphics/dame/navbar.png");
  179 + height:35px;
  180 +}
  181 +
  182 +.clearing {
  183 + height: 0;
  184 + clear: both;
  185 +}
  186 +
  187 +/* Content Styles */
  188 +
  189 +.logo {
  190 + background: url("graphics/logo.png") no-repeat;
  191 + background-position: top left;
  192 + height: 50px;
  193 + width: 200px;
  194 + margin-left: 10px;
  195 +}
  196 +
  197 +#logo {
  198 + position:relative;
  199 + right:760px;
  200 + top:20px;
  201 +}
  202 +
  203 +#migrate_details {
  204 + bottom:20px;
  205 + position:relative;
  206 + right:10px;
  207 +}
  208 +
  209 +.indicator a {
  210 + background:url("graphics/dame/tick1.png") no-repeat left;
  211 + padding-top:15px;
  212 + padding-bottom:10px;
  213 + padding-left:30px;
  214 + color: #1c9e00;
  215 +}
  216 +
  217 +.active {
  218 + background:url("graphics/dame/tick1.png") no-repeat left;
  219 + padding-top:15px;
  220 + padding-bottom:10px;
  221 + padding-left:30px;
  222 + color: #1c9e00;
  223 +}
  224 +
  225 +.inactive {
  226 + background:url("graphics/dame/tick2.png") no-repeat left;
  227 + padding-top:15px;
  228 + padding-bottom:10px;
  229 + padding-left:30px;
  230 + color:#a7a7a7;
  231 +}
  232 +
  233 +.current {
  234 + background:url("graphics/dame/dot.png") no-repeat left;
  235 + padding-top:15px;
  236 + padding-bottom:10px;
  237 + padding-left:30px;
  238 + color: #f36a00;
  239 +}
  240 +
  241 +.tick {
  242 + background: url("graphics/tick.png") no-repeat;
  243 + height: 16px;
  244 + width: 16px;
  245 +}
  246 +
  247 +.cross {
  248 + background: url("graphics/cross.png") no-repeat;
  249 + height: 16px;
  250 + width: 16px;
  251 + color:#A30000;
  252 +}
  253 +
  254 +.cross_orange {
  255 + background: url("graphics/cross_orange.png") no-repeat;
  256 + height: 16px;
  257 + width: 16px;
  258 + color:#EC7725;
  259 +}
  260 +
  261 +.green {
  262 + color: green;
  263 + align: center;
  264 +}
  265 +
  266 +.orange {
  267 + color: orange;
  268 + align: center;
  269 +}
  270 +
  271 +.error {
  272 + font-weight: bold;
  273 + color: red;
  274 +}
  275 +
  276 +.conf_paths {
  277 + width:755px;
  278 +}
  279 +
  280 +.errors {
  281 + color: #9F0000;
  282 +}
  283 +
  284 +.buttons {
  285 + bottom: 40px;
  286 + right:20px;
  287 + position: absolute;
  288 + width:120px;
  289 +}
  290 +
  291 +.back {
  292 + background-image: url("graphics/dame/kt_gradient.jpg");
  293 + background-repeat:repeat-x;
  294 + border:1px solid #CECECE;
  295 + float:left;
  296 + font-size:13px;
  297 + font-weight:bold;
  298 + margin-left:0;
  299 + margin-top:10px;
  300 +}
  301 +
  302 +.textinput {
  303 + margin-top:0px;
  304 + float:left;
  305 +}
  306 +
  307 +.step input {
  308 + background-image: url("graphics/dame/kt_gradient.jpg");
  309 + background-repeat:repeat-x;
  310 + border:1px solid #CECECE;
  311 + float:right;
  312 + font-size:13px;
  313 + font-weight:bold;
  314 + margin-left:5px;
  315 + /*margin-top:10px;*/
  316 +}
  317 +
  318 +.step .radio {
  319 + float:none;
  320 +}
  321 +
  322 +.button_next {
  323 + float:right;
  324 + margin-left:5px;
  325 + margin-top:10px;
  326 +}
  327 +
  328 +.button_previous {
  329 + float:left;
  330 + margin-left:0px;
  331 + margin-top:10px;
  332 +}
  333 +
  334 +.buttons a {
  335 + background: #DDDDDD;
  336 + border: solid 1px #888;
  337 + padding: 2px 8px 2px 5px;
  338 + text-decoration: none;
  339 + color: #EC7725;
  340 +}
  341 +
  342 +.powered-by {
  343 + background: url("graphics/powered-by-kt.png") no-repeat;
  344 + background-position: center left;
  345 + height: 50px;
  346 + width: 140px;
  347 + margin-left: 10px;
  348 +}
  349 +
  350 +.adv_options {
  351 +
  352 +}
  353 +
  354 +.onclick {
  355 + cursor: pointer;
  356 + color: #EC7725;
  357 + width: 130px;
  358 +}
  359 +
  360 +.description {
  361 + color:#898989;
  362 + line-height:150%;
  363 + /*margin-bottom:0.75em;*/
  364 + font-size:90%;
  365 +}
  366 +
  367 +.disclaimer {
  368 + border: solid 1px #EFBE87;
  369 + margin: 0 20px;
  370 + padding: 5px;
  371 + font-size: 85%;
  372 +}
  373 +
  374 +.top {
  375 + font-size: 2em;
  376 + font-weight: normal;
  377 + padding: 10px 0;
  378 + color: #444;
  379 +}
  380 +
  381 +.right_top {
  382 + height:45px;
  383 +}
  384 +
  385 +#dbconf {
  386 + width:755px;
  387 +}
  388 +
  389 +table#dbconf tr td {
  390 + width:50%;
  391 +}
  392 +
  393 +table#dbconf tr td input{
  394 +
  395 +}
  396 +
  397 +.options {
  398 + width:15%;
  399 +}
  400 +
  401 +.adv_options {
  402 + padding: 5px 8px;
  403 +}
  404 +
  405 +#section {
  406 +
  407 +}
  408 +
  409 +.php_ext_details table {
  410 + width:745px;
  411 +}
  412 +
  413 +.php_ext_details table tr {
  414 +
  415 +}
  416 +
  417 +td.ext_indicator {
  418 + width:10px;
  419 +}
  420 +
  421 +td.ext_name {
  422 + width:110p;
  423 +}
  424 +
  425 +td.ext_description {
  426 + width:360px;
  427 +}
  428 +
  429 +td.ext_error {
  430 + width:350px;
  431 +}
  432 +
  433 +td.ext_refresh {
  434 + width:10px;
  435 +}
  436 +
  437 +td.dir_name {
  438 + width:200px;
  439 +}
  440 +
  441 +td.dir_description {
  442 + width:200px;
  443 +}
  444 +
  445 +.php_con_details table {
  446 + width:745px;
  447 + /*border:1px solid;*/
  448 +}
  449 +
  450 +.error_message {
  451 + border:none;
  452 + color:#A30000;
  453 + padding:0px;
  454 + color:red;
  455 + font-size:90%;
  456 + margin-bottom:0.75em;
  457 + font-weight:bold;
  458 +}
  459 +
  460 +.warning_message{
  461 + border:none;
  462 + color:#A30000;
  463 + padding:0px;
  464 + color:#EC7725;
  465 + font-size:90%;
  466 + margin-bottom:0.75em;
  467 + font-weight:bold;
  468 +}
  469 +
  470 +.continue_message {
  471 + border:none;
  472 + width:550px;
  473 + padding:0px;
  474 + color:#898989;
  475 + font-size:90%;
  476 + margin-bottom:0.75em;
  477 + height:16px;
  478 +}
  479 +
  480 +.big_ok {
  481 + background: url("graphics/big-ok.png") no-repeat;
  482 + padding:4px;
  483 + /*width:16px;
  484 + height:16px;
  485 + padding-bottom:1px;*/
  486 +}
  487 +
  488 +.license_agreement {
  489 + overflow: scroll;
  490 + height: 255px;
  491 + width:765px;
  492 + height:370px;
  493 + overflow-x:hidden;
  494 + border:1px solid #CFCFCF;
  495 +}
  496 +
  497 +.db_adv_options {
  498 + height:200px;
  499 + width:720px;
  500 +}
  501 +
  502 +.adv_option {
  503 + height:65px;
  504 + width:720px;
  505 +}
  506 +
  507 +#tooltips {
  508 + background: url("graphics/question.gif") no-repeat;
  509 + width:16px;
  510 + height:16px;
  511 + cursor:pointer;
  512 +}
  513 +
  514 +.empty_space {
  515 + font-size:12pt;
  516 +}
  517 +
  518 +.demo {
  519 + left:75px;
  520 + position:relative;
  521 + width:600px
  522 +}
  523 +
  524 +.text_message {
  525 +
  526 +}
  527 +
  528 +.description_click {
  529 + line-height:150%;
  530 + font-size:90%;
  531 +}
  532 +
  533 +.specify {
  534 + background: #DDDDDD;
  535 + border: solid 1px #888;
  536 + padding: 2px 8px 2px 5px;
  537 + text-decoration: none;
  538 + color: #EC7725;
  539 +}
0 \ No newline at end of file 540 \ No newline at end of file
setup/migrate/resources/wizard.js 0 → 100644
  1 +// Class Wizard
  2 +function wizard() {
  3 +}
  4 +
  5 +// Does a form check on every new page load
  6 +wizard.prototype.doFormCheck = function() {
  7 + w.addReadOnly();
  8 + w.preload();
  9 +}
  10 +
  11 +// Toggle Advance Database options
  12 +wizard.prototype.toggleClass = function(ele, option) {
  13 + var el = document.getElementsByClassName(ele); //adv_options|php_details|php_ext_details|php_con_details
  14 + if(el[0].style.display == 'none') {
  15 + el[0].style.display = 'block';
  16 + if(document.getElementById(option).innerHTML != '&nbsp;&nbsp;Advanced Options')
  17 + document.getElementById(option).innerHTML = "Hide Details";
  18 + } else {
  19 + el[0].style.display = 'none';
  20 + if(document.getElementById(option).innerHTML != '&nbsp;&nbsp;Advanced Options')
  21 + document.getElementById(option).innerHTML = "Show Details";
  22 + }
  23 +}
  24 +
  25 +// Toggle display of an element
  26 +wizard.prototype.toggleElement = function(el) {
  27 + if(el.style.display == 'none')
  28 + el.style.display = 'block';
  29 + else
  30 + el.style.display = 'none';
  31 +}
  32 +
  33 +// Handle steps within database page
  34 + wizard.prototype.showStep = function(p, d) {
  35 + if(d != 'p') { // Don't check if previous is clicked
  36 + var ueq = 0;
  37 + if(p == 2) { // Check User 1
  38 + ueq = w.validateUsers('dmsname', 'dmspassword', 'dmspassword2');
  39 + } else if(p == 3) { // Check User 2
  40 + ueq = w.validateUsers('dmsusername', 'dmsuserpassword', 'dmsuserpassword2');
  41 + }
  42 + if(ueq != 0) {
  43 + return w.display("error_"+ ueq + "_" + p) ;
  44 + }
  45 + }
  46 + w.hideErrors(); // If theres no errors, hide the ones displaying
  47 + var el = document.getElementsByClassName("step"+p);
  48 + el[0].style.display = 'none';
  49 + var j = 0;
  50 + if(d == "n") {
  51 + j = p+1;
  52 + } else if(d == "p") {
  53 + j = p-1;
  54 + }
  55 + el = document.getElementsByClassName("step"+j);
  56 + if(el != 'undefined') {
  57 + el[0].style.display = 'block';
  58 + }
  59 + return true;
  60 +}
  61 +
  62 +// Validate Users
  63 + wizard.prototype.validateUsers = function(id1, id2, id3) {
  64 + var el1 = document.getElementById(id1);
  65 + var el2 = document.getElementById(id2);
  66 + var el3 = document.getElementById(id3);
  67 + var elVal1 = el1.value;
  68 + var elVal2 = el2.value;
  69 + var elVal3 = el3.value;
  70 + if(elVal1 == '') { // User name empty
  71 + w.focusElement(el1);
  72 + return 1;
  73 + } else if(elVal2 == '') { // Empty Password
  74 + w.focusElement(el2);
  75 + return 2;
  76 + } else if(elVal3 == '') { // Empty Confirmation Password
  77 + w.focusElement(el3);
  78 + return 3;
  79 + } else if(elVal2 != elVal3) { // Passwords not equal
  80 + w.focusElement(el2);
  81 + return 4;
  82 + } else {
  83 + return 0;
  84 + }
  85 +}
  86 +
  87 +// Display Errors
  88 +wizard.prototype.display = function(elname, er) {
  89 + var el = document.getElementById(elname);
  90 + w.showElement(el);
  91 + return 'display';
  92 +}
  93 +
  94 +// Hide Errors
  95 +wizard.prototype.hideErrors = function() {
  96 + var errors = document.getElementsByClassName('error');
  97 + var i;
  98 + for(i=0;i<errors.length;i++) {
  99 + w.hideElement(errors[i]);
  100 + }
  101 + return true;
  102 +}
  103 +
  104 +// Hide an element
  105 +wizard.prototype.hideElement = function(el) {
  106 + if(el.style.display == 'block')
  107 + el.style.display = 'none';
  108 +}
  109 +
  110 +// Show an element
  111 +wizard.prototype.showElement = function(el) {
  112 + if(el.style.display == 'none')
  113 + el.style.display = 'block';
  114 +}
  115 +
  116 +// Focus on element
  117 +wizard.prototype.focusElement = function(el) {
  118 + el.focus();
  119 +}
  120 +
  121 +// Catch form submit and validate
  122 +wizard.prototype.onSubmitValidate = function(silent) {
  123 + var response = w.showStep(3, 'n');
  124 + if(response == true || silent == true) {
  125 + document.getElementById('sendAll').name = 'Next'; // Force the next step
  126 + document.getElementById('sendAll').value = 'next';
  127 + document.getElementById('dbsettings').submit();
  128 + } else if(response == 'display') {
  129 + var el = document.getElementsByClassName("step1");
  130 + if(el[0].style.display == 'block') {
  131 + document.getElementById('sendAll').name = 'Previous'; // Force the previous step
  132 + document.getElementById('sendAll').value = 'previous';
  133 + document.getElementById('dbsettings').submit();
  134 + } else {
  135 + return false;
  136 + }
  137 + }
  138 + return true;
  139 +}
  140 +
  141 +wizard.prototype.pClick = function() {
  142 + var state = document.getElementById('state');
  143 + if(state != "undefined") {
  144 + state.name = 'previous';
  145 + }
  146 +}
  147 +
  148 +wizard.prototype.nClick = function() {
  149 + var state = document.getElementById('state');
  150 + if(state != "undefined") {
  151 + state.name = 'next';
  152 + }
  153 +}
  154 +
  155 +// Validate Registration Page
  156 +wizard.prototype.validateRegistration = function() {
  157 + // See if next or previous is clicked.
  158 + var state = document.getElementById('state').name;
  159 + if(state == 'next') {
  160 + if(w.valRegHelper()) {
  161 + document.getElementById('sendAll').name = 'Next'; // Force the next step
  162 + document.getElementById('sendAll').value = 'next';
  163 + document.getElementById('registration').submit();
  164 + }
  165 + } else if(state == 'previous') {
  166 + document.getElementById('sendAll').name = 'Previous'; // Force the previous step
  167 + document.getElementById('sendAll').value = 'previous';
  168 + document.getElementById('registration').submit();
  169 + }
  170 +}
  171 +
  172 +wizard.prototype.valRegHelper = function() {
  173 + var first = document.getElementById('first');
  174 + var last = document.getElementById('last');
  175 + var email = document.getElementById('email');
  176 + if(first.value.length < 1) {
  177 + document.getElementById("reg_error").innerHTML = "Please enter a First Name";
  178 + w.focusElement(first);
  179 + return false;
  180 + }
  181 + if(!w.nameCheck(first.value)) {
  182 + document.getElementById("reg_error").innerHTML = "Please enter a valid First Name";
  183 + w.focusElement(first);
  184 + return false;
  185 + }
  186 + if(last.value.length < 1) {
  187 + document.getElementById("reg_error").innerHTML = "Please enter a Last Name";
  188 + w.focusElement(last);
  189 + return false;
  190 + }
  191 + if(!w.nameCheck(last.value)) {
  192 + document.getElementById("reg_error").innerHTML = "Please enter a valid Last Name";
  193 + w.focusElement(last);
  194 + return false;
  195 + }
  196 + if(!w.emailCheck(email.value)) {
  197 + document.getElementById("reg_error").innerHTML = "Please enter a valid email address";
  198 + w.focusElement(email);
  199 + return false;
  200 + }
  201 +
  202 + return true;
  203 +}
  204 +
  205 +wizard.prototype.nameCheck = function(str) {
  206 + var nameRegxp = /^([a-zA-Z]+)$/;
  207 + if(str.match(nameRegxp)) {
  208 + return true;
  209 + } else {
  210 + return false;
  211 + }
  212 +}
  213 +
  214 +// Validate Registration Page Courtesy of SmartWebby.com (http://www.smartwebby.com/dhtml/)
  215 +wizard.prototype.emailCheck = function(str) {
  216 + str = w.trim(str);
  217 + var at="@";
  218 + var dot=".";
  219 + var lat=str.indexOf(at);
  220 + var lstr=str.length;
  221 + var ldot=str.indexOf(dot);
  222 + if (str.indexOf(at)==-1) {
  223 + return false;
  224 + }
  225 + if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr) {
  226 + return false;
  227 + }
  228 + if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr) {
  229 + return false;
  230 + }
  231 + if (str.indexOf(at,(lat+1))!=-1) {
  232 + return false;
  233 + }
  234 + if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
  235 + return false;
  236 + }
  237 + if (str.indexOf(dot,(lat+2))==-1){
  238 + return false;
  239 + }
  240 + if (str.indexOf(" ")!=-1){
  241 + return false;
  242 + }
  243 + return true;
  244 +}
  245 +
  246 +wizard.prototype.trim = function (str, chars) {
  247 + return w.ltrim(w.rtrim(str, chars), chars);
  248 +}
  249 +
  250 +wizard.prototype.ltrim = function (str, chars) {
  251 + chars = chars || "\\s";
  252 + return str.replace(new RegExp("^[" + chars + "]+", "g"), "");
  253 +}
  254 +
  255 +wizard.prototype.rtrim = function (str, chars) {
  256 + chars = chars || "\\s";
  257 + return str.replace(new RegExp("[" + chars + "]+$", "g"), "");
  258 +}
  259 +
  260 +// Disable DnD on element
  261 +// Element has to have a readOnly status set to readonly
  262 +wizard.prototype.disableDnd = function(el_id) {
  263 +// el = document.getElementById(el_id);
  264 +// el.removeAttribute('readOnly');
  265 +}
  266 +
  267 +// Add readOnly access on all inputs of a form
  268 +wizard.prototype.addReadOnly = function() {
  269 + inputs = document.getElementsByTagName('input');
  270 + for(i=0;i<inputs.length;i++) {
  271 + var input_id = inputs[i].id;
  272 + if(input_id != '') {
  273 +// inputs[i].setAttribute('readOnly', 'readonly');
  274 +// inputs[i].setAttribute('onfocus', "javascript:{w.disableDnd('"+ input_id +"')}");
  275 +// inputs[i].focus();
  276 +// w.focusElement(inputs[i]);
  277 + }
  278 + }
  279 +}
  280 +
  281 +/* */
  282 +wizard.prototype.preload = function() {
  283 +// $('#tooltips').tooltip();
  284 +}
0 \ No newline at end of file 285 \ No newline at end of file
setup/migrate/session.php 0 → 100644
  1 +<?php
  2 +/**
  3 +* Session Controller.
  4 +*
  5 +* KnowledgeTree Community Edition
  6 +* Document Management Made Simple
  7 +* Copyright(C) 2008,2009 KnowledgeTree Inc.
  8 +* Portions copyright The Jam Warehouse Software(Pty) Limited
  9 +*
  10 +* This program is free software; you can redistribute it and/or modify it under
  11 +* the terms of the GNU General Public License version 3 as published by the
  12 +* Free Software Foundation.
  13 +*
  14 +* This program is distributed in the hope that it will be useful, but WITHOUT
  15 +* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  16 +* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
  17 +* details.
  18 +*
  19 +* You should have received a copy of the GNU General Public License
  20 +* along with this program. If not, see <http://www.gnu.org/licenses/>.
  21 +*
  22 +* You can contact KnowledgeTree Inc., PO Box 7775 #87847, San Francisco,
  23 +* California 94120-7775, or email info@knowledgetree.com.
  24 +*
  25 +* The interactive user interfaces in modified source and object code versions
  26 +* of this program must display Appropriate Legal Notices, as required under
  27 +* Section 5 of the GNU General Public License version 3.
  28 +*
  29 +* In accordance with Section 7(b) of the GNU General Public License version 3,
  30 +* these Appropriate Legal Notices must retain the display of the "Powered by
  31 +* KnowledgeTree" logo and retain the original copyright notice. If the display of the
  32 +* logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices
  33 +* must display the words "Powered by KnowledgeTree" and retain the original
  34 +* copyright notice.
  35 +*
  36 +* @copyright 2008-2009, KnowledgeTree Inc.
  37 +* @license GNU General Public License version 3
  38 +* @author KnowledgeTree Team
  39 +* @package Migrater
  40 +* @version Version 0.1
  41 +*/
  42 +class Session
  43 +{
  44 + /**
  45 + * Constructs session object
  46 + *
  47 + * @author KnowledgeTree Team
  48 + * @access public
  49 + * @param none
  50 + */
  51 + public function __construct() {
  52 + $this->startSession();
  53 + }
  54 +
  55 + /**
  56 + * Starts a session if one does not exist
  57 + *
  58 + * @author KnowledgeTree Team
  59 + * @param none
  60 + * @access public
  61 + * @return void
  62 + */
  63 + public function startSession() {
  64 + if(!isset($_SESSION['ready'])) {
  65 + session_start();
  66 + $_SESSION ['ready'] = TRUE;
  67 + }
  68 + }
  69 +
  70 + /**
  71 + * Sets a value key pair in session
  72 + *
  73 + * @author KnowledgeTree Team
  74 + * @param string $fld
  75 + * @param string $val
  76 + * @access public
  77 + * @return void
  78 + */
  79 + public function set($fld, $val) {
  80 + $this->startSession();
  81 + $_SESSION [$fld] = $val;
  82 + }
  83 +
  84 + /**
  85 + * Sets a value key pair in a class in session
  86 + *
  87 + * @author KnowledgeTree Team
  88 + * @param string $class
  89 + * @param string $fld
  90 + * @param string $val
  91 + * @access public
  92 + * @return void
  93 + */
  94 + public function setClass($class , $k, $v) {
  95 + $this->startSession();
  96 + $classArray = $this->get($class);
  97 + if(isset($classArray[$k])) {
  98 + $classArray[$k] = $v;
  99 + } else {
  100 + $classArray[$k] = $v;
  101 + }
  102 + $_SESSION [ $class] = $classArray;
  103 + }
  104 +
  105 + /**
  106 + * Sets a error value key pair in a class in session
  107 + *
  108 + * @author KnowledgeTree Team
  109 + * @param string $class
  110 + * @param string $fld
  111 + * @param string $val
  112 + * @access public
  113 + * @return void
  114 + */
  115 + public function setClassError($class, $k, $v) {
  116 + $this->startSession();
  117 + $classArray = $this->get($class);
  118 + if(isset($classArray[$k])) {
  119 + $classArray[$k] = $v;
  120 + } else {
  121 + $classArray[$k] = $v;
  122 + }
  123 + $_SESSION [ $class] = $classArray;
  124 + }
  125 +
  126 + /**
  127 + * Clear error values in a class session
  128 + *
  129 + * @author KnowledgeTree Team
  130 + * @param string $class
  131 + * @param string $fld
  132 + * @param string $val
  133 + * @access public
  134 + * @return void
  135 + */
  136 + public function clearErrors($class) {
  137 + $classArray = $this->get($class);
  138 + unset($classArray['errors']);
  139 + $_SESSION [ $class] = $classArray;
  140 + }
  141 +
  142 + /**
  143 + * Unset a value in session
  144 + *
  145 + * @author KnowledgeTree Team
  146 + * @param string $fld
  147 + * @access public
  148 + * @return void
  149 + */
  150 + public function un_set($fld) {
  151 + $this->startSession();
  152 + unset($_SESSION [$fld]);
  153 + }
  154 +
  155 + /**
  156 + * Unset a class value in session
  157 + *
  158 + * @author KnowledgeTree Team
  159 + * @param string $class
  160 + * @access public
  161 + * @return void
  162 + */
  163 + public function un_setClass($class) {
  164 + $this->startSession();
  165 + if(isset($_SESSION [$class]))
  166 + unset($_SESSION [$class]);
  167 + }
  168 +
  169 + /**
  170 + * Destroy the session
  171 + *
  172 + * @author KnowledgeTree Team
  173 + * @param none
  174 + * @access public
  175 + * @return void
  176 + */
  177 + public function destroy() {
  178 + $this->startSession();
  179 + unset($_SESSION);
  180 + session_destroy();
  181 + }
  182 +
  183 + /**
  184 + * Get a session value
  185 + *
  186 + * @author KnowledgeTree Team
  187 + * @param string $fld
  188 + * @access public
  189 + * @return string
  190 + */
  191 + public function get($fld) {
  192 + $this->startSession();
  193 + if(isset($_SESSION [$fld]))
  194 + return $_SESSION [$fld];
  195 + return false;
  196 + }
  197 +
  198 + /**
  199 + * Check if a field exists in session
  200 + *
  201 + * @author KnowledgeTree Team
  202 + * @param string $fld
  203 + * @access public
  204 + * @return string
  205 + */
  206 + public function is_set($fld) {
  207 + $this->startSession();
  208 + return isset($_SESSION [$fld]);
  209 + }
  210 +
  211 + /**
  212 + * Return a class from session
  213 + *
  214 + * @author KnowledgeTree Team
  215 + * @param string $fld
  216 + * @access public
  217 + * @return string
  218 + */
  219 + public function getClass($class) {
  220 + return $_SESSION[$class];
  221 + }
  222 +}
  223 +?>
0 \ No newline at end of file 224 \ No newline at end of file
setup/migrate/shells/javaVersion.sh 0 → 100644
  1 +#!/bin/bash
  2 +java -version > output/outJV 2>&1 echo $!
0 \ No newline at end of file 3 \ No newline at end of file
setup/migrate/sql/upgrades/folders.sql 0 → 100644
  1 +ALTER TABLE `folders` ADD `created` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00' AFTER `creator_id` ,
  2 +ADD `modified_user_id` INT( 11 ) NULL DEFAULT NULL AFTER `created` ,
  3 +ADD `modified` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00' AFTER `modified_user_id` ;
  4 +
  5 +#The following lines are for inserting the data which should have been there if this table had always stored this data
  6 +
  7 +UPDATE folders f set f.created =
  8 + (SELECT datetime FROM folder_transactions ft
  9 + WHERE ft.transaction_namespace = 'ktcore.transactions.create' AND ft.folder_id = f.id AND ft.user_id = f.creator_id
  10 + ORDER BY datetime DESC LIMIT 1) ;
  11 +
  12 +#TODO check whether there are additional actions which should trigger a modified date/user change
  13 +
  14 +UPDATE folders f set f.modified =
  15 + (SELECT datetime FROM folder_transactions ft
  16 + WHERE (ft.transaction_namespace = 'ktcore.transactions.move' OR ft.transaction_namespace = 'ktcore.transactions.rename')
  17 + AND ft.folder_id = f.id
  18 + AND ft.datetime > f.created
  19 + ORDER BY datetime DESC LIMIT 1) ;
  20 +
  21 +UPDATE folders f set f.modified_user_id =
  22 + (SELECT user_id FROM folder_transactions ft
  23 + WHERE (ft.transaction_namespace = 'ktcore.transactions.move' OR ft.transaction_namespace = 'ktcore.transactions.rename')
  24 + AND ft.folder_id = f.id
  25 + AND ft.datetime > f.created
  26 + ORDER BY datetime DESC LIMIT 1) ;
  27 +
  28 +UPDATE folders f set f.modified = f.created WHERE f.modified IS NULL OR f.modified = '0000-00-00 00:00:00' ;
  29 +
  30 +UPDATE folders f set f.modified_user_id = f.creator_id WHERE f.modified_user_id IS NULL ;
0 \ No newline at end of file 31 \ No newline at end of file
setup/migrate/sql/upgrades/search_ranking.sql 0 → 100644
  1 +UPDATE `search_ranking` SET ranking = 300 WHERE groupname = 'document_metadata_version' AND itemname = 'name';
  2 +INSERT INTO `search_ranking` VALUES ('document_fields_link','value',1,'T');
0 \ No newline at end of file 3 \ No newline at end of file
setup/migrate/step.php 0 → 100644
  1 +<?php
  2 +/**
  3 +* Step .
  4 +*
  5 +* KnowledgeTree Community Edition
  6 +* Document Management Made Simple
  7 +* Copyright(C) 2008,2009 KnowledgeTree Inc.
  8 +* Portions copyright The Jam Warehouse Software(Pty) Limited
  9 +*
  10 +* This program is free software; you can redistribute it and/or modify it under
  11 +* the terms of the GNU General Public License version 3 as published by the
  12 +* Free Software Foundation.
  13 +*
  14 +* This program is distributed in the hope that it will be useful, but WITHOUT
  15 +* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  16 +* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
  17 +* details.
  18 +*
  19 +* You should have received a copy of the GNU General Public License
  20 +* along with this program. If not, see <http://www.gnu.org/licenses/>.
  21 +*
  22 +* You can contact KnowledgeTree Inc., PO Box 7775 #87847, San Francisco,
  23 +* California 94120-7775, or email info@knowledgetree.com.
  24 +*
  25 +* The interactive user interfaces in modified source and object code versions
  26 +* of this program must display Appropriate Legal Notices, as required under
  27 +* Section 5 of the GNU General Public License version 3.
  28 +*
  29 +* In accordance with Section 7(b) of the GNU General Public License version 3,
  30 +* these Appropriate Legal Notices must retain the display of the "Powered by
  31 +* KnowledgeTree" logo and retain the original copyright notice. If the display of the
  32 +* logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices
  33 +* must display the words "Powered by KnowledgeTree" and retain the original
  34 +* copyright notice.
  35 +*
  36 +* @copyright 2008-2009, KnowledgeTree Inc.
  37 +* @license GNU General Public License version 3
  38 +* @author KnowledgeTree Team
  39 +* @package Migrater
  40 +* @version Version 0.1
  41 +*/
  42 +class Step
  43 +{
  44 + /**
  45 + * List of variables to be loaded to template
  46 + *
  47 + * @author KnowledgeTree Team
  48 + * @access protected
  49 + * @var array
  50 + */
  51 + protected $temp_variables = array();
  52 +
  53 + /**
  54 + * List of errors encountered by step
  55 + *
  56 + * @author KnowledgeTree Team
  57 + * @access protected
  58 + * @var array
  59 + */
  60 + protected $error = array();
  61 +
  62 + /**
  63 + * List of warnings encountered by step
  64 + *
  65 + * @author KnowledgeTree Team
  66 + * @access protected
  67 + * @var array
  68 + */
  69 + protected $warnings = array();
  70 +
  71 + /**
  72 + * Flag to store class information in session
  73 + *
  74 + * @author KnowledgeTree Team
  75 + * @access public
  76 + * @var array
  77 + */
  78 + protected $storeInSession = false;
  79 +
  80 + /**
  81 + * Flag if step needs to be migrateed
  82 + *
  83 + * @author KnowledgeTree Team
  84 + * @access public
  85 + * @var array
  86 + */
  87 + protected $runMigrate = false;
  88 +
  89 + /**
  90 + * Step order
  91 + *
  92 + * @author KnowledgeTree Team
  93 + * @access public
  94 + * @var string
  95 + */
  96 + protected $order = false;
  97 +
  98 + /**
  99 + * Flag if step needs to run silently
  100 + *
  101 + * @author KnowledgeTree Team
  102 + * @access public
  103 + * @var boolean
  104 + */
  105 + protected $silent = false;
  106 +
  107 + public $displayFirst = false;
  108 + /**
  109 + * Returns step state
  110 + *
  111 + * @author KnowledgeTree Team
  112 + * @param none
  113 + * @access public
  114 + * @return string
  115 + */
  116 + public function doStep()
  117 + {
  118 + return '';
  119 + }
  120 +
  121 + public function displayFirst() {
  122 + return $this->displayFirst;
  123 + }
  124 +
  125 + /**
  126 + * Returns step variables
  127 + *
  128 + * @author KnowledgeTree Team
  129 + * @param none
  130 + * @access public
  131 + * @return array
  132 + */
  133 + public function getStepVars()
  134 + {
  135 + return $this->temp_variables;
  136 + }
  137 +
  138 + /**
  139 + * Returns step errors
  140 + *
  141 + * @author KnowledgeTree Team
  142 + * @param none
  143 + * @access public
  144 + * @return array
  145 + */
  146 + public function getErrors() {
  147 + return $this->error;
  148 + }
  149 +
  150 + /**
  151 + * Returns step errors
  152 + *
  153 + * @author KnowledgeTree Team
  154 + * @param none
  155 + * @access public
  156 + * @return array
  157 + */
  158 + public function getWarnings() {
  159 + return $this->warnings;
  160 + }
  161 +
  162 + /**
  163 + * Load default step values
  164 + *
  165 + * @author KnowledgeTree Team
  166 + * @param none
  167 + * @access public
  168 + * @return void
  169 + */
  170 + public function loadDefaults() {
  171 +
  172 + }
  173 +
  174 + /**
  175 + * Return default step values
  176 + *
  177 + * @author KnowledgeTree Team
  178 + * @param none
  179 + * @access public
  180 + * @return array
  181 + */
  182 + public function getDefaults() {
  183 + return array();
  184 + }
  185 +
  186 + /**
  187 + * Checks if edit button has been clicked
  188 + *
  189 + * @author KnowledgeTree Team
  190 + * @param none
  191 + * @access public
  192 + * @return boolean
  193 + */
  194 + public function edit() {
  195 + if(isset($_POST['Edit'])) {
  196 + return true;
  197 + }
  198 +
  199 + return false;
  200 + }
  201 +
  202 + /**
  203 + * Checks if next button has been clicked
  204 + *
  205 + * @author KnowledgeTree Team
  206 + * @param none
  207 + * @access public
  208 + * @return boolean
  209 + */
  210 + public function next() {
  211 + if(isset($_POST['Next'])) {
  212 + return true;
  213 + }
  214 +
  215 + return false;
  216 + }
  217 +
  218 + /**
  219 + * Checks if previous button has been clicked
  220 + *
  221 + * @author KnowledgeTree Team
  222 + * @param none
  223 + * @access public
  224 + * @return boolean
  225 + */
  226 + public function previous() {
  227 + if(isset($_POST['Previous'])) {
  228 + return true;
  229 + }
  230 +
  231 + return false;
  232 + }
  233 +
  234 + /**
  235 + * Checks if Confirm button has been clicked
  236 + *
  237 + * @author KnowledgeTree Team
  238 + * @param none
  239 + * @access public
  240 + * @return boolean
  241 + */
  242 + function confirm() {
  243 + if(isset($_POST['Confirm'])) {
  244 + return true;
  245 + }
  246 +
  247 + return false;
  248 + }
  249 +
  250 + /**
  251 + * Checks if Confirm button has been clicked
  252 + *
  253 + * @author KnowledgeTree Team
  254 + * @param none
  255 + * @access public
  256 + * @return boolean
  257 + */
  258 + function migrate() {
  259 + if(isset($_POST['Migrate'])) {
  260 + return true;
  261 + }
  262 +
  263 + return false;
  264 + }
  265 +
  266 + /**
  267 + * Checks if we are currently in this class step
  268 + *
  269 + * @author KnowledgeTree Team
  270 + * @param string
  271 + * @access public
  272 + * @return boolean
  273 + */
  274 + public function inStep($name) {
  275 + if($_GET['step_name'] == $name)
  276 + return true;
  277 + return false;
  278 + }
  279 +
  280 + /**
  281 + * Load session data to post
  282 + *
  283 + * @author KnowledgeTree Team
  284 + * @params none
  285 + * @access private
  286 + * @return boolean
  287 + */
  288 + public function setDataFromSession($class) {
  289 + if(empty($_SESSION[$class])) {
  290 + return false;
  291 + }
  292 + $_POST = $_SESSION[$class];
  293 +
  294 + return true;
  295 + }
  296 +
  297 + /**
  298 + * Get session data from post
  299 + *
  300 + * @author KnowledgeTree Team
  301 + * @params none
  302 + * @access private
  303 + * @return boolean
  304 + */
  305 + public function getDataFromSession($class) {
  306 + if(empty($_SESSION[$class])) {
  307 + return false;
  308 + }
  309 +
  310 + return $_SESSION[$class];
  311 + }
  312 +
  313 + /**
  314 + * Safer way to return post data
  315 + *
  316 + * @author KnowledgeTree Team
  317 + * @params SimpleXmlObject $simplexml
  318 + * @access public
  319 + * @return void
  320 + */
  321 + public function getPostSafe($key) {
  322 + return isset($_POST[$key]) ? $_POST[$key] : "";
  323 + }
  324 +
  325 + /**
  326 + * Safer way to return post data
  327 + *
  328 + * @author KnowledgeTree Team
  329 + * @params SimpleXmlObject $simplexml
  330 + * @access public
  331 + * @return void
  332 + */
  333 + public function getPostBoolean($key) {
  334 + return isset($_POST[$key]) ? $_POST[$key] : false;
  335 + }
  336 +
  337 + /**
  338 + * Runs step migrate if required
  339 + *
  340 + * @author KnowledgeTree Team
  341 + * @param none
  342 + * @access public
  343 + * @return void
  344 + */
  345 + public function migrateStep() {
  346 + return '';
  347 + }
  348 +
  349 + /**
  350 + * Return whether or not to store a step information in session
  351 + *
  352 + * @author KnowledgeTree Team
  353 + * @param none
  354 + * @access public
  355 + * @return boolean
  356 + */
  357 + public function storeInSession() {
  358 + return $this->storeInSession;
  359 + }
  360 +
  361 + /**
  362 + * Return whether or not to a step has to be migrateed
  363 + *
  364 + * @author KnowledgeTree Team
  365 + * @param none
  366 + * @access public
  367 + * @return boolean
  368 + */
  369 + public function runMigrate() {
  370 + return $this->runMigrate;
  371 + }
  372 +
  373 + public function setPostConfig() {
  374 + return '';
  375 + }
  376 +
  377 + /**
  378 + * Return whether or not to a step has to be in silent mode
  379 + *
  380 + * @author KnowledgeTree Team
  381 + * @param none
  382 + * @access public
  383 + * @return boolean
  384 + */
  385 + public function silentMode() {
  386 + return $this->silent;
  387 + }
  388 +
  389 + /**
  390 + * Set step errors
  391 + *
  392 + * @author KnowledgeTree Team
  393 + * @param none
  394 + * @access public
  395 + * @return array
  396 + */
  397 + public function setErrors($error) {
  398 + $this->error = $error;
  399 + }
  400 +}
  401 +
  402 +?>
0 \ No newline at end of file 403 \ No newline at end of file
setup/migrate/stepAction.php 0 → 100644
  1 +<?php
  2 +/**
  3 +* Steap Action Controller.
  4 +*
  5 +* KnowledgeTree Community Edition
  6 +* Document Management Made Simple
  7 +* Copyright (C) 2008,2009 KnowledgeTree Inc.
  8 +* Portions copyright The Jam Warehouse Software (Pty) Limited
  9 +*
  10 +* This program is free software; you can redistribute it and/or modify it under
  11 +* the terms of the GNU General Public License version 3 as published by the
  12 +* Free Software Foundation.
  13 +*
  14 +* This program is distributed in the hope that it will be useful, but WITHOUT
  15 +* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  16 +* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
  17 +* details.
  18 +*
  19 +* You should have received a copy of the GNU General Public License
  20 +* along with this program. If not, see <http://www.gnu.org/licenses/>.
  21 +*
  22 +* You can contact KnowledgeTree Inc., PO Box 7775 #87847, San Francisco,
  23 +* California 94120-7775, or email info@knowledgetree.com.
  24 +*
  25 +* The interactive user interfaces in modified source and object code versions
  26 +* of this program must display Appropriate Legal Notices, as required under
  27 +* Section 5 of the GNU General Public License version 3.
  28 +*
  29 +* In accordance with Section 7(b) of the GNU General Public License version 3,
  30 +* these Appropriate Legal Notices must retain the display of the "Powered by
  31 +* KnowledgeTree" logo and retain the original copyright notice. If the display of the
  32 +* logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices
  33 +* must display the words "Powered by KnowledgeTree" and retain the original
  34 +* copyright notice.
  35 +*
  36 +* @copyright 2008-2009, KnowledgeTree Inc.
  37 +* @license GNU General Public License version 3
  38 +* @author KnowledgeTree Team
  39 +* @package Migrater
  40 +* @version Version 0.1
  41 +*/
  42 +
  43 +class stepAction {
  44 + /**
  45 + * Step class name
  46 + *
  47 + * @author KnowledgeTree Team
  48 + * @access protected
  49 + * @var string
  50 + */
  51 + protected $stepName = '';
  52 +
  53 + /**
  54 + * Step names for classes
  55 + *
  56 + * @author KnowledgeTree Team
  57 + * @access protected
  58 + * @var array
  59 + */
  60 + protected $stepClassNames = array();
  61 +
  62 + /**
  63 + * Flag if step needs confirmation
  64 + *
  65 + * @author KnowledgeTree Team
  66 + * @access protected
  67 + * @var boolean
  68 + */
  69 + protected $displayConfirm = false;
  70 +
  71 + /**
  72 + * Returns whether or not to display the confirmation page first
  73 + *
  74 + * @author KnowledgeTree Team
  75 + * @access protected
  76 + * @var boolean
  77 + */
  78 + protected $displayFirst = false;
  79 +
  80 + /**
  81 + * List of migrate properties
  82 + *
  83 + * @author KnowledgeTree Team
  84 + * @access protected
  85 + * @var boolean
  86 + */
  87 + protected $migrateProperties = array();
  88 +
  89 + /**
  90 + * Reference to session object
  91 + *
  92 + * @author KnowledgeTree Team
  93 + * @access protected
  94 + * @var object Session
  95 + */
  96 + protected $session = null;
  97 +
  98 + /**
  99 + * Reference to current step object
  100 + *
  101 + * @author KnowledgeTree Team
  102 + * @access protected
  103 + * @var object class Step
  104 + */
  105 + protected $action = null;
  106 +
  107 + /**
  108 + * Constructs step action object
  109 + *
  110 + * @author KnowledgeTree Team
  111 + * @access public
  112 + * @param string class name of the current step
  113 + */
  114 + public function __construct($step) {
  115 + $this->stepName = $step;
  116 + }
  117 +
  118 + /**
  119 + * Helper to initialize step actions
  120 + *
  121 + * @author KnowledgeTree Team
  122 + * @param string
  123 + * @access public
  124 + * @return string
  125 + */
  126 + public function setUpStepAction($steps, $stepNames, $stepConfirmation, $stepDisplayFirst, $session, $migrateProperties) {
  127 + $this->setSteps($steps);
  128 + $this->setStepNames($stepNames);
  129 + $this->setDisplayConfirm($stepConfirmation);
  130 + $this->setDisplayFirst($stepDisplayFirst);
  131 + $this->loadSession($session);
  132 + $this->setMigrateProperties($migrateProperties);
  133 + }
  134 +
  135 + /**
  136 + * Sets steps class names in string format
  137 + *
  138 + * @author KnowledgeTree Team
  139 + * @param array
  140 + * @access public
  141 + * @return void
  142 + */
  143 + public function setSteps($stepClassNames) {
  144 + $this->stepClassNames = $stepClassNames;
  145 + }
  146 +
  147 + /**
  148 + * Sets steps in human readable string format
  149 + *
  150 + * @author KnowledgeTree Team
  151 + * @param array
  152 + * @access public
  153 + * @return void
  154 + */
  155 + public function setStepNames($step_names) {
  156 + $this->step_names = $step_names;
  157 + }
  158 +
  159 + /**
  160 + * Sets confirmation page flag
  161 + *
  162 + * @author KnowledgeTree Team
  163 + * @param boolean
  164 + * @access public
  165 + * @return void
  166 + */
  167 + public function setDisplayConfirm($displayConfirm) {
  168 + $this->displayConfirm = $displayConfirm;
  169 + }
  170 +
  171 + /**
  172 + * Sets confirmation page first flag
  173 + *
  174 + * @author KnowledgeTree Team
  175 + * @param boolean
  176 + * @access public
  177 + * @return void
  178 + */
  179 + public function setDisplayFirst($displayFirst) {
  180 + $this->displayFirst = $displayFirst;
  181 + }
  182 +
  183 + /**
  184 + * Sets session object
  185 + *
  186 + * @author KnowledgeTree Team
  187 + * @param object Session
  188 + * @access public
  189 + * @return void
  190 + */
  191 + public function loadSession($ses) {
  192 + $this->session = $ses;
  193 + }
  194 +
  195 + /**
  196 + * Sets migrate properties
  197 + *
  198 + * @author KnowledgeTree Team
  199 + * @param array
  200 + * @access public
  201 + * @return void
  202 + */
  203 + public function setMigrateProperties($migrateProperties) {
  204 + $this->migrateProperties = $migrateProperties;
  205 + }
  206 +
  207 + /**
  208 + * Main control to handle the steps actions
  209 + *
  210 + * @author KnowledgeTree Team
  211 + * @param none
  212 + * @access public
  213 + * @return string
  214 + */
  215 + public function doAction() {
  216 + if($this->stepName != '') {
  217 + $this->action = $this->createStep();
  218 + if(!$this->action) {
  219 + $this->stepName = 'errors';
  220 + $this->action = $this->createStep();
  221 + $this->action->error = array('Class Files Missing in Step Directory');
  222 + }
  223 + $response = $this->action->doStep();
  224 + if($this->action->storeInSession()) { // Check if class values need to be stored in session
  225 + $this->_loadStepToSession($this->stepName); // Send class to session
  226 + }
  227 + if ($response == 'error') {
  228 + $this->_handleErrors(); // Send Errors to session
  229 + } else {
  230 + $this->_clearErrors($this->stepName); // Send Errors to session
  231 + }
  232 + return $response;
  233 + } else {
  234 + $this->stepName = 'errors';
  235 + $this->action = $this->createStep();
  236 + $this->action->error = array('Class File Missing in Step Directory');
  237 + }
  238 + }
  239 +
  240 + /**
  241 + * Instantiate a step.
  242 + *
  243 + * @author KnowledgeTree Team
  244 + * @param none
  245 + * @access public
  246 + * @return object Step
  247 + */
  248 + public function createStep() {
  249 + $step_class = $this->makeCamelCase($this->stepName);
  250 + return new $step_class();
  251 + }
  252 +
  253 + /**
  254 + * Converts string to camel case
  255 + *
  256 + * @author KnowledgeTree Team
  257 + * @param string
  258 + * @access public
  259 + * @return string
  260 + */
  261 + public function makeCamelCase($str) {
  262 + $upper=ucwords($str);
  263 + $str=str_replace('_', '', $upper);
  264 +
  265 + return $str;
  266 + }
  267 +
  268 + /**
  269 + * Converts string to human readable heading
  270 + *
  271 + * @author KnowledgeTree Team
  272 + * @param string
  273 + * @access public
  274 + * @return string
  275 + */
  276 + public function makeHeading($str) {
  277 + $str = str_replace('_', ' ', $str);
  278 + $str = ucwords($str);
  279 +
  280 + return $str;
  281 + }
  282 +
  283 + /**
  284 + * Returns current step name
  285 + *
  286 + * @author KnowledgeTree Team
  287 + * @param none
  288 + * @access public
  289 + * @return string
  290 + */
  291 + public function getCurrentStepName() {
  292 + if($this->stepName != 'errors')
  293 + return $this->step_names[$this->stepName];
  294 + return '';
  295 + }
  296 +
  297 + /**
  298 + * Returns left menu
  299 + *
  300 + * @author KnowledgeTree Team
  301 + * @param none
  302 + * @access public
  303 + * @return string
  304 + */
  305 + public function getLeftMenu()
  306 + {
  307 + $menu = '';
  308 + $active = false;
  309 + if($this->stepClassNames) {
  310 + foreach ($this->stepClassNames as $k=>$step) {
  311 + if($this->step_names[$step] != '') {
  312 + $item = $this->step_names[$step];
  313 + } else {
  314 + $item = $this->makeHeading($step);
  315 + }
  316 + if($step == $this->stepName) {
  317 + $class = 'current';
  318 + $active = true;
  319 + } else {
  320 + if($active){
  321 + $class = 'inactive';
  322 + }else{
  323 + $class = 'indicator';
  324 + $item = "<a href=\"index.php?step_name={$step}\">{$item}</a>";
  325 + }
  326 + }
  327 +
  328 + $menu .= "<span class='{$class}'>$item</span><br />";
  329 + }
  330 + }
  331 +// $menu .= '</div>';
  332 + return $menu;
  333 + }
  334 +
  335 + /**
  336 + * Returns confirmation page flag
  337 + *
  338 + * @author KnowledgeTree Team
  339 + * @param none
  340 + * @access public
  341 + * @return boolean
  342 + */
  343 + public function displayConfirm() {
  344 + return $this->displayConfirm;
  345 + }
  346 +
  347 + /**
  348 + * Returns whether or not to display the confirmation page first
  349 + *
  350 + * @author KnowledgeTree Team
  351 + * @param none
  352 + * @access public
  353 + * @return boolean
  354 + */
  355 + public function displayFirst() {
  356 + return $this->displayFirst;
  357 + }
  358 +
  359 + /**
  360 + * Returns session object
  361 + *
  362 + * @author KnowledgeTree Team
  363 + * @param object Session
  364 + * @access public
  365 + * @return object
  366 + */
  367 + public function getSession() {
  368 + return $this->session;
  369 + }
  370 +
  371 + /**
  372 + * Returns step tenplate content
  373 + *
  374 + * @author KnowledgeTree Team
  375 + * @param none
  376 + * @access public
  377 + * @return string
  378 + */
  379 + public function paintAction() {
  380 +
  381 + $step_errors = $this->action->getErrors(); // Get errors
  382 + $step_warnings = $this->action->getWarnings(); // Get warnings
  383 + if($this->displayConfirm()) { // Check if theres a confirm step
  384 + $template = "templates/{$this->stepName}_confirm.tpl";
  385 + } else {
  386 + if($this->displayFirst()) {
  387 + $template = "templates/{$this->stepName}_confirm.tpl";
  388 + } else {
  389 + $template = "templates/{$this->stepName}.tpl";
  390 + }
  391 + }
  392 + $step_tpl = new Template($template);
  393 + $step_tpl->set("errors", $step_errors); // Set template errors
  394 + $step_tpl->set("warnings", $step_warnings); // Set template warnings
  395 + $step_vars = $this->action->getStepVars(); // Get template variables
  396 + $step_tpl->set("step_vars", $step_vars); // Set template errors
  397 + foreach ($step_vars as $key => $value) { // Set template variables
  398 + $step_tpl->set($key, $value); // Load values to session
  399 + if($this->action->storeInSession()) { // Check if class values need to be stored in session
  400 + $this->_loadValueToSession($this->stepName, $key, $value);
  401 + }
  402 + }
  403 + $content = $step_tpl->fetch();
  404 + $tpl = new Template("templates/wizard.tpl");
  405 + $vars = $this->getVars(); // Get template variables
  406 + $tpl->set("vars", $vars); // Set template errors
  407 + $tpl->set('content', $content);
  408 + echo $tpl->fetch();
  409 + }
  410 +
  411 + public function getVars() {
  412 + $left = $this->getLeftMenu();
  413 + $vars['left'] = $left; // Set left menu
  414 + $vars['migrate_version'] = $this->migrateProperties['migrate_version']; // Set version
  415 + $vars['migrate_type'] = $this->migrateProperties['migrate_type']; // Set type
  416 + return $vars;
  417 + }
  418 + /**
  419 + * Load class to session
  420 + *
  421 + * @author KnowledgeTree Team
  422 + * @param string $class name of class
  423 + * @param array $v array of values
  424 + * @param boolean $overwrite whether or not to overwrite existing
  425 + * @access private
  426 + * @return void
  427 + */
  428 + private function _loadStepToSession($class, $v = array(), $overwrite = false) {
  429 + if($this->session != null) {
  430 + if($overwrite) {
  431 + $this->session->set($class , $v);
  432 + } else {
  433 + if(!$this->session->is_set($class))
  434 + $this->session->set($class , $v);
  435 + }
  436 + } else {
  437 + $this->stepName = 'errors';
  438 + $this->action = $this->createStep();
  439 + $this->action->error = array('Sessions Are Disabled');
  440 + }
  441 + }
  442 +
  443 + /**
  444 + * Load class value to session
  445 + *
  446 + * @author KnowledgeTree Team
  447 + * @param string $class name of class
  448 + * @param string $k key value
  449 + * @param string $v value to store
  450 + * @param boolean $overwrite whether or not to overwrite existing
  451 + * @access private
  452 + * @return void
  453 + */
  454 + private function _loadValueToSession($class, $k, $v, $overwrite = false) {
  455 + if($this->session != null) {
  456 + $this->session->setClass($class, $k, $v);
  457 + } else {
  458 + $this->stepName = 'errors';
  459 + $this->action = $this->createStep();
  460 + $this->action->error = array('Sessions Are Disabled');
  461 + }
  462 + }
  463 +
  464 + /**
  465 + * Load all class errors value to session
  466 + *
  467 + * @author KnowledgeTree Team
  468 + * @param none
  469 + * @access private
  470 + * @return void
  471 + */
  472 + private function _handleErrors() {// TODO: handle multiple errors
  473 + $step_errors = $this->action->getErrors(); // Get errors
  474 + foreach ($step_errors as $key => $value) {
  475 + $this->_loadErrorToSession($this->stepName, $key, $value); // Load values session
  476 + }
  477 + }
  478 +
  479 + /**
  480 + * Remove all class errors value to session
  481 + *
  482 + * @author KnowledgeTree Team
  483 + * @param none
  484 + * @access private
  485 + * @return void
  486 + */
  487 + private function _clearErrors($class) {
  488 + if($this->session) {
  489 + $this->session->clearErrors($class);
  490 + }
  491 + }
  492 +
  493 + /**
  494 + * Load class error value to session
  495 + *
  496 + * @author KnowledgeTree Team
  497 + * @param string $class name of class
  498 + * @param string $k key value
  499 + * @param string $v value to store
  500 + * @param boolean $overwrite whether or not to overwrite existing
  501 + * @access private
  502 + * @return void
  503 + */
  504 + private function _loadErrorToSession($class, $k, $v, $overwrite = false) {
  505 + $k = "errors";
  506 + if($this->session != null) {
  507 + $this->session->setClassError($class, $k, $v);
  508 + } else {
  509 + $this->stepName = 'errors';
  510 + $this->action = $this->createStep();
  511 + $this->action->error = array('Sessions Are Disabled');
  512 + }
  513 + }
  514 +}
  515 +
  516 +?>
0 \ No newline at end of file 517 \ No newline at end of file
setup/migrate/steps/complete.php 0 → 100644
  1 +<?php
  2 +/**
  3 +* Complete Step Controller.
  4 +*
  5 +* KnowledgeTree Community Edition
  6 +* Document Management Made Simple
  7 +* Copyright(C) 2008,2009 KnowledgeTree Inc.
  8 +* Portions copyright The Jam Warehouse Software(Pty) Limited
  9 +*
  10 +* This program is free software; you can redistribute it and/or modify it under
  11 +* the terms of the GNU General Public License version 3 as published by the
  12 +* Free Software Foundation.
  13 +*
  14 +* This program is distributed in the hope that it will be useful, but WITHOUT
  15 +* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  16 +* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
  17 +* details.
  18 +*
  19 +* You should have received a copy of the GNU General Public License
  20 +* along with this program. If not, see <http://www.gnu.org/licenses/>.
  21 +*
  22 +* You can contact KnowledgeTree Inc., PO Box 7775 #87847, San Francisco,
  23 +* California 94120-7775, or email info@knowledgetree.com.
  24 +*
  25 +* The interactive user interfaces in modified source and object code versions
  26 +* of this program must display Appropriate Legal Notices, as required under
  27 +* Section 5 of the GNU General Public License version 3.
  28 +*
  29 +* In accordance with Section 7(b) of the GNU General Public License version 3,
  30 +* these Appropriate Legal Notices must retain the display of the "Powered by
  31 +* KnowledgeTree" logo and retain the original copyright notice. If the display of the
  32 +* logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices
  33 +* must display the words "Powered by KnowledgeTree" and retain the original
  34 +* copyright notice.
  35 +*
  36 +* @copyright 2008-2009, KnowledgeTree Inc.
  37 +* @license GNU General Public License version 3
  38 +* @author KnowledgeTree Team
  39 +* @package Migrateer
  40 +* @version Version 0.1
  41 +*/
  42 +
  43 +class complete extends Step {
  44 +
  45 + /**
  46 + * Reference to Database object
  47 + *
  48 + * @author KnowledgeTree Team
  49 + * @access private
  50 + * @var object
  51 + */
  52 + private $_dbhandler = null;
  53 +
  54 + /**
  55 + * List of services to check
  56 + *
  57 + * @access private
  58 + * @var array
  59 + */
  60 + private $services_check = 'tick';
  61 + private $paths_check = 'tick';
  62 + private $privileges_check = 'tick';
  63 + private $database_check = 'tick';
  64 + protected $silent = true;
  65 +
  66 + protected $util = null;
  67 +
  68 + public function __construct() {
  69 + $this->temp_variables = array("step_name"=>"complete", "silent"=>$this->silent);
  70 + $this->_dbhandler = new dbUtil();
  71 + $this->util = new MigrateUtil();
  72 + }
  73 +
  74 + function doStep() {
  75 + $this->doRun();
  76 + return 'landing';
  77 + }
  78 +
  79 + function doRun() {
  80 + // check filesystem (including location of document directory and logging)
  81 + $this->checkFileSystem();
  82 + // check database
  83 + $this->checkDb();
  84 + // check services
  85 + $this->checkServices();
  86 + $this->storeSilent();// Set silent mode variables
  87 + }
  88 +
  89 + private function checkFileSystem()
  90 + {
  91 + // defaults
  92 + $this->temp_variables['varDirectory'] = '';
  93 + $this->temp_variables['documentRoot'] = '';
  94 + $this->temp_variables['logDirectory'] = '';
  95 + $this->temp_variables['tmpDirectory'] = '';
  96 + $this->temp_variables['uploadDirectory'] = '';
  97 + $this->temp_variables['config'] = '';
  98 + $this->temp_variables['docLocation'] = '';
  99 + $docRoot = '';
  100 + // retrieve path information from session
  101 + $config = $this->getDataFromSession("configuration");
  102 + $paths = $config['paths'];
  103 +
  104 + $html = '<td><div class="%s"></div></td>'
  105 + . '<td %s>%s</td>';
  106 + $pathhtml = '<td><div class="%s"></div></td>'
  107 + . '<td>%s</td>'
  108 + . '<td %s>%s</td>';
  109 + // check paths are writeable
  110 + if(is_array($paths)) {
  111 + foreach ($paths as $path)
  112 + {
  113 + $output = '';
  114 + $result = $this->util->checkPermission($path['path']);
  115 + $output = sprintf($pathhtml, $result['class'], $path['path'],
  116 + (($result['class'] == 'tick') ? 'class="green"' : 'class="error"' ),
  117 + (($result['class'] == 'tick') ? 'Writeable' : 'Not Writeable' ));
  118 + $this->temp_variables[($path['setting'] != '') ? $path['setting'] : 'config'] = $output;
  119 + if($result['class'] != 'tick') {
  120 + $this->paths_check = $result['class'];
  121 + }
  122 + // for document location check
  123 + if ($path['setting'] == 'documentRoot') {
  124 + $docRoot = $path['path'];
  125 + }
  126 + }
  127 + }
  128 +
  129 + // check document path internal/external to web root
  130 + // compare SYSTEM_DIR to root path of documentRoot
  131 + // NOTE preg_replace is to ensure all slash separators are the same (forward slash)
  132 + $sysDir = preg_replace('/\\\\+|\/+/', '\/', SYSTEM_DIR);
  133 + $docRoot = preg_replace('/\\\\+|\/+/', '\/', $docRoot);
  134 + if (($pos = strpos($docRoot, $sysDir)) !== false) {
  135 + $this->temp_variables['docLocation'] = '<td><div class="cross_orange"></div></td>'
  136 + . '<td class="warning" colspan="2">Your document directory is set to the default, which is inside the web root. '
  137 + . 'This may present a security problem if your documents can be accessed from the web, '
  138 + . 'working around the permission system in KnowledgeTree.</td>';
  139 + if($this->paths_check == 'tick')
  140 + $this->paths_check = 'cross_orange';
  141 + $this->warnings[] = 'Move var directory';
  142 + }
  143 + else {
  144 + $this->temp_variables['docLocation'] = sprintf($html, 'tick', '', 'Your document directory is outside the web root.');
  145 + }
  146 + }
  147 +
  148 + private function checkDb()
  149 + {
  150 + // defaults
  151 + $this->temp_variables['dbConnectAdmin'] = '';
  152 + $this->temp_variables['dbConnectUser'] = '';
  153 + $this->temp_variables['dbPrivileges'] = '';
  154 + $this->temp_variables['dbTransaction'] = '';
  155 +
  156 + $html = '<td><div class="%s"></div></td>'
  157 + . '<td %s>%s</td>';
  158 +
  159 + // retrieve database information from session
  160 + $dbconf = $this->getDataFromSession("database");
  161 + //print_r($dbconf);
  162 + // make db connection - admin
  163 + $loaded = $this->_dbhandler->load($dbconf['dhost'], $dbconf['dmsname'], $dbconf['dmspassword'], $dbconf['dname']);
  164 + if (!$loaded) {
  165 + $this->temp_variables['dbConnectAdmin'] .= /*sprintf($html, 'cross',
  166 + $path['path'],
  167 + (($result['class'] == 'tick') ? '' : 'error' ),
  168 + (($result['class'] == 'tick') ? 'Writeable' : 'Not Writeable' ));*/
  169 + '<td><div class="cross"></div></td>'
  170 + . '<td class="error">Unable to connect to database (user: ' . $dbconf['dmsname'] . ')</td>';
  171 + $this->database_check = 'cross';
  172 + $this->temp_variables['dbConnectAdmin'] .= sprintf($html, 'cross', 'class="error"', 'Unable to connect to database (user: ' . $dbconf['dmsname'] . ')');
  173 + }
  174 + else
  175 + {
  176 + $this->temp_variables['dbConnectAdmin'] .= sprintf($html, 'tick', '', 'Database connectivity successful (user: ' . $dbconf['dmsname'] . ')');
  177 + }
  178 +
  179 + // make db connection - user
  180 + $loaded = $this->_dbhandler->load($dbconf['dhost'], $dbconf['dmsusername'], $dbconf['dmsuserpassword'], $dbconf['dname']);
  181 + // if we can log in to the database, check access
  182 + // TODO check write access?
  183 + if ($loaded)
  184 + {
  185 + $this->temp_variables['dbConnectUser'] .= sprintf($html, 'tick', '', 'Database connectivity successful (user: ' . $dbconf['dmsusername'] . ')');
  186 +
  187 + $qresult = $this->_dbhandler->query('SELECT COUNT(id) FROM documents');
  188 + if (!$qresult)
  189 + {
  190 + $this->temp_variables['dbPrivileges'] .= '<td style="width:15px;"><div class="cross" style="float:left;"></div></td>'
  191 + . '<td class="error" style="width:500px;">'
  192 + . 'Unable to do a basic database query. Error: ' . $this->_dbhandler->getLastError()
  193 + . '</td>';
  194 + $this->privileges_check = 'cross';
  195 + $this->privileges_check = 'cross';
  196 + }
  197 + else
  198 + {
  199 + $this->temp_variables['dbPrivileges'] .= sprintf($html, 'tick', '', 'Basic database query successful');
  200 +
  201 + }
  202 +
  203 + // check transaction support
  204 + $sTable = 'system_settings';
  205 + $this->_dbhandler->startTransaction();
  206 + $this->_dbhandler->query('INSERT INTO ' . $sTable . ' (name, value) VALUES ("transactionTest", "1")');
  207 + $this->_dbhandler->rollback();
  208 + $res = $this->_dbhandler->query("SELECT id FROM $sTable WHERE name = 'transactionTest' LIMIT 1");
  209 + if (!$res) {
  210 + $this->temp_variables['dbTransaction'] .= sprintf($html, 'cross', 'class="error"', 'Transaction support not available in database');
  211 + $this->privileges_check = 'cross';
  212 + } else {
  213 + $this->temp_variables['dbTransaction'] .= sprintf($html, 'tick', '', 'Database has transaction support');
  214 + }
  215 + $this->_dbhandler->query('DELETE FROM ' . $sTable . ' WHERE name = "transactionTest"');
  216 + }
  217 + else
  218 + {
  219 + $this->temp_variables['dbConnectUser'] .= sprintf($html, 'cross', 'class="error"', 'Unable to connect to database (user: ' . $dbconf['dmsusername'] . ')');
  220 + }
  221 + }
  222 +
  223 + private function checkServices()
  224 + {
  225 + $services = new services();
  226 + foreach ($services->getServices() as $serviceName) {
  227 + $className = OS.$serviceName;
  228 + $service = new $className();
  229 + if($service->status() == 'RUNNING' || $service->status() == 'STARTED') {
  230 + $this->temp_variables[$serviceName."Status"] = 'tick';
  231 + } else {
  232 + $this->temp_variables[$serviceName."Status"] = 'cross_orange';
  233 + $this->services_check = 'cross_orange';
  234 + }
  235 + }
  236 + return true;
  237 + }
  238 +
  239 + /**
  240 + * Set all silent mode varibles
  241 + *
  242 + */
  243 + private function storeSilent() {
  244 + $this->temp_variables['services_check'] = $this->services_check;
  245 + $this->temp_variables['paths_check'] = $this->paths_check;
  246 + $this->temp_variables['privileges_check'] = $this->privileges_check;
  247 + $this->temp_variables['database_check'] = $this->database_check;
  248 + }
  249 +}
  250 +?>
0 \ No newline at end of file 251 \ No newline at end of file
setup/migrate/steps/database.php 0 → 100644
  1 +<?php
  2 +/**
  3 +* Database Step Controller.
  4 +*
  5 +* KnowledgeTree Community Edition
  6 +* Document Management Made Simple
  7 +* Copyright(C) 2008,2009 KnowledgeTree Inc.
  8 +* Portions copyright The Jam Warehouse Software(Pty) Limited
  9 +*
  10 +* This program is free software; you can redistribute it and/or modify it under
  11 +* the terms of the GNU General Public License version 3 as published by the
  12 +* Free Software Foundation.
  13 +*
  14 +* This program is distributed in the hope that it will be useful, but WITHOUT
  15 +* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  16 +* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
  17 +* details.
  18 +*
  19 +* You should have received a copy of the GNU General Public License
  20 +* along with this program. If not, see <http://www.gnu.org/licenses/>.
  21 +*
  22 +* You can contact KnowledgeTree Inc., PO Box 7775 #87847, San Francisco,
  23 +* California 94120-7775, or email info@knowledgetree.com.
  24 +*
  25 +* The interactive user interfaces in modified source and object code versions
  26 +* of this program must display Appropriate Legal Notices, as required under
  27 +* Section 5 of the GNU General Public License version 3.
  28 +*
  29 +* In accordance with Section 7(b) of the GNU General Public License version 3,
  30 +* these Appropriate Legal Notices must retain the display of the "Powered by
  31 +* KnowledgeTree" logo and retain the original copyright notice. If the display of the
  32 +* logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices
  33 +* must display the words "Powered by KnowledgeTree" and retain the original
  34 +* copyright notice.
  35 +*
  36 +* @copyright 2008-2009, KnowledgeTree Inc.
  37 +* @license GNU General Public License version 3
  38 +* @author KnowledgeTree Team
  39 +* @package Migrateer
  40 +* @version Version 0.1
  41 +*/
  42 +
  43 +class database extends Step
  44 +{
  45 + /**
  46 + * Reference to Database object
  47 + *
  48 + * @author KnowledgeTree Team
  49 + * @access public
  50 + * @var object
  51 + */
  52 + public $_dbhandler = null;
  53 +
  54 + /**
  55 + * Reference to Database object
  56 + *
  57 + * @author KnowledgeTree Team
  58 + * @access public
  59 + * @var object
  60 + */
  61 + public $_util = null;
  62 +
  63 + /**
  64 + * Database type
  65 + *
  66 + * @author KnowledgeTree Team
  67 + * @access private
  68 + * @var array
  69 + */
  70 + private $dtype = '';
  71 +
  72 + /**
  73 + * Database types
  74 + *
  75 + * @author KnowledgeTree Team
  76 + * @access private
  77 + * @var array
  78 + */
  79 + private $dtypes = array();
  80 +
  81 + /**
  82 + * Database host
  83 + *
  84 + * @author KnowledgeTree Team
  85 + * @access private
  86 + * @var string
  87 + */
  88 + private $dhost = '';
  89 +
  90 + /**
  91 + * Database port
  92 + *
  93 + * @author KnowledgeTree Team
  94 + * @access private
  95 + * @var string
  96 + */
  97 + private $dport = '';
  98 +
  99 + /**
  100 + * Database name
  101 + *
  102 + * @author KnowledgeTree Team
  103 + * @access private
  104 + * @var string
  105 + */
  106 + private $dname = '';
  107 +
  108 + /**
  109 + * Database root username
  110 + *
  111 + * @author KnowledgeTree Team
  112 + * @access private
  113 + * @var string
  114 + */
  115 + private $duname = '';
  116 +
  117 + /**
  118 + * Database root password
  119 + *
  120 + * @author KnowledgeTree Team
  121 + * @access private
  122 + * @var string
  123 + */
  124 + private $dpassword = '';
  125 +
  126 + /**
  127 + * Database dms username
  128 + *
  129 + * @author KnowledgeTree Team
  130 + * @access private
  131 + * @var string
  132 + */
  133 + private $dmsname = '';
  134 +
  135 + /**
  136 + * Database dms password
  137 + *
  138 + * @author KnowledgeTree Team
  139 + * @access private
  140 + * @var string
  141 + */
  142 + private $dmspassword = '';
  143 +
  144 + /**
  145 + * Default dms user username
  146 + *
  147 + * @author KnowledgeTree Team
  148 + * @access private
  149 + * @var boolean
  150 + */
  151 + private $dmsusername = '';
  152 +
  153 + /**
  154 + * Default dms user password
  155 + *
  156 + * @author KnowledgeTree Team
  157 + * @access private
  158 + * @var boolean
  159 + */
  160 + private $dmsuserpassword = '';
  161 +
  162 + /**
  163 + * Location of database binaries.
  164 + *
  165 + * @author KnowledgeTree Team
  166 + * @access private
  167 + * @var string
  168 + */
  169 + private $mysqlDir; // TODO:multiple databases
  170 +
  171 + /**
  172 + * Name of database binary.
  173 + *
  174 + * @author KnowledgeTree Team
  175 + * @access private
  176 + * @var string
  177 + */
  178 + private $dbbinary = ''; // TODO:multiple databases
  179 +
  180 + /**
  181 + * Database table prefix
  182 + *
  183 + * @author KnowledgeTree Team
  184 + * @access private
  185 + * @var string
  186 + */
  187 + private $tprefix = '';
  188 +
  189 + /**
  190 + * Flag to drop database
  191 + *
  192 + * @author KnowledgeTree Team
  193 + * @access private
  194 + * @var boolean
  195 + */
  196 + private $ddrop = false;
  197 +
  198 + /**
  199 + * List of errors encountered
  200 + *
  201 + * @author KnowledgeTree Team
  202 + * @access public
  203 + * @var array
  204 + */
  205 + public $error = array();
  206 +
  207 + /**
  208 + * List of errors used in template
  209 + *
  210 + * @author KnowledgeTree Team
  211 + * @access public
  212 + * @var array
  213 + */
  214 + public $templateErrors = array('dmspassword', 'dmsuserpassword', 'con', 'dname', 'dtype', 'duname', 'dpassword');
  215 +
  216 + /**
  217 + * Flag to store class information in session
  218 + *
  219 + * @author KnowledgeTree Team
  220 + * @access public
  221 + * @var array
  222 + */
  223 + public $storeInSession = true;
  224 +
  225 + /**
  226 + * Flag if step needs to be migrateed
  227 + *
  228 + * @author KnowledgeTree Team
  229 + * @access public
  230 + * @var array
  231 + */
  232 + protected $runMigrate = true;
  233 +
  234 + /**
  235 + * Flag if step needs to run silently
  236 + *
  237 + * @author KnowledgeTree Team
  238 + * @access public
  239 + * @var array
  240 + */
  241 + protected $silent = true;
  242 +
  243 + /**
  244 + * Constructs database object
  245 + *
  246 + * @author KnowledgeTree Team
  247 + * @access public
  248 + * @param none
  249 + */
  250 + public function __construct() {
  251 + $this->temp_variables = array("step_name"=>"database", "silent"=>$this->silent);
  252 + $this->_dbhandler = new dbUtil();
  253 + $this->_util = new MigrateUtil();
  254 + if(WINDOWS_OS)
  255 + $this->mysqlDir = MYSQL_BIN;
  256 + }
  257 +
  258 + /**
  259 + * Main control of database setup
  260 + *
  261 + * @author KnowledgeTree Team
  262 + * @param none
  263 + * @access public
  264 + * @return string
  265 + */
  266 + public function doStep() {
  267 + $this->setErrorsFromSession();
  268 + $this->initErrors(); // Load template errors
  269 + if($this->inStep("database")) {
  270 + $res = $this->doProcess();
  271 + if($res) { // If theres a response, return it
  272 + return $res;
  273 + }
  274 + }
  275 + if($this->setDataFromSession("database")) { // Attempt to set values from session
  276 + $this->setDetails(); // Set any posted variables
  277 + } else {
  278 + $this->loadDefaults($this->readXml()); // Load default variables from file
  279 + }
  280 +
  281 + return 'landing';
  282 + }
  283 +
  284 + /**
  285 + * Controls setup helper
  286 + *
  287 + * @author KnowledgeTree Team
  288 + * @param none
  289 + * @access public
  290 + * @return string
  291 + */
  292 + public function doProcess() {
  293 + if($this->next()) {
  294 + $this->setPostConfig(); // Set any posted variables
  295 + $this->setDetails();
  296 + if($this->doTest()) { // Test
  297 + return 'confirm';
  298 + } else {
  299 + return 'error';
  300 + }
  301 + } else if($this->previous()) {
  302 + return 'previous';
  303 + } else if($this->confirm()) {
  304 + $this->setDataFromSession("database"); // Set Session Information
  305 + $this->setPostConfig(); // Set any posted variables
  306 + return 'next';
  307 + } else if($this->edit()) {
  308 + $this->setDataFromSession("database"); // Set Session Information, since its an edit
  309 + $this->temp_variables['state'] = 'edit';
  310 +
  311 + return 'landing';
  312 + }
  313 + }
  314 +
  315 + /**
  316 + * Test database connectivity
  317 + *
  318 + * @author KnowledgeTree Team
  319 + * @param none
  320 + * @access public
  321 + * @return boolean
  322 + */
  323 + public function doTest() {
  324 + if($this->match($this->dmspassword, $this->getPassword1()) != 0) {
  325 + $this->error['dmspassword'] = "Passwords do not match: " . $this->dmspassword." ". $this->getPassword1();
  326 + return false;
  327 + }
  328 + if($this->match($this->dmsuserpassword, $this->getPassword2()) != 0) {
  329 + $this->error['dmsuserpassword'] = "Passwords do not match: " . $this->dmsuserpassword." ". $this->getPassword2();
  330 + return false;
  331 + }
  332 + if($this->dport == '') {
  333 + $con = $this->_dbhandler->load($this->dhost, $this->duname, $this->dpassword, $this->dname);
  334 + } else {
  335 + $con = $this->_dbhandler->load($this->dhost.":".$this->dport, $this->duname, $this->dpassword, $this->dname);
  336 + }
  337 + if (!$con) {
  338 + $this->error['con'] = "Could not connect to the database, please check username and password";
  339 + return false;
  340 + } else {
  341 + if ($this->dbExists()) { // Check if database Exists
  342 + $this->error['dname'] = 'Database Already Exists, please specify a different name'; // Reset usage errors
  343 + return false;
  344 + } else {
  345 + $this->error = array(); // Reset usage errors
  346 + return true;
  347 + }
  348 + }
  349 + }
  350 +
  351 + public function dbExists() {
  352 + return $this->_dbhandler->useDb();
  353 + }
  354 +
  355 + public function match($str1, $str2) {
  356 + return strcmp($str1, $str2);
  357 + }
  358 +
  359 + public function getPassword1() {
  360 + return $_POST['dmspassword2'];
  361 + }
  362 +
  363 + public function getPassword2() {
  364 + return $_POST['dmsuserpassword2'];
  365 + }
  366 + /**
  367 + * Check if theres a database type
  368 + *
  369 + * @author KnowledgeTree Team
  370 + * @params none
  371 + * @access private
  372 + * @return boolean database type or false
  373 + */
  374 + private function getType() {
  375 + if(isset($_POST['dtype'])) {
  376 + return $_POST['dtype'];
  377 + }
  378 +
  379 + return false;
  380 + }
  381 +
  382 + /**
  383 + * Set Errors if any were encountered
  384 + *
  385 + * @author KnowledgeTree Team
  386 + * @params none
  387 + * @access private
  388 + * @return boolean
  389 + */
  390 + private function setErrorsFromSession() {
  391 + if(isset($_SESSION['database']['errors'])) {
  392 + $this->error[] = $_SESSION['database']['errors'];
  393 +
  394 + return true;
  395 + }
  396 +
  397 + return false;
  398 + }
  399 +
  400 + /**
  401 + * Set POST information
  402 + *
  403 + * @author KnowledgeTree Team
  404 + * @params none
  405 + * @access public
  406 + * @return void
  407 + */
  408 + public function setPostConfig() {
  409 + $this->dtype = $this->getPostSafe("dtype");
  410 + $this->dtypes = array("0"=>"mysql"); // TODO:multiple databases
  411 + $this->dhost = $this->getPostSafe("dhost");
  412 + $this->dport = $this->getPostSafe("dport");
  413 + $this->dname = $this->getPostSafe("dname");
  414 + $this->duname = $this->getPostSafe("duname");
  415 + $this->dpassword = $this->getPostSafe("dpassword");
  416 + $this->dmsname = $this->getPostSafe("dmsname");
  417 + $this->dmsusername = $this->getPostSafe("dmsusername");
  418 + $this->dmspassword = $this->getPostSafe("dmspassword");
  419 + $this->dmsuserpassword = $this->getPostSafe("dmsuserpassword");
  420 + $this->dbbinary = $this->getPostSafe("dbbinary");
  421 + $this->tprefix = $this->getPostSafe("tprefix");
  422 + $this->ddrop = $this->getPostBoolean("ddrop");
  423 + }
  424 +
  425 + /**
  426 + * Load default options on template from xml file
  427 + *
  428 + * @author KnowledgeTree Team
  429 + * @params object SimpleXmlObject
  430 + * @access public
  431 + * @return void
  432 + */
  433 + public function loadDefaults($simplexml) {
  434 + if($simplexml) {
  435 + $this->temp_variables['dtype'] = "";
  436 + $this->temp_variables['dtypes'] = array("0"=>"mysql"); // TODO:multiple databases
  437 + $this->temp_variables['dname'] = (string) $simplexml->dname;
  438 + $this->temp_variables['duname'] = (string) $simplexml->duname;
  439 + $this->temp_variables['dhost'] = (string) $simplexml->dhost;
  440 + $this->temp_variables['dport'] = (string) $simplexml->dport;
  441 + $this->temp_variables['dpassword'] = '';
  442 + $this->temp_variables['dmsname'] = (string) $simplexml->dmsadminuser;
  443 + $this->temp_variables['dmsusername'] = (string) $simplexml->dmsuser;
  444 + $this->temp_variables['dmspassword'] = (string) $simplexml->dmsaupass;
  445 + $this->temp_variables['dmsuserpassword'] = (string) $simplexml->dmsupass;
  446 + if(WINDOWS_OS) {
  447 + $this->temp_variables['dbbinary'] = 'mysql.exe';
  448 + } else {
  449 + $this->temp_variables['dbbinary'] = 'mysql';
  450 + }
  451 + $this->temp_variables['tprefix'] = '';
  452 + $this->temp_variables['ddrop'] = false;
  453 + }
  454 + }
  455 +
  456 + /**
  457 + * Store options
  458 + *
  459 + * @author KnowledgeTree Team
  460 + * @params object SimpleXmlObject
  461 + * @access private
  462 + * @return void
  463 + */
  464 + private function setDetails() {
  465 + if($this->edit()) {
  466 + $this->temp_variables['state'] = 'edit';
  467 + } else {
  468 + $this->temp_variables['state'] = '';
  469 + }
  470 + $this->temp_variables['dtype'] = $this->getPostSafe('dtype');
  471 + $this->temp_variables['dtypes'] = array("0"=>"mysql"); // TODO:multiple databases;
  472 + $this->temp_variables['dhost'] = $this->getPostSafe('dhost');
  473 + $this->temp_variables['dport'] = $this->getPostSafe('dport');
  474 + $this->temp_variables['dname'] = $this->getPostSafe('dname');
  475 + $this->temp_variables['duname'] = $this->getPostSafe('duname');
  476 + $this->temp_variables['dpassword'] = $this->getPostSafe('dpassword');
  477 + $this->temp_variables['dmsname'] = $this->getPostSafe('dmsname');
  478 + $this->temp_variables['dmsusername'] = $this->getPostSafe('dmsusername');
  479 + $this->temp_variables['dmspassword'] = $this->getPostSafe('dmspassword');
  480 + $this->temp_variables['dmsuserpassword'] = $this->getPostSafe('dmsuserpassword');;
  481 + $this->temp_variables['dbbinary'] = $this->getPostSafe('dbbinary');
  482 + $this->temp_variables['tprefix'] = $this->getPostSafe('tprefix');
  483 + $this->temp_variables['ddrop'] = $this->getPostBoolean('ddrop');
  484 + }
  485 +
  486 + /**
  487 + * Extract database types
  488 + *
  489 + * @author KnowledgeTree Team
  490 + * @access private
  491 + * @params object SimpleXmlObject
  492 + * @return array
  493 + */
  494 + private function getTypes($xmlTypes) {
  495 + $t = array();
  496 + foreach ($xmlTypes->dtype as $key=>$val) {
  497 + $t[] = (string) $val;
  498 + }
  499 + return $t;
  500 + }
  501 +
  502 + /**
  503 + * Read xml config file
  504 + *
  505 + * @author KnowledgeTree Team
  506 + * @access private
  507 + * @params none
  508 + * @return object SimpleXmlObject
  509 + */
  510 + private function readXml() {
  511 + $simplexml = simplexml_load_file(CONF_DIR."databases.xml");
  512 +
  513 + return $simplexml;
  514 + }
  515 +
  516 + /**
  517 + * Stores varibles used by template
  518 + *
  519 + * @author KnowledgeTree Team
  520 + * @params none
  521 + * @access public
  522 + * @return array
  523 + */
  524 + public function getStepVars() {
  525 + return $this->temp_variables;
  526 + }
  527 +
  528 + /**
  529 + * Runs step migrate if required
  530 + *
  531 + * @author KnowledgeTree Team
  532 + * @param none
  533 + * @access public
  534 + * @return void
  535 + */
  536 + public function migrateStep() {
  537 + return $this->migrateDatabase();
  538 + }
  539 +
  540 + /**
  541 + * Helper
  542 + *
  543 + * @author KnowledgeTree Team
  544 + * @params none
  545 + * @access private
  546 + * @return void
  547 + */
  548 + private function migrateDatabase() {
  549 + if($this->dtype == '') {
  550 + $this->error['dtype'] = 'No database type selected';
  551 + return 'error';
  552 + }
  553 + if(!$this->{$this->dtype}()) {
  554 + return 'error';
  555 + }
  556 + }
  557 +
  558 + /**
  559 + * Helper
  560 + *
  561 + * @author KnowledgeTree Team
  562 + * @params none
  563 + * @access private
  564 + * @return void
  565 + */
  566 + private function mysql() {
  567 + $con = $this->connectMysql();
  568 + if($con) {
  569 + if(!$this->createDB($con)) {
  570 + $this->error['con'] = "Could not Create Database: ";
  571 + return false;
  572 + }
  573 + $this->closeMysql($con);
  574 + }
  575 + }
  576 +
  577 + /**
  578 + * Connect to mysql
  579 + *
  580 + * @author KnowledgeTree Team
  581 + * @params none
  582 + * @access private
  583 + * @return object mysql connection
  584 + */
  585 + private function connectMysql() {
  586 + $con = $this->_dbhandler->load($this->dhost, $this->duname, $this->dpassword, $this->dname);
  587 + if (!$con) {
  588 + $this->error['con'] = "Could not connect: ";
  589 +
  590 + return false;
  591 + }
  592 +
  593 + return $con;
  594 + }
  595 +
  596 + /**
  597 + * Helper
  598 + *
  599 + * @author KnowledgeTree Team
  600 + * @params object mysql connection object $con
  601 + * @access private
  602 + * @return object mysql connection
  603 + */
  604 + private function createDB($con) {
  605 + if($this->usedb($con)) { // attempt to use the db
  606 + if($this->dropdb($con)) { // attempt to drop the db
  607 + if(!$this->create($con)) { // attempt to create the db
  608 + $this->error['con'] = "Could not create database: ";
  609 + return false;// cannot overwrite database
  610 + }
  611 + } else {
  612 + $this->error['con'] = "Could not drop database: ";
  613 + return false;// cannot overwrite database
  614 + }
  615 + } else {
  616 + if(!$this->create($con)) { // attempt to create the db
  617 + $this->error['con'] = "Could not create database: ";
  618 + return false;// cannot overwrite database
  619 + }
  620 + }
  621 + if(!$this->createDmsUser($con)) {
  622 +
  623 + }
  624 + if(!$this->createSchema($con)) {
  625 + $this->error['con'] = "Could not create schema ";
  626 + }
  627 + if(!$this->populateSchema($con)) {
  628 + $this->error['con'] = "Could not populate schema ";
  629 + }
  630 + if(!$this->applyUpgrades($con)) {
  631 + $this->error['con'] = "Could not apply updates ";
  632 + }
  633 +
  634 + return true;
  635 + }
  636 +
  637 + /**
  638 + * Create database
  639 + *
  640 + * @author KnowledgeTree Team
  641 + * @params object mysql connection object $con
  642 + * @access private
  643 + * @return boolean
  644 + */
  645 + private function create($con) {
  646 + $sql = "CREATE DATABASE {$this->dname}";
  647 + if ($this->_dbhandler->query($sql, $con)) {
  648 +
  649 + return true;
  650 + }
  651 +
  652 + return false;
  653 + }
  654 +
  655 + /**
  656 + * Attempts to use a db
  657 + *
  658 + * @author KnowledgeTree Team
  659 + * @params mysql connection object $con
  660 + * @access private
  661 + * @return boolean
  662 + */
  663 + private function usedb($con) {
  664 + if($this->_dbhandler->useDb($this->dname)) {
  665 + return true;
  666 + } else {
  667 + $this->error['con'] = "Error using database: {$this->dname}";
  668 + return false;
  669 + }
  670 + }
  671 +
  672 + /**
  673 + * Attempts to drop table
  674 + *
  675 + * @author KnowledgeTree Team
  676 + * @access private
  677 + * @params mysql connection object $con
  678 + * @return boolean
  679 + */
  680 + private function dropdb($con) {
  681 + if($this->ddrop) {
  682 + $sql = "DROP DATABASE {$this->dname};";
  683 + if(!$this->_dbhandler->query($sql)) {
  684 + $this->error['con'] = "Cannot drop database: {$this->dname}";
  685 + return false;
  686 + }
  687 + } else {
  688 + $this->error['con'] = "Cannot drop database: {$this->dname}";
  689 + return false;
  690 + }
  691 + return true;
  692 + }
  693 +
  694 + /**
  695 + * Create dms user
  696 + *
  697 + * @author KnowledgeTree Team
  698 + * @access private
  699 + * @params none
  700 + * @return boolean
  701 + */
  702 + private function createDmsUser($con) {
  703 + if($this->dmsname == '' || $this->dmspassword == '') {
  704 + if($this->dpassword == '') {
  705 + $command = "\"".$this->mysqlDir."{$this->dbbinary}\" -u{$this->duname} {$this->dname} < \"".SQL_DIR."user.sql\"";
  706 + } else {
  707 + $command = "\"".$this->mysqlDir."{$this->dbbinary}\" -u{$this->duname} -p{$this->dpassword} {$this->dname} < \"".SQL_DIR."user.sql\"";
  708 + }
  709 + $response = $this->_util->pexec($command);
  710 + return $response;
  711 + } else {
  712 + $user1 = "GRANT SELECT, INSERT, UPDATE, DELETE ON {$this->dname}.* TO {$this->dmsusername}@{$this->dhost} IDENTIFIED BY \"{$this->dmsuserpassword}\";";
  713 + $user2 = "GRANT ALL PRIVILEGES ON {$this->dname}.* TO {$this->dmsname}@{$this->dhost} IDENTIFIED BY \"{$this->dmspassword}\";";
  714 + if ($this->_dbhandler->execute($user1) && $this->_dbhandler->execute($user2)) {
  715 + return true;
  716 + } else {
  717 + $this->error['con'] = "Could not create users for database: {$this->dname}";
  718 + return false;
  719 + }
  720 + }
  721 +
  722 + }
  723 +
  724 + /**
  725 + * Create schema
  726 + *
  727 + * @author KnowledgeTree Team
  728 + * @access private
  729 + * @params none
  730 + * @return boolean
  731 + */
  732 + private function createSchema($con) {
  733 + if($this->dpassword == '') {
  734 + $command = "\"".$this->mysqlDir."{$this->dbbinary}\" -u{$this->duname} {$this->dname} < \"".SQL_DIR."structure.sql\"";
  735 + } else {
  736 + $command = "\"".$this->mysqlDir."{$this->dbbinary}\" -u{$this->duname} -p{$this->dpassword} {$this->dname} < \"".SQL_DIR."structure.sql\"";
  737 + }
  738 + $response = $this->_util->pexec($command);
  739 + return $response;
  740 + }
  741 +
  742 + /**
  743 + * Populate database
  744 + *
  745 + * @author KnowledgeTree Team
  746 + * @access private
  747 + * @params none
  748 + * @return boolean
  749 + */
  750 + private function populateSchema($con) {
  751 + if($this->dpassword == '') {
  752 + $command = "\"".$this->mysqlDir."{$this->dbbinary}\" -u{$this->duname} {$this->dname} < \"".SQL_DIR."data.sql\"";
  753 + } else {
  754 + $command = "\"".$this->mysqlDir."{$this->dbbinary}\" -u{$this->duname} -p{$this->dpassword} {$this->dname} < \"".SQL_DIR."data.sql\"";
  755 + }
  756 + $response = $this->_util->pexec($command);
  757 + return $response;
  758 + }
  759 +
  760 + /**
  761 + * Ammend any known database upgrades
  762 + *
  763 + * @author KnowledgeTree Team
  764 + * @access private
  765 + * @params none
  766 + * @return boolean
  767 + */
  768 + private function applyUpgrades($con) {
  769 + // Database upgrade to version 3.6.1: Search ranking
  770 + return true;
  771 + }
  772 +
  773 + /**
  774 + * Close connection if it exists
  775 + *
  776 + * @author KnowledgeTree Team
  777 + * @access private
  778 + * @params mysql connection object $con
  779 + * @return void
  780 + */
  781 + private function closeMysql($con) {
  782 + try {
  783 + $this->_dbhandler->close();
  784 + } catch (Exeption $e) {
  785 + $this->error['con'] = "Could not close: " . $e;
  786 + }
  787 + }
  788 +
  789 + /**
  790 + * Returns database errors
  791 + *
  792 + * @author KnowledgeTree Team
  793 + * @access public
  794 + * @params none
  795 + * @return array
  796 + */
  797 + public function getErrors() {
  798 +
  799 + return $this->error;
  800 + }
  801 +
  802 + /**
  803 + * Test database connectivity
  804 + *
  805 + * @author KnowledgeTree Team
  806 + * @param none
  807 + * @access public
  808 + * @return boolean
  809 + */
  810 + public function doAjaxTest($host, $uname, $dname) {
  811 +
  812 + }
  813 +
  814 + /**
  815 + * Initialize errors to false
  816 + *
  817 + * @author KnowledgeTree Team
  818 + * @param none
  819 + * @access private
  820 + * @return boolean
  821 + */
  822 + private function initErrors() {
  823 + foreach ($this->templateErrors as $e) {
  824 + $this->error[$e] = false;
  825 + }
  826 + }
  827 +}
  828 +?>
0 \ No newline at end of file 829 \ No newline at end of file
setup/migrate/steps/errors.php 0 → 100644
  1 +<?php
  2 +/**
  3 +* Error Controller.
  4 +*
  5 +* KnowledgeTree Community Edition
  6 +* Document Management Made Simple
  7 +* Copyright(C) 2008,2009 KnowledgeTree Inc.
  8 +* Portions copyright The Jam Warehouse Software(Pty) Limited
  9 +*
  10 +* This program is free software; you can redistribute it and/or modify it under
  11 +* the terms of the GNU General Public License version 3 as published by the
  12 +* Free Software Foundation.
  13 +*
  14 +* This program is distributed in the hope that it will be useful, but WITHOUT
  15 +* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  16 +* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
  17 +* details.
  18 +*
  19 +* You should have received a copy of the GNU General Public License
  20 +* along with this program. If not, see <http://www.gnu.org/licenses/>.
  21 +*
  22 +* You can contact KnowledgeTree Inc., PO Box 7775 #87847, San Francisco,
  23 +* California 94120-7775, or email info@knowledgetree.com.
  24 +*
  25 +* The interactive user interfaces in modified source and object code versions
  26 +* of this program must display Appropriate Legal Notices, as required under
  27 +* Section 5 of the GNU General Public License version 3.
  28 +*
  29 +* In accordance with Section 7(b) of the GNU General Public License version 3,
  30 +* these Appropriate Legal Notices must retain the display of the "Powered by
  31 +* KnowledgeTree" logo and retain the original copyright notice. If the display of the
  32 +* logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices
  33 +* must display the words "Powered by KnowledgeTree" and retain the original
  34 +* copyright notice.
  35 +*
  36 +* @copyright 2008-2009, KnowledgeTree Inc.
  37 +* @license GNU General Public License version 3
  38 +* @author KnowledgeTree Team
  39 +* @package Migrateer
  40 +* @version Version 0.1
  41 +*/
  42 +class Errors extends Step {
  43 + public $error = array();
  44 +
  45 + function doStep() {
  46 + return 'landing';
  47 + }
  48 +
  49 + function getErrors() {
  50 + return $this->error;
  51 + }
  52 +
  53 + function getName() {
  54 + return 'error';
  55 + }
  56 +}
  57 +?>
0 \ No newline at end of file 58 \ No newline at end of file
setup/migrate/steps/installation.php 0 → 100644
  1 +<?php
  2 +/**
  3 +* Migrate Step Controller.
  4 +*
  5 +* KnowledgeTree Community Edition
  6 +* Document Management Made Simple
  7 +* Copyright(C) 2008,2009 KnowledgeTree Inc.
  8 +* Portions copyright The Jam Warehouse Software(Pty) Limited
  9 +*
  10 +* This program is free software; you can redistribute it and/or modify it under
  11 +* the terms of the GNU General Public License version 3 as published by the
  12 +* Free Software Foundation.
  13 +*
  14 +* This program is distributed in the hope that it will be useful, but WITHOUT
  15 +* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  16 +* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
  17 +* details.
  18 +*
  19 +* You should have received a copy of the GNU General Public License
  20 +* along with this program. If not, see <http://www.gnu.org/licenses/>.
  21 +*
  22 +* You can contact KnowledgeTree Inc., PO Box 7775 #87847, San Francisco,
  23 +* California 94120-7775, or email info@knowledgetree.com.
  24 +*
  25 +* The interactive user interfaces in modified source and object code versions
  26 +* of this program must display Appropriate Legal Notices, as required under
  27 +* Section 5 of the GNU General Public License version 3.
  28 +*
  29 +* In accordance with Section 7(b) of the GNU General Public License version 3,
  30 +* these Appropriate Legal Notices must retain the display of the "Powered by
  31 +* KnowledgeTree" logo and retain the original copyright notice. If the display of the
  32 +* logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices
  33 +* must display the words "Powered by KnowledgeTree" and retain the original
  34 +* copyright notice.
  35 +*
  36 +* @copyright 2008-2009, KnowledgeTree Inc.
  37 +* @license GNU General Public License version 3
  38 +* @author KnowledgeTree Team
  39 +* @package Migrateer
  40 +* @version Version 0.1
  41 +*/
  42 +
  43 +class migrate extends step
  44 +{
  45 +
  46 + function __construct() {
  47 + $this->temp_variables = array("step_name"=>"migrate");
  48 + }
  49 +
  50 + public function doStep() {
  51 + if(!$this->inStep("migrate")) {
  52 + return 'landing';
  53 + }
  54 + if($this->migrate()) {
  55 + return 'migrate';
  56 + } else if($this->previous()) {
  57 + return 'previous';
  58 + }
  59 +
  60 + return 'landing';
  61 + }
  62 +
  63 + public function getStepVars()
  64 + {
  65 + return $this->temp_variables;
  66 + }
  67 +
  68 + public function getErrors() {
  69 + return $this->error;
  70 + }
  71 +}
  72 +?>
0 \ No newline at end of file 73 \ No newline at end of file
setup/migrate/steps/services.php 0 → 100644
  1 +<?php
  2 +/**
  3 +* Services Step Controller.
  4 +*
  5 +* KnowledgeTree Community Edition
  6 +* Document Management Made Simple
  7 +* Copyright(C) 2008,2009 KnowledgeTree Inc.
  8 +* Portions copyright The Jam Warehouse Software(Pty) Limited
  9 +*
  10 +* This program is free software; you can redistribute it and/or modify it under
  11 +* the terms of the GNU General Public License version 3 as published by the
  12 +* Free Software Foundation.
  13 +*
  14 +* This program is distributed in the hope that it will be useful, but WITHOUT
  15 +* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  16 +* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
  17 +* details.
  18 +*
  19 +* You should have received a copy of the GNU General Public License
  20 +* along with this program. If not, see <http://www.gnu.org/licenses/>.
  21 +*
  22 +* You can contact KnowledgeTree Inc., PO Box 7775 #87847, San Francisco,
  23 +* California 94120-7775, or email info@knowledgetree.com.
  24 +*
  25 +* The interactive user interfaces in modified source and object code versions
  26 +* of this program must display Appropriate Legal Notices, as required under
  27 +* Section 5 of the GNU General Public License version 3.
  28 +*
  29 +* In accordance with Section 7(b) of the GNU General Public License version 3,
  30 +* these Appropriate Legal Notices must retain the display of the "Powered by
  31 +* KnowledgeTree" logo and retain the original copyright notice. If the display of the
  32 +* logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices
  33 +* must display the words "Powered by KnowledgeTree" and retain the original
  34 +* copyright notice.
  35 +*
  36 +* @copyright 2008-2009, KnowledgeTree Inc.
  37 +* @license GNU General Public License version 3
  38 +* @author KnowledgeTree Team
  39 +* @package Migrateer
  40 +* @version Version 0.1
  41 +*/
  42 +
  43 +class services extends Step
  44 +{
  45 + /**
  46 + * List of errors encountered
  47 + *
  48 + * @author KnowledgeTree Team
  49 + * @access protected
  50 + * @var array
  51 + */
  52 + protected $error = array();
  53 +
  54 + /**
  55 + * Flag if step needs to be migrateed
  56 + *
  57 + * @author KnowledgeTree Team
  58 + * @access protected
  59 + * @var array
  60 + */
  61 + protected $runMigrate = true;
  62 +
  63 + /**
  64 + * List of services to be migrateed
  65 + *
  66 + * @author KnowledgeTree Team
  67 + * @access private
  68 + * @var array
  69 + */
  70 + private $services = array('Lucene', 'Scheduler', 'OpenOffice');
  71 +
  72 + /**
  73 + * Path to java executable
  74 + *
  75 + * @author KnowledgeTree Team
  76 + * @access protected
  77 + * @var string
  78 + */
  79 + protected $java;
  80 +
  81 + /**
  82 + * Path to php executable
  83 + *
  84 + * @author KnowledgeTree Team
  85 + * @access protected
  86 + * @var string
  87 + */
  88 + protected $php;
  89 +
  90 + /**
  91 + * Path to open office executable
  92 + *
  93 + * @author KnowledgeTree Team
  94 + * @access protected
  95 + * @var string
  96 + */
  97 + protected $soffice;
  98 +
  99 + /**
  100 + * Reference to utility object
  101 + *
  102 + * @author KnowledgeTree Team
  103 + * @access protected
  104 + * @var string
  105 + */
  106 + protected $util;
  107 +
  108 + /**
  109 + * Minumum Java Version
  110 + *
  111 + * @author KnowledgeTree Team
  112 + * @access protected
  113 + * @var string
  114 + */
  115 + private $javaVersion = '1.5';
  116 +// private $javaVersion = '1.7';
  117 +
  118 + /**
  119 + * Java Migrateed
  120 + *
  121 + * @author KnowledgeTree Team
  122 + * @access private
  123 + * @var mixed
  124 + */
  125 + private $javaCheck = 'cross';
  126 +
  127 +
  128 + public $providedJava = false;
  129 +
  130 + /**
  131 + * Flag if services are already Migrateed
  132 + *
  133 + * @author KnowledgeTree Team
  134 + * @access private
  135 + * @var mixed
  136 + */
  137 + private $alreadyMigrateed = false;
  138 +
  139 + /**
  140 + * Flag if services are already Migrateed
  141 + *
  142 + * @author KnowledgeTree Team
  143 + * @access private
  144 + * @var mixed
  145 + */
  146 + private $luceneMigrateed = false;
  147 +
  148 + /**
  149 + * Flag if services are already Migrateed
  150 + *
  151 + * @author KnowledgeTree Team
  152 + * @access private
  153 + * @var mixed
  154 + */
  155 + private $schedulerMigrateed = false;
  156 +
  157 + /**
  158 + * PHP Migrateed
  159 + *
  160 + * @author KnowledgeTree Team
  161 + * @access private
  162 + * @var mixed
  163 + */
  164 + private $phpCheck = 'cross_orange';
  165 +
  166 + /**
  167 + * Java Bridge Migrateed
  168 + *
  169 + * @author KnowledgeTree Team
  170 + * @access private
  171 + * @var mixed
  172 + */
  173 + private $javaExtCheck = 'cross_orange';
  174 +
  175 + /**
  176 + * Service Migrateed
  177 + *
  178 + * @author KnowledgeTree Team
  179 + * @access private
  180 + * @var array
  181 + */
  182 + private $serviceCheck = 'tick';
  183 +
  184 + /**
  185 + * Flag to store class information in session
  186 + *
  187 + * @author KnowledgeTree Team
  188 + * @access public
  189 + * @var boolean
  190 + */
  191 + protected $storeInSession = true;
  192 +
  193 + /**
  194 + * List of variables to be loaded to template
  195 + *
  196 + * @author KnowledgeTree Team
  197 + * @access public
  198 + * @var array
  199 + */
  200 + protected $temp_variables;
  201 +
  202 + /**
  203 + * Flag if step needs to run silently
  204 + *
  205 + * @author KnowledgeTree Team
  206 + * @access public
  207 + * @var array
  208 + */
  209 + protected $silent = true;
  210 +
  211 + /**
  212 + * Flag if bridge extension needs to be disabled
  213 + *
  214 + * @author KnowledgeTree Team
  215 + * @access public
  216 + * @var boolean
  217 + */
  218 + private $disableExtension = false;
  219 +
  220 + /**
  221 + * Flag, if java is specified and an error has been encountered
  222 + *
  223 + * @author KnowledgeTree Team
  224 + * @access public
  225 + * @var mixed
  226 + */
  227 + private $javaExeError = '';
  228 +
  229 + /**
  230 + * Holds path error, if java is specified
  231 + *
  232 + * @author KnowledgeTree Team
  233 + * @access public
  234 + * @var mixed
  235 + */
  236 + private $javaExeMessage = '';
  237 +
  238 + /**
  239 + * Holds path error, if php is specified
  240 + *
  241 + * @author KnowledgeTree Team
  242 + * @access public
  243 + * @var mixed
  244 + */
  245 + private $phpExeError = '';
  246 + /**
  247 + * Constructs services object
  248 + *
  249 + * @author KnowledgeTree Team
  250 + * @access public
  251 + * @param none
  252 + */
  253 + public function __construct() {
  254 + $this->temp_variables = array("step_name"=>"services", "silent"=>$this->silent);
  255 + $this->util = new MigrateUtil();
  256 + }
  257 +
  258 + /**
  259 + * Main control of services setup
  260 + *
  261 + * @author KnowledgeTree Team
  262 + * @param none
  263 + * @access public
  264 + * @return string
  265 + */
  266 + public function doStep()
  267 + {
  268 + if(!$this->inStep("services")) {
  269 + $this->doRun();
  270 + return 'landing';
  271 + }
  272 + if($this->next()) {
  273 + // Check dependencies
  274 + $passed = $this->doRun();
  275 + $serv = $this->getDataFromSession("services");
  276 +// var_dump($conf);
  277 +// die;
  278 + if($passed || $serv['providedJava'])
  279 + return 'next';
  280 + else
  281 + return 'error';
  282 + } else if($this->previous()) {
  283 + return 'previous';
  284 + }
  285 +
  286 + $passed = $this->doRun();
  287 + return 'landing';
  288 + }
  289 +
  290 + /**
  291 + * Get service names
  292 + *
  293 + * @author KnowledgeTree Team
  294 + * @param none
  295 + * @access public
  296 + * @return array
  297 + */
  298 + public function getServices() {
  299 + return $this->services;
  300 + }
  301 +
  302 + /**
  303 + * Check if java executable was found
  304 + *
  305 + * @author KnowledgeTree Team
  306 + * @param none
  307 + * @access private
  308 + * @return array
  309 + */
  310 + private function setJava() {
  311 + if($this->java != '') { // Java JRE Found
  312 + $this->javaCheck = 'tick';
  313 + $this->javaMigrateed();
  314 + $this->temp_variables['java']['location'] = $this->java;
  315 + }
  316 + }
  317 +
  318 + /**
  319 + * Run step
  320 + *
  321 + * @author KnowledgeTree Team
  322 + * @param none
  323 + * @access private
  324 + * @return boolean
  325 + */
  326 + private function doRun() {
  327 + if($this->alreadyMigrateed()) {
  328 + $this->alreadyMigrateed = true;
  329 + $this->serviceCheck = 'tick';
  330 + } else {
  331 + $this->php = $this->util->getPhp(); // Get java, if it exists
  332 + $this->java = $this->util->getJava(); // Get java, if it exists
  333 + $this->soffice = $this->util->getOpenOffice(); // Get java, if it exists
  334 + $passedPhp = $this->phpChecks(); // Run Java Pre Checks
  335 + $passedJava = $this->javaChecks(); // Run Java Pre Checks
  336 + $passedOpenOffice = $this->openOfficeChecks(); // Run Java Pre Checks
  337 + $errors = $this->getErrors(); // Get errors
  338 + if(empty($errors) && $passedJava && $passedPhp && $passedOpenOffice) { // Migrate Service if there is no errors
  339 + $this->migrateServices();
  340 + } elseif ($passedPhp) { // Migrate Scheduler
  341 + $this->migrateService('Scheduler');
  342 + } elseif ($passedJava) { // Migrate Lucene
  343 + $this->migrateService('Lucene');
  344 + } elseif ($passedOpenOffice) { //Migrate OpenOffice
  345 + $this->migrateService('OpenOffice');
  346 + } else { // All Services not migrateed
  347 + // TODO: What todo now?
  348 + }
  349 + }
  350 + $this->checkServiceStatus();
  351 + $this->storeSilent(); // Store info needed for silent mode
  352 + if(!empty($errors))
  353 + return false;
  354 + return true;
  355 + }
  356 +
  357 + /**
  358 + * A final check to see if services are still running,
  359 + * incase they switched on and turned off.
  360 + *
  361 + * @author KnowledgeTree Team
  362 + * @param none
  363 + * @access private
  364 + * @return void
  365 + */
  366 + private function checkServiceStatus() {
  367 + $serverDetails = $this->getServices();
  368 + foreach ($serverDetails as $serviceName) {
  369 + $className = OS.$serviceName;
  370 + $service = new $className();
  371 + $status = $this->serviceStatus($service);
  372 + if($status != 'STARTED') {
  373 + $msg = $service->getName()." Could not be added as a Service";
  374 + $this->temp_variables['services'][] = array('class'=>'cross_orange', 'msg'=>$msg);
  375 + $this->serviceCheck = 'cross_orange';
  376 + $this->warnings[] = $msg;
  377 + } else {
  378 + if(WINDOWS_OS) {
  379 + $this->temp_variables['services'][] = array('class'=>'tick', 'msg'=>$service->getName()." has been added as a Service"); }
  380 + else {
  381 + $this->temp_variables['services'][] = array('class'=>'tick', 'msg'=>$service->getName()." has been added and Started as a Service");
  382 + }
  383 + }
  384 + }
  385 + }
  386 +
  387 + /**
  388 + * Checks if all services have been started already,
  389 + * incase the user lands on service page multiple times
  390 + *
  391 + * @author KnowledgeTree Team
  392 + * @param none
  393 + * @access public
  394 + * @return boolean
  395 + */
  396 + public function alreadyMigrateed() {
  397 + $migrateed = true;
  398 + $serverDetails = $this->getServices();
  399 + foreach ($serverDetails as $serviceName) {
  400 + $className = OS.$serviceName;
  401 + $service = new $className();
  402 + $status = $this->serviceStatus($service);
  403 + if(!$status) {
  404 + return false;
  405 + }
  406 + }
  407 + return true;
  408 + }
  409 +
  410 +
  411 + /**
  412 + * Do some basic checks to help the user overcome java problems
  413 + *
  414 + * @author KnowledgeTree Team
  415 + * @param none
  416 + * @access private
  417 + * @return boolean
  418 + */
  419 + private function javaChecks() {
  420 + $this->zendBridgeNotMigrateed(); // Set bridge not migrateed
  421 + $this->javaVersionInCorrect(); // Set version to incorrect
  422 + $this->javaNotMigrateed(); // Set java to not migrateed
  423 + $this->setJava(); // Check if java has been auto detected
  424 + if($this->util->javaSpecified()) {
  425 + $this->disableExtension = true; // Disable the use of the php bridge extension
  426 + if($this->detSettings(true)) { // AutoDetect java settings
  427 + return true;
  428 + } else {
  429 + $this->specifyJava(); // Ask for settings
  430 + }
  431 + } else {
  432 + $auto = $this->useBridge(); // Use Bridge to get java settings
  433 + if($auto) {
  434 + return $auto;
  435 + } else {
  436 + $auto = $this->useDetected(); // Check if auto detected java works
  437 + if($auto) {
  438 + $this->disableExtension = true; // Disable the use of the php bridge extension
  439 + return $auto;
  440 + } else {
  441 + $this->specifyJava(); // Ask for settings
  442 + }
  443 + }
  444 + return $auto;
  445 + }
  446 + }
  447 +
  448 + /**
  449 + * Attempt detection without logging errors
  450 + *
  451 + * @author KnowledgeTree Team
  452 + * @param none
  453 + * @access private
  454 + * @return boolean
  455 + */
  456 + private function useDetected() {
  457 + return $this->detSettings();
  458 + }
  459 +
  460 + private function specifyJava() {
  461 + $this->javaExeError = true;
  462 + }
  463 +
  464 + private function specifyPhp() {
  465 + $this->phpExeError = true;
  466 + }
  467 +
  468 + private function phpChecks() {
  469 + // TODO: Better detection
  470 + return true;
  471 + $this->setPhp();
  472 + if($this->util->phpSpecified()) {
  473 + return $this->detPhpSettings();
  474 + } else {
  475 + $this->specifyPhp();// Ask for settings
  476 + return false;
  477 + }
  478 + }
  479 +
  480 + private function openOfficeChecks() {
  481 + return true;
  482 + }
  483 +
  484 + /**
  485 + * Attempts to use user input and configure java settings
  486 + *
  487 + * @author KnowledgeTree Team
  488 + * @param none
  489 + * @access private
  490 + * @return boolean
  491 + */
  492 + private function detSettings($attempt = false) {
  493 + $javaExecutable = $this->util->javaSpecified();// Retrieve java bin
  494 + $cmd = "$javaExecutable -version > output/outJV 2>&1 echo $!";
  495 + $response = $this->util->pexec($cmd);
  496 + if(file_exists(OUTPUT_DIR.'outJV')) {
  497 + $tmp = file_get_contents(OUTPUT_DIR.'outJV');
  498 + preg_match('/"(.*)"/',$tmp, $matches);
  499 + if($matches) {
  500 + if($matches[1] < $this->javaVersion) { // Check Version of java
  501 + $this->javaVersionInCorrect();
  502 + $this->javaCheck = 'cross';
  503 + $this->error[] = "Requires Java 1.5+ to be migrateed";
  504 +
  505 + return false;
  506 + } else {
  507 + $this->javaVersionCorrect();
  508 + $this->javaMigrateed();
  509 + $this->javaCheck = 'tick';
  510 + $this->providedJava = true;
  511 +
  512 + return true;
  513 + }
  514 + } else {
  515 + $this->javaVersionWarning();
  516 + $this->javaCheck = 'cross_orange';
  517 + if($attempt) {
  518 + $this->javaExeMessage = "Incorrect java path specified";
  519 + $this->javaExeError = true;
  520 + $this->error[] = "Requires Java 1.5+ to be migrateed";
  521 + }
  522 +
  523 +
  524 + return false;
  525 + }
  526 + }
  527 +
  528 + $this->javaVersionInCorrect();
  529 + $this->javaCheck = 'cross';
  530 + $this->error[] = "Requires Java 1.5+ to be migrateed";
  531 + return false;
  532 + }
  533 +
  534 + function detPhpSettings() {
  535 + // TODO: Better php handling
  536 + return true;
  537 + $phpExecutable = $this->util->phpSpecified();// Retrieve java bin
  538 + $cmd = "$phpExecutable -version > output/outPHP 2>&1 echo $!";
  539 + $response = $this->util->pexec($cmd);
  540 + if(file_exists(OUTPUT_DIR.'outPHP')) {
  541 + $tmp = file_get_contents(OUTPUT_DIR.'outPHP');
  542 + preg_match('/PHP/',$tmp, $matches);
  543 + if($matches) {
  544 + $this->phpCheck = 'tick';
  545 +
  546 + return true;
  547 + } else {
  548 + $this->phpCheck = 'cross_orange';
  549 + $this->phpExeError = "PHP : Incorrect path specified";
  550 + $this->error[] = "PHP executable required";
  551 +
  552 + return false;
  553 + }
  554 + }
  555 + }
  556 + /**
  557 + * Attempts to use bridge and configure java settings
  558 + *
  559 + * @author KnowledgeTree Team
  560 + * @param none
  561 + * @access private
  562 + * @return boolean
  563 + */
  564 + private function useBridge() {
  565 + $zendBridge = $this->zendBridge(); // Find Zend Bridge
  566 + if($zendBridge) { // Bridge migrateed implies java exists
  567 + $this->zendBridgeMigrateed();
  568 + if($this->checkZendBridge()) { // Make sure the Zend Bridge is functional
  569 + $this->javaExtCheck = 'tick'; // Set bridge to functional
  570 + $this->javaMigrateed(); // Set java to migrateed
  571 + $javaSystem = new Java('java.lang.System');
  572 + $version = $javaSystem->getProperty('java.version');
  573 + $ver = substr($version, 0, 3);
  574 + if($ver < $this->javaVersion) {
  575 + $this->javaVersionInCorrect();
  576 + $this->error[] = "Requires Java 1.5+ to be migrateed";
  577 + return false;
  578 + } else {
  579 + $this->javaVersionCorrect(); // Set version to correct
  580 + $this->javaCheck = 'tick';
  581 + return true;
  582 + }
  583 + } else {
  584 + $this->javaCheck = 'cross_orange';
  585 + $this->javaVersionWarning();
  586 + $this->zendBridgeWarning();
  587 + $this->warnings[] = "Zend Java Bridge Not Functional";
  588 + $this->javaExtCheck = 'cross_orange';
  589 + return false;
  590 + }
  591 + } else {
  592 + $this->warnings[] = "Zend Java Bridge Not Found";
  593 + return false;
  594 + }
  595 + }
  596 +
  597 + /**
  598 + * Check if Zend Bridge is enabled
  599 + *
  600 + * @author KnowledgeTree Team
  601 + * @param none
  602 + * @access public
  603 + * @return boolean
  604 + */
  605 + public function zendBridge() {
  606 + $mods = get_loaded_extensions();
  607 + if(in_array('Zend Java Bridge', $mods))
  608 + return true;
  609 + else
  610 + return false;
  611 + }
  612 +
  613 + /**
  614 + * Check if Zend Bridge is functional
  615 + *
  616 + * @author KnowledgeTree Team
  617 + * @param none
  618 + * @access public
  619 + * @return boolean
  620 + */
  621 + public function checkZendBridge() {
  622 + if($this->util->javaBridge()) { // Check if java bridge is functional
  623 + return true;
  624 + } else {
  625 + return false;
  626 + }
  627 + }
  628 +
  629 +
  630 + /**
  631 + * Migrates services
  632 + *
  633 + * @author KnowledgeTree Team
  634 + * @param none
  635 + * @access private
  636 + * @return boolean
  637 + */
  638 + private function migrateServices() {
  639 + foreach ($this->getServices() as $serviceName) {
  640 + $this->migrateService($serviceName);
  641 + }
  642 +
  643 + return true;
  644 + }
  645 +
  646 + /**
  647 + * Migrates services helper
  648 + *
  649 + * @author KnowledgeTree Team
  650 + * @param none
  651 + * @access private
  652 + * @return boolean
  653 + */
  654 + private function migrateService($serviceName) {
  655 + $className = OS.$serviceName;
  656 + $service = new $className();
  657 + $status = $this->serviceHelper($service);
  658 + if (!$status) {
  659 + $this->serviceCheck = 'cross_orange';
  660 + }
  661 + }
  662 +
  663 + /**
  664 + * Migrates services
  665 + *
  666 + * @author KnowledgeTree Team
  667 + * @param object
  668 + * @access private
  669 + * @return string
  670 + */
  671 + private function serviceHelper($service) {
  672 + $service->load(); // Load Defaults
  673 + $response = $service->migrate(); // Migrate service
  674 + $statusCheck = OS."ServiceMigrateed";
  675 + return $this->$statusCheck($service);
  676 + }
  677 +
  678 + /**
  679 + * Returns service status
  680 + *
  681 + * @author KnowledgeTree Team
  682 + * @param object
  683 + * @access private
  684 + * @return string
  685 + */
  686 + private function serviceStatus($service) {
  687 + $statusCheck = OS."ServiceMigrateed";
  688 + return $this->$statusCheck($service);
  689 + }
  690 +
  691 + /**
  692 + * Check if windows service migrateed
  693 + *
  694 + * @author KnowledgeTree Team
  695 + * @param object
  696 + * @access public
  697 + * @return boolean
  698 + */
  699 + public function windowsServiceMigrateed($service) {
  700 + $status = $service->status(); // Check if service has been migrateed
  701 + if($status == '') { // Check service status
  702 + return false;
  703 + }
  704 + return true;
  705 + }
  706 +
  707 + /**
  708 + * Check if unix service migrateed
  709 + *
  710 + * @author KnowledgeTree Team
  711 + * @param object
  712 + * @access public
  713 + * @return boolean
  714 + */
  715 + public function unixServiceMigrateed($service) {
  716 + $status = $service->status(); // Check if service has been migrateed
  717 + if($status != 'STARTED') { // Check service status
  718 + return false;
  719 + }
  720 + return true;
  721 + }
  722 +
  723 + /**
  724 + * Starts all services
  725 + *
  726 + * @author KnowledgeTree Team
  727 + * @param object
  728 + * @access public
  729 + * @return mixed
  730 + */
  731 + public function migrateStep() {
  732 + foreach ($this->getServices() as $serviceName) {
  733 + $className = OS.$serviceName;
  734 + $service = new $className();
  735 + $status = $this->serviceStart($service);
  736 + }
  737 + return true;
  738 + }
  739 +
  740 + /**
  741 + * Starts service
  742 + *
  743 + * @author KnowledgeTree Team
  744 + * @param object
  745 + * @access private
  746 + * @return string
  747 + */
  748 + private function serviceStart($service) {
  749 + if(OS == 'windows') {
  750 + $service->load(); // Load Defaults
  751 + $service->start(); // Start Service
  752 + return $service->status(); // Get service status
  753 + }
  754 + }
  755 +
  756 + /**
  757 + * Returns services errors
  758 + *
  759 + * @author KnowledgeTree Team
  760 + * @access public
  761 + * @params none
  762 + * @return array
  763 + */
  764 + public function getErrors() {
  765 + return $this->error;
  766 + }
  767 +
  768 + /**
  769 + * Returns services warnings
  770 + *
  771 + * @author KnowledgeTree Team
  772 + * @access public
  773 + * @params none
  774 + * @return array
  775 + */
  776 + public function getWarnings() {
  777 + return $this->warnings;
  778 + }
  779 +
  780 + /**
  781 + * Get the variables to be passed to the template
  782 + *
  783 + * @author KnowledgeTree Team
  784 + * @access public
  785 + * @return array
  786 + */
  787 + public function getStepVars()
  788 + {
  789 + return $this->temp_variables;
  790 + }
  791 +
  792 + /**
  793 + * Store Java state as migrateed
  794 + *
  795 + * @author KnowledgeTree Team
  796 + * @param none
  797 + * @access private
  798 + * @return void
  799 + */
  800 + private function javaMigrateed() {
  801 + $this->temp_variables['java']['class'] = 'tick';
  802 + $this->temp_variables['java']['found'] = "Java Runtime Migrateed";
  803 + }
  804 +
  805 + /**
  806 + * Store Java state as not migrateed
  807 + *
  808 + * @author KnowledgeTree Team
  809 + * @param none
  810 + * @access private
  811 + * @return void
  812 + */
  813 + private function javaNotMigrateed() {
  814 + $this->temp_variables['java']['class'] = 'cross';
  815 + $this->temp_variables['java']['found'] = "Java runtime environment required";
  816 + }
  817 +
  818 + /**
  819 + * Store Java version state as correct
  820 + *
  821 + * @author KnowledgeTree Team
  822 + * @param none
  823 + * @access private
  824 + * @return void
  825 + */
  826 + private function javaVersionCorrect() {
  827 + $this->temp_variables['version']['class'] = 'tick';
  828 + $this->temp_variables['version']['found'] = "Java Version 1.5+ Migrateed";
  829 + }
  830 +
  831 + /**
  832 + * Store Java version state as warning
  833 + * @author KnowledgeTree Team
  834 + * @param none
  835 + * @access private
  836 + * @return void
  837 + */
  838 + private function javaVersionWarning() {
  839 + $this->temp_variables['version']['class'] = 'cross_orange';
  840 + $this->temp_variables['version']['found'] = "Java Runtime Version Cannot be detected";
  841 + }
  842 +
  843 + /**
  844 + * Store Java version as state incorrect
  845 + *
  846 + * @author KnowledgeTree Team
  847 + * @param none
  848 + * @access private
  849 + * @return void
  850 + */
  851 + private function javaVersionInCorrect() {
  852 + $this->temp_variables['version']['class'] = 'cross';
  853 + $this->temp_variables['version']['found'] = "Requires Java 1.5+ to be migrateed";
  854 + }
  855 +
  856 + /**
  857 + * Store Zend Bridge state as migrateed
  858 + *
  859 + * @author KnowledgeTree Team
  860 + * @param none
  861 + * @access private
  862 + * @return void
  863 + */
  864 + private function zendBridgeMigrateed() {
  865 + $this->temp_variables['extensions']['class'] = 'tick';
  866 + $this->temp_variables['extensions']['found'] = "Java Bridge Migrateed";
  867 + }
  868 +
  869 + /**
  870 + * Store Zend Bridge state as not migrateed
  871 + *
  872 + * @author KnowledgeTree Team
  873 + * @param none
  874 + * @access private
  875 + * @return void
  876 + */
  877 + private function zendBridgeNotMigrateed() {
  878 + $this->temp_variables['extensions']['class'] = 'cross_orange';
  879 + $this->temp_variables['extensions']['found'] = "Zend Java Bridge Not Migrateed";
  880 + }
  881 +
  882 + /**
  883 + * Store Zend Bridge state as warning
  884 + *
  885 + * @author KnowledgeTree Team
  886 + * @param none
  887 + * @access private
  888 + * @return void
  889 + */
  890 + private function zendBridgeWarning() {
  891 + $this->temp_variables['extensions']['class'] = 'cross_orange';
  892 + $this->temp_variables['extensions']['found'] = "Zend Java Bridge Not Functional";
  893 + }
  894 +
  895 + /**
  896 + * Set all silent mode varibles
  897 + *
  898 + * @author KnowledgeTree Team
  899 + * @param none
  900 + * @access private
  901 + * @return void
  902 + */
  903 + private function storeSilent() {
  904 + $this->temp_variables['alreadyMigrateed'] = $this->alreadyMigrateed;
  905 + $this->temp_variables['luceneMigrateed'] = $this->luceneMigrateed;
  906 + $this->temp_variables['schedulerMigrateed'] = $this->schedulerMigrateed;
  907 + $this->temp_variables['javaExeError'] = $this->javaExeError;
  908 + $this->temp_variables['javaExeMessage'] = $this->javaExeMessage;
  909 + $this->temp_variables['javaCheck'] = $this->javaCheck;
  910 + $this->temp_variables['javaExtCheck'] = $this->javaExtCheck;
  911 + // TODO : PHP detection
  912 + $this->temp_variables['phpCheck'] = 'tick';//$this->phpCheck;
  913 + $this->temp_variables['phpExeError'] = '';//$this->phpExeError;
  914 + $this->temp_variables['serviceCheck'] = $this->serviceCheck;
  915 + $this->temp_variables['disableExtension'] = $this->disableExtension;
  916 + // TODO: Java checks are gettign intense
  917 + $this->temp_variables['providedJava'] = $this->providedJava;
  918 + }
  919 +
  920 + private function setPhp() {
  921 + if($this->php != '') { // PHP Found
  922 + $this->phpCheck = 'tick';
  923 + } elseif (PHP_DIR != '') { // Use System Defined Settings
  924 + $this->php = PHP_DIR;
  925 + } else {
  926 +
  927 + }
  928 + $this->temp_variables['php']['location'] = $this->php;
  929 + }
  930 +
  931 + public function getPhpDir() {
  932 + return $this->php;
  933 + }
  934 +}
  935 +?>
0 \ No newline at end of file 936 \ No newline at end of file
setup/migrate/steps/welcome.php 0 → 100644
  1 +<?php
  2 +/**
  3 +* Welcome Step Controller.
  4 +*
  5 +* KnowledgeTree Community Edition
  6 +* Document Management Made Simple
  7 +* Copyright(C) 2008,2009 KnowledgeTree Inc.
  8 +* Portions copyright The Jam Warehouse Software(Pty) Limited
  9 +*
  10 +* This program is free software; you can redistribute it and/or modify it under
  11 +* the terms of the GNU General Public License version 3 as published by the
  12 +* Free Software Foundation.
  13 +*
  14 +* This program is distributed in the hope that it will be useful, but WITHOUT
  15 +* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  16 +* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
  17 +* details.
  18 +*
  19 +* You should have received a copy of the GNU General Public License
  20 +* along with this program. If not, see <http://www.gnu.org/licenses/>.
  21 +*
  22 +* You can contact KnowledgeTree Inc., PO Box 7775 #87847, San Francisco,
  23 +* California 94120-7775, or email info@knowledgetree.com.
  24 +*
  25 +* The interactive user interfaces in modified source and object code versions
  26 +* of this program must display Appropriate Legal Notices, as required under
  27 +* Section 5 of the GNU General Public License version 3.
  28 +*
  29 +* In accordance with Section 7(b) of the GNU General Public License version 3,
  30 +* these Appropriate Legal Notices must retain the display of the "Powered by
  31 +* KnowledgeTree" logo and retain the original copyright notice. If the display of the
  32 +* logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices
  33 +* must display the words "Powered by KnowledgeTree" and retain the original
  34 +* copyright notice.
  35 +*
  36 +* @copyright 2008-2009, KnowledgeTree Inc.
  37 +* @license GNU General Public License version 3
  38 +* @author KnowledgeTree Team
  39 +* @package Migrateer
  40 +* @version Version 0.1
  41 +*/
  42 +
  43 +class welcome extends step {
  44 +
  45 + protected $silent = true;
  46 +
  47 + function __construct() {
  48 + $this->temp_variables = array("step_name"=>"license");
  49 + }
  50 +
  51 + function doStep() {
  52 + if($this->next()) {
  53 + return 'next'; // Just a welcome, so return "next" action
  54 + }
  55 +
  56 + return 'landing';
  57 + }
  58 +
  59 +// function getErrors() {
  60 +// return array();
  61 +// return array('error'=>'error');
  62 +// }
  63 +
  64 +}
  65 +
  66 +?>
0 \ No newline at end of file 67 \ No newline at end of file
setup/migrate/template.php 0 → 100644
  1 +<?php
  2 +/**
  3 +* Template Engine.
  4 +*
  5 +* KnowledgeTree Community Edition
  6 +* Document Management Made Simple
  7 +* Copyright (C) 2008,2009 KnowledgeTree Inc.
  8 +* Portions copyright The Jam Warehouse Software (Pty) Limited
  9 +*
  10 +* This program is free software; you can redistribute it and/or modify it under
  11 +* the terms of the GNU General Public License version 3 as published by the
  12 +* Free Software Foundation.
  13 +*
  14 +* This program is distributed in the hope that it will be useful, but WITHOUT
  15 +* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  16 +* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
  17 +* details.
  18 +*
  19 +* You should have received a copy of the GNU General Public License
  20 +* along with this program. If not, see <http://www.gnu.org/licenses/>.
  21 +*
  22 +* You can contact KnowledgeTree Inc., PO Box 7775 #87847, San Francisco,
  23 +* California 94120-7775, or email info@knowledgetree.com.
  24 +*
  25 +* The interactive user interfaces in modified source and object code versions
  26 +* of this program must display Appropriate Legal Notices, as required under
  27 +* Section 5 of the GNU General Public License version 3.
  28 +*
  29 +* In accordance with Section 7(b) of the GNU General Public License version 3,
  30 +* these Appropriate Legal Notices must retain the display of the "Powered by
  31 +* KnowledgeTree" logo and retain the original copyright notice. If the display of the
  32 +* logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices
  33 +* must display the words "Powered by KnowledgeTree" and retain the original
  34 +* copyright notice.
  35 +*
  36 +* @copyright 2008-2009, KnowledgeTree Inc.
  37 +* @license GNU General Public License version 3
  38 +* @author KnowledgeTree Team
  39 +* @package Migrater
  40 +* @version Version 0.1
  41 +*/
  42 +
  43 +class Template
  44 +{
  45 + /**
  46 + * Hold all the variables that are going to be imported into the template file
  47 + * @var array
  48 + */
  49 + var $template_vars = Array();
  50 +
  51 +
  52 + /**
  53 + * Constructor
  54 + *
  55 + * @author KnowledgeTree Team
  56 + * @param string $file the file name you want to load
  57 + * @access public
  58 + * @return void
  59 + */
  60 + public function Template($file = null)
  61 + {
  62 + $this->file = $file;
  63 + }
  64 +
  65 +
  66 + /**
  67 + * Set a variable into the template
  68 + * If the variable is a template object, go and call its template::fetch() method
  69 + *
  70 + * @author KnowledgeTree Team
  71 + * @param string $name The name for this value in the template file
  72 + * @param string $value The value to show in the template file
  73 + * @access public
  74 + * @return void
  75 + */
  76 + public function set($name, $value)
  77 + {
  78 + //if(is_a($value, 'Template')) {
  79 + $class = 'Template';
  80 + $isA = $value instanceof $class;
  81 + if($isA) {
  82 + $value = $value->fetch();
  83 + }
  84 + $this->template_vars[$name] = $value;
  85 + }
  86 +
  87 +
  88 + /**
  89 + * Create the template and import its variables
  90 + *
  91 + * @author KnowledgeTree Team
  92 + * @param string $file The file to use as the template
  93 + * @access public
  94 + * @return string The parsed template
  95 + */
  96 + public function fetch($file = null)
  97 + {
  98 + if (is_null($file)) $file = $this->file;
  99 + if (!file_exists($file)) {
  100 + trigger_error('Template file '.$file.' does not exist ', E_USER_ERROR);
  101 + }
  102 + extract($this->template_vars); // Extract the vars to local namespace
  103 + ob_start();
  104 + include($file);
  105 + $contents = ob_get_contents();
  106 + ob_end_clean();
  107 + return $contents;
  108 + }
  109 +
  110 +}
  111 +?>
0 \ No newline at end of file 112 \ No newline at end of file
setup/migrate/templates/complete.tpl 0 → 100644
  1 +<form>
  2 + <p class="title">Migrateation Completed</p>
  3 +
  4 + <p class="description">This allows you to check that your KnowledgeTree configuration is set
  5 + up correctly. You can run this at any time after configuration to check
  6 + that things are still set up correctly.</p>
  7 +
  8 + <?php
  9 + if($errors || $warnings){
  10 + echo '<div>'
  11 + . '<a href="http://wiki.knowledgetree.com/Web_Based_Migrateer#Post_Migrate" target="_blank">'
  12 + . 'Click Here for help on overcoming post migrate issues</a></div><br/>';
  13 + }
  14 + ?>
  15 + <div id="step_content_complete" class="step">
  16 +<!-- Paths and Permissions -->
  17 + <div>
  18 + <h3><?php echo "<span class='{$paths_check}'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>"; ?>Paths and Permissions</h3>
  19 + <?php if($silent) { ?>
  20 + <div id="option8" class="onclick" onclick="javascript:{w.toggleClass('paths_check', 'option8');}">Show Details</div>
  21 + <div class="paths_check" style="display:none">
  22 + <?php } ?>
  23 + <table>
  24 + <tr><?php echo $varDirectory; ?></tr>
  25 + <tr><?php echo $documentRoot; ?></tr>
  26 + <tr><?php echo $logDirectory; ?></tr>
  27 + <tr><?php echo $tmpDirectory; ?></tr>
  28 + <tr><?php echo $uploadDirectory; ?></tr>
  29 + <tr><?php echo $config; ?></tr>
  30 + <tr><?php echo $docLocation; ?></tr>
  31 + </table>
  32 + <?php if($silent) { ?>
  33 + </div>
  34 + <?php } ?>
  35 + </div>
  36 + <br/><br/>
  37 + <div>
  38 +<!-- Database connectivity -->
  39 + <h3><?php echo "<span class='{$database_check}'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>"; ?>Database connectivity</h3>
  40 + <?php if($silent) { ?>
  41 + <div id="option9" class="onclick" onclick="javascript:{w.toggleClass('database_check', 'option9');}">Show Details</div>
  42 + <div class="database_check" style="display:none">
  43 + <?php } ?>
  44 + <table>
  45 + <tr><?php echo $dbConnectAdmin; ?></tr>
  46 + <tr><?php echo $dbConnectUser; ?></tr>
  47 + </table>
  48 + <?php if($silent) { ?>
  49 + </div>
  50 +<!-- Privileges -->
  51 + <br/><br/>
  52 +<!-- <div>-->
  53 + <?php } ?>
  54 + <h3><?php echo "<span class='{$privileges_check}'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>"; ?>Privileges</h3>
  55 + <?php if($silent) { ?>
  56 + <div id="option1" class="onclick" onclick="javascript:{w.toggleClass('privileges_check', 'option1');}">Show Details</div>
  57 + <div class="privileges_check" style="display:none">
  58 + <?php } ?>
  59 + <table style="width:755px;">
  60 + <tr><?php echo $dbPrivileges; ?></tr>
  61 + <tr><?php echo $dbTransaction; ?></tr>
  62 + </table>
  63 + <?php if($silent) { ?>
  64 + </div>
  65 + <?php } ?>
  66 + </div>
  67 +<!-- Services -->
  68 + <br/><br/>
  69 + <div>
  70 + <h3><?php echo "<span class='{$services_check}'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>"; ?>Services</h3>
  71 + <?php if($silent) { ?>
  72 + <div id="option2" class="onclick" onclick="javascript:{w.toggleClass('services_check', 'option2');}">Show Details</div>
  73 + <div class="services_check" style="display:none">
  74 + <?php } ?>
  75 + <table style="width:755px;">
  76 + <tr>
  77 + <td style="width:15px;"> <?php echo "<span class='{$LuceneStatus}'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>"; ?> </td>
  78 + <td style="width:640px;"> Lucene Service <?php if ($LuceneStatus != 'tick') { ?> Could not be started <?php } else { ?> Started <?php } ?></td>
  79 + <?php if ($LuceneStatus != 'tick') { ?>
  80 + <td><a href="javascript:this.location.reload();" class="refresh">Refresh</a></td>
  81 + <?php } ?>
  82 + </tr>
  83 + <tr>
  84 + <td> <?php echo "<span class='{$SchedulerStatus}'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>"; ?> </td>
  85 + <td> Scheduler Service <?php if ($LuceneStatus != 'tick') { ?> Could not be started <?php } else { ?> Started <?php } ?></td>
  86 + <?php if ($SchedulerStatus != 'tick') { ?>
  87 + <td><a href="javascript:this.location.reload();" class="refresh">Refresh</a></td>
  88 + <?php } ?>
  89 + </tr>
  90 + <tr>
  91 + <td> <?php echo "<span class='{$OpenOfficeStatus}'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>"; ?> </td>
  92 + <td> OpenOffice Service <?php if ($OpenOfficeStatus != 'tick') { ?> Could not be started <?php } else { ?> Started <?php } ?></td>
  93 + <?php if ($OpenOfficeStatus != 'tick') { ?>
  94 + <td><a href="javascript:this.location.reload();" class="refresh">Refresh</a></td>
  95 + <?php } ?>
  96 + </tr>
  97 + </table>
  98 + <?php if($silent) { ?>
  99 + </div>
  100 + <?php } ?>
  101 + </div>
  102 + </div>
  103 + <a href="../../" class="buttons back" style="width:80px;">Goto Login</a>
  104 + <?php
  105 + if (INSTALL_TYPE == 'Zend') {
  106 + ?>
  107 + <a href="<?php echo "http://".$_SERVER['HTTP_HOST'].":10081/ZendServer/Index"; ?>" class="back" target="_blank">Zend Server Configuration</a>
  108 + <?php
  109 + }
  110 + ?>
  111 +</form>
0 \ No newline at end of file 112 \ No newline at end of file
setup/migrate/templates/database.tpl 0 → 100644
  1 +<form id="dbsettings" action="index.php?step_name=<?php echo $step_name; ?>" method="post" onsubmit="w.onSubmitValidate(<?php if ($silent) echo 'true'; else echo 'false'; ?>);return false;">
  2 +<p class="title">Confirming Database Configurations</p>
  3 +<!-- Check For immediate Errors -->
  4 +<span class="error"> <?php if($errors['con']) { echo $errors['con']; } ?> </span>
  5 +<!-- Hidden Fields -->
  6 +<input type="hidden" id='ddrop' name="ddrop" <?php echo ($ddrop) ? 'CHECKED' : ''; ?>/>
  7 +<input type="hidden" id="sendAll" name="" value="" />
  8 +<!-- STEP 1 of the database configuration - server settings -->
  9 +<div id="database" class="step1" style="display:block;">
  10 + <div class="description">
  11 + This step configures the connection to the database server and migrates the database. The details for an administrative <br/>
  12 + user on the database server are required in order to be able to configure and migrate the migrateation database.
  13 + </div>
  14 + <div id="step_content_database" class="step">
  15 +
  16 + <table class="dbconf">
  17 + <?php
  18 + $input_size = '45';
  19 + $align = 'left';
  20 + ?>
  21 +<!-- TODO: Different Databases-->
  22 +<?php if($state != 'edit') { ?>
  23 + <tr><td>Your current database type is: </td>
  24 + <?php if($dtypes) {
  25 + foreach($dtypes as $k=>$v) {
  26 + ?><td>
  27 + &nbsp;
  28 + <?php echo ucwords($v)." (Currently the only supported database.)";?>
  29 + <input type="hidden" name="dtype" value="<?php echo $v; ?>" <?php if(!$k)echo 'checked="checked"'; ?>/>
  30 + </td>
  31 + <?php }
  32 + }
  33 + ?>
  34 + </tr>
  35 +<?php } ?>
  36 + <tr>
  37 + <td><label for='dname'>Enter a name for the database: </label></td>
  38 + <td><input type='text' value="<?php echo $dname?>" id='dname' name='dname' size='<?php echo $input_size; ?>' style="float:left"/></td>
  39 + <td id="error" class="error"><?php if($errors['dname']) echo $errors['dname']; ?></td>
  40 + </tr>
  41 + <tr>
  42 + <td><label for='duname'>Enter Database Administrative username: </label></td>
  43 + <td><input type='text' value="<?php echo $duname?>" id='duname' name='duname' size='<?php echo $input_size; ?>' style="float:left"/></td>
  44 + <td id="error" class="error"><?php if($errors['duname']) echo $errors['duname']; ?></td>
  45 + </tr>
  46 + <tr>
  47 + <td><label for='dpassword'>Enter the password for the user: </label></td>
  48 + <td><input type='password' value="<?php echo $dpassword?>" id='dpassword' name='dpassword' size='<?php echo $input_size; ?>' style="float:left"/></td>
  49 + <td id="error" class="error"><?php if($errors['dpassword']) echo $errors['dpassword']; ?></td>
  50 + </tr>
  51 + </table>
  52 +<br/><br/>
  53 + <div id="option3" class="onclick" onclick="javascript:{w.toggleClass('adv_options', 'option3');}">&nbsp;&nbsp;Advanced Options</div>
  54 + <div id="database" class="adv_options" style="display:none;">
  55 + <div class="description">
  56 + These options are only necessary for some sites. If you're not sure what you should enter here, leave the default settings.
  57 + </div>
  58 + <table>
  59 + <tr>
  60 + <td width="10px"> <label for='dhost'>Host: </label> </td>
  61 + <td width="205px"> <div id="tooltips" title="The address of the server where the database is located, if different to the current server">&nbsp;</div> </td>
  62 + <td width="10px"> <input type="text" value="<?php echo $dhost?>" id="dhost" name="dhost" size='<?php echo $input_size; ?>' class="textinput"/> </td>
  63 + </tr>
  64 + <tr>
  65 + <td> <label for='dport'>Port: </label> </td>
  66 + <td> <div id="tooltips" title="The port on which your database server is listening, if it is a non-standard port please enter the number here">&nbsp;</div> </td>
  67 + <td> <input type="text" value="<?php echo $dport?>" id="dport" name="dport" size='10' class="textinput" style="float:left"/> </td>
  68 + </tr>
  69 + <tr>
  70 + <td> <label for='dbbinary'>Socket: </label> </td>
  71 + <td> <div id="tooltips" title="The path to the database binary. If it is not on your system path then please enter it here">&nbsp;</div> </td>
  72 + <td> <input type="text" value="<?php echo $dbbinary?>" id="dbbinary" name="dbbinary" size='<?php echo $input_size; ?>' class="textinput"/> </td>
  73 + </tr>
  74 + </table>
  75 + </div>
  76 + </div>
  77 + <input type="submit" name="Previous" value="Previous" class="button_previous" />
  78 + <?php if ($silent) { ?>
  79 + <input type="submit" name="Next" value="Next" class="button_next"/>
  80 + <?php } else { ?>
  81 + <input type="button" name="Next" value="Next" onclick="javascript:{w.showStep(1, 'n');}" class="button_next"/>
  82 + <?php } ?>
  83 +</div>
  84 +
  85 +<!-- STEP 2 of the database configuration - Admin user password settings -->
  86 +<div id="database" class="step2" style="display:none;">
  87 +<div class="description">
  88 +An administrative user is required for creating tables within the database.
  89 +</div>
  90 + <table class="dbconf">
  91 + <tr style="<?php if ($silent) echo 'display:none' ;?>">
  92 + <td><label for='dmsname'>Enter the name of the Database Administrative User: </label></td>
  93 + <td><input type='text' value="<?php echo $dmsname; ?>" id='dmsname' name='dmsname' size='40' /></td>
  94 + <td id="error_1_2" class="error" style="display:none">Please Enter A Username</td>
  95 + </tr>
  96 + <tr>
  97 + <td><label for='dmspassword'>Enter a password for the Administrative User: </label></td>
  98 + <td><input type='password' value="<?php echo $dmspassword; ?>" id='dmspassword' name='dmspassword' size='40' /></td>
  99 + <td id="error_2_2" class="error" style="display:none">Please Enter A Password</td>
  100 + </tr>
  101 + <tr>
  102 + <td><label for='dmspassword2'>Please confirm the password: </label></td>
  103 + <td><input type='password' value="<?php echo $dmspassword; ?>" id='dmspassword2' name='dmspassword2' size='40' /></td>
  104 + <td id="error_3_2" class="error" style="display:none">Please Confirm Password</td>
  105 + <td id="error_4_2" class="error" style="display:none">Passwords Do Not Match</td>
  106 + </tr>
  107 + </table>
  108 +
  109 + <input type="button" name="Previous" value="Previous" onclick="javascript:{w.showStep(2, 'p');}" class="button_previous"/>
  110 + <input type="button" name="Next" value="Next" onclick="javascript:{w.showStep(2, 'n');}" class="button_next"/>
  111 +</div>
  112 +
  113 +<!-- STEP 3 of the database configuration - default user password settings -->
  114 +<div id="database" class="step3" style="display:none;">
  115 +<div class="description">
  116 +An second user is required for normal database interaction, the reading and writing of data.
  117 +</div>
  118 +
  119 + <table class="dbconf">
  120 + <tr style="<?php if ($silent) echo 'display:none' ;?>">
  121 + <td><label for='dmsusername'>Enter a name for the User: </label></td>
  122 + <td><input type='text' value="<?php echo $dmsusername; ?>" id='dmsusername' name='dmsusername' size='40' /></td>
  123 + <td id="error_1_3" class="error" style="display:none">Please Enter A Username</td>
  124 + </tr>
  125 + <tr>
  126 + <td><label for='dmsuserpassword'>Enter a password: </label></td>
  127 + <td><input type='password' value="<?php echo $dmsuserpassword?>" id='dmsuserpassword' name='dmsuserpassword' size='40' /></td>
  128 + <td id="error_2_3" class="error" style="display:none">Please Enter A Password</td>
  129 + </tr>
  130 + <tr>
  131 + <td><label for='dmsuserpassword2'>Please confirm the password: </label></td>
  132 + <td><input type='password' value="<?php echo $dmsuserpassword?>" id='dmsuserpassword2' name='dmsuserpassword2' size='40' /></td>
  133 + <td id="error_3_3" class="error" style="display:none">Please Confirm Password</td>
  134 + <td id="error_4_3" class="error" style="display:none">Passwords Do Not Match</td>
  135 + </tr>
  136 + </table>
  137 + <input type="button" name="Previous" value="previous" onclick="javascript:{w.showStep(3, 'p');}" class="button_previous"/>
  138 + <input type="submit" name="Next" value="next" class="button_next"/>
  139 +</div>
  140 +</form>
0 \ No newline at end of file 141 \ No newline at end of file
setup/migrate/templates/errors.tpl 0 → 100644
  1 +<p class="title">Welcome to the KnowledgeTree Setup Wizard</p>
  2 +
  3 +<div style="width: 800px;">
  4 +<?php if(isset($error)) echo $error; ?>
  5 +<?php
  6 +if($errors){
  7 + echo '<div class="error">';
  8 + foreach ($errors as $msg){
  9 + echo $msg . "<br />\n";
  10 + }
  11 + echo '</div>';
  12 +}
  13 +?>
  14 +</div>
0 \ No newline at end of file 15 \ No newline at end of file
setup/migrate/templates/installation.tpl 0 → 100644
  1 +<form action="index.php?step_name=migrate" method="post">
  2 + <p class="title">Finalizing System Migrateation</p>
  3 +
  4 + <div id="step_content" class="step">
  5 + <br/>
  6 + <br/>
  7 + <p class="empty_space">
  8 + The wizard will now complete the migrateation and run a final check on the system.
  9 + </p>
  10 + <div class="demo"><img src="resources/graphics/kt_browse.png" /></div>
  11 + </div>
  12 + <input type="submit" name="Previous" value="Previous" class="button_previous"/>
  13 + <input type="submit" name="Migrate" value="Migrate" class="button_next"/>
  14 +</form>
0 \ No newline at end of file 15 \ No newline at end of file
setup/migrate/templates/services.tpl 0 → 100644
  1 +<form action="index.php?step_name=services" method="post" id="services">
  2 + <?php //if($javaExeError != '' || $phpExeError != '') {
  3 + //var_dump($javaExeError);
  4 + //if($errors) $top = "185px"; elseif ($warnings) $top = "185px"; else $top = "168px";
  5 + ?>
  6 +<!-- <input type="submit" name="Next" value="Submit" id="inner_button" style="top:<?php //echo $top; ?>"/>-->
  7 + <?php //} ?>
  8 + <p class="title">Checking Service Dependencies</p>
  9 +
  10 + <p class="description">
  11 + The wizard will review your system to determine whether you can run KnowledgeTree background services. <br/>Once the scan is completed, you&rsquo;ll see whether your system has met the requirements or whether there are areas you need to address.
  12 + </p>
  13 +<!--Continue Message-->
  14 + <?php
  15 + if(!$errors && !$warnings) {
  16 + ?>
  17 + <span class='big_ok'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>
  18 + All service dependencies are met. Please click next to continue.
  19 + <br/><br/>
  20 + <?php
  21 + }
  22 + ?>
  23 +<!--Warning and Error Messages-->
  24 + <?php if($errors) { ?>
  25 + <span class='cross'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>
  26 + <span class='error_message'>Your system is not quite ready to run KnowledgeTree. See the list below to determine which areas you need to address.</span>
  27 + <br/>
  28 + <?php } elseif ($warnings) {
  29 + ?>
  30 + <span class='cross_orange'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>
  31 + <span class='warning_message'>Not all optional dependencies required by KnowledgeTree have been met but you will be able to continue.</span>
  32 + <br/>
  33 + <?php
  34 + }?>
  35 + <?php
  36 + if($errors || $warnings) {
  37 +// var_dump($errors);
  38 + ?>
  39 + &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="http://wiki.knowledgetree.com/Web_Based_Migrateer#Service_Dependencies" target="_blank">Click here for help on overcoming service issues</a>
  40 + <?php } ?>
  41 +<!--Content-->
  42 + <div id="step_content_configuration" style="width:755px;" class="step">
  43 + <?php if(!$alreadyMigrateed) { ?>
  44 + <?php //var_dump($javaExeError); ?>
  45 + <?php if($javaExeError) { ?>
  46 + Specify the location of your Java executable
  47 + &nbsp;&nbsp;&nbsp;
  48 + <input name='java' id='port' size='25' value='<?php echo $java['location']; ?>' style="float:none;"/>
  49 + &nbsp;&nbsp;&nbsp;
  50 + <a href="javascript:{document.getElementById('services').submit();}" class="specify">Submit</a>
  51 + <br/>
  52 + <?php if($javaExeError != '') { ?><span class="error"><?php echo $javaExeMessage; ?></span><?php } ?>
  53 + <?php } ?>
  54 + <?php if($phpExeError != '') { ?>
  55 + <br />
  56 + Specify the location of your PHP executable
  57 + <br />
  58 + <?php if($php['location'] == '') { ?>
  59 + <input name='php' id='port' size='25' value='<?php echo $php['location']; ?>'/>
  60 + <?php } else { ?>
  61 + <input type="hidden" name='php' id='port' size='25' value='<?php echo $php['location']; ?>'/>
  62 + <?php } ?>
  63 + &nbsp;&nbsp;&nbsp;
  64 + <?php if($phpExeError != true) { ?><span class="error"><?php echo $phpExeError; ?></span><?php } ?>
  65 + <?php } ?>
  66 + <h3><?php echo "<span class='{$javaCheck}'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>"; ?>Java Check</h3>
  67 + <?php if($silent) { ?>
  68 + <div id="option4" class="onclick" onclick="javascript:{w.toggleClass('java_details', 'option4');}">Show Details</div>
  69 + <div class="java_details" style="display:none">
  70 + <?php } ?>
  71 +<!-- <p class="description">-->
  72 + The Java version must be higher than 1.5.
  73 +<!-- </p>-->
  74 + <table>
  75 + <tr>
  76 + <td> <span class='<?php echo $step_vars['java']['class']; ?>'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span> </td>
  77 + <td style="width:645px;"> <?php echo $step_vars['java']['found']; ?> </td>
  78 + <?php
  79 + if ($step_vars['java']['class'] != 'tick') {
  80 + ?>
  81 + <td><a href="javascript:this.location.reload();" class="refresh">Refresh</a></td>
  82 + <?php
  83 + } else { ?>
  84 + <td> </td>
  85 + <?php } ?>
  86 + </tr>
  87 + <tr>
  88 + <td> <span class='<?php echo $step_vars['version']['class']; ?>'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span> </td>
  89 + <td> <?php echo $step_vars['version']['found']; ?> </td>
  90 + <?php if ($step_vars['version']['class'] != 'tick') {
  91 + ?>
  92 + <td><a href="javascript:this.location.reload();" class="refresh">Refresh</a></td>
  93 + <?php
  94 + }
  95 + ?>
  96 + </tr>
  97 + </table>
  98 + <?php if($silent) { ?>
  99 + </div>
  100 + <?php } ?>
  101 + <?php if (!$disableExtension) { ?>
  102 + <h3><?php echo "<span class='{$javaExtCheck}'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>"; ?>Java Extensions</h3>
  103 + <?php if($silent) { ?>
  104 + <div id="option5" class="onclick" onclick="javascript:{w.toggleClass('java_ext_details', 'option5');}">Show Details</div>
  105 + <div class="java_ext_details" style="display:none">
  106 + <?php } ?>
  107 +<!-- <p class="description">-->
  108 + A PHP Java Bridge is required for KnowledgeTree to perform at an optimal level.
  109 +<!-- </p>-->
  110 + <table>
  111 + <tr>
  112 + <td> <span class='<?php echo $step_vars['extensions']['class']; ?>'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span> </td>
  113 + <td style="width:645px;"> <?php echo $step_vars['extensions']['found']; ?> </td>
  114 + <?php if ($step_vars['extensions']['class'] != 'tick') {
  115 + ?>
  116 + <td><a href="javascript:this.location.reload();" class="refresh">Refresh</a></td>
  117 + <?php
  118 + }
  119 + ?>
  120 + </tr>
  121 + </table>
  122 + <?php if($silent) { ?>
  123 + </div>
  124 + <?php } ?>
  125 + <?php } ?>
  126 + <?php } else { ?>
  127 +<!-- <p class="description">-->
  128 + All services are already migrateed.
  129 +<!-- </p>-->
  130 + <?php } ?>
  131 + <h3><?php echo "<span class='{$serviceCheck}'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>"; ?>Services Check</h3>
  132 + <?php if($silent) { ?>
  133 + <div id="option6" class="onclick" onclick="javascript:{w.toggleClass('service_details', 'option6');}">Show Details</div>
  134 + <div class="service_details" style="display:none">
  135 + <?php } ?>
  136 +<!-- <p class="description">-->
  137 + Preload Services if posibble.
  138 +<!-- </p>-->
  139 + <table>
  140 + <?php
  141 + if($step_vars) {
  142 + if(isset($step_vars['services'])) {
  143 + foreach ($step_vars['services'] as $ser){
  144 + ?>
  145 + <tr>
  146 + <td> <span class='<?php echo $ser['class']; ?>'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span> </td>
  147 + <td style="width:645px;"> <?php echo $ser['msg']; ?> </td>
  148 + <?php if ($ser['class'] != 'tick') {
  149 + ?>
  150 + <td><a href="javascript:this.location.reload();" class="refresh">Refresh</a></td>
  151 + <?php
  152 + } ?>
  153 + </tr>
  154 + <?php
  155 + }
  156 + }
  157 + }
  158 + ?>
  159 + </table>
  160 + <?php if($silent) { ?>
  161 + </div>
  162 + <?php } ?>
  163 + </div>
  164 + <input type="submit" name="Previous" value="Back" class="button_previous"/>
  165 + <input type="submit" name="Next" value="Next" class="button_next"/>
  166 +</form>
0 \ No newline at end of file 167 \ No newline at end of file
setup/migrate/templates/welcome.tpl 0 → 100644
  1 +<form action="index.php?step_name=welcome" method="post">
  2 + <p class="title">Welcome to KnowledgeTree</p>
  3 + <div id="step_content" class="step">
  4 + <br/>
  5 + <br/>
  6 + <p class="empty_space"> This wizard will lead you through the steps needed to migrate and configure KnowledgeTree on your server. </p>
  7 + <div class="demo"><img src="resources/graphics/kt_browse.png" /></div>
  8 + </div>
  9 + <input type="submit" name="Next" value="Next" class="button_next"/>
  10 +</form>
0 \ No newline at end of file 11 \ No newline at end of file
setup/migrate/templates/wizard.tpl 0 → 100644
  1 +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
  2 +<html>
  3 + <head>
  4 + <title>KnowledgeTree Migrateer</title>
  5 + <script type="text/javascript" src="resources/jquery-tooltip/lib/jquery.js"></script>
  6 + <script type="text/javascript" src="resources/wizard.js" ></script>
  7 + <link rel="stylesheet" type="text/css" href="resources/wizard.css" />
  8 +
  9 + </head>
  10 + <body onload="w.doFormCheck();">
  11 + <div id="outer-wrapper">
  12 + <div id="header">
  13 + <div id="logo"><img src="resources/graphics/dame/migrater-header_logo.png"/></div>
  14 + <div id="migrate_details">
  15 + <span style="font-size:120%;"> <?php echo $vars['migrate_version']; ?> </span>
  16 + <span style="font-size:120%;"><?php echo $vars['migrate_type']; ?></span>
  17 + </div>
  18 + </div>
  19 + <div id="wrapper">
  20 + <div id="container">
  21 + <div id="sidebar">
  22 + <?php echo $vars['left']; ?>
  23 + </div>
  24 + <div id="content">
  25 + <div id="content_container">
  26 + <?php echo $content; ?>
  27 + </div>
  28 + </div>
  29 + </div>
  30 + <div class="clearing">&nbsp;</div>
  31 + </div>
  32 +
  33 + <div id="footer">
  34 + <img width="105" height="23" align="right" src="resources/graphics/dame/powered-by-kt.png" style="padding: 5px;"/>
  35 + </div>
  36 + </div>
  37 + </body>
  38 +</html>
  39 +<script>
  40 + var w = new wizard();
  41 +</script>
0 \ No newline at end of file 42 \ No newline at end of file