How to set parameters in menu Item Joomla Component - joomla

Following is my code.
<fields name="request">
<fieldset name="request">
<field name="format" type="list" label="COM_CPS_FIELD_FORMAT"
description="COM_CPS_FIELD_FORMAT_DESC" class="small"
default="raw"
>
<option value="">COM_CPS_FORMAT_HTML</option>
<option value="raw">COM_CPS_FORMAT_RAW</option>
</field>
</fieldset>
</fields>
When I save the menu with 2nd option it save the url like this index.php?option=com_cps&view=webservice&format=raw but when I save the menu with first option it does not remove the &format=raw If any one can help me out It would be great.

Default is defined as what to save if nothing is posted. It works like a Joomla input filter in that it changes what is actually saved as opposed to validation which stops the process and never posts. Therefore you cannot save nothing, since it will always be replaced by the default. Therefore if you want to be able to save blank you must not have a default.
What you may be looking for is a preset, which is a preselected value that can be unselected. Presets and defaults are totally different things although on the surface they appear similar.

Related

Adding menu types with custom url parameters to component in Joomla 3

I'm having problems adding custom url parameters to my component menu. My component displays different data on the same view depending on which value from predetermined set is passed via custom GET parameter. For example, let's say these two urls are the only valid variants of the same view:
?option=com_mycomponent&view=myview&option=hello
?option=com_mycomponent&view=myview&option=world
How can I add these two urls as separate menu types to the component?
you need to change your default.xml file in such a way that when you create menu it will ask you for the optional parameter.
The default.xml file located at component/your_component/views/yourview/tmpl/default.xml
The code will look like as below
<fields name="request">
<fieldset name="request">
<field name="option" type="hidden"
label=""
required=""
description=""
default="default-value"
/>
</fieldset>
</fields>
For reference check components/com_content/views/article/tmpl/default.xml file
You can use External URL.
Create a new menu and select External URL from Menu Item Type > System Links. Add your urls in the Link field.
I hope I was of any help.

How to use "editor" field type in joomla "repeatable" form field?

I am developing a module for Joomla 3.3.6. I want to use "editor" field type in "repeatable" field in the xml file. The code I am using is as follows:
<field
name="fpssibtos_img1subs"
type="Repeatable"
icon="list"
label="GLOBAL_SUBS"
description="GLOBAL_SUBS_DESC"
default="{'fpssibtos_img1sub':['test']}">
<fields name="params">
<fieldset hidden="true" name="fpssibtos_img1subs_modal" repeat="true">
<field
name="fpssibtos_img1sub"
default="test"
type="editor"
label="GLOBAL_SUB"
description="GLOBAL_SUB_DESC"
filter="safehtml"/>
</fieldset>
</fields>
</field>
The problem is the editor is not editable, I mean you cannot type anything in it.
I am using CKEditor, I changed it to TinyMCE and others ,but the problem persists. I know that repeatable form field is still buggy ,but I thought some of you guys might know the fix to this particular problem.
In case anyone else comes across this problem, the repeatable form fields only support simple field types. This is apparently due to Joomla not having a simple way for scripts to interact.
Comment on the issue from one of the devs here and here.

Work Item Customization - Rule behavior in Transition and State

Simple use case: in a work item workflow, a field must be REQUIRED in TRANSITION="Active to Resolved" and READONLY when in State="Resolved".
Customization: For that field, I have set the rule REQUIRED in the Transition details, and the Rule READONLY in the State details.
Behavior: When I change the work item State from Active to Resolved (without saving) the field becomes REQUIRED and READONLY. I was expecting that field switched to READONLY only after saving the work item to Resolved and not during transition.
Question: WHY the rule READONLY is applied in the Transition? Is this the common behavior of the workflows?
I'm working on TFS 2010. To edit the work item template I'm using Team Explroer Power tools (Process Editor). Work Item behavior is tested from Team Explorer e team Web access.
Thanks in advance
In this case the READONLY condition should have been evaluated only after saving but it won't. However you can wrap it within a WHENNOT condition (albeit not ideal solution as your filed must be filled before the state transition). e.g.:
<STATE value="Resolved">
<FIELDS>
<FIELD refname="Your.Field">
<WHENNOT field="Your.Field" value="">
<READONLY />
</WHENNOT>
</FIELD>
</FIELDS>
</STATE>

Creating a Published drop down in Joomla

<field
name="published"
type="list"
label="JSTATUS"
description="JFIELD_PUBLISHED_DESC"
class="inputbox"
filter="intval"
size="1"
default="1"
>
<option value="1">
JPUBLISHED</option>
<option value="0">
JUNPUBLISHED</option>
<option value="-2">
JTRASHED</option>
</field>
I've created a Joomla dropdown in my form.xml file of a custom component to choose the published status of the item. I've taken this code unashamedly from the Joomla com_content component (and copied and pasted it into my own form.xml file. However when its rendered in the edit.php file (as shown below) you can see that the item is being set as unpublished. Despite the code above clearly setting the default as 1 which should correspond to published. Any good ideas as to why/how to fix this. I can easily change the drop down back from unpublished to published - and it works fine doing that. But its just annoying and a bug I'd like to fix. Any ideas?
Try to take a look if there is any override through your code, since this was taken by the com_content component, it won't set to default until all the mandatory fields are set, double check if any JS script or PHP function interrupts your field's normal behavior.
Another thought of mine is that maybe there is a problem with the translations, so take a close look to the translation files.
Are you using a table / model approach like com_content does? if so, when the record doesn't exist, its fields will be set to default (as read from database, so int fields will default to 0).
You can either
set the right defaults in the database,
check their values in the model,
change JPUBLISHED to 0 and JUNPUBLISHED to 517
although the latter looks really ugly.

Joomla component not appearing in the menu item types

I just followed the joomla tutorials on how to create the "perfect" MVC joomla component. However, my problem is that I don't know yet how to assign it to a menu. I thought that my component would then just show up when I select a "menu item type", but my component is not on this list. I've made some research on Google, but I cannot find the answer... Do I have to create a metadata.xml file or something similar ?
Thanks in advance for your answers !!
To create "views" for your component, you have to create some xml files.
Inside the templates folder in the frontend part of your component (usually something like /components/com_yourcomponent/views/someview/tmpl), if you had a template named default.php and form.php, you can create a default.xml file and a form.xml file to make these menu items available from the administrator.
You can take a look at other components to see the structure of these xml files, but what you should put inside is:
1) A name and a description for four view
2) The params the user will be able to change from the administrator (it works like module/plugin params)
3) You can also set "hidden" request variables for that menu item. It means that those vars will be added to the request in that particular menu item, but the user won't be able to change its value.
Here's a complete example for a component (Joomla 1.7):
<?xml version="1.0" encoding="utf-8"?>
<metadata>
<layout title="COM_AGMTAGS_TAG_VIEW_DEFAULT_TITLE">
<message>COM_AGMTAGS_TAG_VIEW_DEFAULT_DESC</message>
</layout>
<fields name="request" addfieldpath="/administrator/components/com_agmtags/models/fields">
<fieldset name="request">
<field name="tag_id" type="agmtag"
label="COM_AGMTAGS_TAG_FIELD_NAME_LABEL"
description="COM_AGMTAGS_TAG_FIELD_NAME_DESC"
/>
</fieldset>
</fields>
<fields name="params">
<fieldset name="basic" label="COM_AGMTAGS_TAG_OPTIONS">
<field name="layout_type" type="hidden" default="blog" />
<field name="show_tag_name" type="list"
label="COM_AGMTAGS_SHOW_TAG_NAME"
description="COM_AGMTAGS_SHOW_TAG_NAME_DESC"
>
<option value="">JGLOBAL_USE_GLOBAL</option>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field name="show_tag_description" type="list"
description="COM_AGMTAGS_SHOW_TAG_DESCRIPTION_DESC"
label="COM_AGMTAGS_SHOW_TAG_DESCRIPTION_LABEL"
>
<option value="">JGLOBAL_USE_GLOBAL</option>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field name="items_per_page" type="text" default="" />
<field name="container_class" type="text" default="agmtags-list" />
</fieldset>
</fields>
</metadata>
I hope it helped!
If you simply want to add the view link to the list create a xml file called default.xml inside the com_yourcomponent/views/yourviewname/tmpl/
The xml code below takes two language strings used to display your menu item link in the list
<?xml version="1.0" encoding="utf-8"?>
<metadata>
<layout title="COM_YOURCOMPONENT_FRONPAGE_TITLE">
<message>COM_YOURCOMPONENT_FRONPAGE_MSG</message>
</layout>
</metadata>
save the file and the link should appear in the list of menu items
Apparently, you also need the administration menu tags in your installation XML file.
http://forum.joomla.org/viewtopic.php?p=706714
This worked for me
<administration>
<menu>COM_COMPONET</menu>
<submenu>
etc...
</submenu>
Think this is what Panayiotis was trying to say
Additionally there is also another catch.
In the installation XML file of the component,
in the section, the tags must
be present, even if you do not need the menu.
If these are missing, then you'll never be given
the option to add this component to a menu item,
because the type wont be there :-)
In additional, your alternative view file names MUST NOT be written with underscores.
table_catalog.xml
table_catalog.php
table_catalog_item.php
didn't work - there wasn't new option in "menu item type" list. But
tablecatalog.xml
tablecatalog.php
tablecatalog_item.php
file names work perfectly. I've lost an hour revealing a problem.

Resources