Committer: sbelyaev
LJSUP-10219: Behavior for variables "Publish/Postpone untill" on update.bmlU trunk/cgi-bin/LJ/Widget/EntryForm.pm
Modified: trunk/cgi-bin/LJ/Widget/EntryForm.pm =================================================================== --- trunk/cgi-bin/LJ/Widget/EntryForm.pm 2011-11-01 08:39:29 UTC (rev 20457) +++ trunk/cgi-bin/LJ/Widget/EntryForm.pm 2011-11-01 08:55:53 UTC (rev 20458) @@ -163,6 +163,8 @@ js/lj_ippu.js js/ck/ckeditor.js js/rte.js + js/jquery/jquery.lj.basicWidget.js + js/jquery/jquery.lj.entryDatePicker.js stc/display_none.css ); @@ -533,45 +535,67 @@ my $hide_link = $can_edit_date ? '' : 'style="display: none;"'; if (LJ::is_enabled("delayed_entries")) { - if ( $opts->{'mode'} eq "edit" && $can_edit_date ) { - $out .= qq{ <li class='pkg' id='currentdate'><label class='title'>$BML::ML{'entryform.date'}</label> - <span class='wrap'> - $monthlong, $mday, $year, $hour:$min - <a $hide_link href='javascript:void(0)' onclick='editdate();' id='currentdate-edit'>$BML::ML{'entryform.date.edit'}</a> - $help_icon - </span> - </li> }; + $out .= qq{ + <li id="entrydate" class="pkg entrydate entrydate-date entrydate-delayed"> + }; + + if ( $opts->{'mode'} eq "edit" && $can_edit_date ) { + if ( $opts->{'delayed'} ) { + $out .= qq{ + <label class="title entrydate-title-date">$BML::ML{'entryform.postponed.until'}</label> + }; + } else { + $out .= qq{ + <label class="title entrydate-title-date">$BML::ML{'entryform.date'}</label> + }; + } } else { - $out .= qq{ <li class='pkg' id='currentdate'><label class='title'>$BML::ML{'entryform.post'}</label> - <span class='wrap'> - $BML::ML{'entryform.post.right.now'} - <a $hide_link href='javascript:void(0)' onclick='editdate();' id='currentdate-edit'>$BML::ML{'entryform.date.edit'}</a> - $help_icon - </span> - </li>}; + $out .= qq{ + <label class="title entrydate-title-post">$BML::ML{'entryform.post'}</label> + }; } - $out .= qq{ <li class='pkg' id='modifydate' style='display: none;'><label class='title'>$BML::ML{'entryform.postponed.until'}</label> - <span class='wrap'> - <input type="hidden" name="date_ymd_mm" value="$mon" /> - <input type="hidden" name="date_ymd_dd" value="$mday" /> - <input type="hidden" name="date_ymd_yyyy" value="$year" /> - $date_diff_input - <span class="wrap-calendar"><a id="currentdate-date" href="#">$monthlong $mday, $year</a><i class='i-calendar'></i></span> - <span class='datetime'> - <input type='text' name='hour' value='$hour' class='input-num' /> : <input type='text' value='$min' name='min' class='input-num' /> - <?de $BML::ML{'entryform.date.24hournote'} de?> - </span> - $help_icon + $out .= qq{ + <label class="title entrydate-title-until">$BML::ML{'entryform.postponed.until'}</label> + }; + + if ( $opts->{'mode'} eq "edit" && $can_edit_date ) { + $out .= qq{ + <span class="wrap entrydate-wrap-date"> + $monthlong, $mday, $year, $hour:$min + <a $hide_link href='javascript:void(0)' id='currentdate-edit'>$BML::ML{'entryform.date.edit'}</a> + $help_icon </span> + }; + } else { + $out .= qq{ + <span class="wrap entrydate-wrap-post"> + $BML::ML{'entryform.post.right.now'} + <a $hide_link href='javascript:void(0)' id='currentdate-edit'>$BML::ML{'entryform.date.edit'}</a> + $help_icon + </span> + }; + } + $out .= qq{ + <span class="wrap entrydate-wrap-until"> + <span class="wrap-select">$datetime</span> + $date_diff_input + <span class="wrap-calendar"><a id="currentdate-date" href="#">$monthlong $mday, $year</a><i class='i-calendar'></i></span> + <span class='datetime'> + <input type='text' name='hour' value='$hour' class='input-num' /> : <input type='text' value='$min' name='min' class='input-num' /> + <?de $BML::ML{'entryform.date.24hournote'} de?> + </span> + $help_icon + </span> </li> - <li> - <noscript> - <p id='time-correct' class='small'> + + <li> + <noscript> + <p id='time-correct' class='small'> $BML::ML{'entryform.nojstime.note'} - </p> - </noscript> - </li> + </p> + </noscript> + </li> }; } else { my $backdate_check = LJ::html_check({ @@ -586,39 +610,33 @@ my $backdate_help_icon = LJ::help_icon_html("backdate", "", ""); $out .= qq{ - <li class='pkg'> - <label for='modifydate' class='title'>$BML::ML{'entryform.date'}</label> - <span class="wrap"> - <span id='currentdate'> - <span id='currentdate-date'> - $monthlong $mday, $year, $hour:$min - </span> - <a href='javascript:void(0)' onclick='editdate();' id='currentdate-edit'>$BML::ML{'entryform.date.edit'}</a> + <li id="entrydate" class="pkg entrydate entrydate-date"> + <label for="modifydate" class="title entrydate-title-date">$BML::ML{'entryform.date'}</label> + <span id='currentdate' class="wrap entrydate-wrap-date"> + <span id='currentdate-date'> + $monthlong $mday, $year, $hour:$min </span> - <span id='modifydate'> - $datetime - $date_diff_input - <?de $BML::ML{'entryform.date.24hournote'} de?> - <span class="backdate"> - $backdate_check - <label for='prop_opt_backdated'> - $BML::ML{'entryform.backdated3'} - </label> - $backdate_help_icon - </span> + <a href='javascript:void(0)' id='currentdate-edit'>$BML::ML{'entryform.date.edit'}</a> + </span> + <span id='modifydate' class="wrap entrydate-wrap-changeit"> + $datetime + $date_diff_input + <?de $BML::ML{'entryform.date.24hournote'} de?> + <span class="backdate"> + $backdate_check + <label for='prop_opt_backdated'>$BML::ML{'entryform.backdated3'}</label> + $backdate_help_icon </span> </span> - </li> - <noscript> - <li id='time-correct' class='small'> - $BML::ML{'entryform.nojstime.note'} </li> - </noscript> + <li> + <noscript> + $BML::ML{'entryform.nojstime.note'} + </noscript> + </li> }; } - $$onload .= " defaultDate();"; - # User Picture if ($self->should_show_userpics) { my $pickw_select = LJ::html_select( @@ -1797,6 +1815,7 @@ } else { $$js .= 'usePlainText();'; } + $$js .= 'initEntryDate();'; my $ljphoto_enabled = $remote ? $remote->can_upload_photo() : 0; $$js .= "window.ljphotoEnabled = $ljphoto_enabled;"; $$js = $self->wrap_js($$js);