App-Alice
view release on metacpan or search on metacpan
share/templates/announcement.html
share/templates/avatargrid.html
share/templates/event.html
share/templates/help.html
share/templates/index_footer.html
share/templates/index_head.html
share/templates/login.html
share/templates/logs.html
share/templates/message.html
share/templates/new_server.html
share/templates/prefs.html
share/templates/range.html
share/templates/results.html
share/templates/select.html
share/templates/server_listitem.html
share/templates/servers.html
share/templates/tab.html
share/templates/window.html
share/templates/window_footer.html
share/templates/window_head.html
t/01-use.t
lib/App/Alice/HTTPD.pm view on Meta::CPAN
isa => 'App::Alice::Config',
lazy => 1,
default => sub {shift->app->config},
);
my $url_handlers = [
[ qr{^/$} => \&send_index ],
[ qr{^/say/?$} => \&handle_message ],
[ qr{^/stream/?$} => \&setup_stream ],
[ qr{^/config/?$} => \&send_config ],
[ qr{^/prefs/?$} => \&send_prefs ],
[ qr{^/serverconfig/?$} => \&server_config ],
[ qr{^/save/?$} => \&save_config ],
[ qr{^/tabs/?$} => \&tab_order ],
[ qr{^/login/?$} => \&login ],
[ qr{^/logout/?$} => \&logout ],
[ qr{^/logs/?$} => \&send_logs ],
[ qr{^/search/?$} => \&send_search ],
[ qr{^/range/?$} => \&send_range ],
[ qr{^/view/?$} => \&send_index ],
[ qr{^/get} => \&image_proxy ],
lib/App/Alice/HTTPD.pm view on Meta::CPAN
sub send_config {
my ($self, $req) = @_;
$self->app->log(info => "serving config");
my $output = $self->app->render('servers');
my $res = $req->new_response(200);
$res->body($output);
return $res->finalize;
}
sub send_prefs {
my ($self, $req) = @_;
$self->app->log(info => "serving prefs");
my $output = $self->app->render('prefs');
my $res = $req->new_response(200);
$res->body($output);
return $res->finalize;
}
sub server_config {
my ($self, $req) = @_;
$self->app->log(info => "serving blank server config");
my $name = $req->param('name');
share/static/alice.js view on Meta::CPAN
});
}
audio.play();
image.onclick = function() {
audio.pause();
this.src = '/static/image/play.png';
this.onclick = function () { Alice.playAudio(this, audio) };
};
},
prefs: {
addHighlight: function (alias) {
var channel = prompt("Enter a word to highlight.");
if (channel)
$('highlights').insert("<option value=\""+channel+"\">"+channel+"</option>");
return false;
},
removeHighlights: function (alias) {
$A($('highlights').options).each(function (option) {
if (option.selected) option.remove()});
return false;
},
remove: function() {
alice.windows().each(function(win) {
win.input.disabled = false;
});
$('prefs').remove();
},
submit: function(form) {
var options = {highlights: []};
["images", "avatars", "alerts"].each(function (pref) {
options[pref] = $(pref).checked ? "show" : "hide";
});
$A($("highlights").options).each(function(option) {
share/static/alice.js view on Meta::CPAN
["style", "timeformat"].each(function(pref) {
options[pref] = $(pref).value;
});
alice.options = options;
new Ajax.Request('/save', {
method: 'get',
parameters: options,
onSuccess: function(){Alice.prefs.remove()}
});
return false;
}
},
connections: {
disconnectServer: function (alias) {
$(alias + "_status").className = "disconnected";
$(alias + "_status").innerHTML = "disconnected";
share/static/alice.js view on Meta::CPAN
},
getConfig: function(callback) {
new Ajax.Request('/config', {
method: 'get',
onSuccess: callback
});
},
getPrefs: function(callback) {
new Ajax.Request('/prefs', {
method: 'get',
onSuccess: callback
});
},
getLog: function(callback) {
new Ajax.Request('/logs', {
method: 'get',
onSuccess: callback
});
share/templates/prefs.html view on Meta::CPAN
? my $app = shift;
<div id="prefs" class="config">
<form id="config_data" onsubmit="return Alice.prefs.submit(this)">
<div class="field" style="width:150px">
<input type="checkbox"<? if ($app->config->images eq "show") { ?> checked<? } ?> name="images" id="images" />
<label>Inline images?</label>
</div>
<div class="field clear" style="width:150px">
<input type="checkbox"<? if ($app->config->avatars eq "show") { ?> checked="checked"<? } ?> name="avatars" id="avatars" />
<label>Show avatars?</label>
</div>
share/templates/prefs.html view on Meta::CPAN
</div>
<div class="field clear" style="width:150px">
<label>Highlights</label>
<select name="highlights" multiple="multiple" id="highlights">
<? for my $highlight (@{$app->config->highlights}) { ?>
<option value="<?= $highlight ?>"><?= $highlight ?></option>
<? } ?>
</select>
<div class="controls">
<a href="#" onclick="return Alice.prefs.addHighlight()">Add</a>
<a href="#" onclick="return Alice.prefs.removeHighlights()">Remove</a>
</div>
</div>
<div class="buttons">
<button type="submit">Save</button>
<button onclick="Alice.prefs.remove(); return false;">Cancel</button>
</div>
</form>
</div>
( run in 0.612 second using v1.01-cache-2.11-cpan-0bb4e1dffa6 )