Show
Ignore:
Timestamp:
09/03/08 03:13:42 (4 months ago)
Author:
MattRead
Message:

plugin:plugin_directory random updates

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • plugins/plugin_directory/trunk/plugin_directory.plugin.php

    r816 r882  
    7474 
    7575        // put together our rule 
    76         $rule['name'] = 'repo_browser'; 
     76        $rule['name'] = 'display_plugin'; 
    7777        $rule['parse_regex'] = '%^packages/browse(?:page/(?P<page>[2-9]|[1-9][0-9]+))?/?$%'; 
    7878        $rule['build_str'] = 'packages/browse'; 
     
    174174 
    175175            $form->plugin_versions->append('static', 'new_version', 'Add New Version'); 
    176             $version = $plugin_versions->append('text', 'plugin_version_number', 'null:null', _t( 'Version Number' )); 
     176            $version = $plugin_versions->append('text', 'plugin_version_version', 'null:null', _t( 'Version Number' )); 
    177177            $version->template = 'tabcontrol_text'; 
    178178            $description = $plugin_versions->append('text', 'plugin_version_description', 'null:null', _t( 'Version Description' )); 
     
    183183            $habari_version->template = 'tabcontrol_text'; 
    184184 
    185             //$plugin_versions->append( 'radio', 'status', 'null:null', _t( 'Critical' ) ); 
    186             //$plugin_versions->append( 'radio', 'status', 'null:null', _t( 'Bugfix' ) ); 
    187             //$plugin_versions->append( 'radio', 'status', 'null:null', _t( 'Feature' ) ); 
     185            $status = $plugin_versions->append( 'radio', 'plugin_version_status', 'null:null'); 
     186            $status->options = array( 
     187                'critical' => 'Critical', 
     188                'bugfix' => 'Bugfix', 
     189                'feature' => 'Feature', 
     190                ); 
    188191 
    189192            //$requires = $plugin_versions->append('text', 'plugin_version[requires]', 'null:null', _t( 'Requires' )); 
     
    204207                } 
    205208            } 
    206  
    207             // Check if new version information has been uploaded 
    208             if ( $form->{"plugin_version_number"}->value ) { 
    209                 foreach ( $this->version_fields as $version_field ) { 
    210                     // todo Do something sensible with the new version information 
    211                     //if ( $form->{"plugin_version_$version_field"}->value ) { 
    212                     //  $post->info->{$version_field} = $form->{"plugin_details_$version_field"}->value; 
    213                     //} 
    214                 } 
    215                 Session::notice( 'Added version number ' . $form->{"plugin_version_number"}->value ); 
    216             } 
    217  
    218             //$this->save_versions( $post, $form ); 
     209             
     210            $this->save_versions( $post, $form ); 
    219211        } 
    220212    } 
     
    223215        * @todo check for required inputs 
    224216        */ 
    225     public function save_versions( $post ) 
    226     { 
    227         $plugin_version = Controller::get_var( 'plugin_version' ); 
    228         if ( !empty( $plugin_version['version'] ) ) { 
    229             $plugin_version['post_id'] = $post->id; 
    230             $plugin_version['md5'] = $this->get_version_md5( $plugin_version['url'] ); 
     217    public function save_versions( $post, $form ) 
     218    { 
     219        if ( $form->plugin_version_version->value ) { 
    231220            $version_vals = array(); 
    232221            foreach ( $this->version_fields as $version_field ) { 
    233                 $version_vals[$version_field] = $plugin_version[$version_field]; 
    234             } 
    235             Session::notice( 'we made it!' ); 
    236  
     222                if ( $form->{"plugin_version_$version_field"} ) { 
     223                    $version_vals[$version_field] = $form->{"plugin_version_$version_field"}->value; 
     224                    Utils::debug($form->{"plugin_version_$version_field"}->value); 
     225                } 
     226                else { 
     227                    $version_vals[$version_field] = ''; 
     228                } 
     229                Utils::debug($version_field ); 
     230            } 
     231            $version_vals['post_id'] = $post->id; 
     232            $version_vals['md5'] = $this->get_version_md5( $version_vals['url'] ); 
     233             
    237234            DB::update( 
    238235                DB::table( 'plugin_versions' ), 
     
    240237                array( 'version' => $version_vals['version'], 'post_id' => $post->id ) 
    241238            ); 
     239             
     240            Session::notice( 'Added version number ' . $version_vals['version'] ); 
    242241        } 
    243242    }