I'm looking for a way to show module fields conditionally on the back end screen of Sitefinty.
For example, say I've created a module through module builder - and I have two fields: a checkbox and a text field.
I'd like the text field only to display to content editors only after they've checked the checkbox field. Ideally that checkbox could hide/show a handful of fields on the spot through the content entering process.
Is there a straightforward, maintainable way to go about this?
Currently using version 10.2, it'd be great to know how to accomplish
this via both the new and old UI.
Hoping there is an advanced setting I just don't know about, but
willing to go a JS approach as well.
Thanks!
After a little digging I've been able to find a working solution. Here's how I handled it:
Note: [module] and [section] assume your custom module name and section. If you didn't setup sections in backend screens and tweaks then all of the fields will be under MainSection
Step 1 - Add a custom script to the module in advanced settings.
Assuming this is a dynamic module...
Create a JS file in your project and reference it in advanced settings by going to:
Advanced settings > Dynamic Modules > Controls > [module] > Views > [Module]View > Scripts
Click Create New and point the script location to the JS file you created.
Step 2 - Add custom classes to your fields
Stay where you're at in advanced settings and navigate to the fields you've made. For example:
Advanced settings > Dynamic Modules > Controls > [module] > Sections > [Section] > Fields > [Field]
On this page scroll down to CSS Class and add a custom CSS class to this field
Step 3 - Add your custom Javascript
Sitefinity uses jQuery so I worked with that and set up some really basic JS based off the class names:
$(document).ready(function(){
$('.myTextBox').hide();
$('.myCheckbox input').on('change', function(){
var $this = $(this),
textBox = $('.myTextBox');
$this.is(':checked') ? textBox.show() : textBox.hide();
})
});
Note: the custom CSS class gets applied to the parent wrapper of the actual element
Now when a content editor goes to add a new content item to a module, checking that specific checkbox will show and hide the custom text box.
Besides the fact that this process seems a little over the top, there are a few other issues:
You have to set the call to your custom script on the edit and insert
view.
It doesn't take into account any validation.
With Sitefinity getting a backend UI upgrade, long term sustainability is questionable.
I'll leave this question unanswered for a while if there is a better/easier approach to this.
Related
i want to add an autocomplete function to work in one of my column suppose name.It is easy to do using items.but how can i do it in the report.
Since a report doesn't contain Apex items, you can't do this with the built in features. Ignoring any possible plugins that may already be available, you can do this with jQuery UI, specifically the Autocomplete widget. Apex already includes some of the jQuery UI suite, but you may need to download the Autocomplete widget from the jQuery website.
This will need some custom work on your end. This really isn't that hard if you know how to use jQuery.
Download the jQuery UI Autocomplete widget and include it on your page. You can put just the .js file for that in your Application Shared Items. I have the whole jQuery UI library in a separate place on the webserver because I use different parts for different projects.
Source in that widget in the page properties.
You'll need to create text items with apex_item.text in your report.
You'll need an On Page Load dynamic action to attach the Autocomplete widget to your text items.
For the autocomplete source, if it's short, you can just use a Javascript variable that you put on the Apex page. If it's longer or you need to find the list at run time, you can use a function that calls apex.server.process.
If your report has Partial Page Refresh turned on, make sure the DA in step 4 has Dynamic scope, not Static.
I'm hoping this is a simple question. I have a custom widget. Let's say it is "SuperAwesomeWidget.ascx". When I'm editing a PageBuilder wireframe, I can see my widget in the little pulldown widget tray at the top of the screen. Thing is, the name under my icon is "SuperAwesomeWidget".
Now, I know that I can go to the widgets settings in the WorkArea and define a custom name, but what if I want Ektron to just "know" what the name should be? I'm hoping there is some config file somewhere that I can add my widget name to. I'd like to be able to drop this widget along with maybe a config file or something into a second Ektron install and not need to define the name via the workarea.
For anyone in the future googling this issue, there is a better answer than my previous one, particularly better than a workarea modification.
To update the display title of a widget in the widget bar:
Go to Workarea > Settings > Configuration > Personalization > Widgets
Find your widget in this list and click the edit icon to the left of its name
Modify the display title in the second text field in the modal that pops up.
Confirmed working in 8.6.1, likely works in all 8+ versions.
Edit: While this answer is still partially correct, I have discovered the actual way to do this. The correction has been marked as the accepted answer.
Set your IWidgethost's title property:
IWidgetHost _host;
...
_host.Title = "Hello World Widget";
From the esteemed eGandalf's tutorial on widget development:
http://www.ektron.com/Blogs/eGandalf/Break-it-down!-Widget-Development-How-To-(Part-1)/
I have multiple Trac projects with different environments on the same server. I would like to have a list of links to all projects at the top of each project page so I can quickly switch between them with out having to go up to the top level list at /projects/.
The ideal solution would:
not require loading all the Trac environments on every page load.
update automatically when a new project is added.
only require editing the config and/or templates or add a plugin.
work for Trac 0.11.
The NavAddPluggin allows the main trac navigation bar to be customized. You could add menu options for each trac of your projects. To add a new menu item the following is added to the trac.ini file.
[navadd]
add_items = project1
project1.target = mainnav
project1.title = Project One
project1.url = http://webserver/trac_project_1
To sort the order edit the mainnav option in the trac.ini
mainnav = project1,wiki,timeline,roadmap,browser,tickets,newticket,search
To answer the question of how to add a meny using site.html, here is a very basic top header to get you started - paste into the site.html placeholder:
<!--! A top header -->
<py:match path="body" once="True">
<body py:attrs="select('#*')">
<div id="top">
<a py:if="req.href() != '/one'" href="/one">one</a>
<a py:if="req.href() != '/two'" href="/two">two</a>
<a py:if="req.href() != '/three'" href="/three">three</a>
</div>
${select('*|comment()|text()')}
</body>
</py:match>
The example uses very simple logic and just hides the current project . You may want to do it differently, typically using highlighting or similar.
See Trac Layout Recipe for an advanced example. This is the layout in use at edgewall.org to switch between the various projects (Trac, Genshi, Babel, Bitten).
The method described by sudo_o is probably your best bet. It will give you something that is very well integrated into the Trac interface.
However, I wanted to mention a quick-n-dirty alternative that you may find useful. You can configure the logo in the upper-left corner of every Trac page to link to a specific page when clicked. Many Trac installations use this to link back to the start page. The link is configurable, however, and you can make it point to your project listing page. In your trac.ini file:
[header_logo]
src = site/your_logo.png
link = /url/to/projects/page
alt = Click to load projects listing
This method gives you easy access to your projects listing, and doesn't require adding any extra entries to your Trac menus. When you add or remove projects, you don't have to modify every trac.ini file to update the links. The downsides are that it takes an extra click to get to another project and that some users might not find this method as intuitive (setting the alt property helps with this a little).
(Crossposted in SiteFinity's forums)
I'm using SiteFinity 5.0. I created a custom module, using the module builder, called Promos. It's content type is called Promo.
Next, I created a new widget template called PromoFlexSpace. I basically copied the auto-generated template for a single Promo display and changed it a bit.
What I would like to do is globally map this widget template to a user control, so that any time that template is selected, it actually uses my user control. I've found how to do this for an individual item:
http://www.sitefinity.com/documentation/documentationarticles/designer-s-guide/widget-templates/using-external-widget-template-file
http://www.sitefinity.com/blogs/joshmorales/posts/11-05-10/mapping_external_templates_for_sitefinity_4_widgets.aspx
And I found something that came close to explaining what I'm trying to do on a global level:
http://www.sitefinity.com/blogs/joshmorales/posts/11-07-26/customizing_sitefinity_4_controls_with_the_viewmap.aspx
But I haven't found a way to accomplish what I'm trying to do yet (apologies if that last link actually does explain it - I need a better breakdown if it does).
What I've tried so far is going into the advanced settings > controls > view map and adding an entry there, but I can't find a value for HostType that works.
If you go to Administration > Settings > Advanced > Toolboxes > ... > [Your Widget Control] there's a setting for "LayoutTemplate" where you can enter a path to an .ascx file.
I have a component with several categories of games and I want to display a different banner depending on the category. I need the banner (and link) to be customizable so it's not simply a case of showing categoryX.jpg or whatever.
I saw this Joomla help page on another question, but it only seems to display a module type, not one specific module. I'd like to use various mod_custom modules and display the one appropriate to the category (I can store each module's ID if necessary).
Any ideas?
This can be done in a 2 step process:
Use the "Load module into article" plugin to allow yourself to access the module using a plugin call like:
{module [*mod_id*]} // where *mod_id* is the module id
Now that you can call a plugin to put your module anywhere, you now need to go to the view code of your/a component you wish to add the module to and add this code:
echo JHTML::_('content.prepare', '{module [*mod_id*]}');
Please see this link - http://www.alltogetherasawhole.org/group/developers/forum/topics/running-joomla-content-plugins - regarding point number 2. I was trying to do the same thing and I found it didn't work, and the reason for this was a comment you can find on the page link above:
"I noticed that some plugin actually expect option=com_content for them to process onPrepareContent properly, so you might actually want to "fool" them by callin JRequet::setVar and restoring the correct values after the trigger."
If you would like to show module within PHP code then use this code, it's worked for me :
<?php echo JHTML::_('content.prepare', '{loadposition position-2}'); ?>
If you want to show module inside html content then just put this code where you want to show module.
{loadposition position-2}
It loads all modules which are assigned to position-2.
You can also use the Joomla Module Renderer
$doc = JFactory::getDocument();
$renderer = $doc->loadRenderer('modules');
$position = 'custom_position_name';
$options = array('style' => 'raw');
echo $renderer->render($position, $options, null);
Just a heads up, Along with being assigned the module position, that module also has to be set to "Display on All pages".
Joomla has this functionality built in. You can use the {loadposition XX} command within your content items. You can specify custom module positions that do not appear in your template to insure that you have the correct module in the correct article.
http://docs.joomla.org/How_do_you_put_a_module_inside_an_article%3F
You could create a new module?
If each category appears in the querystring (catid=X) then you could take a similar approach to https://support.pillwax.com/open-source/doku.php?id=joomla:header_image.
Alternatively, that link might actually do it for you.