Alien-GvaScript

 view release on metacpan or  search on metacpan

Changes  view on Meta::CPAN

1.04    06.04.2007
  - bug fixes && refactoring some details in autocompleter
  - added option ANTIREGEX in KeyMap
  - added PAGE_UP/DOWN in choiceList and option scrollCount

1.03    01.04.2007
  - added options caseSensitive in autoCompleter
  - fixed bug in Builder.pm (dependendy on Pod:POM::View::HTML)

1.02    17.03.2007
  - bug fix, typo in examples/treeNavigator/frames/toc.html

1.01    09.03.2007
  - removed t/boilerplate.t, useless at this stage and failed on linux

1.00    08.03.2007
  - First public release

GvaScript_Builder.pm  view on Meta::CPAN

  my @sources = qw/protoExtensions event keyMap 
                   treeNavigator choiceList autoCompleter
                   customButtons paginator grid
                   repeat form/;
  my $dest = "lib/Alien/GvaScript/lib/GvaScript.js";
  chmod 0777, $dest;
  open my $dest_fh, ">$dest"  or die "open >$dest : $!";

  print $dest_fh <<__EOJS__;
/*-------------------------------------------------------------------------*
 * GvaScript - Javascript framework born in Geneva.
 *
 *  Authors: Laurent Dami            <laurent.d...\@etat.ge.ch>
 *           Mona Remlawi
 *           Jean-Christophe Durand
 *           Sebastien Cuendet

 *  LICENSE
 *  This library is free software, you can redistribute it and/or modify
 *  it under the same terms as Perl's artistic license.
 *

GvaScript_Builder.pm  view on Meta::CPAN

    function convertVersionString(versionString) {
      var v = versionString.replace(/_.*|\\./g, '');
      v = parseInt(v + '0'.times(4-v.length));
      return versionString.indexOf('_') > -1 ? v-1 : v;
    }
    if((typeof Prototype=='undefined') ||
       (typeof Element == 'undefined') ||
       (typeof Element.Methods=='undefined') ||
       (convertVersionString(Prototype.Version) <
        convertVersionString(GvaScript.REQUIRED_PROTOTYPE)))
       throw("GvaScript requires the Prototype JavaScript framework >= " +
        GvaScript.REQUIRED_PROTOTYPE);
  }
};

GvaScript.load();
__EOJS__

  foreach my $sourcefile (@sources) {
    open my $fh, "src/$sourcefile.js" or die $!;
    print $dest_fh "\n//----------$sourcefile.js\n", <$fh>;

META.json  view on Meta::CPAN

{
   "abstract" : "Gva extension to the prototype javascript framework",
   "author" : [
      "Laurent Dami <laurent.dami@justice.ge.ch>"
   ],
   "dynamic_config" : 1,
   "generated_by" : "Module::Build version 0.4224",
   "license" : [
      "perl_5"
   ],
   "meta-spec" : {
      "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec",

META.yml  view on Meta::CPAN

---
abstract: 'Gva extension to the prototype javascript framework'
author:
  - 'Laurent Dami <laurent.dami@justice.ge.ch>'
build_requires:
  Test::More: '0'
configure_requires:
  Module::Build: '0.42'
dynamic_config: 1
generated_by: 'Module::Build version 0.4224, CPAN::Meta::Converter version 2.150010'
license: perl
meta-spec:

README  view on Meta::CPAN

Alien-GvaScript
===============
Geneva extension to the prototype javascript framework

This distribution contains three core components :

  * protoExtensions> : some extensions to the prototype javascript 
    framework (mainly walking the DOM searching for collections of 
    classnames).

  * event : registering and firing application-specific events 
    (in addition to the standard W3C event model)

  * keyMap : managing maps of handlers for key events (similar
    in spirit to Emacs keymaps)

and three widgets:

doc/html/Intro.html  view on Meta::CPAN

        return Event.stopNone;
      }
    }
  </script>
</head>
<body>
<div id='TN_tree'>
  <div class="TN_node">
   <h1 class="TN_label">Alien::GvaScript::Intro</h1>
   <div class="TN_content">
     <p><em>A javascript framework born in Geneva.
</em></p>
     <div class="TN_node"  onPing="jumpto_href">
       <h3 class="TN_label">Table of contents</h3>
       <div class="TN_content">
         <div class="TN_leaf">
  <a class="TN_label" href="#NAME">NAME</a>
  <div class="TN_content"></div>
</div>
<div class="TN_leaf">
  <a class="TN_label" href="#SYNOPSIS">SYNOPSIS</a>

doc/html/Intro.html  view on Meta::CPAN

</div>

       </div>
     </div>
     <hr/>
   </div>
  </div>
  <div class="TN_node" id="NAME">
    <h2 class="TN_label">NAME</h2>
    <div class="TN_content">
      <p>Alien::GvaScript::Intro - A javascript framework born in Geneva.</p>

    </div>
  </div>
  <div class="TN_node" id="SYNOPSIS">
    <h2 class="TN_label">SYNOPSIS</h2>
    <div class="TN_content">
      <pre>  &lt;head&gt;
    &lt;script src="path/to/prototype.js"&gt;&lt;/script&gt;
    &lt;script src="path/to/GvaScript.js"&gt;&lt;/script&gt;
    &lt;link href="path/to/GvaScript.css" rel="stylesheet" type="text/css"&gt;

doc/html/Intro.html  view on Meta::CPAN

    var ac = GvaScript.AutoCompleter(datasource, options);
    var tn = GvaScript.TreeNavigator(element, options);
  &lt;/head&gt;</pre>


    </div>
  </div>
  <div class="TN_node" id="DESCRIPTION">
    <h2 class="TN_label">DESCRIPTION</h2>
    <div class="TN_content">
      <p>GvaScript (pronounce "gee-vascript") is a javascript framework 
born in Geneva, Switzerland (<code>GVA</code> is the IATA code for 
Geneva Cointrin International Airport). 
It is built on top of the <b>prototype</b>
object-oriented javascript framework (<a href="http://prototype.conio.net">http://prototype.conio.net</a>).</p>
<p>It contains four core components :</p>
<ul>
<li>
<p><i>Alien::GvaScript::ProtoExtensions</i> : 
some extensions to the prototype javascript framework
(mainly walking the DOM searching for collections of classnames).</p>
</li>
<li>
<p><i>Alien::GvaScript::Event</i> : 
registering and firing application-specific events (in addition
to the standard W3C event model)</p>
</li>
<li>
<p><i>Alien::GvaScript::KeyMap</i> : 
managing maps of handlers for key events (similar

doc/html/Intro.html  view on Meta::CPAN

</li>
</ul>

    </div>
  </div>
  <div class="TN_node" id="DEPENDENCIES">
    <h2 class="TN_label">DEPENDENCIES</h2>
    <div class="TN_content">
      <ul>
<li>
<p>the <a href="http://prototype.conio.net">http://prototype.conio.net</a> javascript framework,
version 1.5.0 or higher</p>
</li>
</ul>

    </div>
  </div>
  <div class="TN_node" id="AUTHORS">
    <h2 class="TN_label">AUTHORS</h2>
    <div class="TN_content">
      <p>Laurent Dami,  <code>&lt;laurent.d...@etat.ge.ch&gt;</code></p>

doc/index.html  view on Meta::CPAN

<html>
  <head>
    <title>The GvaScript framework</title>
  </head>

  <frameset cols="25%, 75%">
    <frame name="tocFrame" src="html/toc.html"></frame>
    <frame name="contentFrame" src="html/Intro.html"></frame>
  </frameset>
</html>

lib/Alien/GvaScript.pm  view on Meta::CPAN

}

1;

__END__

=encoding ISO8859-1

=head1 NAME

Alien::GvaScript - Gva extension to the prototype javascript framework

=head1 SYNOPSIS

  use Alien::GvaScript;
  ...
  $path    = Alien::GvaScript->path();
  ...
  Alien::GvaScript->install( $my_destination_directory );

=head1 DESCRIPTION

GvaScript (pronounce "gee-vascript") is a javascript framework 
born in Geneva, Switzerland (C<GVA> is the IATA code for 
Geneva Cointrin International Airport). 

It is built on top of the B<prototype>
object-oriented javascript framework (L<http://www.prototypejs.org>)
and offers a number of extensions and widgets, such as 
keymap handling, application-specific events, 
autocompletion on input field, tree navigation, and
forms with autofocus and repeated sections.
These functionalities are described in separate
documentation pages (see L<Alien::GvaScript::Intro>).

GvaScript is distributed using Perl tools, but the actual
content of the library is pure javascript; hence its 
location in the Alien namespace (see the L<Alien> manifesto).

GvaScript runtime library does not need Perl; you can integrate
it in any other Web programming framework. Perl is only needed for
developers who want to modify GvaScript sources and recreate a 
distribution package.



=head1 INSTALLATION

=head2 With usual Perl CPAN tools

Install C<Alien::GvaScript> just as any other CPAN module. Then you can 

lib/Alien/GvaScript/Intro.pod  view on Meta::CPAN

=encoding ISO8859-1

=head1 NAME

Alien::GvaScript::Intro - A javascript framework born in Geneva.

=head1 SYNOPSIS

  <head>
    <script src="path/to/prototype.js"></script>
    <script src="path/to/GvaScript.js"></script>
    <link href="path/to/GvaScript.css" rel="stylesheet" type="text/css">
  
    var cl = GvaScript.ChoiceList(choices, options);
    var ac = GvaScript.AutoCompleter(datasource, options);
    var tn = GvaScript.TreeNavigator(element, options);
  </head>


=head1 DESCRIPTION

GvaScript (pronounce "gee-vascript") is a javascript framework 
born in Geneva, Switzerland (C<GVA> is the IATA code for 
Geneva Cointrin International Airport). 
It is built on top of the B<prototype>
object-oriented javascript framework (L<http://prototype.conio.net>).

It contains four core components :

=over

=item * 

L<Alien::GvaScript::ProtoExtensions> : 
some extensions to the prototype javascript framework
(mainly walking the DOM searching for collections of classnames).

=item * 

L<Alien::GvaScript::Event> : 
registering and firing application-specific events (in addition
to the standard W3C event model)

=item *

lib/Alien/GvaScript/Intro.pod  view on Meta::CPAN


=back

=head1 DEPENDENCIES


=over

=item * 

the L<http://prototype.conio.net> javascript framework,
version 1.5.0 or higher

=back

=head1 AUTHORS

Laurent Dami,  C<< <laurent.d...@etat.ge.ch> >>

Mona Remlawi,  C<< <mona.r...@etat.ge.ch> >>

lib/Alien/GvaScript/lib/GvaScript.js  view on Meta::CPAN

/*-------------------------------------------------------------------------*
 * GvaScript - Javascript framework born in Geneva.
 *
 *  Authors: Laurent Dami            <laurent.d...@etat.ge.ch>
 *           Mona Remlawi
 *           Jean-Christophe Durand
 *           Sebastien Cuendet

 *  LICENSE
 *  This library is free software, you can redistribute it and/or modify
 *  it under the same terms as Perl's artistic license.
 *

lib/Alien/GvaScript/lib/GvaScript.js  view on Meta::CPAN

    function convertVersionString(versionString) {
      var v = versionString.replace(/_.*|\./g, '');
      v = parseInt(v + '0'.times(4-v.length));
      return versionString.indexOf('_') > -1 ? v-1 : v;
    }
    if((typeof Prototype=='undefined') ||
       (typeof Element == 'undefined') ||
       (typeof Element.Methods=='undefined') ||
       (convertVersionString(Prototype.Version) <
        convertVersionString(GvaScript.REQUIRED_PROTOTYPE)))
       throw("GvaScript requires the Prototype JavaScript framework >= " +
        GvaScript.REQUIRED_PROTOTYPE);
  }
};

GvaScript.load();

//----------protoExtensions.js
//-----------------------------------------------------
// Some extensions to the prototype javascript framework
//-----------------------------------------------------

// fire value:change event when setValue method
// is used to change the value of a Form Element
Form.Element.Methods.setValue = Form.Element.Methods.setValue.wrap(
    function($p, element, value) {
        var oldvalue = $F(element);
        var _return = $p(element, value);
        element.fire('value:change', {oldvalue: oldvalue, newvalue: value});
        return _return;

lib/Alien/GvaScript/lib/GvaScript.js  view on Meta::CPAN

        if(this.hasNext()) {
            this.forward.removeClassName('inactive');
            this.last.removeClassName('inactive');
        }
        else {
            this.forward.addClassName('inactive');
            this.last.addClassName('inactive');
        }
        this.links_container.show();
    }
    /* Create pagination controls and append them to the placeholder 'PG:frame' */
    function _addPaginationElts() {
        // append the pagination buttons
        this.links_container.insert(pagination_buttons);

        this.first    = this.links_container.down('.first');
        this.last     = this.links_container.down('.last');
        this.forward  = this.links_container.down('.forward');
        this.back     = this.links_container.down('.back');
        this.textElem = this.links_container.down('.text');

lib/Alien/GvaScript/lib/prototype.js  view on Meta::CPAN

/*  Prototype JavaScript framework, version 1.7
 *  (c) 2005-2010 Sam Stephenson
 *
 *  Prototype is freely distributable under the terms of an MIT-style license.
 *  For details, see the Prototype web site: http://www.prototypejs.org/
 *
 *--------------------------------------------------------------------------*/

var Prototype = {

  Version: '1.7',

lib/Alien/GvaScript/lib/prototype.js  view on Meta::CPAN


      style: function(element, value) {
        element.style.cssText = value ? value : '';
      }
    }
  };

  Element._attributeTranslations.has = {};

  $w('colSpan rowSpan vAlign dateTime accessKey tabIndex ' +
      'encType maxLength readOnly longDesc frameBorder').each(function(attr) {
    Element._attributeTranslations.write.names[attr.toLowerCase()] = attr;
    Element._attributeTranslations.has[attr.toLowerCase()] = attr;
  });

  (function(v) {
    Object.extend(v, {
      href:        v._getAttr2,
      src:         v._getAttr2,
      type:        v._getAttr,
      action:      v._getAttrNode,

lib/Alien/GvaScript/lib/unittest.js  view on Meta::CPAN

    if(!test.isWaiting) {
      this.logger.start(test.name);
    }
    test.run();
    if(test.isWaiting) {
      this.logger.message("Waiting for " + test.timeToWait + "ms");
      setTimeout(this.runTests.bind(this), test.timeToWait || 1000);
    } else {
      this.logger.finish(test.status(), test.summary());
      this.currentTest++;
      // tail recursive, hopefully the browser will skip the stackframe
      this.runTests();
    }
  },
  summary: function() {
    var assertions = 0;
    var failures = 0;
    var errors = 0;
    var messages = [];
    for(var i=0;i<this.tests.length;i++) {
      assertions +=   this.tests[i].assertions;

src/paginator.js  view on Meta::CPAN

        if(this.hasNext()) {
            this.forward.removeClassName('inactive');
            this.last.removeClassName('inactive');
        }
        else {
            this.forward.addClassName('inactive');
            this.last.addClassName('inactive');
        }
        this.links_container.show();
    }
    /* Create pagination controls and append them to the placeholder 'PG:frame' */
    function _addPaginationElts() {
        // append the pagination buttons
        this.links_container.insert(pagination_buttons);

        this.first    = this.links_container.down('.first');
        this.last     = this.links_container.down('.last');
        this.forward  = this.links_container.down('.forward');
        this.back     = this.links_container.down('.back');
        this.textElem = this.links_container.down('.text');

src/protoExtensions.js  view on Meta::CPAN

//-----------------------------------------------------
// Some extensions to the prototype javascript framework
//-----------------------------------------------------

// fire value:change event when setValue method
// is used to change the value of a Form Element
Form.Element.Methods.setValue = Form.Element.Methods.setValue.wrap(
    function($p, element, value) {
        var oldvalue = $F(element);
        var _return = $p(element, value);
        element.fire('value:change', {oldvalue: oldvalue, newvalue: value});
        return _return;

test/functional/form/effects.js  view on Meta::CPAN

    if (timePos >= this.startOn) {
      if (timePos >= this.finishOn) {
        this.render(1.0);
        this.cancel();
        this.event('beforeFinish');
        if (this.finish) this.finish(); 
        this.event('afterFinish');
        return;  
      }
      var pos   = (timePos - this.startOn) / this.totalTime,
          frame = (pos * this.totalFrames).round();
      if (frame > this.currentFrame) {
        this.render(pos);
        this.currentFrame = frame;
      }
    }
  },
  cancel: function() {
    if (!this.options.sync)
      Effect.Queues.get(Object.isString(this.options.queue) ? 
        'global' : this.options.queue.scope).remove(this);
    this.state = 'finished';
  },
  event: function(eventName) {

test/functional/index.html  view on Meta::CPAN

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" 
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
  <head>
    <meta http-equiv="Content-type" content="text/html; charset=iso-8859-1" />
    <title>GvaScript Examples</title>
  </head>

  <frameset cols="250,*">
    <frame name="controls" src="toc.html" />
    <frame name="example" />
  </frameset>

  <noframes>
    <body>
      Heya, 1995!
    </body>
  </noframes>

</html>

test/unit/index.html  view on Meta::CPAN

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" 
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
  <head>
    <meta http-equiv="Content-type" content="text/html; charset=iso-8859-1" />
    <title>GvaScript Unit Test Runner</title>
  </head>

  <frameset cols="250,*">
    <frame name="controls" src="toc.html" />
    <frame name="test" />
  </frameset>

  <noframes>
    <body>
      Heya, 1995!
    </body>
  </noframes>

</html>

test/unittest.js  view on Meta::CPAN

    if(!test.isWaiting) {
      this.logger.start(test.name);
    }
    test.run();
    if(test.isWaiting) {
      this.logger.message("Waiting for " + test.timeToWait + "ms");
      setTimeout(this.runTests.bind(this), test.timeToWait || 1000);
    } else {
      this.logger.finish(test.status(), test.summary());
      this.currentTest++;
      // tail recursive, hopefully the browser will skip the stackframe
      this.runTests();
    }
  },
  summary: function() {
    var assertions = 0;
    var failures = 0;
    var errors = 0;
    var messages = [];
    for(var i=0;i<this.tests.length;i++) {
      assertions +=   this.tests[i].assertions;



( run in 1.004 second using v1.01-cache-2.11-cpan-df04353d9ac )