- Timestamp:
- 09/03/08 03:13:42 (4 months ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
plugins/plugin_directory/trunk/plugin_directory.plugin.php
r816 r882 74 74 75 75 // put together our rule 76 $rule['name'] = ' repo_browser';76 $rule['name'] = 'display_plugin'; 77 77 $rule['parse_regex'] = '%^packages/browse(?:page/(?P<page>[2-9]|[1-9][0-9]+))?/?$%'; 78 78 $rule['build_str'] = 'packages/browse'; … … 174 174 175 175 $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' )); 177 177 $version->template = 'tabcontrol_text'; 178 178 $description = $plugin_versions->append('text', 'plugin_version_description', 'null:null', _t( 'Version Description' )); … … 183 183 $habari_version->template = 'tabcontrol_text'; 184 184 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 ); 188 191 189 192 //$requires = $plugin_versions->append('text', 'plugin_version[requires]', 'null:null', _t( 'Requires' )); … … 204 207 } 205 208 } 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 ); 219 211 } 220 212 } … … 223 215 * @todo check for required inputs 224 216 */ 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 ) { 231 220 $version_vals = array(); 232 221 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 237 234 DB::update( 238 235 DB::table( 'plugin_versions' ), … … 240 237 array( 'version' => $version_vals['version'], 'post_id' => $post->id ) 241 238 ); 239 240 Session::notice( 'Added version number ' . $version_vals['version'] ); 242 241 } 243 242 }
