Changeset 11627

Show
Ignore:
Timestamp:
08/17/07 14:47:26 (1 year ago)
Author:
juhana
Message:

Implemented preview and added 4 style template images

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/MidCOM_2_8/midgard.admin.sitewizard/handler/host.php

    r11367 r11627  
    191191    } 
    192192 
     193    function _is_customizable($style) 
     194    { 
     195        $qb = midcom_db_element::new_query_builder(); 
     196        $qb->add_constraint('sitegroup', '=', 0); 
     197        $qb->add_constraint('style', '=', $style->id); 
     198        $qb->add_constraint('name', '=', '__schemadb'); 
     199 
     200        $schema = $qb->execute(); 
     201 
     202        if (count($schema) > 0) 
     203        { 
     204            return $schema[0]; 
     205        } 
     206        else 
     207        { 
     208            return false; 
     209        } 
     210    } 
     211 
    193212    /** 
    194213     * Selects a template 
     
    245264                    $session->set("midgard_admin_sitewizard_{$this->_request_data['sitegroup']->id}", $host_settings); 
    246265 
    247                     $qb = midcom_db_element::new_query_builder(); 
    248                     $qb->add_constraint('sitegroup', '=', 0); 
    249                     $qb->add_constraint('style', '=', $template_style_obj[0]->id); 
    250                     $qb->add_constraint('name', '=', '__schemadb'); 
    251  
    252                     $schema = $qb->execute(); 
    253  
    254                     if (count($schema) > 0) 
     266                    $schema = $this->_is_customizable($template_style_obj[0]); 
     267 
     268                    if ($schema) 
    255269                    { 
    256270                        $host_settings['template_type'] = "advanced"; 
    257                         $host_settings['template_schemadb'] = $schema[0]
     271                        $host_settings['template_schemadb'] = $schema
    258272                    } 
    259273                    else 
     
    279293        $qb->add_constraint('up', '=', 0); 
    280294        // TODO: Check for sitegroups? 
    281         $this->_request_data['templates'] = $qb->execute(); 
     295        $templates = $qb->execute(); 
     296 
     297        foreach($templates as $template) 
     298        { 
     299            if ($this->_is_customizable($template) && $this->_config->get('mode') == 'simple') 
     300            { 
     301                continue; 
     302            } 
     303 
     304            $this->_request_data['templates'][] = $template; 
     305        } 
    282306 
    283307        return true; 
     
    396420                // The document has been saved, relocate the user 
    397421                debug_pop(); 
    398                 $_MIDCOM->relocate("{$prefix}finish/{$this->_host->id}/"); 
     422                //$_MIDCOM->relocate("{$prefix}finish/{$this->_host->id}/"); 
    399423                // This will exit 
    400424                break; 
     
    402426                // User has cancelled without saving 
    403427                debug_pop(); 
    404                 $_MIDCOM->relocate("{$prefix}finish/{$this->_host->id}/"); 
     428                //$_MIDCOM->relocate("{$prefix}finish/{$this->_host->id}/"); 
    405429                // This will exit 
    406430                break; 
     
    412436        } 
    413437 
     438        if (array_key_exists('midgard_admin_sitewizard_process', $_POST)) 
     439        { 
     440             $_MIDCOM->relocate("{$prefix}finish/{$this->_host->id}/"); 
     441        } 
     442 
     443        $this->_request_data['host'] =& $this->_host; 
    414444        $this->_request_data['controller'] =& $this->_controller; 
    415445 
  • branches/MidCOM_2_8/midgard.admin.sitewizard/style/wizard-create-host.php

    r11351 r11627  
    9595     
    9696    <?php 
    97     if (!$data['config']->get('mode') == 'advanced') 
     97    if ($data['config']->get('mode') != 'advanced') 
    9898    { 
    9999    ?> 
  • branches/MidCOM_2_8/midgard.admin.sitewizard/style/wizard-select-style.php

    r11345 r11627  
    4747     
    4848    // template preview thumbnail 
    49     $template_image = $template->getattachment('__preview.jpg'); 
     49    $template_image = $template->getattachment('__preview.png'); 
    5050    if ($template_image) 
    5151    { 
     
    5454    else 
    5555    { 
    56         $template_image_url = MIDCOM_STATIC_URL."/midgard.admin.sitewizard/no-style-preview.jpg"; 
     56        //$template_image_url = MIDCOM_STATIC_URL."/midgard.admin.sitewizard/no-style-preview.jpg"; 
    5757    } 
     58 
     59    $template_image_url = MIDCOM_STATIC_URL."/midgard.admin.sitewizard/{$template_name}.png"; 
     60 
    5861    ?> 
    5962    <fieldset class="style">