diff options
| author | Jules Laplace <carbon@melanarchy.org> | 2013-08-02 17:14:41 -0500 |
|---|---|---|
| committer | Jules Laplace <carbon@melanarchy.org> | 2013-08-02 17:14:41 -0500 |
| commit | e9192b3d42660a5781101df4357d276318151e8a (patch) | |
| tree | 059eb6ace6147cf9559af74ed1ab5e221c80e280 /lib/settings.pm | |
| parent | 79670053c7247d3a49b607960efd284e93f057e5 (diff) | |
cgi-bin & lib
Diffstat (limited to 'lib/settings.pm')
| -rw-r--r-- | lib/settings.pm | 315 |
1 files changed, 315 insertions, 0 deletions
diff --git a/lib/settings.pm b/lib/settings.pm new file mode 100644 index 0000000..2767cac --- /dev/null +++ b/lib/settings.pm @@ -0,0 +1,315 @@ +############################################# +# SETTINGS - thread maintain forms + +sub admin_form + { + my ($id, $t, $f, $k) = @_; + print <<adminhead; +<table width=100% border=0 cellpadding=0 cellspacing=5> +<tr> +adminhead + if ($t->{files} > 0) + { + print qq(<td colspan=2 align=left style="padding-left: 10px;">\n); + } + else + { + print qq(<td align=left style="padding-left: 10px;">\n); + } + print <<adminhead; +<div style="float: right; text-align: center;"> +<br> +<a href="$BUCKY/details/$id"><u><big><b>exit</b> settings screen</big></u></a><br><br><br> +adminhead + ($many, $flagged) = find_jpeg($files, $t->{flagged}); + print qq!</div>!; + + thread_display_settings($id, $t, $k); + keyword_display_settings($id, $t, $k); + print q{ </td>}; + + if ($t->{files} > 0) + { + print q{ <td align=center valign=top>}; + file_display_settings($id, $t); + print q{ </td>}; + } + print q{</tr>}; + print q{<tr><td colspan=2 align=right>}; + thread_delete_box($id); + print q{</td></tr>}; + print q{</table>}; + } + +sub thread_display_settings + { + my ($id, $t, $k) = @_; + + my $rcolor = get_color($t, $k); + + print qq!<div style="text-align: center; width: 350px;">!; + print qq!<center>!; + print <<keywordhead; +<big><b>display</b> settings</big> +<hr noshade color="$BUCKY_COLOR_HR"> +keywordhead + print qq!<div style="text-align: left; width: 250px;">!; + print qq!<form action="$BUCKY/maintain" name="display" method="post" enctype="multipart/form-data">\n!; + print qq{<input type=hidden name="debug" value="1">\n} if ($DEBUG); + print qq{<input type=hidden name="id" value="$id">\n}; + print qq{<input type=hidden name="c" value="display">\n}; + + print qq!<table border=0 cellpadding=0 cellspacing=0>!; + print qq!<tr>!; + print qq!<td align="right">!; + print qq(title: ); + print qq!</td>!; + print qq!<td align="left">!; + print qq(<input type=text name="title" value="$t->{title}" size=30 maxlength=48> ); + print qq!</td>!; + print qq!</tr>!; + print qq!<tr>!; + print qq!<td align="right">!; + print qq(color: ); + print qq!</td>!; + print qq!<td align="left">!; + color_dropdown($rcolor, 0); + print qq!</td>!; + print qq!</tr>!; + + print qq!<tr>!; + print qq!<td> </td>!; + print qq!<td align="left">!; + + print qq!<table border=0 cellpadding=0 cellspacing=0>!; + print qq!<tr>!; + onecheckbox("shorturl", "shorten urls", $t->{display}); + print qq!</tr>!; + print qq!<tr>!; + onecheckbox("editable", "comments editable by ops", $t->{display}); + print qq!</tr>!; + print qq!<tr>!; + onecheckbox("opset", "post settings available to ops", $t->{display}); + print qq!</tr><tr>!; + onecheckbox("no-zip-button", "no zip button", $t->{display}); + print qq!</tr>!; + + if ($t->{keyword} ne undef) + { + onecheckbox("hidekws", "hide keyword list", $t->{display}); + } + + if ($t->{files} > 5) + { + print qq!<table border=0 cellpadding=0 cellspacing=0>!; + print qq!<tr>!; + my $ffl = check_key($t->{display}, "ffl"); + my $nfl = check_key($t->{display}, "nfl"); + oneradiobutton("filelist", 2, "full file list", $ffl); + print qq!</tr><tr>!; + oneradiobutton("filelist", 1, "trim if many images", (!$nfl && !$ffl)); + print qq!</tr><tr>!; + oneradiobutton("filelist", 0, "no file list", $nfl); + print qq!</tr>!; + print qq!</table>!; + } + print qq!</table>!; + print qq!</td>!; + print qq!</tr>!; + print qq!</table>!; + + print qq!<hr noshade color="$BUCKY_COLOR_HR" size=1>!; + print qq!<table cellpadding=0 cellspacing=0 border=0>!; + print_garrow("date posted", (verbosedate($t->{createdate}))); + print_garrow("last changed", (verbosedate($t->{lastmodified}))); + print_garrow("total comments", (hushnull($t->{comments}))); + print_garrow("total files", (hushnull($t->{files}))); + my $par = get_participation($t->{id}); + my $ps = $par != 1 ? 's' : ''; + print_garrow("participating",(hushnull($par).qq! <span class="older">duder$ps</span>!)); + if ($t->{zipped} == -1) + { + my $zipfile = retrieve_zip_mechanism($t); + if ($zipfile == 1) + { print_garrow("zipfile?", qq(<b>in progress</b>)); } + } + if ($t->{zipped} == 0) + { + print_garrow("zipfile?", qq(none)); + } + if ($t->{zipped} == 1) + { + my $zip = get_file_from_filename(generate_zip_filename($t)); + print_garrow("zipfile?", qq(exists, <small>complete as of ).(verbosedatetime($zip->{date}))[0].qq(<br><u>freshen</u> | <u>flush</u></small>)); + } + print qq!</table>!; + + print qq!</div>!; + print qq!</center>!; + print qq!</div>!; + + print qq!</td>!; + print qq!</tr>!; + + print <<keywordhead; +<div style="width: 350px;"> +<center> +<big><b>category</b> settings</big> +<hr noshade color="$BUCKY_COLOR_HR"> +keywordhead + +# no keyword set + if ($t->{keyword} eq undef) + { + print qq!<form action="$BUCKY/index" method="post" name="keyword" enctype="multipart/form-data">\n!; + print qq{<input type=hidden name="debug" value="1">\n} if ($DEBUG); + print qq{<input type=hidden name="thread" value="$id">\n}; + print qq{<input type=hidden name="c" value="assign">\n}; + print qq!<table border=0 cellpadding=0 cellspacing=0>!; + print qq!<tr><td align="center" valign="middle">SELECT ONE: !; + keyword_pulldown($t->{keyword}); + print <<kwform; +<input type="submit" value="SET CATEGORY" class="clicky"> +</form> +</td> +</tr> +<tr> +<td align="center" valign="middle"> +or<br><a href="$BUCKY/index?thread=$t->{id}&keyword=new"><big>make <b>new</b> category</big></a> +</td> +</tr> +</table> +kwform + } + else + { + print qq{current category: <b>$k->{keyword}</b>}; + + print qq! · <a href="$BUCKY/index?c=detach&thread=$t->{id}!; + print qq!&debug=1! if ($DEBUG); + print qq!"><small>detach</small></a>!; + + if ($k->{owner} eq $USER->{username} || check_op($k) || $USER->{ulevel} == 3) + { + print qq! · <a href="$BUCKY/index?c=edit&keyword=$t->{keyword}!; + print qq!&debug=1! if ($DEBUG); + print qq!"><small>settings</small></a>!; + } + } + print <<kwform; +<br> +<br> +<big><b>privacy</b> settings</big> +<hr noshade color="$BUCKY_COLOR_HR"> +kwform + + print qq!<table border=0 cellpadding=0 cellspacing=0>!; + print qq!<tr>!; + print qq!<td valign="middle" align=right>viewable by ·</td>!; + print qq!<td valign="middle" align=left>!; + privacy_select("private", $t->{private}); + print qq!</td></tr></table>!; + if ($t->{private} > 1) + { + print qq!<span style="font-family: georgia, garamond, serif; font-size: 12px;">\n!; + print qq!<nobr><small>users checked off below will be able to <b>read</b> and <b>update</b> this post!; + if ($k != -1 && $k->{public} != 1) + { + print qq!,<br>but cannot see the rest of the keyword!; + } + print qq!.</small></nobr>\n!; + print qq!</span>!; + user_checkerboard($t->{allowed}, undef, $t->{username}); + } + print <<privend; +<input type="submit" value="UPDATE PRPOST SETTINGS" class="clicky"> +</form> +</small> +</center> +</div> +privend + } + +sub file_display_settings + { + my ($id, $t) = @_; + print <<dirtop; +<div style="width: 500px; text-align: center;"> +<big><b>file</b> settings</big><br> +<hr noshade color="$BUCKY_COLOR_HR"> +dirtop + + print qq!<form name="filez" action="$BUCKY/maintain" method="post" enctype="multipart/form-data">!; + print qq{<input type=hidden name="c" value="f">\n}; + print qq{<input type=hidden name="id" value="$id">\n}; + print qq{<input type=hidden name="debug" value="1">\n} if ($DEBUG); + print <<actionform; +<script type="text/javascript"> +<!-- +function toggle() + { + var e = document.filez.elements.length; + for (var i = 0; i < e; i++) + { + var y = "document.filez[i].type"; + type = eval(y); + + var n = "document.filez[i]"; + box = eval(n); + + if (type == "checkbox") + { + if (box.checked == false) + { box.checked = true; } + else + { box.checked = false; } + } + } + } +--> +</script> + + <input type=button value="toggle checked" onClick="JavaScript:toggle()"> · + <select name="verb"> + <option value="flag" selected>Check off main image...</option> + <option value="rm">Delete checked files (no undo)</option> +<!-- <option value="move">Move checked files...</option> --> + </select> + <input type="submit" value="UPDATE FILES" class="clicky"> +actionform + file_list($files, -1, 1); + print <<end; +</form> +</div> +end + } + +sub thread_delete_box + { + my ($id) = @_; + print <<formend; +<tr> +<td align="right" colspan=2 nowrap> +<form action="$BUCKY/maintain" name="delete" method="post" enctype="multipart/form-data"> +<input type=hidden name="id" value="$id"> +<input type=hidden name="c" value="clobber"> +<input type="submit" value="EMERGENCY DELETE BUTTON" class="clicky" style="margin-right: 15px;"> +</form> +</span> +</td> +</tr> +</table> +formend + } + +############################################# + +sub print_garrow + { + my ($a, $b) = @_; + $a =~ s/\s/ /g; + print qq!<tr><td style="text-align: right; vertical-align: middle;"><big>$a:</big></td><td style="text-align: left; vertical-align: middle; padding: 5px;">$b</a></td></tr>\n!; + } + +1; + |
