Mandatory has one relationship. - newmips

I have to model the following situation: Employees can rise insurance claim which can be for illness or for an accident. Claim for accident requires some additional input (location, police report,...).
I told Mipsy that the entity claim has a accident, which was defined later with a select entity accident, and the create filed location mandatory. So far, so good, the screen accident is on a new tab, which I cannot save without a value in location.
Is it possible to have a select box accident/illness/other on the claim, making the tab accident mandatory in case of accident, and accident only?

You can do the following:
select entity claim
add field Type of claim with type enum and values Accident, Illness, Other
Then open file "views>e_claim>show_fields.dust" in the editor and add the following condition on tab:
<ul class="nav nav-tabs">
<li class="active">
<a data-toggle="tab" href="#home">
{#__ key="entity.e_claim.label_entity" /}
</a>
</li>
{#eq key=f_type_of_claim value="Accident"}
<li>
<a id="r_accident-click" data-toggle="tab" href="#r_accident">
{#__ key="entity.e_accident.as_r_accident" /}
</a>
</li>
{/eq}
</ul>
You can set the same condition in tab content to avoid sending non-relevant data to the browser.

Related

How to use obscure types like ExerciseGym?

I've found this type on Schema.org: ExerciseGym
It doesn't have any examples with it and I'm confused as to how to use it because it seems to inherit properties from other schemas. This one is more specific to the business so ideally I'd like to use it.
It says "properties from LocalBusiness". I have used LocalBusiness before, and it contains good examples. Should I combine LocalBusiness and ExerciseGym and Person as I would like to list the personal trainers of the gym as employee but it says employee is Person?
So is something like this the right way to do this:
<div class="contact" itemscope itemtype="http://schema.org/ExerciseGym https://schema.org/LocalBusiness https://schema.org/Person" itemprop="employee">
<div class"name" itemprop="name">John Doe Does</div>
...
</div>
A type "includes" all its parent types. An ExerciseGym is also a SportsActivityLocation, a LocalBusiness, an Organization, a Place, and a Thing.
So you don’t have to specify ExerciseGym and LocalBusiness, specifying ExerciseGym is sufficient.
If you specify Person in addition to ExerciseGym, you are conveying: There is something that is a person and a gym. This is of course not want you want to say. To add an employee, you need two separate items: the gym and the person. In Microdata, an item is created with the itemscope attribute.
Example with an ExerciseGym that has two employees:
<div itemscope itemtype="http://schema.org/ExerciseGym">
<div itemprop="employee" itemscope itemtype="http://schema.org/Person">
<span itemprop="name">John</span>
</div>
<div itemprop="employee" itemscope itemtype="http://schema.org/Person">
<span itemprop="name">Alice</span>
</div>
</div>

'itemListElement' not recognized in 'HowTo' schema

Based on the Microdata example in http://schema.org/HowTo and extrapolating syntax from the Microdata vs RDFa example in http://schema.org/hasOfferCatalog (there seem to be so few actual examples of RDFa to find?), I put together something like so:
<main vocab="http://schema.org/" typeof="HowTo">
<h1><span property="name">How to do the Hokey Pokey</span></h1>
<ol property="steps">
<li property="itemListElement" typeof="HowToStep">
<img alt="step 1" src="step1.jpg" align="left">
<p property="itemListElement" typeof="HowToDirection">
put your left hand in</p></li>
<li property="itemListElement" typeof="HowToStep">
<img alt="step 2" src="step2.jpg" align="left">
<p property="itemListElement" typeof="HowToDirection">
put your left hand out</p></li>
But, when put into Google's Structured Data Testing Tool, I get:
The property itemListElement is not recognized by Google for an object of type HowTo.
Yandex's validator also says:
WARNING: http://schema.org/itemListElement field not specified in http://schema.org/HowTo
What am I doing wrong?
You missed to specify the HowToSection (or HowToStep) type as value for the steps property.
The Microdata example uses:
<div id="steps" itemprop="steps" itemscope itemtype="http://schema.org/HowToSection">
The equivalent RDFa would be:
<div id="steps" property="steps" typeof="HowToSection">
If you aren’t providing an ItemList/CreativeWork value for the steps property, you are providing a Text value (this is what you are doing in your example markup). But you can’t add properties (like itemListElement) to a Text value.

TYPO3 merge list and edit

I've got a TYPO3 backend module which lists a lot of elements. Now, I want to include in my list the edit form, but that doesn't work well at the moment.
Rendering is good, but if I send the form, I get the error:
Required argument "note" is not set.
My code looks like this:
<f:for each="{notes}" as="note">
<f:form action="update" name="note" object="{note}">
<textarea class="form-control gettooltip" rows="1" placeholder="Kommentar" title="Kommentar zur Note">{note.kommentar}</textarea>
</f:form>
</f:for>
How can I merge these two views correctly?
Your code cannot work because your textarea doesn't have a property (or you don't use the <f:form.textarea ViewHelper).
If you property map $note in your controller, the property must be passed to Fluid with the prefixed extension name and plugin name. This is done automatically when using the "property" argument of the textarea ViewHelper. The name attribute will then be:
<textarea name="tx_myext_myplugin[note]"...
Thîs will map to $note in the controller.
So if you don't use the ViewHelper, you need to manually prefix the name attribute to create an output like printed just above.
If you're planning to update multiple objects of the of the same kind in one request, this won't because because there is an Extbase limitation.
You could do the following:
Use a submit button for each note and save/reload the changes through AJAX.
<f:for each="{notes}" as="note">
<f:form action="update" name="note" object="{note}">
<f:form.textarea class="form-control gettooltip" placeholder="Kommentar" property="kommentar">{note.kommentar}</f:form.textarea>
<f:form.submit value="Update" />
</f:form>
</f:for>
Then you intercept the submit click, submit the form through AJAX and set the new content to the textarea.
If you want to have one form for all objects, you will need to prefix the fields
<f:form action="update" name="note">
<f:for each="{notes}" as="note">
<f:form.textarea class="form-control gettooltip" placeholder="Kommentar" name="note[note{note.uid}][kommentar]">{note.kommentar}</f:form.textarea>
</f:for>
<f:form.submit value="Update" />
</f:form>
You will then have an array of values and need to iterate in your controller and manually persist the changes.
For your problem - as #lorenz answered you need to use viewhelpers for rendering fields OR at least use valid name attributes for your fields...
Anyway, I'm wondering why do you want to reinvent the wheel - especially while creating BE modules, the fastest, easiest and most elegant way is... using TYPO3 forms. They handle many things, relations, localization, validation, RTE etc, etc. What's more you can also add own type of field to TCA and process with your own PHP and JS - very rare situation, but may be used i.e. for adding GoogleMap field,
#see: user type in TCA
Finally all you need to open the record from your BE module is creating proper link - which can be easily copied from List module (right click on the yellow pencil next to your record and copy the code), sample:
<a href="#" onclick="window.location.href='alt_doc.php?returnUrl='+T3_THIS_LOCATION+'&edit[fe_users][1234]=edit'; return false;" title="Edit user">
<span title="" class="t3-icon t3-icon-actions t3-icon-actions-document t3-icon-document-open"> </span>
</a>
Where fe_users is table name and 1234 is record uid.
alt_doc.php?returnUrl='+T3_THIS_LOCATION part handles returning to the place from which edit was started, so it will be your module again including all GET params selected by admin before editing.
For creating new user
<a href="#" onclick="window.location.href='alt_doc.php?returnUrl='+T3_THIS_LOCATION+'&edit[fe_users][6789]=new'; return false;" title="New record">
<span class="t3-icon t3-icon-actions t3-icon-actions-document t3-icon-document-new"> </span>
</a>
In this case 6789 is a PID (uid of the page where the user should be created...
You can even set some default values when creating records from your own module using params in your new link:
&defVals[table_name][field_name]=value
sample
<a href="#" onclick="window.location.href='alt_doc.php?returnUrl='+T3_THIS_LOCATION+'&edit[fe_users][6789]=new&defVals[fe_users][tx_extbase_type]=Tx_MyExt_People&defVals[fe_users][usergroup]=1'; return false;" title="New record">
<span class="t3-icon t3-icon-actions t3-icon-actions-document t3-icon-document-new"> </span>
</a>

Including item type "Place" in "Thing"

According to the documentation (http://schema.org/Thing), the item type Thing cannot include a Place.
The users will be asked to add content that does not have a specific type, therefore everything falls back to Thing. So, suppose the following example. This is want I would like to have, but seems to be invalid. Is there a workaround to fix it?
<div itemscope itemtype="http://schema.org/Thing">
<span itemprop="name">Eiffel Tower</span>
<span itemprop="description">Sample description</span>
<div itemscope itemtype="http://schema.org/Place">
<div itemscope itemtype="http://schema.org/PostalAddress">
<span itemprop="streetAddress">Sample address</span>
</div>
</div>
</div>
Your example snippet is valid.
Simply nesting elements with itemscope/itemtype has no effect on the parsed Microdata. You have to use the itemprop attribute if you want to associate/relate the items.
So in your example, you have three items (Thing, Place, PostalAddress) which are not related in any way.
If your question is, "Has Thing a property which allows a value of Place?", the answer is no, there is no such property.
The best solution would be to have the user choose what "type" of thing they are submitting and map those to schema.org types.
E.g. if you had a drop-down list on the form they use to submit listing "CD", "Event", "Place", etc. and use the value from that form field to set the value of the main itemtype.

Using references in GitHub wiki with restructured text

I'm trying to use internal references to link an index atop my wiki page with several sections within the document. Here's an example:
* `My index`_
+ Foreword_
+ `Technical details`_
My index
--------
Foreword
~~~~~~~~
Technical details
~~~~~~~~~~~~~~~~~
If I generate the HTML page via rest2html I get the right result. However, GitHub wiki inserts extra words in the references and the links do not work. for example:
https://github.com/myaccount/myproject/wiki/Page#wiki-my-index
https://github.com/myaccount/myproject/wiki/Page#wiki-foreword
https://github.com/myaccount/myproject/wiki/Page#wiki-technical-details
I couldn't find any relevant document in the GitHub page, so I'm kind of lost.
It looks like the class ids are missing from the generated divs. Check the page source to (not) see them. I think this is what it should look like:
<ul>
<li><dl class="first docutils">
<dt><a class="reference internal" href="#my-index">My index</a></dt>
<li><a class="reference internal" href="#foreword">Foreword</a></li>
<li><a class="reference internal" href="#technical-details">Technical details</a></li>
</ul>
<div class="section" id="my-index">
<h1>My index</h1>
</div>
<div class="section" id="foreword">
<h2>Foreword</h2>
</div>
<div class="section" id="technical-details">
<h2>Technical details</h2>
</div>
Edit: User intuited mentions the same issue in a GitHub markup issue
I've noticed this problem with README.rst files as well. As well as
headings, inline targets in .rst files, e.g. _some target, don't
work. The inline target text gets wrapped in a but doesn't get
made into any sort of link target. Should I file this as a separate
issue?