Tons of changes made to the CORE. All scripts has more a less been modified. Primaril...
[Packages/TYPO3.CMS.git] / typo3 / wizard_colorpicker.php
1 <?php
2 /***************************************************************
3 * Copyright notice
4 *
5 * (c) 1999-2003 Kasper Skaarhoj (kasper@typo3.com)
6 * All rights reserved
7 *
8 * This script is part of the TYPO3 project. The TYPO3 project is
9 * free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * The GNU General Public License can be found at
15 * http://www.gnu.org/copyleft/gpl.html.
16 * A copy is found in the textfile GPL.txt and important notices to the license
17 * from the author is found in LICENSE.txt distributed with these scripts.
18 *
19 *
20 * This script is distributed in the hope that it will be useful,
21 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 * GNU General Public License for more details.
24 *
25 * This copyright notice MUST APPEAR in all copies of the script!
26 ***************************************************************/
27 /**
28 * Color picker wizard
29 *
30 * @author Kasper Skaarhoj <kasper@typo3.com>
31 * @package TYPO3
32 * @subpackage core
33 *
34 */
35
36
37
38 $BACK_PATH="";
39 require ("init.php");
40 require ("template.php");
41
42
43
44 // ***************************
45 // Script Classes
46 // ***************************
47 class SC_wizard_colorpicker {
48 var $content;
49 var $P;
50 var $doc;
51
52 function init() {
53 global $BE_USER,$LANG,$BACK_PATH,$TCA_DESCR,$TCA,$HTTP_GET_VARS,$HTTP_POST_VARS,$CLIENT,$TYPO3_CONF_VARS;
54
55 $this->P = t3lib_div::GPvar('P',1);
56
57 unset($this->P["fieldChangeFunc"]["alert"]);
58 reset($this->P["fieldChangeFunc"]);
59 $update="";
60 while(list($k,$v)=each($this->P["fieldChangeFunc"])) {
61 $update.= "
62 window.opener.".$v;
63 }
64
65
66 $this->doc = t3lib_div::makeInstance("template");
67 $this->doc->backPath = $BACK_PATH;
68 $this->doc->JScode='
69 <script language="javascript" type="text/javascript">
70 function checkReference() {
71 if (window.opener && window.opener.document && window.opener.document.'.$this->P["formName"].' && window.opener.document.'.$this->P["formName"].'["'.$this->P["itemName"].'"] ) {
72 return window.opener.document.'.$this->P["formName"].'["'.$this->P["itemName"].'"];
73 } else {
74 close();
75 }
76 }
77 function changeBGcolor(color) {
78 if (window.opener.document.layers)
79 window.opener.document.layers["'.$this->P["md5ID"].'"].bgColor = color;
80 else if (window.opener.document.all)
81 window.opener.document.all["'.$this->P["md5ID"].'"].style.background = color;
82 }
83 function setValue(input) {
84 var field = checkReference();
85 if (field) {
86 field.value = input;
87 '.$update.'
88 changeBGcolor(input);
89 }
90 }
91 function getValue() {
92 var field = checkReference();
93 return field.value;
94 }
95 </script>
96 ';
97
98
99 $this->content.=$this->doc->startPage("Color Picker");
100 }
101 function main() {
102 global $SOBE;
103
104 $this->content.='Color picker
105 <form action="">
106 <input type="text" name="test" onChange="setValue(this.value);">
107 </form>
108
109 <script language="javascript" type="text/javascript">
110 document.forms[0].test.value = getValue();
111 </script>
112
113 ';
114 $this->content.=$this->doc->endPage();
115 }
116 function printContent() {
117 echo $this->content;
118 }
119 }
120
121 // Include extension?
122 if (defined("TYPO3_MODE") && $TYPO3_CONF_VARS[TYPO3_MODE]["XCLASS"]["typo3/wizard_colorpicker.php"]) {
123 include_once($TYPO3_CONF_VARS[TYPO3_MODE]["XCLASS"]["typo3/wizard_colorpicker.php"]);
124 }
125
126
127
128
129
130
131
132
133
134
135
136
137 // Make instance:
138 $SOBE = t3lib_div::makeInstance("SC_wizard_colorpicker");
139 $SOBE->init();
140 $SOBE->main();
141 $SOBE->printContent();
142 ?>