Firefox Addon Using preferences as RightClick Submenu - firefox

I´m currently developing an Add-On for Firefox and I have two preferences where as in the first, the user can enter IDs comma seperated. (I.e.: 29, 39, 110).
In the second preference goes the associated name for the ID. i.e. Name for ID 29, Name for ID 39, Name for 110.
In my ff-overlay.xul I have:
<menupopup id="contentAreaContextMenu">
<menu id="addto" label="Add Video to ">
<menupopup>
<menuitem label="NAME" oncommand="insert(ID)" />
</menupopup>
</menu>
</menupopup>
I want a menuitem for every ID there is,
display the name and pass the ID as a parameter to my function.
Is this possible to do? Thank you in advance

You can make the menu on runtime see this snippet here:
https://gist.github.com/Noitidart/9523055
Some explanation on how I made that script, and some simplifications are seen in the topic here: can I add a context menu to a widget?

Related

custom button in Joomla module admin panel

New to Joomla(one month).
I'm trying to create a module that will list events(names and times). I want the module to be populated from the admin panel. For example lets say the module lists would list the following on the front end:
breakfast ........ 9:30
lunch .............12:30
dinner ............7:30
In the admin panel there will be input text fields for the admin to add/delete the events and a button(s) that will call a js function execute add/delete.
I am using Joomla4 I'm under the impression that all I need to do is tell the manifest file about my button in the configs sections and then write the javascript in the mod_project.php file that will add/delete a field on press. (Perhaps the js needs to go in the tmpl/default.php I'm not entirely sure where to put it) Unfortunately my attempt to add a button in the config file has failed meaning there is no output in the html:
current config section of manifest file:
<fields name="params">
<fieldset name="basic">
<field
name="event_name_0"
type="text"
label="Event Name"
filter="event"
/>
<field
name="event_time_0"
type="text"
label="Event Time"
filter="event"
/>
<button type="submit" id="testBtn" value="Add">Add</button>
</fieldset>
</fields>
</config>
I have to do that yesterday but I have found a solution more simple : I just added a custom field, for my specific category, with the type repeatable and I have written a module to read this specific field.

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.

Mendeley's standard IEEE CSL file creates improper bibliography

I have been using Mendeley's Microsoft Word plugin to easily reference papers in my Mendeley Desktop library.
However, I've noticed that the IEEE format for the bibliography/citation is incorrect with regards to referencing conference proceedings and theses.
On the IEEE citation guide: http://www.ieee.org/documents/ieeecitationref.pdf
It shows that the city of the conference should be included in the citation of a conference paper. However, Mendeley's IEEE CSL file does not include this detail.
<macro name="event">
<choose>
<if type="paper-conference speech" match="any">
<choose>
<!-- Published Conference Paper -->
<if variable="container-title">
<group delimiter=", ">
<group delimiter=" ">
<text term="in"/>
<text variable="container-title" font-style="italic"/>
</group>
<text variable="event-place"/>
</group>
Should be changed to:
<macro name="event">
<choose>
<if type="paper-conference speech" match="any">
<choose>
<!-- Published Conference Paper -->
<if variable="container-title">
<group delimiter=", ">
<group delimiter=" ">
<text term="in"/>
<text variable="container-title" font-style="italic"/>
</group>
<text variable="publisher-place"/>
</group>
Since event-place is not a keyword that maps to the "city" field in Mendeley; the correct variable is "publisher-place".
Two options, use this formatted one that I just made, or follow the steps I did to make this change in the CSL Visual Editor.
Just use the corrected file
While in Mendeley Desktop, go to View menu, "Citation Style ->" and click "More Styles..."
Click on the tab "Get More Styles", and enter the following link into the "Download Style:" text box, then click Download
http://csl.mendeley.com/styles/451326401/ieee-CS-edited
Done!
Make your own corrections
While in Mendeley Desktop, go to View menu, "Citation Style ->" and click "More Styles..."
Right Click on IEEE and choose "Copy Style Link"
Open up a web browser, and paste the link and hit enter, it should download a file called "ieee.csl"
Open up a web browser that isn't Chrome, as this doesn't work in Chrome, and go to the page http://csl.mendeley.com/visualEditor/
Login using your Mendeley credentials
Click on the "Visual editor" tab at the top if it's not already selected.
Hover over "Style" and choose "Load Style..."
Browse and select the "ieee.csl" file that was downloaded earlier.
Under "STYLE INFO" and "Info", rename the Title to something new.
Navigate to the following
BIBLIOGRAPHY
->Layout
-->Conditional
--->Else-of paper-conference OR...
---->Group
----->event (macro)
------>Conditional
------->If paper-conference OR speech
-------->Conditional
--------->If container-title
--------->Group
----------->event-place (variable)
Click on event-place (variable) and in the editable section to the right, change the variable from "event-place" to "publisher-place"
Then go back to the Style menu and choose "Save Style As..."
Save this style, and it should automatically add it to your Mendeley Desktop
Done!
Mendeley does not show the thesis citations correctly in IEEE format. It should be like this:
[1] J. K. Author, “Title of thesis,” M.S. thesis, Abbrev. Dept., Abbrev. Univ., City of Univ., Abbrev. State, year.
[2] J. K. Author, “Title of dissertation,” Ph.D. dissertation, Abbrev. Dept., Abbrev. Univ., City of Univ., Abbrev. State,
year.
However, the thesis type and department name are not showing!!

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.

firefox sidebar menu or list of elements. resources/help

I am struggling to find any resources on firefox extensions which construct a sidebar and put elements into them. plus tyhe other functionalities within a sidebar. I have made a emptysidebar. Now i need to display a dynamic array(which is formed using a JS function).
I have absolutely no idea how to go about it. Can someone please help!
this is the code of the sidebar page. I need a xul element like the menuitem where i can display a list of items. How do i get that in a sidebar?
<page id="sbEmptySidebar" title="emptysidebar"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
> <vbox flex="1">
<label id ="l1">
</vbox> </page>
You should used a list box, it would be the best way to display an array of elements in the sidebar. You can check here for more details on the XUL element:
https://developer.mozilla.org/en/XUL_Tutorial/List_Controls
In order to add elements dynamically from JavaScript you can use the appendItem() function on the listbox object, check here for more details and examples:
https://developer.mozilla.org/en/XUL_Tutorial/Manipulating_Lists

Resources