vlad-ghita / sections_event Goto Github PK
View Code? Open in Web Editor NEWSymphony CMS: Section & field permissions. Form data submission to one or more sections at once.
Symphony CMS: Section & field permissions. Form data submission to one or more sections at once.
There seems to be an issue using latest members release and Sections Event. I think it's related to the new feature in members where we can use multiple sections with members in v1.3
Is this a known bug?
Worth adding?
I’m doing something simple like this
foreach($fields_to_add as $key => $value) {
$_POST['sections']['reservations'][$key] = $value;
}
in an event, with the priority set to kHIGH
.
If I do
print_r($_POST); die();
It shows me the correct fields (note: price
)
Array
(
[sections] => Array
(
[reservations] => Array
(
[message] => hi
[dates] => Array
(
[start] => Array
(
[0] => 2013-09-01
)
[end] => Array
(
[0] => 2013-09-30
)
)
[item] => 1529
[customer] => 21
[price] => 1700
)
[__redirect] => /view/%reservations[system:id]%/?
)
[action] => Array
(
[sections] =>
)
)
But if I just submit the form without dumping the array, I get:
<fields>
<price label=“Price" type="missing" message="This is a required field." code="200" />
</fields>
But we just saw when I dumped the array that the price field was there!! I have no idea what’s going on!
I'm getting errors when submitting a form (Symphony 2.3.2, PHP 5.4.4).
When submitting a form with a input
with type="file"
(if file is selected or not):
Symphony Warning: reset() expects parameter 1 to be array, null given
An error occurred in /Applications/MAMP/htdocs/XXX/extensions/sections_event/events/event.sections.php around line 945
940
941 if( is_array( $_FILES['sections'] ) && !empty($_FILES['sections']) ){
942 foreach($_FILES['sections'] as $key_a => $data_a){
943 if( !is_array( $data_a ) ) continue;
944
945 reset($data_a[$handle]);
946
947 // indexed entries
948 if( is_numeric(key($data_a[$handle])) ){
949 $data_c = $data_a[$handle][$position];
Backtrace
[:0]
GenericErrorHandler::handler();
[/Applications/MAMP/htdocs/XXX/extensions/sections_event/events/event.sections.php:945]
reset();
[/Applications/MAMP/htdocs/XXX/extensions/sections_event/events/event.sections.php:324]
EventSections->getPostData();
[/Applications/MAMP/htdocs/XXX/extensions/sections_event/events/event.sections.php:145]
EventSections->sectionsPrepare();
[/Applications/MAMP/htdocs/XXX/extensions/sections_event/events/event.sections.php:103]
EventSections->execute();
[/Applications/MAMP/htdocs/XXX/symphony/lib/toolkit/class.frontendpage.php:712]
EventSections->load();
[/Applications/MAMP/htdocs/XXX/symphony/lib/toolkit/class.frontendpage.php:417]
FrontendPage->processEvents();
[/Applications/MAMP/htdocs/XXX/symphony/lib/toolkit/class.frontendpage.php:185]
FrontendPage->__buildPage();
[/Applications/MAMP/htdocs/XXX/symphony/lib/core/class.frontend.php:103]
FrontendPage->generate();
[/Applications/MAMP/htdocs/XXX/index.php:22]
Frontend->display();
Database Query Log
[0.0002] SET character_set_connection = 'utf8', character_set_database = 'utf8', character_set_server = 'utf8';
[0.0001] SET CHARACTER SET 'utf8';
[0.0014] SELECT SQL_CACHE t1.name, t2.page, t2.delegate, t2.callback FROM `sym_extensions` as t1 INNER JOIN `sym_extensions_delegates` as t2 ON t1.id = t2.extension_id WHERE t1.status = 'enabled' ORDER BY t2.delegate, t1.name;
[0.0003] SELECT SQL_CACHE `session_data` FROM `sym_sessions` WHERE `session` = 'N6DvykA7a6FKhH54Z0Abu0' LIMIT 1;
[0.0003] SELECT SQL_CACHE a.* FROM `sym_authors` AS `a` WHERE `username` = 'Pat' ORDER BY a.id ASC LIMIT 1;
[0.0002] UPDATE sym_authors SET `last_seen` = '2013-04-07 20:33:23' WHERE `id` = 1;
[0.0003] SELECT SQL_CACHE * FROM `sym_pages` WHERE `path` = 'listings' AND `handle` = 'new' LIMIT 1;
[0.0002] SELECT SQL_CACHE type FROM `sym_pages_types` AS pt WHERE pt.page_id = 77 GROUP BY pt.type ORDER BY pt.type ASC;
[0.0003] SELECT SQL_CACHE s.* FROM `sym_gpl_sets` AS s ORDER BY s.name ASC;
[0.0003] SELECT SQL_CACHE `name` FROM `sym_extensions` WHERE `status` = 'enabled';
[0.0004] SELECT SQL_CACHE `id` FROM `sym_sections` WHERE `handle` = 'listings' LIMIT 1;
When submitting form without a file upload input:
Symphony Warning: Illegal string offset '__type'
An error occurred in /Applications/MAMP/htdocs/XXX/extensions/sections_event/events/event.sections.php around line 967
962 foreach($files as $type => $data){
963 merge_file_post_data( $type, $data, $fields );
964 }
965
966 foreach($fields as &$data){
967 $data['__type'] = 'upload';
968 }
969
970
971 return $fields;
Backtrace
[/Applications/MAMP/htdocs/XXX/extensions/sections_event/events/event.sections.php:967]
GenericErrorHandler::handler();
[/Applications/MAMP/htdocs/XXX/extensions/sections_event/events/event.sections.php:324]
EventSections->getPostData();
[/Applications/MAMP/htdocs/XXX/extensions/sections_event/events/event.sections.php:145]
EventSections->sectionsPrepare();
[/Applications/MAMP/htdocs/XXX/extensions/sections_event/events/event.sections.php:103]
EventSections->execute();
[/Applications/MAMP/htdocs/XXX/symphony/lib/toolkit/class.frontendpage.php:712]
EventSections->load();
[/Applications/MAMP/htdocs/XXX/symphony/lib/toolkit/class.frontendpage.php:417]
FrontendPage->processEvents();
[/Applications/MAMP/htdocs/XXX/symphony/lib/toolkit/class.frontendpage.php:185]
FrontendPage->__buildPage();
[/Applications/MAMP/htdocs/XXX/symphony/lib/core/class.frontend.php:103]
FrontendPage->generate();
[/Applications/MAMP/htdocs/XXX/index.php:22]
Frontend->display();
Database Query Log
[0.0001] SET character_set_connection = 'utf8', character_set_database = 'utf8', character_set_server = 'utf8';
[0.0001] SET CHARACTER SET 'utf8';
[0.0010] SELECT SQL_CACHE t1.name, t2.page, t2.delegate, t2.callback FROM `sym_extensions` as t1 INNER JOIN `sym_extensions_delegates` as t2 ON t1.id = t2.extension_id WHERE t1.status = 'enabled' ORDER BY t2.delegate, t1.name;
[0.0002] SELECT SQL_CACHE `session_data` FROM `sym_sessions` WHERE `session` = 'N6DvykA7a6FKhH54Z0Abu0' LIMIT 1;
[0.0003] SELECT SQL_CACHE a.* FROM `sym_authors` AS `a` WHERE `username` = 'Pat' ORDER BY a.id ASC LIMIT 1;
[0.0003] UPDATE sym_authors SET `last_seen` = '2013-04-07 20:35:26' WHERE `id` = 1;
[0.0003] SELECT SQL_CACHE * FROM `sym_pages` WHERE `path` = 'listings' AND `handle` = 'new' LIMIT 1;
[0.0003] SELECT SQL_CACHE type FROM `sym_pages_types` AS pt WHERE pt.page_id = 77 GROUP BY pt.type ORDER BY pt.type ASC;
[0.0003] SELECT SQL_CACHE s.* FROM `sym_gpl_sets` AS s ORDER BY s.name ASC;
[0.0003] SELECT SQL_CACHE `name` FROM `sym_extensions` WHERE `status` = 'enabled';
[0.0005] SELECT SQL_CACHE `id` FROM `sym_sections` WHERE `handle` = 'listings' LIMIT 1;
It will be great if the section event provides a feature similar to the fingerprint extension https://github.com/lewiswharf/fingerprint... actually the fingerprint doesn't support the section event delegates
What I’m trying to do is create a sort parameter like 101
, where 1 and 0 are yes/no for certain fields. My problem is that one of the fields I’m checking is a SBL. I’m guessing sections event saves the linked section, then goes back to add the linked entries, but doesn’t resave with the reflection field.
Example:
order: published (checkbox), images attached (sbl), gender (select box)
Expecting
111
Getting
101
I'm not sure what the exact problem is, but here's what's going on:
I have something like this
<!-- Interpret the values from event. It can be customized. See the implementation -->
<xsl:variable name="formi">
<xsl:call-template name="sform:formi">
<xsl:with-param name="section" select="$section"/>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="formi-images">
<xsl:call-template name="sform:formi">
<xsl:with-param name="section" select="'images'"/>
</xsl:call-template>
</xsl:variable>
<!-- Render this interpretation as pretty HTML. It can be customized. See the implementation -->
<xsl:call-template name="sform:validation-render">
<xsl:with-param name="interpretation" select="$formi"/>
</xsl:call-template>
<xsl:call-template name="sform:validation-render">
<xsl:with-param name="interpretation" select="$formi-images"/>
</xsl:call-template>
I basically have posts with images. The upload field in the images field has a validation to only allow image files. If I try to upload a PDF, I get two empty success divs:
<div class="validation success">
<div class="">
<p class="item-"></p>
</div>
</div>
<div class="validation success">
<div class="">
<p class="item-"></p>
</div>
</div>
But the event XML is showing this:
<coolsection>
<entry position="0">
<post-values>
stuff
</post-values>
<rep-post-values>
stuff
</rep-post-values>
<entry action="edit" />
<fields />
<filters />
</entry>
</coolsection>
In the images section:
<images>
<entry position="0">
<post-values>
<image>
<name>kinvolvedinvite.jpg</name>
<type>image/jpeg</type>
<tmp-name>/Applications/MAMP/tmp/php/phpJyDZSc</tmp-name>
<size>255072</size>
</image>
</post-values>
<rep-post-values>
<image>
<name>kinvolvedinvite.jpg</name>
<type>image/jpeg</type>
<tmp-name>/Applications/MAMP/tmp/php/phpJyDZSc</tmp-name>
<size>255072</size>
</image>
</rep-post-values>
<entry action="create" />
<fields />
<filters />
</entry>
<entry position="1">
<post-values>
<image>
<name>Kinvolved invite.pdf</name>
<type>application/pdf</type>
<tmp-name>/Applications/MAMP/tmp/php/phpKMXK3H</tmp-name>
<size>172379</size>
</image>
</post-values>
<rep-post-values>
<image>
<name>Kinvolved invite.pdf</name>
<type>application/pdf</type>
<tmp-name>/Applications/MAMP/tmp/php/phpKMXK3H</tmp-name>
<size>172379</size>
</image>
</rep-post-values>
<entry action="create" result="error">
<message>Entry encountered errors when saving.</message>
</entry>
<fields>
<image label="Image" type="invalid" message="File chosen in ‘Image’ does not match allowable file types for that field." code="220" />
</fields>
<filters />
</entry>
</images>
Problems:
Exactly the same as #2
Symphony Warning: reset() expects parameter 1 to be array, null given
An error occurred in /Applications/MAMP/htdocs/XXX/extensions/sections_event/events/event.sections.php around line 901
896
897 if( is_array( $_FILES['sections'] ) && !empty($_FILES['sections']) ){
898 foreach($_FILES['sections'] as $key_a => $data_a){
899 if( !is_array( $data_a ) ) continue;
900
901 reset( $data_a[$handle] );
902
903 // indexed entries
904 if( is_numeric( key( $data_a[$handle] ) ) ){
905 $data_c = $data_a[$handle][$position];
Backtrace
[:0]
GenericErrorHandler::handler();
[/Applications/MAMP/htdocs/XXX/extensions/sections_event/events/event.sections.php:901]
reset();
[/Applications/MAMP/htdocs/XXX/extensions/sections_event/events/event.sections.php:263]
EventSections->getPostData();
[/Applications/MAMP/htdocs/XXX/extensions/sections_event/events/event.sections.php:207]
EventSections->sectionsPrepareEntry();
[/Applications/MAMP/htdocs/XXX/extensions/sections_event/events/event.sections.php:83]
EventSections->sectionsPrepare();
[/Applications/MAMP/htdocs/XXX/extensions/sections_event/events/event.sections.php:50]
EventSections->execute();
[/Applications/MAMP/htdocs/XXX/symphony/lib/toolkit/class.frontendpage.php:712]
EventSections->load();
[/Applications/MAMP/htdocs/XXX/symphony/lib/toolkit/class.frontendpage.php:417]
FrontendPage->processEvents();
[/Applications/MAMP/htdocs/XXX/symphony/lib/toolkit/class.frontendpage.php:185]
FrontendPage->__buildPage();
[/Applications/MAMP/htdocs/XXX/symphony/lib/core/class.frontend.php:103]
FrontendPage->generate();
[/Applications/MAMP/htdocs/XXX/index.php:22]
Frontend->display();
Database Query Log
[0.0001] SET character_set_connection = 'utf8', character_set_database = 'utf8', character_set_server = 'utf8';
[0.0001] SET CHARACTER SET 'utf8';
[0.0013] SELECT SQL_CACHE t1.name, t2.page, t2.delegate, t2.callback FROM `sym_extensions` as t1 INNER JOIN `sym_extensions_delegates` as t2 ON t1.id = t2.extension_id WHERE t1.status = 'enabled' ORDER BY t2.delegate, t1.name;
[0.0004] SELECT SQL_CACHE `session_data` FROM `sym_sessions` WHERE `session` = '9NrWNzYuMI6aE1I4VO63u0' LIMIT 1;
[0.0003] SELECT SQL_CACHE a.* FROM `sym_authors` AS `a` WHERE `username` = 'Pat' ORDER BY a.id ASC LIMIT 1;
[0.0002] UPDATE sym_authors SET `last_seen` = '2013-06-27 16:21:28' WHERE `id` = 1;
[0.0003] SELECT SQL_CACHE * FROM `sym_pages` WHERE `path` = 'listings' AND `handle` = 'new' LIMIT 1;
[0.0002] SELECT SQL_CACHE type FROM `sym_pages_types` AS pt WHERE pt.page_id = 77 GROUP BY pt.type ORDER BY pt.type ASC;
[0.0003] SELECT SQL_CACHE t1.* FROM sym_fields AS `t1` WHERE 1 AND t1.`type` = 'memberrole' ORDER BY t1.`sortorder` ASC;
[0.0002] SELECT SQL_CACHE s.* FROM `sym_gpl_sets` AS s ORDER BY s.name ASC;
[0.0003] SELECT SQL_CACHE `name` FROM `sym_extensions` WHERE `status` = 'enabled';
[0.0004] SELECT SQL_CACHE `id` FROM `sym_sections` WHERE `handle` = 'listings' LIMIT 1;
Is there anyway that sections event could work without the need to rely on members extension at all?
With the 1.3 update to members and beyond, the ability to assign more than one section as a members section means that it's currently impossible to use Section Event with an up to date version of Symphony and Members.
I understand the need for the permission based applications but wish there was an option to work without this coupling in order to process mutiple section forms with ease.
Any thoughts on this @vlad-ghita ? Just a pointer as to the easiest way to trick the extension into thinking members is installed or bypass it somehow?
I am editing an entry.
I get this error
<sections>
<users>
<entry position="0">
<post-values>
<email>[email protected]</email>
<terms>on</terms>
<edit>21</edit>
</post-values>
<rep-post-values>
<email>[email protected]</email>
<terms>on</terms>
<edit>21</edit>
</rep-post-values>
<entry action="create" result="error">
<message>Entry encountered errors when saving.</message>
</entry>
<fields>
<facebook-id label="Facebook ID" type="missing" message="‘Facebook ID’ is a required field." code="200" />
</fields>
<filters />
</entry>
</users>
</sections>
Note that there is already a Facebook ID in the entry. I am only editing the email address. This worked in the previous version of Sections.
and this shows up in validation:
<div class="validation success">
<div class="">
<p class="item-"></p>
</div>
</div>
It would be great if we could pass different messages for created/updated/failed.
For example instead of
Entry edited successfully.
We could pass parameters to the template and get
Your profile was updated successfully!
When I try to insert special characters in my input field like (" or ') the characters are non stored in the DB.
then I believe is an issue of the section event
Sample code:
<input name="sections[images][0][image]" id="sections_images_0_image" type="file">
<input name="sections[images][1][image]" id="sections_images_1_image" type="file">
<input name="sections[listings][images][]" id="sections_listings_images" type="hidden" value="%images[0][system:id]%,%images[1][system:id]%">
Only the first (0) item is being included in the SBL field called images
.
So I’ve got something like this:
$_REQUEST['sections']['reservations']['__filters'] = array(
'Balanced_Debit-create'
);
$_REQUEST['sections']['users']['__filters'] = array(
'Balanced_Customer-create-addBankAccount'
);
But only the filters of the last section are run. Is this a problem with Sections Event or my filter? Here are my filters for your reference: https://github.com/patrickyan/balanced/blob/master/extension.driver.php#L152
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.