Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove flawed attribute in AdminType, adjust dependencies to vis-ui a… #3

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions Element/QueryBuilderElement.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,8 @@ public static function getDefaultConfiguration()
return array(
'source' => 'default',
'allowRemove' => false,
'allowEdit' => false,
'allowExecute' => true,
'allowSave' => false,
'allowCreate' => false,
'allowExport' => true,
'allowHtmlExport' => true,
'allowSearch' => false,
Expand Down Expand Up @@ -115,6 +113,11 @@ public function getAssets()
),
'js' => array(
'@MapbenderQueryBuilderBundle/Resources/public/queryBuilder.element.js',
'../../vendor/mapbender/vis-ui.js/src/js/jquery.form.generator.js',
'../../vendor/mapbender/vis-ui.js/src/js/utils/fn.formData.js',
'../../vendor/mapbender/vis-ui.js/src/js/elements/date.selector.js', // only for legacy browsers
'../../vendor/mapbender/vis-ui.js/src/js/elements/popup.dialog.js',
'../../vendor/mapbender/vis-ui.js/src/js/elements/data.result-table.js',
),
'trans' => array(
'MapbenderQueryBuilderBundle:Element:queryBuilder.json.twig',
Expand Down Expand Up @@ -216,7 +219,7 @@ public function handleHttpRequest(Request $requestService)
break;

case 'save':
if (!$configuration['allowCreate'] && !$configuration['allowSave']) {
if (!$configuration['allowSave']) {
throw new AccessDeniedHttpException();
}
$dataStore = $this->getDataStore($configuration['source']);
Expand Down
4 changes: 0 additions & 4 deletions Element/Type/QueryBuilderAdminType.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,16 +38,12 @@ public function buildForm(FormBuilderInterface $builder, array $options)
->add('source', 'Symfony\Component\Form\Extension\Core\Type\ChoiceType', array(
'choices' => $dataStoreSelectValues,
'required' => true,
'empty_value' => null
)
)
->add('sqlFieldName', 'Symfony\Component\Form\Extension\Core\Type\TextType', array('required' => true))
->add('orderByFieldName', 'Symfony\Component\Form\Extension\Core\Type\TextType', array('required' => true))
->add('titleFieldName', 'Symfony\Component\Form\Extension\Core\Type\TextType', array('required' => true))
->add('connectionFieldName', 'Symfony\Component\Form\Extension\Core\Type\TextType', array('required' => true))

->add('allowCreate', 'Symfony\Component\Form\Extension\Core\Type\CheckboxType', array('required' => false))
->add('allowEdit', 'Symfony\Component\Form\Extension\Core\Type\CheckboxType', array('required' => false))
->add('allowSave', 'Symfony\Component\Form\Extension\Core\Type\CheckboxType', array('required' => false))
->add('allowRemove', 'Symfony\Component\Form\Extension\Core\Type\CheckboxType', array('required' => false))
->add('allowExecute', 'Symfony\Component\Form\Extension\Core\Type\CheckboxType', array('required' => false))
Expand Down
6 changes: 0 additions & 6 deletions Resources/config/applications.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,6 @@ parameters:
title: SQL Queries
class: Mapbender\DataSourceBundle\Element\QueryBuilderElement

# Allow edit
allowEdit: true

# Allow edit
allowCreate: false

# Allow save
allowSave: true

Expand Down
92 changes: 1 addition & 91 deletions Resources/public/queryBuilder.element.js
Original file line number Diff line number Diff line change
Expand Up @@ -206,76 +206,6 @@
});
},

/**
* Open SQL edit dialog
*
* @param item
*/
openEditDialog: function(item) {
var widget = this;
var config = widget.options;
var buttons = [];

config.allowSave && buttons.push(widget.saveButton);
config.allowExecute && buttons.push(widget.executeButton);
config.allowExport && buttons.push(widget.exportButton);
config.allowExport && buttons.push(widget.exportHtmlButton);
config.allowRemove && buttons.push(widget.removeButton);

buttons.push(widget.closeButton);

var $form = $("<form class='queryBuilder-edit'>")
.data("item", item)
.generateElements({
children: [{
type: "fieldSet",
children: [{
title: trans("sql.title"), // "Name"
type: "input",
css: {"width": "45%"},
name: config.titleFieldName,
placeholder: "Query name",
options: widget.connections
}, {
title: trans("sql.connection.name"), // "Connection name"
type: "select",
name: config.connectionFieldName,
css: {"width": "25%"},
value: item.connection_name,
options: widget.connections
}, {
title: "Order",
type: "input",
name: config.orderByFieldName,
value: item[config.orderByFieldName],
css: {"width": "15%"}
}, {
title: trans("sql.publish"), // "Anzeigen"
type: "checkbox",
css: {"width": "15%"},
value: 1,
name: config.publicFieldName
}]
}, {
type: "textArea",
title: "SQL",
name: config.sqlFieldName,
rows: 16
}]
})
.popupDialog({
title: item[this.options.titleFieldName],
width: 500,
buttons: buttons
})
.formData(item);

if( !config.allowSave){
$form.disableForm();
}
return $form;
},

_initialize: function() {
var widget = this;
var element = widget.element ;
Expand All @@ -302,25 +232,7 @@
$(this).popupDialog('close');
}
};

var editButton = widget.editButton = {
text: trans('Edit'),
className: 'fa-edit',
click: function(e) {
widget.openEditDialog($(this).data("item"));
}
};

var createButton = widget.createButton = {
type: "button",
text: trans('Create'),
title: " ",
cssClass: 'fa-plus create',
click: function(e) {
widget.openEditDialog({connection_name:"default"});
}
};


var saveButton = widget.saveButton = {
text: trans('Save'),
className: 'fa-floppy-o',
Expand Down Expand Up @@ -390,9 +302,7 @@
config.allowExport && buttons.push(exportButton);
config.allowExport && buttons.push(exportHtmlButton);
config.allowExecute && buttons.push(executeButton);
config.allowEdit && buttons.push(editButton);
config.allowRemove && buttons.push(removeButton);
config.allowCreate && toolBar.push(createButton);

if(toolBar.length){
pane.push({
Expand Down
36 changes: 20 additions & 16 deletions Resources/translations/messages.de.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,20 @@
mb.query.builder.Cancel: Abbrechen
mb.query.builder.Edit: Änderun
mb.query.builder.Create: Erstellen
mb.query.builder.Save: Speichern
mb.query.builder.Remove: Löschen
mb.query.builder.Execute: Ausführen
mb.query.builder.sql.title: Titel
mb.query.builder.sql.connection.name: Verbindungsname
mb.query.builder.sql.publish: Anzeigen
mb.query.builder.confirm.remove: 'Löschen bestätigen'
mb.query.builder.OK: OK
mb.query.builder.sql.saved: 'SQL erfolgreich gespeichert.'
mb.query.builder.sql.removed: 'SQL erfolgreich gelöscht.'
mb.query.builder.Export: Exportieren
mb.query.builder.Results: Ergebnisse
mb.query.builder.HTML-Export: HTML-Export
mb.query.builder:
Cancel: Abbrechen
Edit: Änderung
Create: Erstellen
Save: Speichern
Remove: Löschen
Execute: Ausführen
sql:
title: Titel
connection:
name: Verbindungsname
publish: Anzeigen
saved: 'SQL erfolgreich gespeichert.'
removed: 'SQL erfolgreich gelöscht.'
confirm:
remove: 'Löschen bestätigen'
OK: OK
Export: Exportieren
Results: Ergebnisse
HTML-Export: HTML-Export
36 changes: 20 additions & 16 deletions Resources/translations/messages.en.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,20 @@
mb.query.builder.Cancel: Cancel
mb.query.builder.Edit: Edit
mb.query.builder.Create: Create
mb.query.builder.Save: Save
mb.query.builder.Remove: Remove
mb.query.builder.Execute: Execute
mb.query.builder.sql.title: Title
mb.query.builder.sql.connection.name: Connection
mb.query.builder.sql.publish: Public
mb.query.builder.confirm.remove: 'Confirm remove'
mb.query.builder.OK: OK
mb.query.builder.sql.saved: 'SQL saved successfully.'
mb.query.builder.sql.removed: 'SQL removed successfully.'
mb.query.builder.Export: Export
mb.query.builder.Results: Results
mb.query.builder.HTML-Export: HTML-Export
mb.query.builder:
Cancel: Cancel
Edit: Edit
Create: Create
Save: Save
Remove: Remove
Execute: Execute
sql:
title: Title
connection:
name: Connection
publish: Publish
saved: 'SQL saved successfully.'
removed: 'SQL removed successfully.'
confirm:
remove: 'Confirm remove'
OK: OK
Export: Export
Results: Results
HTML-Export: HTML-Export
36 changes: 20 additions & 16 deletions Resources/translations/messages.ru.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,20 @@
mb.query.builder.Cancel: Отмена
mb.query.builder.Edit: Редактировать
mb.query.builder.Create: Создать
mb.query.builder.Save: Сохранить
mb.query.builder.Remove: Удалить
mb.query.builder.Execute: Выполнить
mb.query.builder.sql.title: Заголовок
mb.query.builder.sql.connection.name: Соеденение
mb.query.builder.sql.publish: Опубликовать
mb.query.builder.confirm.remove: 'Потвердите удаление'
mb.query.builder.OK: OK
mb.query.builder.sql.saved: 'SQL запрос сохранён.'
mb.query.builder.sql.removed: 'SQL запрос удалён.'
mb.query.builder.Export: Экспорт
mb.query.builder.Results: Результат
mb.query.builder.HTML-Export: 'HTML Экспорт'
mb.query.builder:
Cancel: Отмена
Edit: Редактировать
Create: Создать
Save: Сохранить
Remove: Удалить
Execute: Выполнить
sql:
title: Заголовок
connection:
name: Соеденение
publish: Опубликовать
saved: 'SQL запрос сохранён.'
removed: 'SQL запрос удалён.'
confirm:
remove: 'Потвердите удаление'
OK: OK
Export: Экспорт
Results: Результат
HTML-Export: 'HTML Экспорт'
2 changes: 1 addition & 1 deletion Resources/views/Element/queryBuilder.json.twig
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@
"mb.query.builder.saved": "{{ "mb.query.builder.sql.saved"|trans }}",
"mb.query.builder.HTML-Export": "{{ "mb.query.builder.HTML-Export"|trans }}",
"mb.query.builder.removed": "{{ "mb.query.builder.sql.removed"|trans }}"
}
}
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
],
"require": {
"php": ">=5.3.3",
"mapbender/data-source": "0.x"
"mapbender/data-source": "~0.1.15",
"mapbender/vis-ui.js": "^0.1.78 || ~0.2.0"
},
"conflict": {
"symfony/symfony": "<2.4"
Expand Down