MODX Revolution 2.2.10-pl
Migx 2.6.8
I use this in a TV for my clients to be abble to choose a ressource :
{"field":"link1","caption":"Lien","inputTVtype":"resourcelist"}
The context of a user is defined with a user group context access.
I've tried to tick the checkbox of the user usergroup in the TV, but if I do that the user is not abble to see th TV anymore.
Problem is that mys client can see every ressources of every contexts. I need him to only be abble to see the resourcelist of their context. Is there a way to do that ?
You could make a TV with custom #eval options and use that for your migx field. See here for an example and description; http://rtfm.modx.com/revolution/2.x/making-sites-with-modx/customizing-content/template-variables/bindings/eval-binding.
First change your TV to this, basically just swapping out "inputTVtype" to "inputTV"
{
"field":"link1",
"caption":"Lien",
"inputTV":"yourCustomTv"
}
Step two is to create a snippet that finds the resources you want, this requires you to have some knowledge of PHP. Basically you need to find the resources and loop them, outputting a string that looks like a regular list values string (resourceId==name||resourceId==name||...)
Step three is to create "yourCustomTv", and for the input options give it the #EVAL return $modx->runSnippet('yourSnippet');
Related
In one of step definitions I have created a function say “someFunction” that takes a DataTable, which has been defined in my feature file Feature1.
Feature1.feature
Given: User enters the following data
Varibale1|Variable2|Variable3
Value1|Value2|Value3
StpeDef.java
#Given(“^User enters the following data$”)
public void someFunction(DataTable input){
}
Now in another feature file “Feature2.feature”, one of my scenario needs to use same step i.e. call someFunction. I know I can use the same step definition but does that mean that I would have to redefine same DataTable input in Feature2 file.
If not, how would I do it?
Please note that I understand the Backgound keyword and its use, but if I say I need to keep these scenarios in different feature files, how should this be done?
You'll have to duplicate the common background. Since duplication is unwanted, you should consider giving a name/title to the resulting state that is represented by that common background and create a single given step that can be re-used. Something like "Given: the user has entered valid contact data" or "Given: the shopping cart has 3 items" (where any 3 will do).
The below diagram is based on an android application. When the application loads the user is given 3 button to select add, update and Search. On click on add button the user is given an option to add a new user or add a new item. When the user selects the add item option he enters the required data. Once the data is entered the system check if all the values are entered is correct. if it is correct it is saved if not the user is asked to re-enter the values.One the data is saved the user is asked to write the asset id to an NFC tag.
The same process is applied for update section.
In the search the user is given 2 option to either search the asset through text or by tapping the NFC device onto the NFC tag to search the desired item from the database.
I wanted to know if the sequence diagram I have done is correct.
I would remove the Choose an Option messages. The machine does not trigger anything at the actor. It's the actor who decides. So the initial message always comes from the actor.
The Return Result is implicit with the dotted line. Instead describe what is being returned.
Finally (and most important) you do not use objects but classes in your SD. Always (!) use objects since its an object which communicates, not a class.
I'm realizing a theme with liferay using velocity. I would like to add some functions to the theme homepage only in the case the user logs in the portal for the first time.
How can I use velocity (portal_normal.vm) to achieve that?
As stated by #Olaf Kock it is not suggested to use the business logic in the theme section.
But, If you want to do it anyway then Liferay provides a set of Velocity Variables that can be accessed in the Themes. Which includes the User details too.
These are some of the User related Variables available globally in themes,
$user_id,$is_default_user,$user_first_name,$user_middle_name .... $user_login_ip, $user_last_login_ip
You can check out more at : themes\_unstyled\templates\init.vm inside ROOT.WAR.
So, For your specific purpose here you can use $user_last_login_ip. If the value is null then it would be the first time the user has logged into the portal.So, use this inside the portal_normal.vm,
#if (!$user_last_login_ip)
... do stuff here if the variable is null
#end
And, Alternately you can fetch the User last login date using and check null to ensure whether it is his first login,
#if (!$user.getLastLoginDate())
... do stuff here if the variable is null
#end
Don't add this to the theme. Rather have a separate custom LoginAction for this. This will be executed on every login (you can choose pre- or post-login, I'm assuming that post-login will be appropriate) and should find some more information than I linked on this topic all over the net.
A theme is made for look&feel and should not contain any business logic - especially not when it's for a one-off purpose.
I've created my own solution with a custom entity of type activity. I'd like to show a message whenever a new instance of it is created using an existing contact but not allow the user to create one, if only attempting to do that without going via contact.
Basically, my aim is that it won't be impossible to just create that activity (the form will be hidden directly at any attempt except for one way only). The user will have to go to contacts (or leads etc.) and in there add and create an instance of the custom activity entity. That way, I can assure that the field "regarding" will be filled out already.
I'm guessing that I need to detect somehow that the opening of the form is a creation attempt. How can I do that?
Also, as it is now, the user can't create a contact-less activity of the custom type because it doesn't appear on the menu with other activities. I must have disabled it somehow but I have no idea how. Anybody who has one?
You could do this a bunch of ways but the easiest would probably be to:
Make the regarding field read only.
Make the regarding field mandatory.
That way if a user opens a create new form they wont be able to set the regarding and because its mandatory they wont be able to save the record. When they open via an existing contact the regarding field will be mapped automatically. That said in this case just making it mandatory my be enough.
(As a side JavaScript can be used to identify the current form state, but I'm not sure how useful that is here).
In terms of where custom activities appear, by default mine show in a number of locations, for example:
CRM > Workplace > Activities > Ribbon > Other Activities > XXX.
CRM > Workplace > Activities > View Selector > XXX.
They don't show under the left hand navigation of the workplace because they are grouped under 'Activities'. I'm pretty sure these are all the default settings.
You can exercise greater control by editing the sitemap, where you can put pretty much anything, anywhere.
In addition to Mr Wood, I'd like to show you some code. It works as supposed to but I'm not sure if it's optimal.
var foo = function () {
var whatIsGoingOn = Xrm.Page.ui.getFormType();
if (whatIsGoingOn === 1)
alert("Let there be an entity!");
else
alert("Not a creation...");
}
The other states' (deletion, update etc.) numeric values are listed here.
Answering the second part of your question:
When you create a custom activity you can choose whether to have it appear in 'normal' Activity menus or not by checking the box at the top right of the entity form. This is a once-only choice as far as I know and can't be changed later.
For your setup, I would suggest NOT checking this box, so it does not appear in the activity menus to avoid users even being tempted to do it that way.
Instead, add an explicit relationship to the activity N:1 to Contact, and another N:1 to Lead. Use this relationship to add your activity to the left navigation of Contact and Lead forms, or add a grid for them (depends on how you want to use this and if you need to filter the view to something other than the default "Associated View").
When a user navigates to this section they will see if any previous activities of this type exist, and be able to add a new one. BUT this means that the child record is a child via this relationship, not using "regarding", so use a script on the form for the activity so that if Contact is filled in, it is copied to Regarding, and if Lead is filled in then that is copied. If neither, then use an alert or other means to warn the use that something is wrong (see comment earlier). If you want Regarding to be read-only but filled in by script, you will need to make sure to use the force the value to be saved:
Xrm.Page.getAttribute("regardingobjectid").setSubmitMode("always");
You must have the lookups for Contact and Lead on the form to be able to use them in your scripts, but you can make them not "visible by default" so they are there but not seen by the user (and taking up no space).
This is what I am trying to do, when my apps load, user is presented with a bunch of options ( These options are coming from a server) and when user selects one of those options I have to create a new tab bar controller with number of tabs, their name, their layout all coming from a server in the xml format. So the first question is it possible to do this in iphone, that is create all the view controller programmatically on the run time, if yes can you please point me to some reference, i have been searching in google, but may be my search terms are not good, I am not getting back any results.
Of course, it's possible. Anything that can be done using IB can also be done in code. In your particular case, you have to subclass the UITabBarController class and then use the viewControllers property to populate the bar at runtime, depending on your XML.
Please refer to the class reference at Apple.com for more information.
Possible duplicate of iPhone -- create UITabBar programmatically?