Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
admin/content/types
The description for table manager on this page is a bit of a mess. All the html is exposed and for some reason, it lists all the possible tables you can create.
I thought you might blame the theme, so I checked it in bluemarine, still the same result. It's ooooooooogly.
Anisa.
Comments
Comment #1
pobster CreditAttribution: pobster commentedNah I'm afraid it's a necessary evil so to speak! I borrowed *cough*stole* the coding idea from the ecommerce module at the time I wrote the original module and tbh, I've not looked at it again with regards to changing it... Maybe I should, that was quite a few years ago and maybe things are different now... And I have always thought it looks rubbish myself...
The reason for it is because neither tables nor the table entries are 'nodes' and to allow them to be 'enter-able' from the create content screen you need to out-fox Drupal a little bit... I've had issues in the Drupal core queue for years now which go completely unanswered as no-one but me considers that the requirement to add anything to the create content screen which ISN'T a node is important. Which is very annoying... Especially as they've essentially 'closed-shop' in Drupal 6.x hence why the permissions are currently buggered... That'll probably be an issue until someone more knowledgeable helps me out, I doubt I'll be able to fix it myself - it's an impossible situation. If I solve it, it'll only be by luck... And then like with the delete columns problem with Drupal 4.7.x and 5.x, they can easily just change core and break functionality again. That's the problem with trying to out-fox Drupal... Some perhaps could view it as a security flaw and shut it down? For me though, I *require* it... I remember that even the Gmap module used to allow you to have a 'create macro' entry in the create content page, which well... Is where it should go surely? Well, it's certainly not there any more - in fact it's not been there for ages! It gets tiring trying to get Drupal to do things it doesn't want you to do... Drupal is supposed to be flexible, but on occasion it can be your nemesis, making you run around in pointless circles to achieve the 'effect' of functionality which isn't strictly allowed.
...Still on the plus side, only users who have complete administrative control over content types will see the messiness! And on the plus side x 2; Tablemanager v2 creates tables as nodes (which you can still use as filters too) so it's only the entries which are 'bogus'. I have toyed around with making the entries as nodes as well - all this is partly why I've never released any code. I like toying with changing it completely while it's bare-bones, that way I don't have to keep providing upgrade paths in .install files as regardless of its dev/ alpha/ usability stage - someone will use it and complain if something breaks...
Wow! That's a whole lot of guff... Sorry about that!
Pobster
Comment #2
rivena CreditAttribution: rivena commentedAh, well, as long as the end user doesn't see it! That makes it all OK! ;p My users don't even see the create stuff screen anyway, I took it completely away from them. The only create content they can do from the menu is post a story. Everything else is where it ought to be.
Still, it's not a necessarily evil, it's an I give up evil. ;p
But how do blocks do it? Blocks aren't nodes, they don't come up in the create content screen?
Anisa.
Comment #3
pobster CreditAttribution: pobster commentedAh see now I meant the /node/add (access through 'create content') screen. Which is where the content-types all show up... I've hit a crossroads here... I could take the simple route and just create all table entries as nodes... It's not so much a problem, it just might create enormous node tables for people with enormous tables... I kind of consider that they're easier to keep track of when they're all nicely tucked into their own tablemanager_data db table? That'd then cause issues with say... node_clone, all node_access modules, ...forward module perhaps? The real problem here is that there are just so many different ways I could store the table data, that I *still* haven't really decided what is best? I've stuck with the serialized arrays simply because that was the first way I programmed it (which I borrowed *cough*stole* from ... the menu module I think! Was nearly three years ago now!) But I know (now anyway) that this is probably the worst possible way to store it... Reason being is that you can't do any sql sorting/ hiding/ magic as the rows are serialized and look like gobbledegook to mysql. So... Every time a table is viewed (even for a new page of the same table) it's built from the ground up, in FULL and then whatever is needed is taken from it. Awful... And slow...
Here's what I've been playing with;
db table = tablemanager_table_test
Anyways... The point of all that (also guff) was that it currently really is a necessary evil ;o) The other ways create more problems than they solve, even though that last way is exactly how Tablemanager v2 gains so much more functionality than the current version... And at the same time, is exactly why it's not released yet.
Pobster
Comment #4
peterdd CreditAttribution: peterdd commentedIMO: For the simple stuff * I * want the module tablemanager use there is no need of making each row entry a drupal node.
For the version which creates a database table for each tablemanager table:
Why not choose an appropriate field data type for each column when creating or modiying a tablemanager table?
For multi currency field maybe choose decimal plus an extra column for holding the currency (dollar,euro,..) as enum or string.
This would be much cleaner than holding numeric data in text/varchar fields and databases/SQL like that much more for sorting/indexing etc.
Further I tested (only mysql) sorting a mixed data field (an decimal amount with a currency sign saved in a varchar(100) - don't do that in your app!) and following SQL is working too:
SELECT field1 FROM `test_tablemanager1` ORDER BY CAST( field1 AS DECIMAL ) ASC;
output:
Even on such mixed data fields (just avoid if possible) SQL can help you out of the mess.
Comment #5
pobster CreditAttribution: pobster commentedThe output you've given as an example is a little 'unnatural' given that you wouldn't normally put a dollar sign at the end of a price?
What I'm toying with is complete control over fieldtypes... When you create a table, it's now created as a node and as such means I can use tabs on the node using Drupals api (as recommended) in the same way you get 'edit' tabs, etc. I'm thinking I can use these for settings per fieldtype? I just don't know how messy it'll get... At the moment it's only a thought in my head... I'm thinking for example, you'd create a currency fieldtype for column 1 - set the currency in the same way ecommerce does it (I've used this code before so I'm familiar with it), then the module generates a new db table containing this new column which will be int(4) or whatever (you'd set the max length in the settings). The table wouldn't contain the currency symbol, that'd be stripped - it'd only contain the number and so can be sorted easily enough, the currency information would be stored in either a settings table or maybe create some specific Drupal variables to contain it? Dunno, it's all a lot of thinking about stuff at the moment. We'll see...
Pobster
Comment #6
peterdd CreditAttribution: peterdd commentedThat depends on Language.
In Germany the currency sign is normally written past the amount. In your country it seems to be written before. Another reason to not mix currency sign and amount in one database field.
I wrote my comment #4 as anwser to this in comment #3.
Comment #7
pobster CreditAttribution: pobster commentedYou're not considering the restrictiveness of it? I can't exactly write a caveat saying "only use this if you're German"!!! I think there must be a better way, I've just yet to find it.
Pobster
Comment #8
pobster CreditAttribution: pobster as a volunteer and at ArcadeGeek LTD for Rackspace commentedClosing as D6.x is now unsupported.