![]() |
CodeExtinguisher 2.0 Release Candidate 14.2 - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Libraries & Helpers (https://forum.codeigniter.com/forumdisplay.php?fid=22) +--- Thread: CodeExtinguisher 2.0 Release Candidate 14.2 (/showthread.php?tid=8451) |
CodeExtinguisher 2.0 Release Candidate 14.2 - El Forum - 08-20-2008 [eluser]Paul T[/eluser] [quote author="OOBE" date="1218724329"]When I use OneToMany plugin, click "Add new", the form without a submit button. How can I submit it?[/quote] The related record will be added when you submit the current record you are editing. CodeExtinguisher 2.0 Release Candidate 14.2 - El Forum - 08-20-2008 [eluser]Paul T[/eluser] Hi Rob, No need to apologize when asking for help. We've all benefited from the CodeIgniter community. The best thing to do is participate and return the favor, if possible. As far as your issue goes, I ran into similar (if not the same) problems when I started working with Codex. After messing with it quite a bit, I went back to the examples and I finally discovered what works. To use your application, Codex wants your main form to be named music_form.yml. If you are referring to the music table from another table, it will look for music.yml. In my app, here's the setup: staff, departments, departments_staff Here's staff_form.yml: Code: name_first: And departments_form.yml: Code: name: When you want to directly access the staff or departments tables, Codex uses the *_form.yml file (no form_setup). But when you include the ManyToMany plugin, Codex looks for the *.yml file. For example, in my code it needs to see the departments.yml: Code: form_setup: Notice that in this file, which we only access indirectly via the ManyToMany plugin (to access directly we use departments_form.yml), there is a form_setup at the top. So it appears that Codex assumes specific naming conventions. As troubleshooting step if you get stuck, you may try only using underscores in join tables (i.e. MUSICTYPES vs. MUSIC_TYPES). All my tables are named lowercase, but I don't think that matters. Anyway, something to try if you get stuck. Also, make sure your join tables have the field names Codex likes. For my departments_staff: id, departments_id, staff_id. Oh, and make sure your yml files do not contain tabs--spaces only. Good luck, Rob. I hope this was clear enough to help! CodeExtinguisher 2.0 Release Candidate 14.2 - El Forum - 08-20-2008 [eluser]Rob Stefanussen[/eluser] Hi Paul, thank you so much for the explanation, it's making a lot more sense, even from a quick skim. I will try to integrate this later tonight, and let you know how it goes. Thanks! CodeExtinguisher 2.0 Release Candidate 14.2 - El Forum - 08-20-2008 [eluser]Nagyman[/eluser] Note: See UPDATE below. Hey! I found the post below while searching for a solution to "prepForDB null values". [quote author="jTaby" date="1212624776"]gusa, Actually, I'm not sure you can do that without modifying the code a little bit. At first glance, my instinct was to tell you to create a new plugin exactly like TextBox, but with a different prepForDb function. But if you return NULL from prepForDb, then the whole thing will be omitted from the query. If that's fine, then go ahead and do it. If you intend on setting the value as NULL, then I would add a checkbox and in your plugin's prepForDb function, I would do what needs to be done and return NULL...[/quote] The ability to set a field to NULL when it's empty is very important. INSERTing new records is no problem, because setting the value to NULL omits it from the SQL INSERT and the default NULL in the database can take care of that. The big problem arises when you want to UPDATE a value and set it to null. The source of the issue is in this function in plugins/codexevents.php Code: function prepForDb($data=array()){ I'm going to guess that the motivation for unsetting the field was to add the ability to remove a field completely from the INSERTs/UPDATEs??? However, null has important meaning and another mechanism is necessary. (CodeIgniter knows how to handle null values.) Personally, I will be changing the above code to this: Code: function prepForDb($data=array()){ If I encounter problems with this change, I'll post them here. jTaby, if you foresee problems already, please let me know. Thanks! UPDATE (20080922) Ok, the above worked alright until I tried to use the ManyToMany plugin, which returns NULL from the prepForDB function. The expected result being that the value would not be inserted/updated since it would be removed. With the change I made above, the ManyToMany field was added to the UPDATE/INSERT statement as field = NULL, but the field doesn't exist in that table, so it fails. Here's my suggested change; I'll go with it until I find another problem. prepForDB functions can now return a "NULL" string which will be converted to a null value to be inserted/updated. If prepForDB returns NULL (not a string, but the literal), it won't be included in the statement. The only downside is that you can't insert a NULL string into a text field in the database, but hopefully that doesn't come up very often. Code: function prepForDb($data=array()){ CodeExtinguisher 2.0 Release Candidate 14.2 - El Forum - 08-20-2008 [eluser]Rob Stefanussen[/eluser] Paul, thanks for the tips, I was able to get it working! I thought you might like to know about a little discovery I made while I was at it. At first, I was using the naming my YML with "_form", but that wasn't working. After digging around in the code, I found out what was going on. From what I can tell, there's nothing special about "_form" to CodeEx. You can either do your CRUDs using a custom controller, or use the default controller. Right now, I'm using the default controller until I have a better handle on things. The reason YMLs don't need the form_setup directive is because it's defined in the $config array in the controller. It turns out that the trick is in the naming of the linking table and the foreign keys, which I wasn't able to figure out until I read your reply. I was a bit disappointed that CodeEx relies on an inflexible naming convention for this, but beggars can't be choosers, right? I was able to get my tables linked up with these YMLs: music.yml Code: form_setup: music_types.yml Code: form_setup: I hope this helps clear things up, someone please let me know if I'm way off base! Thanks, Paul CodeExtinguisher 2.0 Release Candidate 14.2 - El Forum - 08-22-2008 [eluser]Treb[/eluser] Hi there, First of all: great tool! I've implemented a backend application to manage 7000+ entries. When loading (unfiltered) all entries are streamed to the browser and after that they are paginated. This takes a very long time. Is there a way to do queries per page like in sql SELECT * FROM table LIMIT 0,100 ? Thanks. Bert CodeExtinguisher 2.0 Release Candidate 14.2 - El Forum - 08-22-2008 [eluser]Treb[/eluser] Hi There, My database expects UTF-8 encoded strings, but the default character set is missing from the config.php. Adding: Code: /* fixed it. Enhancement for the next version? Bert CodeExtinguisher 2.0 Release Candidate 14.2 - El Forum - 08-22-2008 [eluser]Majd Taby[/eluser] hey guys, thanks for the continued interest. As you might have noticed, I haven't been participating in the forums at all in the past 2-3 months. There are multiple reasons, mainly: 1) I got tired of php 2) I needed a break from CE (a full year of development) 3) I got a job So if you guys have some patches you'd like to see rolled into a release, please submit them to me (either through PM or email) and i'll svn commit them. The project isn't dead...it's just put on hold. CodeExtinguisher 2.0 Release Candidate 14.2 - El Forum - 08-25-2008 [eluser]unsub[/eluser] [edit]I have come up with a tentative solution, so I'm clearing space here, as the question is no longer relevant.[/edit] CodeExtinguisher 2.0 Release Candidate 14.2 - El Forum - 08-25-2008 [eluser]unsub[/eluser] an edit button in table view. <img src="http://www.unsub.ca/editbtn.jpg"> don't know if anyone would find this useful, and it's dead easy, but maybe there's a beginner like me here, so... in codex/application/views/view_modes/table.php, around line 75 - 80 depending on what you've done to it, right below this... Code: <td width="60" class="first"><input class="edit-button" type="checkbox" value="<?php echo $entry[$this->codexadmin->primary_key]?>" name="selected_rows[]"/> ... do this: Code: <?php Then put your little edit btn icon in the assets images folder in whatever template you're using. For 'clean blue' it's here: codex/assets/clean_blue/images/ <put your image here> I drew that little pencil button in inkscape, so if you want it say so, i'll link to it. I figure most people here could draw a better one. Hope that helps someone and doesn't just waste typespace ![]() cheers. |