Apache2-Translation
view release on metacpan or search on metacpan
lib/Apache2/Translation/Admin/my.css view on Meta::CPAN
margin: 0;
padding: 0;
}
div#menucontainer {
border: ridge #996 2px;
background-color: #eeb;
overflow: hidden;
text-align: right;
padding: 0 2pt;
cursor: pointer;
}
div#menu {
border-top: solid #996 1px;
padding-top: 2pt;
cursor: default;
}
div#menu ul {
list-style: none;
margin: 0;
padding: 0;
}
div#menu ul li a {
text-decoration: none;
lib/Apache2/Translation/Admin/resize.js view on Meta::CPAN
Element.makePositioned(this.options.resizeInsteadWidth); // fix IE
}
this.active = false;
this.resizing = false;
this.currentDirection = '';
this.eventMouseDown = this.startResize.bindAsEventListener(this);
this.eventMouseUp = this.endResize.bindAsEventListener(this);
this.eventMouseMove = this.update.bindAsEventListener(this);
this.eventCursorCheck = this.cursor.bindAsEventListener(this);
this.eventKeypress = this.keyPress.bindAsEventListener(this);
this.registerEvents();
},
destroy: function() {
Event.stopObserving(this.handle, "mousedown", this.eventMouseDown);
this.unregisterEvents();
},
registerEvents: function() {
Event.observe(document, "mouseup", this.eventMouseUp);
lib/Apache2/Translation/Admin/resize.js view on Meta::CPAN
}
if(style.visibility=="hidden") style.visibility = ""; // fix gecko rendering
},
between: function(val, low, high) {
return (val >= low && val < high);
},
directions: function(event) {
var pointer = [Event.pointerX(event), Event.pointerY(event)];
var offsets = Position.cumulativeOffset(this.element);
var cursor = '';
if (this.between(pointer[1] - offsets[1], 0, this.options.top)) cursor += 'n';
if (this.between((offsets[1] + this.element.offsetHeight) - pointer[1], 0, this.options.bottom)) cursor += 's';
if (this.between(pointer[0] - offsets[0], 0, this.options.left)) cursor += 'w';
if (this.between((offsets[0] + this.element.offsetWidth) - pointer[0], 0, this.options.right)) cursor += 'e';
return cursor;
},
cursor: function(event) {
var cursor = this.directions(event);
if (cursor.length > 0) {
cursor += '-resize';
} else {
cursor = '';
}
this.element.style.cursor = cursor;
},
update: function(event) {
if(this.active) {
if(!this.resizing) {
var style = this.element.style;
this.resizing = true;
if(Element.getStyle(this.element,'position')=='')
style.position = "relative";
lib/Apache2/Translation/BDB.pm view on Meta::CPAN
*start=\&connect;
sub stop {}
sub can_notes {1}
sub fetch {
my ($I, $key, $uri, $with_notes)=@_;
$key.="\t".$uri;
my (@l, $v, $c, $stat);
$c=$I->_db2->db_cursor;
if( $with_notes ) {
for( $stat=$c->c_get($key, $v, DB_SET);
$stat==0;
$stat=$c->c_get($key, $v, DB_NEXT_DUP) ) {
push @l, [@{decode($v)}[BLOCK,ORDER,ACTION,ID,NOTE]];
}
} else {
for( $stat=$c->c_get($key, $v, DB_SET);
$stat==0;
$stat=$c->c_get($key, $v, DB_NEXT_DUP) ) {
push @l, [@{decode($v)}[BLOCK,ORDER,ACTION,ID]];
}
}
return sort {$a->[BLOCK] <=> $b->[BLOCK] or $a->[ORDER] <=> $b->[ORDER]} @l;
}
sub list_keys {
my $I=$_[0];
my (%h, $k, $v, $c, $stat);
$c=$I->_db2->db_cursor;
for( $stat=$c->c_get($k, $v, DB_FIRST);
$stat==0;
$stat=$c->c_get($k, $v, DB_NEXT_NODUP) ) {
undef $h{(split /\t/, $k)[0]};
}
return map {[$_]} sort keys %h;
}
sub list_keys_and_uris {
my ($I,$key)=@_;
$key='' unless( defined $key );
my (@l, $k, $v, $c, $stat);
$c=$I->_db2->db_cursor;
for( $stat=$c->c_get($k, $v, DB_FIRST);
$stat==0;
$stat=$c->c_get($k, $v, DB_NEXT_NODUP) ) {
my @v=split /\t/, $k;
push @l, [@v] if( !length($key) or $key eq $v[0] );
}
return sort {$a->[0] cmp $b->[0] or $a->[1] cmp $b->[1]} @l;
}
lib/Apache2/Translation/BDB.pm view on Meta::CPAN
undef $I->_txn;
return $rc;
}
sub update {
my $I=shift;
my $old=shift;
my $new=shift;
my ($v, $c, $stat, $rc);
$c=$I->_db1->db_cursor;
if( ($rc=$c->c_get($old->[oID], $v, DB_SET))==0 ) {
my $el=decode($v);
if( $el->[BLOCK]==$old->[oBLOCK] and $el->[ORDER]==$old->[oORDER] ) {
@{$el}[BLOCK,ORDER,ACTION,KEY,URI,NOTE]=
@{$new}[nBLOCK,nORDER,nACTION,nKEY,nURI,nNOTE];
$rc=$c->c_put($old->[oID],
encode($el),
DB_CURRENT);
die "__RETRY__\n" if( $rc==DB_LOCK_DEADLOCK );
lib/Apache2/Translation/BDB.pm view on Meta::CPAN
die "__RETRY__\n" if( $rc==DB_LOCK_DEADLOCK );
}
return "0 but true";
}
sub insert {
my ($I, $new)=@_;
# fetch a new id
my ($k, $v, $c, $id, $rc);
$c=$I->extra_db->db_cursor;
if( ($rc=$c->c_get($k='id_seq', $v, DB_SET))==0 ) {
$rc=$c->c_put( $k, $id=$v+1, DB_CURRENT );
} else {
die "__RETRY__\n" if( $rc==DB_LOCK_DEADLOCK );
$rc=$I->extra_db->db_put( $k, $id=1 );
}
die "__RETRY__\n" if( $rc==DB_LOCK_DEADLOCK );
my $el=[];
@{$el}[BLOCK,ORDER,ACTION,KEY,URI,NOTE,ID]=
lib/Apache2/Translation/BDB.pm view on Meta::CPAN
$rc=$I->_db1->db_put( $id, encode($el) );
die "__RETRY__\n" if( $rc==DB_LOCK_DEADLOCK );
return $rc==0 ? 1 : 0;
}
sub delete {
my ($I, $old)=@_;
my ($v, $c, $stat, $rc);
$c=$I->_db1->db_cursor;
if( ($rc=$c->c_get($old->[oID], $v, DB_SET))==0 ) {
my $el=decode($v);
if( $el->[BLOCK]==$old->[oBLOCK] and $el->[ORDER]==$old->[oORDER] ) {
$rc=$c->c_del;
die "__RETRY__\n" if( $rc==DB_LOCK_DEADLOCK );
return $rc==0 ? 1 : 0;
}
} elsif( $rc==DB_LOCK_DEADLOCK ) {
die "__RETRY__\n";
}
return "0 but true";
}
sub clear {
my ($I)=@_;
my ($k, $v, $c, $stat, $count, $rc);
$count=0;
$c=$I->_db1->db_cursor;
while( ($rc=$c->c_get($k, $v, DB_NEXT))==0 ) {
$rc=$c->c_del;
die "__RETRY__\n" if( $rc==DB_LOCK_DEADLOCK );
$count+=($rc==0 ? 1 : 0);
}
die "__RETRY__\n" if( $rc==DB_LOCK_DEADLOCK );
die "__RETRY__\n" if( $I->extra_db->db_del("\ttmstmp")==DB_LOCK_DEADLOCK );
return $count;
}
sub iterator {
my $c=$_[0]->_db2->db_cursor;
my @blocklist;
return sub {
unless( @blocklist ) {
my ($key, $k, $v, $rc);
if( ($rc=$c->c_get($key, $v, DB_NEXT))==0 ) {
my $new=[];
@{$new}[nBLOCK,nORDER,nACTION,nKEY,nURI,nNOTE,nID]=
@{decode($v)}[BLOCK,ORDER,ACTION,KEY,URI,NOTE,ID];
push @blocklist, $new;
( run in 0.255 second using v1.01-cache-2.11-cpan-4d50c553e7e )