-- adding support for prefs shown on newuser page that aren't required
-- 'normal' is for prefs shown only in the prefs pages
-- 'required' is for required prefs, shown on the newuser page
-- 'signup' is for non-required prefs that are shown on the newuser page

ALTER TABLE pref_items ADD signup varchar(9);

UPDATE pref_items SET signup='required' WHERE required='1';
UPDATE pref_items SET signup='normal' WHERE required='0';

ALTER TABLE pref_items DROP required;

-- edit_prefs (remove required checkbox; add signup radio buttons)
UPDATE blocks SET block='%%title_font%%Edit User Preferences%%title_font_end%%\r\n\r\n<P>%%err_font%%%%update_msg%%%%err_font_end%%</P>\r\n\r\n<FORM action="%%rootdir%%/admin/prefs" method="post">\r\n<INPUT type="submit" name="save" value="Save">\r\n<INPUT type="submit" name="get" value="Get">\r\n\r\n<TABLE border="0">\r\n  <TR>\r\n    <TD><B>Select Preference:</B></TD>\r\n    <TD>%%pref_selectbox%%</TD>\r\n  </TR>\r\n  <TR>\r\n    <TD colspan="2"><B>Delete:</B> <INPUT type="checkbox" name="delete" value="1"> Many prefs should be disabled (not deleted) if you want to prevent users from changing them, as Scoop requires their default values in order to run correctly.</TD>\r\n  </TR>\r\n  <TR>\r\n    <TD><B>Name:</B></TD>\r\n    <TD><INPUT type="text" size="20" maxlength="32" name="prefname" value="%%pref_name%%"> <B>Enabled:</B><INPUT type="checkbox" name="enabled" value="1"%%pref_enabled%%></TD>\r\n  </TR>\r\n  <TR>\r\n    <TD><B>Title:</B></TD>\r\n    <TD><INPUT type="text" size="50" maxlength="50" name="title" value="%%pref_title%%"></TD>\r\n  </TR>\r\n  <TR>\r\n    <TD><B>Description:</B>\r\n      <BR>The description may contain any HTML or normal block reference.</TD>\r\n    <TD><TEXTAREA rows="%%rows%%" cols="%%cols%%" name="description">%%pref_desc%%</TEXTAREA></TD>\r\n  </TR>\r\n  <TR>\r\n    <TD><B>Default Value:</B></TD>\r\n    <TD><INPUT type="text" size="30" name="default_value" value="%%pref_default%%"></TD>\r\n  </TR>\r\n  <TR>\r\n    <TD colspan="2">&nbsp;</TD>\r\n  </TR>\r\n  <TR>\r\n    <TD colspan="2"><B>Preference Display Settings</B></TD>\r\n  </TR>\r\n  <TR>\r\n    <TD><B>Shown on signup page?</B></TD>\r\n    <TD><INPUT type="radio" name="signup" value="normal"%%pref_signup_normal%%> No\r\n    <BR><INPUT type="radio" name="signup" value="signup"%%pref_signup_signup%%> Yes\r\n    <BR><INPUT type="radio" name="signup" value="required"%%pref_signup_required%%> Yes, and it\'s required</TD>\r\n  </TR>\r\n  <TR>\r\n    <TD><B>Preferences page:</B></TD>\r\n    <TD><INPUT type="text" size="20" maxlength="50" name="page" value="%%pref_page%%"></TD>\r\n  </TR>\r\n  <TR>\r\n    <TD><B>Order on page:</B></TD>\r\n    <TD><INPUT type="text" size="5" maxlength="5" name="display_order" value="%%pref_order%%"></TD>\r\n  </TR>\r\n  <TR>\r\n    <TD><B>Control to display:</B>\r\n      <BR>Special key <I>value</I> is the current value of the preference</TD>\r\n    <TD><INPUT type="text" size="50" name="field" value="%%pref_field%%"></TD>\r\n  </TR>\r\n  <TR>\r\n    <TD><B>Template:</B></TD>\r\n    <TD>%%pref_template%%</TD>\r\n  </TR>\r\n  <TR>\r\n    <TD><B>Visible on public user info page?</B></TD>\r\n    <TD><INPUT type="checkbox" name="visible" value="1"%%pref_visible%%></TD>\r\n  </TR>\r\n  <TR>\r\n    <TD><B>Formatting to apply to value</B></TD>\r\n    <TD><INPUT type="text" name="display_fmt" value="%%pref_fmt%%" size="50"></TD>\r\n  </TR>\r\n  <TR>\r\n    <TD colspan="2">&nbsp;</TD>\r\n  </TR>\r\n  <TR>\r\n    <TD colspan="2"><B>Requires</B></TD>\r\n  </TR>\r\n  <TR>\r\n    <TD><B>Site Control:</B></TD>\r\n    <TD>%%pref_var%%</TD>\r\n  </TR>\r\n  <TR>\r\n    <TD><B>Perm to view:</B></TD>\r\n    <TD>%%pref_perm_view%%</TD>\r\n  </TR>\r\n  <TR>\r\n    <TD><B>Perm to edit:</B></TD>\r\n    <TD>%%pref_perm_edit%%</TD>\r\n  </TR>\r\n  <TR>\r\n  <TD><B>Trusted User status:</B></TD>\r\n    <TD><INPUT type="checkbox" name="req_tu" value="1"%%pref_tu%%></TD>\r\n  </TR>\r\n  <TR>\r\n    <TD colspan="2">&nbsp;</TD>\r\n  </TR>\r\n  <TR>\r\n    <TD colspan="2"><B>Validation</B> (blank to allow anything)</TD>\r\n  </TR>\r\n  <TR>\r\n    <TD><B>HTML allowed?</B></TD>\r\n    <TD><INPUT type="checkbox" name="html" value="1"%%pref_html%%></TD>\r\n  </TR>\r\n  <TR>\r\n    <TD><B>Field length:</B></TD>\r\n    <TD><INPUT type="text" size="5" maxlength="5" name="length" value="%%pref_length%%"></TD>\r\n  </TR>\r\n  <TR>\r\n    <TD><B>Regular expression:</B>\r\n      <BR>Perl regexp - but you must escape pipes</TD>\r\n    <TD><INPUT type="text" size="50" name="regex" value="%%pref_regex%%"></TD>\r\n  </TR>\r\n</TABLE>\r\n\r\n<INPUT type="submit" name="save" value="Save">\r\n<INPUT type="submit" name="get" value="Get">\r\n</FORM>\r\n' WHERE bid='edit_prefs';

-- need to update:
-- new_user_html (change |required_prefs| to |signup_prefs| - script)

