Using Node Reference without popup? - drupal

I am using two content types company and Employee . I am using node reference here(Company -> Employee). Within the Company form , the Employee node comes as a popup ,Employee form need to bring the display and functionality to the company form and should keep the node reference. .

Unfortunately, embedding one form in another is nearly impossible in Drupal. That is due to its form-handling and node-handling system.
If you want such relationships, you often need to write a simple, small module that maintains relationships in the database, offers forms to insert/update them and ways to extend nodes with your relational behaviour.

Best I could suggest is an iFrame holding the employee form - but still it's not very elegant.

Related

Drupal views: list referenced nodes except the one used as contextual filter

i have the following case: I am building a website that has information on filmmakers and their films. I have a node type for the filmmaker, with biographical content, etc and another one for the films, with a field 'author' that references one or more of the filmmakers (since one film may have been made by several of them).
I also have a views block called 'filmography' that lists all the films whose author is the filmmaker (node) the user is seeing. Setting this up with a contextual filter was quite easy.
But now I want to present in this block along with the film name, all the filmmakers that may have made the film ('author' field in the film node) and that are different from the filmmaker being viewed. Displaying all the filmmaker nodes referenced by the author field is immediate, but I want to remove the filmmaker that I am using in the contextual filter. The goal is to get something like this:
Filmmaker 1
Movie 1
Movie 2 (with Filmmaker 2)
Movie 3
I have the notion that this might be done using views php and filtering the node references returned, but I wonder if there is an easier solution for that...
Thanks
Update: I have managed to get a result using the Views Field View module, passing the list of referenced nodes (filmmakers) as a contextual filter (node ID) and then adding another contextual filter (node ID as well) as an exclusion, and getting the default value of the letter from 'node id from URL option' (that is, from filmmaker's page the filmography view is embedded in). Keeping the question open for a while to get other, possibly more efficient, alternatives.
As I read your question, the Views Field View module popped into my mind as the obvious solution (then I saw your edit). I think this will still be your best bet. Definitely avoid using php fields as that is not a good practice in general from a security standpoint. If you are concerned about efficiency/performance, then you should just use views caching setting under the advanced options. Seems like this option is always looked over.
If you are looking for alternative options, one might be to use rendered nodes as your View style instead of fields, then use Display Suite to generate additional display modes beyond "Default" and "Teaser," create a view with the filters, then use the Entity Views Attachment (EVA) module to insert a view as a display mode field. While this is certainly a robust approach, it adds a lot of processing overhead with the rendered entities, so you definitely want to cache the results of that as well.
p.s. You might get faster/more responses over at https://drupal.stackexchange.com/

Are Dexterity z3c relations between non-cataloged content possible?

Specifically, I want to be able to use Dexterity content that has a z3c relationfield pointing to a user in acl_users.source_users. The Plone documentation demonstrates how to create relations in the schema using plone.formwidget.contenttree, but the binders all seem to be based on catalog searches. Since users aren't content in this sense they aren't cataloged.
I'm not sure if this is even the best approach, but being able to link to a user seems simple as an abstract concept. I suppose the alternative would be to store the userid as a simple string field and listen for user management events.
There are two possible approaches:
(1) low-level indexing of relationships between content and users, possibly collective.subscribe (disclosure, I am the principal author, and the only example of this in use is collective.inviting, an event RSVP add-on). There are no widgets or UIs for this.
(2) If you simply want to pick users, you could just use a Choice field in your schema with a dynamic vocabulary of users in your system (example), and store the user-id on your content (unrelated warning: user name and user id can be distinct from each other; if you use email as login in Plone 4, I suggest you use collective.emaillogin4). The content tree widget is not going to work here, so look at either using a drop-down (for <200 users) or an auto-complete widget).

Can you create a joined view from task list and related content?

I'm trying to create a view of approval tasks that also includes a column from the related form library. I have tried creating a linked data source between the tasks list and the form library, but have trouble finding much information on creating linked views with the task list.
I have tried:
http://deannaschneider.wordpress.com/2012/07/25/joining-the-task-list-with-related-content-in-a-dvwp/
without luck - it just tells me "there are no items to show in this view." which I assume means it couldn't be joined correctly with the specified table.
I am using the standard approval workflow.
Here is the closest solution I've found so far
1.) Create task form fields in SharePoint designer.
2.) Go into Approval(1) to add the task form fields.
3.) Click 'Change the behavior of a single task'. Add 'Set task field' action in the Before a task is assigned section to set the task form fields to get the value of Current Item:ID.
4.) Use the new task field to create your subview on your linked datasource
While not optimal - and it created me many different problems - I was able to create the view desired.
Hopefully someone will come up with a better solution.

umbraco and custom system table

I have the following scenario:
My website db has a system table called "Companies", which includes an id field, companyName field, and companyImageUrl field.
How do I set up an umbraco document type for adding entries to this table ?
Maybe I shouldn't use a custom table at all ?
Thanks.
As far as I know, Umbraco doesn't support what you want to do out of the box (mapping a document type to a table that isn't part of the umbraco core).
One approach that might work is to create an action handler that syncs a Company doc type to your table when creating a node of that type.
It's a bit of a hack though. I've found that I've very rarely needed to create custom tables. What exactly are you trying to do with it? My guess is that you don't really need it and would be better off working with a doc type instead. Umbraco provides a variety of ways to get and act upon doc types from within custom C# code (check out the umbraco.NodeFactory namespace). You'll also get the added benefit of being able to easily interact with these nodes from XSLT/Razor.

CRM 2011 - Using contact data on Case form

I've installed CRM 2011 to see if I can tailor it to our business. We do repairs, I want to be able to book in a contact (client) and then a case and have the clients number and address print on the case form. All I can find are fields relevant to the case and not client, any idea on how I can select them?
To get fields from the contact onto the case form you could -
Create redundant fields on the case form for the fields that you want to port over from the contact, and then edit the mappings of the relationship from Contact to Case to map those fields to the case.
Create a web application that loads contact data and then add it to an iframe on the case form. Make it so that the web application accepts the case id in the query string of the URL so that it can look up the related contact and load its details within the web app.
Add JScript (or HTML resource in 2011) to the case form to load the contact values on the fly. You will have to use SOAP XML (or REST endpoints in 2011) messages to pull the data from the CRM service and then can inject it into the CRM case form's DOM.
Option 1 is the quickest solution but will not be realtime (only comes over when the case is first created and must be related to the contact on creation. Option 1 also adds some database redundancy.
Option 2 is the most supported realtime solution, but also requires the most work.
Option 3 is easier than option 2, but any DOM injection will likely not be supported for future releases.
EDIT
To use the mapping option, go to Settings > Customization > "Customize the System". Expand the Case item in the left hand navigation. Then click on N:1 relationships and open the relationship "incident_customer_contacts". This relationship connects the contact to its cases.
On the relationship window click on "Mappings" in the left hand navigation. This controls what fields are mapped from the case when it is created.
Click new and select the contact field from the left that you want to map to the case on the right. Repeat this for each field that you want mapped. Note that the fields need to be the same types, and if they are option sets, they will have to have the same underlying integer values for each of their options.
Now when you create a new case from a contact (or set the contact during the create), the fields should map onto the case.
Seeing as how Craig mentioned he's using CRM 2011, I felt I'd clarify that for Option 3 of Cole's suggestion, you can also use SOAP Xml against the Organization Service, or just use the REST endpoint and both will be supported. So long as you utilize CRM's Xrm.Page object to display the data on the form and don't do any other DOM manipulation, you should be fully supported.
Another Option, "Option 2b" we'll call it would be to add fields to the form for the data you want to be loaded, then add a plugin registered to the Retrieve of the case entity that would populate those fields on the fly for you. No redundancy other than the fields on the form at that point.
I would personally recommend Option 2b if possible because there will not be any lag in loading the data onto the form, and it provides for minimal data redundancy, minimal service calls, and the least amount of additional customizations.
My option is a lot easy one. All we are doing is using Dialog to create cases and in the dialog fields you can get contact detail dynamically. At the end of the form when you create new case, use this dynamic values to submit in Case form.
We get times when customer tell us that the phone number is changed since last time and this method gives you option to change customer's details on the fly and submit both in Contact Entity and Case entity at the same time.

Resources