Update of /cvs/scoop/scoop/struct/patch-files/current
In directory lithium.sabren.com:/tmp/cvs-serv4270/struct/patch-files/current

Modified Files:
	README 
Added Files:
	patch-15-StoryForm.sql 
Log Message:
Move story posting form into blocks. Also moves the part of the poll form where it makes sense into blocks, since it's part of story 
posting. Adds an "edit_own_stories" perm that you can enable for users if you want them to be able to edit their own stuff after posting. 
And finally changes admin tools semantics to allow multiple perms per admin tool. The admin tools box right now only respects the first 
perm listed when it makes the tools list, to preserve the traditional behavior of that box. In the long run, this will need to be 
fixed. Also, it may be advantageous eventually to add an "edit" perm category to sections, to enable editing of some sections but not 
others.

--rusty



Index: README
===================================================================
RCS file: /cvs/scoop/scoop/struct/patch-files/current/README,v
retrieving revision 1.105
retrieving revision 1.106
diff -C2 -d -r1.105 -r1.106
*** README	28 Jan 2005 20:57:10 -0000	1.105
--- README	3 Feb 2005 15:48:31 -0000	1.106
***************
*** 74,77 ****
--- 74,84 ----
          Bugfix for problems in the post throttling code, moves content out of code.
  
+ Feb 03 10:36 patch-15-StoryForm.sql
+         Moves story posting forms entirely into blocks. This will make it a lot
+         easier to add extra fields or customizations to stories. Also, there's 
+         a new admin_tools box that handles a change in admin tools to allow for 
+         more than one perm per tool. Updated here as admin_tools_new to not clobber 
+         custom boxes.
+ 
  Any problems, email scoop-help at lists.kuro5hin.org (don't forget to join!)
  join here: http://lists.kuro5hin.org/mailman/listinfo/scoop-help

--- NEW FILE: patch-15-StoryForm.sql ---
INSERT INTO blocks VALUES ('submit_page_title','Submit Story','1','','','default','en');
INSERT INTO blocks VALUES ('story_list_title','Story List','1','','','default','en');
INSERT INTO blocks VALUES ('archive_list_title','Archived Stories','1','','','default','en');
INSERT INTO blocks VALUES ('pending_list_title','Pending Stories','1','','','default','en');

UPDATE admin_tools SET perm = 'story_admin,edit_my_stories' WHERE tool = 'story';
UPDATE vars SET value=CONCAT(value, ',\r\nedit_my_stories,\r\nstory_time_update') WHERE name='perms';

UPDATE blocks SET block = 'poll:<br><br>\r\nPolls are not required, but if you want one, fill in a question and some answers.' WHERE bid = 'attach_poll_message';

INSERT INTO blocks VALUES ('edit_story_form','<FORM NAME=\"editstory\" ACTION=\"/\" METHOD=\"POST\" enctype=\"multipart/form-data\">\r\n%%hidden_form_data%%\r\n<table width=\"100%\" border=0 cellpadding=\"8\" cellspacing=0>\r\n<tr>\r\n<td valign=\"top\" colspan=\"2\">%%guidelines%%</td>\r\n</tr>\r\n<tr>\r\n<td valign=\"top\" colspan=\"2\">%%all_buttons%%</td>\r\n</tr>\r\n<tr>\r\n<td valign=\"top\">post&nbsp;to:</td>\r\n<td valign=\"top\">%%section_select%% %%topic_select%% %%postmode_select%%</td>\r\n</tr>\r\n%%edit_queue%%\r\n<tr>\r\n<td valign=\"top\">title:</td>\r\n<td valign=\"top\"><INPUT TYPE=\"text\" NAME=\"title\" VALUE=\"%%title%%\" SIZE=50><br>\r\n%%dept%%</td>\r\n</tr>\r\n%%notes%%\r\n<tr>\r\n<td valign=\"top\">intro:</td>\r\n<td valign=\"top\"><TEXTAREA NAME=\"introtext\" COLS=\"%%textarea_cols%%\" ROWS=\"%%textarea_rows%%\" WRAP=\"soft\">%%introtext%%</TEXTAREA></td>\r\n</tr>\r\n<tr>\r\n<td valign=\"top\">body:</td>\r\n<td valign=\"top\"><TEXTAREA NAME=\"bodytex!
 t\" COLS=\"%%textarea_cols%%\" ROWS=\"%%textarea_rows%%\" WRAP=\"soft\">%%bodytext%%</TEXTAREA></td>\r\n</tr>\r\n%%upload_page%%\r\n%%spellcheck%%\r\n<tr>\r\n<td></td>\r\n<td valign=\"top\">%%displaystatus_select%% %%commentstatus_select%% %%edit_category_select%%\r\n</td>\r\n</tr>\r\n%%time_update%%\r\n<tr>\r\n<td>%%poll_message%%</td>\r\n<td>%%poll_form%%</td>\r\n</tr>\r\n<tr>\r\n<td valign=\"top\" colspan=\"2\">%%all_buttons%%</td>\r\n</tr>\r\n</table>\r\n</FORM>','1','The main form for submitting and editing stories. This one has a lot of permitted special keys. Here goes:\r\n\r\n<ul>\r\n<li> allowed_html_intro: the string for what html is allowed in intro. Optional.\r\n<li> allowed_html_body: likewise, for the body field\r\n<li> notes: Block \"story_edit_notes\" -- traditionally for the ED and UPDATE explanations\r\n<li> tid: Topic id of story\r\n<li> section: section id of story\r\n<li> parent: section id of parent section, if there is one\r\n<li> topic_select: The se!
 lector for topics. Generated internally based on perms and vars. REQUI
RED -- it will be a hidden field if you\'re not using topics, but you must have it.\r\n<li> displaystatus_select: Selector for displaystatus. Generated based on perms\r\n<li> commentstatus_select: Obvious\r\n<li> edit_category_select: If you\'re using edit categories, this\'ll be the selector\r\n<li> postmode_select: Selector for posting mode, like \"front page\", \"editing\" etc\r\n<li> all_buttons: The set of currently allowed and relevant buttons. Very required.\r\n<li> aid: uid of author\r\n<li> hidden_form_data: various bits of hdden stuff for the form that scoop needs to track. Very required.\r\n<li> title: Text of the title -- use your own html form element, just include this for \"value\"\r\n<li> dept: Dept field, formatted by block \"story_edit_dept\". Included if show_dept is turned on\r\n<li> upload_page: Story upload form, if you\'re using that.\r\n<li> spellcheck: Spellcheck element, if used. Formatted in block story_edit_spellcheck\r\n<li> edit_queue: Post to e!
 dit queue element, if you\'re using that. Formatted in block story_edit_editqueue\r\n<li> time_update: Update timestamp to now button, if you have permission. Formatted in block story_edit_timeupdate, subject to perm \"story_time_update\"\r\n<li> update_txt: block story_edit_updatetxt\r\n<li> edit_txt: block story_edit_edittxt\r\n<li> textarea_cols: textarea columns, based on perfs and stuff\r\n<li> textarea_rows: textarea rows, likewise\r\n<li> poll_message: Poll into message, from attach_poll_message, if you\'re using polls\r\n<li> poll_form: Poll form, if you\'re using polls\r\n<li> introtext: introtext of the story\r\n<li> bodytext: body text of the story\r\n<li> guidelines: The block \"submission_guidelines\", included for user-level story submit\r\n</ul>','Admin Pages','default','en');
INSERT INTO blocks VALUES ('poll_form_multi','<INPUT type=\"checkbox\" name=\"is_multiple_choice\" value=\"1\"%%allow_multiple%%> Allow multiple selections in poll','1','Allow multiple choice portion of the poll edit form. Included if var \"allow_multiple_choice\" is on.','Polls','default','en');
INSERT INTO blocks VALUES ('poll_form_question','%%last_update%%\r\n%%attached_to%%\r\n%%current%%\r\n%%hidden_form_input%%\r\n%%multiple_choice%%\r\n<p>\r\nPoll Question:<br>\r\n<INPUT type=\"text\" size=\"30\" name=\"question\" value=\"%%question%%\"><br><br>\r\nPoll Answers:<br>\r\n\r\n','1','','Polls','default','en');
INSERT INTO blocks VALUES ('edit_story_archive_success','<table>\r\n<TR><TD>%%norm_font%%<B>Story archived.</B>%%norm_font_end%%</TD></TR>\r\n</table>','1','','Stories','default','en');
INSERT INTO blocks VALUES ('edit_story_archive_fail','<table>\r\n<TR><TD>%%norm_font%%<B>Could not archive story.</B>%%norm_font_end%%</TD></TR>\r\n</table>','1','','Stories','default','en');
INSERT INTO blocks VALUES ('edit_story_deleted','<table>\r\n<TR><TD>%%norm_font%%<B>Story deleted.</B>%%norm_font_end%%</TD></TR>\r\n</table>','1','','Stories','default','en');
INSERT INTO blocks VALUES ('story_edit_updatetxt','<br>Insert <B>[UPDATE]</B> to create an \"[Update]\"','1','','Stories','default','en');
INSERT INTO blocks VALUES ('story_edit_edittxt','<br>Insert <B>[ED]</B> to create an \"[editor\'s note]\"','1','','Stories','default','en');
INSERT INTO blocks VALUES ('story_edit_notes','<TR>\r\n  <TD>\r\n    special functions:\r\n  </td>\r\n  <td>\r\n    Insert <B>[UPDATE]</B> to create an \"[Update]\"<br>\r\n    Insert <B>[ED]</B> to create an \"[editor\'s note]\"\r\n  </TD>\r\n</TR>','1','','Stories','default','en');
INSERT INTO blocks VALUES ('edit_story_admin_page','<div class=\"title\">Edit Story</div>\r\n<div class=\"error\">%%error%%</div>\r\n%%story%%\r\n<p>\r\n%%edit_form%%','1','','Admin Pages','default','en');
INSERT INTO blocks VALUES ('story_edit_spellcheck','<tr>\r\n<td valign=\"top\">spellcheck:</td>\r\n<td valign=\"top\"><INPUT TYPE=\"checkbox\" NAME=\"spellcheck\" VALUE=\"on\"%%check%%></td>\r\n</tr>\r\n','1','','Admin Pages','default','en');
INSERT INTO blocks VALUES ('story_edit_editqueue','<tr>\r\n<td></td>\r\n<td><INPUT TYPE=\"checkbox\" NAME=\"edit_in_queue\" VALUE=\"1\" %%check%%> Request editorial feedback</td>\r\n</tr>\r\n','1','','Stories','default','en');
INSERT INTO blocks VALUES ('story_edit_timeupdate','<tr>\r\n<td valign=\"top\">update timestamp:</td>\r\n<td valign=\"top\"><input type=\"checkbox\" name=\"timeupdate\" value=\"now\"></td>\r\n</tr>','1','','Stories','default','en');
INSERT INTO blocks VALUES ('story_edit_upload','<tr>\r\n  <td>&nbsp;</td>\r\n  <td>%%form%%</td>\r\n</tr>','1','Story submit form element for file uploads. Special key |form| will be replaced with the form, if used.','','default','en');
INSERT INTO blocks VALUES ('story_edit_dept','<tr>\r\n<td>department:</td>\r\n<td><INPUT TYPE=\"text\" NAME=\"dept\" VALUE=\"%%dept%%\" SIZE=50></td>\r\n</tr>','1','','Stories','default','en');
INSERT INTO blocks VALUES ('story_hide_message','Story %%sid%% hidden.','1','','Stories','default','en');
INSERT INTO blocks VALUES ('story_delete_message','Story %%sid%% deleted.','1','','Stories','default','en');

INSERT INTO box VALUES ('admin_tools_new','Admin Tools','my $content;\r\n\r\nmy @tools = sort { $a->{pos} <=> $b->{pos} } values %{ $S->{ADMIN_TOOLS} };\r\n\r\nforeach my $t (@tools) {\r\n        my $perm = $t->{perm};\r\n        if ($t->{perm} =~ /,/) {\r\n          $t->{perm} =~ /^(.*?),/;\r\n          $perm = $1;\r\n        }\r\n	if ( $S->have_perm($perm) ) {\r\n		$content .= qq|\r\n	%%dot%% <a class=\"light\" href=\"%%rootdir%%/admin/$t->{tool}\">$t->{menuname}</a><br>|;\r\n	}\r\n}\r\n\r\nif ($S->have_perm(\'edit_user\')) {\r\n $content .= qq{<br>\r\n <FORM NAME=\"uedit\" METHOD=\"GET\" ACTION=\"%%rootdir%%/\">\r\n Edit User:<BR>\r\n <INPUT TYPE=\"hidden\" NAME=\"op\" VALUE=\"user\">\r\n <SMALL><INPUT TYPE=\"text\" NAME=\"nick\" VALUE=\"\" SIZE=10>\r\n <INPUT TYPE=\"SUBMIT\" NAME=\"tool\" VALUE=\"prefs\">\r\n <INPUT TYPE=\"SUBMIT\" NAME=\"tool\" VALUE=\"info\">\r\n </SMALL></FORM>};\r\n}\r\n\r\nreturn \'\' unless $content;\r\n\r\nreturn $content;\r\n','Admin Tools box','!
 box',0);