/**
  * Test for PMA_getHtmlForInsertEditRow based on the column privilges
  *
  * @return void
  */
 public function testGetHtmlForInsertEditRowBasedOnColumnPrivileges()
 {
     $o_rows = 0;
     $tabindex = 0;
     $GLOBALS['plugin_scripts'] = array();
     $GLOBALS['cfg']['LongtextDoubleTextarea'] = true;
     $GLOBALS['cfg']['CharEditing'] = true;
     // edit
     $table_columns = array(array('Field' => 'foo', 'Type' => 'longtext', 'Null' => 'Yes', 'pma_type' => 'longtext', 'True_Type' => 'longtext', 'Privileges' => 'select,insert,update,references'), array('Field' => 'bar', 'Type' => 'longtext', 'Null' => 'Yes', 'pma_type' => 'longtext', 'True_Type' => 'longtext', 'Privileges' => 'select,insert,references'));
     $actual = PMA_getHtmlForInsertEditRow(array(), $table_columns, array(), false, array(), '', '', '', false, array(), $o_rows, $tabindex, 1, false, 0, array(), 0, 0, 'table', 'db', 0, array(), 0, '', array(), array('wc'));
     $this->assertContains('foo', $actual);
     $this->assertNotContains('bar', $actual);
     // insert
     $table_columns = array(array('Field' => 'foo', 'Type' => 'longtext', 'Null' => 'Yes', 'Key' => '', 'pma_type' => 'longtext', 'True_Type' => 'longtext', 'Privileges' => 'select,insert,update,references'), array('Field' => 'bar', 'Type' => 'longtext', 'Null' => 'Yes', 'Key' => '', 'pma_type' => 'longtext', 'True_Type' => 'longtext', 'Privileges' => 'select,update,references'));
     $actual = PMA_getHtmlForInsertEditRow(array(), $table_columns, array(), false, array(), '', '', '', true, array(), $o_rows, $tabindex, 2, false, 0, array(), 0, 0, 'table', 'db', 0, array(), 0, '', array(), array('wc'));
     $this->assertContains('foo', $actual);
     $this->assertContains('<textarea name="fields[37b51d194a7513e45b56f6524f2d51f2]" ' . 'class="" readonly="readonly"', $actual);
 }
Exemple #2
0
    if (empty($current_row)) {
        $current_row = array();
    }
    $jsvkey = $row_id;
    $vkey = '[multi_edit][' . $jsvkey . ']';
    $current_result = isset($result) && is_array($result) && isset($result[$row_id]) ? $result[$row_id] : $result;
    $repopulate = array();
    $checked = true;
    if (isset($unsaved_values[$row_id])) {
        $repopulate = $unsaved_values[$row_id];
        $checked = false;
    }
    if ($insert_mode && $row_id > 0) {
        $html_output .= PMA_getHtmlForIgnoreOption($row_id, $checked);
    }
    $html_output .= PMA_getHtmlForInsertEditRow($url_params, $table_columns, $comments_map, $timestamp_seen, $current_result, $chg_evt_handler, $jsvkey, $vkey, $insert_mode, $current_row, $o_rows, $tabindex, $columns_cnt, $is_upload, $tabindex_for_function, $foreigners, $tabindex_for_null, $tabindex_for_value, $table, $db, $row_id, $titles, $biggest_max_file_size, $text_dir, $repopulate, $where_clause_array);
}
// end foreach on multi-edit
$scripts->addFiles($GLOBALS['plugin_scripts']);
unset($unsaved_values, $checked, $repopulate, $GLOBALS['plugin_scripts']);
if (!isset($after_insert)) {
    $after_insert = 'back';
}
//action panel
$html_output .= PMA_getActionsPanel($where_clause, $after_insert, $tabindex, $tabindex_for_value, $found_unique_key);
if ($biggest_max_file_size > 0) {
    $html_output .= '        ' . Util::generateHiddenMaxFileSize($biggest_max_file_size) . "\n";
}
$html_output .= '</form>';
$html_output .= PMA_getHtmlForGisEditor();
// end Insert/Edit form
 /**
  * Test for PMA_getHtmlForInsertEditRow
  *
  * @return void
  */
 public function testGetHtmlForInsertEditRow()
 {
     $o_rows = 0;
     $tabindex = 0;
     $GLOBALS['plugin_scripts'] = array();
     $GLOBALS['cfg']['LongtextDoubleTextarea'] = true;
     $GLOBALS['cfg']['CharEditing'] = true;
     $table_columns = array(array('Field' => 'test', 'Type' => 'longtext', 'Null' => 'Yes', 'pma_type' => 'longtext', 'True_Type' => 'longtext'));
     $actual = PMA_getHtmlForInsertEditRow(array(), $table_columns, array(), array(), false, array(), '', '', '', false, array(), $o_rows, $tabindex, 1, false, 0, array(), 0, 0, 'table', 'db', 0, array(), 0, '', array(), array('wc'));
     $this->assertContains('test', $actual);
     $this->assertContains('<th>Column</th>', $actual);
     $this->assertContains('<a', $actual);
     $this->assertContains('<th>Value</th>', $actual);
     $this->assertContains('<span class="column_type">longtext</span>', $actual);
     $this->assertContains('<textarea name="fields[098f6bcd4621d373cade4e832627b4f6]"', $actual);
 }