diff --git a/app/code/community/BL/CustomGrid/Block/Widget/Grid/Column/Filter/Text/Urldecoded.php b/app/code/community/BL/CustomGrid/Block/Widget/Grid/Column/Filter/Text/Urldecoded.php new file mode 100644 index 0000000..d933b0c --- /dev/null +++ b/app/code/community/BL/CustomGrid/Block/Widget/Grid/Column/Filter/Text/Urldecoded.php @@ -0,0 +1,65 @@ + + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +class BL_CustomGrid_Block_Widget_Grid_Column_Filter_Text_Urldecoded extends BL_CustomGrid_Block_Widget_Grid_Column_Filter_Text +{ + /** + * Overridden to strip domain from filter value, as it does not make sense + * + * @return string + */ + public function getValue() + { + $parsedUrl = parse_url(parent::getValue()); + return (isset($parsedUrl["path"]) ? $parsedUrl["path"] : "") . + (isset($parsedUrl["query"]) ? "?" . $parsedUrl["query"] : "") . + (isset($parsedUrl["fragment"]) ? "#" . $parsedUrl["fragment"] : ""); + } + + /** + * @return string + */ + public function getUrlencodedValue() + { + $parsedUrl = parse_url($this->getValue()); + $urlPath = ""; + if (isset($parsedUrl["path"])) { + $urlPath .= implode("/", array_map("rawurlencode", explode("/", $parsedUrl["path"]))); + } + if (isset($parsedUrl["query"])) { + // This urlencodes all the query parameters properly for us + parse_str($parsedUrl["query"], $parsedQuery); + $urlPath .= "?" . http_build_query($parsedQuery); + } + if (isset($parsedUrl["fragment"])) { + $urlPath .= "#" . urlencode($parsedUrl["fragment"]); + } + return $urlPath; + } + + /** + * Return the collection condition(s) usable to filter on the given value with the LIKE function. Overridden to + * URL-encode the filter value. + * + * @param string $value Filter value + * @param string $filterMode Filter mode + * @param bool $isNegative Whether negative filter is enabled + * @return array + */ + public function getLikeCondition($value, $filterMode, $isNegative) + { + return parent::getLikeCondition($this->getUrlencodedValue(), $filterMode, $isNegative); + } +} diff --git a/app/code/community/BL/CustomGrid/Block/Widget/Grid/Column/Renderer/Text/Urldecoded.php b/app/code/community/BL/CustomGrid/Block/Widget/Grid/Column/Renderer/Text/Urldecoded.php new file mode 100644 index 0000000..d8b9c15 --- /dev/null +++ b/app/code/community/BL/CustomGrid/Block/Widget/Grid/Column/Renderer/Text/Urldecoded.php @@ -0,0 +1,27 @@ + BL_CustomGrid_Block_Widget_Grid_Column_Filter_Text::MODE_INSIDE_LIKE, + 'filter' => 'customgrid/widget_grid_column_filter_text_urldecoded', + 'renderer' => 'customgrid/widget_grid_column_renderer_text_urldecoded', + ); + } +} diff --git a/app/code/community/BL/CustomGrid/Model/Grid/Type/Urlrewrite.php b/app/code/community/BL/CustomGrid/Model/Grid/Type/Urlrewrite.php new file mode 100644 index 0000000..2c0c1ba --- /dev/null +++ b/app/code/community/BL/CustomGrid/Model/Grid/Type/Urlrewrite.php @@ -0,0 +1,12 @@ + + + URL Rewrite + 400000 + + + ID Path (URL Decoded) + Duplicated + + id_path + + + + Request Path (URL Decoded) + Duplicated + + request_path + + + + Target Path (URL Decoded) + Duplicated + + target_path + + + + + Other 1000000000