Ejemplo n.º 1
0
 public function delete_index_type()
 {
     $field = $this->_get_field();
     if ($field->is_indexable() or $field->index_type === NULL) {
         $old_field = clone $field;
         $field->set_index(NULL);
         DataSource_Hybrid_Field_Factory::update_field($old_field, $field);
         DataSource_Hybrid_Field_Factory::alter_table_field_drop_index($field);
         $this->message('Index field ":field" dropped', array(':field' => $field->header));
     } else {
         throw HTTP_API_Exception::factory(API::ERROR_UNKNOWN, 'Field cannot be indexed');
     }
 }
Ejemplo n.º 2
0
 private function _edit($field)
 {
     try {
         $field->set($this->request->post());
         DataSource_Hybrid_Field_Factory::update_field(clone $field, $field);
     } catch (Validation_Exception $e) {
         Session::instance()->set('post_data', $this->request->post());
         Messages::errors($e->errors('validation'));
         $this->go_back();
     } catch (Kohana_Exception $e) {
         Messages::errors($e->getMessage());
         $this->go_back();
     }
     Session::instance()->delete('post_data');
     // save and quit or save and continue editing?
     if ($this->request->post('commit') !== NULL) {
         $this->go(Route::get('datasources')->uri(array('directory' => 'datasources', 'controller' => 'section', 'action' => 'edit', 'id' => $field->ds_id)));
     } else {
         $this->go_back();
     }
 }