Is it possible to use more complicated layer url rule matching syntax? I want to be able to choose the layer to display based on a more regex type rule that matches the rules I have set up in my custom routing for my module.
I would like to be able to acheive something along the lines of:
url('~/my-{\w*}/something/{\w*}')
It's not available ootb, but could be pretty easy to implement yourself in a custom module (if you don't want to alter the core code).
It can be implemented as a slight modification to existing Orchard.Widgets.RuleEngine.UrlRuleProvider, so regexes would be also taken into account.
Just create an implementation of IRuleProvider, name your function as eg. 'urlregex' (so it wouldn't collide with the existing 'url', processed by UrlRuleProvider) and do all the processing stuff inside Process(RuleContext ruleContext) method. It's a very simple class to implement and would involve just a few lines of code - take a look at the default url rule provider I mentioned at the beginning.
Related
Apart from "Promote Dynamic parameter to webtest parameter"(which binds session key only),
Can we able to bind fetchgriddata=>grid name,execute grid action,etc? for which extraction rules are user defined.
Immediately after a test is recorded, Visual Studio asks whether it should "Promote dynamic parameters to webtest parameters". If you are not sure then answering "Yes" is normally best. After recording and promoting dynamic parameters the test can be further customized (i.e. made to work). One of the tools is the use of extraction rules and then using the extracted values in later parts of the test.
The way that promoting dynamic parameters to webtest parameters works is by creating extraction rules and inserting the values where needed. This automated detection of dynamic data finds many things but it does not (and I think it can not) find all dynamic data items. Hence the test author often needs to find other dynamic data items.
Back on the details of the question. You cannot add extraction rules to a web test before "Promote dynamic parameters to webtest parameters" is asked. Hence the values in your extraction rules cannot be automatically bound into the test.
See also this page which has some more details.
Is there a way to build a ruleset in codeeffects from a string? The default way over the ASP/MVC RuleEditor is currently not an option.
You need to use RuleXML if you want to build your rules dynamically outside of our editor. It's a common way of creating rules in Code Effects. String representation is too generic to be useful in rule generation. Details on RuleXML can be found here.
Also, please take a look at SourceXML; it allows you to generate your source objects dynamically, too. This is a MUCH more flexible approach for source handling that plain .NET objects. Details can be found here.
We are using SonarQube 4.5.1 for our projects and are planning to provide list of rules activation/deactivation to end users.
What is best way to export/import within SonarQube in Excel?
There is option of backup in Quality Profile but it did not export description.
I looked directly in the database with rules table, but due to some HTML tag this is not working for delimited with semicolon.
I would also like to know how we can add customized rules to existing set of rules. What is the procedure?
The SonarQube interface is really going to be the best referential for your users. Based on the info in your comment, I'd suggest a simple web form rather than trying to construct a spreadsheet.
It may help to know that you can construct the URL to any rule using the repositoryKey and key returned in the XML profile backup:
http://[server]/coding_rules#rule_key=[repositoryKey]:[key]
E.G. https://sonarcloud.io/api/rules/search?rule_key=csharpsquid%3AS907
The API supports many parameters that are documented here: https://sonarcloud.io/web_api/api/rules/search (click the Parameters header above the horizontal line to open the descriptions).
For example, the languages parameter makes it possible to search for rules that apply to one or more languages (a comma-separated list). To get the list of all C# rules, you can use https://sonarcloud.io/api/rules/search?languages=cs
To export the Rules on JSON format:
For C++ rules you can use the URL:
http://<localhost:<port/>>api/rules/search?languages=c%2B%2B
For C rules you can use the URL:
http://<localhost:<port/>>api/rules/search?languages=cs
After saving result of search API in json file, to cover entirely the question, import of json result in excel can be done with https://github.com/VBA-tools/VBA-JSON
I often have the situation where the wording of specific strings from various modules or core features needs to be changed for specific tenants & themes in Orchard CMS.
For example, I may have a client that prefers to have the shopping cart checkout button say "Checkout Now" rather than "Go to checkout" which is a string contained within a view in a shopping module.
I can simply override the razor view in my theme and change the string, however views often are quite complex, and it doesn't feel right overriding a view just to change one string.
Another approach I have tried is to define a po translation file within my theme to override the string from the module. This works because the strings in the module are defined using the T() syntax. However, I've noticed that as soon as I define an override for a string within my theme, this override effects all tenants, instead of just the one tenant that has this theme enabled. I'm inclined to think that translations within modules/themes should be ignored from tenants where they are not enabled.
So I'm left wondering what the best approach for this scenario is?
The localisation/po file approach would be ok if tenants ignored po files from themes that aren't enabled, but then again, it would be really nice if there was a module or feature in core that allowed you to specify string overrides via the admin interface. I guess it's more of a "rewording" task than a "translation" task.
The preferred way of doing this is through template overrides. If you don't want to do that, you can actually break shapes down, and delegate the rendering to smaller templates that are easier to override. This is done by simply refactoring the part of a template that you want to be able to override individually into a separate template. This post explains how to do that: http://weblogs.asp.net/bleroy/creating-shapes-on-the-fly
If you're not willing to do that, you can use this module to get strings from the database instead of po files: http://gallery.orchardproject.net/List/Modules/Orchard.Module.Q42.DbTranslations It should be possible to modify it to fit your sceanrio.
I'm relatively new to Expression Engine, and as I'm learning it I am seeing some stuff missing that WordPress has had for a while. A big one for me is shortcodes, since I will use these to allow CMS users to place more complex content in place with their other content.
I'm not seeing any real equivalent to this in EE, apart from a forthcoming plugin that's in private beta.
As an initial test I'm attempting to fake shortcodes by using delimited strings (e.g. #foo#) in the content field, then using a regex to pull those out and pass them to a function that can retrieve the content out of EE's database.
This brings me to a second question, which is that in looking at EE's API docs, there doesn't appear to be a simple means of retrieving the channel entries programmatically (thinking of something akin to WP's built-in get_posts function).
So my questions are:
a) Can this be done?
b) If so, is my method of approaching it reasonable? Or is there something stupidly obvious I'm missing in my approach?
To reiterate, my main objective here is to have some means of allowing people managing content to drop a code in place in their content that will be replaced with channel content.
Thanks for any advice or help you can give me.
Here's a simple example of the functionality you're looking for.
1) Start by installing Low Replace.
2) Create two Global Variables called gv_hello and gv_goodbye with the values "Hello" and "Goodbye" respectively.
3) Put this text into the body of an entry:
[say_hello]
Nice to see you.
[say_goodbye]
4) Put this into your template, wrapping the Low Replace tag around your body field.
{exp:low_replace
find="[say_hello]|[say_goodbye]"
replace="{gv_hello}|{gv_goodbye}"
multiple="yes"
}
{body}
{/exp:low_replace}
5) It should output this into your browser:
Hello
Nice to see you.
Goodbye
Obviously, this is a really simple example. You can put full blown HTML into your global variable. For example, we've used that to render a complex, interactive graphic that isn't editable but can be easily dropped into a page by any editor.
Unfortunately, due to parse order issues, EE tags won't work inside Global Variables. If you need EE tags in your short code output, you'll need to use Low Variables addon instead of Global Variables.
Continued from the comment:
Do you have examples of the kind of shortcodes you want to support/include? Because i have doubts if controlling the page-layout from a text-field or wysiwyg-field is the way to go.
If you want editors to be able to adjust layout or show/hide extra parts on the page, giving them access to some extra fields in the channel, is (imo) much more manageable and future-proof. For instance some selectfields, a relationship (or playa) field, or a matrix, to let them choose which parts to include/exclude on a page, or which entry from another channel to pull content from.
As said in the comment: i totally understand if you want to replace some #foo# tags with images or data from another field (see other answers: nsm-transplant, low_replace). But, giving an editor access to shortcodes and picking them out, is like writing a template-engine to generate ee-template code for the ee-template-engine.
Using some custom fields to let editors pick and choose parts to embed is, i think, much more manageable.
That being said, you could make a plugin to parse the shortcodes from a textareas content, and then program a lot, to fetch data from other modules you want to support. For channel entries you could build out of the channel data library by objectiveHTML. https://github.com/objectivehtml/Channel-Data
I hear you, I too miss shortcodes from WP -- though the reason they work so easily there is the ubiquity of the_content(). With the great flexibility of EE comes fewer blanket solutions.
I'd suggest looking at NSM Transplant. It should fit the bill for you.
There is also a plugin called Shortcode, which you can find here at
Devot-ee
A quote from the page:
Shortcode aims to allow for more dynamic use of content by authors and
editors, allowing for injection of reusable bits of content or even
whole pieces of functionality into any field in EE