Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Update to 1.1

  • Loading branch information...
commit ef15651409dad912a118cef9665491b02d778fb6 1 parent 6669e91
@vlad-ghita authored
View
80 README.markdown
@@ -1,13 +1,12 @@
Select Box Link Field Combo
------------------------------------
-Version: 1.0beta2<br />
-Author: [Vlad Ghita](vlad_micutul@yahoo.com)<br />
-Build Date: 4th May 2011<br />
-Requirements:<br />
-
-- Symphony 2.2.1 or greater. Untested in previous versions.
-- [Select Box Link Field](http://symphony-cms.com/download/extensions/view/20054/)
+* Version: 1.1
+* Author: [Vlad Ghita](vlad_micutul@yahoo.com)
+* Build Date: 2011-09-27
+* Requirements:
+ - Symphony 2.2 or greater.
+ - [Select Box Link Field](http://symphony-cms.com/download/extensions/view/20054/)
In short, it allows creation of chained select boxes in backend.
@@ -48,47 +47,68 @@ Lets say you have a `Persons` Section and each person has to be localized on the
Secition `Continents`<br />
1. Text Input<br />
-- `name` : Title
+ - `name` : Title
+<br />
Section `Countries`<br />
1. Text Input<br />
-- `name` : Title<br />
+ - `name` : Title<br />
2. Select Box Link (SBL\#1)<br />
-- `name` : Continent<br />
-- `values` : Continents-&gt;Title
+ - `name` : Continent<br />
+ - `values` : Continents-&gt;Title
+<br />
Section `Cities`<br />
1. Text Input<br />
-- `name` : Title<br />
+ - `name` : Title<br />
2. Select Box Link (SBL\#2)<br />
-- `name` : Country<br />
-- `values` : Countries-&gt;Title
-
+ - `name` : Country<br />
+ - `values` : Countries-&gt;Title
+
+<br />
Persons<br />
1. Text Input<br />
-- `name` : Name<br />
+ - `name` : Name<br />
2. Select Box Link (SBL\#3)<br />
-- `name` : Continent<br />
-- `values` : Continents-&gt;Title<br />
+ - `name` : Continent<br />
+ - `values` : Continents-&gt;Title<br />
**SAVE the Section first. Next field needs SBL\#3's ID from Database**<br />
3. Select Box Link Combo (SBLC\#1)<br />
-- `name` : Country<br />
-- `parent` : Persons-&gt;Continent (SBL\#3)<br />
-- `values` : Countries-&gt;Title<br />
-- `relation` : Countries-&gt;Continent (SBL\#1)<br />
+ - `name` : Country<br />
+ - `parent` : Persons-&gt;Continent (SBL\#3)<br />
+ - `values` : Countries-&gt;Title<br />
+ - `relation` : Countries-&gt;Continent (SBL\#1)<br />
**SAVE the Section first. Next field needs SBLC\#1's ID from Database**<br />
4. Select Box Link Combo (SBLC\#2)<br />
-- `name` : City<br />
-- `parent` : Persons-&gt;Country (SBLC\#1)<br />
-- `values` : Cities-&gt;Title<br />
-- `relation` : Cities-&gt;Country (SBL\#2)
+ - `name` : City<br />
+ - `parent` : Persons-&gt;Country (SBLC\#1)<br />
+ - `values` : Cities-&gt;Title<br />
+ - `relation` : Cities-&gt;Country (SBL\#2)
Enjoy!
+<br />
+## Compatibility ##
+
+ Symphony | Selectbox Link Combo
+---------------|---------------------
+ 2.2 - 2.2.2 | [1.0beta2](https://github.com/vlad-ghita/selectbox_link_field_combo/tree/1.0beta2)
+ 2.2.3 - * | [latest](https://github.com/vlad-ghita/page_lhandles)
+
+Selectbox Link | Selectbox Link Combo
+---------------|---------------------
+ 1.18 - 1.19 | [1.0beta2](https://github.com/vlad-ghita/selectbox_link_field_combo/tree/1.0beta2)
+ 1.20 - * | [latest](https://github.com/vlad-ghita/page_lhandles)
+
+<br />
##CHANGE LOG##
-1.0beta2<br />
-- Field rewrite. Better error checking on field settings.<br />
-- New and improved JS (good job Nils)
+* 1.1, 27 September 2011
+ * First stable release.
+ * Compatibility with [Selectbox Link v1.20](https://github.com/symphonycms/selectbox_link_field/tree/1.20)
+
+* 1.0beta2
+ * Field rewrite. Better error checking on field settings.
+ * New and improved JS (good job Nils)
-1.0beta - Initial release.
+* 1.0beta - Initial release.
View
4 extension.driver.php
@@ -5,8 +5,8 @@
public function about(){
return array(
'name' => 'Field: Select Box Link Combo',
- 'version' => '1.0beta2',
- 'release-date' => '2011-05-23',
+ 'version' => '1.1',
+ 'release-date' => '2011-09-27',
'author' => array(
'name' => 'Vlad Ghita',
'email' => 'vlad_micutul@yahoo.com'
View
57 fields/field.selectbox_link_combo.php
@@ -2,6 +2,7 @@
if(!defined('__IN_SYMPHONY__')) die('<h2>Symphony Error</h2><p>You cannot directly access this file</p>');
+
Class fieldSelectBox_Link_Combo extends fieldSelectBox_Link{
@@ -411,18 +412,22 @@ public function displayPublishPanel(&$wrapper, $data=NULL, $flagWithError=NULL,
if(!empty($states)){
foreach($states as $s){
- $group = array('label' => $s['name'], 'options' => array());
+ $group = array(
+ 'label' => $s['name'],
+ 'options' => array()
+ );
+
foreach($s['values'] as $id => $v){
$group['options'][] = array(
- $id,
- in_array($id, $entry_ids),
- General::sanitize($v['value']),
- null,
- null,
- array(
- 'data-parent' => $this->get('parent_field_id'),
- 'data-selector' => General::sanitize($v['parent_id'])
- )
+ $id,
+ in_array($id, $entry_ids),
+ General::sanitize($v['value']),
+ null,
+ null,
+ array(
+ 'data-parent' => $this->get('parent_field_id'),
+ 'data-selector' => General::sanitize($v['parent_id'])
+ )
);
}
$options[] = $group;
@@ -456,28 +461,33 @@ public function findOptions(array $existing_selection=NULL){
if(is_array($sections) && !empty($sections)){
foreach($sections as $section){
- $group = array('name' => $section['name'], 'section' => $section['id'], 'values' => array());
+ $group = array(
+ 'name' => $section['name'],
+ 'section' => $section['id'],
+ 'values' => array()
+ );
// build a list of entry IDs with the correct sort order
- $entryManager = new EntryManager($this->_Parent);
- $entries = $entryManager->fetch(NULL, $section['id'], $limit, 0);
+ $em = new EntryManager(Symphony::Engine());
+ $entries = $em->fetch(NULL, $section['id'], $limit, 0, null, null, false, false);
$results = array();
- foreach($entries as $entry) $results[] = $entry->get('id');
+ foreach($entries as $entry) {
+ $results[] = (int)$entry['id'];
+ }
// if a value is already selected, ensure it is added to the list (if it isn't in the available options)
if(!is_null($existing_selection) && !empty($existing_selection)){
- foreach($existing_selection as $key => $entry_id){
- $x = $this->findFieldIDFromRelationID($entry_id);
- if($x == $section['field_id']) $results[] = $entry_id;
- }
+ $entries_for_field = $this->findEntriesForField($existing_selection, $section['field_id']);
+ $results = array_merge($results, $entries_for_field);
}
-
+
if(is_array($results) && !empty($results)){
- foreach($results as $entry_id){
- $value = $this->findPrimaryFieldValueFromRelationID($entry_id);
- $group['values'][$entry_id]['value'] = $value['value'];
- $group['values'][$entry_id]['parent_id'] = $parent_relations[$entry_id];
+ $related_values = $this->findRelatedValues($results);
+
+ foreach($related_values as $value){
+ $group['values'][$value['id']]['value'] = $value['value'];
+ $group['values'][$value['id']]['parent_id'] = $parent_relations[$value['id']];
}
}
@@ -499,5 +509,4 @@ private function _fetchRelationsFromRelationID() {
return $relations;
}
-
}
View
37 lang/lang.de.php
@@ -0,0 +1,37 @@
+<?php
+
+ $about = array(
+ 'name' => 'Deutsch',
+ 'author' => array(
+ 'name' => 'Nils Hörrmann',
+ 'email' => 'post@nilshoerrmann.de',
+ 'website' => 'http://www.nilshoerrmann.de'
+ ),
+ 'release-date' => '2009-12-29'
+ );
+
+
+ /*
+ * EXTENSION: Field: Select Box Link
+ * Localisation strings
+ */
+
+ $dictionary = array(
+
+ 'Select Box Link' =>
+ 'Select Box Link',
+
+ 'None' =>
+ 'Keine',
+
+ 'Options' =>
+ 'Optionen',
+
+ 'Limit to the %s most recent entries' =>
+ 'Auf die %s neusten Einträge begrenzen.',
+
+ 'Allow selection of multiple options' =>
+ 'Erlaube Mehrfachauswahl.'
+
+ );
+
View
34 lang/lang.it.php
@@ -0,0 +1,34 @@
+<?php
+
+ $about = array(
+ 'name' => 'Italiano',
+ 'author' => array(
+ 'name' => 'Simone Economo',
+ 'email' => 'my.ekoes@gmail.com',
+ 'website' => 'http://lineheight.net',
+ ),
+ 'release-date' => '2010-02-25',
+ );
+
+
+ /**
+ * Field: Select Box Link
+ */
+ $dictionary = array(
+
+ 'Select Box Link' =>
+ 'Giunzione fra sezioni',
+
+ 'None' =>
+ 'Nessuno',
+
+ 'Options' =>
+ 'Fonti',
+
+ 'Limit to the %s most recent entries' =>
+ 'Limita alle %s voci più recenti',
+
+ 'Allow selection of multiple options' =>
+ 'Consenti la selezione di pi&ugrave; elementi',
+
+ );
View
37 lang/lang.nl.php
@@ -0,0 +1,37 @@
+<?php
+
+ $about = array(
+ 'name' => 'Nederlands',
+ 'author' => array(
+ 'name' => 'Carsten de Vries',
+ 'email' => 'carsten@vrieswerk.nl',
+ 'website' => 'http://www.vrieswerk.nl'
+ ),
+ 'release-date' => '2009-11-09'
+ );
+
+
+ /*
+ * EXTENSION: Field: Select Box Link
+ * Localisation strings
+ */
+
+ $dictionary = array(
+
+ 'Select Box Link' =>
+ 'Selectiebox-link',
+
+ 'None' =>
+ false,
+
+ 'Options' =>
+ 'Opties',
+
+ 'Limit to the %s most recent entries' =>
+ 'Limiteer tot de %s meest recente items',
+
+ 'Allow selection of multiple options' =>
+ 'Sta selectie van meerdere opties toe'
+
+ );
+
View
37 lang/lang.pt-br.php
@@ -0,0 +1,37 @@
+<?php
+
+ $about = array(
+ 'name' => 'Portuguese (Brazil)',
+ 'author' => array(
+ 'name' => 'Rainer Borene',
+ 'email' => 'eu@rainerborene.com',
+ 'website' => false
+ ),
+ 'release-date' => '2010-02-01'
+ );
+
+
+ /*
+ * EXTENSION: Field: Select Box Link
+ * Localisation strings
+ */
+
+ $dictionary = array(
+
+ 'Select Box Link' =>
+ 'Select Box Link',
+
+ 'None' =>
+ 'Nenhum',
+
+ 'Options' =>
+ 'Opções',
+
+ 'Limit to the %s most recent entries' =>
+ 'Limitar para as %s recentes entradas',
+
+ 'Allow selection of multiple options' =>
+ 'Permitir seleção de múltiplas opções'
+
+ );
+
View
37 lang/lang.ru.php
@@ -0,0 +1,37 @@
+<?php
+
+ $about = array(
+ 'name' => 'Русский',
+ 'author' => array(
+ 'name' => 'Igor Bogdanov',
+ 'email' => 'i.bogdanov@ibcico.com',
+ 'website' => false
+ ),
+ 'release-date' => '2009-11-27'
+ );
+
+
+ /*
+ * EXTENSION: Field: Select Box Link
+ * Localisation strings
+ */
+
+ $dictionary = array(
+
+ 'Select Box Link' =>
+ 'Ссылка на сущность',
+
+ 'None' =>
+ false,
+
+ 'Options' =>
+ 'Опции',
+
+ 'Limit to the %s most recent entries' =>
+ 'Ограничение на %s последних записей.',
+
+ 'Allow selection of multiple options' =>
+ 'Разрешить выбор нескольких опций.'
+
+ );
+
Please sign in to comment.
Something went wrong with that request. Please try again.