Created
February 13, 2015 16:20
-
-
Save rhysgodfrey/f45b1e47ddbf13987b25 to your computer and use it in GitHub Desktop.
Zimbra Social Introduction - Demo 4 - Set Users Bio
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#set($list = $core_v2_user.List("%{IncludeHidden = 'True', PageSize = 100 }")) | |
#foreach($user in $list) | |
#beforeall | |
<div> | |
#before | |
<div> | |
#each | |
<img src="$demo_v1_gravatar.Url($user.Id)" /> | |
<span>$user.Username</span> | |
#if($user.IsSystemAccount) | |
<span style="font-weight: bold;">(System Account)</span> | |
#end | |
#set($profileUrl = $core_v2_urls.User($user.Id)) | |
#if ($profileUrl) | |
<a href="$profileUrl">View Profile</a> | |
#end | |
<div> | |
$user.Bio() | |
</div> | |
<div> | |
<input type="button" data-id="$user.Id" class="grootButton" value="Groot?" /> | |
</div> | |
#after | |
</div> | |
#between | |
<hr /> | |
#afterall | |
</div> | |
#nodata | |
$core_v2_utility.Hide() | |
#end | |
#registerEndOfPageHtml('zimbraDemo.widgets.demoWidget') | |
<script type="text/javascript" src="$core_v2_widget.GetFileUrl('ui.js')"></script> | |
#end | |
#registerEndOfPageHtml() | |
<script type="text/javascript"> | |
jQuery(document).ready(function(j){ | |
j.zimbraDemo.widgets.demoWidget.register({ | |
buttonSelector: '.grootButton' | |
}); | |
}); | |
</script> | |
#end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function ($) { | |
if (typeof $.zimbraDemo === 'undefined') { $.zimbraDemo = {}; } | |
if (typeof $.zimbraDemo.widgets === 'undefined') { $.zimbraDemo.widgets = {}; } | |
$.zimbraDemo.widgets.demoWidget = { | |
register: function(context) { | |
$(context.buttonSelector).click(function() { | |
var id = this.attributes["data-id"].value; | |
var url = '/api.ashx/v2/users/' + id + '.json'; | |
$.telligent.evolution.put({ | |
url: url, | |
data: { | |
Bio: "<strong>I am Groot!</strong>" | |
}, | |
success: function(response) { | |
if (response.Errors && response.Errors.length > 0) { | |
alert(response.Errors[0]); | |
} else { | |
window.location.reload(); | |
} | |
} | |
}); | |
}); | |
} | |
}; | |
})(jQuery); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment