From 5609a90c029abc4d1f07b51c588450a21e7b3ea3 Mon Sep 17 00:00:00 2001 From: Alex Marin Date: Tue, 10 Jul 2012 00:26:19 +0300 Subject: [PATCH 01/34] oop: Create properties system files --- libraries/properties/PropertyItem.class.php | 49 ++++ .../options/OptionsPropertyGroup.class.php | 100 ++++++++ .../options/OptionsPropertyItem.class.php | 98 ++++++++ .../options/OptionsPropertyOneItem.class.php | 115 ++++++++++ .../groups/OptionsPropertyMainGroup.class.php | 35 +++ .../groups/OptionsPropertyRootGroup.class.php | 35 +++ .../groups/OptionsPropertySubgroup.class.php | 35 +++ .../options/items/BoolPropertyItem.class.php | 35 +++ .../options/items/DocPropertyItem.class.php | 35 +++ .../items/HiddenPropertyItem.class.php | 35 +++ .../items/MessageOnlyPropertyItem.class.php | 35 +++ .../options/items/RadioPropertyItem.class.php | 35 +++ .../items/SelectPropertyItem.class.php | 35 +++ .../options/items/TextPropertyItem.class.php | 35 +++ .../plugins/ExportPluginProperties.class.php | 215 ++++++++++++++++++ .../plugins/ImportPluginProperties.class.php | 156 +++++++++++++ .../plugins/PluginPropertyItem.class.php | 36 +++ .../TransformationsPluginProperties.class.php | 157 +++++++++++++ 18 files changed, 1276 insertions(+) create mode 100644 libraries/properties/PropertyItem.class.php create mode 100644 libraries/properties/options/OptionsPropertyGroup.class.php create mode 100644 libraries/properties/options/OptionsPropertyItem.class.php create mode 100644 libraries/properties/options/OptionsPropertyOneItem.class.php create mode 100644 libraries/properties/options/groups/OptionsPropertyMainGroup.class.php create mode 100644 libraries/properties/options/groups/OptionsPropertyRootGroup.class.php create mode 100644 libraries/properties/options/groups/OptionsPropertySubgroup.class.php create mode 100644 libraries/properties/options/items/BoolPropertyItem.class.php create mode 100644 libraries/properties/options/items/DocPropertyItem.class.php create mode 100644 libraries/properties/options/items/HiddenPropertyItem.class.php create mode 100644 libraries/properties/options/items/MessageOnlyPropertyItem.class.php create mode 100644 libraries/properties/options/items/RadioPropertyItem.class.php create mode 100644 libraries/properties/options/items/SelectPropertyItem.class.php create mode 100644 libraries/properties/options/items/TextPropertyItem.class.php create mode 100644 libraries/properties/plugins/ExportPluginProperties.class.php create mode 100644 libraries/properties/plugins/ImportPluginProperties.class.php create mode 100644 libraries/properties/plugins/PluginPropertyItem.class.php create mode 100644 libraries/properties/plugins/TransformationsPluginProperties.class.php diff --git a/libraries/properties/PropertyItem.class.php b/libraries/properties/PropertyItem.class.php new file mode 100644 index 0000000000..21d50682c5 --- /dev/null +++ b/libraries/properties/PropertyItem.class.php @@ -0,0 +1,49 @@ + \ No newline at end of file diff --git a/libraries/properties/options/OptionsPropertyGroup.class.php b/libraries/properties/options/OptionsPropertyGroup.class.php new file mode 100644 index 0000000000..22b8ada5b7 --- /dev/null +++ b/libraries/properties/options/OptionsPropertyGroup.class.php @@ -0,0 +1,100 @@ +getProperties(), true)) { + return; + } + $this->_properties [] = $property; + } + + /** + * Removes a property from the group of properties + * + * @param OptionsPropertyItem $property the property instance to be removed + * from the group + * + * @return void + */ + public function removeProperty($property) + { + $this->_properties = array_udiff( + $this->getProperties(), + array($property), + function ($a, $b) { + return ($a === $b ) ? 0 : 1; + } + ); + } + + + /* ~~~~~~~~~~~~~~~~~~~~ Getters and Setters ~~~~~~~~~~~~~~~~~~~~ */ + + + /** + * Gets the instance of the class + * + * @return array + */ + public function getGroup() + { + return $this; + } + + /** + * Gets the group of properties + * + * @return array + */ + public function getProperties() + { + return $this->_properties; + } + + /** + * Gets the number of properties + * + * @return int + */ + public function getNrOfProperties() + { + return count($this->_properties); + } +} +?> \ No newline at end of file diff --git a/libraries/properties/options/OptionsPropertyItem.class.php b/libraries/properties/options/OptionsPropertyItem.class.php new file mode 100644 index 0000000000..b10ee63123 --- /dev/null +++ b/libraries/properties/options/OptionsPropertyItem.class.php @@ -0,0 +1,98 @@ +_name; + } + + /** + * Sets the name + * + * @param string $name name + * + * @return void + */ + public function setName($name) + { + $this->_name = $name; + } + + /** + * Gets the text + * + * @return string + */ + public function getText() + { + return $this->_text; + } + + /** + * Sets the text + * + * @param string $text text + * + * @return void + */ + public function setText($text) + { + $this->_text = $text; + } + + /** + * Returns the property type ( either "options", or "plugin" ). + * + * @return string + */ + public abstract function getPropertyType() + { + return "options"; + } +} +?> \ No newline at end of file diff --git a/libraries/properties/options/OptionsPropertyOneItem.class.php b/libraries/properties/options/OptionsPropertyOneItem.class.php new file mode 100644 index 0000000000..368f68f01f --- /dev/null +++ b/libraries/properties/options/OptionsPropertyOneItem.class.php @@ -0,0 +1,115 @@ +_force; + } + + /** + * Sets the force parameter + * + * @param bool $force force parameter + * + * @return void + */ + public function setForce($force) + { + $this->_force = $force; + } + + /** + * Gets the values + * + * @return string + */ + public function getValues() + { + return $this->_values; + } + + /** + * Sets the values + * + * @param array $values values + * + * @return void + */ + public function setValues($values) + { + $this->_values = $values; + } + + /** + * Gets the type of the newline character + * + * @return string + */ + public function getDoc() + { + return $this->_doc; + } + + /** + * Sets the doc + * + * @param string $doc doc + * + * @return void + */ + public function setDoc($doc) + { + $this->_doc = $doc; + } +} +?> \ No newline at end of file diff --git a/libraries/properties/options/groups/OptionsPropertyMainGroup.class.php b/libraries/properties/options/groups/OptionsPropertyMainGroup.class.php new file mode 100644 index 0000000000..5a85e95b0a --- /dev/null +++ b/libraries/properties/options/groups/OptionsPropertyMainGroup.class.php @@ -0,0 +1,35 @@ + \ No newline at end of file diff --git a/libraries/properties/options/groups/OptionsPropertyRootGroup.class.php b/libraries/properties/options/groups/OptionsPropertyRootGroup.class.php new file mode 100644 index 0000000000..83afa89912 --- /dev/null +++ b/libraries/properties/options/groups/OptionsPropertyRootGroup.class.php @@ -0,0 +1,35 @@ + \ No newline at end of file diff --git a/libraries/properties/options/groups/OptionsPropertySubgroup.class.php b/libraries/properties/options/groups/OptionsPropertySubgroup.class.php new file mode 100644 index 0000000000..759aa3d94f --- /dev/null +++ b/libraries/properties/options/groups/OptionsPropertySubgroup.class.php @@ -0,0 +1,35 @@ + \ No newline at end of file diff --git a/libraries/properties/options/items/BoolPropertyItem.class.php b/libraries/properties/options/items/BoolPropertyItem.class.php new file mode 100644 index 0000000000..9c3231a42d --- /dev/null +++ b/libraries/properties/options/items/BoolPropertyItem.class.php @@ -0,0 +1,35 @@ + \ No newline at end of file diff --git a/libraries/properties/options/items/DocPropertyItem.class.php b/libraries/properties/options/items/DocPropertyItem.class.php new file mode 100644 index 0000000000..0ebdaaa0ea --- /dev/null +++ b/libraries/properties/options/items/DocPropertyItem.class.php @@ -0,0 +1,35 @@ + \ No newline at end of file diff --git a/libraries/properties/options/items/HiddenPropertyItem.class.php b/libraries/properties/options/items/HiddenPropertyItem.class.php new file mode 100644 index 0000000000..08562b8dbf --- /dev/null +++ b/libraries/properties/options/items/HiddenPropertyItem.class.php @@ -0,0 +1,35 @@ + \ No newline at end of file diff --git a/libraries/properties/options/items/MessageOnlyPropertyItem.class.php b/libraries/properties/options/items/MessageOnlyPropertyItem.class.php new file mode 100644 index 0000000000..b10bbbb736 --- /dev/null +++ b/libraries/properties/options/items/MessageOnlyPropertyItem.class.php @@ -0,0 +1,35 @@ + \ No newline at end of file diff --git a/libraries/properties/options/items/RadioPropertyItem.class.php b/libraries/properties/options/items/RadioPropertyItem.class.php new file mode 100644 index 0000000000..c5ee62e0cd --- /dev/null +++ b/libraries/properties/options/items/RadioPropertyItem.class.php @@ -0,0 +1,35 @@ + \ No newline at end of file diff --git a/libraries/properties/options/items/SelectPropertyItem.class.php b/libraries/properties/options/items/SelectPropertyItem.class.php new file mode 100644 index 0000000000..e6f39c8767 --- /dev/null +++ b/libraries/properties/options/items/SelectPropertyItem.class.php @@ -0,0 +1,35 @@ + \ No newline at end of file diff --git a/libraries/properties/options/items/TextPropertyItem.class.php b/libraries/properties/options/items/TextPropertyItem.class.php new file mode 100644 index 0000000000..c4c62469bb --- /dev/null +++ b/libraries/properties/options/items/TextPropertyItem.class.php @@ -0,0 +1,35 @@ + \ No newline at end of file diff --git a/libraries/properties/plugins/ExportPluginProperties.class.php b/libraries/properties/plugins/ExportPluginProperties.class.php new file mode 100644 index 0000000000..64f58c7895 --- /dev/null +++ b/libraries/properties/plugins/ExportPluginProperties.class.php @@ -0,0 +1,215 @@ +_text; + } + + /** + * Sets the text + * + * @param string $text text + * + * @return void + */ + public function setText($text) + { + $this->_text = $text; + } + + /** + * Gets the extension + * + * @return string + */ + public function getExtension() + { + return $this->_extension; + } + + /** + * Sets the extension + * + * @param string $extension extension + * + * @return void + */ + public function setExtension($extension) + { + $this->_extension = $extension; + } + + /** + * Gets the options + * + * @return OptionsPropertyRootGroup + */ + public function getOptions() + { + return $this->_options; + } + + /** + * Sets the options + * + * @param OptionsPropertyRootGroup $options options + * + * @return void + */ + public function setOptions($options) + { + $this->_options = $options; + } + + /** + * Gets the options text + * + * @return string + */ + public function getOptionsText() + { + return $this->_optionsText; + } + + /** + * Sets the options text + * + * @param string $optionsText optionsText + * + * @return void + */ + public function setOptionsText($optionsText) + { + $this->_optionsText = $optionsText; + } + + /** + * Gets the MIME type + * + * @return string + */ + public function getMimeType() + { + return $this->_mimeType; + } + + /** + * Sets the MIME type + * + * @param string $mimeType MIME type + * + * @return void + */ + public function setMimeType($mimeType) + { + $this->_mimeType = $mimeType; + } + + /** + * Gets the force file parameter + * + * @return bool + */ + public function getForceFile() + { + return $this->_forceFile; + } + + /** + * Sets the force file parameter + * + * @param bool $forceFile the force file parameter + * + * @return void + */ + public function setForceFile($forceFile) + { + $this->_forceFile = $forceFile; + } +} +?> \ No newline at end of file diff --git a/libraries/properties/plugins/ImportPluginProperties.class.php b/libraries/properties/plugins/ImportPluginProperties.class.php new file mode 100644 index 0000000000..42150a691c --- /dev/null +++ b/libraries/properties/plugins/ImportPluginProperties.class.php @@ -0,0 +1,156 @@ +_text; + } + + /** + * Sets the text + * + * @param string $text text + * + * @return void + */ + public function setText($text) + { + $this->_text = $text; + } + + /** + * Gets the extension + * + * @return string + */ + public function getExtension() + { + return $this->_extension; + } + + /** + * Sets the extension + * + * @param string $extension extension + * + * @return void + */ + public function setExtension($extension) + { + $this->_extension = $extension; + } + + /** + * Gets the options + * + * @return OptionsPropertyRootGroup + */ + public function getOptions() + { + return $this->_options; + } + + /** + * Sets the options + * + * @param OptionsPropertyRootGroup $options options + * + * @return void + */ + public function setOptions($options) + { + $this->_options = $options; + } + + /** + * Gets the options text + * + * @return string + */ + public function getOptionsText() + { + return $this->_optionsText; + } + + /** + * Sets the options text + * + * @param string $optionsText options text + * + * @return void + */ + public function setOptionsText($optionsText) + { + $this->_optionsText = $optionsText; + } +} +?> \ No newline at end of file diff --git a/libraries/properties/plugins/PluginPropertyItem.class.php b/libraries/properties/plugins/PluginPropertyItem.class.php new file mode 100644 index 0000000000..71a0528a55 --- /dev/null +++ b/libraries/properties/plugins/PluginPropertyItem.class.php @@ -0,0 +1,36 @@ + \ No newline at end of file diff --git a/libraries/properties/plugins/TransformationsPluginProperties.class.php b/libraries/properties/plugins/TransformationsPluginProperties.class.php new file mode 100644 index 0000000000..d3b80e7f86 --- /dev/null +++ b/libraries/properties/plugins/TransformationsPluginProperties.class.php @@ -0,0 +1,157 @@ +_info; + } + + /** + * Sets information about the transformations plug-in + * + * @param string $info information about the transformations plug-in + * + * @return void + */ + public function setInfo($info) + { + $this->_info = $info; + } + + /** + * Gets the MIME type + * + * @return string + */ + public function getMimeType() + { + return $this->_mimeType; + } + + /** + * Sets the MIME type + * + * @param string $mimeType MIME type + * + * @return void + */ + public function setMimeType($mimeType) + { + $this->_mimeType = $mimeType; + } + + /** + * Gets the MIME subtype + * + * @return string + */ + public function getMimeSubtype() + { + return $this->_mimeSubype; + } + + /** + * Sets the MIME subtype + * + * @param string $mimeSubtype MIME subtype + * + * @return void + */ + public function setMimeSubtype($mimeSubtype) + { + $this->_mimeSubype = $mimeSubtype; + } + + /** + * Gets the transformation name + * + * @return string + */ + public function getTransformationName() + { + return $this->_transformationName; + } + + /** + * Sets the transformation name + * + * @param string $transformationName transformation name + * + * @return void + */ + public function setTransformationName($transformationName) + { + $this->_transformationName = $transformationName; + } +} +?> \ No newline at end of file From 44103fdbbbed4214eaee840938b16b6fda301c81 Mon Sep 17 00:00:00 2001 From: Alex Marin Date: Tue, 10 Jul 2012 21:47:20 +0300 Subject: [PATCH 02/34] oop: Fixes for properties files --- libraries/properties/options/OptionsPropertyGroup.class.php | 4 +++- libraries/properties/options/OptionsPropertyItem.class.php | 4 ++-- .../options/groups/OptionsPropertyMainGroup.class.php | 6 +++--- .../options/groups/OptionsPropertyRootGroup.class.php | 6 +++--- .../options/groups/OptionsPropertySubgroup.class.php | 6 +++--- .../properties/options/items/BoolPropertyItem.class.php | 6 +++--- .../properties/options/items/DocPropertyItem.class.php | 6 +++--- .../properties/options/items/HiddenPropertyItem.class.php | 6 +++--- .../options/items/MessageOnlyPropertyItem.class.php | 6 +++--- .../properties/options/items/RadioPropertyItem.class.php | 6 +++--- .../properties/options/items/SelectPropertyItem.class.php | 6 +++--- .../properties/options/items/TextPropertyItem.class.php | 6 +++--- .../properties/plugins/ExportPluginProperties.class.php | 2 +- .../properties/plugins/ImportPluginProperties.class.php | 2 +- libraries/properties/plugins/PluginPropertyItem.class.php | 6 +++--- .../plugins/TransformationsPluginProperties.class.php | 2 +- 16 files changed, 41 insertions(+), 39 deletions(-) diff --git a/libraries/properties/options/OptionsPropertyGroup.class.php b/libraries/properties/options/OptionsPropertyGroup.class.php index 22b8ada5b7..a8ad40f326 100644 --- a/libraries/properties/options/OptionsPropertyGroup.class.php +++ b/libraries/properties/options/OptionsPropertyGroup.class.php @@ -38,7 +38,9 @@ abstract class OptionsPropertyGroup extends OptionsPropertyItem */ public function addProperty($property) { - if (in_array($property, $this->getProperties(), true)) { + if ($this->getProperties() == null + || in_array($property, $this->getProperties(), true) + ) { return; } $this->_properties [] = $property; diff --git a/libraries/properties/options/OptionsPropertyItem.class.php b/libraries/properties/options/OptionsPropertyItem.class.php index b10ee63123..4c683e8e3e 100644 --- a/libraries/properties/options/OptionsPropertyItem.class.php +++ b/libraries/properties/options/OptionsPropertyItem.class.php @@ -11,7 +11,7 @@ if (! defined('PHPMYADMIN')) { } /* This class extends the PropertyItem class */ -require_once "../PropertyItem.class.php"; +require_once "libraries/properties/PropertyItem.class.php"; /** * Superclass for @@ -90,7 +90,7 @@ abstract class OptionsPropertyItem extends PropertyItem * * @return string */ - public abstract function getPropertyType() + public function getPropertyType() { return "options"; } diff --git a/libraries/properties/options/groups/OptionsPropertyMainGroup.class.php b/libraries/properties/options/groups/OptionsPropertyMainGroup.class.php index 5a85e95b0a..2de7eadf1c 100644 --- a/libraries/properties/options/groups/OptionsPropertyMainGroup.class.php +++ b/libraries/properties/options/groups/OptionsPropertyMainGroup.class.php @@ -10,7 +10,7 @@ if (! defined('PHPMYADMIN')) { } /* This class extends the OptionsPropertyGroup class */ -require_once "../OptionsPropertyGroup.class.php"; +require_once "libraries/properties/options/OptionsPropertyGroup.class.php"; /** * Group property item class of type main @@ -23,11 +23,11 @@ class OptionsPropertyMainGroup extends OptionsPropertyGroup * Returns the property item type of either an instance of * - OptionsPropertyOneItem ( f.e. "bool", "text", "radio", etc ) or * - OptionsPropertyGroup ( "root", "main" or "subgroup" ) - * - PluginPropertyItem ( "export", "import", "transformations" ) + * - PluginPropertyItem ( "export", "import", "transformations" ) * * @return string */ - public abstract function getItemType() + public function getItemType() { return "main"; } diff --git a/libraries/properties/options/groups/OptionsPropertyRootGroup.class.php b/libraries/properties/options/groups/OptionsPropertyRootGroup.class.php index 83afa89912..f1ded7fdb6 100644 --- a/libraries/properties/options/groups/OptionsPropertyRootGroup.class.php +++ b/libraries/properties/options/groups/OptionsPropertyRootGroup.class.php @@ -10,7 +10,7 @@ if (! defined('PHPMYADMIN')) { } /* This class extends the OptionsPropertyGroup class */ -require_once "../OptionsPropertyGroup.class.php"; +require_once "libraries/properties/options/OptionsPropertyGroup.class.php"; /** * Group property item class of type root @@ -23,11 +23,11 @@ class OptionsPropertyRootGroup extends OptionsPropertyGroup * Returns the property item type of either an instance of * - OptionsPropertyOneItem ( f.e. "bool", "text", "radio", etc ) or * - OptionsPropertyGroup ( "root", "main" or "subgroup" ) - * - PluginPropertyItem ( "export", "import", "transformations" ) + * - PluginPropertyItem ( "export", "import", "transformations" ) * * @return string */ - public abstract function getItemType() + public function getItemType() { return "root"; } diff --git a/libraries/properties/options/groups/OptionsPropertySubgroup.class.php b/libraries/properties/options/groups/OptionsPropertySubgroup.class.php index 759aa3d94f..ae07d0e92e 100644 --- a/libraries/properties/options/groups/OptionsPropertySubgroup.class.php +++ b/libraries/properties/options/groups/OptionsPropertySubgroup.class.php @@ -10,7 +10,7 @@ if (! defined('PHPMYADMIN')) { } /* This class extends the OptionsPropertyGroup class */ -require_once "../OptionsPropertyGroup.class.php"; +require_once "libraries/properties/options/OptionsPropertyGroup.class.php"; /** * Group property item class of type subgroup @@ -23,11 +23,11 @@ class OptionsPropertySubgroup extends OptionsPropertyGroup * Returns the property item type of either an instance of * - OptionsPropertyOneItem ( f.e. "bool", "text", "radio", etc ) or * - OptionsPropertyGroup ( "root", "main" or "subgroup" ) - * - PluginPropertyItem ( "export", "import", "transformations" ) + * - PluginPropertyItem ( "export", "import", "transformations" ) * * @return string */ - public abstract function getItemType() + public function getItemType() { return "subgroup"; } diff --git a/libraries/properties/options/items/BoolPropertyItem.class.php b/libraries/properties/options/items/BoolPropertyItem.class.php index 9c3231a42d..480921d353 100644 --- a/libraries/properties/options/items/BoolPropertyItem.class.php +++ b/libraries/properties/options/items/BoolPropertyItem.class.php @@ -10,7 +10,7 @@ if (! defined('PHPMYADMIN')) { } /* This class extends the OptionsPropertyOneItem class */ -require_once "../OptionsPropertyOneItem.class.php"; +require_once "libraries/properties/options/OptionsPropertyOneItem.class.php"; /** * Single property item class of type bool @@ -23,11 +23,11 @@ class BoolPropertyItem extends OptionsPropertyOneItem * Returns the property item type of either an instance of * - OptionsPropertyOneItem ( f.e. "bool", "text", "radio", etc ) or * - OptionsPropertyGroup ( "root", "main" or "subgroup" ) - * - PluginPropertyItem ( "export", "import", "transformations" ) + * - PluginPropertyItem ( "export", "import", "transformations" ) * * @return string */ - public abstract function getItemType() + public function getItemType() { return "bool"; } diff --git a/libraries/properties/options/items/DocPropertyItem.class.php b/libraries/properties/options/items/DocPropertyItem.class.php index 0ebdaaa0ea..bc69e7edbd 100644 --- a/libraries/properties/options/items/DocPropertyItem.class.php +++ b/libraries/properties/options/items/DocPropertyItem.class.php @@ -10,7 +10,7 @@ if (! defined('PHPMYADMIN')) { } /* This class extends the OptionsPropertyOneItem class */ -require_once "../OptionsPropertyOneItem.class.php"; +require_once "libraries/properties/options/OptionsPropertyOneItem.class.php"; /** * Single property item class of type doc @@ -23,11 +23,11 @@ class DocPropertyItem extends OptionsPropertyOneItem * Returns the property item type of either an instance of * - OptionsPropertyOneItem ( f.e. "bool", "text", "radio", etc ) or * - OptionsPropertyGroup ( "root", "main" or "subgroup" ) - * - PluginPropertyItem ( "export", "import", "transformations" ) + * - PluginPropertyItem ( "export", "import", "transformations" ) * * @return string */ - public abstract function getItemType() + public function getItemType() { return "doc"; } diff --git a/libraries/properties/options/items/HiddenPropertyItem.class.php b/libraries/properties/options/items/HiddenPropertyItem.class.php index 08562b8dbf..f91c5d6e73 100644 --- a/libraries/properties/options/items/HiddenPropertyItem.class.php +++ b/libraries/properties/options/items/HiddenPropertyItem.class.php @@ -10,7 +10,7 @@ if (! defined('PHPMYADMIN')) { } /* This class extends the OptionsPropertyOneItem class */ -require_once "../OptionsPropertyOneItem.class.php"; +require_once "libraries/properties/options/OptionsPropertyOneItem.class.php"; /** * Single property item class of type hidden @@ -23,11 +23,11 @@ class HiddenPropertyItem extends OptionsPropertyOneItem * Returns the property item type of either an instance of * - OptionsPropertyOneItem ( f.e. "bool", "text", "radio", etc ) or * - OptionsPropertyGroup ( "root", "main" or "subgroup" ) - * - PluginPropertyItem ( "export", "import", "transformations" ) + * - PluginPropertyItem ( "export", "import", "transformations" ) * * @return string */ - public abstract function getItemType() + public function getItemType() { return "hidden"; } diff --git a/libraries/properties/options/items/MessageOnlyPropertyItem.class.php b/libraries/properties/options/items/MessageOnlyPropertyItem.class.php index b10bbbb736..f80dbc8ad0 100644 --- a/libraries/properties/options/items/MessageOnlyPropertyItem.class.php +++ b/libraries/properties/options/items/MessageOnlyPropertyItem.class.php @@ -10,7 +10,7 @@ if (! defined('PHPMYADMIN')) { } /* This class extends the OptionsPropertyOneItem class */ -require_once "../OptionsPropertyOneItem.class.php"; +require_once "libraries/properties/options/OptionsPropertyOneItem.class.php"; /** * Single property item class of type messageOnly @@ -23,11 +23,11 @@ class MessageOnlyPropertyItem extends OptionsPropertyOneItem * Returns the property item type of either an instance of * - OptionsPropertyOneItem ( f.e. "bool", "text", "radio", etc ) or * - OptionsPropertyGroup ( "root", "main" or "subgroup" ) - * - PluginPropertyItem ( "export", "import", "transformations" ) + * - PluginPropertyItem ( "export", "import", "transformations" ) * * @return string */ - public abstract function getItemType() + public function getItemType() { return "messageOnly"; } diff --git a/libraries/properties/options/items/RadioPropertyItem.class.php b/libraries/properties/options/items/RadioPropertyItem.class.php index c5ee62e0cd..4f7eef3973 100644 --- a/libraries/properties/options/items/RadioPropertyItem.class.php +++ b/libraries/properties/options/items/RadioPropertyItem.class.php @@ -10,7 +10,7 @@ if (! defined('PHPMYADMIN')) { } /* This class extends the OptionsPropertyOneItem class */ -require_once "../OptionsPropertyOneItem.class.php"; +require_once "libraries/properties/options/OptionsPropertyOneItem.class.php"; /** * Single property item class of type radio @@ -23,11 +23,11 @@ class RadioPropertyItem extends OptionsPropertyOneItem * Returns the property item type of either an instance of * - OptionsPropertyOneItem ( f.e. "bool", "text", "radio", etc ) or * - OptionsPropertyGroup ( "root", "main" or "subgroup" ) - * - PluginPropertyItem ( "export", "import", "transformations" ) + * - PluginPropertyItem ( "export", "import", "transformations" ) * * @return string */ - public abstract function getItemType() + public function getItemType() { return "radio"; } diff --git a/libraries/properties/options/items/SelectPropertyItem.class.php b/libraries/properties/options/items/SelectPropertyItem.class.php index e6f39c8767..51d294d290 100644 --- a/libraries/properties/options/items/SelectPropertyItem.class.php +++ b/libraries/properties/options/items/SelectPropertyItem.class.php @@ -10,7 +10,7 @@ if (! defined('PHPMYADMIN')) { } /* This class extends the OptionsPropertyOneItem class */ -require_once "../OptionsPropertyOneItem.class.php"; +require_once "libraries/properties/options/OptionsPropertyOneItem.class.php"; /** * Single property item class of type select @@ -23,11 +23,11 @@ class SelectPropertyItem extends OptionsPropertyOneItem * Returns the property item type of either an instance of * - OptionsPropertyOneItem ( f.e. "bool", "text", "radio", etc ) or * - OptionsPropertyGroup ( "root", "main" or "subgroup" ) - * - PluginPropertyItem ( "export", "import", "transformations" ) + * - PluginPropertyItem ( "export", "import", "transformations" ) * * @return string */ - public abstract function getItemType() + public function getItemType() { return "select"; } diff --git a/libraries/properties/options/items/TextPropertyItem.class.php b/libraries/properties/options/items/TextPropertyItem.class.php index c4c62469bb..0e0f0915fd 100644 --- a/libraries/properties/options/items/TextPropertyItem.class.php +++ b/libraries/properties/options/items/TextPropertyItem.class.php @@ -10,7 +10,7 @@ if (! defined('PHPMYADMIN')) { } /* This class extends the OptionsPropertyOneItem class */ -require_once "../OptionsPropertyOneItem.class.php"; +require_once "libraries/properties/options/OptionsPropertyOneItem.class.php"; /** * Single property item class of type text @@ -23,11 +23,11 @@ class TextPropertyItem extends OptionsPropertyOneItem * Returns the property item type of either an instance of * - OptionsPropertyOneItem ( f.e. "bool", "text", "radio", etc ) or * - OptionsPropertyGroup ( "root", "main" or "subgroup" ) - * - PluginPropertyItem ( "export", "import", "transformations" ) + * - PluginPropertyItem ( "export", "import", "transformations" ) * * @return string */ - public abstract function getItemType() + public function getItemType() { return "text"; } diff --git a/libraries/properties/plugins/ExportPluginProperties.class.php b/libraries/properties/plugins/ExportPluginProperties.class.php index 64f58c7895..b8f8465da8 100644 --- a/libraries/properties/plugins/ExportPluginProperties.class.php +++ b/libraries/properties/plugins/ExportPluginProperties.class.php @@ -75,7 +75,7 @@ class ExportPluginProperties extends PluginPropertyItem * * @return string */ - public abstract function getItemType() + public function getItemType() { return "export"; } diff --git a/libraries/properties/plugins/ImportPluginProperties.class.php b/libraries/properties/plugins/ImportPluginProperties.class.php index 42150a691c..24ff567d61 100644 --- a/libraries/properties/plugins/ImportPluginProperties.class.php +++ b/libraries/properties/plugins/ImportPluginProperties.class.php @@ -60,7 +60,7 @@ class ImportPluginProperties extends PluginPropertyItem * * @return string */ - public abstract function getItemType() +public function getItemType() { return "import"; } diff --git a/libraries/properties/plugins/PluginPropertyItem.class.php b/libraries/properties/plugins/PluginPropertyItem.class.php index 71a0528a55..f017e9055d 100644 --- a/libraries/properties/plugins/PluginPropertyItem.class.php +++ b/libraries/properties/plugins/PluginPropertyItem.class.php @@ -11,7 +11,7 @@ if (! defined('PHPMYADMIN')) { } /* This class extends the PropertyItem class */ -require_once "../PropertyItem.class.php"; +require_once "libraries/properties/PropertyItem.class.php"; /** * Superclass for @@ -21,14 +21,14 @@ require_once "../PropertyItem.class.php"; * * @package PhpMyAdmin */ -abstract class OptionsPropertyItem extends PropertyItem +abstract class PluginPropertyItem extends PropertyItem { /** * Returns the property type ( either "options", or "plugin" ). * * @return string */ - public abstract function getPropertyType() + public function getPropertyType() { return "plugin"; } diff --git a/libraries/properties/plugins/TransformationsPluginProperties.class.php b/libraries/properties/plugins/TransformationsPluginProperties.class.php index d3b80e7f86..abdc8e1203 100644 --- a/libraries/properties/plugins/TransformationsPluginProperties.class.php +++ b/libraries/properties/plugins/TransformationsPluginProperties.class.php @@ -61,7 +61,7 @@ class TransformationsPluginProperties extends PluginPropertyItem * * @return string */ - public abstract function getItemType() + public function getItemType() { return "transformations"; } From 9458f9d06263822558d39e2a52fabafe40259bf1 Mon Sep 17 00:00:00 2001 From: Alex Marin Date: Tue, 17 Jul 2012 13:32:13 +0300 Subject: [PATCH 03/34] oop: integrate the properties system for ExportXml --- export.php | 17 +- libraries/CommonFunctions.class.php | 3 +- libraries/plugin_interface.lib.php | 315 +++++++++++------- libraries/plugins/export/ExportXml.class.php | 139 ++++---- .../ExportCodegen.class.php | 0 .../ExportCsv.class.php | 0 .../ExportExcel.class.php | 0 .../ExportHtmlword.class.php | 0 .../ExportJson.class.php | 0 .../ExportLatex.class.php | 0 .../ExportMediawiki.class.php | 0 .../ExportOds.class.php | 0 .../ExportOdt.class.php | 0 .../ExportPdf.class.php | 0 .../ExportPhparray.class.php | 0 .../ExportSql.class.php | 0 .../ExportTexytext.class.php | 0 .../ExportYaml.class.php | 0 .../options/OptionsPropertyGroup.class.php | 4 +- .../options/OptionsPropertyOneItem.class.php | 59 +++- .../groups/OptionsPropertySubgroup.class.php | 33 ++ 21 files changed, 377 insertions(+), 193 deletions(-) rename libraries/plugins/export/{ => todo_change_properties}/ExportCodegen.class.php (100%) rename libraries/plugins/export/{ => todo_change_properties}/ExportCsv.class.php (100%) rename libraries/plugins/export/{ => todo_change_properties}/ExportExcel.class.php (100%) rename libraries/plugins/export/{ => todo_change_properties}/ExportHtmlword.class.php (100%) rename libraries/plugins/export/{ => todo_change_properties}/ExportJson.class.php (100%) rename libraries/plugins/export/{ => todo_change_properties}/ExportLatex.class.php (100%) rename libraries/plugins/export/{ => todo_change_properties}/ExportMediawiki.class.php (100%) rename libraries/plugins/export/{ => todo_change_properties}/ExportOds.class.php (100%) rename libraries/plugins/export/{ => todo_change_properties}/ExportOdt.class.php (100%) rename libraries/plugins/export/{ => todo_change_properties}/ExportPdf.class.php (100%) rename libraries/plugins/export/{ => todo_change_properties}/ExportPhparray.class.php (100%) rename libraries/plugins/export/{ => todo_change_properties}/ExportSql.class.php (100%) rename libraries/plugins/export/{ => todo_change_properties}/ExportTexytext.class.php (100%) rename libraries/plugins/export/{ => todo_change_properties}/ExportYaml.class.php (100%) diff --git a/export.php b/export.php index d638f218d6..abe366d99f 100644 --- a/export.php +++ b/export.php @@ -42,8 +42,6 @@ $type = $what; // Check export type if (! isset($export_plugin)) { PMA_fatalError(__('Bad type!')); -} else { - $export_plugin_properties = $export_plugin->getProperties(); } /** @@ -92,9 +90,10 @@ if ($_REQUEST['output_format'] == 'astext') { } // Does export require to be into file? -if (isset($export_plugin_properties['force_file']) && ! $asfile) { - - $message = PMA_Message::error(__('Selected export type has to be saved in file!')); +if ($export_plugin->getProperties()->getForceFile() != null && ! $asfile) { + $message = PMA_Message::error( + __('Selected export type has to be saved in file!') + ); if ($export_type == 'server') { $active_page = 'server_export.php'; include 'server_export.php'; @@ -326,13 +325,15 @@ if ($asfile) { // Grab basic dump extension and mime type // Check if the user already added extension; get the substring where the extension would be if it was included - $extension_start_pos = strlen($filename) - strlen($export_plugin_properties['extension']) - 1; + $extension_start_pos = strlen($filename) - strlen( + $export_plugin->getProperties()->getExtension() + ) - 1; $user_extension = substr($filename, $extension_start_pos, strlen($filename)); - $required_extension = "." . $export_plugin_properties['extension']; + $required_extension = "." . $export_plugin->getProperties()->getExtension(); if (strtolower($user_extension) != $required_extension) { $filename .= $required_extension; } - $mime_type = $export_plugin_properties['mime_type']; + $mime_type = $export_plugin->getProperties()->getMimeType(); // If dump is going to be compressed, set correct mime_type and add // compression to extension diff --git a/libraries/CommonFunctions.class.php b/libraries/CommonFunctions.class.php index 439a49710e..896f3429ee 100644 --- a/libraries/CommonFunctions.class.php +++ b/libraries/CommonFunctions.class.php @@ -3537,8 +3537,7 @@ class PMA_CommonFunctions if (! empty($extensions)) { $extensions .= '|'; } - $properties = $import_plugin->getProperties(); - $extensions .= $properties['extension']; + $extensions .= $import_plugin->getProperties()->getExtension(); } $matcher = '@\.(' . $extensions . ')(\.(' diff --git a/libraries/plugin_interface.lib.php b/libraries/plugin_interface.lib.php index 03d11e22f0..208a5c0fad 100644 --- a/libraries/plugin_interface.lib.php +++ b/libraries/plugin_interface.lib.php @@ -129,14 +129,21 @@ function PMA_pluginCheckboxCheck($section, $opt) */ function PMA_pluginGetDefault($section, $opt) { - if (isset($_GET[$opt])) { // If the form is being repopulated using $_GET data, that is priority + if (isset($_GET[$opt])) { + // If the form is being repopulated using $_GET data, that is priority return htmlspecialchars($_GET[$opt]); - } elseif (isset($GLOBALS['timeout_passed']) && $GLOBALS['timeout_passed'] && isset($_REQUEST[$opt])) { + } elseif (isset($GLOBALS['timeout_passed']) + && $GLOBALS['timeout_passed'] + && isset($_REQUEST[$opt])) { return htmlspecialchars($_REQUEST[$opt]); } elseif (isset($GLOBALS['cfg'][$section][$opt])) { $matches = array(); /* Possibly replace localised texts */ - if (preg_match_all('/(str[A-Z][A-Za-z0-9]*)/', $GLOBALS['cfg'][$section][$opt], $matches)) { + if (preg_match_all( + '/(str[A-Z][A-Za-z0-9]*)/', + $GLOBALS['cfg'][$section][$opt], + $matches + )) { $val = $GLOBALS['cfg'][$section][$opt]; foreach ($matches[0] as $match) { if (isset($GLOBALS[$match])) { @@ -172,7 +179,6 @@ function PMA_pluginGetChoice($section, $name, &$list, $cfgname = null) $default = PMA_pluginGetDefault($section, $cfgname); foreach ($list as $plugin) { $plugin_name = strtolower(substr(get_class($plugin), strlen($section))); - $properties = $plugin->getProperties(); $ret .= '' - . PMA_getString($properties['text']) + . PMA_getString($plugin->getProperties()->getText()) . '' . "\n"; } $ret .= '' . "\n"; @@ -191,9 +197,9 @@ function PMA_pluginGetChoice($section, $name, &$list, $cfgname = null) // Whether each plugin has to be saved as a file foreach ($list as $plugin) { $plugin_name = strtolower(substr(get_class($plugin), strlen($section))); - $properties = $plugin->getProperties(); - $ret .= '' - . PMA_getString($opt['text']) . ''; - } elseif ($opt['type'] == 'text') { - $ret .= '
  • ' . "\n"; - $ret .= ''; - $ret .= ''; - } elseif ($opt['type'] == 'message_only') { - $ret .= '
  • ' . "\n"; - $ret .= '

    ' . PMA_getString($opt['text']) . '

    '; - } elseif ($opt['type'] == 'select') { - $ret .= '
  • ' . "\n"; - $ret .= ''; - $ret .= ''; - } elseif ($opt['type'] == 'radio') { - $default = PMA_pluginGetDefault($section, $plugin_name . '_' . $opt['name']); - foreach ($opt['values'] as $key => $val) { - $ret .= '
  • ' - . PMA_getString($val) . '
  • '; - } - } elseif ($opt['type'] == 'hidden') { - $ret .= '
  • '; - } elseif ($opt['type'] == 'begin_group') { - $ret .= '
    '; - if (isset($opt['text'])) { - $ret .= '

    ' . PMA_getString($opt['text']) . '

    '; + + if (! $is_subgroup) { + // for main groups + $ret .= '
    '; + if ($propertyGroup->getText() != null) { + $ret .= '

    ' . PMA_getString($propertyGroup->getText()) . '

    '; } $ret .= '
      '; - } elseif ($opt['type'] == 'end_group') { - $ret .= '
    '; - } elseif ($opt['type'] == 'begin_subgroup') { - /* each subgroup can have a header, which may also be a form element */ - $ret .= PMA_pluginGetOneOption($section, $plugin_name, $id, $opt['subgroup_header']) . '
  • '; - } else { - $ret .= '>'; - } - } elseif ($opt['type'] == 'end_subgroup') { - $ret .= '
  • '; - } else { - /* This should be seen only by plugin writers, so I do not thing this - * needs translation. */ - $ret .= 'UNKNOWN OPTION ' . $opt['type'] . ' IN IMPORT PLUGIN ' . $plugin_name . '!'; } - if (isset($opt['doc'])) { - if (count($opt['doc']) == 3) { - $ret .= PMA_CommonFunctions::getInstance()->showMySQLDocu($opt['doc'][0], $opt['doc'][1], false, $opt['doc'][2]); - } elseif (count($opt['doc']) == 1) { - $ret .= PMA_CommonFunctions::getInstance()->showDocu($opt['doc'][0]); + + foreach ($propertyGroup->getProperties() as $propertyItem) { + $property_class = get_class($propertyItem); + // if the property is a subgroup, we deal with it recursively + if (strpos("group", $property_class)) { + // for subgroups + // each subgroup can have a header, which may also be a form element + $subgroup_header = $propertyItem->getSubgroupHeader(); + $ret .= PMA_pluginGetOneOption( + $section, + $plugin_name, + $propertyItem, + true + ) . '
  • '; + } else { + $ret .= '>'; + } } else { - $ret .= PMA_CommonFunctions::getInstance()->showMySQLDocu($opt['doc'][0], $opt['doc'][1]); + // single property item + switch ($property_class) { + case "BoolPropertyItem": + $ret .= '
  • ' . "\n"; + $ret .= 'getName()); + + if ($propertyItem->getForce() != null) { + // Same code is also few lines lower, update both if needed + $ret .= ' onclick="if (!this.checked && ' + . '(!document.getElementById(\'checkbox_' . $plugin_name + . '_' . $propertyItem->getForce() . '\') ' + . '|| !document.getElementById(\'checkbox_' + . $plugin_name . '_' . $propertyItem->getForce() + . '\').checked)) ' + . 'return false; else return true;"'; + } + $ret .= ' />'; + $ret .= ''; + break; + case "DocPropertyItem": + echo "DocPropertyItem"; + break; + case "HiddenPropertyItem": + $ret .= '
  • '; + break; + case "MessageOnlyPropertyItem": + $ret .= '
  • ' . "\n"; + $ret .= '

    ' . PMA_getString($propertyItem->getText()) . '

    '; + break; + case "RadioPropertyItem": + $default = PMA_pluginGetDefault($section, $plugin_name . '_' + . $propertyItem->getName()); + foreach ($propertyItem->getValues() as $key => $val) { + $ret .= '
  • ' + . PMA_getString($val) . '
  • '; + } + break; + case "SelectPropertyItem": + $ret .= '
  • ' . "\n"; + $ret .= ''; + $ret .= ''; + break; + case "TextPropertyItem": + $ret .= '
  • ' . "\n"; + $ret .= ''; + $ret .= 'getSize() != null + ? ' size="' . $propertyItem->getSize() . '"' + : '') + . ($propertyItem->getLen() != null + ? ' maxlength="' . $propertyItem->getLen() . '"' + : '') + . ' />'; + break; + default:; + } } } - // Close the list element after $opt['doc'] link is displayed - if ($opt['type'] == 'bool' || $opt['type'] == 'text' || $opt['type'] == 'message_only' || $opt['type'] == 'select') { + if ($is_subgroup) { + // end subgroup + $ret .= '
  • '; + } else { + // end main group + $ret .= '
    '; + } + + $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] + ); + } + } + + // Close the list element after $doc link is displayed + if ($property_class == 'BoolPropertyItem' + || $property_class == 'MessageOnlyPropertyItem' + || $property_class == 'SelectPropertyItem' + || $property_class == 'TextPropertyItem' + ) { $ret .= ''; } $ret .= "\n"; @@ -329,27 +411,32 @@ function PMA_pluginGetOptions($section, &$list) // Options for plugins that support them foreach ($list as $plugin) { $plugin_name = strtolower(substr(get_class($plugin), strlen($section))); - $properties = $plugin->getProperties(); - $ret .= '
    '; + $ret .= '
    '; $count = 0; - $ret .= '

    ' . PMA_getString($properties['text']) . '

    '; - if (isset($properties['options']) && count($properties['options']) > 0) { - foreach ($properties['options'] as $id => $opt) { - if ($opt['type'] != 'hidden' - && $opt['type'] != 'begin_group' - && $opt['type'] != 'end_group' - && $opt['type'] != 'begin_subgroup' - && $opt['type'] != 'end_subgroup' - ) { - $count++; - } - $ret .= PMA_pluginGetOneOption($section, $plugin_name, $id, $opt); + $ret .= '

    ' . PMA_getString($plugin->getProperties()->getText()) + . '

    '; + + if ($plugin->getProperties()->getOptions() != null + && count($plugin->getProperties()->getOptions()) > 0 + ) { + foreach ($plugin->getProperties()->getOptions()->getProperties() + as $propertyMainGroup + ) { + // todo: check for hidden properties + $count++; + $ret .= PMA_pluginGetOneOption( + $section, + $plugin_name, + $propertyMainGroup + ); } } + if ($count == 0) { $ret .= '

    ' . __('This format has no options') . '

    '; } $ret .= '
    '; } return $ret; -} +} \ No newline at end of file diff --git a/libraries/plugins/export/ExportXml.class.php b/libraries/plugins/export/ExportXml.class.php index 36d15658a2..8e5718a8d6 100644 --- a/libraries/plugins/export/ExportXml.class.php +++ b/libraries/plugins/export/ExportXml.class.php @@ -64,81 +64,88 @@ class ExportXml extends ExportPlugin */ protected function setProperties() { - $this->properties = array( - 'text' => __('XML'), - 'extension' => 'xml', - 'mime_type' => 'text/xml', - 'options' => array(), - 'options_text' => __('Options') - ); + require_once "libraries/properties/plugins/ExportPluginProperties.class.php"; + require_once "libraries/properties/options/groups/OptionsPropertyRootGroup.class.php"; + require_once "libraries/properties/options/groups/OptionsPropertyMainGroup.class.php"; + require_once "libraries/properties/options/items/BoolPropertyItem.class.php"; + require_once "libraries/properties/options/items/HiddenPropertyItem.class.php"; - $this->properties['options'] = array( - array( - 'type' => 'begin_group', - 'name' => 'general_opts' - ), - array( - 'type' => 'hidden', - 'name' => 'structure_or_data' - ), - array( - 'type' => 'end_group' - ) - ); + // create the export plugin property item + $exportPluginProperties = new ExportPluginProperties(); + $exportPluginProperties->setText('XML'); + $exportPluginProperties->setExtension('xml'); + $exportPluginProperties->setMimeType('text/xml'); + $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"); + + // add the actual properties to the group + $generalOptions = new OptionsPropertyMainGroup(); + $generalOptions->setName("general_opts"); + + // create primary item and add it to the group + $hiddenProperty = new HiddenPropertyItem(); + $hiddenProperty->setName("structure_or_data"); + $generalOptions->addProperty($hiddenProperty); + // add the main group to the root group + $exportSpecificOptions->addProperty($generalOptions); /* Export structure */ - $this->properties['options'][] = array( - 'type' => 'begin_group', - 'name' => 'structure', - 'text' => __('Object creation options (all are recommended)') - ); + $structure = new OptionsPropertyMainGroup(); + $structure->setName("structure"); + $structure->setText(__('Object creation options (all are recommended)')); + if (! PMA_DRIZZLE) { - $this->properties['options'][] = array( - 'type' => 'bool', - 'name' => 'export_functions', - 'text' => __('Functions') - ); - $this->properties['options'][] = array( - 'type' => 'bool', - 'name' => 'export_procedures', - 'text' => __('Procedures') - ); + $exportFunctions = new BoolPropertyItem(); + $exportFunctions->setName("export_functions"); + $exportFunctions->setText(__('Functions')); + $structure->addProperty($exportFunctions); + + $exportProcedures = new BoolPropertyItem(); + $exportProcedures->setName("export_procedures"); + $exportProcedures->setText(__('Procedures')); + $structure->addProperty($exportProcedures); } - $this->properties['options'][] = array( - 'type' => 'bool', - 'name' => 'export_tables', - 'text' => __('Tables') - ); + + $exportTables = new BoolPropertyItem(); + $exportTables->setName("export_tables"); + $exportTables->setText(__('Tables')); + $structure->addProperty($exportTables); + if (! PMA_DRIZZLE) { - $this->properties['options'][] = array( - 'type' => 'bool', - 'name' => 'export_triggers', - 'text' => __('Triggers') - ); - $this->properties['options'][] = array( - 'type' => 'bool', - 'name' => 'export_views', - 'text' => __('Views') - ); + $exportTriggers = new BoolPropertyItem(); + $exportTriggers->setName("export_triggers"); + $exportTriggers->setText(__('Triggers')); + $structure->addProperty($exportTriggers); + + $exportViews = new BoolPropertyItem(); + $exportViews->setName("export_views"); + $exportViews->setText(__('Views')); + $structure->addProperty($exportViews); } - $this->properties['options'][] = array( - 'type' => 'end_group' - ); + + $exportSpecificOptions->addProperty($structure); /* Data */ - $this->properties['options'][] = array( - 'type' => 'begin_group', - 'name' => 'data', - 'text' => __('Data dump options') - ); - $this->properties['options'][] = array( - 'type' => 'bool', - 'name' => 'export_contents', - 'text' => __('Export contents') - ); - $this->properties['options'][] = array( - 'type' => 'end_group' - ); + $data = new OptionsPropertyMainGroup(); + $data->setName("data"); + $data->setText(__('Data dump options')); + + $exportContents = new BoolPropertyItem(); + $exportContents->setName("export_contents"); + $exportContents->setText(__('Export contents')); + $data->addProperty($exportContents); + + $exportSpecificOptions->addProperty($data); + + // set the options for the export plugin property item + $exportPluginProperties->setOptions($exportSpecificOptions); + + $this->properties = $exportPluginProperties; } /** diff --git a/libraries/plugins/export/ExportCodegen.class.php b/libraries/plugins/export/todo_change_properties/ExportCodegen.class.php similarity index 100% rename from libraries/plugins/export/ExportCodegen.class.php rename to libraries/plugins/export/todo_change_properties/ExportCodegen.class.php diff --git a/libraries/plugins/export/ExportCsv.class.php b/libraries/plugins/export/todo_change_properties/ExportCsv.class.php similarity index 100% rename from libraries/plugins/export/ExportCsv.class.php rename to libraries/plugins/export/todo_change_properties/ExportCsv.class.php diff --git a/libraries/plugins/export/ExportExcel.class.php b/libraries/plugins/export/todo_change_properties/ExportExcel.class.php similarity index 100% rename from libraries/plugins/export/ExportExcel.class.php rename to libraries/plugins/export/todo_change_properties/ExportExcel.class.php diff --git a/libraries/plugins/export/ExportHtmlword.class.php b/libraries/plugins/export/todo_change_properties/ExportHtmlword.class.php similarity index 100% rename from libraries/plugins/export/ExportHtmlword.class.php rename to libraries/plugins/export/todo_change_properties/ExportHtmlword.class.php diff --git a/libraries/plugins/export/ExportJson.class.php b/libraries/plugins/export/todo_change_properties/ExportJson.class.php similarity index 100% rename from libraries/plugins/export/ExportJson.class.php rename to libraries/plugins/export/todo_change_properties/ExportJson.class.php diff --git a/libraries/plugins/export/ExportLatex.class.php b/libraries/plugins/export/todo_change_properties/ExportLatex.class.php similarity index 100% rename from libraries/plugins/export/ExportLatex.class.php rename to libraries/plugins/export/todo_change_properties/ExportLatex.class.php diff --git a/libraries/plugins/export/ExportMediawiki.class.php b/libraries/plugins/export/todo_change_properties/ExportMediawiki.class.php similarity index 100% rename from libraries/plugins/export/ExportMediawiki.class.php rename to libraries/plugins/export/todo_change_properties/ExportMediawiki.class.php diff --git a/libraries/plugins/export/ExportOds.class.php b/libraries/plugins/export/todo_change_properties/ExportOds.class.php similarity index 100% rename from libraries/plugins/export/ExportOds.class.php rename to libraries/plugins/export/todo_change_properties/ExportOds.class.php diff --git a/libraries/plugins/export/ExportOdt.class.php b/libraries/plugins/export/todo_change_properties/ExportOdt.class.php similarity index 100% rename from libraries/plugins/export/ExportOdt.class.php rename to libraries/plugins/export/todo_change_properties/ExportOdt.class.php diff --git a/libraries/plugins/export/ExportPdf.class.php b/libraries/plugins/export/todo_change_properties/ExportPdf.class.php similarity index 100% rename from libraries/plugins/export/ExportPdf.class.php rename to libraries/plugins/export/todo_change_properties/ExportPdf.class.php diff --git a/libraries/plugins/export/ExportPhparray.class.php b/libraries/plugins/export/todo_change_properties/ExportPhparray.class.php similarity index 100% rename from libraries/plugins/export/ExportPhparray.class.php rename to libraries/plugins/export/todo_change_properties/ExportPhparray.class.php diff --git a/libraries/plugins/export/ExportSql.class.php b/libraries/plugins/export/todo_change_properties/ExportSql.class.php similarity index 100% rename from libraries/plugins/export/ExportSql.class.php rename to libraries/plugins/export/todo_change_properties/ExportSql.class.php diff --git a/libraries/plugins/export/ExportTexytext.class.php b/libraries/plugins/export/todo_change_properties/ExportTexytext.class.php similarity index 100% rename from libraries/plugins/export/ExportTexytext.class.php rename to libraries/plugins/export/todo_change_properties/ExportTexytext.class.php diff --git a/libraries/plugins/export/ExportYaml.class.php b/libraries/plugins/export/todo_change_properties/ExportYaml.class.php similarity index 100% rename from libraries/plugins/export/ExportYaml.class.php rename to libraries/plugins/export/todo_change_properties/ExportYaml.class.php diff --git a/libraries/properties/options/OptionsPropertyGroup.class.php b/libraries/properties/options/OptionsPropertyGroup.class.php index a8ad40f326..05b96222aa 100644 --- a/libraries/properties/options/OptionsPropertyGroup.class.php +++ b/libraries/properties/options/OptionsPropertyGroup.class.php @@ -38,8 +38,8 @@ abstract class OptionsPropertyGroup extends OptionsPropertyItem */ public function addProperty($property) { - if ($this->getProperties() == null - || in_array($property, $this->getProperties(), true) + if (! $this->getProperties() == null + && in_array($property, $this->getProperties(), true) ) { return; } diff --git a/libraries/properties/options/OptionsPropertyOneItem.class.php b/libraries/properties/options/OptionsPropertyOneItem.class.php index 368f68f01f..84b27d37e8 100644 --- a/libraries/properties/options/OptionsPropertyOneItem.class.php +++ b/libraries/properties/options/OptionsPropertyOneItem.class.php @@ -16,7 +16,6 @@ require_once "OptionsPropertyItem.class.php"; * Parents only single property items (not groups). * Defines possible options and getters and setters for them. * - * @todo modify descriptions if needed, when the options are integrated * @package PhpMyAdmin */ abstract class OptionsPropertyOneItem extends OptionsPropertyItem @@ -42,6 +41,20 @@ abstract class OptionsPropertyOneItem extends OptionsPropertyItem */ private $_doc; + /** + * Length + * + * @var int + */ + private $_len; + + /** + * Size + * + * @var int + */ + private $_size; + /* ~~~~~~~~~~~~~~~~~~~~ Getters and Setters ~~~~~~~~~~~~~~~~~~~~ */ @@ -111,5 +124,49 @@ abstract class OptionsPropertyOneItem extends OptionsPropertyItem { $this->_doc = $doc; } + + /** + * Gets the length + * + * @return int + */ + public function getLen() + { + return $this->_len; + } + + /** + * Sets the length + * + * @param int $len length + * + * @return void + */ + public function setLen($len) + { + $this->_len = $len; + } + + /** + * Gets the size + * + * @return int + */ + public function getSize() + { + return $this->_size; + } + + /** + * Sets the size + * + * @param int $size size + * + * @return void + */ + public function setSize($size) + { + $this->_size = $size; + } } ?> \ No newline at end of file diff --git a/libraries/properties/options/groups/OptionsPropertySubgroup.class.php b/libraries/properties/options/groups/OptionsPropertySubgroup.class.php index ae07d0e92e..7a6a5e5a06 100644 --- a/libraries/properties/options/groups/OptionsPropertySubgroup.class.php +++ b/libraries/properties/options/groups/OptionsPropertySubgroup.class.php @@ -19,6 +19,17 @@ require_once "libraries/properties/options/OptionsPropertyGroup.class.php"; */ class OptionsPropertySubgroup extends OptionsPropertyGroup { + /** + * Subgroup Header + * + * @var string + */ + private $_subgroupHeader; + + + /* ~~~~~~~~~~~~~~~~~~~~ Getters and Setters ~~~~~~~~~~~~~~~~~~~~ */ + + /** * Returns the property item type of either an instance of * - OptionsPropertyOneItem ( f.e. "bool", "text", "radio", etc ) or @@ -31,5 +42,27 @@ class OptionsPropertySubgroup extends OptionsPropertyGroup { return "subgroup"; } + + /** + * Gets the subgroup header + * + * @return string + */ + public function getSubgroupHeader() + { + return $this->_subgroupHeader; + } + + /** + * Sets the subgroup header + * + * @param string $subgroupHeader subgroup header + * + * @return void + */ + public function setSubgroupHeader($subgroupHeader) + { + $this->_subgroupHeader = $subgroupHeader; + } } ?> \ No newline at end of file From 36afdd0b415a5deac11909702bf0316fe176bc1d Mon Sep 17 00:00:00 2001 From: Alex Marin Date: Tue, 17 Jul 2012 17:04:31 +0300 Subject: [PATCH 04/34] oop: use properties for ExportCodegen --- .../ExportCodegen.class.php | 67 ++++++++++++------- libraries/plugins/export/ExportXml.class.php | 11 +-- 2 files changed, 47 insertions(+), 31 deletions(-) rename libraries/plugins/export/{todo_change_properties => }/ExportCodegen.class.php (84%) diff --git a/libraries/plugins/export/todo_change_properties/ExportCodegen.class.php b/libraries/plugins/export/ExportCodegen.class.php similarity index 84% rename from libraries/plugins/export/todo_change_properties/ExportCodegen.class.php rename to libraries/plugins/export/ExportCodegen.class.php index 11e9df24c0..0b5df38e26 100644 --- a/libraries/plugins/export/todo_change_properties/ExportCodegen.class.php +++ b/libraries/plugins/export/ExportCodegen.class.php @@ -75,33 +75,48 @@ class ExportCodegen extends ExportPlugin */ protected function setProperties() { - $this->properties = array( - 'text' => 'CodeGen', - 'extension' => 'cs', - 'mime_type' => 'text/cs', - 'options' => array(), - 'options_text' => __('Options') - ); + $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/items/HiddenPropertyItem.class.php"; + require_once "$props/options/items/SelectPropertyItem.class.php"; - $this->properties['options'] = array( - array( - 'type' => 'begin_group', - 'name' => 'general_opts' - ), - array( - 'type' => 'hidden', - 'name' => 'structure_or_data' - ), - array( - 'type' => 'select', - 'name' => 'format', - 'text' => __('Format:'), - 'values' => $this->_getCgFormats() - ), - array( - 'type' => 'end_group' - ) - ); + $exportPluginProperties = new ExportPluginProperties(); + $exportPluginProperties->setText('CodeGen'); + $exportPluginProperties->setExtension('cs'); + $exportPluginProperties->setMimeType('text/cs'); + $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"); + + // add the actual properties to the group + $generalOptions = new OptionsPropertyMainGroup(); + $generalOptions->setName("general_opts"); + + // create primary item and add it to the group + $hiddenProperty = new HiddenPropertyItem(); + $hiddenProperty->setName("structure_or_data"); + $generalOptions->addProperty($hiddenProperty); + + // create primary item and add it to the group + $selectProperty = new SelectPropertyItem(); + $selectProperty->setName("format"); + $selectProperty->setText(__('Format:')); + $selectProperty->setValues($this->_getCgFormats()); + $generalOptions->addProperty($selectProperty); + + // 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; } /** diff --git a/libraries/plugins/export/ExportXml.class.php b/libraries/plugins/export/ExportXml.class.php index 8e5718a8d6..da11fcb5c8 100644 --- a/libraries/plugins/export/ExportXml.class.php +++ b/libraries/plugins/export/ExportXml.class.php @@ -64,11 +64,12 @@ class ExportXml extends ExportPlugin */ protected function setProperties() { - require_once "libraries/properties/plugins/ExportPluginProperties.class.php"; - require_once "libraries/properties/options/groups/OptionsPropertyRootGroup.class.php"; - require_once "libraries/properties/options/groups/OptionsPropertyMainGroup.class.php"; - require_once "libraries/properties/options/items/BoolPropertyItem.class.php"; - require_once "libraries/properties/options/items/HiddenPropertyItem.class.php"; + $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/items/HiddenPropertyItem.class.php"; + require_once "$props/options/items/BoolPropertyItem.class.php"; // create the export plugin property item $exportPluginProperties = new ExportPluginProperties(); From 9823d9532ca457f8c950652f2c15c6c09a3af457 Mon Sep 17 00:00:00 2001 From: Alex Marin Date: Tue, 17 Jul 2012 17:09:26 +0300 Subject: [PATCH 05/34] oop: use properties for ExportJson --- .../ExportJson.class.php | 53 ++++++++++++------- 1 file changed, 33 insertions(+), 20 deletions(-) rename libraries/plugins/export/{todo_change_properties => }/ExportJson.class.php (74%) diff --git a/libraries/plugins/export/todo_change_properties/ExportJson.class.php b/libraries/plugins/export/ExportJson.class.php similarity index 74% rename from libraries/plugins/export/todo_change_properties/ExportJson.class.php rename to libraries/plugins/export/ExportJson.class.php index 21d57f4c12..b8e7c75c65 100644 --- a/libraries/plugins/export/todo_change_properties/ExportJson.class.php +++ b/libraries/plugins/export/ExportJson.class.php @@ -35,27 +35,40 @@ class ExportJson extends ExportPlugin */ protected function setProperties() { - $this->properties = array( - 'text' => 'JSON', - 'extension' => 'json', - 'mime_type' => 'text/plain', - 'options' => array(), - 'options_text' => __('Options') - ); + $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/items/HiddenPropertyItem.class.php"; - $this->properties['options'] = array( - array( - 'type' => 'begin_group', - 'name' => 'general_opts' - ), - array( - 'type' => 'hidden', - 'name' => 'structure_or_data', - ), - array( - 'type' => 'end_group' - ) - ); + $exportPluginProperties = new ExportPluginProperties(); + $exportPluginProperties->setText('JSON'); + $exportPluginProperties->setExtension('json'); + $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"); + + // add the actual properties to the group + $generalOptions = new OptionsPropertyMainGroup(); + $generalOptions->setName("general_opts"); + + // create primary item and add it to the group + $hiddenProperty = new HiddenPropertyItem(); + $hiddenProperty->setName("structure_or_data"); + $generalOptions->addProperty($hiddenProperty); + + // 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; } /** From 616228570b64f343c2ce86a7d9301658827aa8a1 Mon Sep 17 00:00:00 2001 From: Alex Marin Date: Tue, 17 Jul 2012 17:18:43 +0300 Subject: [PATCH 06/34] oop: check for hidden properties --- libraries/plugin_interface.lib.php | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/libraries/plugin_interface.lib.php b/libraries/plugin_interface.lib.php index 208a5c0fad..873945ef68 100644 --- a/libraries/plugin_interface.lib.php +++ b/libraries/plugin_interface.lib.php @@ -413,7 +413,6 @@ function PMA_pluginGetOptions($section, &$list) $plugin_name = strtolower(substr(get_class($plugin), strlen($section))); $ret .= '
    '; - $count = 0; $ret .= '

    ' . PMA_getString($plugin->getProperties()->getText()) . '

    '; @@ -423,8 +422,15 @@ function PMA_pluginGetOptions($section, &$list) foreach ($plugin->getProperties()->getOptions()->getProperties() as $propertyMainGroup ) { - // todo: check for hidden properties - $count++; + // check for hidden properties + $no_options = true; + foreach ($propertyMainGroup->getProperties() as $propertyItem) { + if (strcmp("HiddenPropertyItem", get_class($propertyItem))) { + $no_options = false; + break; + } + } + $ret .= PMA_pluginGetOneOption( $section, $plugin_name, @@ -433,7 +439,7 @@ function PMA_pluginGetOptions($section, &$list) } } - if ($count == 0) { + if ($no_options) { $ret .= '

    ' . __('This format has no options') . '

    '; } $ret .= '
    '; From 12e5c6f5c996757d4ba8b3cf4de84489793a0882 Mon Sep 17 00:00:00 2001 From: Alex Marin Date: Wed, 18 Jul 2012 10:12:45 +0300 Subject: [PATCH 07/34] oop: use properties for ExportCsv --- .../ExportCsv.class.php | 118 +++++++++--------- 1 file changed, 61 insertions(+), 57 deletions(-) rename libraries/plugins/export/{todo_change_properties => }/ExportCsv.class.php (79%) diff --git a/libraries/plugins/export/todo_change_properties/ExportCsv.class.php b/libraries/plugins/export/ExportCsv.class.php similarity index 79% rename from libraries/plugins/export/todo_change_properties/ExportCsv.class.php rename to libraries/plugins/export/ExportCsv.class.php index 24af87d603..0ffc3ea4a8 100644 --- a/libraries/plugins/export/todo_change_properties/ExportCsv.class.php +++ b/libraries/plugins/export/ExportCsv.class.php @@ -83,64 +83,68 @@ class ExportCsv extends ExportPlugin */ protected function setProperties() { - $this->properties = array( - 'text' => __('CSV'), - 'extension' => 'csv', - 'mime_type' => 'text/comma-separated-values', - 'options' => array(), - 'options_text' => __('Options') - ); + $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/items/TextPropertyItem.class.php"; + require_once "$props/options/items/BoolPropertyItem.class.php"; + require_once "$props/options/items/HiddenPropertyItem.class.php"; - $this->properties['options'] = array( - array( - 'type' => 'begin_group', - 'name' => 'general_opts' - ), - array( - 'type' => 'text', - 'name' => 'separator', - 'text' => __('Columns separated with:') - ), - array( - 'type' => 'text', - 'name' => 'enclosed', - 'text' => __('Columns enclosed with:') - ), - array( - 'type' => 'text', - 'name' => 'escaped', - 'text' => __('Columns escaped with:') - ), - array( - 'type' => 'text', - 'name' => 'terminated', - 'text' => __('Lines terminated with:') - ), - array( - 'type' => 'text', - 'name' => 'null', - 'text' => __('Replace NULL with:') - ), - array( - 'type' => 'bool', - 'name' => 'removeCRLF', - 'text' => __( - 'Remove carriage return/line feed characters within columns' - ) - ), - array( - 'type' => 'bool', - 'name' => 'columns', - 'text' => __('Put columns names in the first row') - ), - array( - 'type' => 'hidden', - 'name' => 'structure_or_data' - ), - array( - 'type' => 'end_group' - ) - ); + $exportPluginProperties = new ExportPluginProperties(); + $exportPluginProperties->setText('CSV'); + $exportPluginProperties->setExtension('csv'); + $exportPluginProperties->setMimeType('text/comma-separated-values'); + $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"); + // create leaf items and add them to the group + $leaf = new TextPropertyItem(); + $leaf->setName("separator"); + $leaf->setText(__('Columns separated with:')); + $generalOptions->addProperty($leaf); + $leaf = new TextPropertyItem(); + $leaf->setName("enclosed"); + $leaf->setText(__('Columns enclosed with:')); + $generalOptions->addProperty($leaf); + $leaf = new TextPropertyItem(); + $leaf->setName("escaped"); + $leaf->setText(__('Columns escaped with:')); + $generalOptions->addProperty($leaf); + $leaf = new TextPropertyItem(); + $leaf->setName("terminated"); + $leaf->setText(__('Lines terminated with:')); + $generalOptions->addProperty($leaf); + $leaf = new TextPropertyItem(); + $leaf->setName('null'); + $leaf->setText(__('Replace NULL with:')); + $generalOptions->addProperty($leaf); + $leaf = new BoolPropertyItem(); + $leaf->setName('removeCRLF'); + $leaf->setText(__( + 'Remove carriage return/line feed characters within columns' + )); + $leaf = new BoolPropertyItem(); + $leaf->setName('columns'); + $leaf->setText(__('Put columns names in the first row')); + $generalOptions->addProperty($leaf); + $leaf = new HiddenPropertyItem(); + $leaf->setName('structure_or_data'); + $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; } /** From 9288f0eaecea3018b279c2d4902b4e1fc5db9cba Mon Sep 17 00:00:00 2001 From: Alex Marin Date: Wed, 18 Jul 2012 10:15:48 +0300 Subject: [PATCH 08/34] oop: reorganise usage of properties in plug-ins --- .../plugins/export/ExportCodegen.class.php | 25 +++---- libraries/plugins/export/ExportJson.class.php | 13 ++-- libraries/plugins/export/ExportXml.class.php | 74 +++++++++---------- 3 files changed, 48 insertions(+), 64 deletions(-) diff --git a/libraries/plugins/export/ExportCodegen.class.php b/libraries/plugins/export/ExportCodegen.class.php index 0b5df38e26..13f9d0004e 100644 --- a/libraries/plugins/export/ExportCodegen.class.php +++ b/libraries/plugins/export/ExportCodegen.class.php @@ -94,28 +94,23 @@ class ExportCodegen extends ExportPlugin $exportSpecificOptions = new OptionsPropertyRootGroup(); $exportSpecificOptions->setName("Format Specific Options"); - // add the actual properties to the group + // general options main group $generalOptions = new OptionsPropertyMainGroup(); $generalOptions->setName("general_opts"); - - // create primary item and add it to the group - $hiddenProperty = new HiddenPropertyItem(); - $hiddenProperty->setName("structure_or_data"); - $generalOptions->addProperty($hiddenProperty); - - // create primary item and add it to the group - $selectProperty = new SelectPropertyItem(); - $selectProperty->setName("format"); - $selectProperty->setText(__('Format:')); - $selectProperty->setValues($this->_getCgFormats()); - $generalOptions->addProperty($selectProperty); - + // create primary items and add them to the group + $leaf = new HiddenPropertyItem(); + $leaf->setName("structure_or_data"); + $generalOptions->addProperty($leaf); + $leaf = new SelectPropertyItem(); + $leaf->setName("format"); + $leaf->setText(__('Format:')); + $leaf->setValues($this->_getCgFormats()); + $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; } diff --git a/libraries/plugins/export/ExportJson.class.php b/libraries/plugins/export/ExportJson.class.php index b8e7c75c65..a75e184afa 100644 --- a/libraries/plugins/export/ExportJson.class.php +++ b/libraries/plugins/export/ExportJson.class.php @@ -53,21 +53,18 @@ class ExportJson extends ExportPlugin $exportSpecificOptions = new OptionsPropertyRootGroup(); $exportSpecificOptions->setName("Format Specific Options"); - // add the actual properties to the group + // general options main group $generalOptions = new OptionsPropertyMainGroup(); $generalOptions->setName("general_opts"); - - // create primary item and add it to the group - $hiddenProperty = new HiddenPropertyItem(); - $hiddenProperty->setName("structure_or_data"); - $generalOptions->addProperty($hiddenProperty); - + // create primary items and add them to the group + $leaf = new HiddenPropertyItem(); + $leaf->setName("structure_or_data"); + $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; } diff --git a/libraries/plugins/export/ExportXml.class.php b/libraries/plugins/export/ExportXml.class.php index da11fcb5c8..3fb8452afd 100644 --- a/libraries/plugins/export/ExportXml.class.php +++ b/libraries/plugins/export/ExportXml.class.php @@ -84,68 +84,60 @@ class ExportXml extends ExportPlugin $exportSpecificOptions = new OptionsPropertyRootGroup(); $exportSpecificOptions->setName("Format Specific Options"); - // add the actual properties to the group + // general options main group $generalOptions = new OptionsPropertyMainGroup(); $generalOptions->setName("general_opts"); - - // create primary item and add it to the group - $hiddenProperty = new HiddenPropertyItem(); - $hiddenProperty->setName("structure_or_data"); - $generalOptions->addProperty($hiddenProperty); + // create primary items and add them to the group + $leaf = new HiddenPropertyItem(); + $leaf->setName("structure_or_data"); + $generalOptions->addProperty($leaf); // add the main group to the root group $exportSpecificOptions->addProperty($generalOptions); - /* Export structure */ + // export structure main group $structure = new OptionsPropertyMainGroup(); $structure->setName("structure"); $structure->setText(__('Object creation options (all are recommended)')); - + // create primary items and add them to the group if (! PMA_DRIZZLE) { - $exportFunctions = new BoolPropertyItem(); - $exportFunctions->setName("export_functions"); - $exportFunctions->setText(__('Functions')); - $structure->addProperty($exportFunctions); - - $exportProcedures = new BoolPropertyItem(); - $exportProcedures->setName("export_procedures"); - $exportProcedures->setText(__('Procedures')); - $structure->addProperty($exportProcedures); + $leaf = new BoolPropertyItem(); + $leaf->setName("export_functions"); + $leaf->setText(__('Functions')); + $structure->addProperty($leaf); + $leaf = new BoolPropertyItem(); + $leaf->setName("export_procedures"); + $leaf->setText(__('Procedures')); + $structure->addProperty($leaf); } - - $exportTables = new BoolPropertyItem(); - $exportTables->setName("export_tables"); - $exportTables->setText(__('Tables')); - $structure->addProperty($exportTables); - + $leaf = new BoolPropertyItem(); + $leaf->setName("export_tables"); + $leaf->setText(__('Tables')); + $structure->addProperty($leaf); if (! PMA_DRIZZLE) { - $exportTriggers = new BoolPropertyItem(); - $exportTriggers->setName("export_triggers"); - $exportTriggers->setText(__('Triggers')); - $structure->addProperty($exportTriggers); - - $exportViews = new BoolPropertyItem(); - $exportViews->setName("export_views"); - $exportViews->setText(__('Views')); - $structure->addProperty($exportViews); + $leaf = new BoolPropertyItem(); + $leaf->setName("export_triggers"); + $leaf->setText(__('Triggers')); + $structure->addProperty($leaf); + $leaf = new BoolPropertyItem(); + $leaf->setName("export_views"); + $leaf->setText(__('Views')); + $structure->addProperty($leaf); } - $exportSpecificOptions->addProperty($structure); - /* Data */ + // data main group $data = new OptionsPropertyMainGroup(); $data->setName("data"); $data->setText(__('Data dump options')); - - $exportContents = new BoolPropertyItem(); - $exportContents->setName("export_contents"); - $exportContents->setText(__('Export contents')); - $data->addProperty($exportContents); - + // create primary items and add them to the group + $leaf = new BoolPropertyItem(); + $leaf->setName("export_contents"); + $leaf->setText(__('Export contents')); + $data->addProperty($leaf); $exportSpecificOptions->addProperty($data); // set the options for the export plugin property item $exportPluginProperties->setOptions($exportSpecificOptions); - $this->properties = $exportPluginProperties; } From 94ea719b4de8dd696e93d13220b3a1d1ea7c807b Mon Sep 17 00:00:00 2001 From: Alex Marin Date: Wed, 18 Jul 2012 10:35:17 +0300 Subject: [PATCH 09/34] oop: use properties for ExportExcel --- .../plugins/export/ExportExcel.class.php | 101 ++++++++++++++++++ .../ExportExcel.class.php | 92 ---------------- 2 files changed, 101 insertions(+), 92 deletions(-) create mode 100644 libraries/plugins/export/ExportExcel.class.php delete mode 100644 libraries/plugins/export/todo_change_properties/ExportExcel.class.php diff --git a/libraries/plugins/export/ExportExcel.class.php b/libraries/plugins/export/ExportExcel.class.php new file mode 100644 index 0000000000..c77029dc2e --- /dev/null +++ b/libraries/plugins/export/ExportExcel.class.php @@ -0,0 +1,101 @@ +setText('CSV for MS Excel'); + $exportPluginProperties->setExtension('csv'); + $exportPluginProperties->setMimeType('text/comma-separated-values'); + $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"); + // create primary items and add them to the group + $leaf = new TextPropertyItem(); + $leaf->setName('null'); + $leaf->setText(__('Replace NULL with:')); + $generalOptions->addProperty($leaf); + $leaf = new BoolPropertyItem(); + $leaf->setName('removeCRLF'); + $leaf->setText(__( + 'Remove carriage return/line feed characters within columns' + )); + $leaf = new BoolPropertyItem(); + $leaf->setName('columns'); + $leaf->setText(__('Put columns names in the first row')); + $generalOptions->addProperty($leaf); + $leaf = new SelectPropertyItem(); + $leaf->setName('edition'); + $leaf->setValues(array( + 'win' => 'Windows', + 'mac_excel2003' => 'Excel 2003 / Macintosh', + 'mac_excel2008' => 'Excel 2008 / Macintosh' + )); + $leaf->setText(__('Excel edition:')); + $generalOptions->addProperty($leaf); + $leaf = new HiddenPropertyItem(); + $leaf->setName('structure_or_data'); + $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; + } + + /** + * This method is called when any PluginManager to which the observer + * is attached calls PluginManager::notify() + * + * @param SplSubject $subject The PluginManager notifying the observer + * of an update. + * + * @return void + */ + public function update (SplSubject $subject) + { + } +} +?> \ No newline at end of file diff --git a/libraries/plugins/export/todo_change_properties/ExportExcel.class.php b/libraries/plugins/export/todo_change_properties/ExportExcel.class.php deleted file mode 100644 index 96bf0ba3cb..0000000000 --- a/libraries/plugins/export/todo_change_properties/ExportExcel.class.php +++ /dev/null @@ -1,92 +0,0 @@ -properties = array( - 'text' => __('CSV for MS Excel'), - 'extension' => 'csv', - 'mime_type' => 'text/comma-separated-values', - 'options' => array(), - 'options_text' => __('Options') - ); - - $this->properties['options'] = array( - array( - 'type' => 'begin_group', - 'name' => 'general_opts' - ), - array( - 'type' => 'text', - 'name' => 'null', - 'text' => __('Replace NULL with:') - ), - array( - 'type' => 'bool', - 'name' => 'removeCRLF', - 'text' => __( - 'Remove carriage return/line feed characters within columns' - ) - ), - array( - 'type' => 'bool', - 'name' => 'columns', - 'text' => __('Put columns names in the first row') - ), - array( - 'type' => 'select', - 'name' => 'edition', - 'values' => array( - 'win' => 'Windows', - 'mac_excel2003' => 'Excel 2003 / Macintosh', - 'mac_excel2008' => 'Excel 2008 / Macintosh'), - 'text' => __('Excel edition:') - ), - array( - 'type' => 'hidden', - 'name' => 'structure_or_data' - ), - array( - 'type' => 'end_group' - ) - ); - } - - /** - * This method is called when any PluginManager to which the observer - * is attached calls PluginManager::notify() - * - * @param SplSubject $subject The PluginManager notifying the observer - * of an update. - * - * @return void - */ - public function update (SplSubject $subject) - { - } -} -?> \ No newline at end of file From 857d56277c3fe4ebf762e7b31d76f053501143f1 Mon Sep 17 00:00:00 2001 From: Alex Marin Date: Wed, 18 Jul 2012 10:50:04 +0300 Subject: [PATCH 10/34] oop: use properties for ExportHtmlword --- .../ExportHtmlword.class.php | 107 ++++++++++-------- .../options/OptionsPropertyItem.class.php | 29 +++++ 2 files changed, 86 insertions(+), 50 deletions(-) rename libraries/plugins/export/{todo_change_properties => }/ExportHtmlword.class.php (87%) diff --git a/libraries/plugins/export/todo_change_properties/ExportHtmlword.class.php b/libraries/plugins/export/ExportHtmlword.class.php similarity index 87% rename from libraries/plugins/export/todo_change_properties/ExportHtmlword.class.php rename to libraries/plugins/export/ExportHtmlword.class.php index 14bc6f0941..3f43dceebf 100644 --- a/libraries/plugins/export/todo_change_properties/ExportHtmlword.class.php +++ b/libraries/plugins/export/ExportHtmlword.class.php @@ -35,56 +35,63 @@ class ExportHtmlword extends ExportPlugin */ protected function setProperties() { - $this->properties = array( - 'text' => __('Microsoft Word 2000'), - 'extension' => 'doc', - 'mime_type' => 'application/vnd.ms-word', - 'force_file' => true, - 'options' => array(), - 'options_text' => __('Options') - ); + $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/items/RadioPropertyItem.class.php"; + require_once "$props/options/items/TextPropertyItem.class.php"; + require_once "$props/options/items/BoolPropertyItem.class.php"; - $this->properties['options'] = array( - /* what to dump (structure/data/both) */ - array( - 'type' => 'begin_group', - 'name' => 'dump_what', - 'text' => __('Dump table') - ), - array( - 'type' => 'radio', - 'name' => 'structure_or_data', - 'values' => array( - 'structure' => __('structure'), - 'data' => __('data'), - 'structure_and_data' => __('structure and data') - ) - ), - array( - 'type' => 'end_group' - ), + $exportPluginProperties = new ExportPluginProperties(); + $exportPluginProperties->setText('Microsoft Word 2000'); + $exportPluginProperties->setExtension('doc'); + $exportPluginProperties->setMimeType('application/vnd.ms-word'); + $exportPluginProperties->setForceFile(true); + $exportPluginProperties->setOptionsText(__('Options')); - /* data options */ - array( - 'type' => 'begin_group', - 'name' => 'data', - 'text' => __('Data dump options'), - 'force' => 'structure' - ), - array( - 'type' => 'text', - 'name' => 'null', - 'text' => __('Replace NULL with:') - ), - array( - 'type' => 'bool', - 'name' => 'columns', - 'text' => __('Put columns names in the first row') - ), - array( - 'type' => 'end_group' - ) - ); + // 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"); + + // what to dump (structure/data/both) + $generalOptions = new OptionsPropertyMainGroup(); + $generalOptions->setName("dump_what"); + $generalOptions->setText(__('Dump table')); + // create primary items and add them to the group + $leaf = new RadioPropertyItem(); + $leaf->setName("structure_or_data"); + $leaf->setValues(array( + 'structure' => __('structure'), + 'data' => __('data'), + 'structure_and_data' => __('structure and data') + )); + $generalOptions->addProperty($leaf); + // add the main group to the root group + $exportSpecificOptions->addProperty($generalOptions); + + // data options + $dataOptions = new OptionsPropertyMainGroup(); + $dataOptions->setName("dump_what"); + $dataOptions->setText(__('Data dump options')); + $dataOptions->setForce('structure'); + // create primary items and add them to the group + $leaf = new TextPropertyItem(); + $leaf->setName("null"); + $leaf->setText(__('Replace NULL with:')); + $dataOptions->addProperty($leaf); + $leaf = new BoolPropertyItem(); + $leaf->setName("columns"); + $leaf->setText(__('Put columns names in the first row')); + $dataOptions->addProperty($leaf); + // add the main group to the root group + $exportSpecificOptions->addProperty($dataOptions); + + // set the options for the export plugin property item + $exportPluginProperties->setOptions($exportSpecificOptions); + $this->properties = $exportPluginProperties; } /** @@ -590,10 +597,10 @@ class ExportHtmlword extends ExportPlugin $column, $unique_keys ) { $definition = ''; - + $extracted_columnspec = PMA_CommonFunctions::getInstance()->extractColumnSpec($column['Type']); - + $type = htmlspecialchars($extracted_columnspec['print_type']); if (empty($type)) { $type = ' '; diff --git a/libraries/properties/options/OptionsPropertyItem.class.php b/libraries/properties/options/OptionsPropertyItem.class.php index 4c683e8e3e..4a2418d34b 100644 --- a/libraries/properties/options/OptionsPropertyItem.class.php +++ b/libraries/properties/options/OptionsPropertyItem.class.php @@ -36,6 +36,13 @@ abstract class OptionsPropertyItem extends PropertyItem */ private $_text; + /** + * What to force + * + * @var string + */ + private $_force; + /* ~~~~~~~~~~~~~~~~~~~~ Getters and Setters ~~~~~~~~~~~~~~~~~~~~ */ @@ -85,6 +92,28 @@ abstract class OptionsPropertyItem extends PropertyItem $this->_text = $text; } + /** + * Gets the force parameter + * + * @return string + */ + public function getForce() + { + return $this->_force; + } + + /** + * Sets the force paramter + * + * @param string $force force parameter + * + * @return void + */ + public function setForce($force) + { + $this->_force = $force; + } + /** * Returns the property type ( either "options", or "plugin" ). * From 63fa3fa4c07fcb54e3f672384f314fe9c16d34c9 Mon Sep 17 00:00:00 2001 From: Alex Marin Date: Wed, 18 Jul 2012 11:44:19 +0300 Subject: [PATCH 11/34] oop: use properties for ExportLatex --- .../plugins/export/ExportHtmlword.class.php | 12 +- .../ExportLatex.class.php | 236 +++++++++--------- 2 files changed, 121 insertions(+), 127 deletions(-) rename libraries/plugins/export/{todo_change_properties => }/ExportLatex.class.php (75%) diff --git a/libraries/plugins/export/ExportHtmlword.class.php b/libraries/plugins/export/ExportHtmlword.class.php index 3f43dceebf..69268b5f03 100644 --- a/libraries/plugins/export/ExportHtmlword.class.php +++ b/libraries/plugins/export/ExportHtmlword.class.php @@ -57,9 +57,9 @@ class ExportHtmlword extends ExportPlugin $exportSpecificOptions->setName("Format Specific Options"); // what to dump (structure/data/both) - $generalOptions = new OptionsPropertyMainGroup(); - $generalOptions->setName("dump_what"); - $generalOptions->setText(__('Dump table')); + $dumpWhat = new OptionsPropertyMainGroup(); + $dumpWhat->setName("dump_what"); + $dumpWhat->setText(__('Dump table')); // create primary items and add them to the group $leaf = new RadioPropertyItem(); $leaf->setName("structure_or_data"); @@ -68,11 +68,11 @@ class ExportHtmlword extends ExportPlugin 'data' => __('data'), 'structure_and_data' => __('structure and data') )); - $generalOptions->addProperty($leaf); + $dumpWhat->addProperty($leaf); // add the main group to the root group - $exportSpecificOptions->addProperty($generalOptions); + $exportSpecificOptions->addProperty($dumpWhat); - // data options + // data options main group $dataOptions = new OptionsPropertyMainGroup(); $dataOptions->setName("dump_what"); $dataOptions->setText(__('Data dump options')); diff --git a/libraries/plugins/export/todo_change_properties/ExportLatex.class.php b/libraries/plugins/export/ExportLatex.class.php similarity index 75% rename from libraries/plugins/export/todo_change_properties/ExportLatex.class.php rename to libraries/plugins/export/ExportLatex.class.php index b95f8134df..77f9746900 100644 --- a/libraries/plugins/export/todo_change_properties/ExportLatex.class.php +++ b/libraries/plugins/export/ExportLatex.class.php @@ -59,136 +59,130 @@ class ExportLatex extends ExportPlugin $hide_structure = true; } - $this->properties = array( - 'text' => __('LaTeX'), - 'extension' => 'tex', - 'mime_type' => 'application/x-tex', - 'options' => array(), - 'options_text' => __('Options') - ); + $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/items/BoolPropertyItem.class.php"; + require_once "$props/options/items/RadioPropertyItem.class.php"; + require_once "$props/options/items/TextPropertyItem.class.php"; - $this->properties['options'] = array( - array( - 'type' => 'begin_group', - 'name' => 'general_opts' - ), - array( - 'type' => 'bool', - 'name' => 'caption', - 'text' => __('Include table caption') - ), - array( - 'type' => 'end_group' - ) - ); + $exportPluginProperties = new ExportPluginProperties(); + $exportPluginProperties->setText('LaTeX'); + $exportPluginProperties->setExtension('tex'); + $exportPluginProperties->setMimeType('application/x-tex'); + $exportPluginProperties->setOptionsText(__('Options')); - /* what to dump (structure/data/both) */ - $this->properties['options'][] = array( - 'type' => 'begin_group', - 'name' => 'dump_what', - '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_group' - ); + // 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"); - /* Structure options */ + // general options main group + $generalOptions = new OptionsPropertyMainGroup(); + $generalOptions->setName("general_opts"); + // create primary items and add them to the group + $leaf = new BoolPropertyItem(); + $leaf->setName("caption"); + $leaf->setText(__('Include table caption')); + $generalOptions->addProperty($leaf); + // add the main group to the root group + $exportSpecificOptions->addProperty($generalOptions); + + // what to dump (structure/data/both) main group + $dumpWhat = new OptionsPropertyMainGroup(); + $dumpWhat->setName("dump_what"); + $dumpWhat->setText(__('Dump table')); + // create primary items and add them to the group + $leaf = new RadioPropertyItem(); + $leaf->setName("structure_or_data"); + $leaf->setValues(array( + 'structure' => __('structure'), + 'data' => __('data'), + 'structure_and_data' => __('structure and data') + )); + $dumpWhat->addProperty($leaf); + // add the main group to the root group + $exportSpecificOptions->addProperty($dumpWhat); + + // structure options main group if (! $hide_structure) { - $this->properties['options'][] = array( - 'type' => 'begin_group', - 'name' => 'structure', - 'text' => __('Object creation options'), - 'force' => 'data' - ); - $this->properties['options'][] = array( - 'type' => 'text', - 'name' => 'structure_caption', - 'text' => __('Table caption'), - 'doc' => 'faq6_27' - ); - $this->properties['options'][] = array( - 'type' => 'text', - 'name' => 'structure_continued_caption', - 'text' => __('Table caption (continued)'), - 'doc' => 'faq6_27' - ); - $this->properties['options'][] = array( - 'type' => 'text', - 'name' => 'structure_label', - 'text' => __('Label key'), - 'doc' => 'faq6_27' - ); + $structureOptions = new OptionsPropertyMainGroup(); + $structureOptions->setName("structure"); + $structureOptions->setText(__('Object creation options')); + $structureOptions->setForce('data'); + // create primary items and add them to the group + $leaf = new TextPropertyItem(); + $leaf->setName("structure_caption"); + $leaf->setText(__('Table caption')); + $leaf->setDoc('faq6_27'); + $structureOptions->addProperty($leaf); + $leaf = new TextPropertyItem(); + $leaf->setName("structure_continued_caption"); + $leaf->setText(__('Table caption (continued)')); + $leaf->setDoc('faq6_27'); + $structureOptions->addProperty($leaf); + $leaf = new TextPropertyItem(); + $leaf->setName("structure_label"); + $leaf->setText(__('Label key')); + $leaf->setDoc('faq6_27'); + $structureOptions->addProperty($leaf); if (! empty($GLOBALS['cfgRelation']['relation'])) { - $this->properties['options'][] = array( - 'type' => 'bool', - 'name' => 'relation', - 'text' => __('Display foreign key relationships') - ); + $leaf = new BoolPropertyItem(); + $leaf->setName("relation"); + $leaf->setText(__('Display foreign key relationships')); + $structureOptions->addProperty($leaf); } - $this->properties['options'][] = array( - 'type' => 'bool', - 'name' => 'comments', - 'text' => __('Display comments') - ); + $leaf = new BoolPropertyItem(); + $leaf->setName("comments"); + $leaf->setText(__('Display comments')); + $structureOptions->addProperty($leaf); if (! empty($GLOBALS['cfgRelation']['mimework'])) { - $this->properties['options'][] = array( - 'type' => 'bool', - 'name' => 'mime', - 'text' => __('Display MIME types') - ); + $leaf = new BoolPropertyItem(); + $leaf->setName("mime"); + $leaf->setText(__('Display MIME types')); + $structureOptions->addProperty($leaf); } - $this->properties['options'][] = array( - 'type' => 'end_group' - ); + // add the main group to the root group + $exportSpecificOptions->addProperty($structureOptions); } - /* Data */ - $this->properties['options'][] = array( - 'type' => 'begin_group', - 'name' => 'data', - 'text' => __('Data dump options'), - 'force' => 'structure' - ); - $this->properties['options'][] = array( - 'type' => 'bool', - 'name' => 'columns', - 'text' => __('Put columns names in the first row') - ); - $this->properties['options'][] = array( - 'type' => 'text', - 'name' => 'data_caption', - 'text' => __('Table caption'), - 'doc' => 'faq6_27' - ); - $this->properties['options'][] = array( - 'type' => 'text', - 'name' => 'data_continued_caption', - 'text' => __('Table caption (continued)'), - 'doc' => 'faq6_27' - ); - $this->properties['options'][] = array( - 'type' => 'text', - 'name' => 'data_label', - 'text' => __('Label key'), - 'doc' => 'faq6_27' - ); - $this->properties['options'][] = array( - 'type' => 'text', - 'name' => 'null', - 'text' => __('Replace NULL with:') - ); - $this->properties['options'][] = array( - 'type' => 'end_group' - ); + // data options main group + $dataOptions = new OptionsPropertyMainGroup(); + $dataOptions->setName("data"); + $dataOptions->setText(__('Data dump options')); + $dataOptions->setForce(structure); + // create primary items and add them to the group + $leaf = new BoolPropertyItem(); + $leaf->setName("columns"); + $leaf->setText(__('Put columns names in the first row')); + $dataOptions->addProperty($leaf); + $leaf = new TextPropertyItem(); + $leaf->setName("data_caption"); + $leaf->setText(__('Table caption')); + $leaf->setDoc('faq6_27'); + $dataOptions->addProperty($leaf); + $leaf = new TextPropertyItem(); + $leaf->setName("data_continued_caption"); + $leaf->setText(__('Table caption (continued)')); + $leaf->setDoc('faq6_27'); + $dataOptions->addProperty($leaf); + $leaf = new TextPropertyItem(); + $leaf->setName("data_label"); + $leaf->setText(__('Label key')); + $leaf->setDoc('faq6_27'); + $dataOptions->addProperty($leaf); + $leaf = new TextPropertyItem(); + $leaf->setName('null'); + $leaf->setText(__('Replace NULL with:')); + $dataOptions->addProperty($leaf); + // add the main group to the root group + $exportSpecificOptions->addProperty($dataOptions); + + // set the options for the export plugin property item + $exportPluginProperties->setOptions($exportSpecificOptions); + $this->properties = $exportPluginProperties; } /** @@ -442,7 +436,7 @@ class ExportLatex extends ExportPlugin $dates = false ) { global $cfgRelation; - + $common_functions = PMA_CommonFunctions::getInstance(); $this->setCfgRelation($cfgRelation); From 1f23a10f538a1e8198e3bcea3007ecfdde2d889e Mon Sep 17 00:00:00 2001 From: Alex Marin Date: Wed, 18 Jul 2012 11:55:13 +0300 Subject: [PATCH 12/34] oop: use properties for ExportOds --- .../ExportOds.class.php | 72 +++++++++++-------- 1 file changed, 41 insertions(+), 31 deletions(-) rename libraries/plugins/export/{todo_change_properties => }/ExportOds.class.php (82%) diff --git a/libraries/plugins/export/todo_change_properties/ExportOds.class.php b/libraries/plugins/export/ExportOds.class.php similarity index 82% rename from libraries/plugins/export/todo_change_properties/ExportOds.class.php rename to libraries/plugins/export/ExportOds.class.php index ae320cc926..f599d86431 100644 --- a/libraries/plugins/export/todo_change_properties/ExportOds.class.php +++ b/libraries/plugins/export/ExportOds.class.php @@ -38,38 +38,48 @@ class ExportOds extends ExportPlugin */ protected function setProperties() { - $this->properties = array( - 'text' => __('Open Document Spreadsheet'), - 'extension' => 'ods', - 'mime_type' => 'application/vnd.oasis.opendocument.spreadsheet', - 'force_file' => true, - 'options' => array(), - 'options_text' => __('Options') - ); + $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/items/TextPropertyItem.class.php"; + require_once "$props/options/items/BoolPropertyItem.class.php"; + require_once "$props/options/items/HiddenPropertyItem.class.php"; - $this->properties['options'] = array( - array( - 'type' => 'begin_group', - 'name' => 'general_opts' - ), - array( - 'type' => 'text', - 'name' => 'null', - 'text' => __('Replace NULL with:') - ), - array( - 'type' => 'bool', - 'name' => 'columns', - 'text' => __('Put columns names in the first row') - ), - array( - 'type' => 'hidden', - 'name' => 'structure_or_data' - ), - array( - 'type' => 'end_group' - ) - ); + $exportPluginProperties = new ExportPluginProperties(); + $exportPluginProperties->setText('Open Document Spreadsheet'); + $exportPluginProperties->setExtension('ods'); + $exportPluginProperties->setMimeType('application/vnd.oasis.opendocument.spreadsheet'); + $exportPluginProperties->setForceFile(true); + $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"); + // create primary items and add them to the group + $leaf = new TextPropertyItem(); + $leaf->setName("null"); + $leaf->setText(__('Replace NULL with:')); + $generalOptions->addProperty($leaf); + $leaf = new BoolPropertyItem(); + $leaf->setName("columns"); + $leaf->setText(__('Put columns names in the first row')); + $generalOptions->addProperty($leaf); + $leaf = new HiddenPropertyItem(); + $leaf->setName("structure_or_data"); + $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; } /** From 05e0bd9756f00283654542aed16b2d0c97913d96 Mon Sep 17 00:00:00 2001 From: Alex Marin Date: Wed, 18 Jul 2012 12:13:12 +0300 Subject: [PATCH 13/34] oop: use properties for ExportOdt --- .../plugins/export/ExportLatex.class.php | 2 +- .../ExportOdt.class.php | 149 +++++++++--------- 2 files changed, 78 insertions(+), 73 deletions(-) rename libraries/plugins/export/{todo_change_properties => }/ExportOdt.class.php (85%) diff --git a/libraries/plugins/export/ExportLatex.class.php b/libraries/plugins/export/ExportLatex.class.php index 77f9746900..43c9677d4f 100644 --- a/libraries/plugins/export/ExportLatex.class.php +++ b/libraries/plugins/export/ExportLatex.class.php @@ -152,7 +152,7 @@ class ExportLatex extends ExportPlugin $dataOptions = new OptionsPropertyMainGroup(); $dataOptions->setName("data"); $dataOptions->setText(__('Data dump options')); - $dataOptions->setForce(structure); + $dataOptions->setForce('structure'); // create primary items and add them to the group $leaf = new BoolPropertyItem(); $leaf->setName("columns"); diff --git a/libraries/plugins/export/todo_change_properties/ExportOdt.class.php b/libraries/plugins/export/ExportOdt.class.php similarity index 85% rename from libraries/plugins/export/todo_change_properties/ExportOdt.class.php rename to libraries/plugins/export/ExportOdt.class.php index eca4ae1481..2667c0b38c 100644 --- a/libraries/plugins/export/todo_change_properties/ExportOdt.class.php +++ b/libraries/plugins/export/ExportOdt.class.php @@ -46,86 +46,91 @@ class ExportOdt extends ExportPlugin $hide_structure = true; } - $this->properties = array( - 'text' => __('Open Document Text'), - 'extension' => 'odt', - 'mime_type' => 'application/vnd.oasis.opendocument.text', - 'force_file' => true, - 'options' => array(), - 'options_text' => __('Options') - ); + $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/items/TextPropertyItem.class.php"; + require_once "$props/options/items/BoolPropertyItem.class.php"; + require_once "$props/options/items/HiddenPropertyItem.class.php"; - /* what to dump (structure/data/both) */ - $this->properties['options'][] = array( - 'type' => 'begin_group', - 'text' => __('Dump table'), - 'name' => 'general_opts' - ); - $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_group' - ); + $exportPluginProperties = new ExportPluginProperties(); + $exportPluginProperties->setText('Open Document Text'); + $exportPluginProperties->setExtension('odt'); + $exportPluginProperties->setMimeType('application/vnd.oasis.opendocument.text'); + $exportPluginProperties->setForceFile(true); + $exportPluginProperties->setOptionsText(__('Options')); - /* Structure 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"); + + // what to dump (structure/data/both) main group + $dumpWhat = new OptionsPropertyMainGroup(); + $dumpWhat->setName("general_opts"); + $dumpWhat->setText(__('Dump table')); + // create primary items and add them to the group + $leaf = new RadioPropertyItem(); + $leaf->setName("structure_or_data"); + $leaf->setValues(array( + 'structure' => __('structure'), + 'data' => __('data'), + 'structure_and_data' => __('structure and data') + )); + $dumpWhat->addProperty($leaf); + // add the main group to the root group + $exportSpecificOptions->addProperty($dumpWhat); + + + // structure options main group if (! $hide_structure) { - $this->properties['options'][] = array( - 'type' => 'begin_group', - 'name' => 'structure', - 'text' => __('Object creation options'), - 'force' => 'data' - ); + $structureOptions = new OptionsPropertyMainGroup(); + $structureOptions->setName("structure"); + $structureOptions->setText(__('Object creation options')); + $structureOptions->setForce('data'); + // create primary items and add them to the group if (! empty($GLOBALS['cfgRelation']['relation'])) { - $this->properties['options'][] = array( - 'type' => 'bool', - 'name' => 'relation', - 'text' => __('Display foreign key relationships') - ); + $leaf = new BoolPropertyItem(); + $leaf->setName("relation"); + $leaf->setText(__('Display foreign key relationships')); + $structureOptions->addProperty($leaf); } - $this->properties['options'][] = array( - 'type' => 'bool', - 'name' => 'comments', - 'text' => __('Display comments') - ); + $leaf = new BoolPropertyItem(); + $leaf->setName("comments"); + $leaf->setText(__('Display comments')); + $structureOptions->addProperty($leaf); if (! empty($GLOBALS['cfgRelation']['mimework'])) { - $this->properties['options'][] = array( - 'type' => 'bool', - 'name' => 'mime', - 'text' => __('Display MIME types') - ); + $leaf = new BoolPropertyItem(); + $leaf->setName("mime"); + $leaf->setText(__('Display MIME types')); + $structureOptions->addProperty($leaf); } - $this->properties['options'][] = array( - 'type' => 'end_group' - ); + // add the main group to the root group + $exportSpecificOptions->addProperty($structureOptions); } - /* Data */ - $this->properties['options'][] = array( - 'type' => 'begin_group', - 'name' => 'data', - 'text' => __('Data dump options'), - 'force' => 'structure' - ); - $this->properties['options'][] = array( - 'type' => 'bool', - 'name' => 'columns', - 'text' => __('Put columns names in the first row') - ); - $this->properties['options'][] = array( - 'type' => 'text', - 'name' => 'null', - 'text' => __('Replace NULL with:') - ); - $this->properties['options'][] = array( - 'type' => 'end_group' - ); + // data options main group + $dataOptions = new OptionsPropertyMainGroup(); + $dataOptions->setName("data"); + $dataOptions->setText(__('Data dump options')); + $dataOptions->setForce('structure'); + // create primary items and add them to the group + $leaf = new BoolPropertyItem(); + $leaf->setName("columns"); + $leaf->setText(__('Put columns names in the first row')); + $dataOptions->addProperty($leaf); + $leaf = new TextPropertyItem(); + $leaf->setName('null'); + $leaf->setText(__('Replace NULL with:')); + $dataOptions->addProperty($leaf); + // add the main group to the root group + $exportSpecificOptions->addProperty($dataOptions); + + // set the options for the export plugin property item + $exportPluginProperties->setOptions($exportSpecificOptions); + $this->properties = $exportPluginProperties; } /** @@ -386,7 +391,7 @@ class ExportOdt extends ExportPlugin * @param bool $add_semicolon whether to add semicolon and end-of-line at * the end * @param bool $view whether we're handling a view - * + * * @return bool true */ public function getTableDef( From 9f53828dca0c356aa3a20434323a82f4bb4277b6 Mon Sep 17 00:00:00 2001 From: Alex Marin Date: Wed, 18 Jul 2012 12:18:37 +0300 Subject: [PATCH 14/34] oop: use properties for ExportPdf --- .../ExportPdf.class.php | 76 +++++++++++-------- 1 file changed, 43 insertions(+), 33 deletions(-) rename libraries/plugins/export/{todo_change_properties => }/ExportPdf.class.php (68%) diff --git a/libraries/plugins/export/todo_change_properties/ExportPdf.class.php b/libraries/plugins/export/ExportPdf.class.php similarity index 68% rename from libraries/plugins/export/todo_change_properties/ExportPdf.class.php rename to libraries/plugins/export/ExportPdf.class.php index 9aa41553f8..df3867f518 100644 --- a/libraries/plugins/export/todo_change_properties/ExportPdf.class.php +++ b/libraries/plugins/export/ExportPdf.class.php @@ -65,40 +65,50 @@ class ExportPdf extends ExportPlugin */ protected function setProperties() { - $this->properties = array( - 'text' => __('PDF'), - 'extension' => 'pdf', - 'mime_type' => 'application/pdf', - 'force_file' => true, - 'options' => array(), - 'options_text' => __('Options') - ); + $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/items/MessageOnlyPropertyItem.class.php"; + require_once "$props/options/items/TextPropertyItem.class.php"; + require_once "$props/options/items/HiddenPropertyItem.class.php"; - $this->properties['options'] = array( - array( - 'type' => 'begin_group', - 'name' => 'general_opts' - ), - array( - 'type' => 'message_only', - 'name' => 'explanation', - 'text' => __( - '(Generates a report containing the data of a single table)' - ) - ), - array( - 'type' => 'text', - 'name' => 'report_title', - 'text' => __('Report title:') - ), - array( - 'type' => 'hidden', - 'name' => 'structure_or_data' - ), - array( - 'type' => 'end_group' - ) - ); + $exportPluginProperties = new ExportPluginProperties(); + $exportPluginProperties->setText('PDF'); + $exportPluginProperties->setExtension('pdf'); + $exportPluginProperties->setMimeType('application/pdf'); + $exportPluginProperties->setForceFile(true); + $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"); + // create primary items and add them to the group + $leaf = new MessageOnlyPropertyItem(); + $leaf->setName("explanation"); + $leaf->setText(__( + '(Generates a report containing the data of a single table)' + )); + $generalOptions->addProperty($leaf); + $leaf = new TextPropertyItem(); + $leaf->setName("report_title"); + $leaf->setText(__('Report title:')); + $generalOptions->addProperty($leaf); + $leaf = new HiddenPropertyItem(); + $leaf->setName("structure_or_data"); + $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; } /** From b672d605e21f2dd4efe0f8bde7de131ea42a3050 Mon Sep 17 00:00:00 2001 From: Alex Marin Date: Wed, 18 Jul 2012 17:29:23 +0300 Subject: [PATCH 15/34] oop: use properties for ExportPhparray --- .../ExportPhparray.class.php | 50 +++++++++++-------- 1 file changed, 30 insertions(+), 20 deletions(-) rename libraries/plugins/export/{todo_change_properties => }/ExportPhparray.class.php (76%) diff --git a/libraries/plugins/export/todo_change_properties/ExportPhparray.class.php b/libraries/plugins/export/ExportPhparray.class.php similarity index 76% rename from libraries/plugins/export/todo_change_properties/ExportPhparray.class.php rename to libraries/plugins/export/ExportPhparray.class.php index f739fd21a4..c1116d3906 100644 --- a/libraries/plugins/export/todo_change_properties/ExportPhparray.class.php +++ b/libraries/plugins/export/ExportPhparray.class.php @@ -35,27 +35,37 @@ class ExportPhparray extends ExportPlugin */ protected function setProperties() { - $this->properties = array( - 'text' => __('PHP array'), - 'extension' => 'php', - 'mime_type' => 'text/plain', - 'options' => array(), - 'options_text' => __('Options') - ); + $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/items/HiddenPropertyItem.class.php"; - $this->properties['options'] = array( - array( - 'type' => 'begin_group', - 'name' => 'general_opts' - ), - array( - 'type' => 'hidden', - 'name' => 'structure_or_data', - ), - array( - 'type' => 'end_group' - ) - ); + $exportPluginProperties = new ExportPluginProperties(); + $exportPluginProperties->setText('PHP array'); + $exportPluginProperties->setExtension('php'); + $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"); + // create primary items and add them to the group + $leaf = new HiddenPropertyItem(); + $leaf->setName("structure_or_data"); + $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; } /** From bbee588f956c991e266ef7ae9687601ffa7fb266 Mon Sep 17 00:00:00 2001 From: Alex Marin Date: Wed, 18 Jul 2012 17:32:10 +0300 Subject: [PATCH 16/34] oop: use properties for ExportYaml --- .../ExportYaml.class.php | 52 +++++++++++-------- 1 file changed, 31 insertions(+), 21 deletions(-) rename libraries/plugins/export/{todo_change_properties => }/ExportYaml.class.php (72%) diff --git a/libraries/plugins/export/todo_change_properties/ExportYaml.class.php b/libraries/plugins/export/ExportYaml.class.php similarity index 72% rename from libraries/plugins/export/todo_change_properties/ExportYaml.class.php rename to libraries/plugins/export/ExportYaml.class.php index 2ac51c6b05..9c084e6b92 100644 --- a/libraries/plugins/export/todo_change_properties/ExportYaml.class.php +++ b/libraries/plugins/export/ExportYaml.class.php @@ -35,28 +35,38 @@ class ExportYaml extends ExportPlugin */ protected function setProperties() { - $this->properties = array( - 'text' => 'YAML', - 'extension' => 'yml', - 'mime_type' => 'text/yaml', - 'force_file' => true, - 'options' => array(), - 'options_text' => __('Options') - ); + $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/items/HiddenPropertyItem.class.php"; - $this->properties['options'] = array( - array( - 'type' => 'begin_group', - 'name' => 'general_opts' - ), - array( - 'type' => 'hidden', - 'name' => 'structure_or_data', - ), - array( - 'type' => 'end_group' - ) - ); + $exportPluginProperties = new ExportPluginProperties(); + $exportPluginProperties->setText('YAML'); + $exportPluginProperties->setExtension('yml'); + $exportPluginProperties->setMimeType('text/yaml'); + $exportPluginProperties->setForceFile(true); + $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"); + // create primary items and add them to the group + $leaf = new HiddenPropertyItem(); + $leaf->setName("structure_or_data"); + $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; } /** From afebe60cdbb575151783428c6a2f73e24bf062a3 Mon Sep 17 00:00:00 2001 From: Alex Marin Date: Wed, 18 Jul 2012 17:37:41 +0300 Subject: [PATCH 17/34] oop: use properties for ExportTexytext --- .../ExportTexytext.class.php | 101 ++++++++++-------- 1 file changed, 55 insertions(+), 46 deletions(-) rename libraries/plugins/export/{todo_change_properties => }/ExportTexytext.class.php (85%) diff --git a/libraries/plugins/export/todo_change_properties/ExportTexytext.class.php b/libraries/plugins/export/ExportTexytext.class.php similarity index 85% rename from libraries/plugins/export/todo_change_properties/ExportTexytext.class.php rename to libraries/plugins/export/ExportTexytext.class.php index 7fcbc7117f..be87426a02 100644 --- a/libraries/plugins/export/todo_change_properties/ExportTexytext.class.php +++ b/libraries/plugins/export/ExportTexytext.class.php @@ -35,53 +35,62 @@ class ExportTexytext extends ExportPlugin */ protected function setProperties() { - $this->properties = array( - 'text' => __('Texy! text'), - 'extension' => 'txt', - 'mime_type' => 'text/plain', - 'options' => array(), - 'options_text' => __('Options') - ); + $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/items/RadioPropertyItem.class.php"; + require_once "$props/options/items/BoolPropertyItem.class.php"; + require_once "$props/options/items/TextPropertyItem.class.php"; - $this->properties['options'] = array( - /* what to dump (structure/data/both) */ - array( - 'type' => 'begin_group', - 'text' => __('Dump table'), - 'name' => 'general_opts' - ), - array( - 'type' => 'radio', - 'name' => 'structure_or_data', - 'values' => array( - 'structure' => __('structure'), - 'data' => __('data'), - 'structure_and_data' => __('structure and data') - ) - ), - array( - 'type' => 'end_group' - ), - array( - 'type' => 'begin_group', - 'name' => 'data', - 'text' => __('Data dump options'), - 'force' => 'structure' - ), - array( - 'type' => 'text', - 'name' => 'null', - 'text' => __('Replace NULL by') - ), - array( - 'type' => 'bool', - 'name' => 'columns', - 'text' => __('Put columns names in the first row') - ), - array( - 'type' => 'end_group' - ) - ); + $exportPluginProperties = new ExportPluginProperties(); + $exportPluginProperties->setText('Texy! text'); + $exportPluginProperties->setExtension('txt'); + $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"); + + // what to dump (structure/data/both) main group + $dumpWhat = new OptionsPropertyMainGroup(); + $dumpWhat->setName("general_opts"); + $dumpWhat->setText(__('Dump table')); + // create primary items and add them to the group + $leaf = new RadioPropertyItem(); + $leaf->setName("structure_or_data"); + $leaf->setValues(array( + 'structure' => __('structure'), + 'data' => __('data'), + 'structure_and_data' => __('structure and data') + )); + $dumpWhat->addProperty($leaf); + // add the main group to the root group + $exportSpecificOptions->addProperty($dumpWhat); + + // set the options for the export plugin property item + $exportPluginProperties->setOptions($exportSpecificOptions); + $this->properties = $exportPluginProperties; + + // data options main group + $dataOptions = new OptionsPropertyMainGroup(); + $dataOptions->setName("data"); + $dataOptions->setText(__('Data dump options')); + $dataOptions->setForce('structure'); + // create primary items and add them to the group + $leaf = new BoolPropertyItem(); + $leaf->setName("columns"); + $leaf->setText(__('Put columns names in the first row')); + $dataOptions->addProperty($leaf); + $leaf = new TextPropertyItem(); + $leaf->setName('null'); + $leaf->setText(__('Replace NULL with:')); + $dataOptions->addProperty($leaf); + // add the main group to the root group + $exportSpecificOptions->addProperty($dataOptions); } /** From 0aca1fabade528cab94b135cba55e924cbbc8ec4 Mon Sep 17 00:00:00 2001 From: Yasitha Pandithawatta Date: Mon, 23 Jul 2012 22:12:36 +0530 Subject: [PATCH 18/34] add create and drop database selenium test case --- test/classes/PMA_Types_MySQL_test.php | 4 +- .../PmaSeleniumCreateDropDatabaseTest.php | 41 +++++++++++++++++++ 2 files changed, 44 insertions(+), 1 deletion(-) create mode 100644 test/selenium/PmaSeleniumCreateDropDatabaseTest.php diff --git a/test/classes/PMA_Types_MySQL_test.php b/test/classes/PMA_Types_MySQL_test.php index f322b87cdd..3a44622d42 100644 --- a/test/classes/PMA_Types_MySQL_test.php +++ b/test/classes/PMA_Types_MySQL_test.php @@ -263,7 +263,7 @@ class PMA_Types_MySQL_test extends PHPUnit_Framework_TestCase public function testGetFunctionsClass($class, $output){ if (! defined('PMA_MYSQL_INT_VERSION')) { - define('PMA_MYSQL_INT_VERSION', 50000); + define('PMA_MYSQL_INT_VERSION', 60000); } $this->assertEquals( @@ -398,9 +398,11 @@ class PMA_Types_MySQL_test extends PHPUnit_Framework_TestCase '39' => 'SQRT', '40' => 'TAN', '41' => 'TO_DAYS', + '42' => 'TO_SECONDS', '43' => 'TIME_TO_SEC', '44' => 'UNCOMPRESSED_LENGTH', '45' => 'UNIX_TIMESTAMP', + '46' => 'UUID_SHORT', '47' => 'WEEK', '48' => 'WEEKDAY', '49' => 'WEEKOFYEAR', diff --git a/test/selenium/PmaSeleniumCreateDropDatabaseTest.php b/test/selenium/PmaSeleniumCreateDropDatabaseTest.php new file mode 100644 index 0000000000..d408158c39 --- /dev/null +++ b/test/selenium/PmaSeleniumCreateDropDatabaseTest.php @@ -0,0 +1,41 @@ +setBrowser(Helper::getBrowserString()); + $this->setBrowserUrl(TESTSUITE_PHPMYADMIN_HOST . TESTSUITE_PHPMYADMIN_URL); + } + + public function testCreateDropDatabase() + { + $log = new PmaSeleniumTestCase($this); + $log->login(TESTSUITE_USER, TESTSUITE_PASSWORD); + $this->selectFrame("frame_content"); + $this->click("link=Databases"); + $this->waitForPageToLoad("30000"); + $this->type("id=text_create_db", "pma"); + $this->click("id=buttonGo"); + $this->assertTrue($this->isTextPresent("pma")); + + $this->click("link=pma"); + $this->waitForPageToLoad("30000"); + $this->click("link=Operations"); + $this->waitForPageToLoad("30000"); + $this->click("id=drop_db_anchor"); + $this->click("//button[@type='button']"); + + } +} From 501d6e8a3717dd183035e1a269755279335a612f Mon Sep 17 00:00:00 2001 From: Yasitha Pandithawatta Date: Mon, 23 Jul 2012 23:03:35 +0530 Subject: [PATCH 19/34] add test case to the test suit --- test/AllSeleniumTests.php | 1 + test/libraries/PMA_bookmark_test.php | 8 ++++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/test/AllSeleniumTests.php b/test/AllSeleniumTests.php index 8efb1d9b5c..e1b6982a89 100644 --- a/test/AllSeleniumTests.php +++ b/test/AllSeleniumTests.php @@ -32,6 +32,7 @@ class AllSeleniumTests $suite->addTestSuite('PmaSeleniumLoginTest'); $suite->addTestSuite('PmaSeleniumXssTest'); $suite->addTestSuite('PmaSeleniumPrivilegesTest'); + $suite->addTestSuite('PmaSeleniumCreateDropDatabaseTest'); return $suite; } } diff --git a/test/libraries/PMA_bookmark_test.php b/test/libraries/PMA_bookmark_test.php index a8ea3189f4..e6716faaad 100644 --- a/test/libraries/PMA_bookmark_test.php +++ b/test/libraries/PMA_bookmark_test.php @@ -30,8 +30,8 @@ class PMA_bookmark_test extends PHPUnit_Framework_TestCase function PMA_DBI_fetch_result() { return array( - 'id' => 'id', - 'label' => 'label' + 'table1', + 'table2' ); } } @@ -68,8 +68,8 @@ class PMA_bookmark_test extends PHPUnit_Framework_TestCase public function testPMA_Bookmark_getList(){ $this->assertEquals( array( - 'id' => 'id (shared)', - 'label' => 'label (shared)' + 0 => 'table1 (shared)', + 1 => 'table2 (shared)' ), PMA_Bookmark_getList('phpmyadmin') ); From 2e18afde81d520e2482470fc095f981bd7f21b0a Mon Sep 17 00:00:00 2001 From: Julio Guerra Date: Mon, 23 Jul 2012 20:18:47 +0200 Subject: [PATCH 20/34] Translated using Weblate. --- po/gl.po | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/po/gl.po b/po/gl.po index 8900a58978..6ac3f72b44 100644 --- a/po/gl.po +++ b/po/gl.po @@ -4,8 +4,8 @@ msgstr "" "Project-Id-Version: phpMyAdmin 3.5.1-dev\n" "Report-Msgid-Bugs-To: phpmyadmin-devel@lists.sourceforge.net\n" "POT-Creation-Date: 2012-07-18 11:12+0200\n" -"PO-Revision-Date: 2012-07-19 15:41+0200\n" -"Last-Translator: Xosé \n" +"PO-Revision-Date: 2012-07-23 19:18-0000\n" +"Last-Translator: Xullo Guerra \n" "Language-Team: Galician \n" "Language: gl\n" "MIME-Version: 1.0\n" @@ -1862,7 +1862,7 @@ msgstr "Par achegarse, escolla unha sección da gráfica co rato." #: js/messages.php:306 msgid "Click reset zoom button to come back to original state." -msgstr "" +msgstr "Prema o botón de restaurar a amplación para voltar o estado orixinal." #: js/messages.php:308 msgid "Click a data point to view and possibly edit the data row." @@ -1956,7 +1956,7 @@ msgstr "Prema para marcar/desmarcar" #: js/messages.php:352 msgid "Double-click to copy column name" -msgstr "" +msgstr "Prema duas veces para copiar o nome da columna" #: js/messages.php:353 msgid "Click the drop-down arrow
    to toggle column's visibility" @@ -1989,7 +1989,7 @@ msgstr "Copiar nome da columna" #: js/messages.php:359 msgid "Right-click the column name to copy it to your clipboard." -msgstr "" +msgstr "Prema co botón dereito para copiar o nome da columna o portapapeis" #: js/messages.php:360 msgid "Show data row(s)" @@ -2287,7 +2287,7 @@ msgstr "Segundo" #: libraries/Advisor.class.php:67 #, php-format msgid "PHP threw following error: %s" -msgstr "" +msgstr "PHP mostrou o seguinte erro:%s" #: libraries/Advisor.class.php:89 #, php-format @@ -3494,7 +3494,7 @@ msgstr "" #: libraries/Types.class.php:359 msgid "A point in 2-dimensional space" -msgstr "" +msgstr "Un punto nun espacio bidimensonal" #: libraries/Types.class.php:361 msgid "A curve with linear interpolation between points" @@ -3508,15 +3508,15 @@ msgstr "Engadir un polígono" #: libraries/Types.class.php:365 msgid "A collection of points" -msgstr "" +msgstr "Unha colección de puntos" #: libraries/Types.class.php:367 msgid "A collection of curves with linear interpolation between points" -msgstr "" +msgstr "Unha coleccción de curvas con interpolación lineal entre puntos" #: libraries/Types.class.php:369 msgid "A collection of polygons" -msgstr "" +msgstr "Unha colección de poligonos" #: libraries/Types.class.php:371 msgid "A collection of geometry objects of any type" @@ -3525,7 +3525,7 @@ msgstr "" #: libraries/Types.class.php:623 libraries/Types.class.php:973 msgctxt "numeric types" msgid "Numeric" -msgstr "" +msgstr "Numérico" #: libraries/Types.class.php:642 libraries/Types.class.php:976 #, fuzzy @@ -3564,7 +3564,7 @@ msgstr "" #: libraries/Types.class.php:715 msgid "True or false" -msgstr "" +msgstr "Verdadeiro ou falso" #: libraries/Types.class.php:717 msgid "An alias for BIGINT NOT NULL AUTO_INCREMENT UNIQUE" @@ -9098,7 +9098,7 @@ msgstr "Texto completo" #: libraries/tbl_properties.inc.php:603 msgid "first" -msgstr "" +msgstr "Primeiro" #: libraries/tbl_properties.inc.php:613 #, fuzzy, php-format @@ -14003,7 +14003,6 @@ msgstr "concurrent_insert está definido como 0" #~ msgid "Click and drag the mouse to navigate the plot." #~ msgstr "Prema e arrastre o rato para navegar na gráfica ." -#, fuzzy #~| msgid "Linestring" #~ msgid "String" #~ msgstr "Cadea de liñas" @@ -14029,7 +14028,6 @@ msgstr "concurrent_insert está definido como 0" #~ msgid "Verbose multiple statements" #~ msgstr "Instrucións múltiplas extensas" -#, fuzzy #~| msgid "Data only" #~ msgid "Dates only." #~ msgstr "Só os datos" From 053c130bd7357bf39cd9e4a8a1df903c81c7018b Mon Sep 17 00:00:00 2001 From: Xavier Navarro Date: Tue, 24 Jul 2012 07:53:53 +0200 Subject: [PATCH 21/34] Translated using Weblate. --- po/ca.po | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/po/ca.po b/po/ca.po index 139fe23a4b..8f7c5d50d0 100644 --- a/po/ca.po +++ b/po/ca.po @@ -4,7 +4,7 @@ msgstr "" "Project-Id-Version: phpMyAdmin 4.0.0-dev\n" "Report-Msgid-Bugs-To: phpmyadmin-devel@lists.sourceforge.net\n" "POT-Creation-Date: 2012-07-18 11:12+0200\n" -"PO-Revision-Date: 2012-07-05 17:22+0200\n" +"PO-Revision-Date: 2012-07-23 17:19+0200\n" "Last-Translator: Xavier Navarro \n" "Language-Team: catalan \n" "Language: ca\n" @@ -3075,7 +3075,7 @@ msgstr "Jocs de caràcters" #: libraries/Menu.class.php:516 server_plugins.php:33 server_plugins.php:66 msgid "Plugins" -msgstr "" +msgstr "Complements" #: libraries/Menu.class.php:520 msgid "Engines" @@ -8562,15 +8562,15 @@ msgstr "Temps" #: libraries/rte/rte_triggers.lib.php:414 msgid "You must provide a trigger name" -msgstr "" +msgstr "Has de proveïr un nom de disparador" #: libraries/rte/rte_triggers.lib.php:419 msgid "You must provide a valid timing for the trigger" -msgstr "" +msgstr "Has de proveïr una sincronització vàlida pel disparador" #: libraries/rte/rte_triggers.lib.php:424 msgid "You must provide a valid event for the trigger" -msgstr "" +msgstr "Has de proveïr un event vàlid pel disparador" #: libraries/rte/rte_triggers.lib.php:430 msgid "You must provide a valid table name" @@ -8578,7 +8578,7 @@ msgstr "Has de donar un nom de taula vàlid" #: libraries/rte/rte_triggers.lib.php:436 msgid "You must provide a trigger definition." -msgstr "" +msgstr "Has de proveïr una definició de disparador." #: libraries/rte/rte_words.lib.php:22 msgid "Add routine" @@ -9142,7 +9142,7 @@ msgstr "Servidor de base de dades" #: main.php:200 msgid "Software" -msgstr "" +msgstr "Programari" #: main.php:204 msgid "Software version" @@ -9649,7 +9649,7 @@ msgstr "Veure volcat (esquema) de les bases de dades" #: server_plugins.php:67 msgid "Modules" -msgstr "" +msgstr "Mòduls" #: server_plugins.php:88 msgid "Begin" @@ -9657,15 +9657,15 @@ msgstr "Inici" #: server_plugins.php:95 msgid "Plugin" -msgstr "" +msgstr "Complement" #: server_plugins.php:96 server_plugins.php:130 msgid "Module" -msgstr "" +msgstr "Mòdul" #: server_plugins.php:97 server_plugins.php:132 msgid "Library" -msgstr "" +msgstr "Llibreria" #: server_plugins.php:98 server_plugins.php:133 tbl_tracking.php:720 msgid "Version" @@ -9673,11 +9673,11 @@ msgstr "Versió" #: server_plugins.php:99 server_plugins.php:134 msgid "Author" -msgstr "" +msgstr "Autor" #: server_plugins.php:100 server_plugins.php:135 msgid "License" -msgstr "" +msgstr "Licència" #: server_plugins.php:166 msgid "disabled" @@ -10379,11 +10379,11 @@ msgstr "Totes les variables d'estat" #: server_status.php:805 msgid "Monitor" -msgstr "" +msgstr "Monitorització" #: server_status.php:806 msgid "Advisor" -msgstr "" +msgstr "Assessorament" #: server_status.php:816 server_status.php:838 msgid "Refresh rate: " @@ -10403,7 +10403,7 @@ msgstr "Mostra només valors d'alerta" #: server_status.php:868 msgid "Filter by category..." -msgstr "" +msgstr "Filtrar per categoria..." #: server_status.php:881 msgid "Show unformatted values" From 0dcba3b217bc1837e45fca4b0ab0f045c32cf861 Mon Sep 17 00:00:00 2001 From: shanyan baishui Date: Tue, 24 Jul 2012 07:53:54 +0200 Subject: [PATCH 22/34] Translated using Weblate. --- po/zh_CN.po | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/po/zh_CN.po b/po/zh_CN.po index de4819b2cd..76188e6c62 100644 --- a/po/zh_CN.po +++ b/po/zh_CN.po @@ -4,7 +4,7 @@ msgstr "" "Project-Id-Version: phpMyAdmin 4.0.0-dev\n" "Report-Msgid-Bugs-To: phpmyadmin-devel@lists.sourceforge.net\n" "POT-Creation-Date: 2012-07-18 11:12+0200\n" -"PO-Revision-Date: 2012-07-21 08:15+0200\n" +"PO-Revision-Date: 2012-07-23 19:45+0200\n" "Last-Translator: shanyan baishui \n" "Language-Team: chinese_simplified \n" "Language: zh_CN\n" @@ -12338,7 +12338,7 @@ msgstr "" msgid "" "The query cache is enabled and the server receives %d queries per second. " "This rule fires if there is more than 100 queries per second." -msgstr "" +msgstr "查询缓存已启用且服务器每秒收到 %d 个查询。该规则在每秒超过 100 个查询时被触发。" #: libraries/advisory_rules.txt:160 #, php-format @@ -12365,30 +12365,29 @@ msgstr "查询缓存使用率" #: libraries/advisory_rules.txt:170 #, php-format msgid "Less than 80%% of the query cache is being utilized." -msgstr "" +msgstr "查询缓存使用不到 80%%。" #: libraries/advisory_rules.txt:171 msgid "" "This might be caused by {query_cache_limit} being too low. Flushing the " "query cache might help as well." -msgstr "" +msgstr "这可能是因为 {query_cache_limit} 太低所导致。刷新查询缓存可能会有帮助。" #: libraries/advisory_rules.txt:172 #, php-format msgid "" "The current ratio of free query cache memory to total query cache size is %s" "%%. It should be above 80%%" -msgstr "" +msgstr "当前空闲查询缓存内存为总查询缓存大小的 %s%%。此值应高于 80%%" #: libraries/advisory_rules.txt:174 msgid "Query cache fragmentation" msgstr "查询缓存碎片" #: libraries/advisory_rules.txt:177 -#, fuzzy #| msgid "The query cache is not enabled." msgid "The query cache is considerably fragmented." -msgstr "查询缓存没有启用。" +msgstr "查询缓存碎片化相当严重。" #: libraries/advisory_rules.txt:178 msgid "" From 464b4c2ed8d45f5706783413df33d0e6e62e4d5b Mon Sep 17 00:00:00 2001 From: Julio Guerra Date: Tue, 24 Jul 2012 07:53:55 +0200 Subject: [PATCH 23/34] Translated using Weblate. --- po/gl.po | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/po/gl.po b/po/gl.po index 6ac3f72b44..93b580f1d6 100644 --- a/po/gl.po +++ b/po/gl.po @@ -4,14 +4,14 @@ msgstr "" "Project-Id-Version: phpMyAdmin 3.5.1-dev\n" "Report-Msgid-Bugs-To: phpmyadmin-devel@lists.sourceforge.net\n" "POT-Creation-Date: 2012-07-18 11:12+0200\n" -"PO-Revision-Date: 2012-07-23 19:18-0000\n" -"Last-Translator: Xullo Guerra \n" +"PO-Revision-Date: 2012-07-23 20:21+0200\n" +"Last-Translator: Julio Guerra \n" "Language-Team: Galician \n" "Language: gl\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"Plural-Forms: nplurals=2; plural=n != 1;\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" "X-Generator: Weblate 1.1\n" #: browse_foreigners.php:36 browse_foreigners.php:60 js/messages.php:354 @@ -1989,7 +1989,7 @@ msgstr "Copiar nome da columna" #: js/messages.php:359 msgid "Right-click the column name to copy it to your clipboard." -msgstr "Prema co botón dereito para copiar o nome da columna o portapapeis" +msgstr "Prema co botón dereito para copiar o nome da columna o portapapeis." #: js/messages.php:360 msgid "Show data row(s)" From 85e26ed843ceedfd7e41b522bd07c9cdd1ca2277 Mon Sep 17 00:00:00 2001 From: Martin Lacina Date: Tue, 24 Jul 2012 14:32:13 +0200 Subject: [PATCH 24/34] Translated using Weblate. --- po/sk.po | 125 ++++++++++++++++++++++--------------------------------- 1 file changed, 49 insertions(+), 76 deletions(-) diff --git a/po/sk.po b/po/sk.po index 0142f7738f..39578863b0 100644 --- a/po/sk.po +++ b/po/sk.po @@ -4,7 +4,7 @@ msgstr "" "Project-Id-Version: phpMyAdmin 4.0.0-dev\n" "Report-Msgid-Bugs-To: phpmyadmin-devel@lists.sourceforge.net\n" "POT-Creation-Date: 2012-07-18 11:12+0200\n" -"PO-Revision-Date: 2012-07-13 13:53+0200\n" +"PO-Revision-Date: 2012-07-24 11:02+0200\n" "Last-Translator: Martin Lacina \n" "Language-Team: slovak \n" "Language: sk\n" @@ -1853,7 +1853,6 @@ msgid "To zoom in, select a section of the plot with the mouse." msgstr "Pre priblíženie kliknite na sekciu grafu." #: js/messages.php:306 -#, fuzzy #| msgid "Click reset zoom link to come back to original state." msgid "Click reset zoom button to come back to original state." msgstr "Kliknite na tlačidlo Obnoviť zoom na návrat do pôvodného stavu." @@ -2301,10 +2300,10 @@ msgid "" msgstr "" #: libraries/Advisor.class.php:378 -#, fuzzy, php-format +#, php-format #| msgid "Invalid format of CSV input on line %d." msgid "Invalid rule declaration on line %s" -msgstr "Chybný formát v CSV vstupe na riadku %d." +msgstr "Chybná deklarácia pravidla na riadku %s" #: libraries/Advisor.class.php:386 #, php-format @@ -2622,14 +2621,14 @@ msgstr[1] "Celkovo: %s výskyty" msgstr[2] "Celkovo: %s výskytov" #: libraries/DbSearch.class.php:351 -#, fuzzy, php-format +#, php-format #| msgid "%s match inside table %s" #| msgid_plural "%s matches inside table %s" msgid "%1$s match in %2$s" msgid_plural "%1$s matches in %2$s" -msgstr[0] "%s výskyt v tabuľke %s" -msgstr[1] "%s výskyty v tabuľke %s" -msgstr[2] "%s výskytov v tabuľke %s" +msgstr[0] "%1$s výskyt v %2$s" +msgstr[1] "%1$s výskyty v %2$s" +msgstr[2] "%1$s výskytov v %2$s" #: libraries/DbSearch.class.php:373 #, php-format @@ -2673,10 +2672,9 @@ msgid "Inside column:" msgstr "V tabuľke:" #: libraries/DisplayResults.class.php:679 -#, fuzzy #| msgid "Save directory" msgid "Save edited data" -msgstr "Adresár pre ukladanie" +msgstr "Uložiť zmeny" #: libraries/DisplayResults.class.php:685 msgid "Restore column order" @@ -2707,7 +2705,7 @@ msgid "vertical" msgstr "vertikálnom" #: libraries/DisplayResults.class.php:914 -#, fuzzy, php-format +#, php-format #| msgid "Headers every %s rows" msgid "Headers every %s rows" msgstr "Opakovať hlavičku každých %s riadkov" @@ -2777,17 +2775,15 @@ msgid "Show binary contents as HEX" msgstr "Zobraziť binárny obsah v HEX formáte" #: libraries/DisplayResults.class.php:1611 -#, fuzzy #| msgid "Browser transformation" msgid "Hide browser transformation" -msgstr "Transformácia pri prehliadaní" +msgstr "Skryť transformácie prehliadača" #: libraries/DisplayResults.class.php:1620 msgid "Well Known Text" msgstr "Text (Well Known Text)" #: libraries/DisplayResults.class.php:1621 -#, fuzzy msgid "Well Known Binary" msgstr "Well Known Binary" @@ -2920,10 +2916,9 @@ msgstr "Cookies musia byť povolené, pokiaľ chcete pokračovať." #: libraries/Header.class.php:500 #: libraries/plugins/auth/AuthenticationCookie.class.php:152 -#, fuzzy #| msgid "Cookies must be enabled past this point." msgid "Javascript must be enabled past this point" -msgstr "Cookies musia byť povolené, pokiaľ chcete pokračovať." +msgstr "Pokiaľ chcete pokračovať, Javascript musí byť povolený" #: libraries/Index.class.php:433 tbl_relation.php:540 msgid "No index defined!" @@ -3034,10 +3029,9 @@ msgid "Designer" msgstr "Dizajnér" #: libraries/Menu.class.php:470 -#, fuzzy #| msgid "User" msgid "Users" -msgstr "Používateľ" +msgstr "Používatelia" #: libraries/Menu.class.php:491 server_synchronize.php:1320 #: server_synchronize.php:1327 @@ -3131,16 +3125,16 @@ msgid "unknown table status: " msgstr "neznámy stav tabuľky: " #: libraries/Table.class.php:752 -#, fuzzy, php-format +#, php-format #| msgid "Source database" msgid "Source database `%s` was not found!" -msgstr "Zdrojová databáza" +msgstr "Zdrojová databáza `%s` nebola nájdená!" #: libraries/Table.class.php:760 -#, fuzzy, php-format +#, php-format #| msgid "Theme %s not found!" msgid "Target database `%s` was not found!" -msgstr "Vzhľad %s nebol nájdený!" +msgstr "Cieľová databáza `%s` nebola nájdená!" #: libraries/Table.class.php:1187 msgid "Invalid database" @@ -3156,10 +3150,10 @@ msgid "Error renaming table %1$s to %2$s" msgstr "Chyba pri premenovaní tabuľky %1$s na %2$s" #: libraries/Table.class.php:1252 -#, fuzzy, php-format +#, php-format #| msgid "Table %s has been renamed to %s" msgid "Table %1$s has been renamed to %2$s." -msgstr "Tabuľka %s bola premenovaná na %s" +msgstr "Tabuľka %1$s bola premenovaná na %2$s." #: libraries/Table.class.php:1396 msgid "Could not save table UI preferences" @@ -3200,16 +3194,14 @@ msgid "Value" msgstr "Hodnota" #: libraries/TableSearch.class.php:218 -#, fuzzy #| msgid "Search" msgid "Table Search" -msgstr "Hľadať" +msgstr "Hľadať v tabuľke" #: libraries/TableSearch.class.php:247 libraries/insert_edit.lib.php:1373 -#, fuzzy #| msgid "Insert" msgid "Edit/Insert" -msgstr "Vložiť" +msgstr "Upraviť/Vložiť" #: libraries/TableSearch.class.php:778 msgid "Select columns (at least one):" @@ -3232,7 +3224,6 @@ msgid "Use this column to label each point" msgstr "" #: libraries/TableSearch.class.php:877 -#, fuzzy #| msgid "Maximum number of rows to display" msgid "Maximum rows to plot" msgstr "Maximálny počet zobrazených riadkov" @@ -3243,16 +3234,15 @@ msgid "Browse foreign values" msgstr "Prejsť hodnoty cudzích kľúčov" #: libraries/TableSearch.class.php:994 -#, fuzzy #| msgid "Hide search criteria" msgid "Additional search criteria" -msgstr "Skryť parametre vyhľadávania" +msgstr "Rozšírené parametre vyhľadávania" #: libraries/TableSearch.class.php:1134 -#, fuzzy #| msgid "Do a \"query by example\" (wildcard: \"%\")" msgid "Do a \"query by example\" (wildcard: \"%\") for two different columns" -msgstr "Vykonať \"dopyt podľa príkladu\" (nahradzujúci znak: \"%\")" +msgstr "" +"Vykonať \"dopyt podľa príkladu\" (nahradzujúci znak: \"%\") pre dva rôzne stĺpce" #: libraries/TableSearch.class.php:1138 msgid "Do a \"query by example\" (wildcard: \"%\")" @@ -3269,10 +3259,9 @@ msgid "How to use" msgstr "Kontrolný užívateľ" #: libraries/TableSearch.class.php:1210 -#, fuzzy #| msgid "Reset" msgid "Reset zoom" -msgstr "Vynulovať" +msgstr "Zrušiť zoom" #: libraries/Theme.class.php:169 #, php-format @@ -3377,10 +3366,10 @@ msgid "An alias for BIGINT UNSIGNED NOT NULL AUTO_INCREMENT UNIQUE" msgstr "" #: libraries/Types.class.php:319 libraries/Types.class.php:721 -#, fuzzy, php-format +#, php-format #| msgid "Create version" msgid "A date, supported range is %1$s to %2$s" -msgstr "Vytvoriť verziu" +msgstr "Dátum, podporovaný rozsah je od %1$s do %2$s" #: libraries/Types.class.php:321 libraries/Types.class.php:723 #, php-format @@ -3394,10 +3383,10 @@ msgid "" msgstr "" #: libraries/Types.class.php:325 libraries/Types.class.php:727 -#, fuzzy, php-format +#, php-format #| msgid "Error renaming table %1$s to %2$s" msgid "A time, range is %1$s to %2$s" -msgstr "Chyba pri premenovaní tabuľky %1$s na %2$s" +msgstr "Čas, rozsah je od %1$s do %2$s" #: libraries/Types.class.php:327 msgid "" @@ -3502,10 +3491,9 @@ msgid "A curve with linear interpolation between points" msgstr "" #: libraries/Types.class.php:363 -#, fuzzy #| msgid "Add a polygon" msgid "A polygon" -msgstr "Pridať polygón" +msgstr "Polygón" #: libraries/Types.class.php:365 msgid "A collection of points" @@ -3529,18 +3517,16 @@ msgid "Numeric" msgstr "" #: libraries/Types.class.php:642 libraries/Types.class.php:976 -#, fuzzy #| msgid "Create an index" msgctxt "date and time types" msgid "Date and time" -msgstr "Vytvoriť nový index" +msgstr "Dátum a čas" #: libraries/Types.class.php:651 libraries/Types.class.php:979 -#, fuzzy #| msgid "Linestring" msgctxt "string types" msgid "String" -msgstr "Linka" +msgstr "Reťazec" #: libraries/Types.class.php:672 #, fuzzy @@ -3664,7 +3650,6 @@ msgid "Could not load default configuration from: %1$s" msgstr "Nepodarilo sa načítať prednastavenú konfiguráciu zo súboru: %1$s" #: libraries/common.inc.php:588 -#, fuzzy #| msgid "" #| "The $cfg['PmaAbsoluteUri'] directive MUST be set in your " #| "configuration file!" @@ -3672,7 +3657,7 @@ msgid "" "The [code]$cfg['PmaAbsoluteUri'][/code] directive MUST be set in your " "configuration file!" msgstr "" -"Direktíva $cfg['PmaAbsoluteUri'] MUSÍ byť nastavená v " +"Direktíva [code]$cfg['PmaAbsoluteUri'][/code] MUSÍ byť nastavená v " "konfiguračnom súbore!" #: libraries/common.inc.php:621 @@ -3998,10 +3983,9 @@ msgid "" msgstr "" #: libraries/config/messages.inc.php:37 -#, fuzzy #| msgid "Customize text input fields" msgid "Minimum size for input field" -msgstr "Prispôsobenie vstupných textových polí" +msgstr "Minimálna veľkosť vstupného poľa" #: libraries/config/messages.inc.php:38 msgid "" @@ -4010,10 +3994,9 @@ msgid "" msgstr "" #: libraries/config/messages.inc.php:39 -#, fuzzy #| msgid "Maximum size for temporary sort files" msgid "Maximum size for input field" -msgstr "Maximálna veľkosť dočasných zoraďovacích súborov" +msgstr "Maximálna veľkosť vstupného poľa" #: libraries/config/messages.inc.php:40 msgid "Number of columns for CHAR/VARCHAR textareas" @@ -4675,20 +4658,18 @@ msgid "Customize startup page" msgstr "Prispôsobenie úvodnej stránky" #: libraries/config/messages.inc.php:228 -#, fuzzy #| msgid "Database for user" msgid "Database structure" -msgstr "Databáza pre používateľa" +msgstr "Štruktúra databázy" #: libraries/config/messages.inc.php:229 msgid "Choose which details to show in the database structure (list of tables)" msgstr "" #: libraries/config/messages.inc.php:230 -#, fuzzy #| msgid "Database for user" msgid "Table structure" -msgstr "Databáza pre používateľa" +msgstr "Štruktúra tabuľky" #: libraries/config/messages.inc.php:231 msgid "Settings for the table structure (list of columns)" @@ -5081,10 +5062,9 @@ msgid "Memory limit" msgstr "Obmedzenie pamäte" #: libraries/config/messages.inc.php:325 -#, fuzzy #| msgid "These are Edit, Inline edit, Copy and Delete links" msgid "These are Edit, Copy and Delete links" -msgstr "Toto sú odkazy na Upraviť, Upraviť tu, Kopírovať a Odstrániť" +msgstr "Toto sú odkazy na Upraviť, Kopírovať a Odstrániť" #: libraries/config/messages.inc.php:326 msgid "Where to show the table row links" @@ -5688,7 +5668,6 @@ msgid "Automatically create versions" msgstr "Automaticky vytvárať verzie" #: libraries/config/messages.inc.php:449 -#, fuzzy #| msgid "" #| "ve blank for no user preferences storage in database, suggested: [kbd]" #| "_config[/kbd]" @@ -5697,7 +5676,7 @@ msgid "" "pma_userconfig[/kbd]" msgstr "" "Nechajte prázdne pre vypnutie možnosti ukladania užívateľských nastavení v " -"databáze. Odporúčaná hodnota: [kbd]pma_config[/kbd]" +"databáze. Odporúčaná hodnota: [kbd]pma_userconfig[/kbd]" #: libraries/config/messages.inc.php:450 msgid "User preferences storage table" @@ -6401,7 +6380,7 @@ msgstr "Formát:" #: libraries/display_export.lib.php:358 msgid "Format-specific options:" -msgstr "Voľby špecifické pre formáty:" +msgstr "Formát - špecifické voľby:" #: libraries/display_export.lib.php:359 msgid "" @@ -6549,7 +6528,7 @@ msgstr "Počet riadkov od začiatku, ktoré sa majú preskočiť:" #: libraries/display_import.lib.php:317 msgid "Format-Specific Options:" -msgstr "" +msgstr "Formát - špecifické voľby:" #: libraries/display_select_lang.lib.php:52 #: libraries/display_select_lang.lib.php:53 setup/frames/index.inc.php:75 @@ -9084,10 +9063,9 @@ msgid "General Settings" msgstr "Všeobecné nastavenia" #: main.php:121 -#, fuzzy #| msgid "MySQL connection collation" msgid "Server connection collation" -msgstr "Overenie MySQL spojenia" +msgstr "Znaková sada pre pripojenie k serveru" #: main.php:147 msgid "Appearance Settings" @@ -9877,7 +9855,7 @@ msgstr "" #: server_privileges.php:901 msgid "Login Information" -msgstr "Prihlásenie" +msgstr "Prihlasovacie informácie" #: server_privileges.php:1000 msgid "Do not change the password" @@ -9964,10 +9942,9 @@ msgid "Privileges for %s" msgstr "Oprávnenia" #: server_privileges.php:1739 -#, fuzzy #| msgid "User overview" msgid "Users overview" -msgstr "Prehľad používatelov" +msgstr "Zoznam používatelov" #: server_privileges.php:1879 server_privileges.php:2091 #: server_privileges.php:2443 @@ -10333,24 +10310,23 @@ msgstr "Stav serveru" #: server_status.php:804 msgid "All status variables" -msgstr "" +msgstr "Stav všetkých premenných" #: server_status.php:805 msgid "Monitor" -msgstr "" +msgstr "Monitor" #: server_status.php:806 msgid "Advisor" -msgstr "" +msgstr "Poradca" #: server_status.php:816 server_status.php:838 msgid "Refresh rate: " msgstr "Obnovovacia frekvencia: " #: server_status.php:851 server_variables.php:116 -#, fuzzy msgid "Filters" -msgstr "Filter" +msgstr "Filtre" #: server_status.php:859 server_variables.php:118 msgid "Containing the word:" @@ -10377,16 +10353,14 @@ msgid "Related links:" msgstr "Súvisiace odkazy:" #: server_status.php:920 -#, fuzzy #| msgid "Query type" msgid "Run analyzer" -msgstr "Typ dopytu" +msgstr "Spustiť analyzátor" #: server_status.php:921 -#, fuzzy #| msgid "Introduction" msgid "Instructions" -msgstr "Úvod" +msgstr "Inštrukcie" #: server_status.php:928 msgid "" @@ -11478,7 +11452,6 @@ msgid "Target database has been synchronized with source database" msgstr "" #: server_synchronize.php:1191 -#, fuzzy #| msgid "Issued queries" msgid "Executed queries" msgstr "Vykonaných dopytov" From 854d198191299b4b248268ada1dd96b96aaf0703 Mon Sep 17 00:00:00 2001 From: Alex Marin Date: Tue, 24 Jul 2012 16:21:04 +0300 Subject: [PATCH 25/34] remove unused variable --- db_operations.php | 1 - 1 file changed, 1 deletion(-) diff --git a/db_operations.php b/db_operations.php index d58a8d2f84..8f6d027797 100644 --- a/db_operations.php +++ b/db_operations.php @@ -142,7 +142,6 @@ if (strlen($db) && (! empty($db_rename) || ! empty($db_copy))) { "sql", 'libraries/plugins/export/', array( - 'export_type' => $export_type, 'single_table' => isset($single_table) ) ); From 6b7331e9efa0e8b38da1a04d8b10a65060f44c76 Mon Sep 17 00:00:00 2001 From: Alex Marin Date: Tue, 24 Jul 2012 16:45:38 +0300 Subject: [PATCH 26/34] oop: use properties for ExportMediawiki --- .../ExportMediawiki.class.php | 95 ++++++++++--------- 1 file changed, 49 insertions(+), 46 deletions(-) rename libraries/plugins/export/{todo_change_properties => }/ExportMediawiki.class.php (78%) diff --git a/libraries/plugins/export/todo_change_properties/ExportMediawiki.class.php b/libraries/plugins/export/ExportMediawiki.class.php similarity index 78% rename from libraries/plugins/export/todo_change_properties/ExportMediawiki.class.php rename to libraries/plugins/export/ExportMediawiki.class.php index eed2ad2c92..3bbf8e8d21 100644 --- a/libraries/plugins/export/todo_change_properties/ExportMediawiki.class.php +++ b/libraries/plugins/export/ExportMediawiki.class.php @@ -35,59 +35,62 @@ class ExportMediawiki extends ExportPlugin */ protected function setProperties() { - $this->properties = array( - 'text' => __('MediaWiki Table'), - 'extension' => 'mediawiki', - 'mime_type' => 'text/plain', - 'options' => array(), - 'options_text' => __('Options') - ); + $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"; - // general options - $this->properties['options'][] = array( - 'type' => 'begin_group', - 'name' => 'general_opts' - ); + $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"); // 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(); + $leaf = new MessageOnlyPropertyItem(); + $leaf->setText(__('Dump table')); + $subgroup->setSubgroupHeader($leaf); + $leaf = new RadioPropertyItem(); + $leaf->setName('structure_or_data'); + $leaf->setValues(array( + 'structure' => __('structure'), + 'data' => __('data'), + 'structure_and_data' => __('structure and data') + )); + $subgroup->addProperty($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') - ); + $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); - // end general options - $this->properties['options'][] = array( - 'type' => 'end_group' - ); + // set the options for the export plugin property item + $exportPluginProperties->setOptions($exportSpecificOptions); + $this->properties = $exportPluginProperties; } /** From aef3d70ac802bbfbd7b1e474f51d860ffa207795 Mon Sep 17 00:00:00 2001 From: Alex Marin Date: Wed, 25 Jul 2012 11:02:54 +0300 Subject: [PATCH 27/34] oop: fix properties for ExportMediawiki --- libraries/plugin_interface.lib.php | 80 ++++++++++++------- .../plugins/export/ExportMediawiki.class.php | 7 +- 2 files changed, 54 insertions(+), 33 deletions(-) diff --git a/libraries/plugin_interface.lib.php b/libraries/plugin_interface.lib.php index 873945ef68..f387cd2407 100644 --- a/libraries/plugin_interface.lib.php +++ b/libraries/plugin_interface.lib.php @@ -228,33 +228,53 @@ function PMA_pluginGetOneOption( $ret = "\n"; if (! $is_subgroup) { - // for main groups - $ret .= '
    '; - if ($propertyGroup->getText() != null) { - $ret .= '

    ' . PMA_getString($propertyGroup->getText()) . '

    '; + // for subgroup headers + if (strpos(get_class($propertyGroup), "PropertyItem")) { + $properties = array($propertyGroup); + } else { + // for main groups + $ret .= '
    '; + if ($propertyGroup->getText() != null) { + $ret .= '

    ' . PMA_getString($propertyGroup->getText()) . '

    '; + } + $ret .= '
      '; } - $ret .= '
        '; } + + if ($properties == null) { + $properties = $propertyGroup->getProperties(); + } + if (! strpos(get_class($propertyGroup), "PropertyItem")) foreach ($propertyGroup->getProperties() 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 .= '
      • getName() . '">'; + } else { + $ret .= '>'; + } + $ret .= PMA_pluginGetOneOption( $section, $plugin_name, $propertyItem, true - ) . '
      • '; - } else { - $ret .= '>'; - } + ); } else { // single property item switch ($property_class) { @@ -365,22 +385,24 @@ function PMA_pluginGetOneOption( $ret .= '
    '; } - $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] + ); + } } } diff --git a/libraries/plugins/export/ExportMediawiki.class.php b/libraries/plugins/export/ExportMediawiki.class.php index 3bbf8e8d21..b6d86478d4 100644 --- a/libraries/plugins/export/ExportMediawiki.class.php +++ b/libraries/plugins/export/ExportMediawiki.class.php @@ -59,12 +59,10 @@ class ExportMediawiki extends ExportPlugin // general options main group $generalOptions = new OptionsPropertyMainGroup(); $generalOptions->setName("general_opts"); + $generalOptions->setText(__('Dump table')); // what to dump (structure/data/both) $subgroup = new OptionsPropertySubgroup(); - $leaf = new MessageOnlyPropertyItem(); - $leaf->setText(__('Dump table')); - $subgroup->setSubgroupHeader($leaf); $leaf = new RadioPropertyItem(); $leaf->setName('structure_or_data'); $leaf->setValues(array( @@ -80,12 +78,13 @@ class ExportMediawiki extends ExportPlugin $leaf->setName("caption"); $leaf->setText(__('Export table names')); $generalOptions->addProperty($leaf); + // export table headers $leaf = new BoolPropertyItem(); $leaf->setName("caption"); $leaf->setText(__('Export table headers')); $generalOptions->addProperty($leaf); - // add the main group to the root group + //add the main group to the root group $exportSpecificOptions->addProperty($generalOptions); // set the options for the export plugin property item From 54213e16a8a7fd2f71d0f309ded1a9d7018b5038 Mon Sep 17 00:00:00 2001 From: Alex Marin Date: Wed, 25 Jul 2012 11:55:44 +0300 Subject: [PATCH 28/34] oop: use properties without subgroups for ExportSql --- .../ExportSql.class.php | 679 +++++++++--------- 1 file changed, 339 insertions(+), 340 deletions(-) rename libraries/plugins/export/{todo_change_properties => }/ExportSql.class.php (78%) diff --git a/libraries/plugins/export/todo_change_properties/ExportSql.class.php b/libraries/plugins/export/ExportSql.class.php similarity index 78% rename from libraries/plugins/export/todo_change_properties/ExportSql.class.php rename to libraries/plugins/export/ExportSql.class.php index 46e1d94943..b682988b8f 100644 --- a/libraries/plugins/export/todo_change_properties/ExportSql.class.php +++ b/libraries/plugins/export/ExportSql.class.php @@ -128,376 +128,375 @@ class ExportSql extends ExportPlugin $hide_structure = true; $hide_sql = true; } + if (! $hide_sql) { - $this->properties = array( - 'text' => __('SQL'), - 'extension' => 'sql', - 'mime_type' => 'text/x-sql', - 'options' => array(), - 'options_text' => __('Options') - ); + $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/BoolPropertyItem.class.php"; + require_once "$props/options/items/RadioPropertyItem.class.php"; + require_once "$props/options/items/SelectPropertyItem.class.php"; + require_once "$props/options/items/TextPropertyItem.class.php"; - $this->properties['options'][] = array( - 'type' => 'begin_group', - 'name' => 'general_opts' - ); + $exportPluginProperties = new ExportPluginProperties(); + $exportPluginProperties->setText('SQL'); + $exportPluginProperties->setExtension('sql'); + $exportPluginProperties->setMimeType('text/x-sql'); + $exportPluginProperties->setOptionsText(__('Options')); - /* comments */ - $this->properties['options'][] = array( - 'type' => 'begin_subgroup', - 'subgroup_header' => array( - 'type' => 'bool', - 'name' => 'include_comments', - 'text' => __( - 'Display comments (includes info such as export' - . ' timestamp, PHP version, and server version)' - ) - ) - ); - $this->properties['options'][] = array( - 'type' => 'text', - 'name' => 'header_comment', - 'text' => __('Additional custom header comment (\n splits lines):') - ); - $this->properties['options'][] = array( - 'type' => 'bool', - 'name' => 'dates', - 'text' => __( - 'Include a timestamp of when databases were created, last' - . ' updated, and last checked' - ) - ); - if (! empty($GLOBALS['cfgRelation']['relation'])) { - $this->properties['options'][] = array( - 'type' => 'bool', - 'name' => 'relation', - 'text' => __('Display foreign key relationships') - ); - } - if (! empty($GLOBALS['cfgRelation']['mimework'])) { - $this->properties['options'][] = array( - 'type' => 'bool', - 'name' => 'mime', - 'text' => __('Display MIME types') - ); - } - $this->properties['options'][] = array( - 'type' => 'end_subgroup' - ); - /* end comments */ + // 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"); - /* enclose in a transaction */ - $this->properties['options'][] = array( - 'type' => 'bool', - 'name' => 'use_transaction', - 'text' => __('Enclose export in a transaction'), - 'doc' => array( - 'programs', - 'mysqldump', - 'option_mysqldump_single-transaction' - ) - ); + // general options main group + $generalOptions = new OptionsPropertyMainGroup(); + $generalOptions->setName("general_opts"); - /* disable foreign key checks */ - $this->properties['options'][] = array( - 'type' => 'bool', - 'name' => 'disable_fk', - 'text' => __('Disable foreign key checks'), - 'doc' => array( - 'manual_MySQL_Database_Administration', - 'server-system-variables', - 'sysvar_foreign_key_checks' - ) - ); - /* compatibility maximization */ + +// /* comments */ +// $this->properties['options'][] = array( +// 'type' => 'begin_subgroup', +// 'subgroup_header' => array( +// 'type' => 'bool', +// 'name' => 'include_comments', +// 'text' => __( +// 'Display comments (includes info such as export' +// . ' timestamp, PHP version, and server version)' +// ) +// ) +// ); +// $this->properties['options'][] = array( +// 'type' => 'text', +// 'name' => 'header_comment', +// 'text' => __('Additional custom header comment (\n splits lines):') +// ); +// $this->properties['options'][] = array( +// 'type' => 'bool', +// 'name' => 'dates', +// 'text' => __( +// 'Include a timestamp of when databases were created, last' +// . ' updated, and last checked' +// ) +// ); +// if (! empty($GLOBALS['cfgRelation']['relation'])) { +// $this->properties['options'][] = array( +// 'type' => 'bool', +// 'name' => 'relation', +// 'text' => __('Display foreign key relationships') +// ); +// } +// if (! empty($GLOBALS['cfgRelation']['mimework'])) { +// $this->properties['options'][] = array( +// 'type' => 'bool', +// 'name' => 'mime', +// 'text' => __('Display MIME types') +// ); +// } +// $this->properties['options'][] = array( +// 'type' => 'end_subgroup' +// ); +// /* end comments */ + + // enclose in a transaction + $leaf = new BoolPropertyItem(); + $leaf->setName("use_transaction"); + $leaf->setText(__('Enclose export in a transaction')); + $leaf->setDoc(array( + 'programs', + 'mysqldump', + 'option_mysqldump_single-transaction' + )); + $generalOptions->addProperty($leaf); + + // disable foreign key checks + $leaf = new BoolPropertyItem(); + $leaf->setName("disable_fk"); + $leaf->setText(__('Disable foreign key checks')); + $leaf->setDoc(array( + 'manual_MySQL_Database_Administration', + 'server-system-variables', + 'sysvar_foreign_key_checks' + )); + $generalOptions->addProperty($leaf); + + // compatibility maximization $compats = PMA_DBI_getCompatibilities(); if (count($compats) > 0) { $values = array(); foreach ($compats as $val) { $values[$val] = $val; } - $this->properties['options'][] = array( - 'type' => 'select', - 'name' => 'compatibility', - 'text' => __( - 'Database system or older MySQL server to maximize output' - . ' compatibility with:' - ), - 'values' => $values, - 'doc' => array( - 'manual_MySQL_Database_Administration', - 'Server_SQL_mode' - ) - ); + + $leaf = new SelectPropertyItem(); + $leaf->setName("compatibility"); + $leaf->setText(__( + 'Database system or older MySQL server to maximize output' + . ' compatibility with:' + )); + $leaf->setValues($values); + $leaf->setDoc(array( + 'manual_MySQL_Database_Administration', + 'Server_SQL_mode' + )); + $generalOptions->addProperty($leaf); + unset($values); } - /* server export options */ + // server export options if ($plugin_param['export_type'] == 'server') { - $this->properties['options'][] = array( - 'type' => 'bool', - 'name' => 'drop_database', - 'text' => sprintf( - __('Add %s statement'), 'DROP DATABASE' - ) - ); + $leaf = new BoolPropertyItem(); + $leaf->setName("drop_database"); + $leaf->setText(sprintf( + __('Add %s statement'), 'DROP DATABASE' + )); + $generalOptions->addProperty($leaf); } - /* 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' - ); + // what to dump (structure/data/both) + $subgroup = new OptionsPropertySubgroup(); + $leaf = new RadioPropertyItem(); + $leaf->setName('structure_or_data'); + $leaf->setValues(array( + 'structure' => __('structure'), + 'data' => __('data'), + 'structure_and_data' => __('structure and data') + )); + $subgroup->addProperty($leaf); + $generalOptions->addProperty($subgroup); - $this->properties['options'][] = array( - 'type' => 'end_group' - ); + // add the main group to the root group + $exportSpecificOptions->addProperty($generalOptions); - /* begin Structure options */ + + // structure options main group if (! $hide_structure) { - $this->properties['options'][] = array( - 'type' => 'begin_group', - 'name' => 'structure', - 'text' => __('Object creation options'), - 'force' => 'data' - ); + $structureOptions = new OptionsPropertyMainGroup(); + $structureOptions->setName("structure"); + $structureOptions->setText(__('Object creation options')); + $structureOptions->setForce('data'); - /* begin SQL Statements */ - $this->properties['options'][] = array( - 'type' => 'begin_subgroup', - 'subgroup_header' => array( - 'type' => 'message_only', - 'name' => 'add_statements', - 'text' => __('Add statements:') - ) - ); - if ($plugin_param['export_type'] == 'table') { - if (PMA_Table::isView($GLOBALS['db'], $GLOBALS['table'])) { - $drop_clause = 'DROP VIEW'; - } else { - $drop_clause = 'DROP TABLE'; - } - } else { - if (PMA_DRIZZLE) { - $drop_clause = 'DROP TABLE'; - } else { - $drop_clause = 'DROP TABLE / VIEW / PROCEDURE' - . ' / FUNCTION'; - if (PMA_MYSQL_INT_VERSION > 50100) { - $drop_clause .= ' / EVENT'; - } - } - } - $this->properties['options'][] = array( - 'type' => 'bool', - 'name' => 'drop_table', - 'text' => sprintf(__('Add %s statement'), $drop_clause) - ); - // Drizzle doesn't support procedures and functions - if (! PMA_DRIZZLE) { - $this->properties['options'][] = array( - 'type' => 'bool', - 'name' => 'procedure_function', - 'text' => sprintf( - __('Add %s statement'), - 'CREATE PROCEDURE / FUNCTION' - . (PMA_MYSQL_INT_VERSION > 50100 - ? ' / EVENT' : '') - ) - ); - } +// // begin SQL Statements +// $this->properties['options'][] = array( +// 'type' => 'begin_subgroup', +// 'subgroup_header' => array( +// 'type' => 'message_only', +// 'name' => 'add_statements', +// 'text' => __('Add statements:') +// ) +// ); +// if ($plugin_param['export_type'] == 'table') { +// if (PMA_Table::isView($GLOBALS['db'], $GLOBALS['table'])) { +// $drop_clause = 'DROP VIEW'; +// } else { +// $drop_clause = 'DROP TABLE'; +// } +// } else { +// if (PMA_DRIZZLE) { +// $drop_clause = 'DROP TABLE'; +// } else { +// $drop_clause = 'DROP TABLE / VIEW / PROCEDURE' +// . ' / FUNCTION'; +// if (PMA_MYSQL_INT_VERSION > 50100) { +// $drop_clause .= ' / EVENT'; +// } +// } +// } +// $this->properties['options'][] = array( +// 'type' => 'bool', +// 'name' => 'drop_table', +// 'text' => sprintf(__('Add %s statement'), $drop_clause) +// ); +// // Drizzle doesn't support procedures and functions +// if (! PMA_DRIZZLE) { +// $this->properties['options'][] = array( +// 'type' => 'bool', +// 'name' => 'procedure_function', +// 'text' => sprintf( +// __('Add %s statement'), +// 'CREATE PROCEDURE / FUNCTION' +// . (PMA_MYSQL_INT_VERSION > 50100 +// ? ' / EVENT' : '') +// ) +// ); +// } +// +// /* begin CREATE TABLE statements*/ +// $this->properties['options'][] = array( +// 'type' => 'begin_subgroup', +// 'subgroup_header' => array( +// 'type' => 'bool', +// 'name' => 'create_table_statements', +// 'text' => __('CREATE TABLE options:') +// ) +// ); +// $this->properties['options'][] = array( +// 'type' => 'bool', +// 'name' => 'if_not_exists', +// 'text' => 'IF NOT EXISTS' +// ); +// $this->properties['options'][] = array( +// 'type' => 'bool', +// 'name' => 'auto_increment', +// 'text' => 'AUTO_INCREMENT' +// ); +// $this->properties['options'][] = array( +// 'type' => 'end_subgroup' +// ); +// /* end CREATE TABLE statements */ +// +// $this->properties['options'][] = array( +// 'type' => 'end_subgroup' +// ); +// /* end SQL statements */ - /* begin CREATE TABLE statements*/ - $this->properties['options'][] = array( - 'type' => 'begin_subgroup', - 'subgroup_header' => array( - 'type' => 'bool', - 'name' => 'create_table_statements', - 'text' => __('CREATE TABLE options:') - ) - ); - $this->properties['options'][] = array( - 'type' => 'bool', - 'name' => 'if_not_exists', - 'text' => 'IF NOT EXISTS' - ); - $this->properties['options'][] = array( - 'type' => 'bool', - 'name' => 'auto_increment', - 'text' => 'AUTO_INCREMENT' - ); - $this->properties['options'][] = array( - 'type' => 'end_subgroup' - ); - /* end CREATE TABLE statements */ + $leaf = new BoolPropertyItem(); + $leaf->setName("backquotes"); + $leaf->setText(__( + 'Enclose table and column names with backquotes ' + . '(Protects column and table names formed with' + . ' special characters or keywords)' + )); - $this->properties['options'][] = array( - 'type' => 'end_subgroup' - ); - /* end SQL statements */ + $structureOptions->addProperty($leaf); - $this->properties['options'][] = array( - 'type' => 'bool', - 'name' => 'backquotes', - 'text' => __( - 'Enclose table and column names with backquotes ' - . '(Protects column and table names formed with' - . ' special characters or keywords)' - ) - ); - - $this->properties['options'][] = array( - 'type' => 'end_group' - ); + // add the main group to the root group + $exportSpecificOptions->addProperty($structureOptions); } - /* end Structure options */ - /* begin Data options */ - $this->properties['options'][] = array( - 'type' => 'begin_group', - 'name' => 'data', - 'text' => __('Data dump options'), - 'force' => 'structure' - ); - $this->properties['options'][] = array( - 'type' => 'bool', - 'name' => 'truncate', - 'text' => __('Truncate table before insert') - ); - /* begin SQL statements */ - $this->properties['options'][] = array( - 'type' => 'begin_subgroup', - 'subgroup_header' => array( - 'type' => 'message_only', - 'text' => __('Instead of INSERT statements, use:') - ) - ); - // Not supported in Drizzle - if (! PMA_DRIZZLE) { - $this->properties['options'][] = array( - 'type' => 'bool', - 'name' => 'delayed', - 'text' => __('INSERT DELAYED statements'), - 'doc' => array( - 'manual_MySQL_Database_Administration', - 'insert_delayed' - ) - ); - } - $this->properties['options'][] = array( - 'type' => 'bool', - 'name' => 'ignore', - 'text' => __('INSERT IGNORE statements'), - 'doc' => array( - 'manual_MySQL_Database_Administration', - 'insert' - ) - ); - $this->properties['options'][] = array( - 'type' => 'end_subgroup' - ); - /* end SQL statements */ - /* Function to use when dumping data */ - $this->properties['options'][] = array( - 'type' => 'select', - 'name' => 'type', - 'text' => __('Function to use when dumping data:'), - 'values' => array( - 'INSERT' => 'INSERT', - 'UPDATE' => 'UPDATE', - 'REPLACE' => 'REPLACE' - ) - ); + // begin Data options + $dataOptions = new OptionsPropertyMainGroup(); + $dataOptions->setName("data"); + $dataOptions->setText(__('Data creation options')); + $dataOptions->setForce('structure'); - /* Syntax to use when inserting data */ - $this->properties['options'][] = array( - 'type' => 'begin_subgroup', - 'subgroup_header' => array( - 'type' => 'message_only', - 'text' => __('Syntax to use when inserting data:') - ) - ); - $this->properties['options'][] = array( - 'type' => 'radio', - 'name' => 'insert_syntax', - 'values' => array( - 'complete' => __( - 'include column names in every INSERT statement' - . '
          Example: INSERT INTO' - . ' tbl_name (col_A,col_B,col_C) VALUES (1,2,3)' - ), - 'extended' => __( - 'insert multiple rows in every INSERT statement' - . '
          Example: INSERT INTO' - . ' tbl_name VALUES (1,2,3), (4,5,6), (7,8,9)' - ), - 'both' => __( - 'both of the above
          Example:' - . ' INSERT INTO tbl_name (col_A,col_B) VALUES (1,2,3),' - . ' (4,5,6), (7,8,9)' - ), - 'none' => __( - 'neither of the above
          Example:' - . ' INSERT INTO tbl_name VALUES (1,2,3)' - ) - ) - ); - $this->properties['options'][] = array( - 'type' => 'end_subgroup' - ); + $leaf = new BoolPropertyItem(); + $leaf->setName("truncate"); + $leaf->setText(__('Truncate table before insert')); + $dataOptions->addProperty($leaf); - /* Max length of query */ - $this->properties['options'][] = array( - 'type' => 'text', - 'name' => 'max_query_size', - 'text' => __('Maximal length of created query') - ); +// /* begin SQL statements */ +// $this->properties['options'][] = array( +// 'type' => 'begin_subgroup', +// 'subgroup_header' => array( +// 'type' => 'message_only', +// 'text' => __('Instead of INSERT statements, use:') +// ) +// ); +// // Not supported in Drizzle +// if (! PMA_DRIZZLE) { +// $this->properties['options'][] = array( +// 'type' => 'bool', +// 'name' => 'delayed', +// 'text' => __('INSERT DELAYED statements'), +// 'doc' => array( +// 'manual_MySQL_Database_Administration', +// 'insert_delayed' +// ) +// ); +// } +// $this->properties['options'][] = array( +// 'type' => 'bool', +// 'name' => 'ignore', +// 'text' => __('INSERT IGNORE statements'), +// 'doc' => array( +// 'manual_MySQL_Database_Administration', +// 'insert' +// ) +// ); +// $this->properties['options'][] = array( +// 'type' => 'end_subgroup' +// ); +// /* end SQL statements */ - /* Dump binary columns in hexadecimal */ - $this->properties['options'][] = array( - 'type' => 'bool', - 'name' => 'hex_for_blob', - 'text' => __( - 'Dump binary columns in hexadecimal notation' - . ' (for example, "abc" becomes 0x616263)' - ) - ); + // Function to use when dumping dat + $leaf = new SelectPropertyItem(); + $leaf->setName("type"); + $leaf->setText(__('Function to use when dumping data:')); + $leaf->setValues(array( + 'INSERT' => 'INSERT', + 'UPDATE' => 'UPDATE', + 'REPLACE' => 'REPLACE' + )); + $dataOptions->addProperty($leaf); + +// /* Syntax to use when inserting data */ +// $this->properties['options'][] = array( +// 'type' => 'begin_subgroup', +// 'subgroup_header' => array( +// 'type' => 'message_only', +// 'text' => __('Syntax to use when inserting data:') +// ) +// ); +// $this->properties['options'][] = array( +// 'type' => 'radio', +// 'name' => 'insert_syntax', +// 'values' => array( +// 'complete' => __( +// 'include column names in every INSERT statement' +// . '
          Example: INSERT INTO' +// . ' tbl_name (col_A,col_B,col_C) VALUES (1,2,3)' +// ), +// 'extended' => __( +// 'insert multiple rows in every INSERT statement' +// . '
          Example: INSERT INTO' +// . ' tbl_name VALUES (1,2,3), (4,5,6), (7,8,9)' +// ), +// 'both' => __( +// 'both of the above
          Example:' +// . ' INSERT INTO tbl_name (col_A,col_B) VALUES (1,2,3),' +// . ' (4,5,6), (7,8,9)' +// ), +// 'none' => __( +// 'neither of the above
          Example:' +// . ' INSERT INTO tbl_name VALUES (1,2,3)' +// ) +// ) +// ); +// $this->properties['options'][] = array( +// 'type' => 'end_subgroup' +// ); + + // Max length of query + $leaf = new TextPropertyItem(); + $leaf->setName("max_query_size"); + $leaf->setText(__('Maximal length of created query')); + $dataOptions->addProperty($leaf); + + // Dump binary columns in hexadecimal + $leaf = new BoolPropertyItem(); + $leaf->setName("hex_for_blob"); + $leaf->setText(__( + 'Dump binary columns in hexadecimal notation' + . ' (for example, "abc" becomes 0x616263)' + )); + $dataOptions->addProperty($leaf); // Drizzle works only with UTC timezone if (! PMA_DRIZZLE) { - /* Dump time in UTC */ - $this->properties['options'][] = array( - 'type' => 'bool', - 'name' => 'utc_time', - 'text' => __( - 'Dump TIMESTAMP columns in UTC (enables TIMESTAMP columns' - . ' to be dumped and reloaded between servers in different' - . ' time zones)' - ) - ); + // Dump time in UTC + $leaf = new BoolPropertyItem(); + $leaf->setName("utc_time"); + $leaf->setText(__( + 'Dump TIMESTAMP columns in UTC (enables TIMESTAMP columns' + . ' to be dumped and reloaded between servers in different' + . ' time zones)' + )); + $dataOptions->addProperty($leaf); } - $this->properties['options'][] = array( - 'type' => 'end_group' - ); - /* end Data options */ + // add the main group to the root group + $exportSpecificOptions->addProperty($dataOptions); + + // set the options for the export plugin property item + $exportPluginProperties->setOptions($exportSpecificOptions); + $this->properties = $exportPluginProperties; } } @@ -781,10 +780,10 @@ class ExportSql extends ExportPlugin public function exportDBCreate($db) { global $crlf; - + $common_functions = PMA_CommonFunctions::getInstance(); $this->setCrlf($crlf); - + if (isset($GLOBALS['sql_drop_database'])) { if (! PMA_exportOutputHandler( 'DROP DATABASE ' @@ -923,7 +922,7 @@ class ExportSql extends ExportPlugin */ public function getTableDefStandIn($db, $view, $crlf) { - + $common_functions = PMA_CommonFunctions::getInstance(); $create_query = ''; if (! empty($GLOBALS['sql_drop_table'])) { @@ -972,7 +971,7 @@ class ExportSql extends ExportPlugin $view = false ) { $this->initSpecificVariables(); - + $sql_drop_table = $this->_getSqlDropTable(); $sql_backquotes = $this->_getSqlBackquotes(); $sql_constraints = $this->_getSqlConstraints(); @@ -1413,9 +1412,9 @@ class ExportSql extends ExportPlugin $mime = false, $dates = false ) { - + $common_functions = PMA_CommonFunctions::getInstance(); - + $formatted_table_name = (isset($GLOBALS['sql_backquotes'])) ? $common_functions->backquote($table) : '\'' . $table . '\''; $dump = $this->_possibleCRLF() From e304e790326acf30934f0c839674f96e83dbc9c6 Mon Sep 17 00:00:00 2001 From: Alex Marin Date: Wed, 25 Jul 2012 14:05:36 +0300 Subject: [PATCH 29/34] oop: fix display for subgroups of properties --- libraries/plugin_interface.lib.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/libraries/plugin_interface.lib.php b/libraries/plugin_interface.lib.php index f387cd2407..f4b9888f32 100644 --- a/libraries/plugin_interface.lib.php +++ b/libraries/plugin_interface.lib.php @@ -244,10 +244,10 @@ function PMA_pluginGetOneOption( if ($properties == null) { + $not_subgroup_header = true; $properties = $propertyGroup->getProperties(); } - if (! strpos(get_class($propertyGroup), "PropertyItem")) - foreach ($propertyGroup->getProperties() as $propertyItem) { + foreach ($properties as $propertyItem) { $property_class = get_class($propertyItem); // if the property is a subgroup, we deal with it recursively if (strpos($property_class, "Subgroup")) { @@ -382,7 +382,8 @@ function PMA_pluginGetOneOption( $ret .= ''; } else { // end main group - $ret .= '
    '; + if ($not_subgroup_header) + $ret .= '
    '; } if (method_exists($propertyGroup, "getDoc")){ From 2082fe24715ec47a5de3afcd8369a56d2f083204 Mon Sep 17 00:00:00 2001 From: Alex Marin Date: Wed, 25 Jul 2012 14:07:19 +0300 Subject: [PATCH 30/34] oop: fix properties subgroup for ExportMediawiki --- libraries/plugins/export/ExportMediawiki.class.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libraries/plugins/export/ExportMediawiki.class.php b/libraries/plugins/export/ExportMediawiki.class.php index b6d86478d4..47388bfbc1 100644 --- a/libraries/plugins/export/ExportMediawiki.class.php +++ b/libraries/plugins/export/ExportMediawiki.class.php @@ -63,6 +63,8 @@ class ExportMediawiki extends ExportPlugin // what to dump (structure/data/both) $subgroup = new OptionsPropertySubgroup(); + $subgroup->setName("dump_table"); + $subgroup->setText("Dump table"); $leaf = new RadioPropertyItem(); $leaf->setName('structure_or_data'); $leaf->setValues(array( @@ -70,7 +72,7 @@ class ExportMediawiki extends ExportPlugin 'data' => __('data'), 'structure_and_data' => __('structure and data') )); - $subgroup->addProperty($leaf); + $subgroup->setSubgroupHeader($leaf); $generalOptions->addProperty($subgroup); // export table name From 503e1a8b1aebe23c3ab40d1690171d8041dc9709 Mon Sep 17 00:00:00 2001 From: Alex Marin Date: Wed, 25 Jul 2012 14:09:55 +0300 Subject: [PATCH 31/34] oop: add properties subgroups for ExportSql --- libraries/plugins/export/ExportSql.class.php | 340 +++++++++---------- 1 file changed, 152 insertions(+), 188 deletions(-) diff --git a/libraries/plugins/export/ExportSql.class.php b/libraries/plugins/export/ExportSql.class.php index b682988b8f..788b002f00 100644 --- a/libraries/plugins/export/ExportSql.class.php +++ b/libraries/plugins/export/ExportSql.class.php @@ -136,6 +136,7 @@ class ExportSql extends ExportPlugin require_once "$props/options/groups/OptionsPropertyMainGroup.class.php"; require_once "$props/options/groups/OptionsPropertySubgroup.class.php"; require_once "$props/options/items/BoolPropertyItem.class.php"; + require_once "$props/options/items/MessageOnlyPropertyItem.class.php"; require_once "$props/options/items/RadioPropertyItem.class.php"; require_once "$props/options/items/SelectPropertyItem.class.php"; require_once "$props/options/items/TextPropertyItem.class.php"; @@ -156,51 +157,43 @@ class ExportSql extends ExportPlugin $generalOptions = new OptionsPropertyMainGroup(); $generalOptions->setName("general_opts"); + // comments + $subgroup = new OptionsPropertySubgroup(); + $subgroup->setName("include_comments"); + $leaf = new BoolPropertyItem(); + $leaf->setName('include_comments'); + $leaf->setText(__( + 'Display comments (includes info such as export' + . ' timestamp, PHP version, and server version)' + )); + $subgroup->setSubgroupHeader($leaf); - -// /* comments */ -// $this->properties['options'][] = array( -// 'type' => 'begin_subgroup', -// 'subgroup_header' => array( -// 'type' => 'bool', -// 'name' => 'include_comments', -// 'text' => __( -// 'Display comments (includes info such as export' -// . ' timestamp, PHP version, and server version)' -// ) -// ) -// ); -// $this->properties['options'][] = array( -// 'type' => 'text', -// 'name' => 'header_comment', -// 'text' => __('Additional custom header comment (\n splits lines):') -// ); -// $this->properties['options'][] = array( -// 'type' => 'bool', -// 'name' => 'dates', -// 'text' => __( -// 'Include a timestamp of when databases were created, last' -// . ' updated, and last checked' -// ) -// ); -// if (! empty($GLOBALS['cfgRelation']['relation'])) { -// $this->properties['options'][] = array( -// 'type' => 'bool', -// 'name' => 'relation', -// 'text' => __('Display foreign key relationships') -// ); -// } -// if (! empty($GLOBALS['cfgRelation']['mimework'])) { -// $this->properties['options'][] = array( -// 'type' => 'bool', -// 'name' => 'mime', -// 'text' => __('Display MIME types') -// ); -// } -// $this->properties['options'][] = array( -// 'type' => 'end_subgroup' -// ); -// /* end comments */ + $leaf = new TextPropertyItem(); + $leaf->setName('header_comment'); + $leaf->setText(__( + 'Additional custom header comment (\n splits lines):' + )); + $subgroup->addProperty($leaf); + $leaf = new BoolPropertyItem(); + $leaf->setName('dates'); + $leaf->setText(__( + 'Include a timestamp of when databases were created, last' + . ' updated, and last checked' + )); + $subgroup->addProperty($leaf); + if (! empty($GLOBALS['cfgRelation']['relation'])) { + $leaf = new BoolPropertyItem(); + $leaf->setName('relation'); + $leaf->setText(__('Display foreign key relationships')); + $subgroup->addProperty($leaf); + } + if (! empty($GLOBALS['cfgRelation']['mimework'])) { + $leaf = new BoolPropertyItem(); + $leaf->setName('mime'); + $leaf->setText(__('Display MIME types')); + $subgroup->addProperty($leaf); + } + $generalOptions->addProperty($subgroup); // enclose in a transaction $leaf = new BoolPropertyItem(); @@ -260,6 +253,8 @@ class ExportSql extends ExportPlugin // what to dump (structure/data/both) $subgroup = new OptionsPropertySubgroup(); + $subgroup->setName("dump_table"); + $subgroup->setText("Dump table"); $leaf = new RadioPropertyItem(); $leaf->setName('structure_or_data'); $leaf->setValues(array( @@ -267,7 +262,7 @@ class ExportSql extends ExportPlugin 'data' => __('data'), 'structure_and_data' => __('structure and data') )); - $subgroup->addProperty($leaf); + $subgroup->setSubgroupHeader($leaf); $generalOptions->addProperty($subgroup); // add the main group to the root group @@ -281,79 +276,62 @@ class ExportSql extends ExportPlugin $structureOptions->setText(__('Object creation options')); $structureOptions->setForce('data'); -// // begin SQL Statements -// $this->properties['options'][] = array( -// 'type' => 'begin_subgroup', -// 'subgroup_header' => array( -// 'type' => 'message_only', -// 'name' => 'add_statements', -// 'text' => __('Add statements:') -// ) -// ); -// if ($plugin_param['export_type'] == 'table') { -// if (PMA_Table::isView($GLOBALS['db'], $GLOBALS['table'])) { -// $drop_clause = 'DROP VIEW'; -// } else { -// $drop_clause = 'DROP TABLE'; -// } -// } else { -// if (PMA_DRIZZLE) { -// $drop_clause = 'DROP TABLE'; -// } else { -// $drop_clause = 'DROP TABLE / VIEW / PROCEDURE' -// . ' / FUNCTION'; -// if (PMA_MYSQL_INT_VERSION > 50100) { -// $drop_clause .= ' / EVENT'; -// } -// } -// } -// $this->properties['options'][] = array( -// 'type' => 'bool', -// 'name' => 'drop_table', -// 'text' => sprintf(__('Add %s statement'), $drop_clause) -// ); -// // Drizzle doesn't support procedures and functions -// if (! PMA_DRIZZLE) { -// $this->properties['options'][] = array( -// 'type' => 'bool', -// 'name' => 'procedure_function', -// 'text' => sprintf( -// __('Add %s statement'), -// 'CREATE PROCEDURE / FUNCTION' -// . (PMA_MYSQL_INT_VERSION > 50100 -// ? ' / EVENT' : '') -// ) -// ); -// } -// -// /* begin CREATE TABLE statements*/ -// $this->properties['options'][] = array( -// 'type' => 'begin_subgroup', -// 'subgroup_header' => array( -// 'type' => 'bool', -// 'name' => 'create_table_statements', -// 'text' => __('CREATE TABLE options:') -// ) -// ); -// $this->properties['options'][] = array( -// 'type' => 'bool', -// 'name' => 'if_not_exists', -// 'text' => 'IF NOT EXISTS' -// ); -// $this->properties['options'][] = array( -// 'type' => 'bool', -// 'name' => 'auto_increment', -// 'text' => 'AUTO_INCREMENT' -// ); -// $this->properties['options'][] = array( -// 'type' => 'end_subgroup' -// ); -// /* end CREATE TABLE statements */ -// -// $this->properties['options'][] = array( -// 'type' => 'end_subgroup' -// ); -// /* end SQL statements */ + // begin SQL Statements + $subgroup = new OptionsPropertySubgroup(); + $leaf = new MessageOnlyPropertyItem(); + $leaf->setName('add_statements'); + $leaf->setText(__('Add statements:')); + $subgroup->setSubgroupHeader($leaf); + if ($plugin_param['export_type'] == 'table') { + if (PMA_Table::isView($GLOBALS['db'], $GLOBALS['table'])) { + $drop_clause = 'DROP VIEW'; + } else { + $drop_clause = 'DROP TABLE'; + } + } else { + if (PMA_DRIZZLE) { + $drop_clause = 'DROP TABLE'; + } else { + $drop_clause = 'DROP TABLE / VIEW / PROCEDURE' + . ' / FUNCTION'; + if (PMA_MYSQL_INT_VERSION > 50100) { + $drop_clause .= ' / EVENT'; + } + } + } + $leaf = new BoolPropertyItem(); + $leaf->setName('drop_table'); + $leaf->setText(sprintf(__('Add %s statement'), $drop_clause)); + $subgroup->addProperty($leaf); + // Drizzle doesn't support procedures and functions + if (! PMA_DRIZZLE) { + $leaf = new BoolPropertyItem(); + $leaf->setName('procedure_function'); + $leaf->setText(sprintf( + __('Add %s statement'), + 'CREATE PROCEDURE / FUNCTION' + . (PMA_MYSQL_INT_VERSION > 50100 + ? ' / EVENT' : '') + )); + $subgroup->addProperty($leaf); + } + + // begin CREATE TABLE statements + $subgroup_create_table = new OptionsPropertySubgroup(); + $leaf = new BoolPropertyItem(); + $leaf->setName('create_table_statements'); + $leaf->setText(__('CREATE TABLE options:')); + $subgroup_create_table->setSubgroupHeader($leaf); + $leaf = new BoolPropertyItem(); + $leaf->setName('if_not_exists'); + $leaf->setText('IF NOT EXISTS'); + $subgroup_create_table->addProperty($leaf); + $leaf = new BoolPropertyItem(); + $leaf->setName('auto_increment'); + $leaf->setText('AUTO_INCREMENT'); + $subgroup_create_table->addProperty($leaf); + $subgroup->addProperty($subgroup_create_table); + $structureOptions->addProperty($subgroup); $leaf = new BoolPropertyItem(); $leaf->setName("backquotes"); @@ -375,45 +353,36 @@ class ExportSql extends ExportPlugin $dataOptions->setName("data"); $dataOptions->setText(__('Data creation options')); $dataOptions->setForce('structure'); - $leaf = new BoolPropertyItem(); $leaf->setName("truncate"); $leaf->setText(__('Truncate table before insert')); $dataOptions->addProperty($leaf); -// /* begin SQL statements */ -// $this->properties['options'][] = array( -// 'type' => 'begin_subgroup', -// 'subgroup_header' => array( -// 'type' => 'message_only', -// 'text' => __('Instead of INSERT statements, use:') -// ) -// ); -// // Not supported in Drizzle -// if (! PMA_DRIZZLE) { -// $this->properties['options'][] = array( -// 'type' => 'bool', -// 'name' => 'delayed', -// 'text' => __('INSERT DELAYED statements'), -// 'doc' => array( -// 'manual_MySQL_Database_Administration', -// 'insert_delayed' -// ) -// ); -// } -// $this->properties['options'][] = array( -// 'type' => 'bool', -// 'name' => 'ignore', -// 'text' => __('INSERT IGNORE statements'), -// 'doc' => array( -// 'manual_MySQL_Database_Administration', -// 'insert' -// ) -// ); -// $this->properties['options'][] = array( -// 'type' => 'end_subgroup' -// ); -// /* end SQL statements */ + // begin SQL Statements + $subgroup = new OptionsPropertySubgroup(); + $leaf = new MessageOnlyPropertyItem(); + $leaf->setText(__('Instead of INSERT statements, use:')); + $subgroup->setSubgroupHeader($leaf); + // Not supported in Drizzle + if (! PMA_DRIZZLE) { + $leaf = new BoolPropertyItem(); + $leaf->setName("delayed"); + $leaf->setText(__('INSERT DELAYED statements')); + $leaf->setDoc(array( + 'manual_MySQL_Database_Administration', + 'insert_delayed' + )); + $subgroup->addProperty($leaf); + } + $leaf = new BoolPropertyItem(); + $leaf->setName("ignore"); + $leaf->setText(__('INSERT IGNORE statements')); + $leaf->setDoc(array( + 'manual_MySQL_Database_Administration', + 'insert' + )); + $subgroup->addProperty($leaf); + $dataOptions->addProperty($subgroup); // Function to use when dumping dat $leaf = new SelectPropertyItem(); @@ -426,42 +395,37 @@ class ExportSql extends ExportPlugin )); $dataOptions->addProperty($leaf); -// /* Syntax to use when inserting data */ -// $this->properties['options'][] = array( -// 'type' => 'begin_subgroup', -// 'subgroup_header' => array( -// 'type' => 'message_only', -// 'text' => __('Syntax to use when inserting data:') -// ) -// ); -// $this->properties['options'][] = array( -// 'type' => 'radio', -// 'name' => 'insert_syntax', -// 'values' => array( -// 'complete' => __( -// 'include column names in every INSERT statement' -// . '
          Example: INSERT INTO' -// . ' tbl_name (col_A,col_B,col_C) VALUES (1,2,3)' -// ), -// 'extended' => __( -// 'insert multiple rows in every INSERT statement' -// . '
          Example: INSERT INTO' -// . ' tbl_name VALUES (1,2,3), (4,5,6), (7,8,9)' -// ), -// 'both' => __( -// 'both of the above
          Example:' -// . ' INSERT INTO tbl_name (col_A,col_B) VALUES (1,2,3),' -// . ' (4,5,6), (7,8,9)' -// ), -// 'none' => __( -// 'neither of the above
          Example:' -// . ' INSERT INTO tbl_name VALUES (1,2,3)' -// ) -// ) -// ); -// $this->properties['options'][] = array( -// 'type' => 'end_subgroup' -// ); + /* Syntax to use when inserting data */ + $subgroup = new OptionsPropertySubgroup(); + $leaf = new MessageOnlyPropertyItem(); + $leaf->setText(__('Syntax to use when inserting data:')); + $subgroup->setSubgroupHeader($leaf); + $leaf = new RadioPropertyItem(); + $leaf->setName("insert_syntax"); + $leaf->setText(__('INSERT IGNORE statements')); + $leaf->setValues(array( + 'complete' => __( + 'include column names in every INSERT statement' + . '
          Example: INSERT INTO' + . ' tbl_name (col_A,col_B,col_C) VALUES (1,2,3)' + ), + 'extended' => __( + 'insert multiple rows in every INSERT statement' + . '
          Example: INSERT INTO' + . ' tbl_name VALUES (1,2,3), (4,5,6), (7,8,9)' + ), + 'both' => __( + 'both of the above
          Example:' + . ' INSERT INTO tbl_name (col_A,col_B) VALUES (1,2,3),' + . ' (4,5,6), (7,8,9)' + ), + 'none' => __( + 'neither of the above
          Example:' + . ' INSERT INTO tbl_name VALUES (1,2,3)' + ) + )); + $subgroup->addProperty($leaf); + $dataOptions->addProperty($subgroup); // Max length of query $leaf = new TextPropertyItem(); From 3dd52636eb345577edc55158272fb4f12798b4f6 Mon Sep 17 00:00:00 2001 From: Marc Delisle Date: Wed, 25 Jul 2012 08:19:41 -0400 Subject: [PATCH 32/34] Bypass InnoDB and views row counting by default, for performance reasons. See https://github.com/phpmyadmin/phpmyadmin/pull/83 for the discussion, but my commit changes the default values, not the sample values. --- libraries/config.default.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libraries/config.default.php b/libraries/config.default.php index 55c6748cf7..7ba7d07195 100644 --- a/libraries/config.default.php +++ b/libraries/config.default.php @@ -2490,14 +2490,14 @@ $cfg['BrowseMIME'] = true; * * @global integer $cfg['MaxExactCount'] */ -$cfg['MaxExactCount'] = 20000; +$cfg['MaxExactCount'] = 0; /** * Zero means that no row count is done for views; see the doc * * @global integer $cfg['MaxExactCountViews'] */ -$cfg['MaxExactCountViews'] = 100000; +$cfg['MaxExactCountViews'] = 0; /** * Sort table and database in natural order From dfe09a1673f1bff3df42a976f1bd67f0fe6982ca Mon Sep 17 00:00:00 2001 From: Hyun-Sung Yun Date: Thu, 26 Jul 2012 09:35:59 +0200 Subject: [PATCH 33/34] Translated using Weblate. --- po/ko.po | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/po/ko.po b/po/ko.po index 0020eec7ff..ccccf14df0 100644 --- a/po/ko.po +++ b/po/ko.po @@ -4,8 +4,8 @@ msgstr "" "Project-Id-Version: phpMyAdmin 4.0.0-dev\n" "Report-Msgid-Bugs-To: phpmyadmin-devel@lists.sourceforge.net\n" "POT-Creation-Date: 2012-07-18 11:12+0200\n" -"PO-Revision-Date: 2012-07-19 06:59+0200\n" -"Last-Translator: Mog Kim \n" +"PO-Revision-Date: 2012-07-26 08:31+0200\n" +"Last-Translator: Hyun-Sung Yun \n" "Language-Team: korean \n" "Language: ko\n" "MIME-Version: 1.0\n" @@ -1283,9 +1283,8 @@ msgstr "%d개 테이블(s)" #. l10n: Questions is the name of a MySQL Status variable #: js/messages.php:131 -#, fuzzy msgid "Questions" -msgstr "테이블 작업" +msgstr "질의" #: js/messages.php:132 server_status.php:1128 msgid "Traffic" @@ -1333,7 +1332,6 @@ msgid "general_log and slow_query_log are enabled." msgstr "general_log 와 slow_query_log 가 활성화 되었습니다." #: js/messages.php:144 -#, fuzzy msgid "general_log is enabled." msgstr "general_log 가 활성화 되었습니다." @@ -1469,7 +1467,7 @@ msgid "" "Since grouping of INSERTs queries has been selected, INSERT queries into the " "same table are also being grouped together, disregarding of the inserted " "data." -msgstr "" +msgstr "INSERT 쿼리들만 선택되었기 때문에, 입력하는 데이터에 상관없이 같은 테이블을 대상으로 하는 쿼리들끼리 또 분류되었습니다." #: js/messages.php:177 msgid "Log data loaded. Queries executed in this time span:" @@ -1525,9 +1523,8 @@ msgid "Edit chart" msgstr "차트 편집" #: js/messages.php:192 -#, fuzzy msgid "Series" -msgstr "SQL 질의" +msgstr "시리즈" #. l10n: A collection of available filters #: js/messages.php:195 @@ -1545,7 +1542,7 @@ msgstr "단어/정규식에 의한 필터 질의:" #: js/messages.php:199 msgid "Group queries, ignoring variable data in WHERE clauses" -msgstr "" +msgstr "그룹 쿼리, WHERE 절 변수 데이터를 무시합니다" #: js/messages.php:200 msgid "Sum of grouped rows:" @@ -1632,10 +1629,9 @@ msgid "Rule details" msgstr "규칙 세부 사항" #: js/messages.php:225 -#, fuzzy #| msgid "Authenticating..." msgid "Justification" -msgstr "인증중입니다..." +msgstr "인증" #: js/messages.php:226 msgid "Used variable / formula" @@ -1748,7 +1744,6 @@ msgid "Show search results" msgstr "검색 결과 보이기" #: js/messages.php:265 -#, fuzzy #| msgid "Browse" msgid "Browsing" msgstr "보기" @@ -1833,7 +1828,6 @@ msgid "Show search criteria" msgstr "검색 조건 보이기" #: js/messages.php:298 libraries/TableSearch.class.php:225 -#, fuzzy #| msgid "Search" msgid "Zoom Search" msgstr "추가 검색" From 2abb9cfef49ae540f325e4a239a2d6d293024df1 Mon Sep 17 00:00:00 2001 From: Burak Yavuz Date: Thu, 26 Jul 2012 09:36:00 +0200 Subject: [PATCH 34/34] Translated using Weblate. --- po/tr.po | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/po/tr.po b/po/tr.po index 3046616b23..fae2d15c2d 100644 --- a/po/tr.po +++ b/po/tr.po @@ -4,7 +4,7 @@ msgstr "" "Project-Id-Version: phpMyAdmin 4.0.0-dev\n" "Report-Msgid-Bugs-To: phpmyadmin-devel@lists.sourceforge.net\n" "POT-Creation-Date: 2012-07-18 11:12+0200\n" -"PO-Revision-Date: 2012-06-28 12:41+0200\n" +"PO-Revision-Date: 2012-07-26 02:11+0200\n" "Last-Translator: Burak Yavuz \n" "Language-Team: turkish \n" "Language: tr\n" @@ -7207,7 +7207,7 @@ msgstr "Farsça" #: libraries/mysql_charsets.lib.php:292 msgid "Polish" -msgstr "Polonyaca" +msgstr "Lehçe" #: libraries/mysql_charsets.lib.php:295 libraries/mysql_charsets.lib.php:343 msgid "West European"