Skip to content

Commit

Permalink
Updates prepping for Symphony 2.6
Browse files Browse the repository at this point in the history
  • Loading branch information
brendo committed Dec 17, 2014
1 parent a8ab151 commit 7870c5e
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 244 deletions.
39 changes: 0 additions & 39 deletions assets/textboxfield.datasources.css

This file was deleted.

157 changes: 0 additions & 157 deletions assets/textboxfield.datasources.js

This file was deleted.

10 changes: 0 additions & 10 deletions extension.driver.php
Expand Up @@ -18,11 +18,6 @@ class Extension_TextBoxField extends Extension {
*/
const PUBLISH_HEADERS = 1;

/**
* Datasource filter page headers.
*/
const FILTER_HEADERS = 2;

/**
* What headers have been appended?
*
Expand All @@ -47,11 +42,6 @@ static public function appendHeaders($type) {
$page->addScriptToHead(URL . '/extensions/textboxfield/assets/textboxfield.publish.js', null, false);
}

if ($type === self::FILTER_HEADERS) {
$page->addStylesheetToHead(URL . '/extensions/textboxfield/assets/textboxfield.datasources.css', 'screen', null, false);
$page->addScriptToHead(URL . '/extensions/textboxfield/assets/textboxfield.datasources.js', null, false);
}

self::$appendedHeaders &= $type;
}
}
Expand Down
3 changes: 3 additions & 0 deletions extension.meta.xml
Expand Up @@ -18,6 +18,9 @@
</author>
</authors>
<releases>
<release version="2.5.0" date="2014-12-17" min="2.6.x">
- Support for Symphony 2.6+
</release>
<release version="2.4.0" date="2014-08-13" min="2.4" max="2.5.x">
- Official support for Symphony 2.4+
- [#1](https://github.com/symphonists/textboxfield/issues/1) Trim and tidy empty values
Expand Down
59 changes: 21 additions & 38 deletions fields/field.textbox.php
Expand Up @@ -648,7 +648,7 @@ public function getExportModes() {
'getHandle' => ExportableField::HANDLE,
'getFormatted' => ExportableField::FORMATTED,
'getFormatted' => ExportableField::VALUE,
'getUnformatted' => ExportableField::UNFORMATTED,
'getUnformatted' => ExportableField::UNFORMATTED,
'getPostdata' => ExportableField::POSTDATA
);
}
Expand Down Expand Up @@ -701,92 +701,75 @@ public function prepareExportValue($data, $mode, $entry_id = null) {
Filtering:
-------------------------------------------------------------------------*/

public function displayDatasourceFilterPanel(XMLElement &$wrapper, $data = null, $errors = null, $fieldnamePrefix = null, $fieldnamePostfix = null) {
Extension_TextBoxField::appendHeaders(
Extension_TextBoxField::FILTER_HEADERS
);
$field_id = $this->get('id');

parent::displayDatasourceFilterPanel($wrapper, $data, $errors, $fieldnamePrefix, $fieldnamePostfix);
$wrapper->setAttribute('class', $wrapper->getAttribute('class') . ' field-textbox');

$filters = array(
/**
* Returns the keywords that this field supports for filtering. Note
* that no filter will do a simple 'straight' match on the value.
*
* @since Symphony 2.6.0
* @return array
*/
public function fetchFilterableOperators()
{
return array(
array(
'name' => 'boolean',
'title' => 'boolean',
'filter' => 'boolean:',
'help' => __('Find values that match the given query. Can use operators <code>and</code> and <code>not</code>.')
),
array(
'name' => 'not-boolean',
'title' => 'not-boolean',
'filter' => 'not-boolean:',
'help' => __('Find values that do not match the given query. Can use operators <code>and</code> and <code>not</code>.')
),

array(
'name' => 'regexp',
'title' => 'regexp',
'filter' => 'regexp:',
'help' => __('Find values that match the given <a href="%s">MySQL regular expressions</a>.', array(
'http://dev.mysql.com/doc/mysql/en/Regexp.html'
))
),
array(
'name' => 'not-regexp',
'title' => 'not-regexp',
'filter' => 'not-regexp:',
'help' => __('Find values that do not match the given <a href="%s">MySQL regular expressions</a>.', array(
'http://dev.mysql.com/doc/mysql/en/Regexp.html'
))
),

array(
'name' => 'contains',
'title' => 'contains',
'filter' => 'contains:',
'help' => __('Find values that contain the given string.')
),
array(
'name' => 'not-contains',
'title' => 'not-contains',
'filter' => 'not-contains:',
'help' => __('Find values that do not contain the given string.')
),

array(
'name' => 'starts-with',
'title' => 'starts-with',
'filter' => 'starts-with:',
'help' => __('Find values that start with the given string.')
),
array(
'name' => 'not-starts-with',
'title' => 'not-starts-with',
'filter' => 'not-starts-with:',
'help' => __('Find values that do not start with the given string.')
),

array(
'name' => 'ends-with',
'title' => 'ends-with',
'filter' => 'ends-with:',
'help' => __('Find values that end with the given string.')
),
array(
'name' => 'not-ends-with',
'title' => 'not-ends-with',
'filter' => 'not-ends-with:',
'help' => __('Find values that do not end with the given string.')
)
);

$list = new XMLElement('ul');
$list->setAttribute('class', 'filter-prefix-suggestions');

foreach ($filters as $value) {
$item = new XMLElement('li', $value['name']);
$item->setAttribute('title', $value['filter']);
$item->setAttribute('alt', General::sanitize($value['help']));
$list->appendChild($item);
}

$help = new XMLElement('p');
$help->setAttribute('class', 'help');
$help->setValue(__('Find values that are an exact match for the given string.'));

$wrapper->appendChild($list);
$wrapper->appendChild($help);
}

public function buildDSRetrievalSQL($data, &$joins, &$where, $andOperation = false) {
Expand Down

0 comments on commit 7870c5e

Please sign in to comment.