Андрей (andy) wrote in changelog,
Андрей
andy
changelog

[livejournal] r18556: LJSUP-7874 (SMS notification - new featu...

Committer: ailyin
LJSUP-7874 (SMS notification - new features)
U   trunk/htdocs/manage/profile/index.bml
U   trunk/htdocs/manage/profile/index.bml.text
Modified: trunk/htdocs/manage/profile/index.bml
===================================================================
--- trunk/htdocs/manage/profile/index.bml	2011-03-15 11:01:44 UTC (rev 18555)
+++ trunk/htdocs/manage/profile/index.bml	2011-03-15 11:06:17 UTC (rev 18556)
@@ -552,15 +552,42 @@
             }
 			$ret .= "</td></tr>\n";
 			
-            if( $ru_text_messaging && LJ::NotificationMethod::SMSru->configured_for_user($u) ){
+            if( $ru_text_messaging ){
                 my($start, $end) = split /-/, $u->prop( 'smsru_interval' );
-                $ret .= "<tr id=\"sms_time\"><td class='field_name'>$ML{'.fn.smsinterval'}</td><td>";
+
+                my $row_style = '';
+                unless ( LJ::NotificationMethod::SMSru->configured_for_user($u) ) {
+                    $row_style = 'display: none;';
+                }
+
+                $ret .= "<tr id=\"sms_time\" style=\"$row_style\"><td class='field_name'>$ML{'.fn.smsinterval'}</td><td>";
                 $ret .= BML::ml(".fn.smsinterval.info", { url => "$LJ::SITEROOT/manage/settings/?cat=notifications" }) . "<br />";
-         
-                $ret .= LJ::html_check({ 'type' => 'check', 'name' => 'sms_interval', 'id' => 'sms_interval',
-                    'selected' =>  defined $start });
-                $ret .= "<label for='sms_interval'>$ML{'.fn.smsinterval.limitrange'}</label><br/>";
-            
+
+                my $timezone = $u->prop('timezone');
+                my $selected = $timezone && ( defined $start );
+
+                $ret .= LJ::html_check({
+                    'type'      => 'check',
+                    'name'      => 'sms_interval',
+                    'id'        => 'sms_interval',
+                    'selected'  => $selected,
+                    'disabled'  => !$timezone,
+                });
+
+                my $label = LJ::Lang::ml('/manage/profile/index.bml.fn.smsinterval.limitrange');
+                unless ( $timezone ) {
+                    $label .= ' ' . LJ::Lang::ml('/manage/profile/index.bml.fn.smsinterval.limitrange.timezone_required');
+                }
+
+                $ret .= "<label for='sms_interval'>$label</label><br/>";
+
+                my $values_style;
+                unless ( $selected ) {
+                    $values_style = 'display: none;';
+                }
+
+                $ret .= qq{<div id="sms_interval_values" style="$values_style">};
+
                 my @sms_time = map {$_ =>  sprintf("%02d:00", $_)} (0 .. 23);
                 $ret .= "<label for='sms_interval_start'>$ML{'.fn.smsinterval.start'}</label>";
                 $ret .= LJ::html_select({ 'name' => 'sms_interval_start',
@@ -571,6 +598,9 @@
                                                   'selected' => $end || 1, },
                                                   @sms_time);
                 $ret .= BML::ml(".fn.smsinterval.localtime") . "<br />";
+
+                $ret .= '</div>';
+
     			$ret .= "</td></tr>\n";
             }
             

Modified: trunk/htdocs/manage/profile/index.bml.text
===================================================================
--- trunk/htdocs/manage/profile/index.bml.text	2011-03-15 11:01:44 UTC (rev 18555)
+++ trunk/htdocs/manage/profile/index.bml.text	2011-03-15 11:06:17 UTC (rev 18556)
@@ -175,6 +175,8 @@
 
 .fn.smsinterval.limitrange=Limit range
 
+.fn.smsinterval.limitrange.timezone_required=(disabled because you didn't specify time zone)
+
 .fn.smsinterval.start=Send from
 
 .fn.smsinterval.end=till

Tags: andy, bml, livejournal, text
Subscribe
  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

  • 0 comments