Changeset 11345
- Timestamp:
- 07/24/07 15:55:58 (1 year ago)
- Files:
-
- branches/MidCOM_2_8/midgard.admin.sitewizard/handler/host.php (modified) (22 diffs)
- branches/MidCOM_2_8/midgard.admin.sitewizard/locale/default.en.txt (modified) (1 diff)
- branches/MidCOM_2_8/midgard.admin.sitewizard/locale/default.fi.txt (modified) (1 diff)
- branches/MidCOM_2_8/midgard.admin.sitewizard/static/sitewizard.css (modified) (1 diff)
- branches/MidCOM_2_8/midgard.admin.sitewizard/style/wizard-create-host.php (modified) (4 diffs)
- branches/MidCOM_2_8/midgard.admin.sitewizard/style/wizard-select-structure.php (modified) (2 diffs)
- branches/MidCOM_2_8/midgard.admin.sitewizard/style/wizard-select-style.php (modified) (2 diffs)
- branches/MidCOM_2_8/midgard.admin.sitewizard/viewer.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/MidCOM_2_8/midgard.admin.sitewizard/handler/host.php
r11125 r11345 19 19 var $_schema = null; 20 20 var $_schemadb = null; 21 var $_root_topic = null; 21 22 22 23 /** … … 77 78 $session = new midcom_service_session(); 78 79 $session->set("midgard_admin_sitewizard_{$this->_request_data['sitegroup']->id}", $host_settings); 79 80 // Relocate user to template selection 81 $_MIDCOM->relocate("{$prefix}template/{$this->_request_data['sitegroup']->id}/"); 82 // This will exit 80 81 if ($this->_config->get('mode') == 'advanced') 82 { 83 // Relocate user to structure selection 84 $_MIDCOM->relocate("{$prefix}structure/{$this->_request_data['sitegroup']->id}/"); 85 // This will exit 86 } 87 else 88 { 89 // Relocate user to template selection 90 $_MIDCOM->relocate("{$prefix}template/{$this->_request_data['sitegroup']->id}/"); 91 // This will exit 92 } 83 93 } 84 94 … … 113 123 114 124 /** 115 * Select s a template116 */ 117 function _handler_ template($handler_id, $args, &$data)125 * Select a structure 126 */ 127 function _handler_structure($handler_id, $args, &$data) 118 128 { 119 129 $this->_request_data['sitegroup'] = mgd_get_sitegroup($args[0]); … … 140 150 $_MIDCOM->relocate("{$prefix}host/{$this->_request_data['sitegroup']->id}/"); 141 151 // This will exit 142 }143 144 // Read form contents145 if (array_key_exists('midgard_admin_sitewizard_select_template', $_POST))146 {147 if ($_POST['midgard_admin_sitewizard_select_template'] == 'custom')148 {149 if (array_key_exists('template', $host_settings))150 {151 unset($host_settings['template']);152 }153 }154 else155 {156 $host_settings['template'] = $_POST['midgard_admin_sitewizard_select_template'];157 158 // Lets find out if we are using an advanced template159 $qb = midcom_db_style::new_query_builder();160 $qb->add_constraint('sitegroup', '=', 0);161 $qb->add_constraint('name', '=', $host_settings['template']);162 163 $template_style_obj = $qb->execute();164 165 if ($template_style_obj[0]->parameter('midgard.admin.sitewizard', 'template_type') == "advanced")166 {167 $host_settings['template_type'] = "advanced";168 }169 else170 {171 $host_settings['template_type'] = "simple";172 }173 }174 152 } 175 153 … … 191 169 // Save information into session 192 170 $session->set("midgard_admin_sitewizard_{$this->_request_data['sitegroup']->id}", $host_settings); 171 $_MIDCOM->set_pagetitle($this->_l10n->get('create website')); 172 193 173 194 // Relocate user to host creation 174 // Relocate user to host creation 175 $_MIDCOM->relocate("{$prefix}template/{$this->_request_data['sitegroup']->id}/"); 176 // This will exit 177 } 178 179 $this->_request_data['structures_array'] = array_merge( 180 $this->_get_template_structures_filesystem(), $this->_get_template_structures_snippet()); 181 182 return true; 183 } 184 185 function _show_structure($handler_id, &$data) 186 { 187 midcom_show_style('show-wizard-header'); 188 midcom_show_style('wizard-select-structure'); 189 midcom_show_style('show-wizard-footer'); 190 } 191 192 /** 193 * Selects a template 194 */ 195 function _handler_template($handler_id, $args, &$data) 196 { 197 $this->_request_data['sitegroup'] = mgd_get_sitegroup($args[0]); 198 if (!$this->_request_data['sitegroup']) 199 { 200 return false; 201 } 202 203 $prefix = $_MIDCOM->get_context_data(MIDCOM_CONTEXT_ANCHORPREFIX); 204 $session = new midcom_service_session(); 205 if (!$session->exists("midgard_admin_sitewizard_{$this->_request_data['sitegroup']->id}")) 206 { 207 // Relocate user back to host settings 208 $_MIDCOM->relocate("{$prefix}host/{$this->_request_data['sitegroup']->id}/"); 209 // This will exit 210 } 211 212 if (array_key_exists('midgard_admin_sitewizard_process', $_POST)) 213 { 214 $host_settings = $session->get("midgard_admin_sitewizard_{$this->_request_data['sitegroup']->id}"); 215 if (!is_array($host_settings)) 216 { 217 // Corrupt data, relocate back to host settings 218 $_MIDCOM->relocate("{$prefix}host/{$this->_request_data['sitegroup']->id}/"); 219 // This will exit 220 } 221 222 // Read form contents 223 if (array_key_exists('midgard_admin_sitewizard_select_template', $_POST)) 224 { 225 if ($_POST['midgard_admin_sitewizard_select_template'] == 'custom') 226 { 227 if (array_key_exists('template', $host_settings)) 228 { 229 unset($host_settings['template']); 230 } 231 } 232 else 233 { 234 $host_settings['template'] = $_POST['midgard_admin_sitewizard_select_template']; 235 236 // Lets find out if we are using an advanced template 237 $qb = midcom_db_style::new_query_builder(); 238 $qb->add_constraint('sitegroup', '=', 0); 239 $qb->add_constraint('name', '=', $host_settings['template']); 240 241 $template_style_obj = $qb->execute(); 242 243 $qb = midcom_db_element::new_query_builder(); 244 $qb->add_constraint('sitegroup', '=', 0); 245 $qb->add_constraint('style', '=', $template_style_obj[0]->id); 246 $qb->add_constraint('name', '=', '__schemadb'); 247 248 $schema = $qb->execute(); 249 250 if (count($schema) > 0) 251 { 252 $host_settings['template_type'] = "advanced"; 253 $host_settings['template_schemadb'] = $schema[0]; 254 } 255 else 256 { 257 $host_settings['template_type'] = "simple"; 258 } 259 } 260 } 261 262 // Save information into session 263 $session->set("midgard_admin_sitewizard_{$this->_request_data['sitegroup']->id}", $host_settings); 264 $_MIDCOM->set_pagetitle($this->_l10n->get('create website')); 265 266 // Relocate user to host creation 195 267 $_MIDCOM->relocate("{$prefix}create/{$this->_request_data['sitegroup']->id}/"); 196 268 // This will exit … … 204 276 // TODO: Check for sitegroups? 205 277 $this->_request_data['templates'] = $qb->execute(); 206 207 $this->_request_data['structures_array'] = array_merge($this->_get_template_structures_filesystem(), $this->_get_template_structures_snippet());208 278 209 279 return true; … … 219 289 * The operations are done on all available schemas within the DB. 220 290 */ 221 function _load_schemadb() 222 { 223 $this->_schemadb =& $this->_request_data['schemadb']; 224 } 291 function _load_schemadb() 292 { 293 $session = new midcom_service_session(); 294 if (!$session->exists("midgard_admin_sitewizard_{$this->_request_data['sitegroup']->id}")) 295 { 296 // Relocate user back to host settings 297 $_MIDCOM->relocate("{$prefix}host/{$this->_request_data['sitegroup']->id}/"); 298 // This will exit 299 } 300 301 $host_settings = $session->get("midgard_admin_sitewizard_{$this->_request_data['sitegroup']->id}"); 302 if (!is_array($host_settings)) 303 { 304 // Corrupt data, relocate back to host settings 305 $_MIDCOM->relocate("{$prefix}host/{$this->_request_data['sitegroup']->id}/"); 306 // This will exit 307 } 308 309 if (is_string($host_settings['template_schemadb']->value)) 310 { 311 $result = eval ("\$raw_schemadb = Array ( {$host_settings['template_schemadb']->value}\n );"); 312 if ($result === false) 313 { 314 $_MIDCOM->generate_error(MIDCOM_ERRCRIT, 315 "Failed to parse the schema definition from style element, see above for PHP errors."); 316 // This will exit. 317 } 318 } 319 320 $this->_schemadb = midcom_helper_datamanager2_schema::load_database($raw_schemadb); 321 } 225 322 226 323 /** … … 229 326 * @access private 230 327 */ 231 function _load_controller()232 {233 $this->_load_schemadb();234 $this->_controller =& midcom_helper_datamanager2_controller::create('simple');235 $this->_controller->schemadb =& $this->_schemadb;236 $this->_controller->set_storage($this->_host);237 if (! $this->_controller->initialize())238 {239 $_MIDCOM->generate_error(MIDCOM_ERRCRIT, "Failed to initialize a DM2 controller instance for host {$this->_host->id}.");240 // This will exit.241 }242 }328 function _load_controller() 329 { 330 $this->_load_schemadb(); 331 $this->_controller =& midcom_helper_datamanager2_controller::create('simple'); 332 $this->_controller->schemadb =& $this->_schemadb; 333 $this->_controller->set_storage($this->_root_topic); 334 if (! $this->_controller->initialize()) 335 { 336 $_MIDCOM->generate_error(MIDCOM_ERRCRIT, "Failed to initialize a DM2 controller instance for topic {$this->_root_topic->id}."); 337 // This will exit. 338 } 339 } 243 340 244 341 // Handles customization of advanced style templates … … 252 349 } 253 350 254 //$schemadb_contents = midcom_get_snippet_content($this->_config->get("schemadb"));255 //eval("\$schemadb = Array ( {$schemadb_contents} );");256 257 //$this->_schemadb = $schemadb;258 //$this->_request_data['schemadb'] = midcom_helper_datamanager2_schema::load_database($this->_config->get('schemadb'));259 260 /*261 // Instantiate datamanager262 $datamanager = new midcom_helper_datamanager($schemadb);263 264 if (!$datamanager) {265 debug_pop();266 $_MIDCOM->generate_error(MIDCOM_ERRCRIT, "Datamanager could not be instantinated with schema ".$this->_config->get("schemadb"));267 // This will exit.268 }269 */270 351 $prefix = $_MIDCOM->get_context_data(MIDCOM_CONTEXT_ANCHORPREFIX); 271 352 $session = new midcom_service_session(); … … 278 359 279 360 $host_settings = $session->get("midgard_admin_sitewizard_{$this->_request_data['sitegroup']->id}"); 280 281 $qb = midcom_db_host::new_query_builder(); 282 $qb->add_constraint('sitegroup', '=', $this->_request_data['sitegroup']->id); 283 $qb->add_constraint('name', '=', $host_settings['hostname']); 284 $hosts = $qb->execute(); 285 286 $this->_host = $hosts[0]; 287 288 //$datamanager->init($host); 289 361 echo "<pre>"; 362 print_r($host_settings); 363 echo "</pre>"; 364 $this->_root_topic = new midcom_db_topic(); 365 $this->_root_topic->get_by_guid($host_settings['root_topic_guid']); 366 367 $this->_host = new midcom_db_host(); 368 $this->_host->get_by_guid($host_settings['hostguid']); 369 290 370 $this->_load_controller(); 291 371 … … 295 375 // The document has been saved, relocate the user 296 376 debug_pop(); 377 //$this->_root_topic->update(); 297 378 $_MIDCOM->relocate("{$prefix}finish/{$this->_host->id}/"); 298 379 // This will exit … … 300 381 case 'cancel': 301 382 // User has cancelled without saving 383 debug_pop(); 384 //$this->_root_topic->update(); 385 $_MIDCOM->relocate("{$prefix}finish/{$this->_host->id}/"); 386 // This will exit 302 387 break; 303 388 case 'failed': … … 308 393 } 309 394 310 $this->_request_data['datamanager'] =& $this->_controller; 395 $this->_request_data['controller'] =& $this->_controller; 396 $this->_request_data['root_topic'] =& $this->_root_topic; 311 397 312 398 return true; … … 318 404 function _get_template_structures_filesystem() 319 405 { 320 $dir = MIDCOM_ROOT . "/midgard/admin/sitewizard/config/ ";406 $dir = MIDCOM_ROOT . "/midgard/admin/sitewizard/config/templates/"; 321 407 $structures_array = array(); 322 408 … … 324 410 if ($dh = opendir($dir)) { 325 411 while (($file = readdir($dh)) !== false) { 326 if (ereg("structure_template_", $file)) 327 { 328 $path = $dir . $file; 329 eval('$evaluated = array(' . file_get_contents($path) . ');'); 412 $path = $dir . $file; 413 eval('$evaluated = array(' . file_get_contents($path) . ');'); 330 414 331 $keys = array_keys($evaluated); 332 if (count($keys) != 0) 333 { 334 if (array_key_exists('title', $evaluated[$keys[0]]) && array_key_exists('description', $evaluated[$keys[0]])) 335 { 336 $structures_array = array_merge($structures_array, $evaluated); 337 } 338 } 339 } 415 $keys = array_keys($evaluated); 416 if (count($keys) != 0) 417 { 418 if (array_key_exists('title', $evaluated[$keys[0]]) && array_key_exists('description', $evaluated[$keys[0]])) 419 { 420 $structures_array = array_merge($structures_array, $evaluated); 421 } 422 } 340 423 } 341 424 closedir($dh); … … 353 436 $qb = midcom_baseclasses_database_snippet::new_query_builder(); 354 437 $qb->add_constraint('sitegroup', '=', 0); 355 $qb->add_constraint(' name', 'LIKE', 'structure_template_%');438 $qb->add_constraint('up.name', '=', 'templates'); 356 439 357 440 $structures_obj_array = $qb->execute(); … … 372 455 } 373 456 return $structures_array; 374 } 375 376 /** 377 * Creates the template structure 378 */ 379 function _create_structure($host_settings, $runner) 380 { 381 $created_groups = array(); 382 $structures_array = array_merge($this->_get_template_structures_filesystem(), $this->_get_template_structures_snippet()); 383 $structure = $structures_array[$host_settings['structure_template']]; 384 385 $root_topic_guid = $runner->topic->guid; 386 $root_topic_id = $runner->topic->id; 387 $sitegroup = $runner->config->sitegroup_id; 388 389 // Lets find out admin group id 390 $qb = midcom_db_group::new_query_builder(); 391 $qb->add_constraint('sitegroup', '=', $sitegroup); 392 $qb->add_constraint('owner', '=', 0); 393 $admin_group = $qb->execute(); 394 395 $admin_group = $admin_group[0]; 396 397 // And the same thing with admin user 398 $qb = midcom_db_member::new_query_builder(); 399 $qb->add_constraint('sitegroup', '=', $sitegroup); 400 $qb->add_constraint('gid', '=', $admin_group->id); 401 $admin_user = $qb->execute(); 402 403 $admin_user = $admin_user[0]; 404 405 echo "<pre>"; 406 //print_r($admin_user); 407 //print_r($admin_group); 408 echo "</pre>"; 409 410 411 // OK, that should be all we need to create topics and groups 412 413 // Creating groups 414 foreach($structure['groups'] as $group_name) 415 { 416 $newgroup = new midcom_db_group(); 417 $newgroup->name = sprintf($group_name); 418 $newgroup->owner = $admin_group->id; 419 $newgroup->sitegroup = $sitegroup; 420 421 if (!$newgroup->create()) 422 { 423 echo "Error"; 424 425 // TODO: handle error 426 } 427 else 428 { 429 $created_groups[$newgroup->name] = $newgroup->guid; 430 } 431 } 432 457 } 458 459 function _create_topics_recursive($nodes, $created_groups, $sitegroup, $root_topic_id, $admin_group) 460 { 433 461 // Creating topics 434 foreach($structure['nodes']as $node)462 foreach ($nodes as $node) 435 463 { 436 464 $newtopic = new midcom_db_topic(); … … 454 482 if (!$newtopic->component = $node['component']) 455 483 { 456 echo "Setting param";457 484 $newtopic->parameter('midcom', 'component', $node['component']); 458 485 } 459 486 else 460 487 { 461 echo "Setting done";462 488 $newtopic->update(); 463 489 } … … 482 508 foreach($node['acl'] as $group_name => $privilege) 483 509 { 484 485 510 foreach($privilege as $name => $value) 486 511 { … … 490 515 } 491 516 } 517 } 518 } 519 520 if (isset($node['nodes'])) 521 { 522 $this->_create_topics_recursive($node['nodes'], $created_groups, $sitegroup, $root_topic_id, $admin_group); 523 } 524 } 525 } 526 527 528 /** 529 * Creates the template structure 530 */ 531 function _create_structure($host_settings, $runner) 532 { 533 $created_groups = array(); 534 $structures_array = array_merge($this->_get_template_structures_filesystem(), $this->_get_template_structures_snippet()); 535 $structure = $structures_array[$host_settings['structure_template']]; 536 537 $root_topic_guid = $runner->topic->guid; 538 $root_topic_id = $runner->topic->id; 539 $sitegroup = $runner->config->sitegroup_id; 540 541 $session = new midcom_service_session(); 542 if (!$session->exists("midgard_admin_sitewizard_{$this->_request_data['sitegroup']->id}")) 543 { 544 // Relocate user back to host settings 545 $_MIDCOM->relocate("{$prefix}host/{$this->_request_data['sitegroup']->id}/"); 546 // This will exit 547 } 548 549 $host_settings = $session->get("midgard_admin_sitewizard_{$this->_request_data['sitegroup']->id}"); 550 $host_settings['root_topic_guid'] = $root_topic_guid; 551 $session->set("midgard_admin_sitewizard_{$this->_request_data['sitegroup']->id}", $host_settings); 552 553 // Updating root topic 554 $root_topic = new midcom_db_topic(); 555 $root_topic->get_by_guid($root_topic_guid); 556 557 // Setting component here 558 if (isset($structure['root']['component'])) 559 { 560 if (!$root_topic->component = $structure['root']['component']) 561 { 562 $newtopic->parameter('midcom', 'component', $structure['root']['component']); 563 } 564 } 565 566 // Setting additional parameters here 567 if (isset($structure['root']['parameters']) && count($structure['root']['parameters']) != 0) 568 { 569 foreach($structure['root']['parameters'] as $domain => $parameter) 570 { 571 foreach($parameter as $name => $value) 572 { 573 $root_topic->parameter($domain, $name, $value); 574 } 575 } 576 } 577 578 // TODO: str_replaces 579 580 581 // Lets find out admin group id 582 $qb = midcom_db_group::new_query_builder(); 583 $qb->add_constraint('sitegroup', '=', $sitegroup); 584 $qb->add_constraint('owner', '=', 0); 585 $admin_group = $qb->execute(); 586 587 $admin_group = $admin_group[0]; 588 589 // And the same thing with admin user 590 $qb = midcom_db_member::new_query_builder(); 591 $qb->add_constraint('sitegroup', '=', $sitegroup); 592 $qb->add_constraint('gid', '=', $admin_group->id); 593 $admin_user = $qb->execute(); 594 595 $admin_user = $admin_user[0]; 596 597 echo "<pre>"; 598 //print_r($admin_user); 599 //print_r($admin_group); 600 echo "</pre>"; 601 602 // OK, that should be all we need to create topics and groups 603 // Creating groups 604 foreach($structure['groups'] as $group_name) 605 { 606 // TODO: maybe check if a group by the name of $group_name exists and use that 607 608 $newgroup = new midcom_db_group(); 609 $newgroup->name = sprintf($group_name); 610 $newgroup->owner = $admin_group->id; 611 $newgroup->sitegroup = $sitegroup; 612 613 if (!$newgroup->create()) 614 { 615 echo "Error"; 616 617 // TODO: handle error 618 } 619 else 620 { 621 $created_groups[$newgroup->name] = $newgroup->guid; 622 } 623 } 624 625 // Ok, it's time to set up root topic ACL privileges 626 if (isset($structure['root']['acl']) && count($structure['root']['acl']) != 0) 627 { 628 foreach($structure['root']['acl'] as $group_name => $privilege) 629 { 630 foreach($privilege as $name => $value) 631 { 632 if (array_key_exists($group_name, $created_groups)) 633 { 634 $root_topic->set_privilege($name, "group:{$created_groups[$group_name]}", $value); 635 } 492 636 } 493 } 637 } 638 } 639 640 if (!$root_topic->update()) 641 { 642 // TODO: handle error 494 643 } 644 645 // Creating topics 646 if (isset($structure['root']['nodes'])) 647 { 648 $this->_create_topics_recursive($structure['root']['nodes'], $created_groups, $sitegroup, $root_topic_id, $admin_group); 649 } 495 650 } 496 651 … … 511 666 { 512 667 midcom_show_style('show-wizard-header'); 513 514 // Check if advanced style should be shown 515 switch($this->_config->get('mode')) 516 { 517 case 'simple': 518 midcom_show_style('wizard-select-style'); 519 break; 520 case 'advanced': 521 midcom_show_style('wizard-select-structure'); 522 break; 523 default: 524 midcom_show_style('wizard-select-style'); 525 break; 526 } 527 668 midcom_show_style('wizard-select-style'); 528 669 midcom_show_style('show-wizard-footer'); 529 670 } … … 596 737 if (array_key_exists('structure_template', $host_settings)) 597 738 { 598 $this->_create_structure($host_settings, $runner);739 $this->_create_structure($host_settings, $runner); 599 740 } 600 741 branches/MidCOM_2_8/midgard.admin.sitewizard/locale/default.en.txt
r11125 r11345 3 3 ---CVS $Id$ 4 4 ---LANGUAGE en 5 6 ---STRING show all info 7 Show all info 8 ---STRINGEND 9 10 ---STRING whois 11 Whois 12 ---STRINGEND 5 13 6 14 ---STRING template structures branches/MidCOM_2_8/midgard.admin.sitewizard/locale/default.fi.txt
r3621 r11345 3 3 ---CVS $Id$ 4 4 ---LANGUAGE fi 5 6 7 ---STRING show all info 8 Nayta kaikki tiedot 9 ---STRINGEND 10 11 ---STRING whois 12 Whois (domainkysely) 13 ---STRINGEND 5 14 6 15 ---STRING advanced options branches/MidCOM_2_8/midgard.admin.sitewizard/static/sitewizard.css
r11125 r11345 81 81 #midgard_admin_sitewizard fieldset.style div.structure_wrapper { 82 82 float: left; 83 width: 20%;83 //width: 30%; 84 84 margin: 20px; 85 85 } branches/MidCOM_2_8/midgard.admin.sitewizard/style/wizard-create-host.php
r11042 r11345 2 2 //$data =& $_MIDCOM->get_custom_context_data('request_data'); 3 3 $view_form_prefix = 'midgard_admin_sitewizard_'; 4 5 include(MIDCOM_ROOT . "/midgard/admin/sitewizard/whois_class.php"); 6 include(MIDCOM_ROOT . "/midgard/admin/sitewizard/server_list.php"); 7 8 $my_whois = new Whois_domain; 9 $my_whois->possible_tlds = array_keys($servers); // this is the array from the included server list 10 11 if (isset($_POST['submit'])) { 12 $my_whois->tld = $_POST['tld']; 13 $my_whois->domain = $_POST['domain']; 14 $my_whois->free_string = $servers[$_POST['tld']]['free']; 15 $my_whois->whois_server = $servers[$_POST['tld']]['address']; 16 $my_whois->whois_param = $servers[$_POST['tld']]['param']; 17 $my_whois->full_info = (isset($_POST['all_info'])) ? $_POST['all_info'] : "no"; // between "no" and "yes" to get all whois information 18 $my_whois->process(); 19 } 20 4 21 ?> 5 22 <script type="text/javascript"> … … 24 41 </script> 25 42 26 <!-- 27 <fieldset> 43 <div style="position: absolute; background-color: white; top: 180px; right: 20px; width: 400px;"> 44 <fieldset> 28 45 <div class="explanation"> 29 46 <?php $data['l10n']->get("dns whois lookup"); ?> 30 47 </div> 31 <label for="&(view_form_prefix);site_name"><?php echo $data['l10n']->get(" Whois"); ?></label>48 <label for="&(view_form_prefix);site_name"><?php echo $data['l10n']->get("whois"); ?></label> 32 49 33 <input type="text"/> 50 <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post" name="form"> 51 <input type="text" name="domain" size="14" maxlength="63" value="<?php echo (isset($_POST['domain'])) ? $_POST['domain'] : ""; ?>"> 52 <?php echo $my_whois->create_tld_select(); // this method generates the select menu woth all tld's ?> 53 54 <input name="submit" type="submit" value="Whois"> 55 <br/> 56 <?php echo $data['l10n']->get("show all info") . "?"; ?> 57 <input name="all_info" type="checkbox" value="yes"> 58 </form> 59 <br/> 60 <p><?php echo ($my_whois->msg != "") ? $my_whois->msg : ""; ?></p> 61 62 <!-- this will show up all info from the whois server --> 63 64 <?php if ($my_whois->info != "") { ?> 65 <h2><?php echo "Whois ".$my_whois->compl_domain."?" ?></h2> 66 <blockquote> 67 68 <?php echo nl2br($my_whois->info); ?> 69 70 </blockquote> 71 <?php } ?> 72 34 73 </fieldset> 35 --> 36 74 </div> 37 75 <form method="post" name="&(view_form_prefix);sitegroup_select" action="&(_MIDGARD['uri']);"> 38 76 … … 57 95 58 96 <label for="&(view_form_prefix);host_component"><?php echo $data['l10n']->get("host template"); ?></label> 97 98 <?php 99 if (!$data['config']->get('mode') == 'advanced') 100 { 101 ?> 102 59 103 <select name="&(view_form_prefix);host_component" id="&(view_form_prefix);host_component" disabled="disabled"> 60 104 <?php … … 70 114 ?> 71 115 </select> 116 117 <?php 118 } 119 ?> 72 120 </fieldset> 73 74 <input type="submit" name="&(view_form_prefix);process" class="&(view_form_prefix);next" value="<?php echo $data['l10n_midcom']->get("next"); ?> »" /> 121 122 <input type="submit" name="&(view_form_prefix);process" class="&(view_form_prefix);next" value=" 123 <?php echo $data['l10n_midcom']->get("next"); ?> »" /> 124 75 125 </form> branches/MidCOM_2_8/midgard.admin.sitewizard/style/wizard-select-structure.php
r11125 r11345 2 2 //$data =& $_MIDCOM->get_custom_context_data('request_data'); 3 3 $view_form_prefix = 'midgard_admin_sitewizard_'; 4 ?>5 <form method="post" name="&(view_form_prefix);sitegroup_select" action="<?php echo $_MIDGARD['uri']; ?>">6 <fieldset class="style">7 <img src="<?php echo MIDCOM_STATIC_URL; ?>/midgard.admin.sitewizard/no-style-preview.jpg" width="130" alt="Custom" />8 <label for="&(view_form_prefix);select_template_custom" class="action_select">9 <input type="radio" checked="checked" name="&(view_form_prefix);select_template" value="custom"10 id="&(view_form_prefix);select_template_custom" /><?php echo $data['l10n']->get('custom'); ?></label>11 <div class="description"><?php echo $data['l10n']->get('completely empty style'); ?></div>12 </fieldset>13 4 14 <?php 15 foreach ($data['templates'] as $template) 16 { 17 if ($template->parameter('midgard.admin.sitewizard', 'template_type') == "advanced") 18 { 19 $customizable = "Customizable"; 20 } 21 else 22 { 23 $customizable = "Not customizable"; 24 } 5 function sitewizard_show_nodes($structure) 6 { 7 echo "<ul>"; 8 if (isset($structure['root'])) 9 { 10 echo "<li>" . $structure['root']['title'] . "</li>"; 11 if (isset($structure['root']['nodes'])) 12 { 13 echo "<ul>"; 14 foreach($structure['root']['nodes'] as $node) 15 { 16 echo "<li>" . $node['title'] . "</li>"; 17 sitewizard_show_nodes($node); 18 } 19 echo "</ul>"; 20 } 21 } 22 elseif (isset($structure['nodes'])) 23 { 24 foreach($structure['nodes'] as $node) 25 { 26 echo "<li>" . $node['title'] . "</li>"; 27 } 28 } 29 echo "</ul>"; 30 } 25 31 26 // Clean up the template display name27 $template_name = str_replace("template_","",$template->name);28 29 // template metadata30 // TODO: Get from PEAR31 $template_description = $template->parameter('midgard.admin.sitewizard', 'template_description');32 $template_credits = $template->parameter('midgard.admin.sitewizard', 'template_credits');33 34 // template preview thumbnail35 $template_image = $template->getattachment('__preview.jpg');36 if ($template_image)37 {38 $template_image_url = "{$_MIDGARD['self']}midcom-serveattachmentguid-{$template_image->guid}/{$template_image->name}";39 }40 else41 {42 $template_image_url = MIDCOM_STATIC_URL."/midgard.admin.sitewizard/no-style-preview.jpg";43 }44 ?>45 <fieldset class="style">46 <img src="&(template_image_url);" width="130" alt="&(template_name);" />47 <label for="&(view_form_prefix);select_template_&(template.id);" class="action_select">48 <input type="radio" name="&(view_form_prefix);select_template" value="&(template.name);"49 id="&(view_form_prefix);select_template_&(template.id);" />&(template_name); (&(customizable);)</label>50 <div class="credits">&(template_credits);</div>51 <div class="description">&(template_description);</div>52 </fieldset>53 <?php54 }55 32 ?> 56 33 <br/><br/> 57 34 <h2><?php echo $data['l10n']->get('template structures'); ?></h2> 58 35 <form method="post" name="&(view_form_prefix);sitegroup_select" action="<?php echo $_MIDGARD['uri']; ?>"> 59 36 <fieldset class="style"> 60 37 <label for="&(view_form_prefix);select_structure_template_custom" class="action_select"> … … 98 75 <legend>Folders</legend> 99 76 <?php 100 foreach ($structure['nodes'] as $node) 101 { 102 echo "-" . $node['title'] . "<br/>"; 103 } 77 78 sitewizard_show_nodes($structure); 79 104 80 echo "<pre>"; 105 81 //print_r($structure); 106 82 echo "</pre>"; 107 83 ?> 84 </fieldset> 85 </div> 86 <div class="structure_wrapper"> 87 <fieldset class="structure"> 88 <legend>Examples</legend> 89 <?php 90 91 if (isset($structure['examples'])) 92 { 93 foreach($structure['examples'] as $url => $example) 94 { 95 echo "<a href=\"{$url}\" target=\"_blank\">{$example}</a><br/>"; 96 } 97 } 98 99 ?> 108 100 </fieldset> 109 101 </div> branches/MidCOM_2_8/midgard.admin.sitewizard/style/wizard-select-style.php
r5048 r11345 15 15 foreach ($data['templates'] as $template) 16 16 { 17 $qb = midcom_db_element::new_query_builder(); 18 $qb->add_constraint('sitegroup', '=', 0); 19 $qb->add_constraint('style', '=', $template->id); 20 $qb->add_constraint('name', '=', '__schemadb'); 21 22 $schema = $qb->execute(); 23 24 if (count($schema) > 0) 25 { 26 $customizable = "Customizable"; 27 } 28 else 29 { 30 $customizable = "Not customizable"; 31 } 32 33 // Clean up the template display name 34 $template_name = $template->name; // str_replace("template_","",$template->name); 35 36 // template metadata 37 // TODO: Get from PEAR 38 $template_description = $template->parameter('midgard.admin.sitewizard', 'template_description'); 39 $template_credits = $template->parameter('midgard.admin.sitewizard', 'template_credits'); 17 40 // Clean up the template display name 18 41 $template_name = str_replace("template_","",$template->name); … … 38 61 <label for="&(view_form_prefix);select_template_&(template.id);" class="action_select"> 39 62 <input type="radio" name="&(view_form_prefix);select_template" value="&(template.name);" 40 id="&(view_form_prefix);select_template_&(template.id);" />&(template_name); </label>63 id="&(view_form_prefix);select_template_&(template.id);" />&(template_name); (&(customizable);)</label> 41 64 <div class="credits">&(template_credits);</div> 42 65 <div class="description">&(template_description);</div>
