Drupal 7 CCK List of world languages - drupal

I need to create a signup form for translators from any country and give them option to submit the language combinations they can translate to and from. For this purpose I need a list of world languages in dropdown or multi-select widget format. I could not find any module that could make a CCK field of world languages.
Hope anyone can come up with any suggestion.

It sounds like you could use a taxonomy term reference field type with a taxonomy keyed to the languages table (see language_list), which you'd need to do either with a one time mapping (possibly using taxonomy_xml) or a custom module (although it sounds like you have more of a one time use case.)
This is not to be taken as a canonical solution, perhaps someone else has experience with a different approach.

Related

Drupal List View for data entry to multiple records

I would like to create a data entry form in Drupal 7 that is similar to Filemaker's List View. List View is a view that contains many records on a page. When Submit button is clicked, data entered in the fields will be assigned to the individual records.
For example, I have a list of students' names and a column field of grade type. The student's name will be created from Drupal View's filtering, but the grade field will be empty waiting for me to key in.
What is the proper Drupal's module that can enable this functionality? Or what can I do to create this functionality.
This approach is closer to your original request, im testing this out now and I think it should more than do the trick, much more interestingly too.
http://drupal.org/project/slickgrid
Edit:
I highly recommend trying this its awesome!!
A couple quick tips
Be sure to also install http://drupal.org/project/title so you can reset the title (make it a field), Basically with this editor you can only edit actual fields, so same goes for location module, you'll need to use the field option rather than node option.
One possible downer, at least for my site, it appears the drupal module does not support jquery 1.7 which my site uses, so a few buttons etc don't work as expected, also the drupal module does not support the latest slickgrid release either. I'd like to look into fixing that but I dont have the time just yet, possibly someone will before long. If jquery 1.7 is not required for your site then none of that will be a problem for you.
I just figured how to do something similar, although I went about it a different way then I think would be the most desirable, at any rate what I did works perfectly for me at the moment.
What I did...
Used a google docs spreadsheet for data entry, exported a CSV file, then used Feeds module to Import and Map it to my desired content type. I was even able to get location, taxonomy & image fields to map.
Modules & Stuff Used...
Feeds http://drupal.org/project/feeds which also includes Feeds
Importer, you'll want to read through all the instructions to be sure
you understand the import methodology, I could never explain it all
here!
Feeds Tamper http://drupal.org/project/feeds_tamper , I used this to
explode the cell which had a | separated | list of taxonomy terms (dont use comma), the
nice side effect is if the term doesn't exist it creates it for you!
Spreadsheet - Personally I created a Google Docs Spreadsheet, any type
will do. This spreadsheet has every field you want to map to fields
in your content type.
"More Better"
Currently I am on the hunt for a simple backend UI way to do this, but this is what I've settled on for now. I just couldn't imagine hand entering hundreds of nodes, page submit after page submit! I will post back if I figure another way to do it. Good luck!
I have just started with
https://www.drupal.org/project/editableviews
which enables the creation of views where all the fields are editable, including when no data exists in the related entity. At the first url is also documentation.
There a screencast which shows more
https://www.youtube.com/watch?v=g_D4z4Bw6iw

Field data in one table, not many. for drupal7

I am working with the commerce module to create an online store. I am modifying the products .install file to create a content type (as I have been told this is required) and as part of that content type, I need to create lots of fields. The list will be around 50-60 different pieces of information.
Ideally I would like to store these in a single table with the productID at the beginning and all the other information along, but this doesn't seem to be the case; all the fields are stored in different tables.
I noticed that the "Address" module that is also used with commerce creates a field-type that has about 15 different values all stored in the same box. How is this possible? I noticed that if I set the cardinality up to 5 for example, it creates different rows. I just want a table with the following:
ID - value1 - value2 - value3 etc etc.
I also don't need any modules/extensions as this all needs to be written in the files. I also don't think that changing to the mongoDB ( I think ) is an option, so what are my options in this situation?
That's not how the Drupal field system works I'm afraid, one field == one table (well actually 2 tables if you include the revision table for each field).
The Address module uses hook_field_schema() to define several columns for that particular field (have a look in address.install and you'll see what I mean).
So if you want to put everything in one table you'll simply have to define your own field type (see the examples module, specifically field_example for help with that).
Bear in mind though that the number of columns you define in hook_field_schema() will be static once the module is installed, and the only way you're going to be able to increase/decrease it is with an _update hook for your custom module.
Also, if you're hacking at files that are included in the Commerce module...stop!: Commerce is still very much in it's infancy and you will likely have to update it soon...once you've done that your code changes will be gone and there's a good chance your site will be in an inconsistent state.
The whole point to Drupal is that everything is hooked/farmed out so that it can be altered by other parts of the system. There's nothing you can change in product.install that can't be done by implementing a Drupal hook in another module.
If you're unsure, post another question detailing what you're trying to accomplish by directly editing a contrib module file and one of the Drupal gurus on SO will point you in the right direction :-)
EDIT
Just to say I've been working with Ubercart in Drupal 7 for quite some time now and find it a very, very good solution (a lot of Commerce contributed modules are still in dev/alpha/beta; this is less so for Ubercart contributed modules). It might be worth a look.
Some more info
I think you've basically got two options here but either way you'll need to create a custom module (excellent set of instructions here).
Option 1: Create a custom field
If you're a Drupal coding beginner I'd suggest this is probably the easiest way to accomplish what you want, but it's still not totally straight forward. Grab the field_example module from the Drupal Examples module link above and have a look in the .install file, specifically the field_example_field_schema() function. That defines the columns that will be in the table for that field. Then have a look in field_example.module...pretty much every function that's commented with Implements hook_x is one that you're going to want to copy into your module and tweak for your own needs.
I think this will be easier because Drupal will handle the table/form field creation for you
so you don't have to mess with the database, schema or form APIs.
Option 2: Create a custom module
This option involves implementing your own table (like you suggest in your comment) where the primary key would be the entity ID of the product and would also contain all of your custom columns. (See the Schema API documentation for help with this).
Then you'd implement hook_form_alter() to add the form fields necessary for a user to input the data, and then implement hook_node_insert() and hook_node_update() to persist this data to your database table. It's quite hard to go into any more detail without actually writing code and it's quite a bit of code!
Hope that helps, sorry I can't be any more specific but it's not easy without knowing all the ins and outs of the situation

Drupal 7: How can I create a key/value field(or field group, if that's even possible)?

Let's say I'm creating some app documentation. In creating a content type for functions, I have a text field for name, a box for a general description, and a couple other basic things. Now I need something for storing arguments to the function. Ideally, I'd like to input these as key-value pairs, or just two related fields, which can then be repeated as many times as needed for the given function. But I can't find any way to accomplish this.
The closest I've gotten is an abandonded field multigroup module that says to wait for CCK3, which hasn't even produced an alpha yet as far as I can tell and whose project page makes no obvious mention of this multi-group functionality. I also checked the CCK issue queue and don't think I saw it in there, either.
Is there a current viable way of doing this I'm not seeing? Viable includes "you're thinking of this the wrong way and do X instead." I've considered using a "Long text and summary" field, but that smells hackish and I don't know if I'd be setting myself up for side-effects. I'm new to Drupal.
There is the http://drupal.org/project/field_collection module but it's not yet ready. Right now you would need to implement your entity alas to do this :( not easy.
Not sure how well it would work, because it currently does a bit more (eg, forces to group pairs into categories and the keys need to be predefined) but you might want to have a look at http://drupal.org/project/properties.
You could create a these key-value fields on their own: create 2 regular fields that that can be added as often as needed.
So you have a x fields for the keys and x for the values. If this is only for you or other people it might work OK but usability wise, it's very ugly.
If you need to extract the fields from the function, to display it properly in a page template, you should propably use a different approach. Write the function with its arguemnts in a CCK field and in the template extract them as needed. The arguments are always (depending on language) in () and the different arguments are seperated by , so splitting them would by pretty easy.

How to filter custom content type nodes using ajax in Drupal?

I'm in a situation where I think I need to create my own custom search module. What I'm trying to do is make a page with a list of all my nodes in the node type - let's call it 'Beer'. So I want to be able to filter through the beers in a fashion similar to the one you find on the Apple Trailers page ( http://trailers.apple.com/ ).
I tried using Views 2 but ran it to a few problems:
I can't make the filter links like in the top of the trailers page (exclusive, just HD etc.)
The search function will only search one field (Exposed field "Beer title" but I also want it to search for manufacturer and other things.
I'm aware of a couple of solutions:
I could fix the last problem by using the Computed Field Module where I could combine the fields I want to search through. I just don't see this as a very elegant solution.
I could make my own module and create my own database queries where I apply the relevant filters (I just don't know how).
I could somehow use my already installed Solr module.
So the first solution - the easiest I guess but also kind of bad with duplicate content in my database.
The second solution - the best (maybe) - problem: I'm too dumb.
The third solution - Solr seems pretty cool but would I be able to present my beer nodes with just the title and a picture?
So I guess my question is. Which one of the three would you use? Or what other solutions could I potentially use (I'm confident there are things I haven't thought of :))?
Sounds like this could be a good use for Taxonomy not different node types. Also, Have you considered http://drupal.org/project/quicktabs ?
You could set up each "filter" as a tab that passes an argument down to a view. Then don't expose any views filters to the user.

Can Drupal terms in different Taxonomies be synonymous?

Let's say
Taxonomy_A is associated to Node_Type_A
Taxonomy_B is associated to Node_Type_B.
AND
Both Taxonomy_A and Taxonomy_B have a term called 'yellow'.
Is it possible to make terms 'yellow' synonymous, so that if I'm looking at a list of 'yellow' stuff, I'm seeing content of both types (Node_Type_A, and Node_Type_B)?
Progress:
Unfortunately it is not possible for taxonomy terms to behave in Drupal as described in my question (at least not without forcing it):
It is clear by taking a look at the terms_related table that it would be possible to create paths that forced related terms together using the taxonomy_get_related function regardless of what vocabulary the term belongs to:
However, the way to get to these terms is through the taxonomy_get_related function in the taxonomy module. This function is not used at all in drupal-6 core except to define it. (I did find it once in the ctools module).
I think you are doing it wrong. I mean using taxonomy wrong, not technically, but as a concept. Ask yourself why do you have 2 vocabularies with term yellow? Both are colour. they belong to same dictionary. Maybe tell little more of what you are trying to make.
Maybe you need to change setup so you don't associate one dictionary to one content type, maybe CCK, views and this module can do what you need http://drupal.org/project/content_taxonomy

Resources