Merge pull request 'Correctly manage maximum lengths of certain HMT fields' (#30) from df/webif:df-hmtfieldlength-patch into master

Reviewed-on: hummypkg/webif#30
This commit is contained in:
af123 2021-02-24 13:04:14 +00:00
commit a1cf871a84
2 changed files with 7 additions and 5 deletions

View File

@ -103,6 +103,8 @@ if {[llength $plugins(dmenu)]} {
}
}
# the maxlength values for title and synopsis are 1 less than the maximum to
# allow for an extra byte to indicate character encoding (see rename.jim)
puts {
</ul>
@ -131,7 +133,7 @@ puts {
</th>
<td>
<input type=text name="rename_title" id="rename_title"
value="" size=70 maxlength=48
value="" size=70 maxlength=47
class="text ui-widget-content ui-corner-all">
</td>
</tr>
@ -144,7 +146,7 @@ puts {
</th>
<td>
<textarea name="rename_synopsis" id="rename_synopsis"
value="" cols=70 rows=4
value="" cols=70 rows=4 maxlength=251
class="text ui-widget-content ui-corner-all"></textarea>
</td>
</tr>

View File

@ -296,21 +296,21 @@ ts method copy {dst} {
}
ts method settitle {newtitle} {
if {[string length newtitle] > 48} { return }
if {[string length $newtitle] > 48} { return }
exec /mod/bin/hmt "+settitle=${newtitle}" $file
set title $newtitle
}
ts method setsynopsis {newsynopsis} {
if {[string length newsynopsis] > 252} { return }
if {[string length $newsynopsis] > 252} { return }
exec /mod/bin/hmt "+setsynopsis=${newsynopsis}" $file
set synopsis $newsynopsis
}
ts method setguidance {newguidance} {
if {[string length newguidance] > 48} { return }
if {[string length $newguidance] > 74} { return }
if {$newguidance eq ""} {
exec /mod/bin/hmt "-guidance" $file