How to insert url of a selected article from popup in joomla? - joomla

I have small plugin(which work for joomla article in admin) of joomla which has a field in xml file like :
<field name="url" type="modal_article" default="" label="Internal Link"
description="" />
Right now it contains only articleId when I save it.
How can I insert url of selected article like index.php?option=com_content&view=article&id=517&catid=28&Itemid=267 ?
if that is not possible how can I use Article select button of joomla admin editor in my custom plugin.

If you want to insert a url, change the type to url
<field name="url" type="url" default="" label="Internal Link"
description="" />
else if you want to have a proper article select, you're using the right type but your fieldset is not importing the modal_article, hence it's rendered as text (where you end up inserting the id). Just import modal_article from
administrator/components/com_content/models/fields/modal/article.php
like this:
<fieldset name="request"
addfieldpath="/administrator/components/com_content/models/fields">
<field name="url" type="modal_article" default="" label="Internal Link"
description="" />
this will make your current code show the modal select (you'll still need to select the right Itemid from the menu to build a proper url).
Finally, another field type you might want to consider is menuitem:
<field name="url" type="modal_article" default="" label="Internal Link"
description="" />
see the full docs on
http://docs.joomla.org/Standard_form_field_types

Related

Add a link in the label of a Joomla form element

I'm trying to add a link to a field in the joomla contact form. I'm trying to achieve this:
<field name="contact_terms"
type="checkbox"
id="contact-terms"
description=""
label="I agree to <a href='http://example.com/terms'>Terms and Conditions</a>"
default="0"
value="1"
required="true"
/>
but it gives an error and I'm just very very new to joomla. How should it be done?

Joomla: what is wrong with my plugins XML - config-section is not shown?

I am trying to upgrade an old mambot. It's possible that there are still bugs in the code, but even the config-screen does not show up, only the basic pi-parameters are there, none of mine. What am I missing?
<?xml version="1.0" encoding="iso-8859-1" ?>
<extension type="plugin" group="content" version="1.6" method="upgrade">
<name>mb_append</name>
<creationDate>June 08, 2013</creationDate>
<version>1.1</version>
<author>Michael Baas</author>
<authorName>Michael Baas</authorName>
<authorEmail>michael#mbaas.de</authorEmail>
<authorUrl>mbaas.de</authorUrl>
<description>
<![CDATA[
<p>Very simple bot to append constant <i>(configureable)</i> text (i.e. <br>-tags!) to the
article and the output. 'Output' includes the "ReadMore..."-Link (but not the
navigation). (However, if you absolutely
need this, let me know and I may implement it, but it's a bit tricky, so I would only
do this if somebody can convince me he needs it ;)</p>
<p>In case you want to insert multiple texts between the output of other plugins etc., you can
create further instances of this plugin by simply renaming the PHP and XML in the
installation-ZIP AND by adjusting the names in the XML and then just install your
'new' mambot! :)</p>
<p><b>Links</b> <i>(automatically open in new window)</i>:
<ul>
<li>Michael's Homepage
</ul>
]]>
</description>
<copyright>(c) 2013 Michael Baas</copyright>
<license>GPL</license>
<files>
<filename plugin="mb_append">mb_append.php</filename>
</files>
<config>
<fields name="config">
<fieldset name="basic">
<field name="txt_app" type="text" default="" label="Append 2 article" description="The text you want to append to the article" size="40" />
<field name="txt" type="text" default="" label="Append 2 output" description="The text you want to append to the output" size="40"/>
<field name="look4txt" type="radio" value="1" label="Check if txt already there?" description="Check if the specified text has already been added to the text and do not add again if this option is activated.">
<option value="0">No</option>
<option value="1">Yes</option>
</field>
<field name="excat" type="text" default="" label="Categories to EXCLUDE" description="Comma-separated list of IDs" size="40"/>
<field name="exid" type="text" default="" label="Article-IDs to EXCLUDE" description="Comma-separated list of IDs OR a 'less-than'-sign (arrow-left) followed by ONE number to exclude all IDs smaller than thew number you specified!" size="40" />
</fieldset>
</fields>
</config>
</extension>
Change the <fields name="config"> to <fields name="params">. This might work then.

Tiles and breadcrumb - Don't want final breadcrumb to link

I'm using struts 1.x and tiles. I want to create a breadcrumb trail containing a path to the current page, but, I don't want the final breadcrumb to point to the current page. This is because the final page is the result of a search. So it doesn't make sense to point to a search result page.
How do I add a breadcrumb that is only a label and not a link?
I'd like it to look like:
Home Page (link) > Search Criteria (link) > Search Results (not a link)
My tiles def looks like:
<putList name="breadCrumbList">
<item value="Home Page" link="/blablabla" />
<item value="Search Criteria" link="/blablabla2" />
<item value="Search Results" link="/blablabla2" /> <-- this needs changed
</putList>
Change the link value to # as follows.
<item value="Search Results" link="#" />
EDIT :
This is what we have done in our project if that helps:
<definition name="tile.success" extends=".layout">
<put name="content" value="/jsp/routing.jsp"/>
<put name="title.section" value="My Title"/>
<putList name="breadcrumbs">
<item link="#" value="Add Name"/>
</putList>
</definition>
"Add Name" just shows up as a label in the breadcrumb.

Separation of forms & also drop down menu alteration when object selected

In the image provided of my registration page, I wish to put a vertical separator inbetween the form on the left to have another form on the right to be completed for the registration but I have no idea how to do it.
http://puu.sh/1FJIA
Also the second part of my question pertains to the drop down menu, how would I put an extra option other than #_usergroups that when selected will alter the drop down menu to change into a text box? Below is the coding used for the xml.
<?xml version="1.0" encoding="UTF-8"?>
<form>
<fieldset name="default"
label="COM_USERS_REGISTRATION_DEFAULT_LABEL"
>
<field name="spacer" type="spacer" class="text"
label="COM_USERS_REGISTER_REQUIRED"
/>
<field name="name" type="text"
description="COM_USERS_REGISTER_NAME_DESC"
filter="string"
label="COM_USERS_REGISTER_NAME_LABEL"
message="COM_USERS_REGISTER_NAME_MESSAGE"
required="true"
size="30"
/>
<field name="username" type="text"
class="validate-username"
description="COM_USERS_DESIRED_USERNAME"
filter="username"
label="COM_USERS_REGISTER_USERNAME_LABEL"
message="COM_USERS_REGISTER_USERNAME_MESSAGE"
required="true"
size="30"
validate="username"
/>
<field name="password1" type="password"
autocomplete="off"
class="validate-password"
description="COM_USERS_DESIRED_PASSWORD"
field="password2"
filter="raw"
label="COM_USERS_REGISTER_PASSWORD1_LABEL"
message="COM_USERS_REGISTER_PASSWORD1_MESSAGE"
required="true"
size="30"
validate="equals"
/>
<field name="password2" type="password"
autocomplete="off"
class="validate-password"
description="COM_USERS_REGISTER_PASSWORD2_DESC"
filter="raw"
label="COM_USERS_REGISTER_PASSWORD2_LABEL"
message="COM_USERS_REGISTER_PASSWORD2_MESSAGE"
required="true"
size="30"
/>
<field name="email1" type="email"
description="COM_USERS_REGISTER_EMAIL1_DESC"
field="id"
filter="string"
label="COM_USERS_REGISTER_EMAIL1_LABEL"
message="COM_USERS_REGISTER_EMAIL1_MESSAGE"
required="true"
size="30"
unique="true"
validate="email"
/>
<field name="email2" type="email"
description="COM_USERS_REGISTER_EMAIL2_DESC"
field="email1"
filter="string"
label="COM_USERS_REGISTER_EMAIL2_LABEL"
message="COM_USERS_REGISTER_EMAIL2_MESSAGE"
required="true"
size="30"
validate="equals"
/>
<field name="title" type="sql"
default="-None Listed-"
label="Select your University"
description="Select the University you are currently attending, if
it's not on the list then create it below"
query="SELECT title FROM #__usergroups WHERE ID > '8 ' "
required="true"
/>
<field
name="captcha"
type="captcha"
label="COM_USERS_CAPTCHA_LABEL"
description="COM_USERS_CAPTCHA_DESC"
validate="captcha"
/>
</fieldset>
</form>
1. Vertical separator:
you can use a hack i.e. create some fields which will output markup.
The idea here is to insert an extra
<div style='width:50%'>
before the first field;
Then a
</div><div style='width:49%;border-left:1px dashed black'>
where you want the separator
and finally a at the end.
Create three new spacer fields.
You can either insert properly escaped html directly:
<field type="spacer" name="splitterinit" label="<div>" />
or put the html as language constants in the language file:
SPLITTER_MID="</div><div style='width:49%;border-left:1px dashed black'>"
and simply use the constant in the .xml:
<field type="spacer" name="splittermid" label="SPLITTER_MID" />
2. Extra text option:
Easy: Simply add a text field below to allow the user to type in.
Harder: Create a custom element, there you can write php and make it
as you want it
3. A word of advice
Chronoforms features a user registration override that lets you define all the fields you want, and for sure you'll find more similar extensions on the JED
Also, all community solutions feature custom profiles.

TFS Custom WorkItemType Set field to current user

I'm trying to add a custom workitemtype to TFS.
I would like to have a field called SignOff, with possible values of Yes/No. Next to that I would like to have a field called SignOffBy - when you change the SignOff field the SignOffBy field should be set to the current user.
<FIELD name="Signoff" refname="MyProj.Signoff" type="String">
<ALLOWEDVALUES expanditems="true">
<LISTITEM value="Yes" />
<LISTITEM value="No" />
</ALLOWEDVALUES>
<DEFAULT from="value" value="No" />
</FIELD>
<FIELD name="Signoff By" refname="MyProj.SignoffBy" type="String">
<WHENCHANGED field="MyProj.Signoff">
<DEFAULT from="currentuser" />
</WHENCHANGED>
<WHENNOTCHANGED field="MyProj.SsoSignoff">
<READONLY />
<EMPTY />
</WHENNOTCHANGED>
</FIELD>
The problem seems to be that the SignOffBy field wants to be populated at all times. If I don't use the empty tag it just gets populated right away. I want it to be blank, but only get populated when the field gets changed. At the moment it's not changing at all - it's just blank and stays blank.
Instead of onchanged rules, have a WHEN rule for signoff being false, and set the field to EMPTY/READONLY as you currently do.
Have a second WHEN rule for the true case, and use a COPY rule to copy the currentuser value into the field instead of doing it via a DEFAULT rule.

Resources