Changeset 189


Ignore:
Timestamp:
12/26/10 19:52:01 (13 years ago)
Author:
nanardon
Message:
  • add bot forms
Location:
server/trunk/web
Files:
1 added
5 edited

Legend:

Unmodified
Added
Removed
  • server/trunk/web/lib/Sophie/Controller/Chat.pm

    r156 r189  
    2727    my ( $self, $c ) = @_; 
    2828 
     29    $c->stash->{template} = 'chat/index.html'; 
     30    if (my $cmd = $c->req->param('cmd')) { 
     31        $c->forward('message', [ 
     32            [{ 
     33                distribution => $c->req->param('distribution') || undef, 
     34                release => $c->req->param('release') || undef, 
     35                arch => $c->req->param('arch') || undef, 
     36                max_line => 30, 
     37                no_paste => 1, 
     38            }], $cmd ]); 
     39    } 
    2940 
    3041} 
     
    4556    my @contexts = grep { $_ } ( 
    4657        $c->user_exists 
    47         ? ( 'default', 
    48             (ref $contexts 
    49                 ? (@$contexts) 
    50                 : ($contexts) 
    51             ), 
    52         ) 
    53         : () 
     58        ? ( 'default' ) 
     59        : (), 
     60        (ref $contexts 
     61            ? (@$contexts) 
     62            : ($contexts) 
     63        ), 
    5464    ); 
    5565 
    5666    foreach my $co (@contexts) { 
     67        warn $co; 
    5768        if (ref($co) eq 'HASH') { 
    5869            foreach (keys %$co) { 
     70                warn $_; 
    5971                $reqspec->{$_} = $co->{$_}; 
    6072            } 
  • server/trunk/web/lib/Sophie/Controller/Chat/Cmd.pm

    r170 r189  
    4343    }  
    4444 
    45     if ($needpaste) { 
     45    if ($needpaste && !$reqspec->{nopaste}) { 
    4646        my $id = $c->forward('/chat/paste', [ 'Bot paste', join("\n", @backup) ]); 
    4747        if ($id) { 
  • server/trunk/web/root/static/sophie.css

    r176 r189  
    197197} 
    198198 
     199div#sophie_bot_reply { 
     200    padding: 1em; 
     201    border: solid; 
     202} 
     203 
    199204.sophie_help h2 { 
    200205    font-size: 1.2em; 
  • server/trunk/web/root/templates/html/chat/index.html

    r145 r189  
    11<!-- $Id$ --> 
     2 
     3<div style="float: left; width: 35%"> 
     4    <form id="botform" action="[% c.uri_for('/chat') %]"> 
     5            <div id="distribselect"> 
     6            [% INCLUDE 'ajax/forms/distribselect.tt' %] 
     7            </div> 
     8            [% c.prototype.observe_form('botform', 
     9            { 
     10            url => c.uri_for('/ajax/forms/distribselect', { 
     11            'ajax' => 1 }), 
     12            frequency => 2, 
     13            update => 'distribselect', 
     14            } 
     15            ) %] 
     16        <input name="cmd" value="[% c.req.param('cmd') | html %]"> 
     17        <input type="submit"> 
     18    </form> 
     19</div> 
     20<div id="sophie_bot_help" style="float: left; width: 50%"> 
     21    <p>This page simulate the Bot behavior you may meet on IRC.</p> 
     22</div> 
     23 
     24<div id="sophie_bot_reply" style="clear: both"> 
     25    [% INCLUDE 'chat/index.tt' %] 
     26</div> 
  • server/trunk/web/root/templates/includes/header.tt

    r132 r189  
    2929        <li><a href="[% c.uri_for('/explorer') %]">Explorer</a></li> 
    3030        <li><a href="[% c.uri_for('/sources') %]">Source & Patches</a></li> 
     31        <li><a href="[% c.uri_for('/chat') %]">Chat</a></li> 
    3132        <li><a href="[% c.uri_for('/help') %]">Help</a></li> 
    3233        </ul> 
Note: See TracChangeset for help on using the changeset viewer.