-
Re: where is jive.invite.create being called (overriding invite.soy)
sonny.lau Aug 1, 2013 4:25 PM (in response to kathy.nguyen)1 person found this helpfulI find that using the following procedure usually helps me find what I'm looking for when I want to override something on the Front end of Jive.
- Check if the template is being called from within that file, if it is, then you can modify that file and pass your extra parameters.
- Next, check if it's being called in any other Soy or Freemarker files.
- To do this, you'll need to have an extracted Jive WAR file somewhere.
- If you have a local development instance of Jive, this will be at <project root directory>\web\target\<project final name>\WEB-INF\classes.
- You may optionally move into the soy or template directories if you know what you are looking for is definitely a Soy or Freemarker file.
- Once you are here, use a tool to search through the directory. I use grep on Windows through the Git Bash terminal.
- In your case this would be grep -r "jive.invite.create" * which will recursively search through all files in the classes directory to find if jive.invite.create is being called.
- Any files that are listed here indicate that the string has been found and you should probably take a look at them to see if it's the file you want to modify.
- To do this, you'll need to have an extracted Jive WAR file somewhere.
- If you still can't find your file, it's likely that it is located as Javascript in the jive-core JAR file. In this case, as far as I know, you'll probably need to make your modifications through the Overlay.
- This time, you'll need to either extract the jive-core JAR file somewhere or use an IDE (like IntelliJ) to search through the JAR.
- It'll be easier if you have the source downloaded if what you're looking for is in a Java class.
- In the jive-core extracted directory (or through your IDE), go to <extracted jive-core directory>/resources/scripts and search for jive.invite.create.
- In this case, this is how I've found the definition to jive.invite.create. It is called in the <jive-core JAR>/resources/scripts/apps/invitation/views/invite_view.js file.
- This time, you'll need to either extract the jive-core JAR file somewhere or use an IDE (like IntelliJ) to search through the JAR.
- Finally, you can also check the Spring or Struts definitions to see if your template is being called there.
- Just simply search through the whole jive-core JAR file for any references in *.xml files.
-
Re: where is jive.invite.create being called (overriding invite.soy)
kathy.nguyen Aug 2, 2013 10:35 AM (in response to sonny.lau)Hi Sonny,
Thanks for the thorough steps. I do see the reference to jive.invite.create in the invite_view.js. Looks like I should be able to pass in extra parameters in the protect.initialize, but everything I'm trying does not seem to work =T
protect.initialize = function(){
this.invitees = {};
this.inviteeLists = {};
this.content = this.$template = $j(this.getSoyTemplate(this.params));
var view = this;
this.$form = this.$template.find("#jive-invite-form");
this.autocomplete = new jive.UserPicker.Main({
emailAllowed: this.params.inviteEmail,
userAllowed: this.params.inviteUsers,
....
....
trial: this.params.trial,
maxSelectedCount: this.params.maxInviteCount,
maxSelectedMessage: $j(jive.invite.maxInvitationsError(this.params)),
selectionCallbacks: [this.updateInvitees],
$input : this.$template.find("#invitees"),
invitationsRemaining: this.params.invitationsRemaining,
maxAllowedInvitations: 7,
placeholder : " "
});
This is the .create template header
/**
* @param message The content of the personalized message sent to the user
* @param container {name : "string", id : int, type : "string"}
* @param inviteUsers
* @param inviteEmail
* @param trial Are we in a trial or not?
* @param systemInvite Are we inviting users to the system or to a specific place?
* @param domains
* @param invitationsRemaining
* @param maxAllowedInvitations
* @depends i18nKeys=send.invite.*
* @depends template=jive.UserPicker.soy.inputPlaceholder
*/
{template .create}
<div class="jive-modal j-modal jive-modal-invite" id="jive-modal-invite">
The other part of my question is, what java classes support this invite.soy? Before JIVE 6.0 it was invite.ftl and InviteAction but now these do not exist anymore. There is custom logic that needs to happen when the invitations are sent. Any ideas?
-
Re: Re: where is jive.invite.create being called (overriding invite.soy)
sonny.lau Aug 4, 2013 11:46 PM (in response to kathy.nguyen)1 person found this helpfulI think that in Jive 6 this got moved into it's own little self-contained app so it doesn't have a Java backend that is used to support it; instead I think the Javascript in invite_view.js does that. I know it does talk with an internal service to create the invites though (that's what I was customising when I was looking at this) but I don't think that will help you.
After staring at the code for a minute or two, I've noticed you may have made a mistake. You probably want to put invitationsRemaining: this.params.invitationsRemaining, and maxAllowedInvitations: 7, under this.init like (lines 20-21):
this.init = function(container, company, domains, allowEmail, allowUsers, canInvitePartners, canInviteJustPartners, canInvitePreprovisioned, invitePreprovisionedDomainRestricted, maxInvite, invitePeriod, message, trial, trigger){ this.invitees = {}; this.inviteeLists = {}; var view = this; this.params = { message : message, container : container, inviteEmail : allowEmail, inviteUsers : allowUsers, canInvitePartners : canInvitePartners, canInviteJustPartners : canInviteJustPartners, canInvitePreprovisioned : canInvitePreprovisioned, invitePreprovisionedDomainRestricted : invitePreprovisionedDomainRestricted, domains : domains, companyName : company, maxInviteCount : maxInvite, invitePeriodHours : invitePeriod, trial: trial, systemInvite: (container == null || (container.id == 1 && container.type == 'community')), invitationsRemaining: 5, maxAllowedInvitations: 7 }; this.$trigger = $j(trigger || "#j-invite-button"); this.$trigger.click(function(click){ view.open(); click.preventDefault(); }); };
The line that renders the soy template looks like it is this.content = this.$template = $j(this.getSoyTemplate(this.params)); in protect.initialise so adding your variables to params should do the trick.
-
Re: Re: Re: where is jive.invite.create being called (overriding invite.soy)
kathy.nguyen Aug 5, 2013 11:39 AM (in response to sonny.lau)Yeah.. so I kept the params in protect.initialize and added the params in the this.init like you described, but the values still don't pass through correctly, it still shows 'undefined'
Then I tried just having the params in this.init (removed them from protect.initialize), but still doesn't work.
This is what I've done in invite.soy to try to display the values of the params passed in from this.init and protect.initialize
/** * @param message The content of the personalized message sent to the user * @param container {name : "string", id : int, type : "string"} * @param inviteUsers * @param inviteEmail * @param trial Are we in a trial or not? * @param systemInvite Are we inviting users to the system or to a specific place? * @param domains * @param invitationsRemaining * @param maxAllowedInvitations * @depends i18nKeys=send.invite.* * @depends template=jive.UserPicker.soy.inputPlaceholder */ {template .create} <div class="jive-modal j-modal jive-modal-invite" id="jive-modal-invite"> <div>Number of invitations remaining (max allowed): {$maxAllowedInvitations}</div> <div>Number of invitations remaining: {$invitationsRemaining}</div> ... ...
I'm stumped.
BTW your experience with customizing the internal service that exists now for creating invites will definitely help because part of the customization I'm working on now will require extra logic to perform on the list of invitees.
-
Re: where is jive.invite.create being called (overriding invite.soy)
sonny.lau Aug 5, 2013 4:05 PM (in response to kathy.nguyen)Hmm that's strange... I'd say if nothing changes at all after you've modified the Javascript (try adding a console.log just after this.params is defined in this.init to log the variables you want to display) then you could try to restart Jive to make sure the JS/Soy files are rebuilt and to clear your browser's cache to make sure you're not using an older version.
Other than that there's not much else I can help with, best of luck though.
-
Re: Re: Re: where is jive.invite.create being called (overriding invite.soy)
kathy.nguyen Aug 6, 2013 7:47 AM (in response to sonny.lau)Thanks Sonny! Your help is much appreciated.
So for the purposes of my customization it was sufficient to add a parameter in the /scripts/apps/invitation/main.js .createInvite invite object and override InviteEntity.java in order to pass an extra parameter value through to the InviteProvider.
-
Re: where is jive.invite.create being called (overriding invite.soy)
sonny.lau Aug 6, 2013 4:37 PM (in response to kathy.nguyen)Glad it worked!
-
-
-
-
-