Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
weblate committed Jul 26, 2012
2 parents 2abb9cf + 3864f8d commit ab01c55
Show file tree
Hide file tree
Showing 4 changed files with 390 additions and 401 deletions.
1 change: 0 additions & 1 deletion db_operations.php
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,6 @@
"sql",
'libraries/plugins/export/',
array(
'export_type' => $export_type,
'single_table' => isset($single_table)
)
);
Expand Down
85 changes: 54 additions & 31 deletions libraries/plugin_interface.lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -228,33 +228,53 @@ function PMA_pluginGetOneOption(
$ret = "\n";

if (! $is_subgroup) {
// for main groups
$ret .= '<div class="export_sub_options" id="' . $plugin_name . '_'
. $propertyGroup->getName() . '">';
if ($propertyGroup->getText() != null) {
$ret .= '<h4>' . PMA_getString($propertyGroup->getText()) . '</h4>';
// for subgroup headers
if (strpos(get_class($propertyGroup), "PropertyItem")) {
$properties = array($propertyGroup);
} else {
// for main groups
$ret .= '<div class="export_sub_options" id="' . $plugin_name . '_'
. $propertyGroup->getName() . '">';
if ($propertyGroup->getText() != null) {
$ret .= '<h4>' . PMA_getString($propertyGroup->getText()) . '</h4>';
}
$ret .= '<ul>';
}
$ret .= '<ul>';
}

foreach ($propertyGroup->getProperties() as $propertyItem) {

if ($properties == null) {
$not_subgroup_header = true;
$properties = $propertyGroup->getProperties();
}
foreach ($properties as $propertyItem) {
$property_class = get_class($propertyItem);
// if the property is a subgroup, we deal with it recursively
if (strpos("group", $property_class)) {
if (strpos($property_class, "Subgroup")) {
// for subgroups
// each subgroup can have a header, which may also be a form element
$subgroup_header = $propertyItem->getSubgroupHeader();
if (isset($subgroup_header)) {
$ret .= PMA_pluginGetOneOption(
$section,
$plugin_name,
$subgroup_header
);
}

$ret .= '<li class="subgroup"><ul';
if (isset($subgroup_header)) {
$ret .= ' id="ul_' . $subgroup_header->getName() . '">';
} else {
$ret .= '>';
}

$ret .= PMA_pluginGetOneOption(
$section,
$plugin_name,
$propertyItem,
true
) . '<li class="subgroup"><ul';
if (isset($subgroup_header['name'])) {
$ret .= ' id="ul_' . $subgroup_header['name'] . '">';
} else {
$ret .= '>';
}
);
} else {
// single property item
switch ($property_class) {
Expand Down Expand Up @@ -362,25 +382,28 @@ function PMA_pluginGetOneOption(
$ret .= '</ul></li>';
} else {
// end main group
$ret .= '</ul></div>';
if ($not_subgroup_header)
$ret .= '</ul></div>';
}

$doc = $propertyItem->getDoc();
if (isset($doc)) {
if (count($doc) == 3) {
$ret .= PMA_CommonFunctions::getInstance()->showMySQLDocu(
$doc[0],
$doc[1],
false,
$doc[2]
);
} elseif (count($doc) == 1) {
$ret .= PMA_CommonFunctions::getInstance()->showDocu($doc[0]);
} else {
$ret .= PMA_CommonFunctions::getInstance()->showMySQLDocu(
$doc[0],
$doc[1]
);
if (method_exists($propertyGroup, "getDoc")){
$doc = $propertyGroup->getDoc();
if ($doc != null) {
if (count($doc) == 3) {
$ret .= PMA_CommonFunctions::getInstance()->showMySQLDocu(
$doc[0],
$doc[1],
false,
$doc[2]
);
} elseif (count($doc) == 1) {
$ret .= PMA_CommonFunctions::getInstance()->showDocu($doc[0]);
} else {
$ret .= PMA_CommonFunctions::getInstance()->showMySQLDocu(
$doc[0],
$doc[1]
);
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,59 +35,63 @@ public function __construct()
*/
protected function setProperties()
{
$this->properties = array(
'text' => __('MediaWiki Table'),
'extension' => 'mediawiki',
'mime_type' => 'text/plain',
'options' => array(),
'options_text' => __('Options')
);

// general options
$this->properties['options'][] = array(
'type' => 'begin_group',
'name' => 'general_opts'
);
$props = 'libraries/properties/';
require_once "$props/plugins/ExportPluginProperties.class.php";
require_once "$props/options/groups/OptionsPropertyRootGroup.class.php";
require_once "$props/options/groups/OptionsPropertyMainGroup.class.php";
require_once "$props/options/groups/OptionsPropertySubgroup.class.php";
require_once "$props/options/items/MessageOnlyPropertyItem.class.php";
require_once "$props/options/items/RadioPropertyItem.class.php";
require_once "$props/options/items/BoolPropertyItem.class.php";

$exportPluginProperties = new ExportPluginProperties();
$exportPluginProperties->setText('MediaWiki Table');
$exportPluginProperties->setExtension('mediawiki');
$exportPluginProperties->setMimeType('text/plain');
$exportPluginProperties->setOptionsText(__('Options'));

// create the root group that will be the options field for
// $exportPluginProperties
// this will be shown as "Format specific options"
$exportSpecificOptions = new OptionsPropertyRootGroup();
$exportSpecificOptions->setName("Format Specific Options");

// general options main group
$generalOptions = new OptionsPropertyMainGroup();
$generalOptions->setName("general_opts");
$generalOptions->setText(__('Dump table'));

// what to dump (structure/data/both)
$this->properties['options'][] = array(
'type' => 'begin_subgroup',
'subgroup_header' => array(
'type' => 'message_only',
'text' => __('Dump table')
)
);
$this->properties['options'][] = array(
'type' => 'radio',
'name' => 'structure_or_data',
'values' => array(
'structure' => __('structure'),
'data' => __('data'),
'structure_and_data' => __('structure and data')
)
);
$this->properties['options'][] = array(
'type' => 'end_subgroup'
);
$subgroup = new OptionsPropertySubgroup();
$subgroup->setName("dump_table");
$subgroup->setText("Dump table");
$leaf = new RadioPropertyItem();
$leaf->setName('structure_or_data');
$leaf->setValues(array(
'structure' => __('structure'),
'data' => __('data'),
'structure_and_data' => __('structure and data')
));
$subgroup->setSubgroupHeader($leaf);
$generalOptions->addProperty($subgroup);

// export table name
$this->properties['options'][] = array(
'type' => 'bool',
'name' => 'caption',
'text' => __('Export table names')
);
$leaf = new BoolPropertyItem();
$leaf->setName("caption");
$leaf->setText(__('Export table names'));
$generalOptions->addProperty($leaf);

// export table headers
$this->properties['options'][] = array(
'type' => 'bool',
'name' => 'headers',
'text' => __('Export table headers')
);

// end general options
$this->properties['options'][] = array(
'type' => 'end_group'
);
$leaf = new BoolPropertyItem();
$leaf->setName("caption");
$leaf->setText(__('Export table headers'));
$generalOptions->addProperty($leaf);
//add the main group to the root group
$exportSpecificOptions->addProperty($generalOptions);

// set the options for the export plugin property item
$exportPluginProperties->setOptions($exportSpecificOptions);
$this->properties = $exportPluginProperties;
}

/**
Expand Down
Loading

0 comments on commit ab01c55

Please sign in to comment.