Update blog posting code to use new auth api, also create _apps/brag/
This commit is contained in:
		
							parent
							
								
									5fb2596467
								
							
						
					
					
						commit
						1ef35f74dd
					
				
					 2 changed files with 30 additions and 3 deletions
				
			
		
							
								
								
									
										27
									
								
								lib/_apps/brag/post_form.tpl
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										27
									
								
								lib/_apps/brag/post_form.tpl
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,27 @@ | ||||||
|  | %{ | ||||||
|  | get_post_args target_blog_dir post_title post_body | ||||||
|  | 
 | ||||||
|  | if(~ $REQUEST_METHOD POST && ! ~ $#target_blog_dir 0 && ! ~ $#post_title 0) { | ||||||
|  | 
 | ||||||
|  |     get_user | ||||||
|  | 
 | ||||||
|  |     if(test -f $sitedir/$target_blog_dir/_werc/config) | ||||||
|  |         . $sitedir/$target_blog_dir/_werc/config | ||||||
|  | 
 | ||||||
|  |     if(~ $#blog_editors_group 0) | ||||||
|  |         echo Cant post to $target_blog_dir, no editors group set. | ||||||
|  |     if not if (! user_in_group $blog_editors_group) | ||||||
|  |         echo Post to $target_blog_dir denied, user $logged_user not in group $blog_editors_group | ||||||
|  |     if not if(! make_blog_post $target_blog_dir $post_title $post_body) | ||||||
|  |         echo Posting to $target_blog_dir failed: $status | ||||||
|  |     if not | ||||||
|  |         echo Posted to $target_blog_dir. | ||||||
|  | } | ||||||
|  | %} | ||||||
|  | <form method="POST"> | ||||||
|  |     Submit a new blog post | ||||||
|  |     Post title: <input type="text" name="post_title" /><br /> | ||||||
|  |     <textarea name="post_body"></textarea><br /> | ||||||
|  |     <input type="text" name="target_blog_dir" value="%($target_blog_dir%)" /><br /> | ||||||
|  |     <input type="submit" value="Post" /> | ||||||
|  | </form> | ||||||
|  | @ -14,9 +14,9 @@ for (f in `{ sortedBlogPostList $blogDirs }) { | ||||||
| get_user | get_user | ||||||
| if(~ $#logged_user 1) { | if(~ $#logged_user 1) { | ||||||
| %} | %} | ||||||
| <form method="POST" action="/_apps/blog/post_form"> | <form method="POST" action="/_apps/brag/post_form"> | ||||||
| % echo '<input type="text" name="target_blog_dir" value="'^$blogDirs(1)^'" />' |     <input type="hidden" name="target_blog_dir" value="%($blogDirs(1)%)" /> | ||||||
|     <input type="submit" name="Submit" value="New post" />  |     <input type="submit" name="Submit" value="New blog post" />  | ||||||
| </form> | </form> | ||||||
| % } | % } | ||||||
| <hr /> | <hr /> | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Uriel
						Uriel