Changeset 15380
- Timestamp:
- 03/04/08 17:57:48 (7 months ago)
- Files:
-
- trunk/midcom/midcom.helper.datamanager/static/datamanager.css (modified) (1 diff)
- trunk/midcom/midcom.helper.datamanager2/type/parameters.php (modified) (6 diffs)
- trunk/midcom/midcom.helper.datamanager2/type/php.php (modified) (8 diffs)
- trunk/midcom/midcom.helper.datamanager2/type/select.php (modified) (3 diffs)
- trunk/midcom/midcom.helper.datamanager2/type/table.php (modified) (1 diff)
- trunk/midcom/midcom.helper.datamanager2/type/tagselect.php (modified) (43 diffs)
- trunk/midcom/midcom.helper.datamanager2/type/text.php (modified) (8 diffs)
- trunk/midcom/net.nemein.flashplayer/source/com/macromedia/javascript/JavaScriptSerializer.as (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/midcom/midcom.helper.datamanager/static/datamanager.css
r13590 r15380 9 9 /************************ External References ****************************** 10 10 * These must go first, so that CSS is happy. 11 * Don t use any media Tags, IE will ignore it.11 * Don't use any media Tags, IE will ignore it. 12 12 */ 13 13 trunk/midcom/midcom.helper.datamanager2/type/parameters.php
r14806 r15380 9 9 10 10 /** 11 * Datamanager 2 parameters type. This allows the editing of all parameters of 11 * Datamanager 2 parameters type. This allows the editing of all parameters of 12 12 * the storage object. 13 * 13 * 14 14 * <b>Configuration options:</b> 15 15 * <i>headers</i> 16 16 * Array with headernames in the same order as the row columns. 17 * 17 * 18 18 * 19 19 * @package midcom.helper.datamanager2 … … 32 32 */ 33 33 var $headers = array('domain', 'name', 'value', 'delete'); 34 34 35 35 /** 36 36 * Set this to true if you want the keys to be exported to the csv dump instead of the … … 68 68 // reset the rows. 69 69 $this->rows = array(); 70 foreach ($this->storage->object->list_parameters() as $domain => $name) 71 { 72 $this->rows[] = array (0 => $domain, 73 1 => key($name), 70 foreach ($this->storage->object->list_parameters() as $domain => $name) 71 { 72 $this->rows[] = array (0 => $domain, 73 1 => key($name), 74 74 2 => $name[key($name)], 75 75 3 => 0); … … 94 94 * 2 = value 95 95 */ 96 96 97 97 $rows = $this->rows; 98 98 $this->rows = array(); 99 foreach ($rows as $key => $row ) 100 { 101 if (array_key_exists(3 , $row ) && $row[3] == 1) 99 foreach ($rows as $key => $row ) 100 { 101 if (array_key_exists(3 , $row ) && $row[3] == 1) 102 102 { 103 103 $this->storage->object->delete_parameter( $row[0],$row[1]); 104 unset ($this->rows[$key]); 105 } // only update parameters that do not have empty names or domains. 106 else if (trim($row[0]) != '' && trim($row[1]) != '') 107 { 108 104 unset ($this->rows[$key]); 105 } // only update parameters that do not have empty names or domains. 106 else if (trim($row[0]) != '' && trim($row[1]) != '') 107 { 108 109 109 if (! $this->storage->object->set_parameter( 110 110 $row[0], 111 111 $row[1], 112 112 $row[2] 113 )) 113 )) 114 114 { 115 115 echo "Could not update parameter {$row[0]} {$row[1]}!"; 116 116 } 117 118 } 119 } 120 117 118 } 119 } 120 121 121 $this->convert_from_storage(true); 122 122 return; 123 123 124 124 } 125 125 … … 172 172 173 173 /** 174 * The validation callback ensures that we don t't have an array or an object174 * The validation callback ensures that we don't have an array or an object 175 175 * as a value, which would be wrong. 176 176 * … … 185 185 { 186 186 $table = "<table border='0' cellspacing='0' ><tr>"; 187 foreach ($this->headers as $header ) 187 foreach ($this->headers as $header ) 188 188 { 189 189 $table .= "<td>{$header}</td>\n"; 190 190 } 191 191 $table .= "</tr>\n"; 192 foreach ($this->rows as $key => $row) 192 foreach ($this->rows as $key => $row) 193 193 { 194 194 $table .= "<tr>\n"; 195 foreach ($row as $row_key => $value ) 195 foreach ($row as $row_key => $value ) 196 196 { 197 197 $table .= "<td>{$value}</td>\n"; 198 198 } 199 199 } 200 $table .= "</tr>\n"; 201 200 $table .= "</tr>\n"; 201 202 202 return $table; 203 203 } trunk/midcom/midcom.helper.datamanager2/type/php.php
r14974 r15380 23 23 */ 24 24 var $value = ''; 25 25 26 26 var $code_valid = true; 27 27 var $code_valid_errors = array(); … … 31 31 $_MIDCOM->add_jsfile(MIDCOM_STATIC_URL . '/midcom.helper.datamanager2/codepress/codepress.js'); 32 32 $_MIDCOM->add_jsonload("if(typeof {$this->name} != 'undefined'){{$this->name}.toggleReadOnly()}"); 33 33 34 34 return true; 35 35 } … … 44 44 // Normalize line breaks to the UNIX format 45 45 $this->value = preg_replace("/\n\r|\r\n|\r/", "\n", $this->value); 46 46 47 47 return $this->value; 48 48 } … … 59 59 60 60 /** 61 * The validation callback ensures that we don t't have an array or an object61 * The validation callback ensures that we don't have an array or an object 62 62 * as a value, which would be wrong. 63 63 * … … 74 74 return false; 75 75 } 76 76 77 77 /* bergie says this segfaults 78 78 if (function_exists('parsekit_compile_string')) … … 81 81 $errors = array(); 82 82 parsekit_compile_string("?>{$this->value}", $errors, PARSEKIT_QUIET); 83 83 84 84 if (!empty($errors)) 85 85 { … … 92 92 } 93 93 } 94 94 95 95 if (count($parse_errors) > 0) 96 96 { … … 105 105 } 106 106 } 107 107 108 108 debug_pop(); 109 109 return true; trunk/midcom/midcom.helper.datamanager2/type/select.php
r15104 r15380 196 196 */ 197 197 var $multiple_storagemode = 'serialized'; 198 198 199 199 /** 200 200 * Glue that will be used for separating the keys 201 * 201 * 202 202 * @var string 203 203 * @access public … … 647 647 648 648 /** 649 * The validation callback ensures that we don t't have an array or an object649 * The validation callback ensures that we don't have an array or an object 650 650 * as a value, which would be wrong. 651 651 * … … 667 667 return false; 668 668 } 669 669 670 670 /*if ( ! $this->required 671 671 && count($this->selection) == 1) trunk/midcom/midcom.helper.datamanager2/type/table.php
r14329 r15380 161 161 162 162 /** 163 * The validation callback ensures that we don t't have an array or an object163 * The validation callback ensures that we don't have an array or an object 164 164 * as a value, which would be wrong. 165 165 * trunk/midcom/midcom.helper.datamanager2/type/tagselect.php
r14806 r15380 64 64 */ 65 65 var $force_rendering_from_tag_library = false; 66 66 67 67 /** 68 68 * This flag controls whether we require tags found with net_nehmer_tag … … 73 73 */ 74 74 var $must_exist_also_in_callback = false; 75 75 76 76 /** 77 77 * The arguments to pass to the option callback constructor. … … 119 119 { 120 120 $classname = $this->option_callback; 121 121 122 122 if (! class_exists($classname)) 123 123 { … … 141 141 return false; 142 142 } 143 143 144 144 $this->_callback = new $classname($this->option_callback_args); 145 145 $this->_callback->set_type($this); 146 146 147 147 debug_add("classname: {$classname}"); 148 148 149 149 $this->use_tag_library = false; 150 150 } … … 152 152 { 153 153 $this->use_tag_library = true; 154 154 155 155 $this->_data_template = array( 156 156 'id' => '', … … 158 158 'color' => '8596b6' 159 159 ); 160 160 161 161 $_MIDCOM->load_library('net.nemein.tag'); 162 162 } 163 163 164 164 $this->allow_multiple = true; 165 165 $this->multiple_storagemode = 'array'; 166 166 167 167 if (!is_array($this->option_callback_args)) 168 168 { 169 169 $this->option_callback_args = array(); 170 170 } 171 171 172 172 // debug_add("this->allow_multiple: {$this->allow_multiple}"); 173 173 // debug_add("this->multiple_storagemode: {$this->multiple_storagemode}"); … … 175 175 // debug_add("this->use_tag_library: {$this->use_tag_library}"); 176 176 // debug_add("this->force_saving_to_tag_library: {$this->force_saving_to_tag_library}"); 177 177 178 178 debug_pop(); 179 179 return true; … … 190 190 debug_push_class(__CLASS__, __FUNCTION__); 191 191 $key = (string) $key; 192 192 193 193 debug_add("key: {$key}"); 194 194 195 195 if (! $this->key_exists($key)) 196 196 { … … 201 201 } 202 202 } 203 203 204 204 if ( $this->use_tag_library 205 205 || $this->force_rendering_from_tag_library) … … 208 208 return $key; 209 209 } 210 210 211 211 if ($this->option_callback === null) 212 212 { … … 216 216 } 217 217 else 218 { 218 { 219 219 debug_add("get from callback"); 220 220 debug_pop(); … … 222 222 } 223 223 } 224 224 225 225 /** 226 226 * Returns the data for a given key. … … 233 233 debug_push_class(__CLASS__, __FUNCTION__); 234 234 $key = (string) $key; 235 235 236 236 debug_add("key: {$key}"); 237 237 238 238 if (! $this->key_exists($key)) 239 239 { … … 241 241 { 242 242 debug_add("Key not found and corr.opt enabled"); 243 243 244 244 debug_pop(); 245 245 return null; 246 246 } 247 247 } 248 248 249 249 if ( $this->use_tag_library 250 250 || $this->force_rendering_from_tag_library) … … 254 254 $data['id'] = $key; 255 255 $data['name'] = $key; 256 256 257 257 debug_print_r("tag_lib data:", $data); 258 259 debug_pop(); 260 return $data; 261 } 262 258 259 debug_pop(); 260 return $data; 261 } 262 263 263 if ($this->option_callback === null) 264 264 { … … 277 277 return $data; 278 278 } 279 } 280 279 } 280 281 281 /** 282 282 * Checks, whether the given key is known. … … 289 289 debug_push_class(__CLASS__, __FUNCTION__); 290 290 $key = (string) $key; 291 291 292 292 debug_add("key: {$key}"); 293 293 294 294 if ( $this->use_tag_library 295 295 || $this->force_saving_to_tag_library) 296 296 { 297 297 debug_add("use tag lib"); 298 298 299 299 if (! $this->storage->object) 300 300 { … … 324 324 return $this->_callback->key_exists($key); 325 325 } 326 } 326 } 327 327 328 328 /** … … 334 334 { 335 335 debug_push_class(__CLASS__, __FUNCTION__); 336 336 337 337 if ( $this->use_tag_library 338 338 || $this->force_saving_to_tag_library) 339 339 { 340 340 debug_add("use tag lib"); 341 341 342 342 $all_tags = array(); 343 343 344 344 if (! $this->storage->object) 345 345 { … … 347 347 return $all_tags; 348 348 } 349 349 350 350 $tags = net_nemein_tag_handler::get_object_tags($this->storage->object); 351 351 foreach ($tags as $name => $url) … … 353 353 $all_tags[$name] = $name; 354 354 } 355 355 356 356 debug_print_r('all_tags',$all_tags); 357 357 358 358 debug_pop(); 359 359 return $all_tags; 360 360 } 361 361 362 362 if ($this->option_callback === null) 363 363 { … … 381 381 { 382 382 debug_push_class(__CLASS__, __FUNCTION__); 383 383 384 384 debug_print_r("source",$source); 385 385 386 386 $this->selection = Array(); 387 387 388 388 if ($this->option_callback !== null) 389 389 { … … 401 401 { 402 402 $tags = net_nemein_tag_handler::get_object_tags($this->storage->object); 403 $source = net_nemein_tag_handler::tag_array2string($tags); 404 } 405 debug_add("tag lib single source: {$source}"); 406 } 407 403 $source = net_nemein_tag_handler::tag_array2string($tags); 404 } 405 debug_add("tag lib single source: {$source}"); 406 } 407 408 408 if ( $source === false 409 409 || $source === null) … … 422 422 if (! is_array($source)) 423 423 { 424 $source = array($source); 425 } 426 } 427 424 $source = array($source); 425 } 426 } 427 428 428 debug_add("final source: {$source}"); 429 429 430 430 foreach ($source as $key) 431 431 { … … 471 471 } 472 472 } 473 473 474 474 function convert_to_raw() 475 475 { … … 486 486 { 487 487 debug_push_class(__CLASS__, __FUNCTION__); 488 488 489 489 if ($this->allow_multiple) 490 490 { … … 527 527 debug_pop(); 528 528 } 529 529 530 530 $tmp_tags = net_nemein_tag_handler::get_object_tags($this->storage->object); 531 531 $tags = array(); … … 534 534 $tags[$name] = $name; 535 535 } 536 536 537 537 debug_add("new tags: {$tags}"); 538 538 … … 561 561 } 562 562 } 563 563 564 564 debug_print_r('new tags to be saved to callback',$tags); 565 565 566 566 $this->_callback->save_values($tags); 567 567 debug_pop(); 568 568 return null; 569 569 } 570 570 571 571 if ( $this->allow_other 572 572 && !empty($this->others)) … … 589 589 } 590 590 } 591 } 592 591 } 592 593 593 /** 594 594 * Converts the selected options according to the multiple_storagemode setting. … … 600 600 { 601 601 debug_push_class(__CLASS__, __FUNCTION__); 602 602 603 603 $glue = '|'; 604 604 … … 607 607 { 608 608 debug_add("use tag lib"); 609 609 610 610 $tags = net_nemein_tag_handler::string2tag_array($source); 611 611 $source = array(); … … 624 624 } 625 625 } 626 626 627 627 debug_print_r('source',$source); 628 628 629 629 debug_pop(); 630 630 return $source; … … 658 658 } 659 659 } 660 660 661 661 /** 662 662 * Converts the selected options according to the multiple_storagemode setting. … … 667 667 { 668 668 debug_push_class(__CLASS__, __FUNCTION__); 669 669 670 670 if ( $this->option_callback !== null 671 671 && $this->enable_saving_to_callback) … … 688 688 } 689 689 } 690 690 691 691 debug_print_r('new tags to be saved to callback',$tags); 692 692 693 693 $this->_callback->save_values($tags); 694 694 debug_pop(); … … 700 700 { 701 701 debug_add("use tag lib"); 702 702 703 703 if ( $this->allow_other 704 704 && !empty($this->others)) … … 725 725 } 726 726 } 727 727 728 728 debug_print_r('new tags to be saved to n.n.tag',$tags); 729 729 730 730 $status = net_nemein_tag_handler::tag_object($this->storage->object, $tags); 731 731 if (!$status) … … 736 736 debug_pop(); 737 737 } 738 738 739 739 $tmp_tags = net_nemein_tag_handler::get_object_tags($this->storage->object); 740 740 $tags = array(); … … 743 743 $tags[$name] = $name; 744 744 } 745 745 746 746 debug_print_r("new tags:",$tags); 747 747 748 748 debug_pop(); 749 749 return null; 750 750 } 751 751 752 752 switch ($this->multiple_storagemode) 753 753 { 754 case 'array': 754 case 'array': 755 755 case 'serialized': 756 756 if ($this->others) … … 782 782 } 783 783 } 784 785 /** 786 * The validation callback ensures that we don t't have an array or an object784 785 /** 786 * The validation callback ensures that we don't have an array or an object 787 787 * as a value, which would be wrong. 788 788 * … … 792 792 { 793 793 debug_push_class(__CLASS__, __FUNCTION__); 794 794 795 795 if ( ! $this->allow_other 796 796 && $this->others) … … 808 808 return false; 809 809 } 810 810 811 811 debug_pop(); 812 812 return true; trunk/midcom/midcom.helper.datamanager2/type/text.php
r14329 r15380 57 57 */ 58 58 var $output_mode = 'specialchars'; 59 59 60 60 /** 61 61 * Runs HTML contents through the HTML Purifier library to ensure safe XHTML compatibility. … … 64 64 */ 65 65 var $purify = false; 66 66 67 67 /** 68 68 * Configuration values for HTML Purifier … … 86 86 debug_pop(); 87 87 } 88 88 89 89 $this->purify = $this->_config->get('html_purify'); 90 90 $this->purify_config = $this->_config->get('html_purify_config'); … … 99 99 function purify_content() 100 100 { 101 if (isset($this->purify_config['Cache']['SerializerPath']) 101 if (isset($this->purify_config['Cache']['SerializerPath']) 102 102 && !file_exists($this->purify_config['Cache']['SerializerPath'])) 103 103 { 104 104 mkdir($this->purify_config['Cache']['SerializerPath']); 105 105 } 106 106 107 107 require_once('HTMLPurifier.php'); 108 108 // For some reason we lose this along the way! … … 110 110 111 111 $purifier = new HTMLPurifier($this->purify_config); 112 112 113 113 // Set local IDPrefix to field name... 114 114 $purifier->config->set('Attr', 'IDPrefixLocal', "{$this->name}_"); … … 168 168 // Normalize line breaks to the UNIX format 169 169 $this->value = preg_replace("/\n\r|\r\n|\r/", "\n", $this->value); 170 170 171 171 if ($this->purify) 172 172 { … … 179 179 } 180 180 } 181 181 182 182 return $this->value; 183 183 } … … 194 194 195 195 /** 196 * The validation callback ensures that we don t't have an array or an object196 * The validation callback ensures that we don't have an array or an object 197 197 * as a value, which would be wrong. 198 198 * trunk/midcom/net.nemein.flashplayer/source/com/macromedia/javascript/JavaScriptSerializer.as
r11750 r15380 135 135 { 136 136 137 //don t include functions137 //don't include functions 138 138 if(typeof(x[o]) == "function") 139 139 {
