Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ##Trick from HTML5 Boilerplate to only load jQuery if it hasn't already been loaded in this page (ie. by another custom field)
- ##Load the local version so as not to break HTTPS
- <script>window.jQuery || document.write('<script src="/lucid/js/jquery-1.6.min.js">\x3C/script>')</script>
- <script type="text/javascript">
- ${esc.d}.noConflict();
- jQuery(document).ready(function($) {
- /* When page is loaded, copy the hidden field value to the dropdown */
- var initialValue = $("#selectABlog").val();
- $("#selectABlog_field select").val(initialValue);
- /* When new option is selected, copy dropdown value to the hidden field */
- $("#selectABlog_field select").change(function(){
- $("#selectABlog").val($(this).val());
- });
- });
- </script>
- ## Detect currently logged in user
- #set ($foundUser = $cmsuser.getUserByUserId($session.getAttribute("USER_ID")))
- #if($foundUser)
- #set($foundUserMap = $cmsuser.getUserProxy($foundUser).getMap())
- #set($userEmail = ${foundUserMap.emailAddress})
- #else
- <p>ERROR: No user found</p>
- #end
- <p>Currently logged in user, <b>$userEmail</b>, has access to:</p>
- <select>
- <option value="">--</option>
- #foreach($blog in $dotcontent.pull("+structureName:Blog",1000,"Blog.blogTitle"))
- ## Show blog if the currently logged in user's email address is listed with the blog, or if the current user is an admin
- #if($blog.whoCanPost.indexOf($userEmail) > -1 || $cmsuser.isUserRole($foundUser,"CMS Administrator")==true)
- ##This user can post to that blog!
- <option value="$blog.blogUrlTitle">$blog.blogTitle</option>
- #end
- #end
- </select>
Advertisement
Add Comment
Please, Sign In to add comment