External xml file for joomla! template parameters - joomla-template

I have the below code in templateDetails.xml file, in a sample custom Joomla! 2.5.x template.
<config>
<fields name="params">
<fieldset name="advanced" addfieldpath="/plugins/system/framework/elements">
<field name="elements" type="elements" label="" addfieldpath="/plugins/system/framework/elements" />
</fieldset>
</fields>
</config>
I want to have an external .xml file with options like below?
<?xml version="1.0" encoding="utf-8"?><form name="template-options">
<fieldset name="toolbar-panel" label="TOOLBAR">
<field name="presets" type="preset" mode="scroller" default="preset1" setbyurl="true" setinoverride="false" panel_position="left" show_label="false"/>
</fieldset>
I dont'want to add the fieldset inside templateDetails.xml, I want it external.
Is that possible?
Thank you.

Related

How to set a default field value in some form view in Odoo?

How to set default value in Job_id in this form with xml and don't need to set in the python file?
<record id="form_student_stu" model="ir.ui.view">
<field name="name">Student Info</field>
<field name="model">youth_and_scholarship.youth_and_scholarship</field>
<field name="arch" type="xml">
<form string="Job Form" version="9.0">
<div class="widget_box">
<div class="widget_title"><h5>Student Information</h5></div>
<div>
<group col="1">
<field name="image" widget="image" class="oe_avatar oe_left" nolabel="1"/>
<field name="Job_id" invisible="1"/>
</group>
<group>
<field name="Kname" placeholder="First Name and Last Name..." string="Name in Khmer" style="width:40%%"/>
<field name="Ename" placeholder="First Name and last Name..." string="Name in Latin" style="width:40%%"/>
<field name="Gender" string="Gender" style="width:40%%"/>
<field name="DOB" string="Date of birth"/>
<field name="Job_work" string="Accupation" style="width:40%%"/>
</group>
</div>
</div>
</form>
</field>
</record>
You can use some context specifying an XML ID (External ID). You can add the default value to the action which calls the view like this:
<record id="youth_and_scholarship_youth_and_scholarship_action" model="ir.actions.act_window">
<field name="name">Student Info</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">youth_and_scholarship.youth_and_scholarship</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="context">{'default_job_id': ref('xml_id')}</field>
</record>
If you open the view from a field, from a many2one for example, you can add the context to that field:
<field name="field_name" context="{'default_job_id': ref('xml_id')}" />
If haven't set the XML ID of the record you can get the ID by Python code and return an action window with the context:
job_id = self.get_job_id()
return {
'name': 'Student Info',
'type': 'ir.actions.act_window',
'view_type': 'form',
'view_mode': 'form',
'res_model': 'youth_and_scholarship.youth_and_scholarship',
'context': {'default_job_id': job_id }
}
NOTES:
The key always has to be: default_ + field_name: database_id
You can see all the XML IDs here: Settings > Technical > Sequences & Identifiers > External Identifiers > Complete ID

Multiple conditions on TFS field

I need to set a TFS field as required based on two conditions. For example i want to set the field state as required if
Field "IsValid" value is not true
Field "Test Type" value is "Analysis"
Is it possible to set multiple conditions in TFS?
Even if it sounds too late, here's a tip that worked for me. It's a little tedious so I'll try to be clear.
Here is my context :
First I'm working with TFS 2018 RTM (16.122.27102.1) but i don't think it's important in that case.
I added a new field : an "end user description" on User Stories or BUGs to generate a change log based on a simple query.
I wanted this HTML Field to be mandatory only when
the Work Item is "Closed"
the reason is "Work finished"
the activity is "Development"
a new boolean field "Ignore for change log" is not True
Workaround :
I created a new field : "Custom.EndUserDescriptionMandatory" (Integer).
The order is important.
The idea is that when a Field that plays on the condition is changed, that new field is set to 1.
After that when the value does not respond to the required condition, that new field is set to 0.
Here is the XML for the rules :
<FIELD name="Mandatory user description" refname="Custom.EndUserDescriptionMandatory" type="Integer">
<DEFAULT from="value" value="0" />
<WHENCHANGED field="Custom.ChangeLogIgnore">
<COPY from="value" value="1" />
</WHENCHANGED>
<WHENCHANGED field="Custom.EndUserDescription">
<COPY from="value" value="1" />
</WHENCHANGED>
<WHENCHANGED field="System.Reason">
<COPY from="value" value="1" />
</WHENCHANGED>
<WHENCHANGED field="Microsoft.VSTS.Common.Activity">
<COPY from="value" value="1" />
</WHENCHANGED>
<WHENCHANGED field="System.State">
<COPY from="value" value="1" />
</WHENCHANGED>
<WHENNOT value="Closed" field="System.State">
<COPY from="value" value="0" />
</WHENNOT>
<WHENNOT value="Work finished" field="System.Reason">
<COPY from="value" value="0" />
</WHENNOT>
<WHEN value="true" field="Custom.ChangeLogIgnore">
<COPY from="value" value="0" />
</WHEN>
<WHENNOT value="" field="Custom.EndUserDescription">
<COPY from="value" value="0" />
</WHENNOT>
<WHENNOT value="Development" field="Microsoft.VSTS.Common.Activity">
<COPY from="value" value="0" />
</WHENNOT>
<HELPTEXT>(Internal use) allows to know whether Custom.EndUserDescription is mandatory or not</HELPTEXT>
</FIELD>
Finally I added a rule to the Workflow :
<STATE value="Closed">
<FIELDS>
<FIELD refname="Custom.EndUserDescription">
<WHENNOT value="0" field="Custom.EndUserDescriptionMandatory">
<REQUIRED />
</WHENNOT>
</FIELD>
</FIELDS>
</STATE>
I hope that will help.
In simple terms: It's not supported now.
Here has been a featured request in Voice of VS. You can also vote for it.
Allow nested when, whennot, whenchanged, and whennotchanged in TFS
work item definitions
https://visualstudio.uservoice.com/forums/330519-team-services/suggestions/5760933-allow-nested-when-whennot-whenchanged-and-whenn

TFS2013 Requiring Comments on transitions to certain states

I'm creating a TFS 2013 Kanban board. I want to require an additional comment when the user switches the State to "Blocked From Progress"
Based on this post (http://social.msdn.microsoft.com/Forums/vstudio/en-US/9b672f4c-3054-481a-856d-4da650f25f74/how-to-require-comments-during-state-transition?forum=tfsprocess) I can require comments on all state changes. How do I limit it to just a transition to the "Blocked From Progress" State? Here's a section of code from my exported User Story xml file:
<FIELD name="HistoryHelper" refname="Demo.HistoryHelper" type="String">
<WHENNOT field="System.State" value="Blocked From Progress">
<COPY from="value" value="1" />
</WHENNOT>
<WHEN field="System.History" value="">
<COPY from="value" value="0" />
</WHEN>
<WHENNOT field="System.History" value="">
<COPY from="value" value="1" />
</WHENNOT>
<WHENCHANGED field="System.State">
<PROHIBITEDVALUES>
<LISTITEM value="0" />
</PROHIBITEDVALUES>
</WHENCHANGED>
</FIELD>
This is almost exactly the code from the above link, but I've added a check for the value of the State. Those lines don't seem to change the behavior at all. I've tried them at different places in the XML to no avail. Also, I've tried nesting a inside a and got errors. I don't know if there's a way to do an AND inside a WHEN.
EDIT
In addition to the accepted answer, I updated the new Field definition to be as follows:
<FIELD name="Blocked Reason" refname="CustomerProjects.BlockedReason" type="HTML" >
<WHENNOT field="System.State" value="Blocked From Progress">
<COPY from="value" value="" />
<READONLY />
</WHENNOT>
</FIELD>
I think a good solution for this would be to create a new field called "Blocked Reason" and then make it required on transitions into the "Blocked From Progress" state. You'd implement this like:
<Fields>
...
<FIELD name="Blocked Reason" refname="<company>.BlockedReason" type="HTML" />
...
</FIELDS>
<WORKFLOW>
...
<TRANSITIONS>
...
<TRANSITION from="<somestate>" to="Blocked From Progress">
...
<FIELDS>
<FIELD refname="<company>.BlockedReason">
<REQUIRED />
</FIELD>
</FIELDS>
</TRANSITION>
...
</TRANSITIONS>
...
</WORKFLOW>
You'd need to set that for each possible transition into the "Blocked From Progress" state. If you wanted you could also remove the text from the field using the tag on transitions out of the "Blocked From Progress" state.

How to retrieve data using xml

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
<MasterDetailsResponse xmlns="http://192.168.100.173/ArvindMill/">
<MasterDetailsResult>
<GetAllMasterDetail>
<TABLENAME>item_master</TABLENAME>
<ITEMID>1</ITEMID>
<ITEMTYPE>CTS</ITEMTYPE>
<GROUP />
<VARIETY />
<FORM />
<STATUS />
<ITEM />
<GRADE />
<TYPE />
</GetAllMasterDetail>
<GetAllMasterDetail>
<TABLENAME>item_master</TABLENAME>
<ITEMID>2</ITEMID>
<ITEMTYPE>AGS</ITEMTYPE>
<GROUP /><VARIETY />
<FORM />
<STATUS />
<ITEM />
<GRADE />
<TYPE />
</GetAllMasterDetail>
<GetAllMasterDetail>
<TABLENAME>tablet_taluka_master</TABLENAME>
<VILLAGE>Anturli</VILLAGE>
<TALUKA>Anturli</TALUKA>
<TABLETUSERCODE />
<TABLETUSERNAME /><TABLETCODE />
<TABLETTALUKAID />
</GetAllMasterDetail>
<GetAllMasterDetail>
<TABLENAME>tablet_taluka_master</TABLENAME>
<VILLAGE>Bortha</VILLAGE>
<TALUKA>Sadgavan</TALUKA>
<TABLETUSERCODE /><TABLETUSERNAME />
<TABLETCODE />
<TABLETTALUKAID /></GetAllMasterDetail>
<GetAllMasterDetail>
<TABLENAME>tablet_taluka_master</TABLENAME>
<VILLAGE>Kukarmunda</VILLAGE>
<TALUKA>Kukarmunda</TALUKA>
<TABLETUSERCODE />
<TABLETUSERNAME /><TABLETCODE /><TABLETTALUKAID />
</GetAllMasterDetail>
The above code is the response returned from soapobject in android. How to retrieve the data from the above XML file? I want to display it in list view and the response returned from the soapobject contains more than one table so how to retrieve it?
If your are using Java use SAX Parser

Struts2 validation doesn't work

I'm trying to validate a form using the Struts2 validator tool but it doesn't seem to work since, apparently, the xml validator is never acknowledged.
Here is my code:
struts.xml:
<interceptors>
<interceptor name="login_interceptor" class="org.apache.struts.gesprod.produccion.BLLogin">
</interceptor>
<interceptor-stack name="login_stack">
<interceptor-ref name="login_interceptor" />
<interceptor-ref name="defaultStack" />
</interceptor-stack>
</interceptors>
<default-interceptor-ref name="login_stack"></default-interceptor-ref>
<global-results>
<result name="input">/errores/error_input.jsp</result>
<result name="error_sql">/errores/error_sql.jsp</result>
<result name="no_logged">/login.jsp</result>
</global-results>
...
<action name="login" class="org.apache.struts.gesprod.produccion.BLUsuario" method="loginUsuario">
<result name="success" type="redirect">/welcome.jsp</result>
<result name="incorrecto_login">/login.jsp</result>
<result name="input">/login.jsp</result>
</action>
login.jsp:
<div id="login">
<s:fielderror />
<s:form id="login_form" action="login" validate="true">
<s:hidden name="intento_log" value="true" />
<s:textfield name="usuario.username_usuario" label="Usuario"/>
<s:password name="usuario.password_usuario" label="Password"/>
<s:submit value="Ingresar"/>
</s:form>
</div>
And the xml validator, placed in the same package as the Action class.
BLUsuario-login-validation.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE validators PUBLIC
"-//OpenSymphony Group//XWork Validator 1.0.2//EN"
"http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd">
<validators>
<field name="usuario.username_usuario">
<field-validator type="requiredstring">
<message>Show error!</message>
</field-validator>
</field>
</validators>
Can somebody help and notice if there's something wrong with my code?
I think that the problem is in the name of the xml validator. You have to rename the validator with login-validation.xml. The name that you can put to your xml validator files are:
Validation rules can be specified:
Per Action class: in a file named ActionName-validation.xml
Per Action alias: in a file named ActionName-alias-validation.xml
Inheritance hierarchy and interfaces implemented by Action class: XWork searches up the inheritance tree of the action to find default validations for parent classes of the Action and interfaces implemented
You can see more here:
http://struts.apache.org/2.0.12/docs/validation.html#Validation-DefiningValidationRules
P.D: You said that "the "input" result is never returned even if the fields are wrong". The input result is returned if there are any field error (unless you specify other thing).

Resources