Can you customise Layout.Navigation.Menu in CompositeC1? - c1-cms

Is there a way to customise the Layout.Navigation.Menu function in CompositeC1 or perhaps duplicate this function with one I can edit? I need to add unique IDs to the rendered elements so I can create an image based menu rather than text only.

The function may be implemented using XSLT or Razor, depending on what starter site you initially selected. Check below "Functions | XSLT Functions | ..." and if you do not find Layout.Navigation.Menu there then check below "Layout | /App_Data/Razor/...".
To copy a Razor Function simply copy the file, naming it like you want your new function to be named. XSLT Functions do not have a copy feature, here you need to create a new XSLT FUnction and copy over settings.

Related

How can I download a PDF file from a form using UI designer?? Bonita

The thing is I have found how upload a document and after that downolad it. But I just want to download it. I want to do it using the UI designer but I dont know how to do it.
Thanks :)
I dont know which tool are you using to design your UI, anyway this is concerning functionality, not design. In that point, i need to know wich language do you want (or can) use. For example, in PHP, it's very simple, you can make something like:
(create php file) downloadpdf.php
1st: (if you want to generate pdf "on the fly":
<?php
function download($foo){
content headers (type, force-download, etc)
database select to get data or harcode it.
echo data
}
?>
and call this function with some id to select from database or something (ignore if you want to hardcode it)
Other option to download a file, if it's stored on server is making a link to this file (statically or dyamically). If you wanna take control to file downloads, check this post:
http://www.media-division.com/the-right-way-to-handle-file-downloads-in-php/
I don't mean that it can be done with UI designer tools, and it's not concerned if it's from a form or not.
Cheers!
You should create link and variable which type is javascript expression. On Variable value write
return "/bonita/portal/" + $data.context.mainDoc_ref.url;
On link URL write your variable and to text
Download: {{context.mainDoc_ref.fileName}}
Here you can find excellent example for this case

laravel storage hidden directories/files

I'm using Laravel to gather directories from a drive using Storage::disk()->directories();. But I can see that it gathers all the hidden files as well, I'm using Windows so there is a few hidden folders i don't want it to gather. Is there a option or configuration to easily remove them? Or would I have to specify each item I don't want in the array and remove them one by one?
The ones I don't want to see in the array are things like: System Volume Information or $Recycle.bin etc..
You can use array filter to remove those that you don't want.
Something like that
$directories = array_filter(Storage::disk()->directories(), function ($directory) {
return !in_array($directory, ['System Volume Information', '$Recycle.bin']);
});
If you want a list of basic files that you may want to escape, you can take a look at that https://www.gitignore.io/api/windows

Pass parameters to #Cucumber.Options dynamically

I am using cucmber+selenium. Is there a way i can pass options to #Cucumber.Options dynamically. Something like-
features="src/YahooSearch.feature" // i want to take this feature file names from excel & put here...
One way of setting it is through the System.setProperties() method.
Say, if my resources/features folder has all the necessary features, I can simply instruct Cucumber to scan for all the features in the folder like,
String features = "/src/main/resources/features";
System.setProperty("cucumber.options", features);
Also, you can instantiate your RuntimeOptions dynamically like
new RuntimeOptions(features);
You could code something simple by passing command line parameters and retrieving them using ENV['xxx'].
Please see this post
Instead of using Junit, use TestNG to invoke feature files. The flow goes like, Read from Excel and with the data generate testng XML suite dynamically to invoke each feature file. Please find the reference below,
https://github.com/sahajamit/cucumber-jvm-testng-integration

EXT4JS Name Conventions

I'm using EXTJS 4.1 and I'm naming my components as follows. If I create a store I end it with Store and I do the same for Controllers, Models, etc. So I may have UserStore.js. I then put it in a controller. Now EXTJS will create getter and setters for it but the way it does it, is they append the name "Store" to the end so I now have the following: getUserStoreStore(). Which I don't like.
But I want to append Store to my file names so I know what files I'm working in. So for example I may have a UserModel.js, UserStore.js, UserView.js, UserController.js. If I didn't I would have 4 files Called User.js and it would be a pain to always have to remember which file I'm working in.
So my question is there a config to change the way EXTJS names these getters and setters, or do I have to live with getUserStoreStore. It gets even uglier is I have sub dir under stores so for example if I have the following:
-store
-user
-UserStore.js
-UserPersmission.js
I define the store like this:
Ext.define('MyApp.store.user.UserStore'
I then get the following setter:
getUserUserStoreStore()
Yuck! Any idea or do I just live with this?
The short answer is No
You can only change it by overriding the method that creates the 'getter', cause there is no config. Other than, f.e. .Net ExtJS uses namespaces to identify the type (f.e. the controller namespace) and not a applied suffix. In addition; other suffixes are applied by the array into which the class has been placed (f.e. store, model, view).
I recommend you to just divide by namespaces.

Drupal: D7 rewriting values returned by views

I have a requirement to perform an indexed search across content which must include a couple of tags in the result. The tags must be a random selection. The platform is Drupal 7.12
I have created a view that manages the results of a SOLR search through the search_api. The view returns the required content and seems to work as intended. I have included a couple of Global: custom text fields as placeholders for the tag entries.
I am now looking for a solution to manage the requirement to randomise the tag values. The randomisation is not the issue, the issue is how to include the random values into the view result.
My current approach is to write a views_pre_render hook to intercept the placeholders which appear as fields ([nothing] and [nothing_1]). The test code looks like the following
function MODULE_views_pre_render( &$view )
{
$view_display = $view->display['default'];
$display_option = $view_display->display_options;
$fields = $display_option['fields'];
foreach( $view->result as $result )
{
$fields['nothing']['alter']['text'] = sprintf("test %d", rand(1,9));
}
}
I am currently not seeing any change in the placeholder when the view is rendered.
Any pointers to approach, alternate solutions etc would be gratefully received as this is consuming a lot of scarce time at the moment. Calling print_r( $view ) from within the hook dumps over 46M into a log file for a result set of 2 items.
There are two possible solutions for your task.
First approach is do everything on the template level. Define a template for the view field you want to randomize. In advanced settings of your display go to Theme: Information. Make sure that the proper theme is selected and find the template suggestions for your field. They are listed starting from most general to the most specific and you can choose whatever suits you better.
I guess the most specific template suggestion for your field would be something like this: views-view-field--[YOR VIEW NAME]--[YOUR DISPLAY NAME]--nothing.tpl.php. Create the file with that name in the theme templates directory and in this template you can render what ever you want.
By default this template has only one line:
print $output;
you can change this to:
print sprintf("test %d", rand(1,9));
or to anything else, whatsoever :)
Second approach is to go with Views PHP module. WIth this module you can add a custom PHP field in which you can do whatever you want. Even though the module hasn't been released it seems to work quite well for the most of the tasks and most certainly for such a simple task as randomizing numbers it will work out for sure.
I stumbled upon this while searching for another issue and thought I would contribute.
Instead of adding another module or modifying a template, just add a views "sort criteria" of "Global: Random".

Resources