I read http://wiki.customware.net/repository/display/ATLASSIAN/Writing+an+Atlassian+Gadget and somethisng not clear. How can I get login of current user in gadget.xml? Perhaps silly question.
AJS.Gadget({
baseUrl: ...,
useOauth: ...,
config: ...,
view:...
});
It looks
useOauth is responsible for it . Thanks for attention
Community moderators have prevented the ability to post new answers.
useOauth is not for getting user details but for enforcing the authorization mechanism to use while the user access a gadget.
A value of always means, everone can access the gadget whereas a value /rest/gadget/1.0/currentUser will use JIRA's Oauth service to do the authentication.
You can get the current user details using the same rest service: /rest/gadget/1.0/currentUser
Where is this info where it states different property values for the useOauth property in the gadget?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
could you show full gadget xml of example http://www.j-tricks.com/1/post/2011/04/invoking-rest-services-from-gadgets.html, I think something wrong in my code, that I havent yet understood.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I have attached the full plugin in the post now. Have a look. Hope it helps!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks useful post.
All such interesting and clear.
I tried this piece of code but code cant send query,
I tried past to browser
/rest/gadget/1.0/currentUser and it works I got responce. But from gadget.xml I cant send and receive query.
I tried simply get and its doesnt work too
<Content type="html" view="profile">
<![CDATA[
<div id="hope"/>
#requireResource("com.atlassian.jira.gadgets:common")
#includeResources()
<input type="button" id="art"></input>
<script type="text/javascript">
jQuery(document).ready(function(){
jQuery("#art").click(function() {
jQuery.get("/jira/plugins/servlet/children", {"parentid":"3"}, function(data) {
});
});
});
</script>
]]>
</Content>
looks like that gadget.xml cant send querys. firebug show that query wasnt send when button was pressed
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Im not familiar with ajs, thats why I search the example of simple code
that allows me do such:
<script type='text/javascript'>
...
{code of retrieving login of current user}
...
login = ...
</script>
that is all in gadget.xml exact
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I hope you mean retrieving current user's details like name etc. Have a look at this post. Hope it helps.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
sorry I didnt understand exactly
Whats wrong in this script
<![CDATA[ <script type="text/javascript"> (function () { var gadget = AJS.Gadget({ baseUrl: "__ATLASSIAN_BASE_URL__", view: { template: function(args) { var gadget = this; }, args: [{ key: "quip", ajaxOptions: function() { return { url: "/rest/gadget/1.0/currentUser", data: { key : this.getPref("key") } }; } }] } }); })(); alert(args.data.key); </script> ]]>
Why cant I get args.data.key?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Not sure if I understood correctly what are you trying to do here? What is it that you are passing to the the REST service? I don't think it takes any inputs.
Are you trying to retrieve the current user details? Like name etc?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Community moderators have prevented the ability to post new answers.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.