Add Custom Field to Criteria in ATTopic - plone

How do I add a field, say 'Contributors' in Archetype types, to be listed in Field name drop down menu? For example, in a fresh new Plone site, I can manage criteria at events/aggregator/criterion_edit_form. I want 'Contributors' and custom fields to be added as criteria.
BTW, I ever look into Products/ATContentTypes/tool/topic.py, it seems that I have to addIndex and make it 'enabled=True'. But how? Or do I go into wrong direction?
/marr/

You can go into Site Setup and go to the collections configuration(or just append /portal_atct/atct_manageTopicIndex onto the site url) and manage which which are allowed to be used in collections.
You'll have to click the "All fields" button to see everything available. The caveat is that the only fields available are those that are indexes in the portal_catalog. So for your case, you'll need to add a contributors index in the portal_catalog in order to have it available in the form here.

Related

Drupal 6.x Add More Module - No end to adding more

Simple question for all of you here dealing with Drupal 6.x...
With Drupal's Add More module, is there a way to configure my webform so that there is no limit on how many of a specific fields I can add more of?
Please see my image for example:
For example, I'd like to enable the user to add as many titles as they would like. Is that doable?
Unfortunately, it's not currently possible to add unlimited "add another" functionality with webforms. And if this functionality does become a reality someday, I doubt it will be backported to the Drupal 6 version of the module. From the webform modules author (quicksketch):
there is no progress on this subject. The ability to support multiple
values requires a tremendous amount of re-architecting, including
changes to the way CSVs are generated, analysis, the database
structure, and the UI (both for administrators and users). I wouldn't
expect this feature to be added any time soon.
See this thread for more information:
http://drupal.org/node/354381
I would suggest using a node and the CCK module plus rules and views to collect this information.
Assumptions:
Anonymous users can fill out the current form
You need some way of retrieving the data that is submitted
Regular users of the site should not be able to view submissions
Very loose directions:
Create a content type and add all of the fields that your current webform contains to it. CCK has the ability to store unlimited values out of the box. On the field settings page, inside the Global Settings fieldset, select "Unlimited" for the "Number of Values" field.
Give anonymous users permission to Create [your-new-content-type] Content on the Role Permissions page.
Using the Rules module, create a new triggered rule that fires on "Content is about to be viewed" with an condition "Content has type [your-new-content-type]" and an action of redirect to homepage (or a custom error page that you created). (Note: this is a bit of a performance hit. There are better ways to restrict access to this content type, but for the sake of this tutorial, this was the easiest to explain)
Using the Views module, create a new view with Style set to Table. Add each of the fields in [your-new-content-type] in the fields section. Under "Access" choose "role" and select the role that is assigned to your user. Add a "page" display, give it a Path and save. This is the page you will use to view submissions.
Optional:
Use the Rules module to send yourself (or the submitter) an email when a node of [your-new-content-type] is created.

Creating list of similar nodes in Drupal 7/Views 3

Copy from drupal.stackexchange.com hoping to get more answers here:
I face a rather common problem of displaying a list of nodes similar to current one. Similar node is defined as one having at least one taxonomy term that current node has. There are few solutions available as modules, however the modules I've found (specifically Similar By Terms) are in beta stage (as in "not working properly") for Drupal 7.
I've also found a couple of solutions based on Views and contextual filters (such as http://scito.ch/content/show-related-nodes-block-based-taxonomy-terms-views-3-and-drupal-7) or relations. I quite like this way as it saves me installing extra modules and with Views being actively developed and supported I'd prefer to use them rather than any custom solution. The problem I can't get around is how to sort "similar nodes" by the number of terms they share. For example, if I have "IPhone 4S" Node with Terms "Gadget", "Apple", and "Phone", I want similar nodes in the following order:
IPhone 3 (Apple, Gadget, Phone)
IPad (Apple, Gadget, Tablet)
Mac (Apple, Computer)
Bramley (Apple, Fruit, Tree)
How can I sort nodes in this view by the number of terms they share?
This question is about building a view, please do not suggest module or custom php-based solutions. Thank you.
Create a block view
Add Contextual filter -> Content: Nid -> Provide default value -> Content ID from URL
Add Relationship -> Content: Taxonomy terms on node -> specify the appropriate vocabulary
Add Relationship -> Taxonomy term: Content using vocabulary as specified above -> Check off Require this relationship
Turn on Views aggregation (NOTE: the arrow in the screenshot below is pointing to the wrong spot and should be pointing to 2 rows below where it is)
Assuming you are listing title only, edit the title field to use the Relationship you set up in #4 above.
Add new sort criteria of Content: Nid. In aggregation settings, select Count. Use relationship from #4 and sort descending
Add Contextual filter -> Content: Nid -> Use relationship from #4 -> Provide default value - Content ID from URL -> Scroll down and expand "More" then check "Exclude" to remove current node from the view
** See comment by #garret-albright below for testing this in the Views UI preview. **
guess what - there are modules for that too :D
i can recommend similar by terms giving you that view without configuration hassle.
When you are configuring complex views like this one, there are some configuration tips that may help you to understand what is really going on each step:
In Structure >> Views >> Settings >> Basic:
Check 'Show advanced help warning' (important: requires Advanced Help module installed)
Check 'Automatically update preview on changes'
Check 'Show information and statistics about the view during live preview'
Check 'Show the SQL query'
and finally, Save configuration
Now you can preview the results from each configuration step, the SQL query associated and the fields and tables involved, so you will find easier to understand how filters and aggregations work.
Hope it helps.
This is an alternative solution, related to this question. However it might not apply to every case, but if you can use it it's simpler (and safer than aggregation in my opinion).
I am going to use panels. Once you create a panel to show your entity (node or anything else) you can add multiple views and show them beside the content. one of these views is going to be our related content.
Thus panels is the only limitation. Maybe it's possible to use mini-panels and represent it as a block, I haven't tried myself.
Prerequisites
Views (d'oh!)
Panels
Views Content Pane: no need to download, It is in ctools module downloaded with views.
Page manager: Same as Views Content Pane (Optional / Highly Recommended).
The view
Create your view as you normally would, but do not create it as a block or page. Uncheck both.
In views configuration page create a relation to taxonomy term on the entity.
Create a contextual filter to filter: Taxonomy term: Term ID.
Create another contextual filter: Entity ID or Content: Nid if it's a node.
While creating this one, at the bottom there is a collapsed fieldset which has the option: Exclude. Check it as marked.
Now by clicking Add create a new display of type Content pane.
In the display configuration area (named: Pane settings) open Argument input. You should have 2 options:
Content: Nid source : Set it's source as From context. Set it's Required context as Content ID (if you are not using node it can be ID.
Taxonomy term: Term ID source : Set it's source as From context. Set it's Required context as Term ID.
Congrats! You are done creating your view. It's time for a panel (I wont explain much about creating a panel as it is beyond the scope of this Q/A).
The Panel
Create a panel (or enable the node/%node default panel and add a variant).
In context tab, Create a relation to taxonomy term on the entity.
Click add content in one of panes.
If you didn't change the view's category, it's in views pane add it. It will ask for an Entity ID and Term ID both are available now in your panels context, set them.
Now when the panel is displayed, All the content with with the same term excluding the content on this page are displayed.
Views Configuration
Contextual filter
Argument input
Important P.S:
This method is tried and it works flawlessly, but at the time of writing this article ctools had a bug. There is a patch for it: https://www.drupal.org/node/2195211
I am not sure if I fully got the gist to your question but I think node queue is the answer. Check out http://drupal.org/project/nodequeue
The module is well developed. I have used it for a client and you can use their smartqueue api too make make your list.
Hope I was helpful.

Creating a Drupal view with an RSS feed

I am very new to Drupal and I need a bit of help. I am working with Drupal 6 (because that is what the site uses).
I was asked to make a View that would display a RSS feed of certain parts of the website and I don't understand how to do this. I know how to create a View and that it must be set as a "feed". But I am not clear about what to do from here. From the examples I have seen (and not entirely understood), it seems you might need to to modify the arguements or fields, but in which way?
Also, what exactly does the "attach to" in the feed settings do?
You will want to create a view, and add a display of type feed using row style: node.
The default behavior will assume you want to include all fields on the node in the feed.
However, you can control the fields that are included in the feed by going to Content Management > [Your content type] > Display fields > RSS. From here there are checkboxes which allow you to select fields for exclusion when being displayed as part of an RSS feed.
The "attach to" setting allows you to select a page or block view on which to display an RSS icon that links to this feed.
Depending on the content you want to include in the feed, you will want to set a filter, most likely on node: type, and node: published.

Client management page on Drupal 7

I would like to know what is the best way to create a custom page for my client where he can update is content by himself, the simpliest way possible for him, without even entering drupal management.
I would like to create a page with different dropdown list where he can't update a table on a page, only by selecting an item in those and add other dropdown list as well.
For example: he logs in a custom page
Theres a list with different kind of fruits, he choose banana and it automaticaly update a page table and update it with banana.
After that he could also create a new drop down list of vegetables for example, and add different kind in it so he can use it to update the site later. All that done with ajax as well.
I'm very new to drupal and have a couple of php notions, but i don't know where to start, would it be in CCK, Views or Form Api or the three at the same time?
Or is there a module out there doing that kind of thing?
English is not my primary language, so sorry if it isn't very clear.
Thank you very much.
I think what you are looking for is CCK module. You can create a CCK content type and have a field within it called fruits. From the admin interface you can decide what are the values that should be in the dropdown.
You can give the client permission to create a node of the content type. If you think he should be able to edit only the drop down values, make sure you give him the permission to only that field.
You can create a listing page using http://drupal.org/project/views or you can also consider using
http://drupal.org/project/editview
You should take a look at views bulk operations, and try using the "modify node fields" feature which will allow you to perform bulk operations on node fields displayed in a view and then look into roles & permissions which will help you restrict viewing the "View" by role.

How to create a custom form in drupal

I need help on how to create a 'custom form' using the same fields provided by cck.
Drupal gives you the ability to add fields to 'nodes' and how to theme their output. But I would like to be able to post a data from my own form (that pops-up) and sends data to the drupal database using the same drupal cck.
How do I access the specific form inputs to add data to my content types ? because the default form is kind of 'ugly' and loads on different page(without ajax).
Help would be much appreciated
There are several routes you could go down.
The easier option is to use the Webforms module. While this gives you similar fields to cck, they are not exactly the same, and if you have a module that implements a specific cck field type, it won't be available to webforms.
The second choice is to write your own module using the forms api. This can mean a lot of learning, add it takes time to get up to speed, but ultimately you have total control over how your form will look and behave. The forms api doesn't give you exactly the same fields, but all the tools are there to create them. Sometimes you need to hack open a module to find out haw a specific field is implemented.
A third option would be to use cck itself. You could create a content type and add the field types you want on your form. You would them give users permission to create but not view or edit the content type. The form submissions would them be nodes on your website. This would make me slightly nervous, so make sure all your permissions are correct!
The second part of your question: you can use a theme file to override the appearance of most forms and make them pretty.
James

Resources