MDL-13501 Removing stats and visual reports from HEAD

This commit is contained in:
nicolasconnault 2009-04-02 12:51:14 +00:00
parent d030fa7b12
commit 4c2a920872
349 changed files with 0 additions and 39651 deletions

View File

@ -1,104 +0,0 @@
____ __ __ ____ __
/\ _`\ /\ \__ /\ \__ /\ _`\ /\ \__
\ \,\L\_\\ \ ,_\ __ \ \ ,_\ ____ \ \ \L\ \ __ _____ ___ _ __ \ \ ,_\
\/_\__ \ \ \ \/ /'__`\ \ \ \/ /',__\ \ \ , / /'__`\/\ '__`\ / __`\ /\`'__\\ \ \/
/\ \L\ \\ \ \_ /\ \L\.\_\ \ \_ /\__, `\ \ \ \\ \ /\ __/\ \ \L\ \/\ \L\ \\ \ \/ \ \ \_
\ `\____\\ \__\\ \__/.\_\\ \__\\/\____/ \ \_\ \_\\ \____\\ \ ,__/\ \____/ \ \_\ \ \__\
\/_____/ \/__/ \/__/\/_/ \/__/ \/___/ \/_/\/ / \/____/ \ \ \/ \/___/ \/_/ \/__/
\ \_\
\/_/
,+7$$Z$ZO=
:+$$Z$$ZOZZZOOOOOOOOD,:,,,
+Z$ZOOO8OO8OOOOOOOOO8+====~~:,
7$ZOOOOZOZOOOOOOOOOO8+++++=~:,
77$88OZ8MMDZZZOOOOOOOZ+?++==~:,
77Z$$Z8MM8OZOZZZZOOOO8ONDN+=~:,
I7$Z$NMOOOOOO$$$ZZOOOOOD8D8D8:,
II7$7MDZOOZZZZOZ$$ZZ$OOZNDNDDDD8DO ,IIII777I~
7?$$ZOMOOZZZ777MMMMMMMMMMMDNDN8DDDD$$7, =+++++???IIII7777$?
,,,:Z==++===7NMMMND8DDDMMD8DDDDD777777:?=~~~~==+++???II777$$$,
,:DM~~~~::,O8ND8OO8Z$$$$DDDDDD7IIIIII+~~~=?I77$$$$77IIII77$$Z+,
,8,,,, ONND$ZZ$$777DDDDNDO$77II??+++I7$ZZOOOOZZ$77IIII7$ZZZ:,
M,::, O$D888ZO$II77DDD88OZ$7IIIIIII7$ZOO8OOOOOZ$77III77$ZO=:
=M,,, ?+~~+I$$$ZI778D$I?+=$77IIIII7$ZOO++===~~~$$7IIII7$ZOO~:
OM,,, I?==?I7$O8D777?+=:,,:77I?III7ZOO++=~:,,,,:77I?II7$ZOO=~,
8MI::, I?=+II7$O8??+=~:, 77I?II7$ZOO+=~, ?7I??II$ZOO+~:
~M=~~, I?++II7ZOO+=~, II?+?I7$ZOO=~, ,II+?II7ZOO+~:
M::~: I?++II7ZOO+=:, II++?I7$ZOO=~, II++II7ZOO+~:
M,:~: I?++II7ZOO+=: II++?II$ZOO=~, I?++II7ZOO+=:
M=::, I?++II7ZOO+=: II++?II$ZOO=~, I?++II7ZOO+=:
MI::: I?++?I7ZOO+=: II++?II$ZOO=~, I?=+II7ZOO+=:
,M?:~: I?++?I7$OO+=: II+=?II$ZOO=~, I?=+II7ZOO+=:
=M=:~: I?++?I7$OO+=: II+=?II$ZOO=~, I?=+II7ZOO+=:
M,:~: I?++?I7$OO+=: II+=?II$ZOO=~, I?=+II7ZOO+~:
M,:~: I?++?I7$OO+=: II+=?II$ZOO=~, I?=+II7ZOO+~:
M,::, I?++?I7$OO+=: II+=?II$ZOO=~, I?=+II7ZOO+~:
,:, I?++?I7$OO+=: II+=?II$ZOO=~, I?=+II7ZOO+~:
, IIII77$ZOO+=: IIIII77$OOO=~, IIII77$ZOO+~:
77$$ZZZOOO+=: 77$$ZZZOOOO=~, 77$ZZZOOOO+~:
$ZOOOOOOOO+=: $$ZOOOOOOOO=~, $ZOOOOOOOO+=:
=== About Stats Report ===
The stats report gradebook plug-in was developed as part of a Google Summer of Code 2008
project The goal of the plug-in is to provide a framework for providing text based
statistics for grades in a course. Several statistics such as Highest, Lowest, Mean,
Median, Mode, Percent Pass and Standard Deviation are included and new statistics can be
easily dropped in by developers.
=== About Author ===
This plug-in was oringal created by a computer science student named Daniel Servos as part of
a Google Summer of Code 2008 project.
==== Contact Information ====
Name: Daniel Servos
E-mail: dservos@lakeheadu.ca
Blog: HackerDan.com
=== Copyright ===
Moodle - Modular Object-Oriented Dynamic Learning Environment
http://moodle.org
Copyright (C) 1999 onwards Martin Dougiamas http://moodle.com
This program is free software; you can redistribute it and/or modify it under the terms of the GNU
General Public License as published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details:
http://www.gnu.org/copyleft/gpl.html
=== Version / Release ===
This plug-in was developed for Moodle 2.0 dev.
This is the first real release of this plug-in and should be considered an beta version in that it
has not yet had a chance to be extensively tested by users in real life situations and may have
unknown bugs or issues.
Version: 1.0.0b
=== Development Information ===
==== Adding new Statistics ====
To add a new statistic to the plug-in extend the abstract class stats (grade/report/stats/statistics/stats.php) and place you class in a file name stat_yournamehere.php in grade/report/stats/statistics and it should be automatically loaded in to plug-in.
==== Specification ====
http://docs.moodle.org/en/Student_projects/Animated_grade_statistics_report
==== TO DO =====
* Back port to Moodle 1.9.x
* Add more statistics.
* Add more settings for the report.
* Improve look.
* Add help windows/html.
* Add report defaults page.
* Deal with outcomes better/at all.
* Add export functionality to different formats.
* Improve this readme file.
* Improve documentation.

View File

@ -1,49 +0,0 @@
<?php
///////////////////////////////////////////////////////////////////////////
// //
// NOTICE OF COPYRIGHT //
// //
// Moodle - Modular Object-Oriented Dynamic Learning Environment //
// http://moodle.org //
// //
// Copyright (C) 1999 onwards Martin Dougiamas http://moodle.com //
// //
// This program is free software; you can redistribute it and/or modify //
// it under the terms of the GNU General Public License as published by //
// the Free Software Foundation; either version 2 of the License, or //
// (at your option) any later version. //
// //
// This program is distributed in the hope that it will be useful, //
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
// GNU General Public License for more details: //
// //
// http://www.gnu.org/copyleft/gpl.html //
// //
///////////////////////////////////////////////////////////////////////////
/**
* Displays data from an array in the report/stats plugin.
* Array's data is encoded in the data param using the
* grade_report_stats::encode_array function.
* TODO: Improve look.
* @package gradebook
*/
require_once '../../../config.php';
// TODO: this file must be removed or completely rewritten before 2.0 get's released
$rawdata = required_param('data'); // TODO: we can not display ANYTHING on moodle pages like this!!!
$courseid = required_param('id', PARAM_INT);
$data = explode('"', stripslashes(base64_decode(strtr($rawdata, '-_,', '+/='))));
$context = get_context_instance(CONTEXT_COURSE, $courseid);
require_login($courseid);
require_capability('gradereport/stats:view', $context);
foreach($data as $stat) {
echo format_text($stat, FORMAT_HTML) . '<br/>';
}
?>

View File

@ -1,115 +0,0 @@
<?php
///////////////////////////////////////////////////////////////////////////
// //
// NOTICE OF COPYRIGHT //
// //
// Moodle - Modular Object-Oriented Dynamic Learning Environment //
// http://moodle.org //
// //
// Copyright (C) 1999 onwards Martin Dougiamas http://moodle.com //
// //
// This program is free software; you can redistribute it and/or modify //
// it under the terms of the GNU General Public License as published by //
// the Free Software Foundation; either version 2 of the License, or //
// (at your option) any later version. //
// //
// This program is distributed in the hope that it will be useful, //
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
// GNU General Public License for more details: //
// //
// http://www.gnu.org/copyleft/gpl.html //
// //
///////////////////////////////////////////////////////////////////////////
$gradereport_stats_capabilities = array(
'gradereport/stats:view' => array(
'riskbitmask' => RISK_PERSONAL,
'captype' => 'read',
'contextlevel' => CONTEXT_COURSE,
'legacy' => array(
'teacher' => CAP_ALLOW,
'editingteacher' => CAP_ALLOW,
'admin' => CAP_ALLOW
)
),
'gradereport/stats:stat:lowest' => array(
'riskbitmask' => RISK_PERSONAL,
'captype' => 'read',
'contextlevel' => CONTEXT_COURSE,
'legacy' => array(
'student' => CAP_ALLOW,
'teacher' => CAP_ALLOW,
'editingteacher' => CAP_ALLOW,
'admin' => CAP_ALLOW
)
),
'gradereport/stats:stat:highest' => array(
'riskbitmask' => RISK_PERSONAL,
'captype' => 'read',
'contextlevel' => CONTEXT_COURSE,
'legacy' => array(
'student' => CAP_ALLOW,
'teacher' => CAP_ALLOW,
'editingteacher' => CAP_ALLOW,
'admin' => CAP_ALLOW
)
),
'gradereport/stats:stat:passpercent' => array(
'riskbitmask' => RISK_PERSONAL,
'captype' => 'read',
'contextlevel' => CONTEXT_COURSE,
'legacy' => array(
'student' => CAP_ALLOW,
'teacher' => CAP_ALLOW,
'editingteacher' => CAP_ALLOW,
'admin' => CAP_ALLOW
)
),
'gradereport/stats:stat:standarddeviation' => array(
'riskbitmask' => RISK_PERSONAL,
'captype' => 'read',
'contextlevel' => CONTEXT_COURSE,
'legacy' => array(
'student' => CAP_ALLOW,
'teacher' => CAP_ALLOW,
'editingteacher' => CAP_ALLOW,
'admin' => CAP_ALLOW
)
),
'gradereport/stats:stat:mean' => array(
'riskbitmask' => RISK_PERSONAL,
'captype' => 'read',
'contextlevel' => CONTEXT_COURSE,
'legacy' => array(
'student' => CAP_ALLOW,
'teacher' => CAP_ALLOW,
'editingteacher' => CAP_ALLOW,
'admin' => CAP_ALLOW
)
),
'gradereport/stats:stat:median' => array(
'riskbitmask' => RISK_PERSONAL,
'captype' => 'read',
'contextlevel' => CONTEXT_COURSE,
'legacy' => array(
'student' => CAP_ALLOW,
'teacher' => CAP_ALLOW,
'editingteacher' => CAP_ALLOW,
'admin' => CAP_ALLOW
)
),
'gradereport/stats:stat:mode' => array(
'riskbitmask' => RISK_PERSONAL,
'captype' => 'read',
'contextlevel' => CONTEXT_COURSE,
'legacy' => array(
'student' => CAP_ALLOW,
'teacher' => CAP_ALLOW,
'editingteacher' => CAP_ALLOW,
'admin' => CAP_ALLOW
)
)
);
?>

View File

@ -1,92 +0,0 @@
<?php
///////////////////////////////////////////////////////////////////////////
// //
// NOTICE OF COPYRIGHT //
// //
// Moodle - Modular Object-Oriented Dynamic Learning Environment //
// http://moodle.org //
// //
// Copyright (C) 1999 onwards Martin Dougiamas http://moodle.com //
// //
// This program is free software; you can redistribute it and/or modify //
// it under the terms of the GNU General Public License as published by //
// the Free Software Foundation; either version 2 of the License, or //
// (at your option) any later version. //
// //
// This program is distributed in the hope that it will be useful, //
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
// GNU General Public License for more details: //
// //
// http://www.gnu.org/copyleft/gpl.html //
// //
///////////////////////////////////////////////////////////////////////////
/**
* Index page for the stats report plugin.
* Based on the grader report plugin but
* for text based statistics.
* @package gradebook
*/
require_once '../../../config.php';
require_once $CFG->libdir.'/gradelib.php';
require_once $CFG->dirroot.'/grade/lib.php';
require_once $CFG->dirroot.'/grade/report/stats/lib.php';
$courseid = required_param('id', PARAM_INT);
$toggle = optional_param('toggle', NULL, PARAM_INT);
$toggle_type = optional_param('toggle_type', 0, PARAM_ALPHANUM);
/// basic access checks
if (!$course = $DB->get_record('course', array('id' => $courseid))) {
print_error('nocourseid');
}
require_login($course);
$context = get_context_instance(CONTEXT_COURSE, $course->id);
require_capability('gradereport/stats:view', $context);
/// get tracking object
$gpr = new grade_plugin_return(array('type'=>'report', 'plugin'=>'stats', 'courseid'=>$courseid));
/// last selected report session tracking
if (!isset($USER->grade_last_report)) {
$USER->grade_last_report = array();
}
$USER->grade_last_report[$course->id] = 'stats';
/// Build navigation
$strgrades = get_string('grades');
$reportname = get_string('modulename', 'gradereport_stats');
$navigation = grade_build_nav(__FILE__, $reportname, $courseid);
/// Handle toggle change request
if (!is_null($toggle) && !empty($toggle_type)) {
set_user_preferences(array('grade_report_statsshow'.$toggle_type => $toggle));
}
grade_regrade_final_grades($courseid);
/// Get report object
$report = new grade_report_stats($courseid, $gpr, $context);
print_grade_page_head($courseid, 'report', 'stats', $reportname);
/// Build report to output
$report->load_users();
$report->harvest_data();
$report->report_data();
$report->adapt_data();
/// Print report
echo $report->group_selector;
echo '<div class="clearer"></div>';
echo $report->get_toggles_html();
echo '<div class="clearer"></div>';
echo $report->html;
/// Print footer
print_footer($course);
?>

View File

@ -1,80 +0,0 @@
<?php
///////////////////////////////////////////////////////////////////////////
// //
// NOTICE OF COPYRIGHT //
// //
// Moodle - Modular Object-Oriented Dynamic Learning Environment //
// http://moodle.org //
// //
// Copyright (C) 1999 onwards Martin Dougiamas http://moodle.com //
// //
// This program is free software; you can redistribute it and/or modify //
// it under the terms of the GNU General Public License as published by //
// the Free Software Foundation; either version 2 of the License, or //
// (at your option) any later version. //
// //
// This program is distributed in the hope that it will be useful, //
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
// GNU General Public License for more details: //
// //
// http://www.gnu.org/copyleft/gpl.html //
// //
///////////////////////////////////////////////////////////////////////////
$string['modulename'] = 'Stats report';
$string['stats:view'] = 'View course stats report';
$string['preferences'] = 'Stats report preferences';
$string['moredata']='Stats Report: More Data';
$string['range'] = 'Range';
$string['overall'] = 'Course total';
$string['num_grades'] = 'Grades';
$string['showranges'] = 'Show ranges';
$string['showgroups'] = 'Show groups';
$string['shownumgrades'] = 'Show number of grades';
$string['showinverted'] = 'Invert Table';
$string['hideranges'] = 'Hide ranges';
$string['hidegroups'] = 'Hide groups';
$string['hidenumgrades'] = 'Hide number of grades';
$string['hideinverted'] = 'Invert Table';
$string['statsshow'] = 'Show';
$string['statistic'] = 'Statistic';
$string['highest'] = 'Highest';
$string['lowest'] = 'Lowest';
$string['median'] = 'Median';
$string['average'] = 'Average';
$string['mean'] = 'Mean';
$string['mode'] = 'Mode';
$string['standarddeviation'] = 'Standard Deviation';
$string['pass_percent'] = 'Percent Pass';
$string['stats:stat:lowest'] ='Show Lowest Statistic';
$string['stats:stat:highest'] = 'Show Highest Statistic';
$string['stats:stat:passpercent'] = 'Show Percent Pass Statistic';
$string['stats:stat:standarddeviation'] = 'Show Standard Deviation Statistic';
$string['stats:stat:mean'] = 'Show Mean Statistic';
$string['stats:stat:median'] = 'Show Median Statistic';
$string['stats:stat:mode'] = 'Show Mode Statistic';
$string['prefgeneral'] = 'General';
$string['prefshow']= 'Show/hide toggles';
$string['prefcalc'] = 'Calculations';
$string['prefstats'] = 'Statistics';
$string['aggregationview'] = 'Aggregation view';
$string['aggregationposition'] = 'Aggregation position';
$string['showscaleitems'] = 'Show items using scale';
$string['showvalueitems'] = 'Show items using value';
$string['incompleasmin'] = 'Incomplete grades as min';
$string['usehidden'] = 'Count hidden grades';
$string['uselocked'] = 'Count locked grades';
$string['printable'] = 'Printer Friendly Version';
?>

View File

@ -1,559 +0,0 @@
<?php
///////////////////////////////////////////////////////////////////////////
// //
// NOTICE OF COPYRIGHT //
// //
// Moodle - Modular Object-Oriented Dynamic Learning Environment //
// http://moodle.org //
// //
// Copyright (C) 1999 onwards Martin Dougiamas http://moodle.com //
// //
// This program is free software; you can redistribute it and/or modify //
// it under the terms of the GNU General Public License as published by //
// the Free Software Foundation; either version 2 of the License, or //
// (at your option) any later version. //
// //
// This program is distributed in the hope that it will be useful, //
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
// GNU General Public License for more details: //
// //
// http://www.gnu.org/copyleft/gpl.html //
// //
///////////////////////////////////////////////////////////////////////////
/**
* File in which the grade_report_stats class is defined.
* @package gradebook
*/
require_once($CFG->dirroot . '/grade/report/lib.php');
require_once($CFG->libdir.'/tablelib.php');
foreach (glob($CFG->dirroot . '/grade/report/stats/statistics/stat_*.php') as $filename) {
require_once($filename);
}
/**
* Class providing the API for the stats report, including harvesters,
* reports, and adaptor methods for turing grades in to statistics.
* @uses grade_report
* @package gradebook
*/
class grade_report_stats extends grade_report {
/**
* Capability to view hidden items.
* @var bool $canviewhidden
*/
private $canviewhidden;
/**
* Grade objects of users in the course
* @var array $grades
*/
private $grades = array();
/**
* Array of users final grades affter filtered based on
* settings.
* @var array $finalgrades
*/
private $finalgrades = array();
/**
* The value returned from each statistic.
* @var array $reportedstats
*/
private $reportedstats = array();
/**
* The html of the report to output.
* @var string $html
*/
public $html;
/**
* The table class used to make the html of the report.
* @var object $table
*/
private $table;
/**
* Array of clases that extend stats witch have the logic to
* generate the statstics.
* @var array $stats
*/
private static $stats = array();
/**
* Constructor. Initialises grade_tree, sets up group, baseurl
* and pbarurl.
* @param int $courseid the coures id for the report
* @param object $gpr grade plugin tracking object
* @context string $context
*/
public function __construct($courseid, $gpr, $context) {
global $CFG;
parent::__construct($courseid, $gpr, $context, null);
$this->canviewhidden = has_capability('moodle/grade:viewhidden', get_context_instance(CONTEXT_COURSE, $this->course->id));
/// Set up urls
$this->baseurl = 'index.php?id=' . $this->courseid;
$this->pbarurl = 'index.php?id=' . $this->courseid;
/// Set the position of the aggregation categorie based on pref
$switch = $this->get_pref('statsaggregationposition');
if ($switch == '' && isset($CFG->grade_aggregationposition)) {
$switch = grade_get_setting($this->courseid, 'aggregationposition', $CFG->grade_aggregationposition);
}
/// Build grade tree
$this->gtree = new grade_tree($this->courseid, false, $switch);
$this->course->groupmode = 2;
/// Set up Groups
if ($this->get_pref('statsshowgroups') || is_null($this->get_pref('statsshowgroups'))) {
$this->setup_groups();
}
/// Load stats classes from ./statistics
$this->load_stats();
}
/**
* Load all the stats classes into $stats.
* Looks in /statistics and trys to make an instence of any
* class that is in a file that starts with stats_ and extends
* stats directly.
* @param bool $return if true return stats array, else store in $this->stats
* @returns array array of clases that extend stats
*/
private function load_stats($return=false) {
global $CFG;
$stats = array();
foreach (glob($CFG->dirroot . '/grade/report/stats/statistics/stat_*.php') as $path) {
$filename = substr(basename($path, '.php'), 5);
if(class_exists($filename) && get_parent_class($class = new $filename) == 'stats' ) {
$stats[$filename] = $class;
}
}
if($return) {
return $stats;
} else {
grade_report_stats::$stats = $stats;
}
}
/**
* Returns the current stats being used in the report or if no stats are
* set, it returns the stats as whould be loaded by load_stats.
* @returns array array of classes that extend stats
*/
public function get_stats() {
if(!isset(grade_report_stats::$stats) || is_null(grade_report_stats::$stats) || empty(grade_report_stats::$stats)) {
return grade_report_stats::load_stats(true);
} else {
return grade_report_stats::$stats;
}
}
/// Added to keep grade_report happy
public function process_data($data){}
public function process_action($target, $action){}
/**
* Based on load user function from grader report.
* Pulls out the userids of the users to be used in the stats.
* @return array array of user ids to use in stats
*/
public function load_users() {
global $CFG, $DB;
$params = array();
list($usql, $gbr_params) = $DB->get_in_or_equal(explode(',', $this->gradebookroles), SQL_PARAMS_NAMED);
$sql = "SELECT u.id
FROM {user} u
JOIN {role_assignments} ra ON u.id = ra.userid
$this->groupsql
WHERE ra.roleid $usql
$this->groupwheresql
AND ra.contextid ".get_related_contexts_string($this->context);
$params = array_merge($gbr_params, $this->groupwheresql_params);
$this->users = $DB->get_records_sql($sql, $params);
if (empty($this->users)) {
$this->userselect = '';
$this->users = array();
$this->userselect_params = array();
} else {
list($usql, $params) = $DB->get_in_or_equal(array_keys($this->users));
$this->userselect = "AND g.userid $usql";
$this->userselect_params = $params;
}
return $this->users;
}
/**
* Encode an array of stat's data in to a stirng so it can
* be put in the get part of a url.
* @param arrray $array array of data to encode
* @param object $item grade_item to use to fromat stats
* @param object $stat stats object to use to format stats
* @return string encoded string
*/
private function encode_array(array $array, $item, $stat) {
$string = '';
/// Encode each elment by puting a delimiter and base64 encoding it.
foreach($array as $id=>$data) {
$string .= addslashes(grade_format_gradevalue($data, $item, true, $stat->displaytype, $stat->decimals)) . '"';
}
return strtr(base64_encode($string), '+/=', '-_,');
}
/**
* Harvest the grades from the data base and build the finalgrades array.
* Filters out hidden, locked and null grades based on users settings.
* Partly based on grader reports load_final_grades function.
*/
public function harvest_data() {
global $CFG, $DB;
$params = array();
$params = array_merge(array($this->courseid), $this->userselect_params);
/// please note that we must fetch all grade_grades fields if we want to contruct grade_grade object from it!
$sql = "SELECT g.*
FROM {grade_items} gi,
{grade_grades} g
WHERE g.itemid = gi.id AND gi.courseid = ? {$this->userselect}";
$grades = $DB->get_records_sql($sql, $params);
$userids = array_keys($this->users);
if ($grades) {
foreach ($grades as $graderec) {
if (in_array($graderec->userid, $userids) and array_key_exists($graderec->itemid, $this->gtree->items)) { // some items may not be present!!
$this->grades[$graderec->itemid][$graderec->userid] = new grade_grade($graderec, false);
$this->grades[$graderec->itemid][$graderec->userid]->grade_item =& $this->gtree->items[$graderec->itemid]; // db caching
}
}
}
/// prefil grades that do not exist yet
foreach ($userids as $userid) {
foreach ($this->gtree->items as $itemid=>$unused) {
if (!isset($this->grades[$itemid][$userid])) {
$this->grades[$itemid][$userid] = new grade_grade();
$this->grades[$itemid][$userid]->itemid = $itemid;
$this->grades[$itemid][$userid]->userid = $userid;
$this->grades[$itemid][$userid]->grade_item =& $this->gtree->items[$itemid]; // db caching
}
}
}
$this->finalgrades = array();
/// Build finalgrades array and filliter out unwanted grades.
foreach ($this->gtree->items as $id=>$item) {
if(($item->gradetype == GRADE_TYPE_SCALE && ($this->get_pref('statsshowscaleitems') || is_null($this->get_pref('statsshowscaleitems'))))
|| ($item->gradetype == GRADE_TYPE_VALUE && ($this->get_pref('statsshowvalueitems') || is_null($this->get_pref('statsshowvalueitems'))))) {
$this->finalgrades[$id] = array();
$i = 0;
if(isset($this->grades[$id]) && !is_null($this->grades[$id])) {
foreach ($this->grades[$id] as $grade) {
if( (($grade->is_hidden() && $this->canviewhidden && ($this->get_pref('statsusehidden') || is_null($this->get_pref('statsusehidden')))) || !$grade->is_hidden())
&& (($grade->is_locked() && ($this->get_pref('statsuselocked') || is_null($this->get_pref('statsuselocked')))) || !$grade->is_locked())) {
if($this->get_pref('statsincompleasmin') && is_null($grade->finalgrade)) {
$this->finalgrades[$id][$i] = $item->grademin;
$i++;
} elseif(!is_null($grade->finalgrade)) {
$this->finalgrades[$id][$i] = $grade->finalgrade;
$i++;
}
}
}
}
}
}
}
/**
* Runs grades for each item threw the report functions
* of each stats class in $stats and stores the values in
* reportedstats.
*/
public function report_data() {
$this->reportedstats = array();
foreach(grade_report_stats::$stats as $name=>$stat) {
if(($stat->capability == null || has_capability($stat->capability, $this->context)) && ($this->get_pref('stats'. $name) || is_null($this->get_pref('stats'. $name)))) {
$this->reportedstats[$name] = array();
foreach($this->finalgrades as $itemid=>$item) {
sort($item);
if(count($item) > 0) {
$this->reportedstats[$name][$itemid] = $stat->report_data($item, $this->gtree->items[$itemid]);
} else {
$this->reportedstats[$name][$itemid] = null;
}
}
}
}
}
/**
* Take the reported data and adapt it in to HTML to output.
* HTML is stored in html.
* TODO: Deal with tables growing to wide.
* TODO: Make it look nice.
*/
public function adapt_data($printerversion = false) {
global $CFG;
$inverted = $this->get_pref('statsshowinverted');
/// Set up table arrays
$tablecolumns = array('statistic');
$tableheaders = array($this->get_lang_string('statistic', 'gradereport_stats'));
/// Loop threw items and build arrays
if ($inverted) {
if($this->get_pref('statsshowranges')) {
array_push($tablecolumns, 'range');
array_push($tableheaders, $this->get_lang_string('range', 'gradereport_stats'));
}
foreach($this->reportedstats as $name=>$data) {
array_push($tablecolumns, $name);
array_push($tableheaders, grade_report_stats::$stats[$name]->name);
}
if($this->get_pref('statsshownumgrades')) {
array_push($tablecolumns, 'num_grades');
array_push($tableheaders, $this->get_lang_string('num_grades', 'gradereport_stats'));
}
} else {
/// Set up range column and number of grades column
$ranges = array(format_text('<strong>' . $this->get_lang_string('range', 'gradereport_stats') . '</strong>', FORMAT_HTML));
$numgrades = array(format_text('<strong>' . $this->get_lang_string('num_grades', 'gradereport_stats') . '</strong>', FORMAT_HTML));
foreach($this->finalgrades as $itemid=>$grades) {
array_push($tablecolumns, $itemid);
array_push($tableheaders, format_text($this->gtree->items[$itemid]->get_name(), FORMAT_HTML));
array_push($ranges, format_text('<strong>' . grade_format_gradevalue($this->gtree->items[$itemid]->grademin, $this->gtree->items[$itemid], true) . '-' . grade_format_gradevalue($this->gtree->items[$itemid]->grademax, $this->gtree->items[$itemid], true) . '</strong>' , FORMAT_HTML));
array_push($numgrades, format_text(count($grades), FORMAT_HTML));
}
}
/// Set up flexible table
$this->table = new flexible_table('grade-report-stats-' . $this->courseid);
$this->table->define_columns($tablecolumns);
$this->table->define_headers($tableheaders);
if ($printerversion) {
$this->table->collapsible(false);
$this->table->set_attribute('cellspacing', '1');
$this->table->set_attribute('border', '1');
} else {
$this->table->define_baseurl($this->baseurl);
$this->table->collapsible(true);
$this->table->set_attribute('cellspacing', '1');
$this->table->set_attribute('id', 'stats-grade');
$this->table->set_attribute('class', 'grade-report-stats gradestable flexible');
}
$this->table->setup();
/// If ranges are being shown add them to the table
if(!$inverted){
if ($this->get_pref('statsshowranges')){
$this->table->add_data($ranges);
$this->table->add_separator();
}
}
/// Loop threw all the reported data and format it in to cells
/// If stat retured an array of values display the elements or
/// make a link to a popup with the data in it.
if($inverted) {
foreach($this->finalgrades as $itemid=>$grades) {
$item = $this->gtree->items[$itemid];
$row = array(format_text('<strong>' . $item->get_name() . '</strong>' , FORMAT_HTML));
if($this->get_pref('statsshowranges')) {
array_push($row, format_text('<strong>' . grade_format_gradevalue($item->grademin, $item, true) . '-' . grade_format_gradevalue($item->grademax, $item, true) . '</strong>' , FORMAT_HTML));
}
foreach($this->reportedstats as $name=>$data) {
$stat = $data[$itemid];
if(!is_array($stat)) {
array_push($row, format_text(grade_format_gradevalue($stat, $item, true, grade_report_stats::$stats[$name]->displaytype, grade_report_stats::$stats[$name]->decimals), FORMAT_HTML));
} else {
$statstring = "";
for($i = 0; $i < 2; $i++) {
if($i >= count($stat)) {
break;
}
$statstring .= grade_format_gradevalue($stat[$i], $item, true, grade_report_stats::$stats[$name]->displaytype, grade_report_stats::$stats[$name]->decimals) . ', ';
}
if($i < count($stat)) {
if(!$printerversion) {
$statstring = "<a href=\"#\" onClick=\"javascript:window.open('{$CFG->wwwroot}/grade/report/stats/arrayview.php?id={$this->courseid}&data={$this->encode_array($stat, $item, grade_report_stats::$stats[$name])}','{$this->get_lang_string('moredata', 'gradereport_stats')}','width=300,height=500,menubar=no,status=no,location=no,directories=no,toolbar=no,scrollbars=yes');\">". format_text($statstring, FORMAT_HTML) . '....</a>';
} else {
$statstring .= '...';
}
} else {
$statstring = substr($statstring, 0, strlen($statstring) - 2);
}
array_push($row, $statstring);
}
}
if($this->get_pref('statsshownumgrades')) {
array_push($row, format_text(count($grades), FORMAT_HTML));
}
$this->table->add_data($row);
}
} else {
foreach($this->reportedstats as $name=>$data) {
$row = array(format_text('<strong>' . grade_report_stats::$stats[$name]->name . '</strong>', FORMAT_HTML));
foreach($data as $itemid=>$stat) {
if(!is_array($stat)) {
array_push($row, format_text(grade_format_gradevalue($stat, $this->gtree->items[$itemid], true, grade_report_stats::$stats[$name]->displaytype, grade_report_stats::$stats[$name]->decimals), FORMAT_HTML));
} else {
$statstring = "";
for($i = 0; $i < 2; $i++) {
if($i >= count($stat)) {
break;
}
$statstring .= grade_format_gradevalue($stat[$i], $this->gtree->items[$itemid], true, grade_report_stats::$stats[$name]->displaytype, grade_report_stats::$stats[$name]->decimals) . ', ';
}
if($i < count($stat)) {
if(!$printerversion) {
$statstring = "<a href=\"#\" onClick=\"javascript:window.open('{$CFG->wwwroot}/grade/report/stats/arrayview.php?id={$this->courseid}&data={$this->encode_array($stat, $this->gtree->items[$itemid], grade_report_stats::$stats[$name])}','{$this->get_lang_string('moredata', 'gradereport_stats')}','width=300,height=500,menubar=no,status=no,location=no,directories=no,toolbar=no,scrollbars=yes');\">". format_text($statstring, FORMAT_HTML) . '....</a>';
} else {
$statstring .= '...';
}
} else {
$statstring = substr($statstring, 0, strlen($statstring) - 2);
}
array_push($row, $statstring);
}
}
$this->table->add_data($row);
}
}
/// If the number of grades is being shown add it to the table.
if(!$inverted) {
if ($this->get_pref('statsshownumgrades')){
$this->table->add_separator();
$this->table->add_data($numgrades);
}
}
/// Build html
ob_start();
if($this->currentgroup == 0) {
echo format_text('<strong>Group:</strong> All participants', FORMAT_HTML);
} else {
echo format_text('<strong>Group:</strong> ' . groups_get_group_name($this->currentgroup), FORMAT_HTML);
}
$this->table->print_html();
$this->html = ob_get_clean();
}
/**
* Builds HTML for toggles on top of report.
* Based on grader report get_toggles_html
* @return string html code for toggles.
*/
public function get_toggles_html() {
global $CFG, $USER;
$html = '<div id="stats-report-toggles" style="vertical-align: text-top; text-align: center;">';
$html .= $this->print_toggle('numgrades', true);
$html .= $this->print_toggle('groups', true);
$html .= $this->print_toggle('ranges', true);
$html .= $this->print_toggle('inverted', true);
$html .= '</div>';
return $html;
}
/**
* Builds HTML for each individual toggle.
* Based on grader report print_toggle
* @param string $type The toggle type.
* @param bool $return Wheather ro return the HTML or print it.
*/
private function print_toggle($type, $return=false) {
global $CFG;
$icons = array('eyecons' => 't/hide.gif',
'numgrades' => 't/grades.gif',
'calculations' => 't/calc.gif',
'locks' => 't/lock.gif',
'averages' => 't/mean.gif',
'inverted' => 't/switch_whole.gif',
'nooutcomes' => 't/outcomes.gif');
$pref_name = 'grade_report_statsshow' . $type;
if (array_key_exists($pref_name, $CFG)) {
$show_pref = get_user_preferences($pref_name, $CFG->$pref_name);
} else {
$show_pref = get_user_preferences($pref_name);
}
$strshow = $this->get_lang_string('show' . $type, 'gradereport_stats');
$strhide = $this->get_lang_string('hide' . $type, 'gradereport_stats');
$show_hide = 'show';
$toggle_action = 1;
if ($show_pref) {
$show_hide = 'hide';
$toggle_action = 0;
}
if (array_key_exists($type, $icons)) {
$image_name = $icons[$type];
} else {
$image_name = "t/$type.gif";
}
$string = ${'str' . $show_hide};
$img = '<img src="'.$CFG->pixpath.'/'.$image_name.'" class="iconsmall" alt="'
.$string.'" title="'.$string.'" />'. "\n";
$retval = $img . '<a href="' . $this->baseurl . "&amp;toggle=$toggle_action&amp;toggle_type=$type\">"
. format_text($string, FORMAT_HTML) . '</a> ';
if ($return) {
return $retval;
} else {
echo $retval;
}
}
}
?>

View File

@ -1,89 +0,0 @@
<?php
///////////////////////////////////////////////////////////////////////////
// //
// NOTICE OF COPYRIGHT //
// //
// Moodle - Modular Object-Oriented Dynamic Learning Environment //
// http://moodle.org //
// //
// Copyright (C) 1999 onwards Martin Dougiamas http://moodle.com //
// //
// This program is free software; you can redistribute it and/or modify //
// it under the terms of the GNU General Public License as published by //
// the Free Software Foundation; either version 2 of the License, or //
// (at your option) any later version. //
// //
// This program is distributed in the hope that it will be useful, //
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
// GNU General Public License for more details: //
// //
// http://www.gnu.org/copyleft/gpl.html //
// //
///////////////////////////////////////////////////////////////////////////
/**
* Preferences page for the stats report plugin.
* Based on the grader report plugin.
* @package gradebook
*/
require_once '../../../config.php';
require_once $CFG->libdir . '/gradelib.php';
require_once $CFG->dirroot.'/grade/lib.php';
$courseid = required_param('id', PARAM_INT);
/// Make sure they can even access this course
if (!$course = $DB->get_record('course', array('id' => $courseid))) {
print_error('nocourseid');
}
require_login($course);
$context = get_context_instance(CONTEXT_COURSE, $course->id);
$systemcontext = get_context_instance(CONTEXT_SYSTEM);
require_capability('gradereport/stats:view', $context);
require('preferences_form.php');
$mform = new stats_report_preferences_form('preferences.php', compact('course'));
// If data submitted, then process and store.
if ($data = $mform->get_data()) {
foreach ($data as $preference => $value) {
if (substr($preference, 0, 18) !== 'grade_report_stats') {
continue;
}
if ($value == GRADE_REPORT_PREFERENCE_DEFAULT || strlen($value) == 0) {
unset_user_preference($preference);
} else {
set_user_preference($preference, $value);
}
}
}
/// If cancelled go back to report
if ($mform->is_cancelled()){
redirect($CFG->wwwroot . '/grade/report/stats/index.php?id='.$courseid);
}
print_grade_page_head($courseid, 'preferences', 'stats', get_string('preferences', 'gradereport_stats'));
/// If USER has admin capability, print a link to the site config page for this report
/// TODO: Add admin config page for this report
if (has_capability('moodle/site:config', $systemcontext)) {
echo '<div id="siteconfiglink"><a href="'.$CFG->wwwroot.'/'.$CFG->admin.'/settings.php?section=gradereportstats">';
echo get_string('changereportdefaults', 'grades');
echo "</a></div>\n";
}
print_simple_box_start("center");
$mform->display();
print_simple_box_end();
print_footer($course);
?>

View File

@ -1,181 +0,0 @@
<?php
///////////////////////////////////////////////////////////////////////////
// //
// NOTICE OF COPYRIGHT //
// //
// Moodle - Modular Object-Oriented Dynamic Learning Environment //
// http://moodle.org //
// //
// Copyright (C) 1999 onwards Martin Dougiamas http://moodle.com //
// //
// This program is free software; you can redistribute it and/or modify //
// it under the terms of the GNU General Public License as published by //
// the Free Software Foundation; either version 2 of the License, or //
// (at your option) any later version. //
// //
// This program is distributed in the hope that it will be useful, //
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
// GNU General Public License for more details: //
// //
// http://www.gnu.org/copyleft/gpl.html //
// //
///////////////////////////////////////////////////////////////////////////
/**
* FIle with class defition for stats_report_preferences_form.
* Used by preferences.php
* @package gradebook
*/
require_once($CFG->libdir.'/formslib.php');
require_once($CFG->dirroot . '/grade/report/stats/lib.php');
/**
* Moodle form to be used to set user preferences for report/stats
* gradebook plugin.
* @uses moodleform
*/
class stats_report_preferences_form extends moodleform {
/**
* Fourm definition.
*/
public function definition() {
global $USER, $CFG;
$stats = grade_report_stats::get_stats();
$mform =& $this->_form;
$course = $this->_customdata['course'];
$context = get_context_instance(CONTEXT_COURSE, $course->id);
$systemcontext = get_context_instance(CONTEXT_SYSTEM);
$stryes = get_string('yes');
$strno = get_string('no');
$checkbox_default = array(GRADE_REPORT_PREFERENCE_DEFAULT => '*default*', 0 => $strno, 1 => $stryes);
$advanced = array();
$preferences = array();
$preferences['prefgeneral'] = array(
/* 'aggregationview' => array(GRADE_REPORT_PREFERENCE_DEFAULT => '*default*',
GRADE_REPORT_AGGREGATION_VIEW_FULL => get_string('fullmode', 'grades'),
GRADE_REPORT_AGGREGATION_VIEW_AGGREGATES_ONLY => get_string('aggregatesonly', 'grades'),
GRADE_REPORT_AGGREGATION_VIEW_GRADES_ONLY => get_string('gradesonly', 'grades')
),*/
'aggregationposition' => array(GRADE_REPORT_PREFERENCE_DEFAULT => '*default*',
GRADE_REPORT_AGGREGATION_POSITION_FIRST => get_string('positionfirst', 'grades'),
GRADE_REPORT_AGGREGATION_POSITION_LAST => get_string('positionlast', 'grades')
)
);
$preferences['prefstats'] = array();
$preferences['prefshow'] = array();
foreach($stats as $key=>$stat) {
$preferences['prefstats'][$key] = $checkbox_default;
}
$preferences['prefshow']['showgroups'] = $checkbox_default;
$preferences['prefshow']['showranges'] = $checkbox_default;
$preferences['prefshow']['shownumgrades'] = $checkbox_default;
$preferences['prefshow']['showscaleitems'] = $checkbox_default;
$preferences['prefshow']['showvalueitems'] = $checkbox_default;
$preferences['prefshow']['showinverted'] = $checkbox_default;
$preferences['prefcalc']['incompleasmin'] = $checkbox_default;
$preferences['prefcalc']['usehidden'] = $checkbox_default;
$preferences['prefcalc']['uselocked'] = $checkbox_default;
foreach ($preferences as $group => $prefs) {
$mform->addElement('header', $group, get_string($group, 'gradereport_stats'));
foreach ($prefs as $pref => $type) {
$full_pref = 'grade_report_stats' . $pref;
$pref_value = get_user_preferences($full_pref);
$course_value = null;
//$options = $type;
//$type = 'select';
if (!empty($CFG->{$full_pref})) {
$course_value = grade_get_setting($course->id, $pref, $CFG->{$full_pref});
}
$options = null;
if (is_array($type)) {
$options = $type;
$type = 'select';
// MDL-11478
// get default aggregationposition from grade_settings
if (!empty($CFG->{$full_pref})) {
$course_value = grade_get_setting($course->id, $pref, $CFG->{$full_pref});
}
if ($pref == 'aggregationposition') {
if (!empty($options[$course_value])) {
$default = $options[$course_value];
} else {
$default = $options[$CFG->grade_aggregationposition];
}
} elseif (isset($options[$CFG->{$full_pref}])) {
$default = $options[$CFG->{$full_pref}];
} else {
$default = '';
}
} else {
$default = $CFG->$full_pref;
}
/*
if ($pref == 'aggregationposition') {
if (!empty($options[$course_value])) {
$default = $options[$course_value];
} elseif(isset($CFG->grade_aggregationposition)) {
$default = $options[$CFG->grade_aggregationposition];
}
} elseif ($pref == 'aggregationview' && isset($CFG->grade_report_aggregationview) && isset($options[$CFG->grade_report_aggregationview])) {
$default = $options[$CFG->grade_report_aggregationview];
} else {
if (!empty($options[$course_value])) {
$default = $options[$course_value];
} else {
if ($pref == 'incompleasmin') {
$default = $strno;
} else {
$default = $stryes;
}
}
}*/
$help_string = get_string("config$pref", 'gradereport_stats');
// Replace the '*default*' value with the site default language string - 'default' might collide with custom language packs
if (!is_null($options) AND isset($options[GRADE_REPORT_PREFERENCE_DEFAULT]) && $options[GRADE_REPORT_PREFERENCE_DEFAULT] == '*default*') {
$options[GRADE_REPORT_PREFERENCE_DEFAULT] = get_string('reportdefault', 'grades', $default);
} elseif ($type == 'text') {
$help_string = get_string("config{$pref}default", 'gradereport_stats', $default);
}
if($group == 'prefstats') {
$label = get_string('statsshow', 'gradereport_stats') . ' ' . $stats[$pref]->name;
} else {
$label = get_string($pref, 'gradereport_stats');
}
$mform->addElement($type, $full_pref, $label, $options);
$mform->setHelpButton($full_pref, array('stats' . $pref, get_string($pref, 'gradereport_stats'), 'grade'), true);
$mform->setDefault($full_pref, $pref_value);
$mform->setType($full_pref, PARAM_ALPHANUM);
}
}
$mform->addElement('hidden', 'id');
$mform->setType('id', PARAM_INT);
$mform->setDefault('id', $course->id);
$this->add_action_buttons();
}
}
?>

View File

@ -1,75 +0,0 @@
<?php
///////////////////////////////////////////////////////////////////////////
// //
// NOTICE OF COPYRIGHT //
// //
// Moodle - Modular Object-Oriented Dynamic Learning Environment //
// http://moodle.org //
// //
// Copyright (C) 1999 onwards Martin Dougiamas http://moodle.com //
// //
// This program is free software; you can redistribute it and/or modify //
// it under the terms of the GNU General Public License as published by //
// the Free Software Foundation; either version 2 of the License, or //
// (at your option) any later version. //
// //
// This program is distributed in the hope that it will be useful, //
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
// GNU General Public License for more details: //
// //
// http://www.gnu.org/copyleft/gpl.html //
// //
///////////////////////////////////////////////////////////////////////////
/**
* Printer page for the stats report plugin.
* @package gradebook
*/
require_once '../../../config.php';
require_once $CFG->libdir.'/gradelib.php';
require_once $CFG->dirroot.'/grade/lib.php';
require_once $CFG->dirroot.'/grade/report/stats/lib.php';
$courseid = required_param('id', PARAM_INT);
$reportname = get_string('modulename', 'gradereport_stats');
/// basic access checks
if (!$course = $DB->get_record('course', array('id' => $courseid))) {
print_error('nocourseid');
}
require_login($course);
$context = get_context_instance(CONTEXT_COURSE, $course->id);
require_capability('gradereport/stats:view', $context);
/// get tracking object
$gpr = new grade_plugin_return(array('type'=>'report', 'plugin'=>'stats', 'courseid'=>$courseid));
/// last selected report session tracking
if (!isset($USER->grade_last_report)) {
$USER->grade_last_report = array();
}
$USER->grade_last_report[$course->id] = 'stats';
grade_regrade_final_grades($courseid);
/// Get report object
$report = new grade_report_stats($courseid, $gpr, $context);
/// Build report to output
$report->load_users();
$report->harvest_data();
$report->report_data();
$report->adapt_data(true);
/// Print report
echo '<html><title>' . $reportname . ' for ' . $course->shortname . '</title><body>';
echo '<div style="font-size:25px; text-align:center; font-weight:bold">' . $course->fullname . ': ' . $reportname. '</div>';
echo '<div style="text-align:center;">' . userdate(time()) . '</div>';
echo '<br/><br/>';
echo $report->html;
echo '</body></html>';
?>

View File

@ -1,101 +0,0 @@
<?php // $Id$
///////////////////////////////////////////////////////////////////////////
// //
// NOTICE OF COPYRIGHT //
// //
// Moodle - Modular Object-Oriented Dynamic Learning Environment //
// http://moodle.com //
// //
// Copyright (C) 1999 onwards Martin Dougiamas http://dougiamas.com //
// //
// This program is free software; you can redistribute it and/or modify //
// it under the terms of the GNU General Public License as published by //
// the Free Software Foundation; either version 2 of the License, or //
// (at your option) any later version. //
// //
// This program is distributed in the hope that it will be useful, //
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
// GNU General Public License for more details: //
// //
// http://www.gnu.org/copyleft/gpl.html //
// //
///////////////////////////////////////////////////////////////////////////
$strshow = get_string('statsshow', 'gradereport_stats') . ' ';
/// Add settings for this module to the $settings object (it's already defined)
$settings->add(new admin_setting_configselect('grade_report_stats_aggregationposition',
get_string('aggregationposition', 'grades'),
get_string('configaggregationposition', 'grades'),
GRADE_REPORT_AGGREGATION_POSITION_LAST,
array(GRADE_REPORT_AGGREGATION_POSITION_FIRST => get_string('positionfirst', 'grades'),
GRADE_REPORT_AGGREGATION_POSITION_LAST => get_string('positionlast', 'grades'))));
$settings->add(new admin_setting_configcheckbox('grade_report_statshighest',
$strshow . get_string('highest', 'gradereport_stats'),
get_string('stats:stat:highest', 'gradereport_stats'), 1));
$settings->add(new admin_setting_configcheckbox('grade_report_statslowest',
$strshow . get_string('lowest', 'gradereport_stats'),
get_string('stats:stat:lowest', 'gradereport_stats'), 1));
$settings->add(new admin_setting_configcheckbox('grade_report_statsmean',
$strshow . get_string('mean', 'gradereport_stats'),
get_string('stats:stat:mean', 'gradereport_stats'), 1));
$settings->add(new admin_setting_configcheckbox('grade_report_statsmedian',
$strshow . get_string('median', 'gradereport_stats'),
get_string('stats:stat:median', 'gradereport_stats'), 1));
$settings->add(new admin_setting_configcheckbox('grade_report_statsmode',
$strshow . get_string('mode', 'gradereport_stats'),
get_string('stats:stat:mode', 'gradereport_stats'), 1));
$settings->add(new admin_setting_configcheckbox('grade_report_statspass_percent',
$strshow . get_string('pass_percent', 'gradereport_stats'),
get_string('stats:stat:passpercent', 'gradereport_stats'), 1));
$settings->add(new admin_setting_configcheckbox('grade_report_statsstandard_deviation',
$strshow . get_string('standarddeviation', 'gradereport_stats'),
get_string('stats:stat:standarddeviation', 'gradereport_stats'), 1));
$settings->add(new admin_setting_configcheckbox('grade_report_statsshowgroups',
$strshow . get_string('showgroups', 'gradereport_stats'),
get_string('showgroups', 'gradereport_stats'), 1));
$settings->add(new admin_setting_configcheckbox('grade_report_statsshowranges',
$strshow . get_string('showranges', 'gradereport_stats'),
get_string('showranges', 'gradereport_stats'), 1));
$settings->add(new admin_setting_configcheckbox('grade_report_statsshownumgrades',
$strshow . get_string('shownumgrades', 'gradereport_stats'),
get_string('shownumgrades', 'gradereport_stats'), 1));
$settings->add(new admin_setting_configcheckbox('grade_report_statsshowscaleitems',
$strshow . get_string('showscaleitems', 'gradereport_stats'),
get_string('showscaleitems', 'gradereport_stats'), 1));
$settings->add(new admin_setting_configcheckbox('grade_report_statsshowvalueitems',
$strshow . get_string('showvalueitems', 'gradereport_stats'),
get_string('showvalueitems', 'gradereport_stats'), 1));
$settings->add(new admin_setting_configcheckbox('grade_report_statsshowinverted',
$strshow . get_string('showinverted', 'gradereport_stats'),
get_string('showinverted', 'gradereport_stats'), 1))
;
$settings->add(new admin_setting_configcheckbox('grade_report_statsincompleasmin',
$strshow . get_string('incompleasmin', 'gradereport_stats'),
get_string('incompleasmin', 'gradereport_stats'), 0));
$settings->add(new admin_setting_configcheckbox('grade_report_statsusehidden',
$strshow . get_string('usehidden', 'gradereport_stats'),
get_string('usehidden', 'gradereport_stats'), 1));
$settings->add(new admin_setting_configcheckbox('grade_report_statsuselocked',
$strshow . get_string('uselocked', 'gradereport_stats'),
get_string('uselocked', 'gradereport_stats'), 1));
?>

View File

@ -1,41 +0,0 @@
<?php
///////////////////////////////////////////////////////////////////////////
// //
// NOTICE OF COPYRIGHT //
// //
// Moodle - Modular Object-Oriented Dynamic Learning Environment //
// http://moodle.org //
// //
// Copyright (C) 1999 onwards Martin Dougiamas http://moodle.com //
// //
// This program is free software; you can redistribute it and/or modify //
// it under the terms of the GNU General Public License as published by //
// the Free Software Foundation; either version 2 of the License, or //
// (at your option) any later version. //
// //
// This program is distributed in the hope that it will be useful, //
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
// GNU General Public License for more details: //
// //
// http://www.gnu.org/copyleft/gpl.html //
// //
///////////////////////////////////////////////////////////////////////////
require_once($CFG->dirroot . '/grade/report/stats/statistics/stats.php');
/**
* Stats class for finding the highest grade for an item in a course.
*/
class highest extends stats {
public function __construct() {
parent::__construct(get_string('highest', 'gradereport_stats'));
$this->capability = 'gradereport/stats:stat:highest';
}
public function report_data($final_grades, $item=null){
return max($final_grades);
}
}
?>

View File

@ -1,41 +0,0 @@
<?php
///////////////////////////////////////////////////////////////////////////
// //
// NOTICE OF COPYRIGHT //
// //
// Moodle - Modular Object-Oriented Dynamic Learning Environment //
// http://moodle.org //
// //
// Copyright (C) 1999 onwards Martin Dougiamas http://moodle.com //
// //
// This program is free software; you can redistribute it and/or modify //
// it under the terms of the GNU General Public License as published by //
// the Free Software Foundation; either version 2 of the License, or //
// (at your option) any later version. //
// //
// This program is distributed in the hope that it will be useful, //
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
// GNU General Public License for more details: //
// //
// http://www.gnu.org/copyleft/gpl.html //
// //
///////////////////////////////////////////////////////////////////////////
require_once($CFG->dirroot . '/grade/report/stats/statistics/stats.php');
/**
* Stats class for finding the lowest grade for an item in a course.
*/
class lowest extends stats {
public function __construct() {
parent::__construct(get_string('lowest', 'gradereport_stats'));
$this->capability = 'gradereport/stats:stat:lowest';
}
public function report_data($final_grades, $item=null){
return min($final_grades);
}
}
?>

View File

@ -1,41 +0,0 @@
<?php
///////////////////////////////////////////////////////////////////////////
// //
// NOTICE OF COPYRIGHT //
// //
// Moodle - Modular Object-Oriented Dynamic Learning Environment //
// http://moodle.org //
// //
// Copyright (C) 1999 onwards Martin Dougiamas http://moodle.com //
// //
// This program is free software; you can redistribute it and/or modify //
// it under the terms of the GNU General Public License as published by //
// the Free Software Foundation; either version 2 of the License, or //
// (at your option) any later version. //
// //
// This program is distributed in the hope that it will be useful, //
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
// GNU General Public License for more details: //
// //
// http://www.gnu.org/copyleft/gpl.html //
// //
///////////////////////////////////////////////////////////////////////////
require_once($CFG->dirroot . '/grade/report/stats/statistics/stats.php');
/**
* Stats class for finding the mean of the set of grades for an item in a course.
*/
class mean extends stats {
public function __construct() {
parent::__construct(get_string('mean', 'gradereport_stats'));
$this->capability = 'gradereport/stats:stat:mean';
}
public function report_data($final_grades, $item=null){
return (array_sum($final_grades) / count($final_grades));
}
}
?>

View File

@ -1,42 +0,0 @@
<?php
///////////////////////////////////////////////////////////////////////////
// //
// NOTICE OF COPYRIGHT //
// //
// Moodle - Modular Object-Oriented Dynamic Learning Environment //
// http://moodle.org //
// //
// Copyright (C) 1999 onwards Martin Dougiamas http://moodle.com //
// //
// This program is free software; you can redistribute it and/or modify //
// it under the terms of the GNU General Public License as published by //
// the Free Software Foundation; either version 2 of the License, or //
// (at your option) any later version. //
// //
// This program is distributed in the hope that it will be useful, //
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
// GNU General Public License for more details: //
// //
// http://www.gnu.org/copyleft/gpl.html //
// //
///////////////////////////////////////////////////////////////////////////
require_once($CFG->dirroot . '/grade/report/stats/statistics/stats.php');
/**
* Stats class for finding the median of a set of grades for an item in a course.
*/
class median extends stats {
public function __construct() {
parent::__construct(get_string('median', 'gradereport_stats'));
$this->capability = 'gradereport/stats:stat:median';
}
public function report_data($final_grades, $item=null){
$midpoint = (count($final_grades) - 1) / 2;
return ($final_grades[floor($midpoint)] + $final_grades[ceil($midpoint)]) / 2;
}
}
?>

View File

@ -1,64 +0,0 @@
<?php
///////////////////////////////////////////////////////////////////////////
// //
// NOTICE OF COPYRIGHT //
// //
// Moodle - Modular Object-Oriented Dynamic Learning Environment //
// http://moodle.org //
// //
// Copyright (C) 1999 onwards Martin Dougiamas http://moodle.com //
// //
// This program is free software; you can redistribute it and/or modify //
// it under the terms of the GNU General Public License as published by //
// the Free Software Foundation; either version 2 of the License, or //
// (at your option) any later version. //
// //
// This program is distributed in the hope that it will be useful, //
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
// GNU General Public License for more details: //
// //
// http://www.gnu.org/copyleft/gpl.html //
// //
///////////////////////////////////////////////////////////////////////////
require_once($CFG->dirroot . '/grade/report/stats/statistics/stats.php');
/**
* Stats class for finding the mode of a set of grades in an item in a course.
* NOTE: To pervent students from being able to find a list of all grades when
* there are no grades the same (or to many in the same) the mode will not be
* shown when there are over $maxmode number of modes.
*/
class mode extends stats {
public static $maxmode = 5;
public function __construct() {
parent::__construct(get_string('mode', 'gradereport_stats'));
$this->capability = 'gradereport/stats:stat:mode';
}
public function report_data($final_grades, $item=null){
$occurrences = array();
$modes = array();
foreach($final_grades as $grade) {
if(!array_key_exists(sprintf('%f', round($grade,2)), $occurrences)) {
$occurrences[sprintf('%f', round($grade,2))] = 1;
} else {
$occurrences[sprintf('%f', round($grade,2))]++;
}
}
arsort($occurrences);
$modes = array_keys($occurrences, current($occurrences));
if(count($modes) <= mode::$maxmode) {
return $modes;
} else {
return null;
}
}
}
?>

View File

@ -1,52 +0,0 @@
<?php
///////////////////////////////////////////////////////////////////////////
// //
// NOTICE OF COPYRIGHT //
// //
// Moodle - Modular Object-Oriented Dynamic Learning Environment //
// http://moodle.org //
// //
// Copyright (C) 1999 onwards Martin Dougiamas http://moodle.com //
// //
// This program is free software; you can redistribute it and/or modify //
// it under the terms of the GNU General Public License as published by //
// the Free Software Foundation; either version 2 of the License, or //
// (at your option) any later version. //
// //
// This program is distributed in the hope that it will be useful, //
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
// GNU General Public License for more details: //
// //
// http://www.gnu.org/copyleft/gpl.html //
// //
///////////////////////////////////////////////////////////////////////////
require_once($CFG->dirroot . '/grade/report/stats/statistics/stats.php');
require_once($CFG->dirroot . '/lib/grade/grade_grade.php');
/**
* Stats class for finding the percent of grades above the set
* gradepass for the item in a course.
* NOTE: This statistic depends on gradepass being set for an item,
* by defualt it is set to 0, witch is also noramly what the mingrade is
* so it will show the pass percent as 100% if everything is left as default.
*/
class pass_percent extends stats {
public function __construct() {
parent::__construct(get_string('pass_percent', 'gradereport_stats'), GRADE_DISPLAY_TYPE_PERCENTAGE);
$this->capability = 'gradereport/stats:stat:passpercent';
}
public function report_data($final_grades, $item=null){
$numpass = 0;
foreach($final_grades as $grade) {
if($grade >= $item->gradepass) {
$numpass++;
}
}
return grade_grade::standardise_score($numpass / count($final_grades), 0, 1, $item->grademin, $item->grademax);
}
}
?>

View File

@ -1,49 +0,0 @@
<?php
///////////////////////////////////////////////////////////////////////////
// //
// NOTICE OF COPYRIGHT //
// //
// Moodle - Modular Object-Oriented Dynamic Learning Environment //
// http://moodle.org //
// //
// Copyright (C) 1999 onwards Martin Dougiamas http://moodle.com //
// //
// This program is free software; you can redistribute it and/or modify //
// it under the terms of the GNU General Public License as published by //
// the Free Software Foundation; either version 2 of the License, or //
// (at your option) any later version. //
// //
// This program is distributed in the hope that it will be useful, //
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
// GNU General Public License for more details: //
// //
// http://www.gnu.org/copyleft/gpl.html //
// //
///////////////////////////////////////////////////////////////////////////
require_once($CFG->dirroot . '/grade/report/stats/statistics/stats.php');
/**
* Stats class for finding the standard deviation of the grades for an item in a course.
*/
class standard_deviation extends stats {
public function __construct() {
parent::__construct(get_string('standarddeviation', 'gradereport_stats'));
$this->capability = 'gradereport/stats:stat:standarddeviation';
}
public function report_data($final_grades, $item=null){
$sum = 0;
$n = count($final_grades);
$avg = array_sum($final_grades) / $n;
foreach($final_grades as $grade) {
$sum += pow($grade - $avg, 2);
}
return sqrt($sum / $n);
}
}
?>

View File

@ -1,82 +0,0 @@
<?php
///////////////////////////////////////////////////////////////////////////
// //
// NOTICE OF COPYRIGHT //
// //
// Moodle - Modular Object-Oriented Dynamic Learning Environment //
// http://moodle.org //
// //
// Copyright (C) 1999 onwards Martin Dougiamas http://moodle.com //
// //
// This program is free software; you can redistribute it and/or modify //
// it under the terms of the GNU General Public License as published by //
// the Free Software Foundation; either version 2 of the License, or //
// (at your option) any later version. //
// //
// This program is distributed in the hope that it will be useful, //
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
// GNU General Public License for more details: //
// //
// http://www.gnu.org/copyleft/gpl.html //
// //
///////////////////////////////////////////////////////////////////////////
/**
*File that defines the abstract stats class.
* @package gradebook
*/
/**
* Abstract class stats to be extended by classes that will be
* defining new statistics for the report/stats plugin.
*/
abstract class stats {
/**
* The name of this statistic.
* @var string $name
*/
public $name;
/**
* The display type to use when outputing this result of this
* statistic. If null the defualt item display type will be used.
* @var int $displaytype
*/
public $displaytype = null;
/**
* The nummber of decimals to use when displaying the result
* of this statistic. If null the defualt item decimals are used.
*/
public $decimals = null;
public $capability = null;
/**
* Constructor for stats.
* @param string $name name of the statistic.
* @param int $displaytype
* @param int $decimals
*/
public function __construct($name = null, $displaytype = null, $decimals=null) {
$this->name = $name;
$this->displaytype = $displaytype;
$this->decimals = $decimals;
if($name == null) {
$this->name = get_string('statistic', 'gradereport_stats');
}
}
/**
* Abstract method that is called to make the statistic and
* do all the processing for it.
* @param array $final_grades ordered array of final grades.
* @iparam object $item the gradeable item for witch the grades are a part of.
* @returns an array or floating point value of the statistic.
*/
abstract public function report_data($final_grades, $item=null);
}
?>

View File

@ -1,254 +0,0 @@
.flexible th {
white-space:nowrap;
}
.gradestable th.user img {
width: 20px;
}
.gradestable th.user, .gradestable th.range {
white-space: nowrap;
}
.grade-report-stats table .catlevel1 {
background-color: #ffffff;
}
.grade-report-stats table .catlevel2 {
background-color: #eeeeee;
}
.grade-report-stats table .catlevel3 {
background-color: #dddddd;
}
.grade-report-stats table td.overridden {
background-color: #EFD9B3;
}
.grade-report-stats table tr.avg td.cell {
background-color: #efefff;
}
.grade-report-stats table tr.odd td.cell {
background-color: #efefef;
}
.grade-report-stats table tr.even td.overridden {
background-color: #F3E4C0;
}
.grade-report-stats table tr.odd td.overridden {
background-color: #EFD9A4;
}
.grade-report-stats table tr.even td.excluded {
background-color: #EABFFF;
}
.grade-report-stats table tr.odd td.excluded {
background-color: #E5AFFF;
}
.grade-report-stats table th th.heading th.heading.c0 th.header th.header.c0 {
border-width:1px;
}
.grade-report-stats table tr.odd th.header {
border-width:1px;
}
.grade-report-stats table td.vmarked, .grade-report-stats table tr.odd td.vmarked {
background-color: #ffcc33;
}
.grade-report-stats table td.hmarked, .grade-report-stats table tr.odd td.hmarked {
background-color: #ffff99;
}
.grade-report-stats table td.hmarked.vmarked, .grade-report-stats table tr.odd td.hmarked.vmarked{
background-color: #ffcc99;
}
.grade-report-stats table tr.groupavg td.cell {
background-color: #efffef;
}
.grade-report-stats table tr.groupavg td.cell {
font-weight: bold;
color: #006400;
}
.grade-report-stats table tr.avg td.cell {
font-weight: bold;
color: #00008B;
}
.grade-report-stats table td.cat,
.grade-report-stats table td.course {
font-weight: bold;
}
.grade-report-stats table {
font-size: 80%;
white-space: nowrap;
border-color: #D3D3D3;
}
.grade-report-stats table {
border-width:1px;
border-style:solid;
margin-top: 20px;
border-color: #D3D3D3;
}
.grade-report-stats #overDiv table {
margin: 0;
}
.grade-report-stats #overDiv table td.feedback {
border: 0px;
}
.grade-report-stats #overDiv .feedback {
background-color: #AABBFF;
color: #000000;
font-family: Verdana;
font-size: 70%;
font-weight: normal;
}
.grade-report-stats #overDiv .caption {
background-color: #5566CC;
color: #CCCCFF;
font-family: Arial;
font-size: 70%;
font-weight: bold;
}
.grade-report-stats div.submit {
margin-top: 20px;
text-align: center;
}
.grade-report-stats table td {
border-width:1px;
border-style:solid;
border-color: #D3D3D3;
}
.grade-report-stats table tr.heading {
border-width:0px 0px 0px 0px;
border-style:solid;
border-color: #D3D3D3;
}
.grade-report-stats table .heading td {
border-width:0px 0px 0px 0px;
border-style:solid;
border-color: #D3D3D3;
}
.grade-report-stats table th.category {
border-width:1px 1px 1px 1px;
border-style:solid;
border-color: #D3D3D3;
vertical-align: top;
}
.grade-report-stats table th.user {
border-width:0px 0px 1px 0px;
border-style:solid;
border-color: #D3D3D3;
}
.grade-report-stats table th.useridnumber {
border-width:0px 0px 1px 1px;
border-style:solid;
border-color: #D3D3D3;
}
.grade-report-stats table th.categoryitem,
.grade-report-stats table th.courseitem,
.grade-report-stats table td.topleft {
border-width:0px 1px 0px 1px;
border-style:solid;
vertical-align: top;
border-color: #D3D3D3;
}
.grade-report-stats table#participants th {
vertical-align: top;
}
.grade-report-stats table td.fillerfirst {
border-width:0px 0px 0px 1px;
border-style:solid;
border-color: #D3D3D3;
}
.grade-report-stats table td.fillerlast {
border-width:0px 1px 0px 0px;
border-style:solid;
border-color: #D3D3D3;
}
.grade-report-stats table th.item {
border-width:1px 1px 1px 1px;
border-style:solid;
border-color: #D3D3D3;
vertical-align: top;
}
.grade-report-stats div.gradertoggle {
display: inline;
margin-left: 20px;
}
.grade-report-stats table {
margin-left:auto;
margin-right:auto;
}
.grade-report-stats table th.user {
text-align:left;
}
.grade-report-stats table td.useridnumber {
text-align:left;
}
.grade-report-stats table td {
text-align:right;
}
.grade-report-stats table th.range {
border-width:1px 1px 1px 1px;
border-style:solid;
border-color: #D3D3D3;
}
.grade-report-stats table .userpic {
display: inline;
margin-right: 10px;
}
.grade-report-stats table .quickfeedback {
border: #000000 1px dashed;
}
.grade-report-stats #siteconfiglink {
text-align: right;
}
.grade-report-stats table .hidden,
.grade-report-stats table .hidden a {
color:#aaaaaa;
}
.grade-report-stats table .datesubmitted {
font-size: 0.7em;
}
.grade-report-stats table td.cell {
padding-left: 5px;
padding-right: 5px;
}

View File

@ -1,49 +0,0 @@
<?php
///////////////////////////////////////////////////////////////////////////
// //
// NOTICE OF COPYRIGHT //
// //
// Moodle - Modular Object-Oriented Dynamic Learning Environment //
// http://moodle.org //
// //
// Copyright (C) 1999 onwards Martin Dougiamas http://moodle.com //
// //
// This program is free software; you can redistribute it and/or modify //
// it under the terms of the GNU General Public License as published by //
// the Free Software Foundation; either version 2 of the License, or //
// (at your option) any later version. //
// //
// This program is distributed in the hope that it will be useful, //
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
// GNU General Public License for more details: //
// //
// http://www.gnu.org/copyleft/gpl.html //
// //
///////////////////////////////////////////////////////////////////////////
/**
* Sets up the tabs for the report/stats plug-in and displays them.
* @package gradebook
*/
$row = $tabs = array();
$tabcontext = get_context_instance(CONTEXT_COURSE, $COURSE->id);
$row[] = new tabobject('statsreport',
$CFG->wwwroot.'/grade/report/stats/index.php?id='.$courseid,
get_string('modulename', 'gradereport_stats'));
$row[] = new tabobject('preferences',
$CFG->wwwroot.'/grade/report/stats/preferences.php?id='.$courseid,
get_string('myreportpreferences', 'grades'));
/// A bit of a hack to make the printable tab open a new window.
$row[] = new tabobject('printable',
'#" onClick="javascript:window.open(\'' . $CFG->wwwroot. '/grade/report/stats/print.php?id=' . $courseid . '\')',
get_string('printable', 'gradereport_stats'));
$tabs[] = $row;
echo '<div class="gradedisplay">';
print_tabs($tabs, $currenttab);
echo '</div>';
?>

View File

@ -1,28 +0,0 @@
<?PHP
///////////////////////////////////////////////////////////////////////////
// //
// NOTICE OF COPYRIGHT //
// //
// Moodle - Modular Object-Oriented Dynamic Learning Environment //
// http://moodle.org //
// //
// Copyright (C) 1999 onwards Martin Dougiamas http://moodle.com //
// //
// This program is free software; you can redistribute it and/or modify //
// it under the terms of the GNU General Public License as published by //
// the Free Software Foundation; either version 2 of the License, or //
// (at your option) any later version. //
// //
// This program is distributed in the hope that it will be useful, //
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
// GNU General Public License for more details: //
// //
// http://www.gnu.org/copyleft/gpl.html //
// //
///////////////////////////////////////////////////////////////////////////
$plugin->version = 2008061400;
$plugin->requires = 2007101000;
?>

View File

@ -1,276 +0,0 @@
// Flash Player Version Detection - Rev 1.6
// Detect Client Browser type
// Copyright(c) 2005-2006 Adobe Macromedia Software, LLC. All rights reserved.
var isIE = (navigator.appVersion.indexOf("MSIE") != -1) ? true : false;
var isWin = (navigator.appVersion.toLowerCase().indexOf("win") != -1) ? true : false;
var isOpera = (navigator.userAgent.indexOf("Opera") != -1) ? true : false;
function ControlVersion()
{
var version;
var axo;
var e;
// NOTE : new ActiveXObject(strFoo) throws an exception if strFoo isn't in the registry
try {
// version will be set for 7.X or greater players
axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");
version = axo.GetVariable("$version");
} catch (e) {
}
if (!version)
{
try {
// version will be set for 6.X players only
axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");
// installed player is some revision of 6.0
// GetVariable("$version") crashes for versions 6.0.22 through 6.0.29,
// so we have to be careful.
// default to the first public version
version = "WIN 6,0,21,0";
// throws if AllowScripAccess does not exist (introduced in 6.0r47)
axo.AllowScriptAccess = "always";
// safe to call for 6.0r47 or greater
version = axo.GetVariable("$version");
} catch (e) {
}
}
if (!version)
{
try {
// version will be set for 4.X or 5.X player
axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.3");
version = axo.GetVariable("$version");
} catch (e) {
}
}
if (!version)
{
try {
// version will be set for 3.X player
axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.3");
version = "WIN 3,0,18,0";
} catch (e) {
}
}
if (!version)
{
try {
// version will be set for 2.X player
axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash");
version = "WIN 2,0,0,11";
} catch (e) {
version = -1;
}
}
return version;
}
// JavaScript helper required to detect Flash Player PlugIn version information
function GetSwfVer(){
// NS/Opera version >= 3 check for Flash plugin in plugin array
var flashVer = -1;
if (navigator.plugins != null && navigator.plugins.length > 0) {
if (navigator.plugins["Shockwave Flash 2.0"] || navigator.plugins["Shockwave Flash"]) {
var swVer2 = navigator.plugins["Shockwave Flash 2.0"] ? " 2.0" : "";
var flashDescription = navigator.plugins["Shockwave Flash" + swVer2].description;
var descArray = flashDescription.split(" ");
var tempArrayMajor = descArray[2].split(".");
var versionMajor = tempArrayMajor[0];
var versionMinor = tempArrayMajor[1];
var versionRevision = descArray[3];
if (versionRevision == "") {
versionRevision = descArray[4];
}
if (versionRevision[0] == "d") {
versionRevision = versionRevision.substring(1);
} else if (versionRevision[0] == "r") {
versionRevision = versionRevision.substring(1);
if (versionRevision.indexOf("d") > 0) {
versionRevision = versionRevision.substring(0, versionRevision.indexOf("d"));
}
}
var flashVer = versionMajor + "." + versionMinor + "." + versionRevision;
}
}
// MSN/WebTV 2.6 supports Flash 4
else if (navigator.userAgent.toLowerCase().indexOf("webtv/2.6") != -1) flashVer = 4;
// WebTV 2.5 supports Flash 3
else if (navigator.userAgent.toLowerCase().indexOf("webtv/2.5") != -1) flashVer = 3;
// older WebTV supports Flash 2
else if (navigator.userAgent.toLowerCase().indexOf("webtv") != -1) flashVer = 2;
else if ( isIE && isWin && !isOpera ) {
flashVer = ControlVersion();
}
return flashVer;
}
// When called with reqMajorVer, reqMinorVer, reqRevision returns true if that version or greater is available
function DetectFlashVer(reqMajorVer, reqMinorVer, reqRevision)
{
versionStr = GetSwfVer();
if (versionStr == -1 ) {
return false;
} else if (versionStr != 0) {
if(isIE && isWin && !isOpera) {
// Given "WIN 2,0,0,11"
tempArray = versionStr.split(" "); // ["WIN", "2,0,0,11"]
tempString = tempArray[1]; // "2,0,0,11"
versionArray = tempString.split(","); // ['2', '0', '0', '11']
} else {
versionArray = versionStr.split(".");
}
var versionMajor = versionArray[0];
var versionMinor = versionArray[1];
var versionRevision = versionArray[2];
// is the major.revision >= requested major.revision AND the minor version >= requested minor
if (versionMajor > parseFloat(reqMajorVer)) {
return true;
} else if (versionMajor == parseFloat(reqMajorVer)) {
if (versionMinor > parseFloat(reqMinorVer))
return true;
else if (versionMinor == parseFloat(reqMinorVer)) {
if (versionRevision >= parseFloat(reqRevision))
return true;
}
}
return false;
}
}
function AC_AddExtension(src, ext)
{
if (src.indexOf('?') != -1)
return src.replace(/\?/, ext+'?');
else
return src + ext;
}
function AC_Generateobj(objAttrs, params, embedAttrs)
{
var str = '';
if (isIE && isWin && !isOpera)
{
str += '<object ';
for (var i in objAttrs)
str += i + '="' + objAttrs[i] + '" ';
str += '>';
for (var i in params)
str += '<param name="' + i + '" value="' + params[i] + '" /> ';
str += '</object>';
} else {
str += '<embed ';
for (var i in embedAttrs)
str += i + '="' + embedAttrs[i] + '" ';
str += '> </embed>';
}
document.write(str);
}
function AC_FL_RunContent(){
var ret =
AC_GetArgs
( arguments, ".swf", "movie", "clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"
, "application/x-shockwave-flash"
);
AC_Generateobj(ret.objAttrs, ret.params, ret.embedAttrs);
}
function AC_GetArgs(args, ext, srcParamName, classid, mimeType){
var ret = new Object();
ret.embedAttrs = new Object();
ret.params = new Object();
ret.objAttrs = new Object();
for (var i=0; i < args.length; i=i+2){
var currArg = args[i].toLowerCase();
switch (currArg){
case "classid":
break;
case "pluginspage":
ret.embedAttrs[args[i]] = args[i+1];
break;
case "src":
case "movie":
args[i+1] = AC_AddExtension(args[i+1], ext);
ret.embedAttrs["src"] = args[i+1];
ret.params[srcParamName] = args[i+1];
break;
case "onafterupdate":
case "onbeforeupdate":
case "onblur":
case "oncellchange":
case "onclick":
case "ondblClick":
case "ondrag":
case "ondragend":
case "ondragenter":
case "ondragleave":
case "ondragover":
case "ondrop":
case "onfinish":
case "onfocus":
case "onhelp":
case "onmousedown":
case "onmouseup":
case "onmouseover":
case "onmousemove":
case "onmouseout":
case "onkeypress":
case "onkeydown":
case "onkeyup":
case "onload":
case "onlosecapture":
case "onpropertychange":
case "onreadystatechange":
case "onrowsdelete":
case "onrowenter":
case "onrowexit":
case "onrowsinserted":
case "onstart":
case "onscroll":
case "onbeforeeditfocus":
case "onactivate":
case "onbeforedeactivate":
case "ondeactivate":
case "type":
case "codebase":
ret.objAttrs[args[i]] = args[i+1];
break;
case "id":
case "width":
case "height":
case "align":
case "vspace":
case "hspace":
case "class":
case "title":
case "accesskey":
case "name":
case "tabindex":
ret.embedAttrs[args[i]] = ret.objAttrs[args[i]] = args[i+1];
break;
default:
ret.embedAttrs[args[i]] = ret.params[args[i]] = args[i+1];
}
}
ret.objAttrs["classid"] = classid;
if (mimeType) ret.embedAttrs["type"] = mimeType;
return ret;
}

View File

@ -1,123 +0,0 @@
__ __ ___
/\ \/\ \ __ /\_ \
\ \ \ \ \ /\_\ ____ __ __ __ \//\ \
\ \ \ \ \\/\ \ /',__\ /\ \/\ \ /'__`\ \ \ \
\ \ \_/ \\ \ \ /\__, `\\ \ \_\ \/\ \L\.\_ \_\ \_
\ `\___/ \ \_\\/\____/ \ \____/\ \__/.\_\/\____\
`\/__/ \/_/ \/___/ \/___/ \/__/\/_/\/____/
____ __
/\ _`\ /\ \__
\ \ \L\ \ __ _____ ___ _ __ \ \ ,_\
\ \ , / /'__`\/\ '__`\ / __`\ /\`'__\\ \ \/
\ \ \\ \ /\ __/\ \ \L\ \/\ \L\ \\ \ \/ \ \ \_
\ \_\ \_\\ \____\\ \ ,__/\ \____/ \ \_\ \ \__\
\/_/\/ / \/____/ \ \ \/ \/___/ \/_/ \/__/
\ \_\
\/_/ ,+7$$Z$ZO=
:+$$Z$$ZOZZZOOOOOOOOD,:,,,
+Z$ZOOO8OO8OOOOOOOOO8+====~~:,
7$ZOOOOZOZOOOOOOOOOO8+++++=~:,
77$88OZ8MMDZZZOOOOOOOZ+?++==~:,
77Z$$Z8MM8OZOZZZZOOOO8ONDN+=~:,
I7$Z$NMOOOOOO$$$ZZOOOOOD8D8D8:,
II7$7MDZOOZZZZOZ$$ZZ$OOZNDNDDDD8DO ,IIII777I~
7?$$ZOMOOZZZ777MMMMMMMMMMMDNDN8DDDD$$7, =+++++???IIII7777$?
,,,:Z==++===7NMMMND8DDDMMD8DDDDD777777:?=~~~~==+++???II777$$$,
,:DM~~~~::,O8ND8OO8Z$$$$DDDDDD7IIIIII+~~~=?I77$$$$77IIII77$$Z+,
,8,,,, ONND$ZZ$$777DDDDNDO$77II??+++I7$ZZOOOOZZ$77IIII7$ZZZ:,
M,::, O$D888ZO$II77DDD88OZ$7IIIIIII7$ZOO8OOOOOZ$77III77$ZO=:
=M,,, ?+~~+I$$$ZI778D$I?+=$77IIIII7$ZOO++===~~~$$7IIII7$ZOO~:
OM,,, I?==?I7$O8D777?+=:,,:77I?III7ZOO++=~:,,,,:77I?II7$ZOO=~,
8MI::, I?=+II7$O8??+=~:, 77I?II7$ZOO+=~, ?7I??II$ZOO+~:
~M=~~, I?++II7ZOO+=~, II?+?I7$ZOO=~, ,II+?II7ZOO+~:
M::~: I?++II7ZOO+=:, II++?I7$ZOO=~, II++II7ZOO+~:
M,:~: I?++II7ZOO+=: II++?II$ZOO=~, I?++II7ZOO+=:
M=::, I?++II7ZOO+=: II++?II$ZOO=~, I?++II7ZOO+=:
MI::: I?++?I7ZOO+=: II++?II$ZOO=~, I?=+II7ZOO+=:
,M?:~: I?++?I7$OO+=: II+=?II$ZOO=~, I?=+II7ZOO+=:
=M=:~: I?++?I7$OO+=: II+=?II$ZOO=~, I?=+II7ZOO+=:
M,:~: I?++?I7$OO+=: II+=?II$ZOO=~, I?=+II7ZOO+~:
M,:~: I?++?I7$OO+=: II+=?II$ZOO=~, I?=+II7ZOO+~:
M,::, I?++?I7$OO+=: II+=?II$ZOO=~, I?=+II7ZOO+~:
,:, I?++?I7$OO+=: II+=?II$ZOO=~, I?=+II7ZOO+~:
, IIII77$ZOO+=: IIIII77$OOO=~, IIII77$ZOO+~:
77$$ZZZOOO+=: 77$$ZZZOOOO=~, 77$ZZZOOOO+~:
$ZOOOOOOOO+=: $$ZOOOOOOOO=~, $ZOOOOOOOO+=:
=== About Visual Report ===
The visual report gradebook plug-in was developed as part of a Google
Summer of Code 2008 project The goal of the plug-in is to provide a
framework for providing flash based visualizations for gradebook data
using flex and the flare action script libraries. Several visualizations
such as Average Grades vs Items, Normalized Grades vs Students, and
several different types of Grade Distributions are included and new
visualizations can be easily dropped in by developers.
=== About Author ===
This plug-in was originally created by a computer science student named Daniel Servos as part of
a Google Summer of Code 2008 project.
==== Contact Information ====
Name: Daniel Servos
E-mail: dservos@lakeheadu.ca
Blog: HackerDan.com
=== Copyright ===
Moodle - Modular Object-Oriented Dynamic Learning Environment
http://moodle.org
Copyright (C) 1999 onwards Martin Dougiamas http://moodle.com
This program is free software; you can redistribute it and/or modify it under the terms of the GNU
General Public License as published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details:
http://www.gnu.org/copyleft/gpl.html
=== Version / Release ===
This plug-in was developed for Moodle 2.0 dev.
This is the first real release of this plug-in and should be considered an beta version in that it
has not yet had a chance to be extensively tested by users in real life situations and may have
unknown bugs or issues.
Version: 1.0.0b
=== Development Information ===
==== Front End ====
The flash front end for this visualization was made in adobe flex builder 3 for linux and uses an
alpha version of the flare actionscript libbary. The source code for the fron end can be found in
the ./flare_visualization/ dir with the flare libs that where used. Flare is open source and can
be found at http://flare.prefuse.org/. The newest version of flare changed several things so the
included copy of the flare lib is needed to complie the front end and the fron end code still
needs to be ported to the newest flare realse.
==== Adding new Visualizations ====
To add a new visualization to the plug-in, extend the abstract class visualization (grade/report/stats/visualizations/visualization.php) and place you class in a file name
visual_yournamehere.php in grade/report/stats/visualizations and it should be automatically loaded
in to plug-in.
==== Specification ====
http://docs.moodle.org/en/Student_projects/Animated_grade_statistics_report
==== TO DO ====
* Add more visualizations.
* Back port to Moodle 1.9.x
* Export functionality to other programs and document types like excel.
* Port to flare 2008.07.29 (new major flare release that had some big changes to the API witch
would require some recoding of the plug-in?s front end).
* Account for outcomes.
* "Find me in data" - a feature i wanted to add to show a user where they are in the data being
visualized.
* Better looking graphically and more natural UI.
* Add visualizations that go beyond just grades in a course. Compare different courses, years,
drop out trends, age of students, submission times, etc.

View File

@ -1,85 +0,0 @@
<?php
///////////////////////////////////////////////////////////////////////////
// //
// NOTICE OF COPYRIGHT //
// //
// Moodle - Modular Object-Oriented Dynamic Learning Environment //
// http://moodle.org //
// //
// Copyright (C) 1999 onwards Martin Dougiamas http://moodle.com //
// //
// This program is free software; you can redistribute it and/or modify //
// it under the terms of the GNU General Public License as published by //
// the Free Software Foundation; either version 2 of the License, or //
// (at your option) any later version. //
// //
// This program is distributed in the hope that it will be useful, //
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
// GNU General Public License for more details: //
// //
// http://www.gnu.org/copyleft/gpl.html //
// //
///////////////////////////////////////////////////////////////////////////
/**
* Page to be read in by the flex application.
* Outputs data for a visulasation in tab format.
*/
// TODO: This needs to be replaced by web service user keys
/// Get a session id from the URI request and make a cookie
/// for it temparaly. This is needed as the flex application will
/// not have the users oringal cookie and only the session information
/// witch is passed to it.
$cookiewasset = false;
if(empty($_COOKIE) && isset($_GET['sessionid']) && isset($_GET['sessioncookie']) && isset($_GET['sessiontest'])) {
$_COOKIE['MoodleSession' . $_GET['sessioncookie']] = $_GET['sessionid'];
$_COOKIE['MoodleSessionTest' . $_GET['sessioncookie']] = $_GET['sessiontest'];
$cookiewasset = true;
}
require_once '../../../config.php';
require_once $CFG->libdir.'/gradelib.php';
require_once $CFG->dirroot.'/grade/lib.php';
require_once $CFG->dirroot.'/grade/report/visual/lib.php';
$courseid = required_param('id', PARAM_INT);
$visid = optional_param('visid', '', PARAM_ACTION);
/// basic access checks
if (!$course = $DB->get_record('course', array('id' => $courseid))) {
print_error('nocourseid');
}
require_login($course);
$context = get_context_instance(CONTEXT_COURSE, $course->id);
require_capability('gradereport/visual:view', $context);
/// get tracking object
$gpr = new grade_plugin_return(array('type'=>'report', 'plugin'=>'visual', 'courseid'=>$courseid));
$report = new grade_report_visual($courseid, $gpr, $context, $visid);
/// Make sure the user is allowed see this visualization
require_capability(grade_report_visual::get_visualization($report->visid, $context)->capability, $context);
grade_regrade_final_grades($courseid);
/// Turn of error reporting as hummans will not be seeing
/// this and it will be read by the front end. Notices and
/// warnings will break the format and stop the
/// front end from working.
error_reporting(0);
/// Get report object
$report->load_users();
$report->harvest_data();
$report->report_data();
$report->adapt_data();
/// Clean up cookie if it was created.
if($cookiewasset) {
$_COOKIE['MoodleSession' . $_GET['sessioncookie']] = null;
$_COOKIE['MoodleSessionTest' . $_GET['sessioncookie']] = null;
}
?>

View File

@ -1,39 +0,0 @@
<?php
///////////////////////////////////////////////////////////////////////////
// //
// NOTICE OF COPYRIGHT //
// //
// Moodle - Modular Object-Oriented Dynamic Learning Environment //
// http://moodle.org //
// //
// Copyright (C) 1999 onwards Martin Dougiamas http://moodle.com //
// //
// This program is free software; you can redistribute it and/or modify //
// it under the terms of the GNU General Public License as published by //
// the Free Software Foundation; either version 2 of the License, or //
// (at your option) any later version. //
// //
// This program is distributed in the hope that it will be useful, //
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
// GNU General Public License for more details: //
// //
// http://www.gnu.org/copyleft/gpl.html //
// //
///////////////////////////////////////////////////////////////////////////
$gradereport_visual_capabilities = array(
'gradereport/visual:view' => array(
'riskbitmask' => RISK_PERSONAL,
'captype' => 'read',
'contextlevel' => CONTEXT_COURSE,
'legacy' => array(
'student' => CAP_ALLOW,
'teacher' => CAP_ALLOW,
'editingteacher' => CAP_ALLOW,
'admin' => CAP_ALLOW
)
)
);
?>

View File

@ -1,36 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<actionScriptProperties mainApplicationPath="flare_visualization.as" version="3">
<compiler additionalCompilerArguments="" copyDependentFiles="true" enableModuleDebug="true" generateAccessible="false" htmlExpressInstall="true" htmlGenerate="true" htmlHistoryManagement="true" htmlPlayerVersion="9.0.28" htmlPlayerVersionCheck="true" outputFolderPath="bin-debug" strict="true" useApolloConfig="false" verifyDigests="true" warn="true">
<compilerSourcePath/>
<libraryPath defaultLinkType="1">
<libraryPathEntry kind="4" path="">
<excludedEntries>
<libraryPathEntry kind="3" linkType="1" path="${PROJECT_FRAMEWORKS}/libs/automation_charts.swc" useDefaultLinkType="false"/>
<libraryPathEntry kind="1" linkType="1" path="${PROJECT_FRAMEWORKS}/locale/{locale}"/>
<libraryPathEntry kind="3" linkType="1" path="${PROJECT_FRAMEWORKS}/libs/qtp.swc" useDefaultLinkType="false"/>
<libraryPathEntry kind="3" linkType="1" path="${PROJECT_FRAMEWORKS}/libs/rpc.swc" useDefaultLinkType="false"/>
<libraryPathEntry kind="3" linkType="1" path="${PROJECT_FRAMEWORKS}/libs/charts.swc" useDefaultLinkType="false"/>
<libraryPathEntry kind="3" linkType="1" path="${PROJECT_FRAMEWORKS}/libs/framework.swc" useDefaultLinkType="false"/>
<libraryPathEntry kind="3" linkType="1" path="${PROJECT_FRAMEWORKS}/libs/datavisualization.swc" useDefaultLinkType="false"/>
<libraryPathEntry kind="3" linkType="1" path="${PROJECT_FRAMEWORKS}/libs/automation.swc" useDefaultLinkType="false"/>
<libraryPathEntry kind="3" linkType="1" path="${PROJECT_FRAMEWORKS}/libs/automation_dmv.swc" useDefaultLinkType="false"/>
<libraryPathEntry kind="3" linkType="1" path="${PROJECT_FRAMEWORKS}/libs/automation_flashflexkit.swc" useDefaultLinkType="false"/>
<libraryPathEntry kind="3" linkType="1" path="${PROJECT_FRAMEWORKS}/libs/automation_agent.swc" useDefaultLinkType="false"/>
</excludedEntries>
</libraryPathEntry>
<libraryPathEntry kind="3" linkType="1" path="/flare.util/bin/flare.util.swc" useDefaultLinkType="false"/>
<libraryPathEntry kind="3" linkType="1" path="/flare.animate/bin/flare.animate.swc" useDefaultLinkType="false"/>
<libraryPathEntry kind="3" linkType="1" path="/flare.flex/bin/flare.flex.swc" useDefaultLinkType="false"/>
<libraryPathEntry kind="3" linkType="1" path="/flare.data/bin/flare.data.swc" useDefaultLinkType="false"/>
<libraryPathEntry kind="3" linkType="1" path="/flare.physics/bin/flare.physics.swc" useDefaultLinkType="false"/>
<libraryPathEntry kind="3" linkType="1" path="/flare.query/bin/flare.query.swc" useDefaultLinkType="false"/>
<libraryPathEntry kind="3" linkType="1" path="/flare.vis/bin/flare.vis.swc" useDefaultLinkType="false"/>
</libraryPath>
<sourceAttachmentPath/>
</compiler>
<applications>
<application path="flare_visualization.as"/>
</applications>
<modules/>
<buildCSSFiles/>
</actionScriptProperties>

View File

@ -1,17 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>flare_visualization</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>com.adobe.flexbuilder.project.flexbuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>com.adobe.flexbuilder.project.actionscriptnature</nature>
</natures>
</projectDescription>

View File

@ -1,127 +0,0 @@
///////////////////////////////////////////////////////////////////////////
// //
// NOTICE OF COPYRIGHT //
// //
// Moodle - Modular Object-Oriented Dynamic Learning Environment //
// http://moodle.org //
// //
// Copyright (C) 1999 onwards Martin Dougiamas http://moodle.com //
// //
// This program is free software; you can redistribute it and/or modify //
// it under the terms of the GNU General Public License as published by //
// the Free Software Foundation; either version 2 of the License, or //
// (at your option) any later version. //
// //
// This program is distributed in the hope that it will be useful, //
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
// GNU General Public License for more details: //
// //
// http://www.gnu.org/copyleft/gpl.html //
// //
///////////////////////////////////////////////////////////////////////////
package {
import flash.display.SimpleButton;
import flash.text.TextField;
import flash.text.TextFormat;
public class Button extends SimpleButton {
private var upColor:uint = 0x9999FF;
private var overColor:uint = 0xBABAFF;
private var downColor:uint = 0xBBBBFF;
private var fmt:TextFormat = new TextFormat("monospace", 12, 0, null, null, null, null, null, "center");
private var buttonText:String;
private var alphaValue:Number = 0.6;
public var props:Object = new Object();
public function Button(text:String, settings:XMLList = null) {
if(settings != null) {
upColor = parseInt(settings.bgcolor, 16);
overColor = upColor + 0x212100;
downColor = upColor + 0x222200;
alphaValue = settings.alpha;
fmt = new TextFormat(settings.text.font, settings.text.size, 0, null, null, null, null, null, "center");
downState = new ButtonDisplayState(text, fmt, downColor, alphaValue, settings.line);
overState = new ButtonDisplayState(text, fmt, overColor, alphaValue, settings.line);
upState = new ButtonDisplayState(text, fmt, upColor, alphaValue, settings.line);
} else {
downState = new ButtonDisplayState(text, fmt, downColor, alphaValue);
overState = new ButtonDisplayState(text, fmt, overColor, alphaValue);
upState = new ButtonDisplayState(text, fmt, upColor, alphaValue);
}
buttonText = text;
hitTestState = upState;
useHandCursor = true;
}
public function set text(text:String):void {
buttonText = text;
ButtonDisplayState(downState).text = text;
ButtonDisplayState(overState).text = text;
ButtonDisplayState(upState).text = text;
}
public function get text():String {
return buttonText;
}
}
}
import flash.display.Sprite;
import flash.text.TextField;
import flash.text.TextFormat;
import flash.text.TextFieldAutoSize;
import flare.display.TextSprite;
class ButtonDisplayState extends Sprite
{
private var bgColor:uint;
private var w:uint;
private var h:uint;
private var buttonText:String;
private var fmt:TextFormat;
private var ts:TextSprite;
private var alphaValue:Number
private var lineSettings:XMLList;
public function ButtonDisplayState(text:String, fmt:TextFormat, bgColor:uint = 0x9999FF, alphaValue:Number = 0.6, lineSettings:XMLList = null) {
this.bgColor = bgColor;
buttonText = text;
this.fmt = fmt;
this.ts = new TextSprite(text, fmt);
this.alphaValue = alphaValue;
this.lineSettings = lineSettings;
var tf:TextField = ts.textField;
w = tf.width = tf.textWidth + 6;
h = tf.height = tf.textHeight + 4;
ts.dirty();
addChild(ts);
draw();
}
private function draw():void {
graphics.beginFill(bgColor, alphaValue);
if(lineSettings == null) {
graphics.lineStyle(1, 0x4444FF, 0.3, true);
} else {
graphics.lineStyle(lineSettings.size, parseInt(lineSettings.color, 16), lineSettings.alpha, true);
}
graphics.drawRoundRect(0, 0, w, h, 10, 10);
graphics.endFill();
}
public function set text(text:String):void {
buttonText = text;
ts.text = text;
}
}

View File

@ -1,72 +0,0 @@
package
{
import flare.vis.controls.HoverControl;
import flash.display.Sprite;
import flash.events.MouseEvent;
import flash.filters.GlowFilter;
public class Selector extends Sprite
{
public var param:String;
public var options:XMLList;
public var active:SelectorOption = null;
public function Selector(param:String, options:XMLList, func:Function, active:String = null, borderWidth:Number = -1)
{
this.param = param;
this.options = options;
for each(var option:XML in options) {
var selectorOption:SelectorOption;
if(active != null && active != "" && option.value == active) {
selectorOption = new SelectorOption(param, option, true);
this.active = selectorOption;
selectorOption.alpha = 1;
} else {
selectorOption = new SelectorOption(param, option, false);
selectorOption.alpha = 0.4;
}
var hc:HoverControl = new HoverControl(selectorOption);
selectorOption.x = 10;
selectorOption.y = this.height;
selectorOption.addEventListener(MouseEvent.CLICK, func);
hc.onRollOver = rollOver;
hc.onRollOut = rollOut;
addChild(selectorOption);
}
this.graphics.lineStyle(1, 0x303030, 0.50);
if(borderWidth < 0) {
this.graphics.drawRoundRect(1, 1, this.width, this.height, 15, 15);
} else if(borderWidth != 0) {
this.graphics.drawRoundRect(1, 1, max(borderWidth, this.width + 10), this.height, 15, 15);
}
}
/**
* Simple function to retrun the greatest of two ints.
* @param num1 the first number to test
* @param num2 the second number to test
* @return the largest value between num1 and num2.
*/
private function max(num1:int, num2:int):int {
if(num1 > num2) {
return num1;
} else {
return num2;
}
}
private function rollOver(soption:SelectorOption):void {
soption.filters = [new GlowFilter(0xFFFF55, 0.8, 6, 6, 10)];
}
private function rollOut(soption:SelectorOption):void {
soption.filters = null;
}
}
}

View File

@ -1,20 +0,0 @@
package
{
import flare.display.TextSprite;
import flash.text.TextFormat;
public class SelectorOption extends TextSprite {
public var param:String;
public var value:String;
public var active:Boolean = false;
public function SelectorOption(param:String, option:XML, active:Boolean = false) {
this.param = param;
this.value = option.value;
this.active = active;
super(option.title, new TextFormat("timesnewromen"));
}
}
}

View File

@ -1,276 +0,0 @@
// Flash Player Version Detection - Rev 1.6
// Detect Client Browser type
// Copyright(c) 2005-2006 Adobe Macromedia Software, LLC. All rights reserved.
var isIE = (navigator.appVersion.indexOf("MSIE") != -1) ? true : false;
var isWin = (navigator.appVersion.toLowerCase().indexOf("win") != -1) ? true : false;
var isOpera = (navigator.userAgent.indexOf("Opera") != -1) ? true : false;
function ControlVersion()
{
var version;
var axo;
var e;
// NOTE : new ActiveXObject(strFoo) throws an exception if strFoo isn't in the registry
try {
// version will be set for 7.X or greater players
axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");
version = axo.GetVariable("$version");
} catch (e) {
}
if (!version)
{
try {
// version will be set for 6.X players only
axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");
// installed player is some revision of 6.0
// GetVariable("$version") crashes for versions 6.0.22 through 6.0.29,
// so we have to be careful.
// default to the first public version
version = "WIN 6,0,21,0";
// throws if AllowScripAccess does not exist (introduced in 6.0r47)
axo.AllowScriptAccess = "always";
// safe to call for 6.0r47 or greater
version = axo.GetVariable("$version");
} catch (e) {
}
}
if (!version)
{
try {
// version will be set for 4.X or 5.X player
axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.3");
version = axo.GetVariable("$version");
} catch (e) {
}
}
if (!version)
{
try {
// version will be set for 3.X player
axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.3");
version = "WIN 3,0,18,0";
} catch (e) {
}
}
if (!version)
{
try {
// version will be set for 2.X player
axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash");
version = "WIN 2,0,0,11";
} catch (e) {
version = -1;
}
}
return version;
}
// JavaScript helper required to detect Flash Player PlugIn version information
function GetSwfVer(){
// NS/Opera version >= 3 check for Flash plugin in plugin array
var flashVer = -1;
if (navigator.plugins != null && navigator.plugins.length > 0) {
if (navigator.plugins["Shockwave Flash 2.0"] || navigator.plugins["Shockwave Flash"]) {
var swVer2 = navigator.plugins["Shockwave Flash 2.0"] ? " 2.0" : "";
var flashDescription = navigator.plugins["Shockwave Flash" + swVer2].description;
var descArray = flashDescription.split(" ");
var tempArrayMajor = descArray[2].split(".");
var versionMajor = tempArrayMajor[0];
var versionMinor = tempArrayMajor[1];
var versionRevision = descArray[3];
if (versionRevision == "") {
versionRevision = descArray[4];
}
if (versionRevision[0] == "d") {
versionRevision = versionRevision.substring(1);
} else if (versionRevision[0] == "r") {
versionRevision = versionRevision.substring(1);
if (versionRevision.indexOf("d") > 0) {
versionRevision = versionRevision.substring(0, versionRevision.indexOf("d"));
}
}
var flashVer = versionMajor + "." + versionMinor + "." + versionRevision;
}
}
// MSN/WebTV 2.6 supports Flash 4
else if (navigator.userAgent.toLowerCase().indexOf("webtv/2.6") != -1) flashVer = 4;
// WebTV 2.5 supports Flash 3
else if (navigator.userAgent.toLowerCase().indexOf("webtv/2.5") != -1) flashVer = 3;
// older WebTV supports Flash 2
else if (navigator.userAgent.toLowerCase().indexOf("webtv") != -1) flashVer = 2;
else if ( isIE && isWin && !isOpera ) {
flashVer = ControlVersion();
}
return flashVer;
}
// When called with reqMajorVer, reqMinorVer, reqRevision returns true if that version or greater is available
function DetectFlashVer(reqMajorVer, reqMinorVer, reqRevision)
{
versionStr = GetSwfVer();
if (versionStr == -1 ) {
return false;
} else if (versionStr != 0) {
if(isIE && isWin && !isOpera) {
// Given "WIN 2,0,0,11"
tempArray = versionStr.split(" "); // ["WIN", "2,0,0,11"]
tempString = tempArray[1]; // "2,0,0,11"
versionArray = tempString.split(","); // ['2', '0', '0', '11']
} else {
versionArray = versionStr.split(".");
}
var versionMajor = versionArray[0];
var versionMinor = versionArray[1];
var versionRevision = versionArray[2];
// is the major.revision >= requested major.revision AND the minor version >= requested minor
if (versionMajor > parseFloat(reqMajorVer)) {
return true;
} else if (versionMajor == parseFloat(reqMajorVer)) {
if (versionMinor > parseFloat(reqMinorVer))
return true;
else if (versionMinor == parseFloat(reqMinorVer)) {
if (versionRevision >= parseFloat(reqRevision))
return true;
}
}
return false;
}
}
function AC_AddExtension(src, ext)
{
if (src.indexOf('?') != -1)
return src.replace(/\?/, ext+'?');
else
return src + ext;
}
function AC_Generateobj(objAttrs, params, embedAttrs)
{
var str = '';
if (isIE && isWin && !isOpera)
{
str += '<object ';
for (var i in objAttrs)
str += i + '="' + objAttrs[i] + '" ';
str += '>';
for (var i in params)
str += '<param name="' + i + '" value="' + params[i] + '" /> ';
str += '</object>';
} else {
str += '<embed ';
for (var i in embedAttrs)
str += i + '="' + embedAttrs[i] + '" ';
str += '> </embed>';
}
document.write(str);
}
function AC_FL_RunContent(){
var ret =
AC_GetArgs
( arguments, ".swf", "movie", "clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"
, "application/x-shockwave-flash"
);
AC_Generateobj(ret.objAttrs, ret.params, ret.embedAttrs);
}
function AC_GetArgs(args, ext, srcParamName, classid, mimeType){
var ret = new Object();
ret.embedAttrs = new Object();
ret.params = new Object();
ret.objAttrs = new Object();
for (var i=0; i < args.length; i=i+2){
var currArg = args[i].toLowerCase();
switch (currArg){
case "classid":
break;
case "pluginspage":
ret.embedAttrs[args[i]] = args[i+1];
break;
case "src":
case "movie":
args[i+1] = AC_AddExtension(args[i+1], ext);
ret.embedAttrs["src"] = args[i+1];
ret.params[srcParamName] = args[i+1];
break;
case "onafterupdate":
case "onbeforeupdate":
case "onblur":
case "oncellchange":
case "onclick":
case "ondblClick":
case "ondrag":
case "ondragend":
case "ondragenter":
case "ondragleave":
case "ondragover":
case "ondrop":
case "onfinish":
case "onfocus":
case "onhelp":
case "onmousedown":
case "onmouseup":
case "onmouseover":
case "onmousemove":
case "onmouseout":
case "onkeypress":
case "onkeydown":
case "onkeyup":
case "onload":
case "onlosecapture":
case "onpropertychange":
case "onreadystatechange":
case "onrowsdelete":
case "onrowenter":
case "onrowexit":
case "onrowsinserted":
case "onstart":
case "onscroll":
case "onbeforeeditfocus":
case "onactivate":
case "onbeforedeactivate":
case "ondeactivate":
case "type":
case "codebase":
ret.objAttrs[args[i]] = args[i+1];
break;
case "id":
case "width":
case "height":
case "align":
case "vspace":
case "hspace":
case "class":
case "title":
case "accesskey":
case "name":
case "tabindex":
ret.embedAttrs[args[i]] = ret.objAttrs[args[i]] = args[i+1];
break;
default:
ret.embedAttrs[args[i]] = ret.params[args[i]] = args[i+1];
}
}
ret.objAttrs["classid"] = classid;
if (mimeType) ret.embedAttrs["type"] = mimeType;
return ret;
}

View File

@ -1,121 +0,0 @@
<!-- saved from url=(0014)about:internet -->
<html lang="en">
<!--
Smart developers always View Source.
This application was built using Adobe Flex, an open source framework
for building rich Internet applications that get delivered via the
Flash Player or to desktops via Adobe AIR.
Learn more about Flex at http://flex.org
// -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- BEGIN Browser History required section -->
<link rel="stylesheet" type="text/css" href="history/history.css" />
<!-- END Browser History required section -->
<title></title>
<script src="AC_OETags.js" language="javascript"></script>
<!-- BEGIN Browser History required section -->
<script src="history/history.js" language="javascript"></script>
<!-- END Browser History required section -->
<style>
body { margin: 0px; overflow:hidden }
</style>
<script language="JavaScript" type="text/javascript">
<!--
// -----------------------------------------------------------------------------
// Globals
// Major version of Flash required
var requiredMajorVersion = 9;
// Minor version of Flash required
var requiredMinorVersion = 0;
// Minor version of Flash required
var requiredRevision = 28;
// -----------------------------------------------------------------------------
// -->
</script>
</head>
<body scroll="no">
<script language="JavaScript" type="text/javascript">
<!--
// Version check for the Flash Player that has the ability to start Player Product Install (6.0r65)
var hasProductInstall = DetectFlashVer(6, 0, 65);
// Version check based upon the values defined in globals
var hasRequestedVersion = DetectFlashVer(requiredMajorVersion, requiredMinorVersion, requiredRevision);
if ( hasProductInstall && !hasRequestedVersion ) {
// DO NOT MODIFY THE FOLLOWING FOUR LINES
// Location visited after installation is complete if installation is required
var MMPlayerType = (isIE == true) ? "ActiveX" : "PlugIn";
var MMredirectURL = window.location;
document.title = document.title.slice(0, 47) + " - Flash Player Installation";
var MMdoctitle = document.title;
AC_FL_RunContent(
"src", "playerProductInstall",
"FlashVars", "MMredirectURL="+MMredirectURL+'&MMplayerType='+MMPlayerType+'&MMdoctitle='+MMdoctitle+"",
"width", "800",
"height", "600",
"align", "middle",
"id", "flare_visualization",
"quality", "high",
"bgcolor", "#ffffff",
"name", "flare_visualization",
"allowScriptAccess","sameDomain",
"type", "application/x-shockwave-flash",
"pluginspage", "http://www.adobe.com/go/getflashplayer"
);
} else if (hasRequestedVersion) {
// if we've detected an acceptable version
// embed the Flash Content SWF when all tests are passed
AC_FL_RunContent(
"src", "flare_visualization",
"width", "800",
"height", "600",
"align", "middle",
"id", "flare_visualization",
"quality", "high",
"bgcolor", "#ffffff",
"name", "flare_visualization",
"allowScriptAccess","sameDomain",
"type", "application/x-shockwave-flash",
"pluginspage", "http://www.adobe.com/go/getflashplayer"
);
} else { // flash is too old or we can't detect the plugin
var alternateContent = 'Alternate HTML content should be placed here. '
+ 'This content requires the Adobe Flash Player. '
+ '<a href=http://www.adobe.com/go/getflash/>Get Flash</a>';
document.write(alternateContent); // insert non-flash content
}
// -->
</script>
<noscript>
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
id="flare_visualization" width="800" height="600"
codebase="http://fpdownload.macromedia.com/get/flashplayer/current/swflash.cab">
<param name="movie" value="flare_visualization.swf" />
<param name="quality" value="high" />
<param name="bgcolor" value="#ffffff" />
<param name="allowScriptAccess" value="sameDomain" />
<embed src="flare_visualization.swf" quality="high" bgcolor="#ffffff"
width="800" height="600" name="flare_visualization" align="middle"
play="true"
loop="false"
quality="high"
allowScriptAccess="sameDomain"
type="application/x-shockwave-flash"
pluginspage="http://www.adobe.com/go/getflashplayer">
</embed>
</object>
</noscript>
</body>
</html>

View File

@ -1,35 +0,0 @@
# text strings to use in the API documentation
doc.title=Flare API Documention
doc.copyright=&#169; 2007-2008 Regents of the University of California
# source folders from which to generate ASDoc documentation
doc.source=flare.util,flare.animate,flare.physics,flare.query,flare.data,flare.vis,flare.flex
# package-level documentation properties for use in the flare API documention
doc.flare.animate=The flare.animate package provides classes for creating animated transitions.
doc.flare.animate.interpolate=The flare.animate.interpolate package provides classes for interpolating object property values.
doc.flare.data=The flare.data package provides classes for describing and importing external data sets.
doc.flare.data.converters=The flare.data.converters package provides classes for converting data between external formats and ActionScript objects.
doc.flare.display=The flare.display package provides classes for display objects that automatically redraw themselves as needed.
doc.flare.flex=The flare.flex package provides classes for integrating Flare visualizations into Flex applications.
doc.flare.physics=The flare.physics package provides classes for physical simulations involving particles&#44; springs&#44; and forces.
doc.flare.query=The flare.query package provides classes for creating and processing SQL-style queries over ActionScript objects.
doc.flare.query.methods=The flare.query.methods package provides convenience methods for writing queries and expressions.
doc.flare.util=The flare.util package provides classes for manipulating common data types and accessing object properties in a generalized fashion.
doc.flare.vis=The flare.vis package provides classes for creating interactive data visualizations.
doc.flare.vis.axis=The flare.vis.axis package provides classes for presenting and animating axes in a data visualization.
doc.flare.vis.controls=The flare.vis.controls package provides classes for interacting with data visualizations.
doc.flare.vis.data=The flare.vis.data package provides classes for visually representing data elements as <code>DataSprite</code> instances.
doc.flare.vis.data.render=The flare.vis.data.render package provides classes for customized rendering of <code>DataSprite</code> instances.
doc.flare.vis.events=The flare.vis.events package provides classes for events issued in the flare.vis visualization framework.
doc.flare.vis.legend=The flare.vis.legend package provides classes for presenting legends for data visualizations.
doc.flare.vis.operator=The flare.vis.operator package provides classes for visualization operators for encoding and processing visualized data.
doc.flare.vis.operator.distortion=The flare.vis.operator.distortion package provides classes for distorting the position and size of visualized data.
doc.flare.vis.operator.filter=The flare.vis.operator.filter package provides classes for visually filtering items by setting their visibility.
doc.flare.vis.operator.encoder=The flare.vis.operator.encoding package provides classes for visually encoding properties such as color&#44; shape&#44; and size.
doc.flare.vis.operator.layout=The flare.vis.operator.layout package provides classes for calculating the spatial position of visualized data.
doc.flare.vis.palette=The flare.vis.palette package provides classes for color&#44; shape&#44; and size palettes for visual encoding.
doc.flare.vis.scale=The flare.vis.scale package provides classes for data scales such as linear&#44; logarithmic&#44; and ordinal scales.
doc.flare.vis.util=The flare.vis.util package provides classes with utility functions for filtering and spanning tree generation.
doc.flare.vis.util.graphics=The flare.vis.util.graphics package provides classes with utility functions for rendering and computational geometry.
doc.flare.vis.util.heap=The flare.vis.util.heap package provides classes for a heap data structure.

View File

@ -1,16 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<actionScriptProperties mainApplicationPath="flaretween.as" version="3">
<compiler additionalCompilerArguments="" copyDependentFiles="false" enableModuleDebug="true" generateAccessible="false" htmlExpressInstall="true" htmlGenerate="false" htmlHistoryManagement="false" htmlPlayerVersion="9.0.28" htmlPlayerVersionCheck="true" outputFolderPath="bin" strict="true" useApolloConfig="false" verifyDigests="true" warn="true">
<compilerSourcePath/>
<libraryPath defaultLinkType="1">
<libraryPathEntry kind="4" path=""/>
<libraryPathEntry kind="3" linkType="2" path="/flare.util/bin/flare.util.swc" useDefaultLinkType="false"/>
</libraryPath>
<sourceAttachmentPath/>
</compiler>
<applications>
<application path="flaretween.as"/>
</applications>
<modules/>
<buildCSSFiles/>
</actionScriptProperties>

View File

@ -1,23 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<flexLibProperties version="1">
<includeClasses>
<classEntry path="flare.animate.Easing"/>
<classEntry path="flare.animate.Scheduler"/>
<classEntry path="flare.animate.Sequence"/>
<classEntry path="flare.animate.FunctionSequence"/>
<classEntry path="flare.animate.Pause"/>
<classEntry path="flare.animate.ISchedulable"/>
<classEntry path="flare.animate.interpolate.NumberInterpolator"/>
<classEntry path="flare.animate.Tween"/>
<classEntry path="flare.animate.interpolate.ColorInterpolator"/>
<classEntry path="flare.animate.interpolate.ArrayInterpolator"/>
<classEntry path="flare.animate.Transition"/>
<classEntry path="flare.animate.Parallel"/>
<classEntry path="flare.animate.interpolate.PointInterpolator"/>
<classEntry path="flare.animate.interpolate.Interpolator"/>
<classEntry path="flare.animate.interpolate.RectangleInterpolator"/>
<classEntry path="flare.animate.Transitioner"/>
</includeClasses>
<includeResources/>
<namespaceManifests/>
</flexLibProperties>

View File

@ -1,19 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>flare.animate</name>
<comment></comment>
<projects>
<project>flare.util</project>
</projects>
<buildSpec>
<buildCommand>
<name>com.adobe.flexbuilder.project.flexbuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>com.adobe.flexbuilder.project.flexlibnature</nature>
<nature>com.adobe.flexbuilder.project.actionscriptnature</nature>
</natures>
</projectDescription>

View File

@ -1,424 +0,0 @@
/*
Disclaimer for Robert Penner's Easing Equations license:
TERMS OF USE - EASING EQUATIONS
Open source under the BSD License.
Copyright © 2001 Robert Penner
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
* Neither the name of the author nor the names of contributors may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package flare.animate
{
/**
* Collection of easing functions to control animation rates.
* The methods of this class are intended to be used either (a) directly as
* values for the <tt>easing</tt> property of <tt>Transition</tt> instances,
* or (b) to generate such easing functions.
*
* <p>Many of these easing functions are adapted from Robert Penner's
* <a href="http://www.robertpenner.com/">collection of easing functions</a>.
* </p>
*/
public class Easing
{
/**
* Constructor, throws an error if called, as this is an abstract class.
*/
public function Easing() {
throw new Error("This is an abstract class.");
}
// -- Function Generators ---------------------------------------------
/**
* Composes any easeIn function with any easeOut function to create a
* custom ease-in/ease-out transition.
* @param fi an ease-in function
* @param fo an ease-out function
* @return the combined ease-in/ease-out function
*/
public static function easeInOut(fi:Function, fo:Function):Function {
return function(t:Number):Number {
if (t < 0.5) return 0.5 * fi(2*t);
return 0.5 * (1 + fo(2*t-1));
}
}
/**
* A wrapper that specifies additional arguments to an easing function,
* such that the resulting function can be called with only the time.
* @param f The easing function to wrap
* @param arg A list of arguments. There should only be 1 or 2 arguments.
*/
public static function delegate(f:Function, ...args):Function {
if (args.length == 0 || args.length > 2)
throw new ArgumentError("There should only be 1 or 2 extra arguments");
return function(t:Number):Number {
if (args.length == 1) return f(t,args[0]);
return f(t,args[0],args[1]);
};
}
/**
* Easing equation function generator for polynomial easing in: accelerating from zero velocity.
*
* @param exp The exponent of the polynomial (2 for quadration, 3 for cubic, etc)
* @return An ease-in function using the polynomial x^exp
*/
public static function easeInPoly(exp:Number):Function {
return function(t:Number):Number {
if (t < 0) return 0;
if (t > 1) return 1;
else return Math.pow(t, exp);
}
}
/**
* Easing equation function generator for polynomial easing out: decelerating from zero velocity.
*
* @param exp The exponent of the polynomial (2 for quadration, 3 for cubic, etc)
* @return An ease-out function using the polynomial x^exp
*/
public static function easeOutPoly(exp:Number):Function {
return function(t:Number):Number {
if (t < 0) return 0;
if (t > 1) return 1;
else return 1 - Math.pow(1-t, exp);
}
}
/**
* Easing equation function generator for polynomial easing in/out: acceleration until halfway, then deceleration.
*
* @param exp The exponent of the polynomial (2 for quadration, 3 for cubic, etc)
* @return An ease-in, ease-out function using the polynomial x^exp
*/
public static function easeInOutPoly(exp:Number):Function {
return function(t:Number):Number {
if (t < 0) return 0;
if (t > 1) return 1;
if (t < .5) return 0.5 * Math.pow(2*t, exp);
else return 0.5 * (2 - Math.pow(2*(1-t), exp));
}
}
/**
* Easing equation function generator for polynomial easing out/in: deceleration until halfway, then acceleration.
*
* @param exp The exponent of the polynomial (2 for quadration, 3 for cubic, etc)
* @return An ease-out, ease-in function using the polynomial x^exp
*/
public static function easeOutInPoly(exp:Number):Function {
var fi:Function = easeInPoly(exp);
var fo:Function = easeOutPoly(exp);
return function(t:Number):Number {
if (t < 0.5) return fo(2*t)/2;
else return 0.5 * (1 + fi(2*t-1));
}
}
// -- Static Functions ------------------------------------------------
/**
* Easing equation that does nothing, simply returns the input value.
*
* @param t Current time (an animation fraction between 0 and 1).
* @return The correct value.
*/
public static function none(t:Number):Number {
return t;
}
/**
* Easing equation function for a sinusoidal (sin(t)) easing in: accelerating from zero velocity.
*
* @param t Current time (an animation fraction between 0 and 1).
* @return The correct value.
*/
public static function easeInSine (t:Number):Number {
return 1 - Math.cos(t * (Math.PI/2));
}
/**
* Easing equation function for a sinusoidal (sin(t)) easing out: decelerating from zero velocity.
*
* @param t Current time (an animation fraction between 0 and 1).
* @return The correct value.
*/
public static function easeOutSine (t:Number):Number {
return Math.sin(t * (Math.PI/2));
}
/**
* Easing equation function for a sinusoidal (sin(t)) easing in/out: acceleration until halfway, then deceleration.
*
* @param t Current time (an animation fraction between 0 and 1).
* @return The correct value.
*/
public static function easeInOutSine (t:Number):Number {
return -0.5 * (Math.cos(Math.PI*t) - 1);
}
/**
* Easing equation function for a sinusoidal (sin(t)) easing out/in: deceleration until halfway, then acceleration.
*
* @param t Current time (an animation fraction between 0 and 1).
* @return The correct value.
*/
public static function easeOutInSine (t:Number):Number {
if (t < 0.5) return easeOutSine (t*2);
return easeInSine((t*2)-1);
}
/**
* Easing equation function for an exponential (2^t) easing in: accelerating from zero velocity.
*
* @param t Current time (an animation fraction between 0 and 1).
* @return The correct value.
*/
public static function easeInExpo (t:Number):Number {
return t==0 ? t : Math.pow(2,10*(t-1)) - 0.001;
}
/**
* Easing equation function for an exponential (2^t) easing out: decelerating from zero velocity.
*
* @param t Current time (an animation fraction between 0 and 1).
* @return The correct value.
*/
public static function easeOutExpo (t:Number):Number {
return (t==1) ? t : 1.001 * (-Math.pow(2, -10*t) + 1);
}
/**
* Easing equation function for an exponential (2^t) easing in/out: acceleration until halfway, then deceleration.
*
* @param t Current time (an animation fraction between 0 and 1).
* @return The correct value.
*/
public static function easeInOutExpo (t:Number):Number {
if (t==0 || t==1) return t;
if (t < 0.5) return 0.5 * Math.pow(2, 10*(2*t-1)) - 0.0005;
return 0.5 * 1.0005 * (-Math.pow(2, -10 * (2*t-1)) + 2);
}
/**
* Easing equation function for an exponential (2^t) easing out/in: deceleration until halfway, then acceleration.
*
* @param t Current time (an animation fraction between 0 and 1).
* @return The correct value.
*/
public static function easeOutInExpo (t:Number):Number {
if (t < 0.5) return 0.5 * easeOutExpo(2*t);
return 0.5 * (1 + easeInExpo(2*t-1));
}
/**
* Easing equation function for a circular (sqrt(1-t^2)) easing in: accelerating from zero velocity.
*
* @param t Current time (an animation fraction between 0 and 1).
* @return The correct value.
*/
public static function easeInCirc(t:Number):Number {
return -(Math.sqrt(1-t*t) - 1);
}
/**
* Easing equation function for a circular (sqrt(1-t^2)) easing out: decelerating from zero velocity.
*
* @param t Current time (an animation fraction between 0 and 1).
* @return The correct value.
*/
public static function easeOutCirc(t:Number):Number {
return Math.sqrt(1 - (t=t-1)*t);
}
/**
* Easing equation function for a circular (sqrt(1-t^2)) easing in/out: acceleration until halfway, then deceleration.
*
* @param t Current time (an animation fraction between 0 and 1).
* @return The correct value.
*/
public static function easeInOutCirc(t:Number):Number {
if (t < 0.5) return -0.5 * (Math.sqrt(1 - 4*t*t) - 1);
return 0.5 * (Math.sqrt(1 - (t=2*t-2)*t) + 1);
}
/**
* Easing equation function for a circular (sqrt(1-t^2)) easing out/in: deceleration until halfway, then acceleration.
*
* @param t Current time (an animation fraction between 0 and 1).
* @return The correct value.
*/
public static function easeOutInCirc(t:Number):Number {
if (t < 0.5) return easeOutCirc(2*t);
return 0.5 * (1 + easeInCirc(2*t-1));
}
/**
* Easing equation function for an elastic (exponentially decaying sine wave) easing in: accelerating from zero velocity.
*
* @param t Current time (an animation fraction between 0 and 1).
* @param a Amplitude.
* @param p Period.
* @return The correct value.
*/
public static function easeInElastic (t:Number, a:Number = Number.NaN, p:Number = Number.NaN):Number {
if (t<=0 || t>=1) return t; if (!p) p=0.45;
var s:Number;
if (!a || a < Math.abs(1)) { a=1; s=p/4; }
else s = p/(2*Math.PI) * Math.asin (1/a);
return -(a*Math.pow(2,10*(t-=1)) * Math.sin( (t-s)*(2*Math.PI)/p ));
}
/**
* Easing equation function for an elastic (exponentially decaying sine wave) easing out: decelerating from zero velocity.
*
* @param t Current time (an animation fraction between 0 and 1).
* @param a Amplitude.
* @param p Period.
* @return The correct value.
*/
public static function easeOutElastic (t:Number, a:Number = Number.NaN, p:Number = Number.NaN):Number {
return 1 - easeInElastic(1-t, a, p);
}
/**
* Easing equation function for an elastic (exponentially decaying sine wave) easing in/out: acceleration until halfway, then deceleration.
*
* @param t Current time (an animation fraction between 0 and 1).
* @param a Amplitude.
* @param p Period.
* @return The correct value.
*/
public static function easeInOutElastic (t:Number, a:Number = Number.NaN, p:Number = Number.NaN):Number {
if (t < 0.5) return 0.5 * easeInElastic(2*t, a, p);
return 0.5 * (1 + easeOutElastic(2*t-1, a, p));
}
/**
* Easing equation function for an elastic (exponentially decaying sine wave) easing out/in: deceleration until halfway, then acceleration.
*
* @param t Current time (an animation fraction between 0 and 1).
* @param a Amplitude.
* @param p Period.
* @return The correct value.
*/
public static function easeOutInElastic (t:Number, a:Number = Number.NaN, p:Number = Number.NaN):Number {
if (t < 0.5) return 0.5 * easeOutElastic(2*t, a, p);
return 0.5 * (1 + easeInElastic(2*t-1, a, p));
}
/**
* Easing equation function for a back (overshooting cubic easing: (s+1)*t^3 - s*t^2) easing in: accelerating from zero velocity.
*
* @param t Current time (an animation fraction between 0 and 1).
* @param s Overshoot ammount: higher s means greater overshoot (0 produces cubic easing with no overshoot, and the default value of 1.70158 produces an overshoot of 10 percent).
* @return The correct value.
*/
public static function easeInBack (t:Number, s:Number = Number.NaN):Number {
if (!s) s = 1.70158;
return t*t*((s+1)*t - s);
}
/**
* Easing equation function for a back (overshooting cubic easing: (s+1)*t^3 - s*t^2) easing out: decelerating from zero velocity.
*
* @param t Current time (an animation fraction between 0 and 1).
* @param s Overshoot ammount: higher s means greater overshoot (0 produces cubic easing with no overshoot, and the default value of 1.70158 produces an overshoot of 10 percent).
* @return The correct value.
*/
public static function easeOutBack (t:Number, s:Number = Number.NaN):Number {
if (!s) s = 1.70158;
return 1 - (t=1-t)*t*((s+1)*t - s);
}
/**
* Easing equation function for a back (overshooting cubic easing: (s+1)*t^3 - s*t^2) easing in/out: acceleration until halfway, then deceleration.
*
* @param t Current time (an animation fraction between 0 and 1).
* @param s Overshoot ammount: higher s means greater overshoot (0 produces cubic easing with no overshoot, and the default value of 1.70158 produces an overshoot of 10 percent).
* @return The correct value.
*/
public static function easeInOutBack (t:Number, s:Number = Number.NaN):Number {
if (!s) s = 1.70158 * 1.525;
if (t < 0.5) return 0.5 * easeInBack(2*t, s);
return 0.5 * (1 + easeOutBack(2*t-1, s));
}
/**
* Easing equation function for a back (overshooting cubic easing: (s+1)*t^3 - s*t^2) easing out/in: deceleration until halfway, then acceleration.
*
* @param t Current time (an animation fraction between 0 and 1).
* @param s Overshoot ammount: higher s means greater overshoot (0 produces cubic easing with no overshoot, and the default value of 1.70158 produces an overshoot of 10 percent).
* @return The correct value.
*/
public static function easeOutInBack (t:Number, s:Number = Number.NaN):Number {
if (!s) s = 1.70158 * 1.525;
if (t < 0.5) return 0.5 * easeOutBack(2*t, s);
return 0.5 * (1 + easeInBack(2*t-1, s));
}
/**
* Easing equation function for a bounce (exponentially decaying parabolic bounce) easing in: accelerating from zero velocity.
*
* @param t Current time (an animation fraction between 0 and 1).
* @return The correct value.
*/
public static function easeInBounce(t:Number):Number {
return 1 - easeOutBounce(1-t);
}
/**
* Easing equation function for a bounce (exponentially decaying parabolic bounce) easing out: decelerating from zero velocity.
*
* @param t Current time (an animation fraction between 0 and 1).
* @return The correct value.
*/
public static function easeOutBounce (t:Number):Number {
if (t < (1/2.75)) {
return 7.5625*t*t;
} else if (t < (2/2.75)) {
return (7.5625*(t-=(1.5/2.75))*t + .75);
} else if (t < (2.5/2.75)) {
return (7.5625*(t-=(2.25/2.75))*t + .9375);
} else {
return (7.5625*(t-=(2.625/2.75))*t + .984375);
}
}
/**
* Easing equation function for a bounce (exponentially decaying parabolic bounce) easing in/out: acceleration until halfway, then deceleration.
*
* @param t Current time (an animation fraction between 0 and 1).
* @return The correct value.
*/
public static function easeInOutBounce (t:Number):Number {
if (t < 0.5) return 0.5 * easeInBounce(2*t);
return 0.5 * (1 + easeOutBounce(2*t-1));
}
/**
* Easing equation function for a bounce (exponentially decaying parabolic bounce) easing out/in: deceleration until halfway, then acceleration.
*
* @param t Current time (an animation fraction between 0 and 1).
* @return The correct value.
*/
public static function easeOutInBounce (t:Number):Number {
if (t < 0.5) return 0.5 * easeOutBounce(2*t);
return 0.5 * (1 + easeInBounce(2*t-1));
}
} // end of class Easing
}

View File

@ -1,185 +0,0 @@
package flare.animate
{
import flare.util.Arrays;
import flare.util.Maths;
/**
* Transition that runs sub-transitions in sequential order while also
* invoking a function before each sub-transition is run. Each function
* must take a Transition instance (often a Transitioner) as input.
* Function sequences can only be played forwards; any attempt to play
* one in reverse will result in an error.
*
* <p>Function sequences are useful for ensuring a particular function
* is run before a sub-transition begins. For example, the function may
* populate the values of a Transitioner on the fly, or may be used to
* control other variables or side-effects that affect the subsequent
* sub-transition(s).</p>
*/
public class FunctionSequence extends Sequence
{
/** @private */
protected var _funcs:/*Function*/Array = [];
/** @private */
protected var _offsetStart:Boolean = true;
/** Flag indicating if extra time should be added to the transition to
* offset the running time of invoked functions. True by default. */
public function get offsetStartTime():Boolean { return _offsetStart; }
public function set offsetStartTime(b:Boolean):void { _offsetStart = b; }
// --------------------------------------------------------------------
/**
* Creates a new FunctionSequence transition.
*/
public function FunctionSequence()
{
super();
}
/**
* Adds a function call and corresponding transition to this sequence.
* As the sequence plays, functions will be called at the beginning of
* their subsequence, with the provided transition passed as the
* function's sole argument.
* @param f a function to call at the beginning of a sub-sequence
* @param t the transition to run after the function call. This
* transition will be passed in as an input to the function.
*/
public function addFunction(f:Function, t:Transition):void
{
super.add(t);
_funcs.push(f);
}
/**
* Removes a sub-transition function from this sequence. The
* corresponding transition instance will also be removed.
* @param t the transition to remove
* @return true if the transition was found and removed, false
* otherwise
*/
public function removeFunction(f:Function):Boolean
{
if (running) throw new Error("Transition is running!");
var idx:int = Arrays.remove(_funcs, f);
var rem:Boolean = idx > 0;
if (rem) {
_trans.splice(idx, 1);
_dirty = true;
}
return rem;
}
/** @inheritDoc */
public override function add(t:Transition):void
{
super.add(t);
_funcs.push(null);
}
/**
* Removes a sub-transition from this sequence. Any corresponding
* function will also be removed.
* @param t the transition to remove
* @return true if the transition was found and removed, false
* otherwise
*/
public override function remove(t:Transition):Boolean
{
if (running) throw new Error("Transition is running!");
var idx:int = Arrays.remove(_trans, t);
var rem:Boolean = idx > 0;
if (rem) {
_funcs.splice(idx, 1);
_dirty = true;
}
return rem;
}
/** @inheritDoc */
public override function dispose():void {
super.dispose();
Arrays.clear(_funcs);
}
/**
* Plays this function sequence. Function sequences can not be played
* in reverse.
* @param reverse If true, an error will be thrown and the sequence
* will not play.
*/
public override function play(reverse:Boolean=false):void {
if (reverse) throw new Error(
"Function sequences can't be played in reverse.");
super.play(false);
}
private function invoke(idx:int, t:Transition):void {
var f:Function = _funcs[idx];
if (f != null) {
if (_offsetStart) {
var d:Number = new Date().time;
f(t);
d = new Date().time - d;
_start += d;
} else {
f(t);
}
}
}
// --------------------------------------------------------------------
/**
* Sets up each sub-transition.
*/
protected override function setup():void
{
}
/**
* Starts this sequence transition, starting the first sub-transition
* to be played.
*/
protected override function start():void
{
if (_trans.length > 0) {
var t:Transition = _trans[_idx];
invoke(_idx, t); t.doSetup(); t.doStart(false);
}
}
/**
* Steps this sequence transition, ensuring that any sub-transitions
* between the previous and current progress fraction are properly
* invoked.
* @param ef the current progress fraction.
*/
internal override function step(ef:Number):void
{
// find the right sub-transition
var t:Transition, f0:Number, f1:Number, i:int, inc:int;
f0 = _fracs[_idx]; f1 = _fracs[_idx+1]; inc = (ef<=f0 ? -1 : 1);
for (i = _idx; i>=0 && i<_trans.length; i+=inc) {
// get transition and progress fractions
t = _trans[i]; f0 = _fracs[i]; f1 = _fracs[i+1];
// hand-off to new transition
if (i != _idx) {
invoke(i, t); t.doSetup(); t.doStart(false);
}
if ((inc<0 && ef >= f0) || (inc>0 && ef <= f1)) break;
t.doStep(inc<0 ? 0 : 1);
t.doEnd();
}
_idx = i; // set the transition index
if (_idx >= 0 && _idx < _trans.length) {
// run transition with mapped fraction
t.doStep(Maths.invLinearInterp(ef, f0, f1));
}
}
} // end of class FunctionSequence
}

View File

@ -1,18 +0,0 @@
package flare.animate
{
/**
* Interface for "schedulable" objects that can be run by
* the Scheduler class.
*/
public interface ISchedulable
{
/**
* Evaluate a scheduled call.
* @param time the current time in milliseconds
* @return true if this item should be removed from the scheduler,
* false if it should continue to be run.
*/
function evaluate(time:Number) : Boolean;
} // end of interface ISchedulable
}

View File

@ -1,160 +0,0 @@
package flare.animate
{
import flare.util.Arrays;
import flare.util.Maths;
/**
* Transition that runs multiple transitions simultaneously (in parallel).
* The duration of this parallel transition is computed as the maximum
* total duration (duration + delay) among the sub-transitions. If the
* duration is explicitly set, the sub-transition lengths will be
* uniformly scaled to fit within the new time span.
*/
public class Parallel extends Transition
{
// -- Properties ------------------------------------------------------
/** Array of parallel transitions */
protected var _trans:/*Transition*/Array = [];
/** @private */
protected var _equidur:Boolean;
/** @private */
protected var _dirty:Boolean = false;
/** @private */
protected var _autodur:Boolean = true;
/**
* If true, the duration of this sequence is automatically determined
* by the longest sub-transition. This is the default behavior.
*/
public function get autoDuration():Boolean { return _autodur; }
public function set autoDuration(b:Boolean):void {
_autodur = b;
computeDuration();
}
/** @inheritDoc */
public override function get duration():Number {
if (_dirty) computeDuration();
return super.duration;
}
public override function set duration(dur:Number):void {
_autodur = false;
super.duration = dur;
_dirty = true;
}
// -- Methods ---------------------------------------------------------
/**
* Creates a new Parallel transition.
* @param transitions a list of sub-transitions
*/
public function Parallel(...transitions) {
easing = Easing.none;
for each (var t:Transition in transitions) {
_trans.push(t);
}
_dirty = true;
}
/**
* Adds a new sub-transition to this parallel transition.
* @param t the transition to add
*/
public function add(t:Transition):void {
if (running) throw new Error("Transition is running!");
_trans.push(t);
_dirty = true;
}
/**
* Removes a sub-transition from this parallel transition.
* @param t the transition to remove
* @return true if the transition was found and removed, false
* otherwise
*/
public function remove(t:Transition):Boolean {
if (running) throw new Error("Transition is running!");
var rem:Boolean = Arrays.remove(_trans, t) >= 0;
if (rem) _dirty = true;
return rem;
}
/**
* Computes the duration of this parallel transition.
*/
protected function computeDuration():void {
var d:Number=0, td:Number;
if (_trans.length > 0) d = _trans[0].totalDuration;
_equidur = true;
for each (var t:Transition in _trans) {
td = t.totalDuration;
if (_equidur && td != d) _equidur = false;
d = Math.max(d, t.totalDuration);
}
if (_autodur) super.duration = d;
_dirty = false;
}
/** @inheritDoc */
public override function dispose():void {
while (_trans.length > 0) { _trans.pop().dispose(); }
}
// -- Transition Handlers ---------------------------------------------
/** @inheritDoc */
public override function play(reverse:Boolean=false):void
{
if (_dirty) computeDuration();
super.play(reverse);
}
/**
* Sets up each sub-transition.
*/
protected override function setup():void
{
for each (var t:Transition in _trans) { t.doSetup(); }
}
/**
* Starts each sub-transition.
*/
protected override function start():void
{
for each (var t:Transition in _trans) { t.doStart(_reverse); }
}
/**
* Steps each sub-transition.
* @param ef the current progress fraction.
*/
internal override function step(ef:Number):void
{
var t:Transition;
if (_equidur) {
// if all durations are the same, we can skip some calculations
for each (t in _trans) { t.doStep(ef); }
} else {
// otherwise, make sure we respect the different lengths
var d:Number = duration;
for each (t in _trans) {
var td:Number = t.totalDuration;
var f:Number = d==0 || td==d ? 1 : td/d;
t.doStep(ef>f ? 1 : f==1 ? ef : ef/f);
}
}
}
/**
* Ends each sub-transition.
*/
protected override function end():void
{
for each (var t:Transition in _trans) { t.doEnd(); }
}
} // end of class Parallel
}

View File

@ -1,18 +0,0 @@
package flare.animate
{
/**
* Transition representing a pause or dwell in which nothing happens.
* Useful for adding pauses within an animation sequence.
*/
public class Pause extends Transition
{
/**
* Creates a new Pause transition with specified duration.
* @param duration the length of the pause, in seconds
*/
public function Pause(duration:Number) {
super(duration);
}
} // end of class Pause
}

View File

@ -1,124 +0,0 @@
package flare.animate
{
import flash.display.Shape;
import flash.events.Event;
import flash.events.TimerEvent;
import flash.utils.Timer;
/**
* Scheduler that oversees animation and time-based processing. Uses an
* internal timer to regularly invoke the current set of scheduled
* objects. Typically, interaction with the scheduler is automatically
* handled by Transition classes. However, custom implmentations of
* the ISchedulable interface will need to be scheduled. Use the
* <tt>Scheduler.instance</tt> property, and not the constructor, to get
* a reference to the active scheduler.
*
* <p>By default, the Scheduler issues updates to all scheduled items each
* time the Flash Player advances to the next frame, as reported by the
* <code>Event.ENTER_FRAME</code> event. To instead set the update interval
* manually, see the <code>timerInterval</code> property.</p>
*/
public class Scheduler
{
private static var _scheduler:Scheduler = new Scheduler();
/** The default Scheduler instance. */
public static function get instance():Scheduler { return _scheduler; }
private var _scheduled:Array;
private var _timer:Timer;
private var _obj:Shape;
/**
* Sets the timer interval (in milliseconds) at which the scheduler
* should process events. If this value is greater than zero, a
* <code>Timer</code> instance will be used to trigger scheduler
* updates at the given interval. If this value is less than or equal
* to zero (the default), scheduler updates will be issued with each
* time the Flash Player advances to the next frame according to the
* <code>Event.ENTER_FRAME</code> event.
*/
public function get timerInterval():Number { return _timer.delay; }
public function set timerInterval(t:Number):void {
pause(); _timer.delay = (t>0 ? t : 0); play();
}
/**
* Creates a new Scheduler--this constructor should be not used;
* instead use the <code>instance</code> property.
*/
public function Scheduler() {
_scheduled = new Array();
_timer = new Timer(0);
_obj = new Shape();
_timer.addEventListener(TimerEvent.TIMER, tick);
}
/**
* Plays the scheduler, allowing it to process events.
*/
private function play():void
{
if (timerInterval <= 0) {
if (!_obj.hasEventListener(Event.ENTER_FRAME))
_obj.addEventListener(Event.ENTER_FRAME, tick);
} else if (!_timer.running) {
_timer.start();
}
}
/**
* Pauses the scheduler, so that events are not processed.
*/
private function pause():void
{
if (timerInterval <= 0) {
_obj.removeEventListener(Event.ENTER_FRAME, tick);
} else {
_timer.stop();
}
}
/**
* Adds an object to the scheduling list.
* @param item a schedulable object to add
*/
public function add(item:ISchedulable) : void
{
_scheduled.push(item);
play();
}
/**
* Removes an object from the scheduling list.
* @param item the object to remove
* @return true if the object was found and removed, false otherwise
*/
public function remove(item:ISchedulable) : Boolean
{
var idx:uint = _scheduled.indexOf(item);
if (idx >= 0) _scheduled.splice(idx,1);
return (idx >= 0);
}
/**
* Frame/timer callback that invokes each scheduled object.
* @param event the event that triggered the callback
*/
public function tick(event:Event) : void
{
// all events will see the same timestamp
var time:Number = new Date().time;
for each (var s:ISchedulable in _scheduled) {
if (s.evaluate(time))
remove(s);
}
if (_scheduled.length == 0) {
pause();
}
}
} // end of class Scheduler
}

View File

@ -1,192 +0,0 @@
package flare.animate
{
import flare.util.Arrays;
import flare.util.Maths;
/**
* Transition that runs multiple transitions one after the other in
* sequence. By default, the total duration of the sequence is the sum of
* the durations and delays of the sub-transitions. If the duration
* of the sequence is set explicitly, the duration and delay for
* sub-transitions will be uniformly scaled to fit within in the new
* time span.
*/
public class Sequence extends Transition
{
// -- Properties ------------------------------------------------------
/** Array of sequential transitions */
protected var _trans:/*Transition*/Array = [];
/** @private */
protected var _fracs:/*Number*/Array = [];
/** @private */
protected var _autodur:Boolean = true;
/** @private */
protected var _dirty:Boolean = false;
/** @private */
protected var _idx:int = 0;
/**
* If true, the duration of this sequence is automatically determined
* by the durations of each sub-transition. This is the default behavior.
*/
public function get autoDuration():Boolean { return _autodur; }
public function set autoDuration(b:Boolean):void {
_autodur = b;
computeDuration();
}
/** @inheritDoc */
public override function get duration():Number {
if (_dirty) computeDuration();
return super.duration;
}
public override function set duration(dur:Number):void {
_autodur = false;
super.duration = dur;
_dirty = true;
}
// -- Methods ---------------------------------------------------------
/**
* Creates a new Sequence transition.
* @param transitions an ordered list of sub-transitions
*/
public function Sequence(...transitions) {
easing = Easing.none;
for each (var t:Transition in transitions) {
_trans.push(t);
}
_dirty = true;
}
/**
* Adds a new transition to the end of this sequence.
* @param t the transition to add
*/
public function add(t:Transition):void
{
if (running) throw new Error("Transition is running!");
_trans.push(t);
_dirty = true;
}
/**
* Removes a sub-transition from this sequence.
* @param t the transition to remove
* @return true if the transition was found and removed, false
* otherwise
*/
public function remove(t:Transition):Boolean
{
if (running) throw new Error("Transition is running!");
var rem:Boolean = Arrays.remove(_trans, t) >= 0;
if (rem) _dirty = true;
return rem;
}
/**
* Computes the duration of this sequence transition.
*/
protected function computeDuration():void
{
var d:Number = 0; _fracs = [0];
// collect durations and compute sum
for each (var t:Transition in _trans)
_fracs.push(d += t.totalDuration);
// normalize durations to create progress fractions
for (var i:int=1; i<=_trans.length; ++i)
_fracs[i] = (d==0 ? 0 : _fracs[i] / d);
// set duration and scale
if (_autodur) super.duration = d;
_dirty = false;
}
/** @inheritDoc */
public override function dispose():void {
while (_trans.length > 0) { _trans.pop().dispose(); }
}
// -- Transition Handlers ---------------------------------------------
/** @inheritDoc */
public override function play(reverse:Boolean=false):void
{
if (_dirty) computeDuration();
super.play(reverse);
}
/**
* Sets up each sub-transition.
*/
protected override function setup():void
{
// initialize each transition in proper sequence
for each (var t:Transition in _trans) {
t.doSetup(); t.step(1.0);
}
}
/**
* Starts this sequence transition, starting the first sub-transition
* to be played.
*/
protected override function start():void
{
if (_reverse) {
// init for reverse playback
for (_idx=0; _idx<_trans.length; ++_idx) _trans[_idx].step(1);
_idx -= 1;
} else {
// init for forward playback
for (_idx=_trans.length; --_idx>=0;) _trans[_idx].step(0);
_idx += 1;
}
if (_trans.length > 0)
_trans[_idx].doStart(_reverse);
}
/**
* Steps this sequence transition, ensuring that any sub-transitions
* between the previous and current progress fraction are properly
* invoked.
* @param ef the current progress fraction.
*/
internal override function step(ef:Number):void
{
// find the right sub-transition
var t:Transition, f0:Number, f1:Number, i:int, inc:int;
f0 = _fracs[_idx]; f1 = _fracs[_idx+1]; inc = (ef<=f0 ? -1 : 1);
for (i = _idx; i>=0 && i<_trans.length; i+=inc) {
// get transition and progress fractions
t = _trans[i]; f0 = _fracs[i]; f1 = _fracs[i+1];
// hand-off to new transition
if (i != _idx) t.doStart(_reverse);
if ((inc<0 && ef >= f0) || (inc>0 && ef <= f1)) break;
t.doStep(inc<0 ? 0 : 1);
t.doEnd();
}
_idx = i; // set the transition index
if (_idx >= 0 && _idx < _trans.length) {
// run transition with mapped fraction
t.doStep(Maths.invLinearInterp(ef, f0, f1));
}
}
/**
* Ends this sequence transition, ending the last transition to be
* played in the sequence as necessary.
*/
protected override function end():void
{
if (_idx >= 0 && _idx < _trans.length) {
_trans[_idx].doStep(_reverse ? 0 : 1);
_trans[_idx].doEnd();
}
}
} // end of class Sequence
}

View File

@ -1,259 +0,0 @@
package flare.animate
{
import flare.util.Maths;
/**
* Base class representing an animated transition. Provides support for
* tracking animation progress over a time duration. The Transition class
* also provides set of callback functions (<tt>onStart</tt>,
* <tt>onStep</tt>, and <tt>onEnd</tt>) that are useful for tracking and
* responding to a transition's progress.
*
* <p>Useful subclasses of <code>Transition</code> include the
* <code>Tween</code>, <code>Parallel</code>, <code>Sequence</code>,
* <code>Pause</code>, and <code>Transitioner</code> classes.</p>
*/
public class Transition implements ISchedulable
{
/** Default easing function: a cubic slow-in slow-out. */
public static var DEFAULT_EASING:Function = Easing.easeInOutPoly(3);
/** Constant indicating this Transition needs initialization. */
protected static const SETUP:int = 0;
/** Constant indicating this Transition has been initialized. */
protected static const INIT:int = 1;
/** Constant indicating this Transition is currently running. */
protected static const RUN:int = 2;
// -- Properties ------------------------------------------------------
private var _easing:Function = DEFAULT_EASING; // easing function
private var _duration:Number; // duration, in seconds
private var _delay:Number; // delay, in seconds
private var _frac:Number; // animation fraction
private var _state:int = SETUP; // initialization flag
/** @private */
protected var _start:Number; // start time
/** Flag indicating this Transition is currently running. */
protected var _running:Boolean = false;
/** Flag indicating this Transition is running in reverse. */
protected var _reverse:Boolean = false;
/** Function called each time this Transition steps. */
public var onStep:Function = null;
/** Function called when this Transition starts.
* Even when playing in reverse, this function is called first. */
public var onStart:Function = null;
/** Function called when this Transition completes.
* Even when playing in reverse, this function is called last. */
public var onEnd:Function = null;
/** The total duration, including both delay and active duration. */
public function get totalDuration():Number { return duration + delay; }
/** The duration (length) of this Transition, in seconds. */
public function get duration():Number { return _duration; }
public function set duration(d:Number):void {
if (d<0) throw new ArgumentError("Negative duration not allowed.");
_duration = d;
}
/** The delay between a call to play and the actual start
* of the transition, in seconds. */
public function get delay():Number { return _delay; }
public function set delay(d:Number):void {
if (d<0) throw new ArgumentError("Negative delay not allowed.");
_delay = d;
}
/** Fraction between 0 and 1 indicating the current progress
* of this transition. */
public function get progress():Number { return _frac; }
internal function set progress(f:Number):void { _frac = f; }
/** Easing function used to pace this Transition. */
public function get easing():Function { return _easing; }
public function set easing(f:Function):void { _easing = f; }
/** Indicates if this Transition is currently running. */
public function get running():Boolean { return _running; }
// -- Methods ---------------------------------------------------------
/**
* Creates a new Transition.
* @param duration the duration, in seconds
* @param delay the delay, in seconds
* @param easing the easing function
*/
public function Transition(duration:Number=1, delay:Number=0,
easing:Function=null)
{
_duration = duration;
_delay = delay;
_easing = (easing==null ? DEFAULT_EASING : easing);
}
/**
* Starts running the transition.
* @param reverse if true, the transition is played in reverse,
* if false (the default), it is played normally.
*/
public function play(reverse:Boolean = false):void
{
_reverse = reverse;
init();
Scheduler.instance.add(this);
_running = true;
}
/**
* Stops the transition and completes it.
* Any end-of-transition actions will still be taken.
* Calling play() after stop() will result in the transition
* starting over from the beginning.
*/
public function stop():void
{
Scheduler.instance.remove(this);
doEnd();
}
/**
* Resets the transition, so that any cached starting values are
* cleared and reset the next time this transition is played.
*/
public function reset():void
{
_state = SETUP;
}
/**
* Pauses the transition at its current position.
* Calling play() after pause() will resume the transition.
*/
public function pause():void
{
Scheduler.instance.remove(this);
_running = false;
}
private function init():void
{
if (_state == SETUP) doSetup();
if (_state == RUN) {
var f:Number = _reverse ? (1-_frac) : _frac;
_start = new Date().time - f * 1000 * (duration + delay);
} else {
_start = new Date().time;
doStart(_reverse);
}
_state = RUN;
}
internal function doSetup():void
{
setup();
_state = INIT;
}
internal function doStart(reverse:Boolean):void
{
_reverse = reverse;
_running = true;
_frac = _reverse ? 1 : 0;
start(); if (onStart!=null) onStart();
}
internal function doStep(frac:Number):void
{
_frac = frac;
var f:Number = delay==0 ? frac
: Maths.invLinearInterp(frac, delay/totalDuration, 1);
if (f >= 0) { step(_easing(f)); }
if (onStep != null) onStep();
}
internal function doEnd():void
{
_frac = _reverse ? 0 : 1;
end();
_state = INIT;
_running = false;
if (onEnd!=null) onEnd();
}
/**
* Evaluates the Transition, stepping the transition forward.
* @param time the current time in milliseconds
* @return true if this item should be removed from the scheduler,
* false if it should continue to be run.
*/
public function evaluate(time:Number):Boolean
{
var t:Number = time - _start;
if (t < 0) return false;
// step the transition forward
var d:Number = 1000 * (duration + delay);
t = (d==0 ? 1.0 : t/d);
if (t > 1) t = 1; // clamp
doStep(_reverse ? 1-t : t);
// check if we're done
var _done:Boolean = (t >= 1.0);
if (_done) { doEnd(); }
return _done;
}
/**
* Disposes of this transition, freeing up any resources held. This
* method is optional, but calling it when a transition is no longer
* needed can help improve overall performance.
*/
public function dispose():void
{
// for sub-classes to implement
}
// -- abstract methods ------------------------------------------------
/**
* Transition setup routine. Subclasses should override this function
* to perform custom setup actions.
*/
protected function setup():void
{
// for sub-classes to implement
}
/**
* Transition start routine. Subclasses should override this function
* to perform custom start actions.
*/
protected function start():void
{
// for sub-classes to implement
}
/**
* Transition step routine. Subclasses should override this function
* to perform custom step actions.
*/
internal function step(ef:Number):void
{
// for sub-classes to implement
}
/**
* Transition end routine. Subclasses should override this function
* to perform custom ending actions.
*/
protected function end():void
{
// for sub-classes to implement
}
} // end of class Transition
}

View File

@ -1,431 +0,0 @@
package flare.animate
{
import flare.util.Property;
import flash.display.DisplayObject;
import flash.utils.Dictionary;
/**
* Parallel transition with convenience methods for adding new
* object tweens, helping to incrementally construct a group of transitions.
* A Transitioner will automatically generate tweens for any number of
* items and properties, simplifying the task of creating animated
* transitions.
*
* <p>For example, the following code creates a 1 second
* animation for two items. The first item is translated to the point
* (50,50) and the second item is scaled along the x dimension to twice the
* normal size.</p>
* <pre>
* var item1:Sprite, item2:Sprite; // assume these are two drawn sprites
* var t:Transitioner = new Transitioner(1); // create 1-second transition
* t.$(item1).x = 50;
* t.$(item1).y = 50;
* t.$(item2).scaleX = 2;
* t.play();
* </pre>
*
* <p>In the code above, the <code>$</code> method takes an item (this
* can be any ActionScript object, but is often a <code>DisplayObject</code>
* instance) and returns an <code>Object</code> which stores the names of
* the properties to animate and their target values. Behind the scenes,
* the <code>Transitioner</code> automatically creates <code>Tween</code>
* objects as needed.</p>
*
* <p>The object returned by the <code>$</code> method is a proxy object
* that passes the values to underlying tweens as needed. This same proxy
* object is reused across calls to the <code>$</code> method so do
* <strong>not</strong> attempt to use multiple return values from the
* <code>$</code> method simultaneously. <em>The following example shows
* what you should not do!</em></p>
* <pre>
* var o1:Object = t.$(item1);
* var o2:Object = t.$(item2); // o2==o1, now configured for item2
* o1.x = 5; // actually sets the value 5 to item2, NOT item1
* </pre>
*
* <p>
* A transitioner can also be set to "immediate" mode, either by setting
* the <code>immediate</code> property to true, or by passing in
* <code>NaN</code> as the duration value to the constructor. When in
* immediate mode, a transitioner will <strong>NOT</strong> generate
* <code>Tween</code> instances to animate the properties. Instead, the
* transitioner will set the values of the target objects immediately.
* For example, when in immediate mode, the <code>$</code> operator is
* equivalent to directly setting the property:
* <code>t.$(item1).x = 50</code> has exactly the same result at
* <code>t.x = 50</code>. The static property
* <code>Transitioner.DEFAULT</code> provides a default instance of an
* immediate-mode transitioner.
* </p>
*
* <p>
* With these features, transitioners provide a highly flexible way to
* update values in your application. You can write layout and other
* methods once, using a transitioner to update all the property values.
* When animation is desired, a standard transitioner can be passed in
* to your routines. When immediate updates are desired, you can reuse
* the same code, but just pass in a transitioner in immediate mode
* instead. Whether or not value updates are animated or immediate then
* becomes easy to control.
* </p>
*
* <p>
* Transitioners also provide optimizations to improve animation
* performance. However, they are not enabled by default, as the
* optimizations make some assumptions about how the transitioner will
* be used. See the <code>optimize</code> property and
* <code>dispose</code> method for more information.
* </p>
*/
public class Transitioner extends Parallel
{
/** The default, immediate-mode transitioner instance. */
public static const DEFAULT:Transitioner = new Transitioner(NaN);
/**
* Gets a transitioner instance depending upon the input value.
* @param t input determining the transitioner instance to return. If
* the input is a transitioner, it is simply returned. If the input is
* a number, a new Transitioner with duration set to the input value
* is returned. If the input is null,
* <code>Transitioner.DEFAULT</code> is returned.
* @return a Transitioner instance determined by the input
*/
public static function instance(t:*):Transitioner {
if (t is Number) {
return new Transitioner(t as Number);
} else if (t == null) {
return Transitioner.DEFAULT;
} else {
return t as Transitioner;
}
}
// --------------------------------------------------------------------
private var _immediate:Boolean;
private var _lookup:/*Object->Tween*/Dictionary = new Dictionary();
private var _proxy:ValueProxy;
private var _optimize:Boolean = false;
private var _subdur:Number;
/** @private */
public override function get duration():Number {
return _trans.length==0 ? _subdur : super.duration;
}
/** Immediate mode flag, used to bypass tween generation and perform
* immediate updates of target object values. */
public function get immediate():Boolean { return _immediate; }
public function set immediate(b:Boolean):void {
_immediate = b;
if (!immediate && _proxy == null) _proxy = new ValueProxy(this);
}
/**
* Flag indicating if aggressive optimization should be applied.
* This can significantly decrease processing time when large numbers
* of elements are involved. However, the optimization process makes a
* few assumptions about how the transitioner will be used. If these
* assumptions are not met, the animations may exhibit unexpected
* behaviors.
*
* <p>The assumptions made for optimized transitioners are:
* <ol>
* <li>The property values of tweened objects will not change between
* the time their target values are set and the transition is
* played. This allows the transitioner to avoid creating tweens
* when properties have the same starting and ending values, and
* immediately set values for DisplayObjects that are not visible.
* However, this means the starting value must stay the same. In
* particular, this means that optimized transitioners are often
* inappropriate for use within a <code>Sequence</code>.</li>
* <li>The transitioner will only be played once, then discarded.
* This allows the transitioner to automatically recycle all
* generated <code>Tween</code> and <code>Interpolator</code>
* instances, reducing initialization time across transitioners by
* reusing objects.</li>
* </ol>
* </p>
*/
public function get optimize():Boolean { return _optimize; }
public function set optimize(b:Boolean):void { _optimize = b; }
// --------------------------------------------------------------------
/**
* Creates a new Transitioner with specified duration.
* @param duration the length of the transition. If this value is NaN,
* the transitioner will be in immediate mode, in which all changes
* are immediately applied and no tweens are generated.
* @param easing the easing function to use for this transition. If
* null, the function Easing.none will be used.
* @param optimize boolean flag indicating if the transitioner should
* attempt to optimize tween construction. See the documentation
* for the <code>optimize</code> property for mode details.
*/
public function Transitioner(duration:Number=1, easing:Function=null,
optimize:Boolean=false)
{
super.easing = easing==null ? DEFAULT_EASING : easing;
_subdur = duration;
_optimize = optimize;
_immediate = isNaN(duration);
if (!_immediate) _proxy = new ValueProxy(this);
}
/**
* Returns the Tween for the given object, creating a new tween if no
* tween is yet associated with the object. This method returns null if
* the transitioner is in immediate mode.
* @param o the target object
* @return a tween for the input target object, or null if this
* transitioner is in immediate mode.
*/
public function _(o:Object):Tween
{
if (_immediate) return null;
var tw:Tween = _lookup[o];
if (tw == null) {
add(tw = getTween(o, _subdur));
tw.easing = Easing.none;
_lookup[o] = tw;
}
return tw;
}
/**
* Returns the values object of the Tween for the given object. If no
* tween is associated with the object, a new one is created.
*
* If the transitioner is in immediate mode, then no Tween will be
* created. Instead, the input object will be returned. This allows
* value updates to be set immediately, rather than animated by a
* tween.
* @param o the target object
* @return the <code>values</code> object for the target object's
* tween, or the target object itself if this transitioner is in
* immediate mode.
*/
public function $(o:Object):Object
{
return _immediate ? o : _proxy.init(o);
}
/**
* Sets property values for a target object. This method has the same
* effect as setting a property on the object returned by the
* <code>$</code> method.
*
* <p>If the transitioner is in immediate mode, the property name will
* be parsed and the value set at the end of the property chain. If
* the transitioner is not in immediate mode, the property name and
* values will simply be added to a Tween. If no Tween is associated
* with the input object, a new one will be created.</p>
*
* @param o the target object
* @param name the property name string
* @param value the property value to set
*/
public function setValue(o:Object, name:String, value:*):void
{
if (_immediate) {
// set the object property
Property.$(name).setValue(o, value);
} else if (optimize && getValue(o, name) == value) {
// do nothing, optimize the call away...
} else if (optimize && o is DisplayObject && !o.visible) {
Property.$(name).setValue(o, value);
} else {
// add to a tween
_(o).values[name] = value;
}
}
/**
* Retrieves property values for a target object. This method has the
* same effect as accessing a property using the object returned by the
* <code>$</code> method.
*
* <p>If the transitioner is in immediate mode, the property name will
* be parsed and the value retrieved diretly from the target object. If
* the transitioner is not in immediate mode, this method will first
* try to lookup the value in the tween <code>values</code> for the
* target object. If this does not succeed, the property value will be
* retrieved directly from the target object itself as in the immediate
* mode case.</p>
*
* @param o the target object
* @param name the property name string
* @return the property value for the target object, either from the
* target object's tween values, or, failing that, the object itself.
*/
public function getValue(o:Object, name:String):*
{
if (!_immediate) {
var tw:Tween = _lookup[o];
if (tw != null && tw.values[name] != undefined) {
return tw.values[name];
}
}
return Property.$(name).getValue(o);
}
/**
* Sets the delay of the tween for the given object. If the
* transitioner is in immediate mode, this method has no effect.
* @param o the object to set the delay for
* @param delay the delay, in seconds
*/
public function setDelay(o:Object, delay:Number):void
{
if (!_immediate) {
_(o).delay = delay;
}
}
/**
* Gets the delay of the tween for the given object. If the
* transitioner is in immediate mode or no tween has been created for
* the input object, this method returns zero.
* @param o the object to get the delay for
* @return the delay of the tween, or zero if there is no tween
*/
public function getDelay(o:Object):Number
{
if (_immediate) return 0;
var tw:Tween = _lookup[o];
return tw==null ? 0 : tw.delay;
}
/**
* Sets the removal status of a display object with this transition.
* If true, the display object will be removed from its parent in the
* display list when the transition completes. If this transitioner is
* in immediate mode, any removals are performed immediately.
* @param dobj a display object
* @param b true to remove the display object from the display list
* at the end of the transition (the default). If false, the removal
* status will be updated so that the display object will not be
* removed (not applicable in immediate mode).
*/
public function removeChild(dobj:DisplayObject, b:Boolean=true):void
{
if (_immediate && b) {
if (dobj.parent) dobj.parent.removeChild(dobj);
} else if (!_immediate) {
_(dobj).remove = b;
}
}
/**
* Indicates if a display object is scheduled to be removed from the
* display list when this transition completes. This method always
* returns false if this transitioner is in immediate mode.
* @param dobj a display object
* @return true if the display object will be removed from the display
* list at the end of this transition, false otherwise. This method
* always returns false if the transitioner is in immediate mode.
*/
public function willRemove(dobj:DisplayObject):Boolean
{
if (_immediate) return false;
var tw:Tween = _lookup[dobj];
return (tw != null && tw.remove);
}
/** @inheritDoc */
protected override function end():void
{
super.end();
if (_optimize) dispose();
}
/**
* Disposes of the internal state of this transitioner.
* Contained tweens and their interpolators will be collected and
* recycled for future reuse, improving initialization times for
* subsequent transitioners. This method is automatically called at the
* end of the transition if the <code>optimize</code> flag is true.
* Otherwise, this method can be invoked manually when a transitioner
* is no longer needed.
*/
public override function dispose():void
{
while (_trans.length > 0) {
var t:Transition = _trans.pop();
t.dispose();
if (t is Tween) reclaimTween(t as Tween);
}
}
// --------------------------------------------------------------------
private static var _maxPoolSize:int = 10000;
private static var _tweenPool:Array = [];
private static var _count:int = 0;
private static function getTween(o:Object, duration:Number):Tween
{
var tw:Tween;
if (_tweenPool.length > 0) {
tw = _tweenPool.pop();
tw.target = o;
tw.duration = duration;
} else {
tw = new Tween(o, duration);
}
return tw;
}
private static function reclaimTween(tw:Tween):void
{
if (_tweenPool.length < _maxPoolSize) {
_tweenPool.push(tw);
}
}
} // end of class Transitioner
}
import flash.utils.Proxy;
import flash.utils.flash_proxy;
import flare.animate.Transitioner;
import flare.util.Property;
/**
* Helper class that gets/sets values for a Transitioner.
* This layer of indirection allows us to perform "behind-the-scenes"
* handling while maintaining simple property assignment syntax.
*/
dynamic class ValueProxy extends Proxy
{
private var _trans:Transitioner;
private var _object:Object;
public function ValueProxy(trans:Transitioner) {
_trans = trans;
}
public function init(obj:Object):Object
{
_object = obj;
return this;
}
override flash_proxy function callProperty(methodName:*, ... args):* {
return null;
}
override flash_proxy function getProperty(name:*):* {
return _trans.getValue(_object, name);
}
override flash_proxy function setProperty(name:*, value:*):void {
_trans.setValue(_object, name, value);
}
} // end of class ValueProxy

View File

@ -1,175 +0,0 @@
package flare.animate
{
import flare.animate.interpolate.Interpolator;
import flare.util.Property;
import flash.display.DisplayObject;
/**
* Transition that interpolates (in-be<em>tweens</em>) properties
* of a target object over a time interval. The <tt>values</tt> property
* represents the set of properties to tween and their final values. Any
* arbitrary property (not just visual properties) can be tweened. The
* Tween class handles tweening of Numbers, colors, Dates, Points,
* Rectangles, and numeric Arrays. Properties of other types are simply
* swapped when then Transition half-completes. Tweening for custom types
* is possible, see the <tt>flare.animate.interpolate.Interpolator</tt>
* class for more.
*
* <p>Starting values are automatically determined from the tweened object.
* Once determined, these starting values are stored to allow both forward
* and backward playback. Use the <tt>reset</tt> method to force a tween to
* redetermine the starting values the next time it is played. Tweens also
* provide a <code>remove</code> flag for DisplayObjects. When set to true,
* a display object will be removed from the display list at the end of the
* tween. Note that playing the tween is reverse will not revert this
* removal.</p>
*
* <p>Internally, a Tween creates a set of Interpolator objects to compute
* intermediate values for each property included in <tt>values</tt>. Note
* that property names can involve nested properties. For example,
* <tt>{"filters[0].blurX":5}</tt> is a valid tweening property, as both
* array access (<tt>[]</tt>) and property access (<tt>.</tt>) syntax are
* supported.</p>
*
* <p>To manage a collection of objects being tweened simultaneously, use a
* <tt>Transitioner</tt> object.</p>
*/
public class Tween extends Transition
{
// -- Properties ------------------------------------------------------
private var _interps:Array = new Array();
private var _target:Object;
private var _from:Object;
private var _remove:Boolean = false;
private var _visible:Boolean = true;
private var _values:Object;
/** The target object whose properties are tweened. */
public function get target():Object { return _target; }
public function set target(t:Object):void { _target = t; }
/** Flag indicating if the target object should be removed from the
* display list at the end of the tween. Only applies when the target
* is a <code>DisplayObject</code>. */
public function get remove():Boolean { return _remove; }
public function set remove(b:Boolean):void { _remove = b; }
/** The properties to tween and their target values. */
public function get values():Object { return _values; }
public function set values(o:Object):void { _values = o; }
/** Optional starting values for tweened properties. */
public function get from():Object { return _from; }
public function set from(s:Object):void { _from = s; }
// - Methods ----------------------------------------------------------
/**
* Creates a new Tween with the specified parameters.
* @param target the target object
* @param duration the duration of the tween, in seconds
* @param values the properties to tween and their target values
* @param remove a display list removal flag (for
* <code>DisplayObject</code> target objects
* @param easing the easing function to use
*/
public function Tween(target:Object, duration:Number=1,
values:Object=null, remove:Boolean=false, easing:Function=null)
{
super(duration, 0, easing);
_target = target;
_remove = remove;
_values = values==null ? {} : values;
_from = {};
}
/** @inheritDoc */
public override function dispose():void
{
// reclaim any old interpolators
while (_interps.length > 0) {
Interpolator.reclaim(_interps.pop());
}
// remove all target values
for (var name:String in _values) {
delete _values[name];
}
_visible = true;
_remove = false;
_target = null;
}
/**
* Sets up this tween by creating interpolators for each tweened
* property.
*/
protected override function setup():void
{
// reclaim any old interpolators
while (_interps.length > 0) {
Interpolator.reclaim(_interps.pop());
}
// build interpolators
var vc:Object, v0:Object, v1:Object;
for (var name:String in _values) {
// create interpolator only if start/cur/end values don't match
vc = Property.$(name).getValue(_target);
v0 = _start.hasOwnProperty(name) ? _from[name] : vc;
v1 = _values[name];
if (vc != v1 || vc != v0) {
if (name == "visible") {
// special handling for visibility
_visible = Boolean(v1);
} else {
_interps.push(Interpolator.create(_target, name, v0, v1));
}
}
}
}
/**
* Updates target object visibility, if appropriate.
*/
protected override function start():void
{
// set visibility
var item:DisplayObject = _target as DisplayObject;
if (item != null && _visible) {
item.visible = _visible;
}
}
/**
* Steps the tween, updating the tweened properties.
*/
internal override function step(ef:Number):void
{
// run the interpolators
for each (var i:Interpolator in _interps) {
i.interpolate(ef);
}
}
/**
* Ends the tween, updating target object visibility and display
* list membership, if appropriate.
*/
protected override function end():void
{
// set visibility, remove from display list if requested
var item:DisplayObject = _target as DisplayObject;
if (item != null) {
if (_remove && item.parent != null)
item.parent.removeChild(item);
item.visible = _visible;
}
}
} // end of class Tween
}

View File

@ -1,65 +0,0 @@
package flare.animate.interpolate
{
import flare.util.Arrays;
/**
* Interpolator for numeric <code>Array</code> values. Each value
* contained in the array should be a numeric (<code>Number</code> or
* <code>int</code>) value.
*/
public class ArrayInterpolator extends Interpolator
{
private var _start:Array;
private var _end:Array;
private var _cur:Array;
/**
* Creates a new ArrayInterpolator.
* @param target the object whose property is being interpolated
* @param property the property to interpolate
* @param start the starting array of values to interpolate from
* @param end the target array to interpolate to. This should be an
* array of numerical values.
*/
public function ArrayInterpolator(target:Object, property:String,
start:Object, end:Object)
{
super(target, property, start, end);
}
/**
* Initializes this interpolator.
* @param start the starting value of the interpolation
* @param end the target value of the interpolation
*/
protected override function init(start:Object, end:Object) : void
{
_start = start as Array;
_end = end as Array;
if (!_end) throw new Error("Target array is null!");
if (!_start) _start = Arrays.copy(_end);
if (_start.length != _end.length)
throw new Error("Array dimensions don't match");
if (_cur == null || _cur == _start || _cur == _end) {
_cur = Arrays.copy(_start);
} else {
_cur = Arrays.copy(_start, _cur);
}
}
/**
* Calculate and set an interpolated property value.
* @param f the interpolation fraction (typically between 0 and 1)
*/
public override function interpolate(f:Number) : void
{
for (var i:uint=0; i<_cur.length; ++i) {
_cur[i] = _start[i] + f*(_end[i] - _start[i]);
}
_prop.setValue(_target, _cur);
}
} // end of class ArrayInterpolator
}

View File

@ -1,65 +0,0 @@
package flare.animate.interpolate
{
/**
* Interpolator for color (<code>uint</code>) values.
*/
public class ColorInterpolator extends Interpolator
{
private var _start:uint;
private var _end:uint;
/**
* Creates a new ColorInterpolator.
* @param target the object whose property is being interpolated
* @param property the property to interpolate
* @param start the starting color value to interpolate from
* @param end the target color value to interpolate to
*/
public function ColorInterpolator(target:Object, property:String,
start:Object, end:Object)
{
super(target, property, start, end);
}
/**
* Initializes this interpolator.
* @param start the starting value of the interpolation
* @param end the target value of the interpolation
*/
protected override function init(start:Object, end:Object) : void
{
_start = uint(start);
_end = uint(end);
}
/**
* Calculate and set an interpolated property value.
* @param f the interpolation fraction (typically between 0 and 1)
*/
public override function interpolate(f:Number) : void
{
// we'll do all the work here to avoid the overhead of
// extra method calls (rather than call Colors.interpolate)
var a1:uint, a2:uint, r1:uint, r2:uint,
g1:uint, g2:uint, b1:uint, b2:uint;
// get color components
a1 = (_start >> 24) & 0xFF; a2 = (_end >> 24) & 0xFF;
r1 = (_start >> 16) & 0xFF; r2 = (_end >> 16) & 0xFF;
g1 = (_start >> 8) & 0xFF; g2 = (_end >> 8) & 0xFF;
b1 = _start & 0xff; b2 = _end & 0xFF;
// interpolate the color components
a1 += f*(a2-a1); r1 += f*(r2-r1);
g1 += f*(g2-g1); b1 += f*(b2-b1);
// recombine into final color
a1 = ((a1 & 0xFF) << 24) | ((r1 & 0xFF) << 16) |
((g1 & 0xFF) << 8) | (b1 & 0xFF);
// update the property value
_prop.setValue(_target, a1);
}
} // end of class ColorInterpolator
}

View File

@ -1,48 +0,0 @@
package flare.animate.interpolate
{
/**
* Interpolator for <code>Date</code> values.
*/
public class DateInterpolator extends Interpolator
{
private var _start:Number;
private var _end:Number;
private var _d:Date;
/**
* Creates a new DateInterpolator.
* @param target the object whose property is being interpolated
* @param property the property to interpolate
* @param start the starting date value to interpolate from
* @param end the target date value to interpolate to
*/
public function DateInterpolator(target:Object, property:String,
start:Object, end:Object)
{
super(target, property, start, end);
}
/**
* Initializes this interpolator.
* @param start the starting value of the interpolation
* @param end the target value of the interpolation
*/
protected override function init(start:Object, end:Object) : void
{
_d = new Date();
_start = (start as Date).time;
_end = (end as Date).time - _start;
}
/**
* Calculate and set an interpolated property value.
* @param f the interpolation fraction (typically between 0 and 1)
*/
public override function interpolate(f:Number) : void
{
_d.time = _start + f * _end;
_prop.setValue(_target, _d);
}
} // end of class DateInterpolator
}

View File

@ -1,251 +0,0 @@
package flare.animate.interpolate
{
import flare.util.Property;
import flash.utils.getDefinitionByName;
import flash.utils.getQualifiedClassName;
/**
* Base class for value interpolators. This class also provides factory
* methods for creating concrete interpolator instances -- see the
* <code>create</code> method for details about interpolator creation.
*/
public class Interpolator
{
/** The target object whose property is being interpolated. */
protected var _target:Object;
/** The property to interpolate. */
protected var _prop:Property;
/**
* Base constructor for Interpolator instances.
* @param target the object whose property is being interpolated
* @param property the property to interpolate
* @param value the target value of the interpolation
*/
public function Interpolator(target:Object, property:String,
start:Object, end:Object)
{
reset(target, property, start, end);
}
/**
* Re-initializes an exising interpolator instance.
* @param target the object whose property is being interpolated
* @param property the property to interpolate
* @param value the target value of the interpolation
*/
public function reset(target:Object, property:String,
start:Object, end:Object):void
{
_target = target;
_prop = Property.$(property);
init(start, end);
}
/**
* Performs initialization of an interpolator, typically by
* initializing the start and ending values. Subclasses should
* override this method for custom initialization.
* @param value the target value of the interpolation
*/
protected function init(start:Object, end:Object) : void
{
// for subclasses to override
}
/**
* Calculate and set an interpolated property value. Subclasses should
* override this method to implement custom interpolation routines.
* @param f the interpolation fraction (typically between 0 and 1)
*/
public function interpolate(f:Number) : void
{
throw new Error("This is an abstract method");
}
// -- Interpolator Factory --------------------------------------------
private static var _maxPoolSize:int = 10000;
private static var _pools:Object = [];
private static var _lookup:Object = buildLookupTable();
private static var _rules:Array = buildRules();
private static function buildLookupTable() : Object
{
// add variables to ensure classes are included by compiler
var ni:NumberInterpolator;
var di:DateInterpolator;
var pi:PointInterpolator;
var ri:RectangleInterpolator;
var mi:MatrixInterpolator;
var ai:ArrayInterpolator;
var ci:ColorInterpolator;
var oi:ObjectInterpolator;
// build the value->interpolator lookup table
var lut:Object = new Object();
lut["Number"] = "flare.animate.interpolate::NumberInterpolator";
lut["int"] = "flare.animate.interpolate::NumberInterpolator";
lut["Date"] = "flare.animate.interpolate::DateInterpolator";
lut["Array"] = "flare.animate.interpolate::ArrayInterpolator";
lut["flash.geom::Point"] = "flare.animate.interpolate::PointInterpolator";
lut["flash.geom::Rectangle"] = "flare.animate.interpolate::RectangleInterpolator";
lut["flash.geom::Matrix"] = "flare.animate.interpolate::MatrixInterpolator";
return lut;
}
private static function buildRules() : Array
{
var rules:Array = new Array();
rules.push(isColor);
rules.push(isShape);
return rules;
}
private static function isColor(target:Object, property:String, s:Object, e:Object)
: String
{
return property.indexOf("Color")>=0 || property.indexOf("color")>=0
? "flare.animate.interpolate::ColorInterpolator"
: null;
}
private static function isShape(target:Object, property:String, s:Object, e:Object)
: String
{
return property == "shape"
? "flare.animate.interpolate::ObjectInterpolator"
: null;
}
/**
* Extends the interpolator factory with a new interpolator type.
* @param valueType the fully qualified class name for the object type
* to interpolate
* @param interpType the fully qualified class name for the
* interpolator class type
*/
public static function addInterpolatorType(valueType:String, interpType:String) : void
{
_lookup[valueType] = interpType;
}
/**
* Clears the lookup table of interpolator types, removing all
* type to interpolator mappings.
*/
public static function clearInterpolatorTypes():void
{
_lookup = new Object();
}
/**
* Adds a rule to the interpolator factory. The input function should
* take a target object, property name string, and target value as
* arguments and either return a fully qualified class name for the
* type of interpolator to use, or null if this rule does not apply.
* @param f the rule function for supplying custom interpolator types
* based on contextual conditions
*/
public static function addInterpolatorRule(f:Function):void
{
_rules.push(f);
}
/**
* Clears all interpolator rule functions from the interpolator
* factory.
*/
public static function clearInterpolatorRules():void
{
_rules = new Array();
}
/**
* Returns a new interpolator instance for the given target object,
* property name, and interpolation target value. This factory method
* follows these steps to provide an interpolator instance:
* <ol>
* <li>The list of installed interpolator rules is consulted, and if a
* rule returns a non-null class name string, an interpolator of
* that type will be returned.</li>
* <li>If all rules return null values, then the class type of the
* interpolation value is used to look up the appropriate
* interpolator type for that value. If a matching interpolator
* type is found, an interpolator is initialized and returned.
* </li>
* <li>If no matching type is found, a default ObjectInterpolator
* instance is initialized and returned.</li>
* </ol>
*
* <p>By default, the interpolator factory contains two rules. The
* first rule returns the class name of ColorInterpolator for any
* property names containing the string "color" or "Color". The second
* rule returns the class name of ObjectInterpolator for the property
* name "shape".</p>
*
* <p>The default value type to interpolator type mappings are:
* <ul>
* <li><code>Number -> NumberInterpolator</code></li>
* <li><code>int -> NumberInterpolator</code></li>
* <li><code>Date -> DateInterpolator</code></li>
* <li><code>Array -> ArrayInterpolator</code></li>
* <li><code>flash.geom.Point -> PointInterpolator</code></li>
* <li><code>flash.geom.Rectangle -> RectangleInterpolator</code></li>
* </ul>
* </p>
*
* <p>The interpolator factory can be extended either by adding new
* interpolation rule functions or by adding new mappings from
* interpolation value types to custom interpolator classes.</p>
*/
public static function create(target:Object, property:String,
start:Object, end:Object): Interpolator
{
// first, check the rules list for an interpolator
var name:String = null;
for (var i:uint=0; name==null && i<_rules.length; ++i) {
name = _rules[i](target, property, start, end);
}
// if no matching rule, use the type lookup table
if (name == null) {
name = _lookup[getQualifiedClassName(end)];
}
// if that fails, use ObjectInterpolator as default
if (name == null) {
name = "flare.animate.interpolate::ObjectInterpolator";
}
// now create the interpolator, recycling from the pool if possible
var pool:Array = _pools[name] as Array;
if (pool == null || pool.length == 0) {
// nothing in the pool, create a new instance
var Ref:Class = getDefinitionByName(name) as Class;
return new Ref(target, property, start, end) as Interpolator;
} else {
// reuse an interpolator from the object pool
var interp:Interpolator = pool.pop() as Interpolator;
interp.reset(target, property, start, end);
return interp;
}
}
/**
* Reclaims an interpolator for later recycling. The reclaimed
* interpolator should not be in active use by any other classes.
* @param interp the Interpolator to reclaim
*/
public static function reclaim(interp:Interpolator):void
{
var type:String = getQualifiedClassName(interp);
var pool:Array = _pools[type] as Array;
if (pool == null) {
_pools[type] = [interp];
} else if (pool.length < _maxPoolSize) {
pool.push(interp);
}
}
} // end of class Interpolator
}

View File

@ -1,70 +0,0 @@
package flare.animate.interpolate
{
import flash.geom.Matrix;
/**
* Interpolator for <code>flash.geom.Matrix</code> values.
*/
public class MatrixInterpolator extends Interpolator
{
private var _startA:Number, _startB:Number, _startC:Number;
private var _startD:Number, _startX:Number, _startY:Number;
private var _rangeA:Number, _rangeB:Number, _rangeC:Number;
private var _rangeD:Number, _rangeX:Number, _rangeY:Number;
private var _cur:Matrix;
/**
* Creates a new MatrixInterpolator.
* @param target the object whose property is being interpolated
* @param property the property to interpolate
* @param start the starting matrix value to interpolate from
* @param end the target matrix value to interpolate to
*/
public function MatrixInterpolator(target:Object, property:String,
start:Object, end:Object)
{
super(target, property, start, end);
}
/**
* Initializes this interpolator.
* @param start the starting value of the interpolation
* @param end the target value of the interpolation
*/
protected override function init(start:Object, end:Object) : void
{
var e:Matrix = Matrix(end), s:Matrix = Matrix(start);
if (_cur == null || _cur == s || _cur == e)
_cur = e.clone();
_startA = s.a;
_startB = s.b;
_startC = s.c;
_startD = s.d;
_startX = s.tx;
_startY = s.ty;
_rangeA = e.a - _startA;
_rangeB = e.b - _startB;
_rangeC = e.c - _startC;
_rangeD = e.d - _startD;
_rangeX = e.tx - _startX;
_rangeY = e.ty - _startY;
}
/**
* Calculate and set an interpolated property value.
* @param f the interpolation fraction (typically between 0 and 1)
*/
public override function interpolate(f:Number) : void
{
_cur.a = _startA + f * _rangeA;
_cur.b = _startB + f * _rangeB;
_cur.c = _startC + f * _rangeC;
_cur.d = _startD + f * _rangeD;
_cur.tx = _startX + f * _rangeX;
_cur.ty = _startY + f * _rangeY;
_prop.setValue(_target, _cur);
}
} // end of class MatrixInterpolator
}

View File

@ -1,47 +0,0 @@
package flare.animate.interpolate
{
/**
* Interpolator for <code>Number</code> and <code>int</code> values.
*/
public class NumberInterpolator extends Interpolator
{
private var _start:Number;
private var _end:Number;
/**
* Creates a new NumberInterpolator.
* @param target the object whose property is being interpolated
* @param property the property to interpolate
* @param start the starting number to interpolate from
* @param end the target number to interpolate to
*/
public function NumberInterpolator(target:Object, property:String,
start:Object, end:Object)
{
super(target, property, start, end);
}
/**
* Initializes this interpolator.
* @param start the starting value of the interpolation
* @param end the target value of the interpolation
*/
protected override function init(start:Object, end:Object) : void
{
_start = Number(start);
_end = Number(end);
if (isNaN(_start)) _start = _end;
_end = _end - _start;
}
/**
* Calculate and set an interpolated property value.
* @param f the interpolation fraction (typically between 0 and 1)
*/
public override function interpolate(f:Number) : void
{
_prop.setValue(_target, _start + f*_end);
}
} // end of class NumberInterpolator
}

View File

@ -1,50 +0,0 @@
package flare.animate.interpolate
{
/**
* Interpolator for arbitrary <code>Object</code> values. Simply swaps the
* initial value for the end value for interpolation fractions greater
* than or equal to 0.5.
*/
public class ObjectInterpolator extends Interpolator
{
private var _start:Object;
private var _end:Object;
/**
* Creates a new ObjectInterpolator.
* @param target the object whose property is being interpolated
* @param property the property to interpolate
* @param start the starting object value to interpolate from
* @param end the target object value to interpolate to
*/
public function ObjectInterpolator(target:Object, property:String,
start:Object, end:Object)
{
super(target, property, start, end);
}
/**
* Initializes this interpolator.
* @param start the starting value of the interpolation
* @param end the target value of the interpolation
*/
protected override function init(start:Object, end:Object) : void
{
_start = start;
_end = end;
}
/**
* Calculate and set an interpolated property value. This method sets
* the target object's property to the starting value if the
* interpolation fraction is less than 0.5 and to the ending value if
* the fraction is greather than or equal to 0.5.
* @param f the interpolation fraction (typically between 0 and 1)
*/
public override function interpolate(f:Number) : void
{
_prop.setValue(_target, f < 0.5 ? _start : _end);
}
} // end of class ObjectInterpolator
}

View File

@ -1,56 +0,0 @@
package flare.animate.interpolate
{
import flash.geom.Point;
/**
* Interpolator for <code>flash.geom.Point</code> values.
*/
public class PointInterpolator extends Interpolator
{
private var _startX:Number, _startY:Number;
private var _rangeX:Number, _rangeY:Number;
private var _cur:Point;
/**
* Creates a new PointInterpolator.
* @param target the object whose property is being interpolated
* @param property the property to interpolate
* @param start the starting point value to interpolate from
* @param end the target point value to interpolate to
*/
public function PointInterpolator(target:Object, property:String,
start:Object, end:Object)
{
super(target, property, start, end);
}
/**
* Initializes this interpolator.
* @param start the starting value of the interpolation
* @param end the target value of the interpolation
*/
protected override function init(start:Object, end:Object) : void
{
var e:Point = Point(end), s:Point = Point(start);
if (_cur == null || _cur == s || _cur == e)
_cur = e.clone();
_startX = s.x;
_startY = s.y;
_rangeX = e.x - _startX;
_rangeY = e.y - _startY;
}
/**
* Calculate and set an interpolated property value.
* @param f the interpolation fraction (typically between 0 and 1)
*/
public override function interpolate(f:Number) : void
{
_cur.x = _startX + f*_rangeX;
_cur.y = _startY + f*_rangeY;
_prop.setValue(_target, _cur);
}
} // end of class PointInterpolator
}

View File

@ -1,65 +0,0 @@
package flare.animate.interpolate
{
import flash.geom.Rectangle;
/**
* Interpolator for <code>flash.geom.Rectangle</code> values.
*/
public class RectangleInterpolator extends Interpolator
{
private var _startX:Number, _startY:Number;
private var _startW:Number, _startH:Number;
private var _rangeX:Number, _rangeY:Number;
private var _rangeW:Number, _rangeH:Number;
private var _cur:Rectangle;
/**
* Creates a new RectangleInterpolator.
* @param target the object whose property is being interpolated
* @param property the property to interpolate
* @param start the starting rectangle value to interpolate from
* @param end the target re3ctangle value to interpolate to
*/
public function RectangleInterpolator(target:Object, property:String,
start:Object, end:Object)
{
super(target, property, start, end);
}
/**
* Initializes this interpolator.
* @param start the starting value of the interpolation
* @param end the target value of the interpolation
*/
protected override function init(start:Object, end:Object) : void
{
var e:Rectangle = Rectangle(end), s:Rectangle = Rectangle(start);
if (_cur == null || _cur == s || _cur == e)
_cur = e.clone();
_startX = s.x;
_startY = s.y;
_startW = s.width;
_startH = s.height;
_rangeX = e.x - _startX;
_rangeY = e.y - _startY;
_rangeW = e.width - _startW;
_rangeH = e.height - _startH;
}
/**
* Calculate and set an interpolated property value.
* @param f the interpolation fraction (typically between 0 and 1)
*/
public override function interpolate(f:Number) : void
{
_cur.x = _startX + f * _rangeX;
_cur.y = _startY + f * _rangeY;
_cur.width = _startW + f * _rangeW;
_cur.height = _startH + f * _rangeH;
_prop.setValue(_target, _cur);
}
} // end of class RectangleInterpolator
}

View File

@ -1,16 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<actionScriptProperties mainApplicationPath="flaredata.as" version="3">
<compiler additionalCompilerArguments="" copyDependentFiles="false" enableModuleDebug="true" generateAccessible="false" htmlExpressInstall="true" htmlGenerate="false" htmlHistoryManagement="false" htmlPlayerVersion="9.0.28" htmlPlayerVersionCheck="true" outputFolderPath="bin" strict="true" useApolloConfig="false" verifyDigests="true" warn="true">
<compilerSourcePath/>
<libraryPath defaultLinkType="1">
<libraryPathEntry kind="4" path=""/>
<libraryPathEntry kind="3" linkType="1" path="/flare.util/bin/flare.util.swc" useDefaultLinkType="false"/>
</libraryPath>
<sourceAttachmentPath/>
</compiler>
<applications>
<application path="flaredata.as"/>
</applications>
<modules/>
<buildCSSFiles/>
</actionScriptProperties>

View File

@ -1,16 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<flexLibProperties version="1">
<includeClasses>
<classEntry path="flare.data.DataField"/>
<classEntry path="flare.data.DataUtil"/>
<classEntry path="flare.data.converters.DelimitedTextConverter"/>
<classEntry path="flare.data.converters.JSONConverter"/>
<classEntry path="flare.data.converters.GraphMLConverter"/>
<classEntry path="flare.data.DataSchema"/>
<classEntry path="flare.data.DataSource"/>
<classEntry path="flare.data.DataSet"/>
<classEntry path="flare.data.DataTable"/>
</includeClasses>
<includeResources/>
<namespaceManifests/>
</flexLibProperties>

View File

@ -1,19 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>flare.data</name>
<comment></comment>
<projects>
<project>flare.util</project>
</projects>
<buildSpec>
<buildCommand>
<name>com.adobe.flexbuilder.project.flexbuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>com.adobe.flexbuilder.project.flexlibnature</nature>
<nature>com.adobe.flexbuilder.project.actionscriptnature</nature>
</natures>
</projectDescription>

View File

@ -1,89 +0,0 @@
/*
Adobe Systems Incorporated(r) Source Code License Agreement
Copyright(c) 2005 Adobe Systems Incorporated. All rights reserved.
Please read this Source Code License Agreement carefully before using
the source code.
Adobe Systems Incorporated grants to you a perpetual, worldwide, non-exclusive,
no-charge, royalty-free, irrevocable copyright license, to reproduce,
prepare derivative works of, publicly display, publicly perform, and
distribute this source code and such derivative works in source or
object code form without any attribution requirements.
The name "Adobe Systems Incorporated" must not be used to endorse or promote products
derived from the source code without prior written permission.
You agree to indemnify, hold harmless and defend Adobe Systems Incorporated from and
against any loss, damage, claims or lawsuits, including attorney's
fees that arise or result from your use or distribution of the source
code.
THIS SOURCE CODE IS PROVIDED "AS IS" AND "WITH ALL FAULTS", WITHOUT
ANY TECHNICAL SUPPORT OR ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING,
BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. ALSO, THERE IS NO WARRANTY OF
NON-INFRINGEMENT, TITLE OR QUIET ENJOYMENT. IN NO EVENT SHALL MACROMEDIA
OR ITS SUPPLIERS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOURCE CODE, EVEN IF
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package com.adobe.serialization.json {
/**
* This class provides encoding and decoding of the JSON format.
*
* Example usage:
* <code>
* // create a JSON string from an internal object
* JSON.encode( myObject );
*
* // read a JSON string into an internal object
* var myObject:Object = JSON.decode( jsonString );
* </code>
* @private
*/
public class JSON {
/**
* Encodes a object into a JSON string.
*
* @param o The object to create a JSON string for
* @return the JSON string representing o
* @langversion ActionScript 3.0
* @playerversion Flash 8.5
* @tiptext
*/
public static function encode( o:Object ):String {
var encoder:JSONEncoder = new JSONEncoder( o );
return encoder.getString();
}
/**
* Decodes a JSON string into a native object.
*
* @param s The JSON string representing the object
* @return A native object as specified by s
* @throw JSONParseError
* @langversion ActionScript 3.0
* @playerversion Flash 8.5
* @tiptext
*/
public static function decode( s:String ):Object {
var decoder:JSONDecoder = new JSONDecoder( s )
return decoder.getObject();
}
}
}

View File

@ -1,223 +0,0 @@
/*
Adobe Systems Incorporated(r) Source Code License Agreement
Copyright(c) 2005 Adobe Systems Incorporated. All rights reserved.
Please read this Source Code License Agreement carefully before using
the source code.
Adobe Systems Incorporated grants to you a perpetual, worldwide, non-exclusive,
no-charge, royalty-free, irrevocable copyright license, to reproduce,
prepare derivative works of, publicly display, publicly perform, and
distribute this source code and such derivative works in source or
object code form without any attribution requirements.
The name "Adobe Systems Incorporated" must not be used to endorse or promote products
derived from the source code without prior written permission.
You agree to indemnify, hold harmless and defend Adobe Systems Incorporated from and
against any loss, damage, claims or lawsuits, including attorney's
fees that arise or result from your use or distribution of the source
code.
THIS SOURCE CODE IS PROVIDED "AS IS" AND "WITH ALL FAULTS", WITHOUT
ANY TECHNICAL SUPPORT OR ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING,
BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. ALSO, THERE IS NO WARRANTY OF
NON-INFRINGEMENT, TITLE OR QUIET ENJOYMENT. IN NO EVENT SHALL MACROMEDIA
OR ITS SUPPLIERS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOURCE CODE, EVEN IF
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package com.adobe.serialization.json {
/**
* @private
*/
public class JSONDecoder {
/** The object that will get parsed from the JSON string */
private var obj:Object;
/** The tokenizer designated to read the JSON string */
private var tokenizer:JSONTokenizer;
/** The current token from the tokenizer */
private var token:JSONToken;
/**
* Constructs a new JSONDecoder to parse a JSON string
* into a native object.
*
* @param s The JSON string to be converted
* into a native object
* @langversion ActionScript 3.0
* @playerversion Flash 8.5
* @tiptext
*/
public function JSONDecoder( s:String ) {
tokenizer = new JSONTokenizer( s );
nextToken();
obj = parseValue();
}
/**
* Gets the internal object that was created by parsing
* the JSON string passed to the constructor.
*
* @return The internal object representation of the JSON
* string that was passed to the constructor
* @langversion ActionScript 3.0
* @playerversion Flash 8.5
* @tiptext
*/
public function getObject():Object {
return obj;
}
/**
* Returns the next token from the tokenzier reading
* the JSON string
*/
private function nextToken():JSONToken {
return token = tokenizer.getNextToken();
}
/**
* Attempt to parse an array
*/
private function parseArray():Array {
// create an array internally that we're going to attempt
// to parse from the tokenizer
var a:Array = new Array();
// grab the next token from the tokenizer to move
// past the opening [
nextToken();
// check to see if we have an empty array
if ( token.type == JSONTokenType.RIGHT_BRACKET ) {
// we're done reading the array, so return it
return a;
}
// deal with elements of the array, and use an "infinite"
// loop because we could have any amount of elements
while ( true ) {
// read in the value and add it to the array
a.push ( parseValue() );
// after the value there should be a ] or a ,
nextToken();
if ( token.type == JSONTokenType.RIGHT_BRACKET ) {
// we're done reading the array, so return it
return a;
} else if ( token.type == JSONTokenType.COMMA ) {
// move past the comma and read another value
nextToken();
} else {
tokenizer.parseError( "Expecting ] or , but found " + token.value );
}
}
return null;
}
/**
* Attempt to parse an object
*/
private function parseObject():Object {
// create the object internally that we're going to
// attempt to parse from the tokenizer
var o:Object = new Object();
// store the string part of an object member so
// that we can assign it a value in the object
var key:String
// grab the next token from the tokenizer
nextToken();
// check to see if we have an empty object
if ( token.type == JSONTokenType.RIGHT_BRACE ) {
// we're done reading the object, so return it
return o;
}
// deal with members of the object, and use an "infinite"
// loop because we could have any amount of members
while ( true ) {
if ( token.type == JSONTokenType.STRING ) {
// the string value we read is the key for the object
key = String( token.value );
// move past the string to see what's next
nextToken();
// after the string there should be a :
if ( token.type == JSONTokenType.COLON ) {
// move past the : and read/assign a value for the key
nextToken();
o[key] = parseValue();
// move past the value to see what's next
nextToken();
// after the value there's either a } or a ,
if ( token.type == JSONTokenType.RIGHT_BRACE ) {
// // we're done reading the object, so return it
return o;
} else if ( token.type == JSONTokenType.COMMA ) {
// skip past the comma and read another member
nextToken();
} else {
tokenizer.parseError( "Expecting } or , but found " + token.value );
}
} else {
tokenizer.parseError( "Expecting : but found " + token.value );
}
} else {
tokenizer.parseError( "Expecting string but found " + token.value );
}
}
return null;
}
/**
* Attempt to parse a value
*/
private function parseValue():Object {
switch ( token.type ) {
case JSONTokenType.LEFT_BRACE:
return parseObject();
case JSONTokenType.LEFT_BRACKET:
return parseArray();
case JSONTokenType.STRING:
case JSONTokenType.NUMBER:
case JSONTokenType.TRUE:
case JSONTokenType.FALSE:
case JSONTokenType.NULL:
return token.value;
default:
tokenizer.parseError( "Unexpected " + token.value );
}
return null;
}
}
}

View File

@ -1,276 +0,0 @@
/*
Adobe Systems Incorporated(r) Source Code License Agreement
Copyright(c) 2005 Adobe Systems Incorporated. All rights reserved.
Please read this Source Code License Agreement carefully before using
the source code.
Adobe Systems Incorporated grants to you a perpetual, worldwide, non-exclusive,
no-charge, royalty-free, irrevocable copyright license, to reproduce,
prepare derivative works of, publicly display, publicly perform, and
distribute this source code and such derivative works in source or
object code form without any attribution requirements.
The name "Adobe Systems Incorporated" must not be used to endorse or promote products
derived from the source code without prior written permission.
You agree to indemnify, hold harmless and defend Adobe Systems Incorporated from and
against any loss, damage, claims or lawsuits, including attorney's
fees that arise or result from your use or distribution of the source
code.
THIS SOURCE CODE IS PROVIDED "AS IS" AND "WITH ALL FAULTS", WITHOUT
ANY TECHNICAL SUPPORT OR ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING,
BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. ALSO, THERE IS NO WARRANTY OF
NON-INFRINGEMENT, TITLE OR QUIET ENJOYMENT. IN NO EVENT SHALL MACROMEDIA
OR ITS SUPPLIERS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOURCE CODE, EVEN IF
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package com.adobe.serialization.json {
/**
* @private
*/
public class JSONEncoder {
/** The string that is going to represent the object we're encoding */
private var jsonString:String;
/**
* Creates a new JSONEncoder.
*
* @param o The object to encode as a JSON string
* @langversion ActionScript 3.0
* @playerversion Flash 8.5
* @tiptext
*/
public function JSONEncoder( o:Object ) {
jsonString = convertToString( o );
}
/**
* Gets the JSON string from the encoder.
*
* @return The JSON string representation of the object
* that was passed to the constructor
* @langversion ActionScript 3.0
* @playerversion Flash 8.5
* @tiptext
*/
public function getString():String {
return jsonString;
}
/**
* Converts a value to it's JSON string equivalent.
*
* @param value The value to convert. Could be any
* type (object, number, array, etc)
*/
private function convertToString( value:Object ):String {
// determine what value is and convert it based on it's type
if ( value is String ) {
// escape the string so it's formatted correctly
return escapeString( value as String );
} else if ( value is Number ) {
// only encode numbers that finate
return isFinite( value as Number) ? value.toString() : "null";
} else if ( value is Boolean ) {
// convert boolean to string easily
return value ? "true" : "false";
} else if ( value is Array ) {
// call the helper method to convert an array
return arrayToString( value as Array );
} else if ( value is Object && value != null ) {
// call the helper method to convert an object
return objectToString( value );
}
return "null";
}
/**
* Escapes a string accoding to the JSON specification.
*
* @param str The string to be escaped
* @return The string with escaped special characters
* according to the JSON specification
*/
private function escapeString( str:String ):String {
// create a string to store the string's jsonstring value
var s:String = "";
// current character in the string we're processing
var ch:String;
// store the length in a local variable to reduce lookups
var len:Number = str.length;
// loop over all of the characters in the string
for ( var i:int = 0; i < len; i++ ) {
// examine the character to determine if we have to escape it
ch = str.charAt( i );
switch ( ch ) {
case '"': // quotation mark
s += "\\\"";
break;
//case '/': // solidus
// s += "\\/";
// break;
case '\\': // reverse solidus
s += "\\\\";
break;
case '\b': // bell
s += "\\b";
break;
case '\f': // form feed
s += "\\f";
break;
case '\n': // newline
s += "\\n";
break;
case '\r': // carriage return
s += "\\r";
break;
case '\t': // horizontal tab
s += "\\t";
break;
default: // everything else
// check for a control character and escape as unicode
if ( ch < ' ' ) {
// get the hex digit(s) of the character (either 1 or 2 digits)
var hexCode:String = ch.charCodeAt( 0 ).toString( 16 );
// ensure that there are 4 digits by adjusting
// the # of zeros accordingly.
var zeroPad:String = hexCode.length == 2 ? "00" : "000";
// create the unicode escape sequence with 4 hex digits
s += "\\u" + zeroPad + hexCode;
} else {
// no need to do any special encoding, just pass-through
s += ch;
}
} // end switch
} // end for loop
return "\"" + s + "\"";
}
/**
* Converts an array to it's JSON string equivalent
*
* @param a The array to convert
* @return The JSON string representation of <code>a</code>
*/
private function arrayToString( a:Array ):String {
// create a string to store the array's jsonstring value
var s:String = "";
// loop over the elements in the array and add their converted
// values to the string
for ( var i:int = 0; i < a.length; i++ ) {
// when the length is 0 we're adding the first element so
// no comma is necessary
if ( s.length > 0 ) {
// we've already added an element, so add the comma separator
s += ","
}
// convert the value to a string
s += convertToString( a[i] );
}
// KNOWN ISSUE: In ActionScript, Arrays can also be associative
// objects and you can put anything in them, ie:
// myArray["foo"] = "bar";
//
// These properties aren't picked up in the for loop above because
// the properties don't correspond to indexes. However, we're
// sort of out luck because the JSON specification doesn't allow
// these types of array properties.
//
// So, if the array was also used as an associative object, there
// may be some values in the array that don't get properly encoded.
//
// A possible solution is to instead encode the Array as an Object
// but then it won't get decoded correctly (and won't be an
// Array instance)
// close the array and return it's string value
return "[" + s + "]";
}
/**
* Converts an object to it's JSON string equivalent
*
* @param o The object to convert
* @return The JSON string representation of <code>o</code>
*/
private function objectToString( o:Object ):String {
// create a string to store the object's jsonstring value
var s:String = "";
// the value of o[key] in the loop below - store this
// as a variable so we don't have to keep looking up o[key]
// when testing for valid values to convert
var value:Object;
// loop over the keys in the object and add their converted
// values to the string
for ( var key:String in o ) {
// assign value to a variable for quick lookup
value = o[key];
// don't add function's to the JSON string
if ( value is Function ) {
// skip this key and try another
continue;
}
// when the length is 0 we're adding the first item so
// no comma is necessary
if ( s.length > 0 ) {
// we've already added an item, so add the comma separator
s += ","
}
s += escapeString( key ) + ":" + convertToString( value );
}
return "{" + s + "}";
}
}
}

View File

@ -1,89 +0,0 @@
/*
Adobe Systems Incorporated(r) Source Code License Agreement
Copyright(c) 2005 Adobe Systems Incorporated. All rights reserved.
Please read this Source Code License Agreement carefully before using
the source code.
Adobe Systems Incorporated grants to you a perpetual, worldwide, non-exclusive,
no-charge, royalty-free, irrevocable copyright license, to reproduce,
prepare derivative works of, publicly display, publicly perform, and
distribute this source code and such derivative works in source or
object code form without any attribution requirements.
The name "Adobe Systems Incorporated" must not be used to endorse or promote products
derived from the source code without prior written permission.
You agree to indemnify, hold harmless and defend Adobe Systems Incorporated from and
against any loss, damage, claims or lawsuits, including attorney's
fees that arise or result from your use or distribution of the source
code.
THIS SOURCE CODE IS PROVIDED "AS IS" AND "WITH ALL FAULTS", WITHOUT
ANY TECHNICAL SUPPORT OR ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING,
BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. ALSO, THERE IS NO WARRANTY OF
NON-INFRINGEMENT, TITLE OR QUIET ENJOYMENT. IN NO EVENT SHALL MACROMEDIA
OR ITS SUPPLIERS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOURCE CODE, EVEN IF
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package com.adobe.serialization.json {
/**
* @private
*/
public class JSONParseError extends Error {
/** The location in the string where the error occurred */
private var _location:int;
/** The string in which the parse error occurred */
private var _text:String;
/**
* Constructs a new JSONParseError.
*
* @param message The error message that occured during parsing
* @langversion ActionScript 3.0
* @playerversion Flash 8.5
* @tiptext
*/
public function JSONParseError( message:String = "", location:int = 0, text:String = "") {
super( message );
//name = "JSONParseError";
_location = location;
_text = text;
}
/**
* Provides read-only access to the location variable.
*
* @return The location in the string where the error occurred
* @langversion ActionScript 3.0
* @playerversion Flash 8.5
* @tiptext
*/
public function get location():int {
return _location;
}
/**
* Provides read-only access to the text variable.
*
* @return The string in which the error occurred
* @langversion ActionScript 3.0
* @playerversion Flash 8.5
* @tiptext
*/
public function get text():String {
return _text;
}
}
}

View File

@ -1,110 +0,0 @@
/*
Adobe Systems Incorporated(r) Source Code License Agreement
Copyright(c) 2005 Adobe Systems Incorporated. All rights reserved.
Please read this Source Code License Agreement carefully before using
the source code.
Adobe Systems Incorporated grants to you a perpetual, worldwide, non-exclusive,
no-charge, royalty-free, irrevocable copyright license, to reproduce,
prepare derivative works of, publicly display, publicly perform, and
distribute this source code and such derivative works in source or
object code form without any attribution requirements.
The name "Adobe Systems Incorporated" must not be used to endorse or promote products
derived from the source code without prior written permission.
You agree to indemnify, hold harmless and defend Adobe Systems Incorporated from and
against any loss, damage, claims or lawsuits, including attorney's
fees that arise or result from your use or distribution of the source
code.
THIS SOURCE CODE IS PROVIDED "AS IS" AND "WITH ALL FAULTS", WITHOUT
ANY TECHNICAL SUPPORT OR ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING,
BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. ALSO, THERE IS NO WARRANTY OF
NON-INFRINGEMENT, TITLE OR QUIET ENJOYMENT. IN NO EVENT SHALL MACROMEDIA
OR ITS SUPPLIERS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOURCE CODE, EVEN IF
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package com.adobe.serialization.json {
/**
* @private
*/
public class JSONToken {
private var _type:int;
private var _value:Object;
/**
* Creates a new JSONToken with a specific token type and value.
*
* @param type The JSONTokenType of the token
* @param value The value of the token
* @langversion ActionScript 3.0
* @playerversion Flash 8.5
* @tiptext
*/
public function JSONToken( type:int = -1 /* JSONTokenType.UNKNOWN */, value:Object = null ) {
_type = type;
_value = value;
}
/**
* Returns the type of the token.
*
* @see com.adobe.serialization.json.JSONTokenType
* @langversion ActionScript 3.0
* @playerversion Flash 8.5
* @tiptext
*/
public function get type():int {
return _type;
}
/**
* Sets the type of the token.
*
* @see com.adobe.serialization.json.JSONTokenType
* @langversion ActionScript 3.0
* @playerversion Flash 8.5
* @tiptext
*/
public function set type( value:int ):void {
_type = value;
}
/**
* Gets the value of the token
*
* @see com.adobe.serialization.json.JSONTokenType
* @langversion ActionScript 3.0
* @playerversion Flash 8.5
* @tiptext
*/
public function get value():Object {
return _value;
}
/**
* Sets the value of the token
*
* @see com.adobe.serialization.json.JSONTokenType
* @langversion ActionScript 3.0
* @playerversion Flash 8.5
* @tiptext
*/
public function set value ( v:Object ):void {
_value = v;
}
}
}

View File

@ -1,71 +0,0 @@
/*
Adobe Systems Incorporated(r) Source Code License Agreement
Copyright(c) 2005 Adobe Systems Incorporated. All rights reserved.
Please read this Source Code License Agreement carefully before using
the source code.
Adobe Systems Incorporated grants to you a perpetual, worldwide, non-exclusive,
no-charge, royalty-free, irrevocable copyright license, to reproduce,
prepare derivative works of, publicly display, publicly perform, and
distribute this source code and such derivative works in source or
object code form without any attribution requirements.
The name "Adobe Systems Incorporated" must not be used to endorse or promote products
derived from the source code without prior written permission.
You agree to indemnify, hold harmless and defend Adobe Systems Incorporated from and
against any loss, damage, claims or lawsuits, including attorney's
fees that arise or result from your use or distribution of the source
code.
THIS SOURCE CODE IS PROVIDED "AS IS" AND "WITH ALL FAULTS", WITHOUT
ANY TECHNICAL SUPPORT OR ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING,
BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. ALSO, THERE IS NO WARRANTY OF
NON-INFRINGEMENT, TITLE OR QUIET ENJOYMENT. IN NO EVENT SHALL MACROMEDIA
OR ITS SUPPLIERS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOURCE CODE, EVEN IF
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package com.adobe.serialization.json {
/**
* Class containing constant values for the different types
* of tokens in a JSON encoded string.
* @private
*/
public class JSONTokenType {
public static const UNKNOWN:int = -1;
public static const COMMA:int = 0;
public static const LEFT_BRACE:int = 1;
public static const RIGHT_BRACE:int = 2;
public static const LEFT_BRACKET:int = 3;
public static const RIGHT_BRACKET:int = 4;
public static const COLON:int = 6;
public static const TRUE:int = 7;
public static const FALSE:int = 8;
public static const NULL:int = 9;
public static const STRING:int = 10;
public static const NUMBER:int = 11;
}
}

View File

@ -1,499 +0,0 @@
/*
Adobe Systems Incorporated(r) Source Code License Agreement
Copyright(c) 2005 Adobe Systems Incorporated. All rights reserved.
Please read this Source Code License Agreement carefully before using
the source code.
Adobe Systems Incorporated grants to you a perpetual, worldwide, non-exclusive,
no-charge, royalty-free, irrevocable copyright license, to reproduce,
prepare derivative works of, publicly display, publicly perform, and
distribute this source code and such derivative works in source or
object code form without any attribution requirements.
The name "Adobe Systems Incorporated" must not be used to endorse or promote products
derived from the source code without prior written permission.
You agree to indemnify, hold harmless and defend Adobe Systems Incorporated from and
against any loss, damage, claims or lawsuits, including attorney's
fees that arise or result from your use or distribution of the source
code.
THIS SOURCE CODE IS PROVIDED "AS IS" AND "WITH ALL FAULTS", WITHOUT
ANY TECHNICAL SUPPORT OR ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING,
BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. ALSO, THERE IS NO WARRANTY OF
NON-INFRINGEMENT, TITLE OR QUIET ENJOYMENT. IN NO EVENT SHALL MACROMEDIA
OR ITS SUPPLIERS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOURCE CODE, EVEN IF
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package com.adobe.serialization.json {
/**
* @private
*/
public class JSONTokenizer {
/** The object that will get parsed from the JSON string */
private var obj:Object;
/** The JSON string to be parsed */
private var jsonString:String;
/** The current parsing location in the JSON string */
private var loc:int;
/** The current character in the JSON string during parsing */
private var ch:String;
/**
* Constructs a new JSONDecoder to parse a JSON string
* into a native object.
*
* @param s The JSON string to be converted
* into a native object
*/
public function JSONTokenizer( s:String ) {
jsonString = s;
loc = 0;
// prime the pump by getting the first character
nextChar();
}
/**
* Gets the next token in the input sting and advances
* the character to the next character after the token
*/
public function getNextToken():JSONToken {
var token:JSONToken = new JSONToken();
// skip any whitespace / comments since the last
// token was read
skipIgnored();
// examine the new character and see what we have...
switch ( ch ) {
case '{':
token.type = JSONTokenType.LEFT_BRACE;
token.value = '{';
nextChar();
break
case '}':
token.type = JSONTokenType.RIGHT_BRACE;
token.value = '}';
nextChar();
break
case '[':
token.type = JSONTokenType.LEFT_BRACKET;
token.value = '[';
nextChar();
break
case ']':
token.type = JSONTokenType.RIGHT_BRACKET;
token.value = ']';
nextChar();
break
case ',':
token.type = JSONTokenType.COMMA;
token.value = ',';
nextChar();
break
case ':':
token.type = JSONTokenType.COLON;
token.value = ':';
nextChar();
break;
case 't': // attempt to read true
var possibleTrue:String = "t" + nextChar() + nextChar() + nextChar();
if ( possibleTrue == "true" ) {
token.type = JSONTokenType.TRUE;
token.value = true;
nextChar();
} else {
parseError( "Expecting 'true' but found " + possibleTrue );
}
break;
case 'f': // attempt to read false
var possibleFalse:String = "f" + nextChar() + nextChar() + nextChar() + nextChar();
if ( possibleFalse == "false" ) {
token.type = JSONTokenType.FALSE;
token.value = false;
nextChar();
} else {
parseError( "Expecting 'false' but found " + possibleFalse );
}
break;
case 'n': // attempt to read null
var possibleNull:String = "n" + nextChar() + nextChar() + nextChar();
if ( possibleNull == "null" ) {
token.type = JSONTokenType.NULL;
token.value = null;
nextChar();
} else {
parseError( "Expecting 'null' but found " + possibleNull );
}
break;
case '"': // the start of a string
token = readString();
break;
default:
// see if we can read a number
if ( isDigit( ch ) || ch == '-' ) {
token = readNumber();
} else if ( ch == '' ) {
// check for reading past the end of the string
return null;
} else {
// not sure what was in the input string - it's not
// anything we expected
parseError( "Unexpected " + ch + " encountered" );
}
}
return token;
}
/**
* Attempts to read a string from the input string. Places
* the character location at the first character after the
* string. It is assumed that ch is " before this method is called.
*
* @return the JSONToken with the string value if a string could
* be read. Throws an error otherwise.
*/
private function readString():JSONToken {
// the token for the string we'll try to read
var token:JSONToken = new JSONToken();
token.type = JSONTokenType.STRING;
// the string to store the string we'll try to read
var string:String = "";
// advance past the first "
nextChar();
while ( ch != '"' && ch != '' ) {
// unescape the escape sequences in the string
if ( ch == '\\' ) {
// get the next character so we know what
// to unescape
nextChar();
switch ( ch ) {
case '"': // quotation mark
string += '"';
break;
case '/': // solidus
string += "/";
break;
case '\\': // reverse solidus
string += '\\';
break;
case 'b': // bell
string += '\b';
break;
case 'f': // form feed
string += '\f';
break;
case 'n': // newline
string += '\n';
break;
case 'r': // carriage return
string += '\r';
break;
case 't': // horizontal tab
string += '\t'
break;
case 'u':
// convert a unicode escape sequence
// to it's character value - expecting
// 4 hex digits
// save the characters as a string we'll convert to an int
var hexValue:String = "";
// try to find 4 hex characters
for ( var i:int = 0; i < 4; i++ ) {
// get the next character and determine
// if it's a valid hex digit or not
if ( !isHexDigit( nextChar() ) ) {
parseError( " Excepted a hex digit, but found: " + ch );
}
// valid, add it to the value
hexValue += ch;
}
// convert hexValue to an integer, and use that
// integrer value to create a character to add
// to our string.
string += String.fromCharCode( parseInt( hexValue, 16 ) );
break;
default:
// couldn't unescape the sequence, so just
// pass it through
string += '\\' + ch;
}
} else {
// didn't have to unescape, so add the character to the string
string += ch;
}
// move to the next character
nextChar();
}
// we read past the end of the string without closing it, which
// is a parse error
if ( ch == '' ) {
parseError( "Unterminated string literal" );
}
// move past the closing " in the input string
nextChar();
// attach to the string to the token so we can return it
token.value = string;
return token;
}
/**
* Attempts to read a number from the input string. Places
* the character location at the first character after the
* number.
*
* @return The JSONToken with the number value if a number could
* be read. Throws an error otherwise.
*/
private function readNumber():JSONToken {
// the token for the number we'll try to read
var token:JSONToken = new JSONToken();
token.type = JSONTokenType.NUMBER;
// the string to accumulate the number characters
// into that we'll convert to a number at the end
var input:String = "";
// check for a negative number
if ( ch == '-' ) {
input += '-';
nextChar();
}
// read numbers while we can
while ( isDigit( ch ) ) {
input += ch;
nextChar();
}
// check for a decimal value
if ( ch == '.' ) {
input += '.';
nextChar();
// read more numbers to get the decimal value
while ( isDigit( ch ) ) {
input += ch;
nextChar();
}
}
//Application.application.show( "number = " + input );
// conver the string to a number value
var num:Number = Number( input );
if ( isFinite( num ) ) {
token.value = num;
return token;
} else {
parseError( "Number " + num + " is not valid!" );
}
return null;
}
/**
* Reads the next character in the input
* string and advances the character location.
*
* @return The next character in the input string, or
* null if we've read past the end.
*/
private function nextChar():String {
return ch = jsonString.charAt( loc++ );
}
/**
* Advances the character location past any
* sort of white space and comments
*/
private function skipIgnored():void {
skipWhite();
skipComments();
skipWhite();
}
/**
* Skips comments in the input string, either
* single-line or multi-line. Advances the character
* to the first position after the end of the comment.
*/
private function skipComments():void {
if ( ch == '/' ) {
// Advance past the first / to find out what type of comment
nextChar();
switch ( ch ) {
case '/': // single-line comment, read through end of line
// Loop over the characters until we find
// a newline or until there's no more characters left
do {
nextChar();
} while ( ch != '\n' && ch != '' )
// move past the \n
nextChar();
break;
case '*': // multi-line comment, read until closing */
// move past the opening *
nextChar();
// try to find a trailing */
while ( true ) {
if ( ch == '*' ) {
// check to see if we have a closing /
nextChar();
if ( ch == '/') {
// move past the end of the closing */
nextChar();
break;
}
} else {
// move along, looking if the next character is a *
nextChar();
}
// when we're here we've read past the end of
// the string without finding a closing */, so error
if ( ch == '' ) {
parseError( "Multi-line comment not closed" );
}
}
break;
// Can't match a comment after a /, so it's a parsing error
default:
parseError( "Unexpected " + ch + " encountered (expecting '/' or '*' )" );
}
}
}
/**
* Skip any whitespace in the input string and advances
* the character to the first character after any possible
* whitespace.
*/
private function skipWhite():void {
// As long as there are spaces in the input
// stream, advance the current location pointer
// past them
while ( isSpace( ch ) ) {
nextChar();
}
}
/**
* Determines if a character is whitespace or not.
*
* @return True if the character passed in is a whitespace
* character
*/
private function isSpace( ch:String ):Boolean {
return ( ch == ' ' || ch == '\t' );
}
/**
* Determines if a character is a digit [0-9].
*
* @return True if the character passed in is a digit
*/
private function isDigit( ch:String ):Boolean {
return ( ch >= '0' && ch <= '9' );
}
/**
* Determines if a character is a digit [0-9].
*
* @return True if the character passed in is a digit
*/
private function isHexDigit( ch:String ):Boolean {
// get the uppercase value of ch so we only have
// to compare the value between 'A' and 'F'
var uc:String = ch.toUpperCase();
// a hex digit is a digit of A-F, inclusive ( using
// our uppercase constraint )
return ( isDigit( ch ) || ( uc >= 'A' && uc <= 'F' ) );
}
/**
* Raises a parsing error with a specified message, tacking
* on the error location and the original string.
*
* @param message The message indicating why the error occurred
*/
public function parseError( message:String ):void {
throw new JSONParseError( message, loc, jsonString );
}
}
}

View File

@ -1,52 +0,0 @@
package flare.data
{
/**
* Represents metadata for an individual data field.
*/
public class DataField
{
private var _id:String;
private var _name:String;
private var _format:String;
private var _label:String;
private var _type:int;
private var _def:Object;
/** A unique id for the data field, often the name. */
public function get id():String { return _id; }
/** The name of the data field. */
public function get name():String { return _name; }
/** A formatting string for printing values of this field.
* @see flare.util.Stings#format
*/
public function get format():String { return _format; }
/** A label describing this data field, useful for axis titles. */
public function get label():String { return _label; }
/** The data type of this field.
* @see flare.data.DataUtil. */
public function get type():int { return _type; }
/** The default value for this data field. */
public function get defaultValue():Object { return _def; }
/**
* Creates a new DataField.
* @param name the name of the data field
* @param type the data type of this field
* @param def the default value of this field
* @param id a unique id for the field. If null, the name will be used
* @param format a formatting string for printing values of this field
* @param label a label describing this data field
*/
public function DataField(name:String, type:int, def:Object=null,
id:String=null, format:String=null, label:String=null)
{
_name = name;
_type = type;
_def = def;
_id = (id==null ? name : id);
_format = format;
_label = label==null ? name : _label;
}
} // end of class DataField
}

View File

@ -1,81 +0,0 @@
package flare.data
{
import flare.util.Arrays;
/**
* A DataSchema represents a set of data variables and their associated
* types. A schema maintains a collection of <code>DataField</code>
* objects.
* @see flare.data.DataField
*/
public class DataSchema
{
public var dataRoot:String = null;
public var hasHeader:Boolean = false;
private var _fields:/*DataField*/Array = [];
private var _nameLookup:/*String->DataField*/Object = {};
private var _idLookup:/*String->DataField*/Object = {};
/** An array containing the data fields in this schema. */
public function get fields():Array { return Arrays.copy(_fields); }
/** The number of data fields in this schema. */
public function get numFields():int { return _fields.length; }
/**
* Creates a new DataSchema.
* @param fields an ordered list of data fields to include in the
* schema
*/
public function DataSchema(...fields)
{
for each (var f:DataField in fields) {
addField(f);
}
}
/**
* Adds a field to this schema.
* @param field the data field to add
*/
public function addField(field:DataField):void
{
_fields.push(field);
_nameLookup[field.name] = field;
_idLookup[field.id] = field;
}
/**
* Retrieves a data field by name.
* @param name the data field name
* @return the corresponding data field, or null if no data field is
* found matching the name
*/
public function getFieldByName(name:String):DataField
{
return _nameLookup[name];
}
/**
* Retrieves a data field by id.
* @param name the data field id
* @return the corresponding data field, or null if no data field is
* found matching the id
*/
public function getFieldById(id:String):DataField
{
return _idLookup[id];
}
/**
* Retrieves a data field by its index in this schema.
* @param idx the index of the data field in this schema
* @return the corresponding data field
*/
public function getFieldAt(idx:int):DataField
{
return _fields[idx];
}
} // end of class DataSchema
}

View File

@ -1,26 +0,0 @@
package flare.data
{
/**
* A data set is a collection of one or more data tables that represent
* a table or graph data structure.
*/
public class DataSet
{
/**
* Creates a new DataSet.
* @param nodes a data table of node data
* @param edges a data table of edge data (optional, for graphs only)
*/
public function DataSet(nodes:DataTable, edges:DataTable=null) {
this.nodes = nodes;
this.edges = edges;
}
/** A DataTable of nodes (or table rows). */
public var nodes:DataTable = null;
/** A DataTable of edges. */
public var edges:DataTable = null;
} // end of class DataSet
}

View File

@ -1,90 +0,0 @@
package flare.data
{
import flash.net.URLRequest;
import flash.net.URLStream;
import flash.utils.IDataInput;
import flare.data.converters.IDataConverter;
import flash.net.URLLoader;
import flash.events.Event;
import flare.data.converters.Converters;
import flash.utils.ByteArray;
import flash.net.URLLoaderDataFormat;
import flash.events.ProgressEvent;
/**
* The DataSource class provides access to remote data on the Internet.
* A DataSource requires a URL for retrieving a data file, and a format
* string representing the data format. The currently supported formats are
* "tab" (Tab-Delimited Text) and "json" (JavaScript Object Notation).
* Additionally, a DataSource can be given a schema object describing the
* data fields and their types (int, Number, Date, String, etc). If no
* schema is provided, the data converter for the particular format will
* attempt to infer the data types directly from the data itself.
*
* <p>Once a DataSource has been created, use the <tt>load</tt> method to
* initiate data loading. This method returns a <tt>URLLoader</tt>
* instance. Add a listener to the URLLoader's COMPLETE event to be
* notified when loading and parsing has been completed. When a COMPLETE
* event is issued, the URLLoader's <tt>data</tt> property will contain the
* loaded and parsed data set.</p>
*/
public class DataSource
{
private var _url:String;
private var _format:String;
private var _schema:DataSchema;
/** The URL of the remote data set. */
public function get url():String { return _url; }
/** The format of the remote data set (e.g., "tab" or "json"). */
public function get format():String { return _format; }
/** A schema describing the attributes of the data set. */
public function get schema():DataSchema { return _schema; }
/**
* Creates a new DataSource.
* @param url the URL of the remote data set
* @param format the format of the remote data set (e.g., "tab" or
* "json")
* @param schema an optional schema describing the attibutes of the
* data set
*/
public function DataSource(url:String, format:String, schema:DataSchema=null)
{
_url = url;
_format = format;
_schema = schema;
}
/**
* Initiates loading of the data set. When the load completes, a data
* converter instance is used to convert the retrieved data set into
* ActionScript objects. The parsed data is then available through the
* <code>data</code> property of the returned <code>URLLoader</code>.
* @return a URLLoader instance responsible for loading the data set.
* Add an event listener for the <code>COMPLETE</code> event to be
* notified when data loading has completed.
*/
public function load():URLLoader
{
var loader:URLLoader = new URLLoader();
loader.dataFormat = URLLoaderDataFormat.BINARY;
loader.addEventListener(Event.COMPLETE,
function(evt:Event):void {
var conv:IDataConverter = Converters.lookup(_format);
loader.data = conv.read(loader.data, _schema);
}
);
loader.load(new URLRequest(_url));
return loader;
}
/* TODO later -- support streaming data
public function stream():URLStream
{
}
*/
} // end of class DataSource
}

View File

@ -1,27 +0,0 @@
package flare.data
{
/**
* A table of data that maintains a collection of data objects, each
* representing a row of data, and an optional data schema describing
* the data variables.
*/
public class DataTable
{
/**
* Creates a new data table instance.
* @param data an array of tuples, each tuple is a row of data
* @param schema an optional DataSchema describing the data columns
*/
public function DataTable(data:Array, schema:DataSchema=null) {
this.data = data;
this.schema = schema;
}
/** A DataSchema describing the data columns of the table. */
public var schema:DataSchema;
/** An array of data objects, each representing a row of data. */
public var data:Array;
} // end of class DataTable
}

View File

@ -1,112 +0,0 @@
package flare.data
{
/**
* Utility class for parsing and representing data field values.
*/
public class DataUtil
{
/** Constant indicating a numeric data type. */
public static const NUMBER:int = 0;
/** Constant indicating an integer data type. */
public static const INT:int = 1;
/** Constant indicating a Date data type. */
public static const DATE:int = 2;
/** Constant indicating a String data type. */
public static const STRING:int = 3;
/** Constant indicating an arbitrary Object data type. */
public static const OBJECT:int = 4;
/** Constant indicating a boolean data type. */
public static const BOOLEAN:int = 5;
/**
* Parse an input value given its data type.
* @param val the value to parse
* @param type the data type to parse as
* @return the parsed data value
*/
public static function parseValue(val:Object, type:int):Object
{
switch (type) {
case NUMBER:
return Number(val);
case INT:
return int(val);
case BOOLEAN:
return Boolean(val);
case DATE:
var t:Number = val is Number ? Number(val)
: Date.parse(String(val));
return isNaN(t) ? null : new Date(t);
case STRING:
return String(val);
default: return val;
}
}
/**
* Returns the data type for the input string value. This method
* attempts to parse the value as a number of different data types.
* If successful, the matching data type is returned. If no parse
* succeeds, this method returns the <code>STRING</code> constant.
* @param s the string to parse
* @return the inferred data type of the string contents
*/
public static function type(s:String):int
{
if (!isNaN(Number(s))) return NUMBER;
if (!isNaN(Date.parse(s))) return DATE;
return STRING;
}
/**
* Infers the data schema by checking values of the input data.
* @param lines an array of lines of input text
* @return the inferred schema
*/
public static function inferSchema(tuples:Array):DataSchema
{
if (tuples==null || tuples.length==0) return null;
var header:Array = [];
for (var name:String in tuples[0]) {
header.push(name);
}
var types:Array = new Array(header.length);
// initialize data types
for (var col:int=0; col<header.length; ++col) {
types[col] = DataUtil.type(tuples[0][header[col]]);
}
// now process data to infer types
for (var i:int = 2; i<tuples.length; ++i) {
var tuple:Object = tuples[i];
for (col=0; col<header.length; ++col) {
name = header[col];
var value:Object = tuple[name];
if (types[col] == -1 || value==null) continue;
var type:int =
value is Boolean ? BOOLEAN :
value is Date ? DATE :
value is int ? INT :
value is Number ? NUMBER :
value is String ? STRING : OBJECT;
if (types[col] != type) {
types[col] = -1;
}
}
}
// finally, we create the schema
var schema:DataSchema = new DataSchema();
for (col=0; col<header.length; ++col) {
schema.addField(new DataField(header[col],
types[col]==-1 ? DataUtil.STRING : types[col]));
}
return schema;
}
} // end of class DataUtil
}

View File

@ -1,27 +0,0 @@
package flare.data.converters
{
/**
* Factory class for looking up the appropriate IDataConverter for a
* given data format.
*/
public class Converters
{
private static var _lookup:Object = {
"json":new JSONConverter(),
"tab":new DelimitedTextConverter("\t"),
"graphml":new GraphMLConverter()
};
/**
* Returns a data converter for the input format type.
* @param type a format string (e.g., "tab" or "json").
* @return a data converter for the provided format, or null if no
* matching converter was found.
*/
public static function lookup(type:String):IDataConverter
{
return _lookup[type.toLowerCase()];
}
} // end of class Converters
}

View File

@ -1,143 +0,0 @@
package flare.data.converters
{
import flare.data.DataField;
import flare.data.DataSchema;
import flare.data.DataSet;
import flare.data.DataTable;
import flare.data.DataUtil;
import flash.utils.ByteArray;
import flash.utils.IDataInput;
import flash.utils.IDataOutput;
/**
* Converts data between delimited text (e.g., tab delimited) and
* flare DataSet instances.
*/
public class DelimitedTextConverter implements IDataConverter
{
private var _delim:String;
public function get delimiter():String { return _delim; }
public function set delimiter(d:String):void { _delim = d; }
/**
* Creates a new DelimitedTextConverter.
* @param delim the delimiter string separating values (tab by default)
*/
public function DelimitedTextConverter(delim:String="\t")
{
_delim = delim;
}
/**
* @inheritDoc
*/
public function read(input:IDataInput, schema:DataSchema=null):DataSet
{
return parse(input.readUTFBytes(input.bytesAvailable), schema);
}
/**
* Converts data from a tab-delimited string into ActionScript objects.
* @param input the loaded input data
* @param schema a data schema describing the structure of the data.
* Schemas are optional in many but not all cases.
* @param data an array in which to write the converted data objects.
* If this value is null, a new array will be created.
* @return an array of converted data objects. If the <code>data</code>
* argument is non-null, it is returned.
*/
public function parse(text:String, schema:DataSchema=null):DataSet
{
var tuples:Array = [];
var lines:Array = text.split(/\r\n|\r|\n/);
if (schema == null) {
schema = inferSchema(lines);
}
var i:int = schema.hasHeader ? 1 : 0;
for (; i<lines.length; ++i) {
var line:String = lines[i];
if (line.length == 0) break;
var tok:Array = line.split(_delim);
var tuple:Object = {};
for (var j:int=0; j<schema.numFields; ++j) {
var field:DataField = schema.getFieldAt(j);
tuple[field.name] = DataUtil.parseValue(tok[j], field.type);
}
tuples.push(tuple);
}
return new DataSet(new DataTable(tuples, schema));
}
/**
* @inheritDoc
*/
public function write(data:DataSet, output:IDataOutput=null):IDataOutput
{
if (output==null) output = new ByteArray();
var tuples:Array = data.nodes.data;
var schema:DataSchema = data.nodes.schema;
for each (var tuple:Object in tuples) {
var i:int = 0, s:String;
if (schema == null) {
for (var name:String in tuple) {
if (i>0) output.writeUTFBytes(_delim);
output.writeUTFBytes(String(tuple[name])); // TODO: proper string formatting
++i;
}
} else {
for (;i<schema.numFields; ++i) {
var f:DataField = schema.getFieldAt(i);
if (i>0) output.writeUTFBytes(_delim);
output.writeUTFBytes(String(tuple[f.name])); // TODO proper string formatting
}
}
output.writeUTFBytes("\n");
}
return output;
}
/**
* Infers the data schema by checking values of the input data.
* @param lines an array of lines of input text
* @return the inferred schema
*/
protected function inferSchema(lines:Array):DataSchema
{
var header:Array = lines[0].split(_delim);
var types:Array = new Array(header.length);
// initialize data types
var tok:Array = lines[1].split(_delim);
for (var col:int=0; col<header.length; ++col) {
types[col] = DataUtil.type(tok[col]);
}
// now process data to infer types
for (var i:int = 2; i<lines.length; ++i) {
tok = lines[i].split(_delim);
for (col=0; col<tok.length; ++col) {
if (types[col] == -1) continue;
var type:int = DataUtil.type(tok[col]);
if (types[col] != type) {
types[col] = -1;
}
}
}
// finally, we create the schema
var schema:DataSchema = new DataSchema();
schema.hasHeader = true;
for (col=0; col<header.length; ++col) {
schema.addField(new DataField(header[col],
types[col]==-1 ? DataUtil.STRING : types[col]));
}
return schema;
}
} // end of class DelimitedTextConverter
}

View File

@ -1,292 +0,0 @@
package flare.data.converters
{
import flare.data.DataField;
import flare.data.DataSchema;
import flare.data.DataSet;
import flare.data.DataTable;
import flare.data.DataUtil;
import flash.utils.ByteArray;
import flash.utils.IDataInput;
import flash.utils.IDataOutput;
/**
* Converts data between GraphML markup and flare DataSet instances.
* <a href="http://graphml.graphdrawing.org/">GraphML</a> is a
* standardized XML format supporting graph structure and typed data
* schemas for both nodes and edges.
*/
public class GraphMLConverter implements IDataConverter
{
// -- reader ----------------------------------------------------------
/** @inheritDoc */
public function read(input:IDataInput, schema:DataSchema=null):DataSet
{
return parse(XML(input.readUTFBytes(input.bytesAvailable)), schema);
}
/**
* Parses a GraphML XML object into a DataSet instance.
* @param graphml the XML object containing GraphML markup
* @param schema a DataSchema (typically null, as GraphML contains
* schema information)
* @return the parsed DataSet instance
*/
public function parse(graphml:XML, schema:DataSchema=null):DataSet
{
var lookup:Object = {};
var nodes:Array = [], n:Object;
var edges:Array = [], e:Object;
var id:String, sid:String, tid:String;
var def:Object, type:int;
var group:String, attrName:String, attrType:String;
var nodeSchema:DataSchema = new DataSchema();
var edgeSchema:DataSchema = new DataSchema();
var schema:DataSchema;
// set schema defaults
nodeSchema.addField(new DataField(ID, DataUtil.STRING));
edgeSchema.addField(new DataField(ID, DataUtil.STRING));
edgeSchema.addField(new DataField(SOURCE, DataUtil.STRING));
edgeSchema.addField(new DataField(TARGET, DataUtil.STRING));
edgeSchema.addField(new DataField(DIRECTED, DataUtil.BOOLEAN,
DIRECTED == graphml.graph.@edgedefault));
// parse data schema
for each (var key:XML in graphml..key) {
id = key.@[ID].toString();
group = key.@[FOR].toString();
attrName = key.@[ATTRNAME].toString();
type = toType(key.@[ATTRTYPE].toString());
def = key[DEFAULT].toString();
def = def != null && def.length > 0
? DataUtil.parseValue(def, type) : null;
schema = (group==EDGE ? edgeSchema : nodeSchema);
schema.addField(new DataField(attrName, type, def, id));
}
// parse nodes
for each (var node:XML in graphml..node) {
id = node.@[ID].toString();
lookup[id] = (n = parseData(node, nodeSchema));
nodes.push(n);
}
// parse edges
for each (var edge:XML in graphml..edge) {
id = edge.@[ID].toString();
sid = edge.@[SOURCE].toString();
tid = edge.@[TARGET].toString();
// error checking
if (!lookup.hasOwnProperty(sid))
error("Edge "+id+" references unknown node: "+sid);
if (!lookup.hasOwnProperty(tid))
error("Edge "+id+" references unknown node: "+tid);
edges.push(e = parseData(edge, edgeSchema));
}
return new DataSet(
new DataTable(nodes, nodeSchema),
new DataTable(edges, edgeSchema)
);
}
private function parseData(node:XML, schema:DataSchema):Object {
var n:Object = {};
var name:String, field:DataField, value:Object;
// set default values
for (var i:int=0; i<schema.numFields; ++i) {
field = schema.getFieldAt(i);
n[field.name] = field.defaultValue;
}
// get attribute values
for each (var attr:XML in node.@*) {
name = attr.name().toString();
field = schema.getFieldByName(name);
n[name] = DataUtil.parseValue(attr[0].toString(), field.type);
}
// get data values in XML
for each (var data:XML in node.data) {
field = schema.getFieldById(data.@[KEY].toString());
name = field.name;
n[name] = DataUtil.parseValue(data[0].toString(), field.type);
}
return n;
}
// -- writer ----------------------------------------------------------
/** @inheritDoc */
public function write(data:DataSet, output:IDataOutput=null):IDataOutput
{
// init GraphML
var graphml:XML = new XML(GRAPHML_HEADER);
// add schema
graphml = addSchema(graphml, data.nodes.schema, NODE, NODE_ATTR);
graphml = addSchema(graphml, data.edges.schema, EDGE, EDGE_ATTR);
// add graph data
var graph:XML = new XML(<graph/>);
var ed:Object = data.edges.schema.getFieldByName(DIRECTED).defaultValue;
graph.@[EDGEDEF] = ed==DIRECTED ? DIRECTED : UNDIRECTED;
addData(graph, data.nodes.data, data.nodes.schema, NODE, NODE_ATTR);
addData(graph, data.edges.data, data.edges.schema, EDGE, EDGE_ATTR);
graphml = graphml.appendChild(graph);
if (output == null) output = new ByteArray();
output.writeUTFBytes(graphml.toXMLString());
return output;
}
private static function addSchema(xml:XML, schema:DataSchema,
group:String, attrs:Object):XML
{
var field:DataField;
for (var i:int=0; i<schema.numFields; ++i) {
field = schema.getFieldAt(i);
if (attrs.hasOwnProperty(field.name)) continue;
var key:XML = new XML(<key/>);
key.@[ID] = field.id;
key.@[FOR] = group;
key.@[ATTRNAME] = field.name;
key.@[ATTRTYPE] = fromType(field.type);
if (field.defaultValue != null) {
var def:XML = new XML(<default/>);
def.appendChild(toString(field.defaultValue, field.type));
key.appendChild(def);
}
xml = xml.appendChild(key);
}
return xml;
}
private static function addData(xml:XML, tuples:Array,
schema:DataSchema, tag:String, attrs:Object):void
{
for each (var tuple:Object in tuples) {
var x:XML = new XML("<"+tag+"/>");
for (var name:String in tuple) {
var field:DataField = schema.getFieldByName(name);
if (tuple[name] == field.defaultValue) continue;
if (attrs.hasOwnProperty(name)) {
// add as attribute
x.@[name] = toString(tuple[name], field.type);
} else {
// add as data child tag
var data:XML = new XML(<data/>);
data.@[KEY] = field.id;
data.appendChild(toString(tuple[name], field.type));
x.appendChild(data);
}
}
xml.appendChild(x);
}
}
// -- static helpers --------------------------------------------------
private static function toString(o:Object, type:int):String
{
return o.toString(); // TODO: formatting control?
}
private static function toType(type:String):int {
switch (type) {
case INT:
case INTEGER:
return DataUtil.INT;
case LONG:
case FLOAT:
case DOUBLE:
case REAL:
return DataUtil.NUMBER;
case BOOLEAN:
return DataUtil.BOOLEAN;
case DATE:
return DataUtil.DATE;
case STRING:
default:
return DataUtil.STRING;
}
}
private static function fromType(type:int):String {
switch (type) {
case DataUtil.INT: return INT;
case DataUtil.BOOLEAN: return BOOLEAN;
case DataUtil.NUMBER: return DOUBLE;
case DataUtil.DATE: return DATE;
case DataUtil.STRING:
default: return STRING;
}
}
private static function error(msg:String):void {
throw new Error(msg);
}
// -- constants -------------------------------------------------------
private static const NODE_ATTR:Object = {
"id":1
}
private static const EDGE_ATTR:Object = {
"id":1, "directed":1, "source":1, "target":1
};
private static const GRAPHML_HEADER:String = "<graphml/>";
// "<graphml xmlns=\"http://graphml.graphdrawing.org/xmlns\""
// +" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\""
// +" xsi:schemaLocation=\"http://graphml.graphdrawing.org/xmlns"
// +" http://graphml.graphdrawing.org/xmlns/1.0/graphml.xsd\">"
// +"</graphml>";
private static const GRAPHML:String = "graphml";
private static const ID:String = "id";
private static const GRAPH:String = "graph";
private static const EDGEDEF:String = "edgedefault";
private static const DIRECTED:String = "directed";
private static const UNDIRECTED:String = "undirected";
private static const KEY:String = "key";
private static const FOR:String = "for";
private static const ALL:String = "all";
private static const ATTRNAME:String = "attr.name";
private static const ATTRTYPE:String = "attr.type";
private static const DEFAULT:String = "default";
private static const NODE:String = "node";
private static const EDGE:String = "edge";
private static const SOURCE:String = "source";
private static const TARGET:String = "target";
private static const DATA:String = "data";
private static const TYPE:String = "type";
private static const INT:String = "int";
private static const INTEGER:String = "integer";
private static const LONG:String = "long";
private static const FLOAT:String = "float";
private static const DOUBLE:String = "double";
private static const REAL:String = "real";
private static const BOOLEAN:String = "boolean";
private static const STRING:String = "string";
private static const DATE:String = "date";
} // end of class GraphMLConverter
}

View File

@ -1,36 +0,0 @@
package flare.data.converters
{
import flare.data.DataSchema;
import flare.data.DataSet;
import flash.utils.IDataInput;
import flash.utils.IDataOutput;
/**
* Interface for data converters that map between an external data file
* format and ActionScript objects (e.g., Arrays and Objects).
*/
public interface IDataConverter
{
/**
* Converts data from an external format into ActionScript objects.
* @param input the loaded input data
* @param schema a data schema describing the structure of the data.
* Schemas are optional in many but not all cases.
* @return a DataSet instance containing converted data objects.
*/
function read(input:IDataInput, schema:DataSchema=null):DataSet;
/**
* Converts data from ActionScript objects into an external format.
* @param data the data set to write.
* @param output an object to which to write the output. If this value
* is null, a new <code>ByteArray</code> will be created.
* @return the converted data. If the <code>output</code> parameter is
* non-null, it is returned. Otherwise the return value will be a
* newly created <code>ByteArray</code>
*/
function write(data:DataSet, output:IDataOutput=null):IDataOutput;
} // end of interface IDataConverter
}

View File

@ -1,76 +0,0 @@
package flare.data.converters
{
import com.adobe.serialization.json.JSON;
import flare.data.DataField;
import flare.data.DataSchema;
import flare.data.DataSet;
import flare.data.DataTable;
import flare.data.DataUtil;
import flare.util.Property;
import flash.utils.ByteArray;
import flash.utils.IDataInput;
import flash.utils.IDataOutput;
/**
* Converts data between JSON (JavaScript Object Notation) strings and
* flare DataSet instances.
*/
public class JSONConverter implements IDataConverter
{
/**
* @inheritDoc
*/
public function read(input:IDataInput, schema:DataSchema=null):DataSet
{
var data:Array;
return new DataSet(new DataTable(
data = parse(input.readUTFBytes(input.bytesAvailable), schema),
schema ? schema : DataUtil.inferSchema(data)
));
}
/**
* Converts data from a JSON string into ActionScript objects.
* @param input the loaded input data
* @param schema a data schema describing the structure of the data.
* Schemas are optional in many but not all cases.
* @param data an array in which to write the converted data objects.
* If this value is null, a new array will be created.
* @return an array of converted data objects. If the <code>data</code>
* argument is non-null, it is returned.
*/
public function parse(text:String, schema:DataSchema):Array
{
var json:Object = JSON.decode(text) as Object;
var list:Array = json as Array;
if (schema != null) {
if (schema.dataRoot) {
// if nested, extract data array
list = Property.$(schema.dataRoot).getValue(json);
}
// convert value types according to schema
for each (var t:Object in list) {
for each (var f:DataField in schema.fields) {
t[f.name] = DataUtil.parseValue(t[f.name], f.type);
}
}
}
return list;
}
/**
* @inheritDoc
*/
public function write(data:DataSet, output:IDataOutput=null):IDataOutput
{
var tuples:Array = data.nodes.data;
if (output==null) output = new ByteArray();
output.writeUTFBytes(JSON.encode(tuples));
return output;
}
} // end of class JSONConverter
}

View File

@ -1,33 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<actionScriptProperties mainApplicationPath="demos.as" version="3">
<compiler additionalCompilerArguments="" copyDependentFiles="true" enableModuleDebug="true" generateAccessible="false" htmlExpressInstall="true" htmlGenerate="true" htmlHistoryManagement="true" htmlPlayerVersion="9.0.28" htmlPlayerVersionCheck="true" outputFolderPath="bin" strict="true" useApolloConfig="false" verifyDigests="true" warn="true">
<compilerSourcePath/>
<libraryPath defaultLinkType="1">
<libraryPathEntry kind="4" path="">
<excludedEntries>
<libraryPathEntry kind="3" linkType="1" path="${PROJECT_FRAMEWORKS}/libs/automation_charts.swc" useDefaultLinkType="false"/>
<libraryPathEntry kind="1" linkType="1" path="${PROJECT_FRAMEWORKS}/locale/{locale}"/>
<libraryPathEntry kind="3" linkType="1" path="${PROJECT_FRAMEWORKS}/libs/qtp.swc" useDefaultLinkType="false"/>
<libraryPathEntry kind="3" linkType="1" path="${PROJECT_FRAMEWORKS}/libs/charts.swc" useDefaultLinkType="false"/>
<libraryPathEntry kind="3" linkType="1" path="${PROJECT_FRAMEWORKS}/libs/rpc.swc" useDefaultLinkType="false"/>
<libraryPathEntry kind="3" linkType="1" path="${PROJECT_FRAMEWORKS}/libs/datavisualization.swc" useDefaultLinkType="false"/>
<libraryPathEntry kind="3" linkType="1" path="${PROJECT_FRAMEWORKS}/libs/framework.swc" useDefaultLinkType="false"/>
<libraryPathEntry kind="3" linkType="1" path="${PROJECT_FRAMEWORKS}/libs/automation.swc" useDefaultLinkType="false"/>
<libraryPathEntry kind="3" linkType="1" path="${PROJECT_FRAMEWORKS}/libs/automation_dmv.swc" useDefaultLinkType="false"/>
<libraryPathEntry kind="3" linkType="1" path="${PROJECT_FRAMEWORKS}/libs/automation_agent.swc" useDefaultLinkType="false"/>
</excludedEntries>
</libraryPathEntry>
<libraryPathEntry kind="3" linkType="1" path="/flare.animate/bin/flare.animate.swc" useDefaultLinkType="false"/>
<libraryPathEntry kind="3" linkType="1" path="/flare.physics/bin/flare.physics.swc" useDefaultLinkType="false"/>
<libraryPathEntry kind="3" linkType="1" path="/flare.util/bin/flare.util.swc" useDefaultLinkType="false"/>
<libraryPathEntry kind="3" linkType="1" path="/flare.vis/bin/flare.vis.swc" useDefaultLinkType="false"/>
<libraryPathEntry kind="3" linkType="1" path="/flare.data/bin/flare.data.swc" useDefaultLinkType="false"/>
</libraryPath>
<sourceAttachmentPath/>
</compiler>
<applications>
<application path="demos.as"/>
</applications>
<modules/>
<buildCSSFiles/>
</actionScriptProperties>

View File

@ -1,21 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>flare.demos</name>
<comment></comment>
<projects>
<project>flare.animate</project>
<project>flare.physics</project>
<project>flare.util</project>
<project>flare.vis</project>
</projects>
<buildSpec>
<buildCommand>
<name>com.adobe.flexbuilder.project.flexbuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>com.adobe.flexbuilder.project.actionscriptnature</nature>
</natures>
</projectDescription>

View File

@ -1,141 +0,0 @@
package
{
import flash.display.Sprite;
import flare.animate.Transitioner;
import flash.display.DisplayObject;
import flare.animate.Sequence;
import flare.animate.Tween;
import flare.animate.Easing;
import flash.filters.GlowFilter;
import flare.animate.Pause;
import flare.animate.Transition;
import flare.animate.Parallel;
public class FlareLogo extends Sprite
{
private var points:Array = [
/*f*/ 0,2, 1,1, 1,2, 1,3, 1,4, 1,5, 1,6, 1,7, 2,0, 2,2, 3,0, 3,2,
/*l*/ 5,0, 5,7, 6,0, 6,1, 6,2, 6,3, 6,4, 6,5, 6,6, 6,7, 7,7,
/*a*/ 9,5, 9,6, 10,2, 10,4, 10,7, 11,2, 11,4, 11,7, 12,2, 12,4, 12,6, 13,3, 13,4, 13,5, 13,6, 13,7,
/*r*/ 15,2, 15,3, 15,4, 15,5, 15,6, 15,7, 16,3, 17,2, 18,2, 19,3,
/*e*/ 21,3, 21,4, 21,5, 21,6, 22,2, 22,4, 22,7, 23,2, 23,4, 23,7, 24,2, 24,4, 24,7, 25,3, 25,4, 25,7
];
private var w:Number = 10;
private var h:Number = 10;
private var xb:Number = -25/2;
private var yb:Number = -7/2;
private var _dance:Transition;
private var _glow:Transition;
public function FlareLogo()
{
var inc:Number = 2, linc:Number = 4;
var con:Sprite = new Sprite();
for (var i:int=0; i<points.length; i+=2) {
var s:Sprite = new Sprite();
s.graphics.beginFill(0, 1);
s.graphics.drawRect(-(w+inc)/2,-(h+inc)/2,w+inc,h+inc);
s.graphics.endFill();
con.addChild(s);
}
addChild(con);
layoutT(con, Transitioner.DEFAULT, 0);
var seq:Sequence = new Sequence(
new Pause(6),
layoutT(con, new Transitioner(3), linc),
layoutY(con, new Transitioner(2,Easing.easeOutBounce), linc),
new Pause(1),
layoutC(con, new Transitioner(3,Easing.easeInPoly(3)), linc),
new Tween(con, 6, {rotation:180}, false, Easing.easeInPoly(3)),
new Parallel(
new Tween(con, 6, {rotation:360}, false, Easing.easeOutPoly(3)),
layoutX(con, new Transitioner(6), linc)
),
new Tween(con, 0, {rotation:0}),
layoutT(con, new Transitioner(3), linc),
layoutT(con, new Transitioner(3), 0),
new Pause(21)
);
seq.onEnd = function():void { seq.play(); }
_dance = seq;
// do the glow...
con.filters = [new GlowFilter(0xff0000, 0.5, 0, 0)];
var g1:Tween = new Tween(con,3,{"filters[0].blurX":15,"filters[0].blurY":15});
var g2:Tween = new Tween(con,3,{"filters[0].blurX":0,"filters[0].blurY":0});
g1.easing = g2.easing = Easing.none;
var glow:Sequence = new Sequence(g1,g2);
glow.easing = Easing.easeInOutPoly(2);
glow.onEnd = function():void { glow.play(); }
_glow = glow;
}
public function play():void {
_dance.play();
_glow.play();
}
public function pause():void {
_dance.pause();
_glow.pause();
}
private function layoutT(s:Sprite, t:Transitioner, a:Number):Transitioner
{
for (var i:int=0; i<s.numChildren; ++i) {
var b:DisplayObject = s.getChildAt(i);
t.$(b).x = (w+a) * (xb + points[2*i]);
t.$(b).y = (h+a) * (yb + points[2*i+1]);
}
return t;
}
private function layoutX(s:Sprite, t:Transitioner, a:Number):Transitioner
{
var xc:Object = {}; for (var i:int=0; i<8; ++i) xc[i] = 0;
for (i=0; i<s.numChildren; ++i) {
var b:DisplayObject = s.getChildAt(i);
t.$(b).x = 100 + (w+a) * (xb + xc[points[2*i+1]]);
t.$(b).y = (h+a) * (yb + points[2*i+1]);
xc[points[2*i+1]]++;
}
return t;
}
private function layoutY(s:Sprite, t:Transitioner, a:Number):Transitioner
{
var yc:Object = {}; for (var i:int=0; i<26; ++i) yc[i] = 7;
for (i=s.numChildren; --i>=0;) {
var b:DisplayObject = s.getChildAt(i);
t.$(b).x = (w+a) * (xb + points[2*i]);
t.$(b).y = (h+a) * (yb + yc[points[2*i]]);
yc[points[2*i]]--;
}
return t;
}
private function layoutC(s:Sprite, t:Transitioner, a:Number):Transitioner
{
var sort:Array = new Array(s.numChildren);
for (var i:int=0; i<s.numChildren; ++i) {
var b:DisplayObject = s.getChildAt(i);
sort[i] = Math.atan2(b.y, b.x);
}
sort = sort.sort(Array.NUMERIC | Array.RETURNINDEXEDARRAY);
for (i=0; i<sort.length; ++i) {
var f:Number = 1.0 - i / s.numChildren;
b = s.getChildAt(sort[i]);
t.$(b).x = -200 * Math.cos(2*Math.PI*f);
t.$(b).y = 200 * Math.sin(2*Math.PI*f);
}
return t;
}
}
}

View File

@ -1,275 +0,0 @@
// Flash Player Version Detection - Rev 1.6
// Detect Client Browser type
// Copyright(c) 2005-2006 Adobe Macromedia Software, LLC. All rights reserved.
var isIE = (navigator.appVersion.indexOf("MSIE") != -1) ? true : false;
var isWin = (navigator.appVersion.toLowerCase().indexOf("win") != -1) ? true : false;
var isOpera = (navigator.userAgent.indexOf("Opera") != -1) ? true : false;
function ControlVersion()
{
var version;
var axo;
var e;
// NOTE : new ActiveXObject(strFoo) throws an exception if strFoo isn't in the registry
try {
// version will be set for 7.X or greater players
axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");
version = axo.GetVariable("$version");
} catch (e) {
}
if (!version)
{
try {
// version will be set for 6.X players only
axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");
// installed player is some revision of 6.0
// GetVariable("$version") crashes for versions 6.0.22 through 6.0.29,
// so we have to be careful.
// default to the first public version
version = "WIN 6,0,21,0";
// throws if AllowScripAccess does not exist (introduced in 6.0r47)
axo.AllowScriptAccess = "always";
// safe to call for 6.0r47 or greater
version = axo.GetVariable("$version");
} catch (e) {
}
}
if (!version)
{
try {
// version will be set for 4.X or 5.X player
axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.3");
version = axo.GetVariable("$version");
} catch (e) {
}
}
if (!version)
{
try {
// version will be set for 3.X player
axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.3");
version = "WIN 3,0,18,0";
} catch (e) {
}
}
if (!version)
{
try {
// version will be set for 2.X player
axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash");
version = "WIN 2,0,0,11";
} catch (e) {
version = -1;
}
}
return version;
}
// JavaScript helper required to detect Flash Player PlugIn version information
function GetSwfVer(){
// NS/Opera version >= 3 check for Flash plugin in plugin array
var flashVer = -1;
if (navigator.plugins != null && navigator.plugins.length > 0) {
if (navigator.plugins["Shockwave Flash 2.0"] || navigator.plugins["Shockwave Flash"]) {
var swVer2 = navigator.plugins["Shockwave Flash 2.0"] ? " 2.0" : "";
var flashDescription = navigator.plugins["Shockwave Flash" + swVer2].description;
var descArray = flashDescription.split(" ");
var tempArrayMajor = descArray[2].split(".");
var versionMajor = tempArrayMajor[0];
var versionMinor = tempArrayMajor[1];
var versionRevision = descArray[3];
if (versionRevision == "") {
versionRevision = descArray[4];
}
if (versionRevision[0] == "d") {
versionRevision = versionRevision.substring(1);
} else if (versionRevision[0] == "r") {
versionRevision = versionRevision.substring(1);
if (versionRevision.indexOf("d") > 0) {
versionRevision = versionRevision.substring(0, versionRevision.indexOf("d"));
}
}
var flashVer = versionMajor + "." + versionMinor + "." + versionRevision;
}
}
// MSN/WebTV 2.6 supports Flash 4
else if (navigator.userAgent.toLowerCase().indexOf("webtv/2.6") != -1) flashVer = 4;
// WebTV 2.5 supports Flash 3
else if (navigator.userAgent.toLowerCase().indexOf("webtv/2.5") != -1) flashVer = 3;
// older WebTV supports Flash 2
else if (navigator.userAgent.toLowerCase().indexOf("webtv") != -1) flashVer = 2;
else if ( isIE && isWin && !isOpera ) {
flashVer = ControlVersion();
}
return flashVer;
}
// When called with reqMajorVer, reqMinorVer, reqRevision returns true if that version or greater is available
function DetectFlashVer(reqMajorVer, reqMinorVer, reqRevision)
{
versionStr = GetSwfVer();
if (versionStr == -1 ) {
return false;
} else if (versionStr != 0) {
if(isIE && isWin && !isOpera) {
// Given "WIN 2,0,0,11"
tempArray = versionStr.split(" "); // ["WIN", "2,0,0,11"]
tempString = tempArray[1]; // "2,0,0,11"
versionArray = tempString.split(","); // ['2', '0', '0', '11']
} else {
versionArray = versionStr.split(".");
}
var versionMajor = versionArray[0];
var versionMinor = versionArray[1];
var versionRevision = versionArray[2];
// is the major.revision >= requested major.revision AND the minor version >= requested minor
if (versionMajor > parseFloat(reqMajorVer)) {
return true;
} else if (versionMajor == parseFloat(reqMajorVer)) {
if (versionMinor > parseFloat(reqMinorVer))
return true;
else if (versionMinor == parseFloat(reqMinorVer)) {
if (versionRevision >= parseFloat(reqRevision))
return true;
}
}
return false;
}
}
function AC_AddExtension(src, ext)
{
if (src.indexOf('?') != -1)
return src.replace(/\?/, ext+'?');
else
return src + ext;
}
function AC_Generateobj(objAttrs, params, embedAttrs)
{
var str = '';
if (isIE && isWin && !isOpera)
{
str += '<object ';
for (var i in objAttrs)
str += i + '="' + objAttrs[i] + '" ';
for (var i in params)
str += '><param name="' + i + '" value="' + params[i] + '" /> ';
str += '></object>';
} else {
str += '<embed ';
for (var i in embedAttrs)
str += i + '="' + embedAttrs[i] + '" ';
str += '> </embed>';
}
document.write(str);
}
function AC_FL_RunContent(){
var ret =
AC_GetArgs
( arguments, ".swf", "movie", "clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"
, "application/x-shockwave-flash"
);
AC_Generateobj(ret.objAttrs, ret.params, ret.embedAttrs);
}
function AC_GetArgs(args, ext, srcParamName, classid, mimeType){
var ret = new Object();
ret.embedAttrs = new Object();
ret.params = new Object();
ret.objAttrs = new Object();
for (var i=0; i < args.length; i=i+2){
var currArg = args[i].toLowerCase();
switch (currArg){
case "classid":
break;
case "pluginspage":
ret.embedAttrs[args[i]] = args[i+1];
break;
case "src":
case "movie":
args[i+1] = AC_AddExtension(args[i+1], ext);
ret.embedAttrs["src"] = args[i+1];
ret.params[srcParamName] = args[i+1];
break;
case "onafterupdate":
case "onbeforeupdate":
case "onblur":
case "oncellchange":
case "onclick":
case "ondblClick":
case "ondrag":
case "ondragend":
case "ondragenter":
case "ondragleave":
case "ondragover":
case "ondrop":
case "onfinish":
case "onfocus":
case "onhelp":
case "onmousedown":
case "onmouseup":
case "onmouseover":
case "onmousemove":
case "onmouseout":
case "onkeypress":
case "onkeydown":
case "onkeyup":
case "onload":
case "onlosecapture":
case "onpropertychange":
case "onreadystatechange":
case "onrowsdelete":
case "onrowenter":
case "onrowexit":
case "onrowsinserted":
case "onstart":
case "onscroll":
case "onbeforeeditfocus":
case "onactivate":
case "onbeforedeactivate":
case "ondeactivate":
case "type":
case "codebase":
ret.objAttrs[args[i]] = args[i+1];
break;
case "id":
case "width":
case "height":
case "align":
case "vspace":
case "hspace":
case "class":
case "title":
case "accesskey":
case "name":
case "tabindex":
ret.embedAttrs[args[i]] = ret.objAttrs[args[i]] = args[i+1];
break;
default:
ret.embedAttrs[args[i]] = ret.params[args[i]] = args[i+1];
}
}
ret.objAttrs["classid"] = classid;
if (mimeType) ret.embedAttrs["type"] = mimeType;
return ret;
}

View File

@ -1,6 +0,0 @@
/* This CSS stylesheet defines styles used by required elements in a DeepLinking application page */
#ie_historyFrame { width: 0px; height: 0px; display:none }
#firefox_anchorDiv { width: 0px; height: 0px; display:none }
#safari_formDiv { width: 0px; height: 0px; display:none }
#safari_rememberDiv { width: 0px; height: 0px; display:none }

View File

@ -1,517 +0,0 @@
DeepLinkingUtils = {
addEvent: function(elm, evType, fn, useCapture) {
useCapture = useCapture || false;
if (elm.addEventListener) {
elm.addEventListener(evType, fn, useCapture);
return true;
}
else if (elm.attachEvent) {
var r = elm.attachEvent('on' + evType, fn);
return r;
}
else {
elm['on' + evType] = fn;
}
}
}
DeepLinking = (function() {
// type of browser
var browser = {
ie: false,
firefox: false,
safari: false,
opera: false,
version: -1
};
// Default app state URL to use when no fragment ID present
var defaultHash = '';
// Last-known app state URL
var currentHref = document.location.href;
// Initial URL (used only by IE)
var initialHref = document.location.href;
// Initial URL (used only by IE)
var initialHash = document.location.hash;
// History frame source URL prefix (used only by IE)
var historyFrameSourcePrefix = 'deeplinking/historyFrame.html?';
// History maintenance (used only by Safari)
var currentHistoryLength = -1;
var historyHash = [];
var initialState = createState(initialHref, initialHref + '#' + initialHash, initialHash);
var backStack = [];
var forwardStack = [];
//UserAgent detection
var useragent = navigator.userAgent.toLowerCase();
if (useragent.indexOf("opera") != -1) {
browser.opera = true;
} else if (useragent.indexOf("msie") != -1) {
browser.ie = true;
browser.version = parseFloat(useragent.substring(useragent.indexOf('msie') + 4));
} else if (useragent.indexOf("safari") != -1) {
browser.safari = true;
browser.version = parseFloat(useragent.substring(useragent.indexOf('safari') + 7));
} else if (useragent.indexOf("gecko") != -1) {
browser.firefox = true;
}
// Accessor functions for obtaining specific elements of the page.
function getHistoryFrame()
{
return document.getElementById('ie_historyFrame');
}
function getAnchorElement()
{
return document.getElementById('firefox_anchorDiv');
}
function getFormElement()
{
return document.getElementById('safari_formDiv');
}
function getRememberElement()
{
return document.getElementById("safari_remember_field");
}
/* Get the Flash player object for performing ExternalInterface callbacks. */
function getPlayer() {
var player = null; /* AJH, needed? = document.getElementById(getPlayerId()); */
if (player == null) {
player = document.getElementsByTagName('object')[0];
}
if (player == null || player.object == null) {
player = document.getElementsByTagName('embed')[0];
}
return player;
}
/* Get the current location hash excluding the '#' symbol. */
function getHash() {
// It would be nice if we could use document.location.hash here,
// but it's faulty sometimes.
var idx = document.location.href.indexOf('#');
return (idx >= 0) ? document.location.href.substr(idx+1) : '';
}
/* Get the current location hash excluding the '#' symbol. */
function setHash(hash) {
// It would be nice if we could use document.location.hash here,
// but it's faulty sometimes.
if (hash == '') hash = '#'
document.location.hash = hash;
}
function createState(baseUrl, newUrl, flexAppUrl) {
return { 'baseUrl': baseUrl, 'newUrl': newUrl, 'flexAppUrl': flexAppUrl, 'title': null };
}
/* Add a history entry to the browser.
* baseUrl: the portion of the location prior to the '#'
* newUrl: the entire new URL, including '#' and following fragment
* flexAppUrl: the portion of the location following the '#' only
*/
function addHistoryEntry(baseUrl, newUrl, flexAppUrl, copyToAddressBar) {
//delete all the history entries
forwardStack = [];
if (browser.ie) {
//Check to see if we are being asked to do a navigate for the first
//history entry, and if so ignore, because it's coming from the creation
//of the history iframe
if (flexAppUrl == defaultHash && document.location.href == initialHref && _ie_firstload) {
currentHref = initialHref;
return;
}
if ((!flexAppUrl || flexAppUrl == defaultHash) && _ie_firstload) {
newUrl = baseUrl + '#' + defaultHash;
flexAppUrl = defaultHash;
} else {
// for IE, tell the history frame to go somewhere without a '#'
// in order to get this entry into the browser history.
getHistoryFrame().src = historyFrameSourcePrefix + flexAppUrl;
}
if (copyToAddressBar) {
setHash(flexAppUrl);
//document.location.href = newUrl;
}
} else {
//ADR
if (backStack.length == 0 && initialState.flexAppUrl == flexAppUrl) {
initialState = createState(baseUrl, newUrl, flexAppUrl);
} else if(backStack.length > 0 && backStack[backStack.length - 1].flexAppUrl == flexAppUrl) {
backStack[backStack.length - 1] = createState(baseUrl, newUrl, flexAppUrl);
}
if (browser.safari) {
// for Safari, submit a form whose action points to the desired URL
if (browser.version <= 419.3) {
var file = window.location.pathname.toString();
file = file.substring(file.lastIndexOf("/")+1);
getFormElement().innerHTML = '<form name="historyForm" action="'+file+'#' + flexAppUrl + '" method="GET"></form>';
//get the current elements and add them to the form
var qs = window.location.search.substring(1);
var qs_arr = qs.split("&");
for (var i = 0; i < qs_arr.length; i++) {
var tmp = qs_arr[i].split("=");
var elem = document.createElement("input");
elem.type = "hidden";
elem.name = tmp[0];
elem.value = tmp[1];
document.forms.historyForm.appendChild(elem);
}
document.forms.historyForm.submit();
} else {
top.location.hash = flexAppUrl;
}
// We also have to maintain the history by hand for Safari
historyHash[history.length] = flexAppUrl;
_storeStates();
} else {
// Otherwise, write an anchor into the page and tell the browser to go there
addAnchor(flexAppUrl);
if (copyToAddressBar) {
setHash(flexAppUrl);
}
}
}
backStack.push(createState(baseUrl, newUrl, flexAppUrl));
}
function _storeStates() {
if (browser.safari) {
getRememberElement().value = historyHash.join(",");
}
}
function handleBackButton() {
//The "current" page is always at the top of the history stack.
var current = backStack.pop();
if (!current) { return; }
var last = backStack[backStack.length - 1];
if (!last && backStack.length == 0){
last = initialState;
}
forwardStack.push(current);
}
function handleForwardButton() {
//summary: private method. Do not call this directly.
var last = forwardStack.pop();
if (!last) { return; }
backStack.push(last);
}
function handleArbitraryUrl() {
//delete all the history entries
forwardStack = [];
}
/* Called periodically to poll to see if we need to detect navigation that has occurred */
function checkForUrlChange() {
if (browser.ie) {
if (currentHref != document.location.href && currentHref + '#' != document.location.href) {
//This occurs when the user has navigated to a specific URL
//within the app, and didn't use browser back/forward
//IE seems to have a bug where it stops updating the URL it
//shows the end-user at this point, but programatically it
//appears to be correct. Do a full app reload to get around
//this issue.
if (browser.version < 7) {
currentHref = document.location.href;
document.location.reload();
} else {
//getHistoryFrame().src = historyFrameSourcePrefix + getHash();
}
}
}
if (browser.safari) {
// For Safari, we have to check to see if history.length changed.
if (currentHistoryLength >= 0 && history.length != currentHistoryLength) {
//alert("did change: " + history.length + ", " + historyHash.length + "|" + historyHash[history.length] + "|>" + historyHash.join("|"));
// If it did change, then we have to look the old state up
// in our hand-maintained array since document.location.hash
// won't have changed, then call back into BrowserManager.
currentHistoryLength = history.length;
var flexAppUrl = historyHash[currentHistoryLength];
if (flexAppUrl == '') {
//flexAppUrl = defaultHash;
}
getPlayer().browserURLChange(flexAppUrl);
_storeStates();
}
}
if (browser.firefox) {
if (currentHref != document.location.href) {
var bsl = backStack.length;
var urlActions = {
back: false,
forward: false,
set: false
}
if ((window.location.hash == initialHash || window.location.href == initialHref) && (bsl == 1)) {
urlActions.back = true;
// FIXME: could this ever be a forward button?
// we can't clear it because we still need to check for forwards. Ugg.
// clearInterval(this.locationTimer);
handleBackButton();
}
// first check to see if we could have gone forward. We always halt on
// a no-hash item.
if (forwardStack.length > 0) {
if (forwardStack[forwardStack.length-1].flexAppUrl == getHash()) {
urlActions.forward = true;
handleForwardButton();
}
}
// ok, that didn't work, try someplace back in the history stack
if ((bsl >= 2) && (backStack[bsl - 2])) {
if (backStack[bsl - 2].flexAppUrl == getHash()) {
urlActions.back = true;
handleBackButton();
}
}
if (!urlActions.back && !urlActions.forward) {
var foundInStacks = {
back: -1,
forward: -1
}
for (var i = 0; i < backStack.length; i++) {
if (backStack[i].flexAppUrl == getHash() && i != (bsl - 2)) {
arbitraryUrl = true;
foundInStacks.back = i;
}
}
for (var i = 0; i < forwardStack.length; i++) {
if (forwardStack[i].flexAppUrl == getHash() && i != (bsl - 2)) {
arbitraryUrl = true;
foundInStacks.forward = i;
}
}
handleArbitraryUrl();
}
// Firefox changed; do a callback into BrowserManager to tell it.
currentHref = document.location.href;
var flexAppUrl = getHash();
if (flexAppUrl == '') {
//flexAppUrl = defaultHash;
}
getPlayer().browserURLChange(flexAppUrl);
}
}
//setTimeout(checkForUrlChange, 50);
}
/* Write an anchor into the page to legitimize it as a URL for Firefox et al. */
function addAnchor(flexAppUrl)
{
if (document.getElementsByName(flexAppUrl).length == 0) {
getAnchorElement().innerHTML += "<a name='" + flexAppUrl + "'>" + flexAppUrl + "</a>";
}
}
var _initialize = function () {
if (browser.ie)
{
var scripts = document.getElementsByTagName('script');
for (var i = 0, s; s = scripts[i]; i++) {
if (s.src.indexOf("deeplinking.js") > -1) {
var iframe_location = (new String(s.src)).replace("deeplinking.js", "historyFrame.html");
}
}
historyFrameSourcePrefix = iframe_location + "?";
var src = historyFrameSourcePrefix;
var iframe = document.createElement("iframe");
iframe.id = 'ie_historyFrame';
iframe.name = 'ie_historyFrame';
//iframe.src = historyFrameSourcePrefix;
document.body.appendChild(iframe);
}
if (browser.safari)
{
var rememberDiv = document.createElement("div");
rememberDiv.id = 'asafari_rememberDiv';
document.body.appendChild(rememberDiv);
rememberDiv.innerHTML = '<input type="text" id="safari_remember_field" style="width: 500px;">';
var formDiv = document.createElement("div");
formDiv.id = 'safari_formDiv';
document.body.appendChild(formDiv);
var reloader_content = document.createElement('div');
reloader_content.id = 'safarireloader';
var scripts = document.getElementsByTagName('script');
for (var i = 0, s; s = scripts[i]; i++) {
if (s.src.indexOf("deeplinking.js") > -1) {
html = (new String(s.src)).replace(".js", ".html");
}
}
reloader_content.innerHTML = '<iframe id="safarireloader-iframe" src="about:blank" frameborder="no" scrolling="no"></iframe>';
document.body.appendChild(reloader_content);
reloader_content.style.position = 'absolute';
reloader_content.style.left = reloader_content.style.top = '-9999px';
iframe = reloader_content.getElementsByTagName('iframe')[0];
if (document.getElementById("safari_remember_field").value != "" ) {
historyHash = document.getElementById("safari_remember_field").value.split(",");
}
}
if (browser.firefox)
{
var anchorDiv = document.createElement("div");
anchorDiv.id = 'firefox_anchorDiv';
document.body.appendChild(anchorDiv);
}
//setTimeout(checkForUrlChange, 50);
}
return {
historyHash: historyHash,
backStack: function() { return backStack; },
forwardStack: function() { return forwardStack },
getPlayer: getPlayer,
initialize: function(src) {
_initialize(src);
},
setURL: function(url) {
document.location.href = url;
},
getURL: function() {
return document.location.href;
},
getTitle: function() {
return document.title;
},
setTitle: function(title) {
try {
backStack[backStack.length - 1].title = title;
} catch(e) { }
document.title = title;
},
setDefaultURL: function(def)
{
defaultHash = def;
def = getHash();
//trailing ? is important else an extra frame gets added to the history
//when navigating back to the first page. Alternatively could check
//in history frame navigation to compare # and ?.
if (browser.ie)
{
_ie_firstload = true;
getHistoryFrame().src = historyFrameSourcePrefix + def;
window.location.replace("#" + def);
setInterval(checkForUrlChange, 50);
}
if (browser.safari)
{
currentHistoryLength = history.length;
if (historyHash.length == 0) {
historyHash[currentHistoryLength] = defaultHash;
var newloc = "#" + def;
window.location.replace(newloc);
} else {
//alert(historyHash[historyHash.length-1]);
}
//setHash(def);
setInterval(checkForUrlChange, 50);
}
if (browser.firefox || browser.opera)
{
var reg = new RegExp("#" + def + "$");
if (window.location.toString().match(reg)) {
} else {
var newloc ="#" + def;
window.location.replace(newloc);
}
setInterval(checkForUrlChange, 50);
//setHash(def);
}
},
/* Set the current browser URL; called from inside BrowserManager to propagate
* the application state out to the container.
*/
setBrowserURL: function(flexAppUrl, copyToAddressBar) {
//fromIframe = fromIframe || false;
//fromFlex = fromFlex || false;
//alert("setBrowserURL: " + flexAppUrl);
//flexAppUrl = (flexAppUrl == "") ? defaultHash : flexAppUrl ;
var pos = document.location.href.indexOf('#');
var baseUrl = pos != -1 ? document.location.href.substr(0, pos) : document.location.href;
var newUrl = baseUrl + '#' + flexAppUrl;
if (document.location.href != newUrl && document.location.href + '#' != newUrl) {
currentHref = newUrl;
addHistoryEntry(baseUrl, newUrl, flexAppUrl, copyToAddressBar);
currentHistoryLength = history.length;
}
return false;
}
}
})();
// Initialization
// Automated unit testing and other diagnostics
function setURL(url)
{
document.location.href = url;
}
function backButton()
{
history.back();
}
function forwardButton()
{
history.forward();
}
function goForwardOrBackInHistory(step)
{
history.go(step);
}
DeepLinkingUtils.addEvent(window, "load", function() { DeepLinking.initialize(); });

View File

@ -1,29 +0,0 @@
<html>
<head>
<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
<META HTTP-EQUIV="Expires" CONTENT="-1">
</head>
<body>
<script>
function processUrl()
{
var pos = url.indexOf("?");
url = pos != -1 ? url.substr(pos + 1) : "";
if (!parent._ie_firstload) {
parent.DeepLinking.setBrowserURL(url, true);
try {
parent.DeepLinking.getPlayer().browserURLChange(url);
} catch(e) { }
} else {
parent._ie_firstload = false;
}
}
var url = document.location.href;
processUrl();
document.write(url);
</script>
Yo, I'm your history.
</body>
</html>

View File

@ -1,118 +0,0 @@
<!-- saved from url=(0014)about:internet -->
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- BEGIN DeepLinking required section -->
<link rel="stylesheet" type="text/css" href="deeplinking/deeplinking.css" />
<!-- END DeepLinking required section -->
<title></title>
<script src="AC_OETags.js" language="javascript"></script>
<!-- BEGIN DeepLinking required section -->
<script src="deeplinking/deeplinking.js" language="javascript"></script>
<!-- END DeepLinking required section -->
<style>
body { margin: 0px; overflow:hidden }
</style>
<script language="JavaScript" type="text/javascript">
<!--
// -----------------------------------------------------------------------------
// Globals
// Major version of Flash required
var requiredMajorVersion = 9;
// Minor version of Flash required
var requiredMinorVersion = 0;
// Minor version of Flash required
var requiredRevision = 28;
// -----------------------------------------------------------------------------
// -->
</script>
</head>
<body scroll="no">
<center>
<div style="border: 1px solid #cccccc; width:800; height:550; margin-top:20px;">
<script language="JavaScript" type="text/javascript">
<!--
// Version check for the Flash Player that has the ability to start Player Product Install (6.0r65)
var hasProductInstall = DetectFlashVer(6, 0, 65);
// Version check based upon the values defined in globals
var hasRequestedVersion = DetectFlashVer(requiredMajorVersion, requiredMinorVersion, requiredRevision);
// Check to see if a player with Flash Product Install is available and the version does not meet the requirements for playback
if ( hasProductInstall && !hasRequestedVersion ) {
// MMdoctitle is the stored document.title value used by the installation process to close the window that started the process
// This is necessary in order to close browser windows that are still utilizing the older version of the player after installation has completed
// DO NOT MODIFY THE FOLLOWING FOUR LINES
// Location visited after installation is complete if installation is required
var MMPlayerType = (isIE == true) ? "ActiveX" : "PlugIn";
var MMredirectURL = window.location;
document.title = document.title.slice(0, 47) + " - Flash Player Installation";
var MMdoctitle = document.title;
AC_FL_RunContent(
"src", "playerProductInstall",
"FlashVars", "MMredirectURL="+MMredirectURL+'&MMplayerType='+MMPlayerType+'&MMdoctitle='+MMdoctitle+"",
"width", "800",
"height", "550",
"align", "middle",
"id", "demos",
"quality", "high",
"bgcolor", "#ffffff",
"name", "demos",
"allowScriptAccess","sameDomain",
"type", "application/x-shockwave-flash",
"pluginspage", "http://www.adobe.com/go/getflashplayer"
);
} else if (hasRequestedVersion) {
// if we've detected an acceptable version
// embed the Flash Content SWF when all tests are passed
AC_FL_RunContent(
"src", "demos",
"width", "800",
"height", "550",
"align", "middle",
"id", "demos",
"quality", "high",
"bgcolor", "#ffffff",
"name", "demos",
"allowScriptAccess","sameDomain",
"type", "application/x-shockwave-flash",
"pluginspage", "http://www.adobe.com/go/getflashplayer"
);
} else { // flash is too old or we can't detect the plugin
var alternateContent = 'Alternate HTML content should be placed here. '
+ 'This content requires the Adobe Flash Player. '
+ '<a href=http://www.adobe.com/go/getflash/>Get Flash</a>';
document.write(alternateContent); // insert non-flash content
}
// -->
</script>
<noscript>
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
id="demos" width="800" height="550"
codebase="http://fpdownload.macromedia.com/get/flashplayer/current/swflash.cab">
<param name="movie" value="demos.swf" />
<param name="quality" value="high" />
<param name="bgcolor" value="#ffffff" />
<param name="allowScriptAccess" value="sameDomain" />
<embed src="demos.swf" quality="high" bgcolor="#ffffff"
width="800" height="550" name="demos" align="middle"
play="true"
loop="false"
quality="high"
allowScriptAccess="sameDomain"
type="application/x-shockwave-flash"
pluginspage="http://www.adobe.com/go/getflashplayer">
</embed>
</object>
</noscript>
</div>
</center>
</body>
</html>

Some files were not shown because too many files have changed in this diff Show More