web/client_new.php
changeset 506 f7fd2458fc5c
parent 485 38ac6cb87be7
equal deleted inserted replaced
505:b90c2bd832dd 506:f7fd2458fc5c
    56             });
    56             });
    57             $("#IDENTIFIER").click(function() {
    57             $("#IDENTIFIER").click(function() {
    58                 document.location.href="<?php echo(URL_ROOT.$rep); ?>/client.php?CONNECT=true";
    58                 document.location.href="<?php echo(URL_ROOT.$rep); ?>/client.php?CONNECT=true";
    59             });
    59             });
    60             
    60             
       
    61             function updateCounter() {
       
    62                 var _v = $("#status").val();
       
    63                 if (_v.length > 140) {
       
    64                     _v = _v.substr(0,140);
       
    65                     $("#status").val(_v);
       
    66                 }
       
    67                 $('#tweetCounter').html(140-_v.length);
       
    68                 if(140-_v.length < 0) {
       
    69                     $('#tweetCounter').addClass("tweetCounterNegative");
       
    70                 }
       
    71                 else {
       
    72                     $('#tweetCounter').removeClass("tweetCounterNegative");
       
    73                 }
       
    74                 $(".tweetButton").each(function(_i, _e) {
       
    75                     if (_v.search($(_e).find('span.twbSyntax').text().replace(/(\W)/g, '\\$1')) > -1) {
       
    76                         $(_e).addClass('selected');
       
    77                     } else {
       
    78                         $(_e).removeClass('selected');
       
    79                     }
       
    80                 });
       
    81             }
       
    82             
    61             // BUTTONS
    83             // BUTTONS
    62             $(".tweetButton").click(function() {
    84             $(".tweetButton").click(function() {
    63                 add_grammar($(this).text());
    85                 add_grammar($(this).find('span.twbSyntax').text());
       
    86                 updateCounter();
    64             })
    87             })
    65             
    88             
    66             // SEND TWEETS
    89             // SEND TWEETS
    67             $("#sendTweet").click(function(){
    90             $("#sendTweet").click(function(){
    68                 var MyStatus = $('#status').val();
    91                 var MyStatus = $('#status').val();
    81                     }
   104                     }
    82                     
   105                     
    83                 });
   106                 });
    84                 
   107                 
    85             });
   108             });
    86 
   109             
    87             $("#status").bind("change keyup paste blur focus",function() {
   110 
    88                 newval = 140-$("#status").val().length;
   111             $("#status").bind("change keyup paste blur focus",updateCounter);
    89                 $('#tweetCounter').val(newval);
       
    90                 if(newval < 0) {
       
    91                     $('#tweetCounter').addClass("tweetCounterNegative");
       
    92                 }
       
    93                 else {
       
    94                     $('#tweetCounter').removeClass("tweetCounterNegative");
       
    95                 }
       
    96             });
       
    97             
   112             
    98             
   113             
    99             $("#Program").fancybox({
   114             $("#Program").fancybox({
   100                 'width'             : '75%',
   115                 'width'             : '75%',
   101                 'height'            : '75%',
   116                 'height'            : '75%',
   121             
   136             
   122 
   137 
   123         });
   138         });
   124 
   139 
   125         //<!-- LIMIT TEXTAREA:
   140         //<!-- LIMIT TEXTAREA:
   126         function imposemax(obj) {
       
   127             obj.value = obj.value.substr(0,140);
       
   128         };
       
   129         // End -->
   141         // End -->
   130 
   142 
   131     </script>
   143     </script>
   132     
   144     
   133     <script type="text/javascript">
   145     <script type="text/javascript">
   286                         </li>
   298                         </li>
   287                     </ul>
   299                     </ul>
   288                 </div>
   300                 </div>
   289                 <div id="twwWrap">
   301                 <div id="twwWrap">
   290                     <div id="tweetWriter">
   302                     <div id="tweetWriter">
       
   303                             <?php if (isset($_SESSION['TWITTER_ACCESS_TOKEN'])): ?>
       
   304                             <div id="tweetCounter"><?php echo(140-strlen($config['hashtag']));?></div>
       
   305                             <?php endif;?>
   291                         <h3 class="tweetWriterTitle"><?php print $translate->_("ClientTitle1 :"); ?></h3>
   306                         <h3 class="tweetWriterTitle"><?php print $translate->_("ClientTitle1 :"); ?></h3>
   292                         <form  action="tweet.php" method="post" id="statusform" >
   307                         <form  action="tweet.php" method="post" id="statusform" >
   293                             <?php if (!isset($_SESSION['TWITTER_ACCESS_TOKEN'])){
   308                             <?php if (!isset($_SESSION['TWITTER_ACCESS_TOKEN'])){
   294                                 echo("<div class='loginbutton'><a href='".URL_ROOT."$rep/client.php?CONNECT=true' class='loginlink'>".$translate->_("Vous n'êtes pas connecté.")."</a></div>");
   309                                 echo("<div class='loginbutton'><a href='".URL_ROOT."$rep/client.php?CONNECT=true' class='loginlink'>".$translate->_("Vous n'êtes pas connecté.")."</a></div>");
   295                             } else {
   310                             } else {
   296                                 echo("<textarea name='status' id='status' rows='3' cols='50' onkeypress='imposemax(this);'>$config[hashtag]</textarea>");
   311                                 echo("<textarea name='status' id='status' rows='3' cols='50'>$config[hashtag]</textarea>");
   297                             }
   312                             }
   298                             ?>
   313                             ?>
   299                             <div id="messageSuccess" style="background-color:lightgreen; display: none;">
   314                             <div id="messageSuccess" style="background-color:lightgreen; display: none;">
   300                                 <?php print $translate->_("Envoyé"); ?><br/><br/>
   315                                 <?php print $translate->_("Envoyé"); ?><br/><br/>
   301                             </div>
   316                             </div>
   303                                 <?php print $translate->_("Erreur1"); ?><div id="error">&nbsp;</div><br/><br/>
   318                                 <?php print $translate->_("Erreur1"); ?><div id="error">&nbsp;</div><br/><br/>
   304                             </div>
   319                             </div>
   305                             <a href="#"  id="sendTweet" >
   320                             <a href="#"  id="sendTweet" >
   306                                 <span><?php print $translate->_("Envoyer"); ?></span>
   321                                 <span><?php print $translate->_("Envoyer"); ?></span>
   307                             </a>
   322                             </a>
   308                             <?php if (isset($_SESSION['TWITTER_ACCESS_TOKEN'])): ?>
   323                             <a id="positive" title="++ | <?php echo $translate->_('Agree'); ?>" class="tweetButton twbGreen">
   309                             <input id="tweetCounter" value="<?php echo(140-strlen($config['hashtag']));?>" disabled="disabled" size="3"/>
   324                                 <span class="twbSyntax">++</span>
   310                             <?php endif;?>
   325                                 <span class="twbSeparator">|</span>
   311                             <a id="positive" title="<?php echo $translate->_('Agree'); ?>" class="tweetButton">++</a>
   326                                 <span class="twbLabel"><?php echo $translate->_('Agree'); ?></span>
   312                             <a id="negative" title="<?php echo $translate->_('Disagree'); ?>" class="tweetButton">--</a>
   327                             </a>
   313                             <a id="reference" title="<?php echo $translate->_('Reference'); ?>" class="tweetButton">==</a>
   328                             <a id="negative" title="-- | <?php echo $translate->_('Disagree'); ?>" class="tweetButton twbRed">
   314                             <a id="question" title="<?php echo $translate->_('Question'); ?>" class="tweetButton"> ??</a>
   329                                 <span class="twbSyntax">--</span>
       
   330                                 <span class="twbSeparator">|</span>
       
   331                                 <span class="twbLabel"><?php echo $translate->_('Disagree'); ?></span>
       
   332                             </a>
       
   333                             <a id="reference" title="== | <?php echo $translate->_('Reference'); ?>" class="tweetButton twbYellow">
       
   334                                 <span class="twbSyntax">==</span>
       
   335                                 <span class="twbSeparator">|</span>
       
   336                                 <span class="twbLabel"><?php echo $translate->_('Reference'); ?></span>
       
   337                             </a>
       
   338                             <a id="question" title="?? | <?php echo $translate->_('Question'); ?>" class="tweetButton twbBlue">
       
   339                                 <span class="twbSyntax">??</span>
       
   340                                 <span class="twbSeparator">|</span>
       
   341                                 <span class="twbLabel"><?php echo $translate->_('Question'); ?></span>
       
   342                             </a>
   315                             
   343                             
   316                             <div style="clear: both;"></div>
   344                             <div style="clear: both;"></div>
   317                         </form>
   345                         </form>
   318                     </div>
   346                     </div>
   319                 </div>
   347                 </div>