Changeset 12604

Show
Ignore:
Timestamp:
09/30/07 16:56:06 (1 year ago)
Author:
bergie
Message:

Fix uploading of both video and thumbnail on same submit

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/midcom/midcom.helper.datamanager2/formmanager.php

    r11955 r12604  
    209209        $this->namespace = "{$name}_"; 
    210210 
    211         $this->form = new HTML_QuickForm($name, 'post', '', '_self', Array('id' => $name), true); 
     211        $this->form = new HTML_QuickForm($name, 'post', $_SERVER['REQUEST_URI'], '_self', Array('id' => $name), true); 
    212212        $defaults = Array(); 
    213213        $this->widgets = Array(); 
  • trunk/midcom/midcom.helper.datamanager2/widget/video.php

    r11749 r12604  
    210210            'id'    => "{$this->_namespace}{$this->name}_upload_button", 
    211211        ); 
    212         $elements[] =& HTML_QuickForm::createElement('submit', "{$this->name}_upload", $this->_l10n->get('upload file'), $attributes); 
     212        //$elements[] =& HTML_QuickForm::createElement('submit', "{$this->name}_upload", $this->_l10n->get('upload file'), $attributes); 
    213213 
    214214        // Add Title line if configured to do so 
     
    355355            'id'    => "{$this->_namespace}{$this->name}_upload_button", 
    356356        ); 
    357         $elements[] =& HTML_QuickForm::createElement('submit', "{$this->name}_upload", $this->_l10n->get('upload file'), $attributes); 
     357        //$elements[] =& HTML_QuickForm::createElement('submit', "{$this->name}_upload", $this->_l10n->get('upload file'), $attributes); 
    358358 
    359359        // Add Title line if configured to do so. 
     
    403403            'id'    => "{$this->_namespace}{$this->name}_upload_button_video", 
    404404        ); 
    405         $elements[] =& HTML_QuickForm::createElement('submit', "{$this->name}_upload_video", $this->_l10n->get('upload file'), $attributes); 
     405        //$elements[] =& HTML_QuickForm::createElement('submit', "{$this->name}_upload_video", $this->_l10n->get('upload file'), $attributes); 
    406406         
    407407        $static_html = "</td></tr>\n"; 
     
    454454            'id'    => "{$this->_namespace}{$this->name}_upload_button_video", 
    455455        ); 
    456         $elements[] =& HTML_QuickForm::createElement('submit', "{$this->name}_upload_video", $this->_l10n->get('upload file'), $attributes); 
     456        //$elements[] =& HTML_QuickForm::createElement('submit', "{$this->name}_upload_video", $this->_l10n->get('upload file'), $attributes); 
    457457         
    458458        $static_html = "</td></tr>"; 
     
    570570            } 
    571571 
    572         }        
    573         elseif ($this->_upload_element_video->isUploadedFile()) 
    574       { 
    575  
    576             $file_video = $this->_upload_element_video->getValue(); 
    577  
    578 echo "<pre>"
    579 //print_r($this->_upload_element_video); 
    580 //print_r($this->_upload_element)
    581 echo "</pre>"
    582  
    583             if (!empty($file_video['name'])) 
    584             { 
    585                 if (! $this->_type->set_video($file_video['name'], $file_video['tmp_name'], 'Video file')) 
     572        }    
     573        else 
     574      { 
     575            if ($this->_upload_element_video->isUploadedFile()) 
     576            { 
     577     
     578                $file_video = $this->_upload_element_video->getValue()
     579     
     580                //echo "<pre>"
     581                //print_r($this->_upload_element_video)
     582                //print_r($this->_upload_element); 
     583                //echo "</pre>"; 
     584     
     585                if (!empty($file_video['name'])) 
    586586                { 
    587                     debug_push_class(__CLASS__, __FUNCTION__); 
    588                     debug_add("Failed to process image {$this->name}.", MIDCOM_LOG_INFO); 
    589                     debug_pop(); 
    590                     $this->_cast_formgroup_to_upload_video(); 
     587                    if (! $this->_type->set_video($file_video['name'], $file_video['tmp_name'], 'Video file')) 
     588                    { 
     589                        debug_push_class(__CLASS__, __FUNCTION__); 
     590                        debug_add("Failed to process image {$this->name}.", MIDCOM_LOG_INFO); 
     591                        debug_pop(); 
     592                        $this->_cast_formgroup_to_upload_video(); 
     593                    } 
     594                    else 
     595                    { 
     596                        $this->_cast_formgroup_to_replacedelete_video(); 
     597                    } 
    591598                } 
    592                 else 
    593                 { 
    594                     $this->_cast_formgroup_to_replacedelete_video(); 
    595                 } 
    596             } 
    597  
    598         } 
    599         elseif ($this->_upload_element->isUploadedFile()) 
    600         { 
    601             $file = $this->_upload_element->getValue(); 
    602              
    603 echo "<pre>"; 
    604 //print_r($this->_upload_element_video); 
    605 //print_r($this->_upload_element); 
    606 echo "</pre>"; 
    607  
    608  
    609             if ($this->show_title) 
    610             { 
    611                 $title = $results["{$this->name}_title"]; 
    612             } 
    613             else 
    614             { 
    615                 $title = ''; 
    616599            } 
    617600             
    618             if (!empty($file['name'])) 
    619             { 
    620                 if (! $this->_type->set_image($file['name'], $file['tmp_name'], $title)) 
     601            if ($this->_upload_element->isUploadedFile()) 
     602            { 
     603                $file = $this->_upload_element->getValue(); 
     604             
     605                //echo "<pre>"; 
     606                //print_r($this->_upload_element_video); 
     607                //print_r($this->_upload_element); 
     608                //echo "</pre>"; 
     609     
     610                if ($this->show_title) 
    621611                { 
    622                     debug_push_class(__CLASS__, __FUNCTION__); 
    623                     debug_add("Failed to process image {$this->name}.", MIDCOM_LOG_INFO); 
    624                     debug_pop(); 
    625                     $this->_cast_formgroup_to_upload(); 
     612                    $title = $results["{$this->name}_title"]; 
    626613                } 
    627614                else 
    628615                { 
    629                     $this->_cast_formgroup_to_replacedelete()
     616                    $title = ''
    630617                } 
    631             } 
     618                 
     619                if (!empty($file['name'])) 
     620                { 
     621                    if (! $this->_type->set_image($file['name'], $file['tmp_name'], $title)) 
     622                    { 
     623                        debug_push_class(__CLASS__, __FUNCTION__); 
     624                        debug_add("Failed to process image {$this->name}.", MIDCOM_LOG_INFO); 
     625                        debug_pop(); 
     626                        $this->_cast_formgroup_to_upload(); 
     627                    } 
     628                    else 
     629                    { 
     630                        $this->_cast_formgroup_to_replacedelete(); 
     631                    } 
     632                } 
     633            } 
    632634        } 
    633635    }