I added the sheetnode module and at first it was terrific. I wanted a content type where users could submit reports by using the spread sheet with numbers calculating various functions.
However after playing with the spread sheets and being amazed at how it works within Drupal, I added 3 fields to the sheet countent type. This was the content type that was automatically generated when I installed the module.
When I then tried to create new content of that type, I could see the additional fields that I had defined, but the spreadsheet itself was not displayed. It behaved like a page content type with the 3 additional fields that I added.
THe documentation did not say that I could add fields to a sheet BUT it didn't say I could NOT either.
Then I thought that I would define a NEW sheet type, but had no way to do that. Is this a unique one off, a bug or did I do something wrong be trying to add fields to a sheet content type? It occured to me that if the NODE is a sheet then there can be no other kinds of fields perhaps.
PS The original sheet I created and saved is still in the system. When I go to it, it displays the spread sheet fine. But I cannot generate any more spreadsheets by using that content type. I could delete the content type, but then I have no idea how to get a spreadsheet content type back.
Any healp would be appreciated. I have a host of applications that Drupal could be a solution for if I can handle spreadsheets.
Comments
Comment #1
infojunkieI just tested the latest sheetnode version (6.x-1.x-dev) with an additional CCK text field added to the sheetnode type, and it seems to work fine. Can you please try with the latest version? If it still does not work, can you please export your content type and paste it here for me to try?
Comment #2
leigen commentedI did use the latest version at your suggestion. THe problem was still there, so I retraced all my steps one at a time, and I think I have discovered the problem. I am not sure that this is a bug as it could have been designed that way, but here is my conclusion at this point.
It is NOT the addition of fields per se that creates the problem. It appears when ALL of the following three conditions are met.
A field is added to the sheetnode
The content being created is the "Sheetnode Import from Template" option.
One or more of the added fields is REQUIRED
What I think is happening is that if there is a required field, the TEMPLATE must have that field filled in or an error is produced when Drupal loads the spreadsheet template. In my case I wanted the template to only have some spread sheet info that is imported and not have the fields filled in at first but I want to user to be required to enter the data into the required fields.
Another variation scenerio where the problem is encountered is the following:
Create the sheetnode content type.
Create a template for the spreadsheet,
Save the template and use it to create additional instances of the sheetnode content type.
So far, all is well.
Then edit the sheetnode content type and add a new field that is REQUIRED.
Now try and create another instance of the sheetnode using the template.
As a practical matter this means that: If one addes a required field to an already existing sheetnode content type, the problem ocurrs. My work around was to uncheck the Required box for all the additional fields other than the spreadsheet itself. However, it would be nice to be able to require fields.
If you concur that this is the problem, I could draft some copy for you to add to your documentation. This is a great module for entering much experimental and scientific data into Drupal sites while allowing for calculated fields and conversions, etc. Thanks much for your effort.
PS In the process of debugging this I created a number of extra spreadsheet templates that I really no longer want to present the user creating new sheetnode contact to be bothered with. Is there a way to delete an already created sheet template so it is no longer a choice when creating a sheetnode from a template.
Comment #3
infojunkieThanks for your great analysis. I've actually encountered this problem in the past: I had defined a required taxonomy on the sheetnode type and template importing subsequently failed.
To solve this programmatically, I invoke a new hook
hook_sheetnode_template_alter(&$form_state_node, $template, $form, $form_state)that allows to manipulate the form values for the new sheetnode beforedrupal_executeis called to create the node. You can implement this hook to fill the CCK fields with some value.In the future, though, I might be shifting to using
node_savedirectly instead ofdrupal_execute, which would change the hook's signature - but will not complain if required fields are not set. Feel free to submit a patch for this modification if you have the inclination and time. The salient function issheetnode_import_template_submit()insheetnode.module.Comment #4
leigen commentedI am unfortunately not that good of a programmer to implement the patch, but at least I now understand this. I would be glad to draft a paragraph for the documentation warning about this, if you want.
I am having so much success with this module despite the required field problem. It gives us incredible power and productivity for scientific and medical reporting requirements. It is so good that I would like to suggest a feature for future consideration.
It is to be able to LOCK a cell or set of cells.
The reason is as follows:
We have developed a sheetnode as an imput form for a lot of medical data emenating from a clinic. We use a pale yellow background color for the user to fill in local numbers. As he does so, different ratios and metrics are calculated. Then the sheet node becomes his quarterly report. What we want to avoid is for a user to inadvertantly write over a formula or a label. If we could via the formatting LOCK cells, the only cells we would leave unlocked would be the ones where we want him to input data.
With or without the locking the module is great. Thanks so much.
PS I took me a while to figure out that the format copy button is functionally different from the microsoft Format Painter. I'd be glad to write a paragraph on how it is different and how to make it work if you are only used to Excel. Just let me know.
Comment #5
grn commented+1 to the locking of cells! ;-)
+1 on the paragraph on the format copy button :-)
Thanks.
Comment #6
infojunkieCell locking has been implemented in the latest dev. Please try it (12 hours from now) and let me know. You will need to re-install the SocialCalc core as per the updated instructions.
Here's how cell locking works: A permission "unlock sheet cells" allows users to lock/unlock cells. Users with this permission see two additional icons on the spreadsheet toolbar for locking and unlocking. Users without this permission don't see those icons. Locked cells cannot be edited.
Comment #9
juancra commentedHi, sorry for reopening this after so long, but I'm trying to find the permission to disallow unlocking of cells for a registered user and I can't find it , can you please help me on this? I have no JS errors on the console when displaying the permissions available for Sheetnode.
Thanks!
Sebastian.