Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop
This commit is contained in:
commit
c174be7100
32
ChangeLog
32
ChangeLog
@ -6,8 +6,8 @@ English Dolibarr ChangeLog
|
||||
For users:
|
||||
- New: [ task #877 ] Reorganize menus.
|
||||
- New: [ task #858 ] Holiday module: note on manual holiday assignation.
|
||||
- New: [ task #892 ] Add hidden option in thirdparty customer/supplier module to
|
||||
hide non active companies in select_company method.
|
||||
- New: [ task #892 ] Add hidden option in thirdparty customer/supplier module to hide non active
|
||||
companies in select_company method.
|
||||
- New: [ task #531 ] Add a workload field on tasks.
|
||||
- New: Add graph of bank account input/output into input-output report page.
|
||||
- New: Add script export-bank-receipts.php
|
||||
@ -24,7 +24,9 @@ For users:
|
||||
- New: [ task #928 ] Add extrafield feature on invoice lines.
|
||||
- New: Add option ADHERENT_LOGIN_NOT_REQUIRED.
|
||||
- New: Add a cron module to define scheduled jobs.
|
||||
- New: Add new graphical boxes (customer invoices per month).
|
||||
- New: Add new graphical boxes (customer invoices and orders per month).
|
||||
- New: [ task #286 ] Enhance rounding function of prices to allow round of sum instead of sum of rounding.
|
||||
- New: Can add an event automatically when a projet is create.
|
||||
- Qual: Implement same rule for return value of all command line scripts (0 when success, <>0 if error).
|
||||
|
||||
For translators:
|
||||
@ -37,9 +39,31 @@ For developers:
|
||||
- New: Show version of client lib used by mysql drivers.
|
||||
- New: Add function to get content of an url (using all dolibarr setup like timeout, proxies...)
|
||||
- New: Upgrade lib of TCPDF to 6.0
|
||||
- New: Upgrade jquery flot library to 0.8.1
|
||||
- New: Add property "hidden" into module descriptors to allow to hide a module according to
|
||||
some dynamic conditions.
|
||||
|
||||
- New: Add option MAIN_MOTD_SETUPPAGE to add a content onto setup page. Also content for
|
||||
MAIN_MOTD_SETUPPAGE, MAIN_MOTD_SETUPPAGE, MAIN_HOME now accept "|langfile" into translation
|
||||
key to use a specific language file.
|
||||
- New: Make some changes to allow usage of several alternative $dolibarr_main_url_root variables.
|
||||
Fix also several bugs with old code.
|
||||
|
||||
WARNING: This may create regression for some external modules, but was necessary to make
|
||||
Dolibarr better:
|
||||
|
||||
- We started to clean hooks code. If your hook want to modify value of $actions, it's role
|
||||
of your hook to modify it. Dolibarr hook code will not decide this for your module anymore.
|
||||
If your action class for hook was returning a string or an array, instead your module must
|
||||
set $actionclassinstance->results (to return array)
|
||||
or $actionclassinstance->resprints (to return string)
|
||||
to return same thing. The return value must be replaced by a "return 0";
|
||||
Goal is to fix old compatibility code that does not match hook
|
||||
specification: http://wiki.dolibarr.org/index.php/Hooks_system
|
||||
|
||||
- Some methods object->addline used a first parameter that was object->id, some not. Of course
|
||||
this was not a good pratice, since object->id is already known so no need to provide it as
|
||||
parameter. All methods addline in this case were modified to remove this information.
|
||||
|
||||
|
||||
***** ChangeLog for 3.4 compared to 3.3.2 *****
|
||||
For users:
|
||||
|
||||
1
README
1
README
@ -132,7 +132,6 @@ This is features that Dolibarr does not support completely yet:
|
||||
- No accountancy (only bank management).
|
||||
- Dolibarr manage one currency at once (mono-currency).
|
||||
- Dolibarr manage one company/foundation (mono-company). If you want to manage several companies or foundations, you must install several time the software (on same server or not). Another solution is to extend Dolibarr with the addon Module MultiCompany that allows to manage several companies in one Dolibarr instance (one database but with a logical isolation of datas).
|
||||
- Does not support double VAT (Federal / provincial) for Canada.
|
||||
- Dolibarr does not contains Payroll module.
|
||||
- Tasks on module project can't have dependencies between each other.
|
||||
- Dolibarr does not include any Webmail.
|
||||
|
||||
@ -122,7 +122,6 @@ Voici un liste de fonctionnalites pas encore gérées par Dolibarr:
|
||||
- Pas de compta analytique (uniquement gestion de trésorerie).
|
||||
- Dolibarr ne gère qu'une seule monnaie à la fois (mono-devise).
|
||||
- Dolibarr ne gère en standard qu'une société/institution/association mère (mono-société). Pour en gérer plusieurs (comme vos filiales), il faut, soit faire plusieurs installations de Dolibarr, soit installer le module MultiCompany qui permet de gérer n société/institutions/associations dans une seule instance par une isolation logique des données.
|
||||
- Ne gère pas la double tva (Fédérale / provinciale) du canada.
|
||||
- Dolibarr ne contient pas de module de Gestion de la paie.
|
||||
- Les taches du module de gestion de projets n'ont pas de dépendance entre elle.
|
||||
- Dolibarr ne contient pas de Webmail.
|
||||
|
||||
@ -128,7 +128,6 @@ This is features that Dolibarr does not support completely yet:
|
||||
- No double party accountancy (only bank management).
|
||||
- Dolibarr manage one currency at once (mono-currency).
|
||||
- Dolibarr manage one master company/foundation (mono-company). If you want to manage several companies or foundations, you must install several time the software (on same server or not). Another solution is to extend Dolibarr with the addon Module MultiCompany that allows to manage several companies in one Dolibarr instance (one database but with a logical isolation of datas).
|
||||
- Does not support double VAT (Federal / provincial) for Canada.
|
||||
- Dolibarr does not contains Payroll module.
|
||||
- Tasks on module project can't have dependencies between each other.
|
||||
- Dolibarr does not include any Webmail.
|
||||
|
||||
@ -13,6 +13,7 @@ Depends: libapache2-mod-php5 | libapache2-mod-php5filter | php5-cgi | php5-fpm |
|
||||
libphp-adodb,
|
||||
libnusoap-php,
|
||||
libphp-pclzip,
|
||||
libfpdi-php, libfpdf-tpl-php, php-fpdf
|
||||
libjs-jquery, libjs-jquery-ui, libjs-flot, ckeditor,
|
||||
ttf-dejavu-core,
|
||||
xdg-utils,
|
||||
|
||||
@ -1018,5 +1018,3 @@ Type: filesandordirs; Name: "{app}\www\dolibarr"
|
||||
[UninstallRun]
|
||||
Filename: "{app}\uninstall_services.bat"; Flags: runhidden
|
||||
|
||||
|
||||
|
||||
|
||||
@ -9,13 +9,13 @@ beta version of Dolibarr, step by step.
|
||||
|
||||
- Check all files are commited.
|
||||
- Update version/info in /ChangeLog
|
||||
- Update version number with x.x.x-y in htdocs/filefunc.inc.php
|
||||
- Update version number with x.x.x-y in build/makepack-dolibarr.pl
|
||||
- Update version number with x.x.x-y in build/debian/changelog
|
||||
- Update version number with x.x.x-y in build/exe/doliwamp/doliwamp.iss
|
||||
- Update version number with x.x.x-y in build/rpm/*.spec
|
||||
- Update version number with x.x.x in build/doxygen/dolibarr-doxygen.doxyfile
|
||||
- Update version number with x.x.x in build/perl/virtualmin/dolibarr.pl
|
||||
- Update version number with x.y.z-w in htdocs/filefunc.inc.php
|
||||
- Update version number with x.y.z-w in build/makepack-dolibarr.pl
|
||||
- Update version number with x.y.z-w in build/debian/changelog
|
||||
- Update version number with x.y.z-w in build/exe/doliwamp/doliwamp.iss
|
||||
- Update version number with x.y.z-w in build/rpm/*.spec
|
||||
- Update version number with x.y.z in build/doxygen/dolibarr-doxygen.doxyfile
|
||||
- Update version number with x.y.z in build/perl/virtualmin/dolibarr.pl
|
||||
- Commit all changes.
|
||||
- Add a Tag (x.y.betaz_YYYYMMDD) and push it: git push --tags
|
||||
- Create a branch (x.y).
|
||||
@ -33,14 +33,14 @@ complete release of Dolibarr, step by step.
|
||||
|
||||
- Check all files are commited.
|
||||
- Update version/info in ChangeLog
|
||||
- Update version number with x.x.x in htdocs/filefunc.inc.php
|
||||
- Update version number with x.x.x in build/makepack-dolibarr.pl
|
||||
- Update version number with x.x.x in build/debian/changelog
|
||||
- Update version number with x.x.x in build/exe/doliwamp/doliwamp.iss
|
||||
- Update version number with x.x.x in build/rpm/*.spec
|
||||
- Update version number with x.y.z in htdocs/filefunc.inc.php
|
||||
- Update version number with x.y.z in build/makepack-dolibarr.pl
|
||||
- Update version number with x.y.z in build/debian/changelog
|
||||
- Update version number with x.y.z in build/exe/doliwamp/doliwamp.iss
|
||||
- Update version number with x.y.z in build/rpm/*.spec
|
||||
- Update PAD files.
|
||||
- Commit all changes.
|
||||
- Add a Tag (DOLIBARR_x_y)
|
||||
- Add a Tag (x.y.z)
|
||||
|
||||
- Build Dolibarr and DoliWamp packages with makepack-dolibarr.pl
|
||||
- Check content of built packages.
|
||||
|
||||
@ -35,8 +35,8 @@
|
||||
<Program_Info>
|
||||
<Program_Name>Dolibarr</Program_Name>
|
||||
<Program_Version>3.4</Program_Version>
|
||||
<Program_Release_Month>05</Program_Release_Month>
|
||||
<Program_Release_Day>17</Program_Release_Day>
|
||||
<Program_Release_Month>07</Program_Release_Month>
|
||||
<Program_Release_Day>07</Program_Release_Day>
|
||||
<Program_Release_Year>2013</Program_Release_Year>
|
||||
<Program_Cost_Dollars />
|
||||
<Program_Cost_Other_Code />
|
||||
|
||||
@ -35,8 +35,8 @@
|
||||
<Program_Info>
|
||||
<Program_Name>DoliWamp</Program_Name>
|
||||
<Program_Version>3.4</Program_Version>
|
||||
<Program_Release_Month>05</Program_Release_Month>
|
||||
<Program_Release_Day>17</Program_Release_Day>
|
||||
<Program_Release_Month>07</Program_Release_Month>
|
||||
<Program_Release_Day>07</Program_Release_Day>
|
||||
<Program_Release_Year>2013</Program_Release_Year>
|
||||
<Program_Cost_Dollars />
|
||||
<Program_Cost_Other_Code />
|
||||
|
||||
@ -320,7 +320,7 @@ then
|
||||
fi
|
||||
|
||||
|
||||
|
||||
# version x.y.z-0.1.a for alpha, x.y.z-0.2.b for beta, x.y.z-0.3 for release
|
||||
%changelog
|
||||
* Sun Feb 17 2013 Laurent Destailleur 3.5.0-0.1.a
|
||||
- Initial version (#723326)
|
||||
|
||||
@ -538,6 +538,7 @@ fi
|
||||
|
||||
|
||||
|
||||
# version x.y.z-0.1.a for alpha, x.y.z-0.2.b for beta, x.y.z-0.3 for release
|
||||
%changelog
|
||||
* Sun Feb 17 2013 Laurent Destailleur 3.5.0-0.1.a
|
||||
- Initial version (#723326)
|
||||
|
||||
@ -321,7 +321,7 @@ then
|
||||
fi
|
||||
|
||||
|
||||
|
||||
# version x.y.z-0.1.a for alpha, x.y.z-0.2.b for beta, x.y.z-0.3 for release
|
||||
%changelog
|
||||
* Sun Feb 17 2013 Laurent Destailleur 3.5.0-0.1.a
|
||||
- Initial version (#723326)
|
||||
|
||||
@ -333,6 +333,7 @@ fi
|
||||
|
||||
|
||||
|
||||
# version x.y.z-0.1.a for alpha, x.y.z-0.2.b for beta, x.y.z-0.3 for release
|
||||
%changelog
|
||||
* Sun Feb 17 2013 Laurent Destailleur 3.5.0-0.1.a
|
||||
- Initial version (#723326)
|
||||
|
||||
@ -186,7 +186,7 @@ for ($s = 0 ; $s < GEN_NUMBER_COMMANDE ; $s++)
|
||||
$prodid = rand(1, $num_prods);
|
||||
$product=new Product($db);
|
||||
$result=$product->fetch($prodids[$prodid]);
|
||||
$result=$com->addline($com->id, $product->description, $product->price, rand(1,5), 0, 0, 0, $prodids[$prodid], 0, 0, 0, $product->price_base_type, $product->price_ttc, '', '', $product->type);
|
||||
$result=$com->addline($product->description, $product->price, rand(1,5), 0, 0, 0, $prodids[$prodid], 0, 0, 0, $product->price_base_type, $product->price_ttc, '', '', $product->type);
|
||||
if ($result < 0)
|
||||
{
|
||||
dol_print_error($db,$propal->error);
|
||||
|
||||
@ -112,8 +112,12 @@ while ($i < GEN_NUMBER_FACTURE && $result >= 0)
|
||||
$prodid = rand(1, $num_prods);
|
||||
$product=new Product($db);
|
||||
$result=$product->fetch($prodids[$prodid]);
|
||||
$result=$facture->addline($facture->id,$product->description,$product->price, rand(1,5), 0, 0, 0, $prodids[$prodid], 0, '', '', 0, 0, '', $product->price_base_type, $product->price_ttc, $product->type);
|
||||
$xnbp++;
|
||||
$result=$facture->addline($product->description, $product->price, rand(1,5), 0, 0, 0, $prodids[$prodid], 0, '', '', 0, 0, '', $product->price_base_type, $product->price_ttc, $product->type);
|
||||
if ($result < 0)
|
||||
{
|
||||
dol_print_error($db,$propal->error);
|
||||
}
|
||||
$xnbp++;
|
||||
}
|
||||
|
||||
print " OK with ref ".$facture->ref."\n";;
|
||||
|
||||
@ -143,7 +143,9 @@ while ($i < GEN_NUMBER_PROPAL && $result >= 0)
|
||||
while ($xnbp < $nbp)
|
||||
{
|
||||
$prodid = rand(1, $num_prods);
|
||||
$result=$propal->addline($propal->id, 'Description '.$xnbp, '100', rand(1,5), '19.6', 0, 0, $prodids[$prodid], 0);
|
||||
$product=new Product($db);
|
||||
$result=$product->fetch($prodids[$prodid]);
|
||||
$result=$propal->addline($product->description, $product->price, rand(1,5), 0, 0, 0, $prodids[$prodid], 0);
|
||||
if ($result < 0)
|
||||
{
|
||||
dol_print_error($db,$propal->error);
|
||||
|
||||
10
htdocs/.gitignore
vendored
10
htdocs/.gitignore
vendored
@ -1,9 +1,11 @@
|
||||
/test.php
|
||||
/custom*
|
||||
/bootstrap
|
||||
/multicompany
|
||||
/ovh
|
||||
/numberingpack
|
||||
/extensions
|
||||
/google
|
||||
/skincoloreditor
|
||||
/multicompany
|
||||
/numberingpack
|
||||
/ovh
|
||||
/pos
|
||||
/skincoloreditor
|
||||
/ultimatepdf
|
||||
|
||||
@ -368,7 +368,7 @@ if ($user->rights->adherent->cotisation->creer && $action == 'cotisation' && ! $
|
||||
$vattouse=get_default_tva($mysoc, $mysoc, $idprodsubscription);
|
||||
}
|
||||
//print xx".$vattouse." - ".$mysoc." - ".$customer;exit;
|
||||
$result=$invoice->addline($invoice->id,$label,0,1,$vattouse,0,0,$idprodsubscription,0,$datecotisation,$datesubend,0,0,'','TTC',$cotisation,1);
|
||||
$result=$invoice->addline($label,0,1,$vattouse,0,0,$idprodsubscription,0,$datecotisation,$datesubend,0,0,'','TTC',$cotisation,1);
|
||||
if ($result <= 0)
|
||||
{
|
||||
$errmsg=$invoice->error;
|
||||
@ -538,7 +538,7 @@ if ($rowid)
|
||||
|
||||
// EMail
|
||||
print '<tr><td>'.$langs->trans("EMail").'</td><td class="valeur">'.dol_print_email($object->email,0,$object->fk_soc,1).'</td></tr>';
|
||||
|
||||
|
||||
// Status
|
||||
print '<tr><td>'.$langs->trans("Status").'</td><td class="valeur">'.$object->getLibStatut(4).'</td></tr>';
|
||||
|
||||
|
||||
@ -268,7 +268,7 @@ class Adherent extends CommonObject
|
||||
|
||||
// Clean parameters
|
||||
$this->import_key = trim($this->import_key);
|
||||
|
||||
|
||||
// Check parameters
|
||||
if (! empty($conf->global->ADHERENT_MAIL_REQUIRED) && ! isValidEMail($this->email))
|
||||
{
|
||||
@ -1006,18 +1006,18 @@ class Adherent extends CommonObject
|
||||
* Method to load member from its name
|
||||
*
|
||||
* @param string $firstname Firstname
|
||||
** @param string $lastname Lastname
|
||||
* @param string $lastname Lastname
|
||||
* @return void
|
||||
*/
|
||||
function fetch_name($firstname,$lastname)
|
||||
{
|
||||
global $conf;
|
||||
|
||||
|
||||
$sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."adherent";
|
||||
$sql.= " WHERE firstname='".$this->db->escape($firstname)."'";
|
||||
$sql.= " AND lastname='".$this->db->escape($lastname)."'";
|
||||
$sql.= " AND entity = ".$conf->entity;
|
||||
|
||||
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
@ -1032,7 +1032,7 @@ class Adherent extends CommonObject
|
||||
dol_print_error($this->db);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Load member from database
|
||||
*
|
||||
@ -1541,7 +1541,7 @@ class Adherent extends CommonObject
|
||||
{
|
||||
global $langs;
|
||||
$langs->load("dict");
|
||||
|
||||
|
||||
$code=(! empty($this->civilite_id)?$this->civilite_id:(! empty($this->civility_id)?$this->civility_id:''));
|
||||
if (empty($code)) return '';
|
||||
return $langs->getLabelFromKey($this->db, "Civility".$code, "c_civilite", "code", "civilite", $code);
|
||||
|
||||
@ -161,8 +161,9 @@ if (! empty($triggers))
|
||||
if ($module == 'order_supplier' || $module == 'invoice_supplier') $module = 'fournisseur';
|
||||
if ($module == 'shipping') $module = 'expedition_bon';
|
||||
if ($module == 'member') $module = 'adherent';
|
||||
if ($module == 'project') $module = 'projet';
|
||||
//print 'module='.$module.'<br>';
|
||||
if ($conf->$module->enabled)
|
||||
if (! empty($conf->$module->enabled))
|
||||
{
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'>';
|
||||
|
||||
@ -67,7 +67,6 @@ if ($action == 'set')
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
@ -85,6 +84,13 @@ $geoip='';
|
||||
if (! empty($conf->global->GEOIPMAXMIND_COUNTRY_DATAFILE))
|
||||
{
|
||||
$geoip=new DolGeoIP('country',$conf->global->GEOIPMAXMIND_COUNTRY_DATAFILE);
|
||||
//if ($geoip->error) print dol_htmloutput_errors($geoip->errorlabel,'',1);
|
||||
if ($geoip->gi == 'NOGI') $geointernal=true;
|
||||
else $geointernal=false;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (function_exists('geoip_country_code_by_name')) $geointernal=true;
|
||||
}
|
||||
|
||||
// Mode
|
||||
@ -102,6 +108,8 @@ print "</tr>\n";
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'><td width=\"50%\">'.$langs->trans("PathToGeoIPMaxmindCountryDataFile").'</td>';
|
||||
print '<td colspan="2">';
|
||||
|
||||
if ($geointernal) print 'Using geoip PHP internal functions. Value must be '.geoip_db_filename(GEOIP_COUNTRY_EDITION).' or '.geoip_db_filename(GEOIP_CITY_EDITION_REV1).'<br>';
|
||||
print '<input size="50" type="text" name="GEOIPMAXMIND_COUNTRY_DATAFILE" value="'.$conf->global->GEOIPMAXMIND_COUNTRY_DATAFILE.'">';
|
||||
if ($geoip) $version=$geoip->getVersion();
|
||||
if ($version)
|
||||
|
||||
@ -28,8 +28,6 @@ $langs->load("companies");
|
||||
|
||||
if (!$user->admin) accessforbidden();
|
||||
|
||||
$mesg='';
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
@ -43,7 +41,28 @@ $form = new Form($db);
|
||||
|
||||
print_fiche_titre($langs->trans("SetupArea"),'','setup');
|
||||
|
||||
if ($mesg) print $mesg.'<br>';
|
||||
|
||||
if (! empty($conf->global->MAIN_MOTD_SETUPPAGE))
|
||||
{
|
||||
$conf->global->MAIN_MOTD_SETUPPAGE=preg_replace('/<br(\s[\sa-zA-Z_="]*)?\/?>/i','<br>',$conf->global->MAIN_MOTD_SETUPPAGE);
|
||||
if (! empty($conf->global->MAIN_MOTD_SETUPPAGE))
|
||||
{
|
||||
$i=0;
|
||||
while (preg_match('/__\(([a-zA-Z|@]+)\)__/i',$conf->global->MAIN_MOTD_SETUPPAGE,$reg) && $i < 100)
|
||||
{
|
||||
$tmp=explode('|',$reg[1]);
|
||||
if (! empty($tmp[1])) $langs->load($tmp[1]);
|
||||
$conf->global->MAIN_MOTD_SETUPPAGE=preg_replace('/__\('.preg_quote($reg[1]).'\)__/i',$langs->trans($tmp[0]),$conf->global->MAIN_MOTD_SETUPPAGE);
|
||||
$i++;
|
||||
}
|
||||
|
||||
print "\n<!-- Start of welcome text for setup page -->\n";
|
||||
print '<table width="100%" class="notopnoleftnoright"><tr><td>';
|
||||
print dol_htmlentitiesbr($conf->global->MAIN_MOTD_SETUPPAGE);
|
||||
print '</td></tr></table><br>';
|
||||
print "\n<!-- End of welcome text for setup page -->\n";
|
||||
}
|
||||
}
|
||||
|
||||
print $langs->trans("SetupDescription1").' ';
|
||||
print $langs->trans("AreaForAdminOnly").' ';
|
||||
|
||||
@ -52,10 +52,10 @@ if ($action == 'update')
|
||||
dolibarr_set_const($db, "MAIN_PDF_FORMAT", $_POST["MAIN_PDF_FORMAT"],'chaine',0,'',$conf->entity);
|
||||
|
||||
|
||||
dolibarr_set_const($db, "MAIN_PROFID2_IN_ADDRESS", $_POST["MAIN_PROFID2_IN_ADDRESS"],'chaine',0,'',$conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_PROFID1_IN_ADDRESS", $_POST["MAIN_PROFID1_IN_ADDRESS"],'chaine',0,'',$conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_PROFID2_IN_ADDRESS", $_POST["MAIN_PROFID2_IN_ADDRESS"],'chaine',0,'',$conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_PROFID3_IN_ADDRESS", $_POST["MAIN_PROFID3_IN_ADDRESS"],'chaine',0,'',$conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_PROFID4_IN_ADDRESS", $_POST["MAIN_PROFID4_IN_ADDRESS"],'chaine',0,'',$conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_PROFID4_IN_ADDRESS", $_POST["MAIN_PROFID4_IN_ADDRESS"],'chaine',0,'',$conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT", $_POST["MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT"],'chaine',0,'',$conf->entity);
|
||||
|
||||
dolibarr_set_const($db, "MAIN_TVAINTRA_NOT_IN_ADDRESS", $_POST["MAIN_TVAINTRA_NOT_IN_ADDRESS"],'chaine',0,'',$conf->entity);
|
||||
|
||||
@ -183,7 +183,6 @@ foreach($configfileparameters as $key)
|
||||
print "<td>";
|
||||
if ($newkey == 'dolibarr_main_db_pass') print preg_replace('/./i','*',${$newkey});
|
||||
else if ($newkey == 'dolibarr_main_url_root' && preg_match('/__auto__/',${$newkey})) print ${$newkey}.' => '.constant('DOL_MAIN_URL_ROOT');
|
||||
else if ($newkey == 'dolibarr_main_url_root_alt' && preg_match('/__auto__/',${$newkey})) print ${$newkey}.' => '.constant('DOL_MAIN_URL_ROOT_ALT');
|
||||
else print ${$newkey};
|
||||
if ($newkey == 'dolibarr_main_url_root' && $newkey != DOL_MAIN_URL_ROOT) print ' (currently overwritten by autodetected value: '.DOL_MAIN_URL_ROOT.')';
|
||||
print "</td>";
|
||||
|
||||
@ -154,7 +154,8 @@ $var=!$var;
|
||||
print '<tr '.$bc[$var].'><td width="300"> => price(1234.56)</td><td>'.price(1234.56).'</td></tr>'."\n";
|
||||
// Timezone
|
||||
$txt =$langs->trans("OSTZ").' (variable system TZ): '.(! empty($_ENV["TZ"])?$_ENV["TZ"]:$langs->trans("NotDefined")).'<br>'."\n";
|
||||
$txt.=$langs->trans("PHPTZ").' (php.ini date.timezone): '.(ini_get("date.timezone")?ini_get("date.timezone"):$langs->trans("NotDefined")).''."\n"; // date.timezone must be in valued defined in http://fr3.php.net/manual/en/timezones.europe.php
|
||||
$txt.=$langs->trans("PHPTZ").' (php.ini date.timezone): '.(ini_get("date.timezone")?ini_get("date.timezone"):$langs->trans("NotDefined")).''."<br>\n"; // date.timezone must be in valued defined in http://fr3.php.net/manual/en/timezones.europe.php
|
||||
$txt.=$langs->trans("YouCanEditPHPTZ");
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'><td width="300">'.$langs->trans("CurrentTimeZone").'</td><td>'; // Timezone server PHP
|
||||
$a=getServerTimeZoneInt('now');
|
||||
@ -301,7 +302,6 @@ foreach($configfileparameters as $key => $value)
|
||||
print "<td>";
|
||||
if ($newkey == 'dolibarr_main_db_pass') print preg_replace('/./i','*',${$newkey});
|
||||
else if ($newkey == 'dolibarr_main_url_root' && preg_match('/__auto__/',${$newkey})) print ${$newkey}.' => '.constant('DOL_MAIN_URL_ROOT');
|
||||
else if ($newkey == 'dolibarr_main_url_root_alt' && preg_match('/__auto__/',${$newkey})) print ${$newkey}.' => '.constant('DOL_MAIN_URL_ROOT_ALT');
|
||||
else print ${$newkey};
|
||||
if ($newkey == 'dolibarr_main_url_root' && $newkey != DOL_MAIN_URL_ROOT) print ' (currently overwritten by autodetected value: '.DOL_MAIN_URL_ROOT.')';
|
||||
print "</td>";
|
||||
|
||||
451
htdocs/admin/system/perf.php
Normal file
451
htdocs/admin/system/perf.php
Normal file
@ -0,0 +1,451 @@
|
||||
<?php
|
||||
/* Copyright (C) 2005-2013 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
*
|
||||
* 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 3 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.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/admin/system/perf.php
|
||||
* \brief Page to show Performance information
|
||||
*/
|
||||
|
||||
require '../../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/memory.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/geturl.lib.php';
|
||||
|
||||
$langs->load("admin");
|
||||
$langs->load("install");
|
||||
$langs->load("other");
|
||||
|
||||
if (! $user->admin)
|
||||
accessforbidden();
|
||||
|
||||
if (GETPOST('action') == 'donothing')
|
||||
{
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
||||
$form=new Form($db);
|
||||
$nowstring=dol_print_date(dol_now(),'dayhourlog');
|
||||
|
||||
llxHeader();
|
||||
|
||||
print_fiche_titre($langs->trans("PerfDolibarr"),'','setup');
|
||||
|
||||
print $langs->trans("YouMayFindPerfAdviceHere",'http://wiki.dolibarr.org/index.php/FAQ_Increase_Performance').' (<a href="'.$_SERVER["PHP_SELF"].'">'.$langs->trans("Reload").'</a>)<br>';
|
||||
|
||||
// XDebug
|
||||
print '<br>';
|
||||
print '<strong>'.$langs->trans("XDebug").'</strong>: ';
|
||||
$test=!function_exists('xdebug_is_enabled');
|
||||
if ($test) print img_picto('','tick.png').' '.$langs->trans("NotInstalled");
|
||||
else
|
||||
{
|
||||
print img_picto('','warning').' '.$langs->trans("XDebugInstalled");
|
||||
print $langs->trans("MoreInformation").' <a href="'.DOL_URL_ROOT.'/admin/xdebug.php'.'">XDebug admin page</a>';
|
||||
}
|
||||
print '<br>';
|
||||
|
||||
// Applicative cache
|
||||
print '<br>';
|
||||
print '<strong>'.$langs->trans("ApplicativeCache").'</strong>: ';
|
||||
$test=!empty($conf->memcached->enabled);
|
||||
if ($test)
|
||||
{
|
||||
if (!empty($conf->global->MEMCACHED_SERVER))
|
||||
{
|
||||
print img_picto('','tick.png').' '.$langs->trans("MemcachedAvailableAndSetup");
|
||||
print $langs->trans("MoreInformation").' <a href="'.dol_buildpath('/memcached/admin/memcached.php',1).'">Memcached module admin page</a>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print img_picto('','warning').' '.$langs->trans("MemcachedModuleAvailableButNotSetup");
|
||||
}
|
||||
}
|
||||
else print img_picto('','warning').' '.$langs->trans("MemcachedNotAvailable");
|
||||
print '</br>';
|
||||
|
||||
// OPCode cache
|
||||
print '<br>';
|
||||
print '<strong>'.$langs->trans("OPCodeCache").'</strong>: ';
|
||||
$test1=function_exists('xcache_info');
|
||||
if ($test1)
|
||||
{
|
||||
print img_picto('','tick.png').' '.$langs->trans("XCacheInstalled");
|
||||
print $langs->trans("MoreInformation").' <a href="'.DOL_URL_ROOT.'/admin/xcache.php'.'">Xcache admin page</a>';
|
||||
}
|
||||
else
|
||||
{
|
||||
$test2=function_exists('eaccelerator_info');
|
||||
if ($test2) print img_picto('','tick.png').' '.$langs->trans("EAcceleratorInstalled");
|
||||
else print $langs->trans("NoOPCodeCacheFound");
|
||||
}
|
||||
print '<br>';
|
||||
|
||||
// HTTPCacheStaticResources
|
||||
print '<script type="text/javascript" language="javascript">
|
||||
jQuery(document).ready(function() {
|
||||
var getphpurl;
|
||||
var cachephpstring;
|
||||
var compphpstring;
|
||||
getphpurl = $.ajax({
|
||||
type: "GET",
|
||||
url: \''.DOL_URL_ROOT.'/index.php\',
|
||||
cache: false,
|
||||
/* async: false, */
|
||||
/* crossDomain: true,*/
|
||||
success: function () {
|
||||
cachephpstring=getphpurl.getResponseHeader(\'Cache-Control\');
|
||||
/* alert(\'php:\'+getphpurl.getAllResponseHeaders()); */
|
||||
/*alert(\'php:\'+cachephpstring);*/
|
||||
if (cachephpstring == null || cachephpstring.indexOf("no-cache") !== -1)
|
||||
{
|
||||
jQuery("#httpcachephpok").hide();
|
||||
jQuery("#httpcachephpko").show();
|
||||
}
|
||||
else
|
||||
{
|
||||
jQuery("#httpcachephpok").show();
|
||||
jQuery("#httpcachephpko").hide();
|
||||
}
|
||||
compphpstring=getphpurl.getResponseHeader(\'Content-Encoding\');
|
||||
/* alert(\'php:\'+getphpurl.getAllResponseHeaders()); */
|
||||
/*alert(\'php:\'+compphpstring);*/
|
||||
if (compphpstring == null || (compphpstring.indexOf("gzip") == -1 && compphpstring.indexOf("deflate") == -1))
|
||||
{
|
||||
jQuery("#httpcompphpok").hide();
|
||||
jQuery("#httpcompphpko").show();
|
||||
}
|
||||
else
|
||||
{
|
||||
jQuery("#httpcompphpok").show();
|
||||
jQuery("#httpcompphpko").hide();
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
var getcssurl;
|
||||
var cachecssstring;
|
||||
var compcssstring;
|
||||
getcssurl = $.ajax({
|
||||
type: "GET",
|
||||
url: \''.DOL_URL_ROOT.'/includes/jquery/css/smoothness/jquery-ui-latest.custom.css\',
|
||||
cache: false,
|
||||
/* async: false, */
|
||||
/*crossDomain: true, */
|
||||
success: function () {
|
||||
cachecssstring=getcssurl.getResponseHeader(\'Cache-Control\');
|
||||
/* alert(\'css:\'+getcssurl.getAllResponseHeaders()); */
|
||||
/*alert(\'css:\'+cachecssstring);*/
|
||||
if (cachecssstring != null && cachecssstring.indexOf("no-cache") !== -1)
|
||||
{
|
||||
jQuery("#httpcachecssok").hide();
|
||||
jQuery("#httpcachecssko").show();
|
||||
}
|
||||
else
|
||||
{
|
||||
jQuery("#httpcachecssok").show();
|
||||
jQuery("#httpcachecssko").hide();
|
||||
}
|
||||
compcssstring=getcssurl.getResponseHeader(\'Content-Encoding\');
|
||||
/* alert(\'php:\'+getcssurl.getAllResponseHeaders()); */
|
||||
/*alert(\'php:\'+compcssstring);*/
|
||||
if (compcssstring == null || (compcssstring.indexOf("gzip") == -1 && compcssstring.indexOf("deflate") == -1))
|
||||
{
|
||||
jQuery("#httpcompcssok").hide();
|
||||
jQuery("#httpcompcssko").show();
|
||||
}
|
||||
else
|
||||
{
|
||||
jQuery("#httpcompcssok").show();
|
||||
jQuery("#httpcompcssko").hide();
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
var getcssphpurl;
|
||||
var cachecssphpstring;
|
||||
var compcssphpstring;
|
||||
getcssphpurl = $.ajax({
|
||||
type: "GET",
|
||||
url: \''.DOL_URL_ROOT.'/theme/eldy/style.css.php\',
|
||||
cache: false,
|
||||
/* async: false, */
|
||||
/*crossDomain: true,*/
|
||||
success: function () {
|
||||
cachecssphpstring=getcssphpurl.getResponseHeader(\'Cache-Control\');
|
||||
/* alert(\'cssphp:\'+getcssphpurl.getAllResponseHeaders()); */
|
||||
/*alert(\'cssphp:\'+cachecssphpstring);*/
|
||||
if (cachecssphpstring != null && cachecssphpstring.indexOf("no-cache") !== -1)
|
||||
{
|
||||
jQuery("#httpcachecssphpok").hide();
|
||||
jQuery("#httpcachecssphpko").show();
|
||||
}
|
||||
else
|
||||
{
|
||||
jQuery("#httpcachecssphpok").show();
|
||||
jQuery("#httpcachecssphpko").hide();
|
||||
}
|
||||
compcssphpstring=getcssphpurl.getResponseHeader(\'Content-Encoding\');
|
||||
/* alert(\'php:\'+getcssphpurl.getAllResponseHeaders()); */
|
||||
/*alert(\'php:\'+compcssphpstring);*/
|
||||
if (compcssphpstring == null || (compcssphpstring.indexOf("gzip") == -1 && compcssphpstring.indexOf("deflate") == -1))
|
||||
{
|
||||
jQuery("#httpcompcssphpok").hide();
|
||||
jQuery("#httpcompcssphpko").show();
|
||||
}
|
||||
else
|
||||
{
|
||||
jQuery("#httpcompcssphpok").show();
|
||||
jQuery("#httpcompcssphpko").hide();
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
var getimgurl;
|
||||
var cacheimgstring;
|
||||
var compimgstring;
|
||||
getimgurl = $.ajax({
|
||||
type: "GET",
|
||||
url: \''.DOL_URL_ROOT.'/theme/eldy/img/help.png\',
|
||||
cache: false,
|
||||
/* async: false, */
|
||||
/*crossDomain: true,*/
|
||||
success: function () {
|
||||
cacheimgstring=getimgurl.getResponseHeader(\'Cache-Control\');
|
||||
/* alert(\'img:\'+getimgurl.getAllResponseHeaders()); */
|
||||
/*alert(\'img:\'+cacheimgstring);*/
|
||||
if (cacheimgstring != null && cacheimgstring.indexOf("no-cache") !== -1)
|
||||
{
|
||||
jQuery("#httpcacheimgok").hide();
|
||||
jQuery("#httpcacheimgko").show();
|
||||
}
|
||||
else
|
||||
{
|
||||
jQuery("#httpcacheimgok").show();
|
||||
jQuery("#httpcacheimgko").hide();
|
||||
}
|
||||
compimgstring=getimgurl.getResponseHeader(\'Content-Encoding\');
|
||||
/* alert(\'php:\'+getimgurl.getAllResponseHeaders()); */
|
||||
/*alert(\'php:\'+compimgstring);*/
|
||||
if (compimgstring == null || (compimgstring.indexOf("gzip") == -1 && compimgstring.indexOf("deflate") == -1))
|
||||
{
|
||||
jQuery("#httpcompimgok").hide();
|
||||
jQuery("#httpcompimgko").show();
|
||||
}
|
||||
else
|
||||
{
|
||||
jQuery("#httpcompimgok").show();
|
||||
jQuery("#httpcompimgko").hide();
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
var getjsurl;
|
||||
var cachejsstring;
|
||||
var compjsstring;
|
||||
getjsurl = $.ajax({
|
||||
type: "GET",
|
||||
url: \''.DOL_URL_ROOT.'/core/js/lib_head.js\',
|
||||
cache: false,
|
||||
/* async: false, */
|
||||
/* crossDomain: true,*/
|
||||
success: function () {
|
||||
cachejsstring=getjsurl.getResponseHeader(\'Cache-Control\');
|
||||
/*alert(\'js:\'+getjsurl.getAllResponseHeaders());*/
|
||||
/*alert(\'js:\'+cachejsstring);*/
|
||||
if (cachejsstring != null && cachejsstring.indexOf("no-cache") !== -1)
|
||||
{
|
||||
jQuery("#httpcachejsok").hide();
|
||||
jQuery("#httpcachejsko").show();
|
||||
}
|
||||
else
|
||||
{
|
||||
jQuery("#httpcachejsok").show();
|
||||
jQuery("#httpcachejsko").hide();
|
||||
}
|
||||
compjstring=getjsurl.getResponseHeader(\'Content-Encoding\');
|
||||
/* alert(\'php:\'+getjsurl.getAllResponseHeaders()); */
|
||||
/*alert(\'php:\'+compjsstring);*/
|
||||
if (compjsstring == null || (compjsstring.indexOf("gzip") == -1 && compjsstring.indexOf("deflate") == -1))
|
||||
{
|
||||
jQuery("#httpcompjsok").hide();
|
||||
jQuery("#httpcompjsko").show();
|
||||
}
|
||||
else
|
||||
{
|
||||
jQuery("#httpcompjsok").show();
|
||||
jQuery("#httpcompjsko").hide();
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
var getjsphpurl;
|
||||
var cachejsphpstring;
|
||||
var compjsphpstring;
|
||||
getjsphpurl = $.ajax({
|
||||
type: "GET",
|
||||
url: \''.DOL_URL_ROOT.'/core/js/datepicker.js.php\',
|
||||
cache: false,
|
||||
/* async: false, */
|
||||
/* crossDomain: true,*/
|
||||
success: function () {
|
||||
cachejsphpstring=getjsphpurl.getResponseHeader(\'Cache-Control\');
|
||||
/* alert(\'jsphp:\'+getjsphpurl.getAllResponseHeaders()); */
|
||||
/*alert(\'jsphp:\'+cachejsphpstring);*/
|
||||
if (cachejsphpstring != null && cachejsphpstring.indexOf("no-cache") !== -1)
|
||||
{
|
||||
jQuery("#httpcachejsphpok").hide();
|
||||
jQuery("#httpcachejsphpko").show();
|
||||
}
|
||||
else
|
||||
{
|
||||
jQuery("#httpcachejsphpok").show();
|
||||
jQuery("#httpcachejsphpko").hide();
|
||||
}
|
||||
compjsphpstring=getjsphpurl.getResponseHeader(\'Content-Encoding\');
|
||||
/* alert(\'php:\'+getjsphpurl.getAllResponseHeaders()); */
|
||||
/*alert(\'php:\'+compjsphpstring);*/
|
||||
if (compjsphpstring == null || (compjsphpstring.indexOf("gzip") == -1 && compjsphpstring.indexOf("deflate") == -1))
|
||||
{
|
||||
jQuery("#httpcompjsphpok").hide();
|
||||
jQuery("#httpcompjsphpko").show();
|
||||
}
|
||||
else
|
||||
{
|
||||
jQuery("#httpcompjsphpok").show();
|
||||
jQuery("#httpcompjsphpko").hide();
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
});
|
||||
</script>';
|
||||
|
||||
|
||||
print '<br>';
|
||||
print '<strong>'.$langs->trans("HTTPCacheStaticResources").' - ';
|
||||
print $langs->trans("CacheByServer").':</strong><br>';
|
||||
// No cahce on PHP
|
||||
//print '<div id="httpcachephpok">'.img_picto('','warning.png').' '.$langs->trans("FilesOfTypeNotCompressed",'php (.php)').'</div>';
|
||||
//print '<div id="httpcachephpko">'.img_picto('','tick.png').' '.$langs->trans("FilesOfTypeNotCached",'php (.php)').'</div>';
|
||||
// Cache on rest
|
||||
print '<div id="httpcachecssok">'.img_picto('','tick.png').' '.$langs->trans("FilesOfTypeCached",'css (.css)').'</div>';
|
||||
print '<div id="httpcachecssko">'.img_picto('','warning.png').' '.$langs->trans("FilesOfTypeNotCached",'css (.css)').'</div>';
|
||||
print '<div id="httpcachecssphpok">'.img_picto('','tick.png').' '.$langs->trans("FilesOfTypeCached",'css (.css.php)').'</div>';
|
||||
print '<div id="httpcachecssphpko">'.img_picto('','warning.png').' '.$langs->trans("FilesOfTypeNotCached",'css (.css.php)').'</div>';
|
||||
print '<div id="httpcacheimgok">'.img_picto('','tick.png').' '.$langs->trans("FilesOfTypeCached",'img (.png)').'</div>';
|
||||
print '<div id="httpcacheimgko">'.img_picto('','warning.png').' '.$langs->trans("FilesOfTypeNotCached",'img (.png)').'</div>';
|
||||
print '<div id="httpcachejsok">'.img_picto('','tick.png').' '.$langs->trans("FilesOfTypeCached",'javascript (.js)').'</div>';
|
||||
print '<div id="httpcachejsko">'.img_picto('','warning.png').' '.$langs->trans("FilesOfTypeNotCached",'javascript (.js)').'</div>';
|
||||
print '<div id="httpcachejsphpok">'.img_picto('','tick.png').' '.$langs->trans("FilesOfTypeCached",'javascript (.js.php)').'</div>';
|
||||
print '<div id="httpcachejsphpko">'.img_picto('','warning.png').' '.$langs->trans("FilesOfTypeNotCached",'javascript (.js.php)').'</div>';
|
||||
print '<br>';
|
||||
print '<strong>'.$langs->trans("HTTPCacheStaticResources").' - ';
|
||||
print $langs->trans("CacheByClient").':</strong><br>';
|
||||
print $langs->trans("TestNotPossibleWithCurrentBrowsers").'<br>';
|
||||
|
||||
|
||||
// Compressions
|
||||
print '<br>';
|
||||
print '<strong>'.$langs->trans("CompressionOfResources").'</strong>: ';
|
||||
//$tmp=getURLContent(DOL_URL_ROOT.'/index.php','GET');var_dump($tmp);
|
||||
print '<br>';
|
||||
// on PHP
|
||||
print '<div id="httpcompphpok">'.img_picto('','tick.png').' '.$langs->trans("FilesOfTypeCompressed",'php (.php)').'</div>';
|
||||
print '<div id="httpcompphpko">'.img_picto('','warning.png').' '.$langs->trans("FilesOfTypeNotCompressed",'php (.php)').'</div>';
|
||||
// on rest
|
||||
print '<div id="httpcompcssok">'.img_picto('','tick.png').' '.$langs->trans("FilesOfTypeCompressed",'css (.css)').'</div>';
|
||||
print '<div id="httpcompcssko">'.img_picto('','warning.png').' '.$langs->trans("FilesOfTypeNotCompressed",'css (.css)').'</div>';
|
||||
print '<div id="httpcompcssphpok">'.img_picto('','tick.png').' '.$langs->trans("FilesOfTypeCompressed",'css (.css.php)').'</div>';
|
||||
print '<div id="httpcompcssphpko">'.img_picto('','warning.png').' '.$langs->trans("FilesOfTypeNotCompressed",'css (.css.php)').'</div>';
|
||||
//print '<div id="httpcompimgok">'.img_picto('','tick.png').' '.$langs->trans("FilesOfTypeCompressed",'img (.png)').'</div>';
|
||||
//print '<div id="httpcompimgko">'.img_picto('','warning.png').' '.$langs->trans("FilesOfTypeNotCompressed",'img (.png)').'</div>';
|
||||
print '<div id="httpcompjsok">'.img_picto('','tick.png').' '.$langs->trans("FilesOfTypeCompressed",'javascript (.js)').'</div>';
|
||||
print '<div id="httpcompjsko">'.img_picto('','warning.png').' '.$langs->trans("FilesOfTypeNotCompressed",'javascript (.js)').'</div>';
|
||||
print '<div id="httpcompjsphpok">'.img_picto('','tick.png').' '.$langs->trans("FilesOfTypeCompressed",'javascript (.js.php)').'</div>';
|
||||
print '<div id="httpcompjsphpko">'.img_picto('','warning.png').' '.$langs->trans("FilesOfTypeNotCompressed",'javascript (.js.php)').'</div>';
|
||||
|
||||
// Database driver
|
||||
print '<br>';
|
||||
print '<strong>'.$langs->trans("DriverType").'</strong>: ';
|
||||
print '<br>';
|
||||
if ($conf->db->type == 'mysql' || $conf->db->type == 'mysqli')
|
||||
{
|
||||
$test=($conf->db->type == 'mysqli');
|
||||
if ($test)
|
||||
{
|
||||
print img_picto('','tick.png').' '.$langs->trans("YouUseBestDriver",$conf->db->type);
|
||||
}
|
||||
else
|
||||
{
|
||||
print img_picto('','warning.png').' '.$langs->trans("YouDoNotUseBestDriver",$conf->db->type,'mysqli');
|
||||
}
|
||||
print '<br>';
|
||||
}
|
||||
|
||||
// Product search
|
||||
print '<br>';
|
||||
print '<strong>'.$langs->trans("ProductSearch").'</strong>: ';
|
||||
print '<br>';
|
||||
$tab = array();
|
||||
$sql = "SELECT COUNT(*) as nb";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."product as p";
|
||||
$resql=$db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$limitforoptim=10000;
|
||||
$num=$db->num_rows($resql);
|
||||
if ($nb > $limitforoptim)
|
||||
{
|
||||
if (empty($conf->global->PRODUCT_DONOTSEARCH_ANYWHERE))
|
||||
{
|
||||
print img_picto('','warning.png').' '.$langs->trans("YouHaveXProductUseSearchOptim",$num);
|
||||
}
|
||||
else
|
||||
{
|
||||
print img_picto('','tick.png').' '.$langs->trans("YouHaveXProductAndSearchOptimOn",$num);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
print img_picto('','tick.png').' '.$langs->trans("NbOfProductIsLowerThanNoPb",$limitforoptim);
|
||||
}
|
||||
print '<br>';
|
||||
$db->free($resql);
|
||||
}
|
||||
|
||||
// Browser
|
||||
print '<br>';
|
||||
print '<strong>'.$langs->trans("Browser").'</strong>: ';
|
||||
var_dump($conf->browser);
|
||||
print '<br>';
|
||||
|
||||
// Database statistics update
|
||||
print '<br>';
|
||||
print '<strong>'.$langs->trans("DatabaseStatistics").'</strong>: ';
|
||||
print '<br>';
|
||||
|
||||
|
||||
|
||||
llxFooter();
|
||||
|
||||
$db->close();
|
||||
?>
|
||||
@ -56,7 +56,7 @@ if (function_exists('socket_create'))
|
||||
print 'XDEBUG_PORT: '.$port."<br>\n";
|
||||
print "<br>\n";
|
||||
$socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
|
||||
if (empty($socket)) die('Unable to preapre a socket');
|
||||
if (empty($socket)) die('Unable to prepare a socket');
|
||||
//socket_bind($sock, $address, $port) or die('Unable to bind on address='.$address.' port='.$port);
|
||||
//socket_listen($sock);
|
||||
//$client = socket_accept($sock);
|
||||
|
||||
@ -75,7 +75,7 @@ if (GETPOST('action','alpha')=='install')
|
||||
$result=dol_move_uploaded_file($_FILES['fileinstall']['tmp_name'],$newfile,1,0,$_FILES['fileinstall']['error']);
|
||||
if ($result > 0)
|
||||
{
|
||||
$documentrootalt=DOL_DOCUMENT_ROOT_ALT;
|
||||
$documentrootalt=DOL_DOCUMENT_ROOT.'/extensions';
|
||||
$result=dol_uncompress($newfile,$documentrootalt);
|
||||
if (! empty($result['error']))
|
||||
{
|
||||
@ -95,7 +95,7 @@ if (GETPOST('action','alpha')=='install')
|
||||
* View
|
||||
*/
|
||||
|
||||
$dirins=DOL_DOCUMENT_ROOT_ALT;
|
||||
$dirins=DOL_DOCUMENT_ROOT.'/extensions';
|
||||
$dirins_ok=(is_dir($dirins));
|
||||
|
||||
$wikihelp='EN:Installation_-_Upgrade|FR:Installation_-_Mise_à_jour|ES:Instalación_-_Actualización';
|
||||
@ -141,7 +141,7 @@ print '<b>'.$langs->trans("StepNb",3).'</b>: ';
|
||||
print $langs->trans("UnpackPackageInDolibarrRoot",$dolibarrroot).'<br>';
|
||||
if (! empty($conf->global->MAIN_ONLINE_INSTALL_MODULE))
|
||||
{
|
||||
if ($dirins_ok && $dirins != 'DOL_DOCUMENT_ROOT_ALT')
|
||||
if ($dirins_ok)
|
||||
{
|
||||
print '<form enctype="multipart/form-data" method="POST" class="noborder" action="'.$_SERVER["PHP_SELF"].'" name="forminstall">';
|
||||
print '<input type="hidden" name="action" value="install">';
|
||||
@ -151,8 +151,8 @@ if (! empty($conf->global->MAIN_ONLINE_INSTALL_MODULE))
|
||||
}
|
||||
else
|
||||
{
|
||||
$message=info_admin($langs->trans("NotExistsDirect").$langs->trans("InfDirAlt").$langs->trans("InfDirExample"));
|
||||
print $message;
|
||||
$message=info_admin($langs->trans("NotExistsDirect",$dirins).$langs->trans("InfDirAlt").$langs->trans("InfDirExample"));
|
||||
print '<div class="warning">'.$message.'</div>';
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
@ -40,9 +40,9 @@ class ActionComm extends CommonObject
|
||||
var $id;
|
||||
|
||||
var $type_id; // id into parent table llx_c_actioncomm (will be deprecated into future, link should not be required)
|
||||
var $type_code; // code into parent table llx_c_actioncomm (will be deprecated into future, link should not be required)
|
||||
var $type_code; // code into parent table llx_c_actioncomm (will be deprecated into future, link should not be required). With defautl setup, should be AC_OTH_AUTO or AC_OTH
|
||||
var $type; // label into parent table llx_c_actioncomm (will be deprecated into future, link should not be required)
|
||||
var $code;
|
||||
var $code; // Free code to identify action. Ie: Agenda trigger add here AC_TRIGGERNAME ('AC_COMPANY_CREATE', 'AC_PROPAL_VALIDATE', ...)
|
||||
var $label;
|
||||
|
||||
var $datec; // Date creation record (datec)
|
||||
|
||||
@ -56,7 +56,8 @@ $contactid=GETPOST('contactid','int');
|
||||
$socid = GETPOST('socid','int');
|
||||
$id = GETPOST('id','int');
|
||||
if ($user->societe_id) $socid=$user->societe_id;
|
||||
$result = restrictedArea($user, 'agenda', $id, 'actioncomm&societe', 'myactions&allactions', '', 'id');
|
||||
$result = restrictedArea($user,'societe',$id,'&societe');
|
||||
//$result = restrictedArea($user, 'agenda', $id, 'actioncomm&societe', 'myactions&allactions', '', 'id');
|
||||
|
||||
$error=GETPOST("error");
|
||||
$mesg='';
|
||||
|
||||
@ -804,7 +804,6 @@ else if ($action == "addline" && $user->rights->propal->creer)
|
||||
{
|
||||
// Insert line
|
||||
$result=$object->addline(
|
||||
$id,
|
||||
$desc,
|
||||
$pu_ht,
|
||||
GETPOST('qty'),
|
||||
|
||||
@ -314,9 +314,9 @@ class Propal extends CommonObject
|
||||
*
|
||||
* @see add_product
|
||||
*/
|
||||
function addline($propalid, $desc, $pu_ht, $qty, $txtva, $txlocaltax1=0, $txlocaltax2=0, $fk_product=0, $remise_percent=0, $price_base_type='HT', $pu_ttc=0, $info_bits=0, $type=0, $rang=-1, $special_code=0, $fk_parent_line=0, $fk_fournprice=0, $pa_ht=0, $label='',$date_start='', $date_end='',$array_option=0)
|
||||
function addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1=0, $txlocaltax2=0, $fk_product=0, $remise_percent=0, $price_base_type='HT', $pu_ttc=0, $info_bits=0, $type=0, $rang=-1, $special_code=0, $fk_parent_line=0, $fk_fournprice=0, $pa_ht=0, $label='',$date_start='', $date_end='',$array_option=0)
|
||||
{
|
||||
global $conf;
|
||||
$propalid=$this->id;
|
||||
|
||||
dol_syslog(get_class($this)."::addline propalid=$propalid, desc=$desc, pu_ht=$pu_ht, qty=$qty, txtva=$txtva, fk_product=$fk_product, remise_except=$remise_percent, price_base_type=$price_base_type, pu_ttc=$pu_ttc, info_bits=$info_bits, type=$type");
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php';
|
||||
@ -414,7 +414,6 @@ class Propal extends CommonObject
|
||||
$this->line->pa_ht = $pa_ht;
|
||||
|
||||
// Mise en option de la ligne
|
||||
//if ($conf->global->PROPALE_USE_OPTION_LINE && !$qty) $ligne->special_code=3;
|
||||
if (empty($qty) && empty($special_code)) $this->line->special_code=3;
|
||||
|
||||
// TODO deprecated
|
||||
@ -762,7 +761,6 @@ class Propal extends CommonObject
|
||||
}
|
||||
|
||||
$result = $this->addline(
|
||||
$this->id,
|
||||
$this->lines[$i]->desc,
|
||||
$this->lines[$i]->subprice,
|
||||
$this->lines[$i]->qty,
|
||||
@ -2468,22 +2466,32 @@ class Propal extends CommonObject
|
||||
global $conf, $db, $langs;
|
||||
$langs->load("propal");
|
||||
|
||||
$dir = DOL_DOCUMENT_ROOT . "/core/modules/propale/";
|
||||
|
||||
if (! empty($conf->global->PROPALE_ADDON))
|
||||
{
|
||||
$file = $conf->global->PROPALE_ADDON.".php";
|
||||
$mybool=false;
|
||||
|
||||
// Chargement de la classe de numerotation
|
||||
$file = $conf->global->PROPALE_ADDON.".php";
|
||||
$classname = $conf->global->PROPALE_ADDON;
|
||||
require_once $dir.$file;
|
||||
|
||||
// Include file with class
|
||||
foreach ($conf->file->dol_document_root as $dirroot)
|
||||
{
|
||||
$dir = $dirroot."/core/modules/propale/";
|
||||
// Load file with numbering class (if found)
|
||||
$mybool|=@include_once $dir.$file;
|
||||
}
|
||||
|
||||
if (! $mybool)
|
||||
{
|
||||
dol_print_error('',"Failed to include file ".$file);
|
||||
return '';
|
||||
}
|
||||
|
||||
$obj = new $classname();
|
||||
|
||||
$numref = "";
|
||||
$numref = $obj->getNextValue($soc,$this);
|
||||
|
||||
if ( $numref != "")
|
||||
if ($numref != "")
|
||||
{
|
||||
return $numref;
|
||||
}
|
||||
|
||||
@ -129,36 +129,39 @@ class Commande extends CommonOrder
|
||||
global $db, $langs, $conf;
|
||||
$langs->load("order");
|
||||
|
||||
$dir = DOL_DOCUMENT_ROOT . "/core/modules/commande";
|
||||
|
||||
if (! empty($conf->global->COMMANDE_ADDON))
|
||||
{
|
||||
$file = $conf->global->COMMANDE_ADDON.".php";
|
||||
$mybool=false;
|
||||
|
||||
// Chargement de la classe de numerotation
|
||||
$file = $conf->global->COMMANDE_ADDON.".php";
|
||||
$classname = $conf->global->COMMANDE_ADDON;
|
||||
|
||||
$result=include_once $dir.'/'.$file;
|
||||
if ($result)
|
||||
// Include file with class
|
||||
foreach ($conf->file->dol_document_root as $dirroot)
|
||||
{
|
||||
$obj = new $classname();
|
||||
$numref = "";
|
||||
$numref = $obj->getNextValue($soc,$this);
|
||||
$dir = $dirroot."/core/modules/commande/";
|
||||
// Load file with numbering class (if found)
|
||||
$mybool|=@include_once $dir.$file;
|
||||
}
|
||||
|
||||
if ( $numref != "")
|
||||
{
|
||||
return $numref;
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($db,get_class($this)."::getNextNumRef ".$obj->error);
|
||||
return "";
|
||||
}
|
||||
if (! $mybool)
|
||||
{
|
||||
dol_print_error('',"Failed to include file ".$file);
|
||||
return '';
|
||||
}
|
||||
|
||||
$obj = new $classname();
|
||||
$numref = "";
|
||||
$numref = $obj->getNextValue($soc,$this);
|
||||
|
||||
if ($numref != "")
|
||||
{
|
||||
return $numref;
|
||||
}
|
||||
else
|
||||
{
|
||||
print $langs->trans("Error")." ".$langs->trans("Error_COMMANDE_ADDON_NotDefined");
|
||||
return "";
|
||||
{
|
||||
dol_print_error($db,get_class($this)."::getNextNumRef ".$obj->error);
|
||||
return "";
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -678,7 +681,6 @@ class Commande extends CommonOrder
|
||||
}
|
||||
|
||||
$result = $this->addline(
|
||||
$this->id,
|
||||
$this->lines[$i]->desc,
|
||||
$this->lines[$i]->subprice,
|
||||
$this->lines[$i]->qty,
|
||||
@ -1002,7 +1004,6 @@ class Commande extends CommonOrder
|
||||
/**
|
||||
* Add an order line into database (linked to product/service or not)
|
||||
*
|
||||
* @param int $commandeid Id of line
|
||||
* @param string $desc Description of line
|
||||
* @param double $pu_ht Unit price (without tax)
|
||||
* @param double $qty Quantite
|
||||
@ -1034,8 +1035,10 @@ class Commande extends CommonOrder
|
||||
* par l'appelant par la methode get_default_tva(societe_vendeuse,societe_acheteuse,produit)
|
||||
* et le desc doit deja avoir la bonne valeur (a l'appelant de gerer le multilangue)
|
||||
*/
|
||||
function addline($commandeid, $desc, $pu_ht, $qty, $txtva, $txlocaltax1=0, $txlocaltax2=0, $fk_product=0, $remise_percent=0, $info_bits=0, $fk_remise_except=0, $price_base_type='HT', $pu_ttc=0, $date_start='', $date_end='', $type=0, $rang=-1, $special_code=0, $fk_parent_line=0, $fk_fournprice=null, $pa_ht=0, $label='',$array_option=0)
|
||||
function addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1=0, $txlocaltax2=0, $fk_product=0, $remise_percent=0, $info_bits=0, $fk_remise_except=0, $price_base_type='HT', $pu_ttc=0, $date_start='', $date_end='', $type=0, $rang=-1, $special_code=0, $fk_parent_line=0, $fk_fournprice=null, $pa_ht=0, $label='',$array_option=0)
|
||||
{
|
||||
$commandeid=$this->id;
|
||||
|
||||
dol_syslog(get_class($this)."::addline commandeid=$commandeid, desc=$desc, pu_ht=$pu_ht, qty=$qty, txtva=$txtva, fk_product=$fk_product, remise_percent=$remise_percent, info_bits=$info_bits, fk_remise_except=$fk_remise_except, price_base_type=$price_base_type, pu_ttc=$pu_ttc, date_start=$date_start, date_end=$date_end, type=$type", LOG_DEBUG);
|
||||
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php';
|
||||
|
||||
@ -322,7 +322,6 @@ else if ($action == 'add' && $user->rights->commande->creer)
|
||||
}
|
||||
|
||||
$result = $object->addline(
|
||||
$object_id,
|
||||
$desc,
|
||||
$lines[$i]->subprice,
|
||||
$lines[$i]->qty,
|
||||
@ -739,7 +738,6 @@ else if ($action == 'addline' && $user->rights->commande->creer)
|
||||
{
|
||||
// Insert line
|
||||
$result = $object->addline(
|
||||
$object->id,
|
||||
$desc,
|
||||
$pu_ht,
|
||||
GETPOST('qty'),
|
||||
|
||||
@ -269,7 +269,6 @@ if (($action == 'create' || $action == 'add') && empty($mesgs))
|
||||
$fk_parent_line = 0;
|
||||
}
|
||||
$result = $object->addline(
|
||||
$id,
|
||||
$desc,
|
||||
$lines[$i]->subprice,
|
||||
$lines[$i]->qty,
|
||||
@ -428,7 +427,7 @@ if ($action == 'create' && empty($mesgs))
|
||||
if (! empty($conf->projet->enabled))
|
||||
{
|
||||
$formproject=new FormProjets($db);
|
||||
|
||||
|
||||
$langs->load('projects');
|
||||
print '<tr><td>'.$langs->trans('Project').'</td><td colspan="2">';
|
||||
$formproject->select_projects($soc->id, $projectid, 'projectid');
|
||||
|
||||
@ -758,7 +758,7 @@ else if ($action == 'add' && $user->rights->facture->creer)
|
||||
$product->fetch($_POST['idprod'.$i]);
|
||||
$startday=dol_mktime(12, 0, 0, $_POST['date_start'.$i.'month'], $_POST['date_start'.$i.'day'], $_POST['date_start'.$i.'year']);
|
||||
$endday=dol_mktime(12, 0, 0, $_POST['date_end'.$i.'month'], $_POST['date_end'.$i.'day'], $_POST['date_end'.$i.'year']);
|
||||
$result=$object->addline($id,$product->description,$product->price, $_POST['qty'.$i], $product->tva_tx, $product->localtax1_tx, $product->localtax2_tx, $_POST['idprod'.$i], $_POST['remise_percent'.$i], $startday, $endday, 0, 0, '', $product->price_base_type, $product->price_ttc, $product->type);
|
||||
$result=$object->addline($product->description,$product->price, $_POST['qty'.$i], $product->tva_tx, $product->localtax1_tx, $product->localtax2_tx, $_POST['idprod'.$i], $_POST['remise_percent'.$i], $startday, $endday, 0, 0, '', $product->price_base_type, $product->price_ttc, $product->type);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -913,7 +913,6 @@ else if ($action == 'add' && $user->rights->facture->creer)
|
||||
}
|
||||
|
||||
$result = $object->addline(
|
||||
$id,
|
||||
$langs->trans('Deposit'),
|
||||
$amountdeposit, //subprice
|
||||
1, //quantity
|
||||
@ -1016,7 +1015,6 @@ else if ($action == 'add' && $user->rights->facture->creer)
|
||||
}
|
||||
|
||||
$result = $object->addline(
|
||||
$id,
|
||||
$desc,
|
||||
$lines[$i]->subprice,
|
||||
$lines[$i]->qty,
|
||||
@ -1093,7 +1091,7 @@ else if ($action == 'add' && $user->rights->facture->creer)
|
||||
$product->fetch($_POST['idprod'.$i]);
|
||||
$startday=dol_mktime(12, 0, 0, $_POST['date_start'.$i.'month'], $_POST['date_start'.$i.'day'], $_POST['date_start'.$i.'year']);
|
||||
$endday=dol_mktime(12, 0, 0, $_POST['date_end'.$i.'month'], $_POST['date_end'.$i.'day'], $_POST['date_end'.$i.'year']);
|
||||
$result=$object->addline($id,$product->description,$product->price, $_POST['qty'.$i], $product->tva_tx, $product->localtax1_tx, $product->localtax2_tx, $_POST['idprod'.$i], $_POST['remise_percent'.$i], $startday, $endday, 0, 0, '', $product->price_base_type, $product->price_ttc, $product->type);
|
||||
$result=$object->addline($product->description,$product->price, $_POST['qty'.$i], $product->tva_tx, $product->localtax1_tx, $product->localtax2_tx, $_POST['idprod'.$i], $_POST['remise_percent'.$i], $startday, $endday, 0, 0, '', $product->price_base_type, $product->price_ttc, $product->type);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1311,7 +1309,6 @@ else if (($action == 'addline' || $action == 'addline_predef') && $user->rights-
|
||||
{
|
||||
// Insert line
|
||||
$result = $object->addline(
|
||||
$id,
|
||||
$desc,
|
||||
$pu_ht,
|
||||
GETPOST('qty'),
|
||||
|
||||
@ -147,7 +147,6 @@ class FactureRec extends Facture
|
||||
for ($i = 0; $i < $num; $i++)
|
||||
{
|
||||
$result_insert = $this->addline(
|
||||
$this->id,
|
||||
$facsrc->lines[$i]->desc,
|
||||
$facsrc->lines[$i]->subprice,
|
||||
$facsrc->lines[$i]->qty,
|
||||
@ -399,7 +398,6 @@ class FactureRec extends Facture
|
||||
/**
|
||||
* Add a line to invoice
|
||||
*
|
||||
* @param int $facid Id de la facture
|
||||
* @param string $desc Description de la ligne
|
||||
* @param double $pu_ht Prix unitaire HT (> 0 even for credit note)
|
||||
* @param double $qty Quantite
|
||||
@ -416,8 +414,10 @@ class FactureRec extends Facture
|
||||
* @param string $label Label of the line
|
||||
* @return int <0 if KO, Id of line if OK
|
||||
*/
|
||||
function addline($facid, $desc, $pu_ht, $qty, $txtva, $fk_product=0, $remise_percent=0, $price_base_type='HT', $info_bits=0, $fk_remise_except='', $pu_ttc=0, $type=0, $rang=-1, $special_code=0, $label='')
|
||||
function addline($desc, $pu_ht, $qty, $txtva, $fk_product=0, $remise_percent=0, $price_base_type='HT', $info_bits=0, $fk_remise_except='', $pu_ttc=0, $type=0, $rang=-1, $special_code=0, $label='')
|
||||
{
|
||||
$facid=$this->id;
|
||||
|
||||
dol_syslog("FactureRec::addline facid=$facid,desc=$desc,pu_ht=$pu_ht,qty=$qty,txtva=$txtva,fk_product=$fk_product,remise_percent=$remise_percent,date_start=$date_start,date_end=$date_end,ventil=$ventil,info_bits=$info_bits,fk_remise_except=$fk_remise_except,price_base_type=$price_base_type,pu_ttc=$pu_ttc,type=$type", LOG_DEBUG);
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php';
|
||||
|
||||
|
||||
@ -344,7 +344,6 @@ class Facture extends CommonInvoice
|
||||
}
|
||||
|
||||
$result = $this->addline(
|
||||
$this->id,
|
||||
$this->lines[$i]->desc,
|
||||
$this->lines[$i]->subprice,
|
||||
$this->lines[$i]->qty,
|
||||
@ -403,7 +402,6 @@ class Facture extends CommonInvoice
|
||||
$localtax2_tx=get_localtax($tva_tx,2,$soc);
|
||||
|
||||
$result_insert = $this->addline(
|
||||
$this->id,
|
||||
$_facrec->lines[$i]->desc,
|
||||
$_facrec->lines[$i]->subprice,
|
||||
$_facrec->lines[$i]->qty,
|
||||
@ -1943,7 +1941,6 @@ class Facture extends CommonInvoice
|
||||
* par l'appelant par la methode get_default_tva(societe_vendeuse,societe_acheteuse,produit)
|
||||
* et le desc doit deja avoir la bonne valeur (a l'appelant de gerer le multilangue)
|
||||
*
|
||||
* @param int $facid Id de la facture
|
||||
* @param string $desc Description de la ligne
|
||||
* @param double $pu_ht Prix unitaire HT (> 0 even for credit note)
|
||||
* @param double $qty Quantite
|
||||
@ -1971,8 +1968,10 @@ class Facture extends CommonInvoice
|
||||
* @param array $array_option extrafields array
|
||||
* @return int <0 if KO, Id of line if OK
|
||||
*/
|
||||
function addline($facid, $desc, $pu_ht, $qty, $txtva, $txlocaltax1=0, $txlocaltax2=0, $fk_product=0, $remise_percent=0, $date_start='', $date_end='', $ventil=0, $info_bits=0, $fk_remise_except='', $price_base_type='HT', $pu_ttc=0, $type=0, $rang=-1, $special_code=0, $origin='', $origin_id=0, $fk_parent_line=0, $fk_fournprice=null, $pa_ht=0, $label='',$array_option=0)
|
||||
function addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1=0, $txlocaltax2=0, $fk_product=0, $remise_percent=0, $date_start='', $date_end='', $ventil=0, $info_bits=0, $fk_remise_except='', $price_base_type='HT', $pu_ttc=0, $type=0, $rang=-1, $special_code=0, $origin='', $origin_id=0, $fk_parent_line=0, $fk_fournprice=null, $pa_ht=0, $label='',$array_option=0)
|
||||
{
|
||||
$facid=$this->id;
|
||||
|
||||
dol_syslog(get_class($this)."::Addline facid=$facid,desc=$desc,pu_ht=$pu_ht,qty=$qty,txtva=$txtva, txlocaltax1=$txlocaltax1, txlocaltax2=$txlocaltax2, fk_product=$fk_product,remise_percent=$remise_percent,date_start=$date_start,date_end=$date_end,ventil=$ventil,info_bits=$info_bits,fk_remise_except=$fk_remise_except,price_base_type=$price_base_type,pu_ttc=$pu_ttc,type=$type", LOG_DEBUG);
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php';
|
||||
|
||||
@ -2540,11 +2539,10 @@ class Facture extends CommonInvoice
|
||||
}
|
||||
|
||||
$obj = new $classname();
|
||||
|
||||
$numref = "";
|
||||
$numref = $obj->getNumRef($soc,$this,$mode);
|
||||
|
||||
if ( $numref != "")
|
||||
if ($numref != "")
|
||||
{
|
||||
return $numref;
|
||||
}
|
||||
|
||||
@ -37,21 +37,20 @@ $dolibarr_main_document_root='';
|
||||
|
||||
|
||||
// dolibarr_main_url_root_alt
|
||||
// This parameter defines the alternative URL of your Dolibarr.
|
||||
// It must link to a secondary directory htdocs.
|
||||
// This parameter defines the relative sub URLs of alternative Dolibarr root directories.
|
||||
// It can be links to some other secondary htdocs directories, separated by a coma.
|
||||
// Examples:
|
||||
// $dolibarr_main_url_root_alt='http://localhost/custom';
|
||||
// $dolibarr_main_url_root_alt='http://mydolibarrvirtualhost/custom';
|
||||
// $dolibarr_main_url_root_alt='http://myserver/dolibarr/htdocs/custom';
|
||||
// $dolibarr_main_url_root_alt='/extensions';
|
||||
// $dolibarr_main_url_root_alt='/extensions1,/extensions2';
|
||||
//
|
||||
$dolibarr_main_url_root_alt='';
|
||||
|
||||
|
||||
// dolibarr_main_document_root_alt
|
||||
// This parameter contains absolute alternative file system directory of Dolibarr
|
||||
// This parameter contains absolute alternative root file system directories of Dolibarr
|
||||
// Examples:
|
||||
// $dolibarr_main_document_root_alt='/var/www/dolibarr/htdocs/custom';
|
||||
// $dolibarr_main_document_root_alt='C:/My web sites/dolibarr/htdocs/custom';
|
||||
// $dolibarr_main_document_root_alt='/var/www/dolibarr/htdocs/extensions';
|
||||
// $dolibarr_main_document_root_alt='C:/My web sites/dolibarr/htdocs/extensions1,C:/My web sites/dolibarr/htdocs/extensions2';
|
||||
//
|
||||
$dolibarr_main_document_root_alt='';
|
||||
|
||||
|
||||
@ -2076,7 +2076,7 @@ class ContratLigne
|
||||
/**
|
||||
* Load elements linked to contract (only intervention for the moment)
|
||||
*
|
||||
* @param User $user Objet type
|
||||
* @param string $type Object type
|
||||
* @return array $elements array of linked elements
|
||||
*/
|
||||
function get_element_list($type)
|
||||
|
||||
@ -289,6 +289,9 @@ abstract class CommonInvoice extends CommonObject
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Parent class of all other business classes for details of elements (invoices, contracts, proposals, orders, ...)
|
||||
*/
|
||||
abstract class CommonInvoiceLine extends CommonObject
|
||||
{
|
||||
}
|
||||
|
||||
@ -42,7 +42,7 @@ abstract class CommonObject
|
||||
public $firstname;
|
||||
public $civility_id;
|
||||
public $import_key;
|
||||
|
||||
|
||||
public $array_options=array();
|
||||
|
||||
public $linkedObjectsIds;
|
||||
@ -53,7 +53,7 @@ abstract class CommonObject
|
||||
|
||||
/**
|
||||
* Method to output saved errors
|
||||
*
|
||||
*
|
||||
* @return string String with errors
|
||||
*/
|
||||
function errorsToString()
|
||||
@ -1464,15 +1464,18 @@ abstract class CommonObject
|
||||
}
|
||||
|
||||
/**
|
||||
* Update total_ht, total_ttc and total_vat for an object (sum of lines)
|
||||
* Update total_ht, total_ttc, total_vat, total_localtax1, total_localtax2 for an object (sum of lines).
|
||||
* Must be called at end of methods addline, updateline.
|
||||
*
|
||||
* @param int $exclspec Exclude special product (product_type=9)
|
||||
* @param int $roundingadjust -1=Use default method (MAIN_ROUNDOFTOTAL_NOT_TOTALOFROUND or 0), 0=Use total of rounding, 1=Use rounding of total
|
||||
* @param int $roundingadjust -1=Use default method (MAIN_ROUNDOFTOTAL_NOT_TOTALOFROUND if defined, or 0), 0=Force use total of rounding, 1=Force use rounding of total
|
||||
* @param int $nodatabaseupdate 1=Do not update database. Update only properties of object.
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function update_price($exclspec=0,$roundingadjust=-1,$nodatabaseupdate=0)
|
||||
{
|
||||
global $conf;
|
||||
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php';
|
||||
|
||||
if ($roundingadjust < 0 && isset($conf->global->MAIN_ROUNDOFTOTAL_NOT_TOTALOFROUND)) $roundingadjust=$conf->global->MAIN_ROUNDOFTOTAL_NOT_TOTALOFROUND;
|
||||
@ -1486,7 +1489,7 @@ abstract class CommonObject
|
||||
$fieldlocaltax2='total_localtax2';
|
||||
if ($this->element == 'facture_fourn' || $this->element == 'invoice_supplier') $fieldtva='tva';
|
||||
|
||||
$sql = 'SELECT qty, total_ht, '.$fieldtva.' as total_tva, total_ttc, '.$fieldlocaltax1.' as total_localtax1, '.$fieldlocaltax2.' as total_localtax2,';
|
||||
$sql = 'SELECT rowid, qty, total_ht, '.$fieldtva.' as total_tva, total_ttc, '.$fieldlocaltax1.' as total_localtax1, '.$fieldlocaltax2.' as total_localtax2,';
|
||||
$sql.= ' tva_tx as vatrate, localtax1_tx, localtax2_tx, localtax1_type, localtax2_type';
|
||||
$sql.= ' FROM '.MAIN_DB_PREFIX.$this->table_element_line;
|
||||
$sql.= ' WHERE '.$this->fk_element.' = '.$this->id;
|
||||
@ -1496,6 +1499,7 @@ abstract class CommonObject
|
||||
if ($this->table_element_line == 'contratdet') $product_field=''; // contratdet table has no product_type field
|
||||
if ($product_field) $sql.= ' AND '.$product_field.' <> 9';
|
||||
}
|
||||
$sql.= ' ORDER by rowid'; // We want to be sure to always use same order of line to not change lines differently when option MAIN_ROUNDOFTOTAL_NOT_TOTALOFROUND is used
|
||||
|
||||
dol_syslog(get_class($this)."::update_price sql=".$sql);
|
||||
$resql = $this->db->query($sql);
|
||||
@ -1506,8 +1510,9 @@ abstract class CommonObject
|
||||
$this->total_localtax1 = 0;
|
||||
$this->total_localtax2 = 0;
|
||||
$this->total_ttc = 0;
|
||||
$vatrates = array();
|
||||
$vatrates_alllines = array();
|
||||
$total_ht_by_vats = array();
|
||||
$total_tva_by_vats = array();
|
||||
$total_ttc_by_vats = array();
|
||||
|
||||
$num = $this->db->num_rows($resql);
|
||||
$i = 0;
|
||||
@ -1515,42 +1520,34 @@ abstract class CommonObject
|
||||
{
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
|
||||
$this->total_ht += $obj->total_ht;
|
||||
$this->total_ht += $obj->total_ht; // The only field visible at line level
|
||||
$this->total_tva += $obj->total_tva;
|
||||
$this->total_localtax1 += $obj->total_localtax1;
|
||||
$this->total_localtax2 += $obj->total_localtax2;
|
||||
$this->total_ttc += $obj->total_ttc;
|
||||
$total_ht_by_vats[$obj->vatrate] += $obj->total_ht;
|
||||
$total_tva_by_vats[$obj->vatrate] += $obj->total_tva;
|
||||
$total_ttc_by_vats[$obj->vatrate] += $obj->total_ttc;
|
||||
|
||||
// Check if there is a global invoice tax for this vat rate
|
||||
// FIXME: We should have no database access into this function. Also localtax 7 seems to have problem so i add condition to avoid it into standard usage without loosing it.
|
||||
if (! empty($conf->global->MAIN_USE_LOCALTAX_TYPE_7))
|
||||
if ($roundingadjust) // Check if we need adjustement onto line for vat
|
||||
{
|
||||
if ($this->total_localtax1 == 0)
|
||||
{
|
||||
// Search to know if there is a localtax of type 7
|
||||
// TODO : store local taxes types into object lines and remove this. We should use here $obj->localtax1_type but it is not yet filled into database, so we search into table of vat rate
|
||||
global $mysoc;
|
||||
$localtax1_array=getLocalTaxesFromRate($vatrate,1,$mysoc);
|
||||
if (empty($obj->localtax1_type))
|
||||
{
|
||||
$obj->localtax1_type = $localtax1_array[0];
|
||||
$obj->localtax1_tx = $localtax1_array[1];
|
||||
}
|
||||
//end TODO
|
||||
}
|
||||
if ($this->total_localtax2 == 0)
|
||||
{
|
||||
// Search to know if there is a localtax of type 7
|
||||
// TODO : store local taxes types into object lines and remove this. We should use here $obj->localtax1_type but it is not yet filled into database, so we search into table of vat rate
|
||||
global $mysoc;
|
||||
$localtax2_array=getLocalTaxesFromRate($vatrate,2,$mysoc);
|
||||
if (empty($obj->localtax2_type))
|
||||
{
|
||||
$obj->localtax2_type = $localtax2_array[0];
|
||||
$obj->localtax2_tx = $localtax2_array[1];
|
||||
}
|
||||
//end TODO
|
||||
}
|
||||
$tmpvat=price2num($total_ht_by_vats[$obj->vatrate] * $obj->vatrate / 100, 'MT', 1);
|
||||
$diff=price2num($total_tva_by_vats[$obj->vatrate]-$tmpvat, 'MT', 1);
|
||||
//print 'Line '.$i.' rowid='.$obj->rowid.' vat_rate='.$obj->vatrate.' total_ht='.$obj->total_ht.' total_tva='.$obj->total_tva.' total_ttc='.$obj->total_ttc.' total_ht_by_vats='.$total_ht_by_vats[$obj->vatrate].' total_tva_by_vats='.$total_tva_by_vats[$obj->vatrate].' (new calculation = '.$tmpvat.') total_ttc_by_vats='.$total_ttc_by_vats[$obj->vatrate].($diff?" => DIFF":"")."<br>\n";
|
||||
if ($diff)
|
||||
{
|
||||
if ($diff > 0.1) { dol_print_error('','A rounding difference was detected but is to high to be corrected'); exit; }
|
||||
$sqlfix="UPDATE ".MAIN_DB_PREFIX.$this->table_element_line." SET ".$fieldtva." = ".($obj->total_tva - $diff).", total_ttc = ".($obj->total_ttc - $diff)." WHERE rowid = ".$obj->rowid;
|
||||
//print 'We found a difference of '.$diff.' for line rowid = '.$obj->rowid.". Run sqlfix = ".$sqlfix."<br>\n";
|
||||
dol_syslog('We found a difference of '.$diff.' for line rowid = '.$obj->rowid.". Run sqlfix = ".$sqlfix);
|
||||
$resqlfix=$this->db->query($sqlfix);
|
||||
if (! $resqlfix) dol_print_error($this->db,'Failed to update line');
|
||||
$this->total_tva -= $diff;
|
||||
$this->total_ttc -= $diff;
|
||||
$total_tva_by_vats[$obj->vatrate] -= $diff;
|
||||
$total_ttc_by_vats[$obj->vatrate] -= $diff;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
$i++;
|
||||
@ -1567,6 +1564,7 @@ abstract class CommonObject
|
||||
$fieldlocaltax1='localtax1';
|
||||
$fieldlocaltax2='localtax2';
|
||||
$fieldttc='total_ttc';
|
||||
// Specific code for backward compatibility with old field names
|
||||
if ($this->element == 'facture' || $this->element == 'facturerec') $fieldht='total';
|
||||
if ($this->element == 'facture_fourn' || $this->element == 'invoice_supplier') $fieldtva='total_tva';
|
||||
if ($this->element == 'propal') $fieldttc='total';
|
||||
@ -2748,7 +2746,7 @@ abstract class CommonObject
|
||||
* @param string $seller Object of seller third party
|
||||
* @param string $buyer Object of buyer third party
|
||||
* @param string $selected Object line selected
|
||||
* @param object $extrafieldline Object of extrafield line attribute
|
||||
* @param object $extrafieldsline Object of extrafield line attribute
|
||||
* @return void
|
||||
*/
|
||||
function printObjectLine($action,$line,$var,$num,$i,$dateSelector,$seller,$buyer,$selected=0,$extrafieldsline=0)
|
||||
@ -3015,9 +3013,10 @@ abstract class CommonObject
|
||||
|
||||
|
||||
/**
|
||||
* get Margin info
|
||||
*
|
||||
* @param string $force_price
|
||||
* @return multitype:number string NULL
|
||||
* @param string $force_price True of not
|
||||
* @return mixed Array with info
|
||||
*/
|
||||
function getMarginInfos($force_price=false) {
|
||||
global $conf;
|
||||
|
||||
@ -65,18 +65,18 @@ class DolGeoIP
|
||||
print $this->errorlabel;
|
||||
return 0;
|
||||
}
|
||||
if (! file_exists($datfile))
|
||||
if (! file_exists($datfile) || ! is_readable($datfile))
|
||||
{
|
||||
//dol_syslog("DolGeoIP::DolGeoIP datafile ".$datfile." can not be read", LOG_ERR);
|
||||
$this->error='ErrorGeoIPClassNotInitialized';
|
||||
$this->errorlabel="Datafile ".$datfile." not found";
|
||||
print $this->errorlabel;
|
||||
print $this->errorlabel; // To be sure to understand when it fails on screens
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (function_exists('geoip_open'))
|
||||
{
|
||||
$this->gi = geoip_open($datfile,GEOIP_STANDARD);
|
||||
$this->gi = geoip_open($datfile,GEOIP_STANDARD);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -133,7 +133,7 @@ class DolGeoIP
|
||||
function getVersion()
|
||||
{
|
||||
if ($this->gi == 'NOGI') return geoip_database_info();
|
||||
return '';
|
||||
return 'Not available (not using PHP internal geo functions)';
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -79,7 +79,7 @@ class dolprintIPP
|
||||
|
||||
/**
|
||||
* Print selected file
|
||||
*
|
||||
*
|
||||
* @param string $file file
|
||||
* @param string $module module
|
||||
*
|
||||
@ -181,6 +181,8 @@ class dolprintIPP
|
||||
/**
|
||||
* Get printer detail
|
||||
*
|
||||
* @param string $uri URI
|
||||
* @return array List of attributes
|
||||
*/
|
||||
function get_printer_detail($uri)
|
||||
{
|
||||
|
||||
@ -131,7 +131,7 @@ class HookManager
|
||||
// Define type of hook ('output', 'returnvalue' or 'addreplace'). 'addreplace' should be type for all hooks. 'output' and 'returnvalue' are deprecated.
|
||||
$hooktype='output';
|
||||
if (preg_match('/^pdf_/',$method)) $hooktype='returnvalue'; // pdf_xxx except pdf_writelinedesc are returnvalue hooks. When there is 2 hooks of this type, only last one win.
|
||||
if (in_array($method,array('doActions','formObjectOptions','moveUploadedFile','pdf_writelinedesc','paymentsupplierinvoices','printSearchForm'))) $hooktype='addreplace';
|
||||
if (in_array($method,array('doActions','formObjectOptions','moveUploadedFile','pdf_writelinedesc','paymentsupplierinvoices','printSearchForm', 'formattachOptions', 'formBuilddocLineOptions'))) $hooktype='addreplace';
|
||||
|
||||
// Loop on each hook to qualify modules that declared context
|
||||
$modulealreadyexecuted=array();
|
||||
@ -159,13 +159,13 @@ class HookManager
|
||||
{
|
||||
$error++;
|
||||
$this->error=$actionclassinstance->error; $this->errors=array_merge($this->errors, (array) $actionclassinstance->errors);
|
||||
|
||||
// TODO remove this. Change must be inside the method of hook if required
|
||||
// TODO remove this.
|
||||
/* Change must be inside the method of hook if required. Only hook must decide if $action must be modified or not.
|
||||
if ($method == 'doActions')
|
||||
{
|
||||
if ($action=='add') $action='create';
|
||||
if ($action=='update') $action='edit';
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
if (is_array($actionclassinstance->results)) $this->resArray =array_merge($this->resArray, $actionclassinstance->results);
|
||||
@ -181,11 +181,10 @@ class HookManager
|
||||
|
||||
if (! empty($actionclassinstance->results) && is_array($actionclassinstance->results)) $this->resArray =array_merge($this->resArray, $actionclassinstance->results);
|
||||
if (! empty($actionclassinstance->resprints)) $this->resPrint.=$actionclassinstance->resprints;
|
||||
|
||||
// TODO. remove this. array result must be set into $actionclassinstance->results
|
||||
if (is_array($result)) $this->resArray = array_merge($this->resArray, $result);
|
||||
// TODO. remove this. result must not be a string. we must use $actionclassinstance->resprint to return a string
|
||||
if (! is_array($result) && ! is_numeric($result)) $this->resPrint.=$result;
|
||||
//if (is_array($result)) $this->resArray = array_merge($this->resArray, $result);
|
||||
// TODO. remove this. result must not be a string. we must use $actionclassinstance->resprints to return a string
|
||||
//if (! is_array($result) && ! is_numeric($result)) $this->resPrint.=$result;
|
||||
}
|
||||
|
||||
//print "After hook ".get_class($actionclassinstance)." method=".$method." results=".count($actionclassinstance->results)." resprints=".count($actionclassinstance->resprints)." result=".$result." resaction=".$resaction."<br>\n";
|
||||
|
||||
@ -1372,7 +1372,7 @@ class Form
|
||||
$objp->remise = $objp2->remise;
|
||||
$objp->price_by_qty_rowid = $objp2->rowid;
|
||||
|
||||
$this->_construct_product_list_option($objp, $opt, $optJson, 0, $selected);
|
||||
$this->constructProductListOption($objp, $opt, $optJson, 0, $selected);
|
||||
|
||||
$j++;
|
||||
|
||||
@ -1386,7 +1386,7 @@ class Form
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->_construct_product_list_option($objp, $opt, $optJson, $price_level, $selected);
|
||||
$this->constructProductListOption($objp, $opt, $optJson, $price_level, $selected);
|
||||
// Add new entry
|
||||
// "key" value of json key array is used by jQuery automatically as selected value
|
||||
// "label" value of json key array is used by jQuery automatically as text for combo box
|
||||
@ -1411,16 +1411,16 @@ class Form
|
||||
}
|
||||
|
||||
/**
|
||||
* _construct_product_list_option
|
||||
* constructProductListOption
|
||||
*
|
||||
* @param resultset &$objp Resultset of fetch
|
||||
* @param string $opt Option
|
||||
* @param string $optJson Option
|
||||
* @param resultset &$objp Resultset of fetch
|
||||
* @param string &$opt Option
|
||||
* @param string &$optJson Option
|
||||
* @param int $price_level Price level
|
||||
* @param string $selected Preselected value
|
||||
* @return
|
||||
* @return void
|
||||
*/
|
||||
private function _construct_product_list_option(&$objp, &$opt, &$optJson, $price_level, $selected)
|
||||
private function constructProductListOption(&$objp, &$opt, &$optJson, $price_level, $selected)
|
||||
{
|
||||
global $langs,$conf,$user,$db;
|
||||
|
||||
@ -1475,7 +1475,7 @@ class Form
|
||||
$sql.= " ORDER BY date_price";
|
||||
$sql.= " DESC LIMIT 1";
|
||||
|
||||
dol_syslog(get_class($this)."::_construct_product_list_option search price for level '.$price_level.' sql=".$sql);
|
||||
dol_syslog(get_class($this)."::constructProductListOption search price for level '.$price_level.' sql=".$sql);
|
||||
$result2 = $this->db->query($sql);
|
||||
if ($result2)
|
||||
{
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
<?php
|
||||
/* Copyright (c) 2008-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
/* Copyright (c) 2008-2013 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2010-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (c) 2010 Juanjo Menent <jmenent@2byte.es>
|
||||
*
|
||||
@ -64,7 +64,8 @@ class FormFile
|
||||
*/
|
||||
function form_attach_new_file($url, $title='', $addcancel=0, $sectionid=0, $perm=1, $size=50, $object='', $options='', $useajax=true)
|
||||
{
|
||||
global $conf,$langs;
|
||||
global $conf,$langs, $hookmanager;
|
||||
$hookmanager->initHooks(array('formfile'));
|
||||
|
||||
if (! empty($conf->browser->phone)) return 0;
|
||||
|
||||
@ -76,22 +77,22 @@ class FormFile
|
||||
{
|
||||
$maxlength=$size;
|
||||
|
||||
print "\n\n<!-- Start form attach new file -->\n";
|
||||
$out = "\n\n<!-- Start form attach new file -->\n";
|
||||
|
||||
if (empty($title)) $title=$langs->trans("AttachANewFile");
|
||||
if ($title != 'none') print_titre($title);
|
||||
|
||||
print '<form name="formuserfile" action="'.$url.'" enctype="multipart/form-data" method="POST">';
|
||||
print '<input type="hidden" id="formuserfile_section_dir" name="section_dir" value="">';
|
||||
print '<input type="hidden" id="formuserfile_section_id" name="section_id" value="'.$sectionid.'">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
$out .= '<form name="formuserfile" action="'.$url.'" enctype="multipart/form-data" method="POST">';
|
||||
$out .= '<input type="hidden" id="formuserfile_section_dir" name="section_dir" value="">';
|
||||
$out .= '<input type="hidden" id="formuserfile_section_id" name="section_id" value="'.$sectionid.'">';
|
||||
$out .= '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
|
||||
print '<table width="100%" class="nobordernopadding">';
|
||||
print '<tr>';
|
||||
$out .= '<table width="100%" class="nobordernopadding">';
|
||||
$out .= '<tr>';
|
||||
|
||||
if (! empty($options)) print '<td>'.$options.'</td>';
|
||||
if (! empty($options)) $out .= '<td>'.$options.'</td>';
|
||||
|
||||
print '<td valign="middle" class="nowrap">';
|
||||
$out .= '<td valign="middle" class="nowrap">';
|
||||
|
||||
$max=$conf->global->MAIN_UPLOAD_DOC; // En Kb
|
||||
$maxphp=@ini_get('upload_max_filesize'); // En inconnu
|
||||
@ -102,20 +103,20 @@ class FormFile
|
||||
|
||||
if ($max > 0)
|
||||
{
|
||||
print '<input type="hidden" name="max_file_size" value="'.($max*1024).'">';
|
||||
$out .= '<input type="hidden" name="max_file_size" value="'.($max*1024).'">';
|
||||
}
|
||||
print '<input class="flat" type="file" name="userfile" size="'.$maxlength.'"';
|
||||
print (empty($conf->global->MAIN_UPLOAD_DOC) || empty($perm)?' disabled="disabled"':'');
|
||||
print '>';
|
||||
print ' ';
|
||||
print '<input type="submit" class="button" name="sendit" value="'.$langs->trans("Upload").'"';
|
||||
print (empty($conf->global->MAIN_UPLOAD_DOC) || empty($perm)?' disabled="disabled"':'');
|
||||
print '>';
|
||||
$out .= '<input class="flat" type="file" name="userfile" size="'.$maxlength.'"';
|
||||
$out .= (empty($conf->global->MAIN_UPLOAD_DOC) || empty($perm)?' disabled="disabled"':'');
|
||||
$out .= '>';
|
||||
$out .= ' ';
|
||||
$out .= '<input type="submit" class="button" name="sendit" value="'.$langs->trans("Upload").'"';
|
||||
$out .= (empty($conf->global->MAIN_UPLOAD_DOC) || empty($perm)?' disabled="disabled"':'');
|
||||
$out .= '>';
|
||||
|
||||
if ($addcancel)
|
||||
{
|
||||
print ' ';
|
||||
print '<input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'">';
|
||||
$out .= ' ';
|
||||
$out .= '<input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'">';
|
||||
}
|
||||
|
||||
if (! empty($conf->global->MAIN_UPLOAD_DOC))
|
||||
@ -123,22 +124,29 @@ class FormFile
|
||||
if ($perm)
|
||||
{
|
||||
$langs->load('other');
|
||||
print ' ('.$langs->trans("MaxSize").': '.$max.' '.$langs->trans("Kb");
|
||||
print ' '.info_admin($langs->trans("ThisLimitIsDefinedInSetup",$max,$maxphp),1);
|
||||
print ')';
|
||||
$out .= ' ('.$langs->trans("MaxSize").': '.$max.' '.$langs->trans("Kb");
|
||||
$out .= ' '.info_admin($langs->trans("ThisLimitIsDefinedInSetup",$max,$maxphp),1);
|
||||
$out .= ')';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
print ' ('.$langs->trans("UploadDisabled").')';
|
||||
$out .= ' ('.$langs->trans("UploadDisabled").')';
|
||||
}
|
||||
print "</td></tr>";
|
||||
print "</table>";
|
||||
$out .= "</td></tr>";
|
||||
$out .= "</table>";
|
||||
|
||||
print '</form>';
|
||||
if (empty($sectionid)) print '<br>';
|
||||
$out .= '</form>';
|
||||
if (empty($sectionid)) $out .= '<br>';
|
||||
|
||||
print "\n<!-- End form attach new file -->\n\n";
|
||||
$out .= "\n<!-- End form attach new file -->\n\n";
|
||||
$parameters = array('socid'=>(isset($GLOBALS['socid'])?$GLOBALS['socid']:''),'id'=>(isset($GLOBALS['id'])?$GLOBALS['id']:''), 'url'=>$url);
|
||||
$res = $hookmanager->executeHooks('formattachOptions',$parameters,$object);
|
||||
if (empty($res))
|
||||
{
|
||||
print $out;
|
||||
}
|
||||
print $hookmanager->resprint;
|
||||
|
||||
return 1;
|
||||
}
|
||||
@ -533,7 +541,14 @@ class FormFile
|
||||
$out.= ($param?'&'.$param:'');
|
||||
$out.= '">'.img_printer().'</a></td>';
|
||||
}
|
||||
if (is_object($hookmanager)) $out.= $hookmanager->executeHooks('formBuilddocLineOptions',$parameters,$file);
|
||||
if (is_object($hookmanager))
|
||||
{
|
||||
$parameters=array('socid'=>(isset($GLOBALS['socid'])?$GLOBALS['socid']:''),'id'=>(isset($GLOBALS['id'])?$GLOBALS['id']:''),'modulepart'=>$modulepart,'relativepath'=>$relativepath);
|
||||
$res = $hookmanager->executeHooks('formBuilddocLineOptions',$parameters,$file);
|
||||
if(!$res) {
|
||||
$out .= $hookmanager->resPrint;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$out.= '</tr>';
|
||||
|
||||
@ -45,20 +45,22 @@ class FormProjets
|
||||
/**
|
||||
* Show a combo list with projects qualified for a third party
|
||||
*
|
||||
* @param int $socid Id third party (-1=all, 0=only projects not linked to a third party, id=projects not linked or linked to third party id)
|
||||
* @param int $selected Id project preselected
|
||||
* @param string $htmlname Nom de la zone html
|
||||
* @param int $maxlength Maximum length of label
|
||||
* @return int Nbre of project if OK, <0 if KO
|
||||
* @param int $socid Id third party (-1=all, 0=only projects not linked to a third party, id=projects not linked or linked to third party id)
|
||||
* @param int $selected Id project preselected
|
||||
* @param string $htmlname Nom de la zone html
|
||||
* @param int $maxlength Maximum length of label
|
||||
* @param int $option_only Option only
|
||||
* @param int $show_empty Add an empty line
|
||||
* @return int Nber of project if OK, <0 if KO
|
||||
*/
|
||||
function select_projects($socid=-1, $selected='', $htmlname='projectid', $maxlength=16, $option_only=0, $show_empty=1)
|
||||
{
|
||||
{
|
||||
global $user,$conf,$langs;
|
||||
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
|
||||
|
||||
$out='';
|
||||
|
||||
|
||||
$hideunselectables = false;
|
||||
if (! empty($conf->global->PROJECT_HIDE_UNSELECTABLES)) $hideunselectables = true;
|
||||
|
||||
@ -146,7 +148,7 @@ class FormProjets
|
||||
$out.= '</select>';
|
||||
}
|
||||
print $out;
|
||||
|
||||
|
||||
$this->db->free($resql);
|
||||
return $num;
|
||||
}
|
||||
@ -156,16 +158,16 @@ class FormProjets
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Build Select List of element associable to a project
|
||||
*
|
||||
* @param TableName Table of the element to update
|
||||
* @return string The HTML select list of element
|
||||
* @param string $table_element Table of the element to update
|
||||
* @return string The HTML select list of element
|
||||
*/
|
||||
function select_element($table_element)
|
||||
{
|
||||
|
||||
|
||||
$projectkey="fk_projet";
|
||||
switch ($table_element)
|
||||
{
|
||||
@ -186,16 +188,16 @@ class FormProjets
|
||||
$sql = "SELECT rowid, ref";
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX.$table_element;
|
||||
$sql.= " WHERE ".$projectkey." is null";
|
||||
if (!empty($this->societe->id)) {
|
||||
$sql.= " AND fk_soc=".$this->societe->id;
|
||||
}
|
||||
$sql.= " ORDER BY ref DESC";
|
||||
|
||||
|
||||
dol_syslog(get_class($this).'::select_element sql='.$sql,LOG_DEBUG);
|
||||
|
||||
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
@ -213,10 +215,10 @@ class FormProjets
|
||||
$sellist .='</select>';
|
||||
}
|
||||
return $sellist ;
|
||||
|
||||
|
||||
$this->db->free($resql);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@ -417,8 +417,7 @@ abstract class Stats
|
||||
* Renvoie le montant moyen par mois pour une annee donnee
|
||||
*
|
||||
* @param int $year Year
|
||||
* @param string $sql SQL
|
||||
* @param int $format 0=Label of absiss is a translated text, 1=Label of absiss is a number
|
||||
* @param string $sql SQL
|
||||
* @return array
|
||||
*/
|
||||
function _getAverageByMonth($year, $sql)
|
||||
|
||||
@ -244,20 +244,29 @@ function dol_include_once($relpath, $classname='')
|
||||
|
||||
|
||||
/**
|
||||
* Return path of url or filesystem. Return default_root or alternate root if file_exist fails
|
||||
* Return path of url or filesystem. Return alternate root if exists
|
||||
*
|
||||
* @param string $path Relative path to file (if mode=0, ie: mydir/myfile, ../myfile, ...) or relative url (if mode=1).
|
||||
* @param string $path Relative path to file (if mode=0) or relative url (if mode=1). Ie: mydir/myfile, ../myfile
|
||||
* @param int $type 0=Used for a Filesystem path, 1=Used for an URL path (output relative), 2=Used for an URL path (output full path)
|
||||
* @return string Full filsystem path (if mode=0), Full url path (if mode=1)
|
||||
* @return string Full filesystem path (if mode=0), Full url path (if mode=1)
|
||||
*/
|
||||
function dol_buildpath($path, $type=0)
|
||||
{
|
||||
global $conf;
|
||||
|
||||
$path=preg_replace('/^\//','',$path);
|
||||
|
||||
if (empty($type)) // For a filesystem path
|
||||
{
|
||||
$res = DOL_DOCUMENT_ROOT.$path; // Standard value
|
||||
if (defined('DOL_DOCUMENT_ROOT_ALT') && DOL_DOCUMENT_ROOT_ALT) // We check only if alternate feature is used
|
||||
$res = DOL_DOCUMENT_ROOT.'/'.$path; // Standard value
|
||||
foreach ($conf->file->dol_document_root as $key => $dirroot) // ex: array(["main"]=>"/home/main/htdocs", ["alt0"]=>"/home/dirmod/htdocs", ...)
|
||||
{
|
||||
if (! file_exists(DOL_DOCUMENT_ROOT.$path)) $res = DOL_DOCUMENT_ROOT_ALT.$path;
|
||||
if ($key == 'main') continue;
|
||||
if (file_exists($dirroot.'/'.$path))
|
||||
{
|
||||
$res=$dirroot.'/'.$path;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else // For an url path
|
||||
@ -266,27 +275,27 @@ function dol_buildpath($path, $type=0)
|
||||
// Note that trying to know if a file on disk exist by forging path on disk from url
|
||||
// works only for some web server and some setup. This is bugged when
|
||||
// using proxy, rewriting, virtual path, etc...
|
||||
if ($type == 1)
|
||||
$res='';
|
||||
if ($type == 1) $res = DOL_URL_ROOT.'/'.$path; // Standard value
|
||||
if ($type == 2) $res = DOL_MAIN_URL_ROOT.'/'.$path; // Standard value
|
||||
foreach ($conf->file->dol_document_root as $key => $dirroot) // ex: array(["main"]=>"/home/main/htdocs", ["alt0"]=>"/home/dirmod/htdocs", ...)
|
||||
{
|
||||
$res = DOL_URL_ROOT.$path; // Standard value
|
||||
if (defined('DOL_URL_ROOT_ALT') && DOL_URL_ROOT_ALT) // We check only if alternate feature is used
|
||||
if ($key == 'main') continue;
|
||||
preg_match('/^([^\?]+(\.css\.php|\.css|\.js\.php|\.js|\.png|\.jpg|\.php)?)/i',$path,$regs); // Take part before '?'
|
||||
if (! empty($regs[1]))
|
||||
{
|
||||
preg_match('/^([^\?]+(\.css\.php|\.css|\.js\.php|\.js|\.png|\.jpg|\.php)?)/i',$path,$regs); // Take part before '?'
|
||||
if (! empty($regs[1]))
|
||||
//print $key.'-'.$dirroot.'/'.$path.'-'.$conf->file->dol_url_root[$type].'<br>'."\n";
|
||||
if (file_exists($dirroot.'/'.$regs[1]))
|
||||
{
|
||||
if (! file_exists(DOL_DOCUMENT_ROOT.$regs[1])) $res = DOL_URL_ROOT_ALT.$path;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if ($type == 2)
|
||||
{
|
||||
$res = DOL_MAIN_URL_ROOT.$path; // Standard value
|
||||
if (defined('DOL_URL_ROOT_ALT') && DOL_URL_ROOT_ALT) // We check only if alternate feature is used
|
||||
{
|
||||
preg_match('/^([^\?]+(\.css\.php|\.css|\.js\.php|\.js|\.png|\.jpg|\.php)?)/i',$path,$regs); // Take part before '?'
|
||||
if (! empty($regs[1]))
|
||||
{
|
||||
if (! file_exists(DOL_DOCUMENT_ROOT.$regs[1])) $res = DOL_MAIN_URL_ROOT_ALT.$path;
|
||||
if ($type == 1)
|
||||
{
|
||||
$res=(preg_match('/^http/i',$conf->file->dol_url_root[$key])?'':DOL_URL_ROOT).$conf->file->dol_url_root[$key].'/'.$path;
|
||||
}
|
||||
if ($type == 2)
|
||||
{
|
||||
$res=(preg_match('/^http/i',$conf->file->dol_url_root[$key])?'':DOL_MAIN_URL_ROOT).$conf->file->dol_url_root[$key].'/'.$path;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -698,7 +707,7 @@ function dol_bc($var,$moreclass='')
|
||||
function dol_format_address($object,$withcountry=0,$sep="\n")
|
||||
{
|
||||
$ret='';
|
||||
$countriesusingstate=array('AU','US','IN','GB','ES','UK');
|
||||
$countriesusingstate=array('AU','US','IN','GB','ES','UK','TR');
|
||||
|
||||
// Address
|
||||
$ret .= $object->address;
|
||||
@ -721,7 +730,7 @@ function dol_format_address($object,$withcountry=0,$sep="\n")
|
||||
}
|
||||
if ($object->zip) $ret .= ($ret ? $sep : '' ).$object->zip;
|
||||
}
|
||||
else if (in_array($object->country_code,array('ES'))) // ES: title firstname name \n address lines \n zip town \n state \n country
|
||||
else if (in_array($object->country_code,array('ES','TR'))) // ES: title firstname name \n address lines \n zip town \n state \n country
|
||||
{
|
||||
$ret .= ($ret ? $sep : '' ).$object->zip;
|
||||
$ret .= ' '.$object->town;
|
||||
@ -1714,8 +1723,16 @@ function img_picto($alt, $picto, $options = '', $pictoisfullpath = false, $srcon
|
||||
}
|
||||
// Clean parameters
|
||||
if (! preg_match('/(\.png|\.gif)$/i',$picto)) $picto .= '.png';
|
||||
// If img file is not into standard path, we use alternate path (Avoid using DOL_URL_ROOT_ALT for performane)
|
||||
if (defined('DOL_URL_ROOT_ALT') && DOL_URL_ROOT_ALT && ! file_exists(DOL_DOCUMENT_ROOT.'/'.$path.'/img/'.$picto)) $url = DOL_URL_ROOT_ALT;
|
||||
// If alt path are defined, define url where img file is, according to physical path
|
||||
foreach ($conf->file->dol_document_root as $type => $dirroot) // ex: array(["main"]=>"/home/maindir/htdocs", ["alt0"]=>"/home/moddir/htdocs", ...)
|
||||
{
|
||||
if ($type == 'main') continue;
|
||||
if (file_exists($dirroot.'/'.$path.'/img/'.$picto))
|
||||
{
|
||||
$url=$conf->file->dol_url_root[$type];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// $url is '' or '/custom', $path is current theme or
|
||||
$fullpathpicto = $url.'/'.$path.'/img/'.$picto;
|
||||
|
||||
@ -27,9 +27,10 @@
|
||||
*
|
||||
* @param string $url URL to call.
|
||||
* @param string $postorget 'post' = POST, 'get='GET'
|
||||
* @param string $param Paraemeters of URL (x=value1&y=value2)
|
||||
* @return array returns an associtive array containing the response from the server.
|
||||
*/
|
||||
function getURLContent($url,$postorget='GET',$param)
|
||||
function getURLContent($url,$postorget='GET',$param='')
|
||||
{
|
||||
//declaring of global variables
|
||||
global $conf, $langs;
|
||||
@ -58,7 +59,7 @@ function getURLContent($url,$postorget='GET',$param)
|
||||
|
||||
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, empty($conf->global->MAIN_USE_CONNECT_TIMEOUT)?5:$conf->global->MAIN_USE_CONNECT_TIMEOUT);
|
||||
curl_setopt($ch, CURLOPT_TIMEOUT, empty($conf->global->MAIN_USE_RESPONSE_TIMEOUT)?30:$conf->global->MAIN_USE_RESPONSE_TIMEOUT);
|
||||
|
||||
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
|
||||
if ($postorget == 'POST') curl_setopt($ch, CURLOPT_POST, 1);
|
||||
else curl_setopt($ch, CURLOPT_POST, 0);
|
||||
@ -95,7 +96,10 @@ function getURLContent($url,$postorget='GET',$param)
|
||||
}
|
||||
else
|
||||
{
|
||||
//closing the curl
|
||||
$info = curl_getinfo($ch);
|
||||
$rep['header_size']=$info['header_size'];
|
||||
|
||||
//closing the curl
|
||||
curl_close($ch);
|
||||
}
|
||||
|
||||
|
||||
@ -65,16 +65,21 @@ function image_format_supported($file)
|
||||
* Return size of image file on disk (Supported extensions are gif, jpg, png and bmp)
|
||||
*
|
||||
* @param string $file Full path name of file
|
||||
* @param bool $url Image with url (true or false)
|
||||
* @return array array('width'=>width, 'height'=>height)
|
||||
*/
|
||||
function dol_getImageSize($file)
|
||||
function dol_getImageSize($file, $url = false)
|
||||
{
|
||||
$ret=array();
|
||||
|
||||
if (image_format_supported($file) < 0) return $ret;
|
||||
|
||||
$fichier = realpath($file); // Chemin canonique absolu de l'image
|
||||
$dir = dirname($file); // Chemin du dossier contenant l'image
|
||||
$fichier = $file;
|
||||
if (!$url)
|
||||
{
|
||||
$fichier = realpath($file); // Chemin canonique absolu de l'image
|
||||
$dir = dirname($file); // Chemin du dossier contenant l'image
|
||||
}
|
||||
|
||||
$infoImg = getimagesize($fichier); // Recuperation des infos de l'image
|
||||
$ret['width']=$infoImg[0]; // Largeur de l'image
|
||||
|
||||
@ -261,13 +261,14 @@ function pdf_getPDFFontSize($outputlangs)
|
||||
* Return height to use for Logo onot PDF
|
||||
*
|
||||
* @param string $logo Full path to logo file to use
|
||||
* @param bool $url Image with url (true or false)
|
||||
* @return number
|
||||
*/
|
||||
function pdf_getHeightForLogo($logo)
|
||||
function pdf_getHeightForLogo($logo, $url = false)
|
||||
{
|
||||
$height=22; $maxwidth=130;
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php';
|
||||
$tmp=dol_getImageSize($logo);
|
||||
$tmp=dol_getImageSize($logo, $url);
|
||||
if ($tmp['height'])
|
||||
{
|
||||
$width=round($height*$tmp['width']/$tmp['height']);
|
||||
|
||||
@ -270,12 +270,13 @@ function dol_loginfunction($langs,$conf,$mysoc)
|
||||
if (! empty($conf->global->MAIN_HOME))
|
||||
{
|
||||
$i=0;
|
||||
while (preg_match('/__\(([a-zA-Z]+)\)__/i',$conf->global->MAIN_HOME,$reg) && $i < 100)
|
||||
while (preg_match('/__\(([a-zA-Z|@]+)\)__/i',$conf->global->MAIN_HOME,$reg) && $i < 100)
|
||||
{
|
||||
$conf->global->MAIN_HOME=preg_replace('/__\('.$reg[1].'\)__/i',$langs->trans($reg[1]),$conf->global->MAIN_HOME);
|
||||
$tmp=explode('|',$reg[1]);
|
||||
if (! empty($tmp[1])) $langs->load($tmp[1]);
|
||||
$conf->global->MAIN_HOME=preg_replace('/__\('.preg_quote($reg[1]).'\)__/i',$langs->trans($tmp[0]),$conf->global->MAIN_HOME);
|
||||
$i++;
|
||||
}
|
||||
|
||||
$main_home=dol_htmlcleanlastbr($conf->global->MAIN_HOME);
|
||||
}
|
||||
|
||||
|
||||
@ -63,16 +63,14 @@ function print_auguria_menu($db,$atarget,$type_user,&$tabMenu,&$menu,$noout=0)
|
||||
$url = $shorturl = $newTabMenu[$i]['url'];
|
||||
if (! preg_match("/^(http:\/\/|https:\/\/)/i",$newTabMenu[$i]['url']))
|
||||
{
|
||||
$param='';
|
||||
if (! preg_match('/mainmenu/i',$url) || ! preg_match('/leftmenu/i',$url))
|
||||
{
|
||||
if (! preg_match('/\?/',$url)) $param.='?';
|
||||
else $param.='&';
|
||||
$param.='mainmenu='.$newTabMenu[$i]['mainmenu'].'&leftmenu=';
|
||||
}
|
||||
$tmp=explode('?',$newTabMenu[$i]['url'],2);
|
||||
$url = $shorturl = $tmp[0];
|
||||
$param = (isset($tmp[1])?$tmp[1]:'');
|
||||
|
||||
if (! preg_match('/mainmenu/i',$url) || ! preg_match('/leftmenu/i',$url)) $param.=($param?'&':'').'mainmenu='.$newTabMenu[$i]['mainmenu'].'&leftmenu=';
|
||||
//$url.="idmenu=".$newTabMenu[$i]['rowid']; // Already done by menuLoad
|
||||
$url=dol_buildpath($url,1).$param;
|
||||
$shorturl = $newTabMenu[$i]['url'].$param;
|
||||
$url = dol_buildpath($url,1).($param?'?'.$param:'');
|
||||
$shorturl = $shorturl.($param?'?'.$param:'');
|
||||
}
|
||||
$url=preg_replace('/__LOGIN__/',$user->login,$url);
|
||||
$shorturl=preg_replace('/__LOGIN__/',$user->login,$shorturl);
|
||||
@ -246,15 +244,15 @@ function print_left_auguria_menu($db,$menu_array_before,$menu_array_after,&$tabM
|
||||
$sql.= " WHERE entity = ".$conf->entity;
|
||||
$sql.= " AND clos = 0";
|
||||
$sql.= " ORDER BY label";
|
||||
|
||||
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$numr = $db->num_rows($resql);
|
||||
$i = 0;
|
||||
|
||||
|
||||
if ($numr > 0) $newmenu->add('/compta/bank/index.php',$langs->trans("BankAccounts"),0,$user->rights->banque->lire);
|
||||
|
||||
|
||||
while ($i < $numr)
|
||||
{
|
||||
$objp = $db->fetch_object($resql);
|
||||
@ -281,14 +279,14 @@ function print_left_auguria_menu($db,$menu_array_before,$menu_array_after,&$tabM
|
||||
if (! empty($conf->global->$paramkey))
|
||||
{
|
||||
$link="/ftp/index.php?idmenu=".$_SESSION["idmenu"]."&numero_ftp=".$i;
|
||||
|
||||
|
||||
$newmenu->add($link, dol_trunc($conf->global->$paramkey,24));
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Build final $menu_array = $menu_array_before +$newmenu->liste + $menu_array_after
|
||||
//var_dump($menu_array_before);exit;
|
||||
//var_dump($menu_array_after);exit;
|
||||
@ -346,7 +344,7 @@ function print_left_auguria_menu($db,$menu_array_before,$menu_array_after,&$tabM
|
||||
}
|
||||
|
||||
print '<!-- Process menu entry with mainmenu='.$menu_array[$i]['mainmenu'].', leftmenu='.$menu_array[$i]['leftmenu'].', level='.$menu_array[$i]['level'].' enabled='.$menu_array[$i]['enabled'].' -->'."\n";
|
||||
|
||||
|
||||
// Menu niveau 0
|
||||
if ($menu_array[$i]['level'] == 0)
|
||||
{
|
||||
|
||||
@ -192,7 +192,7 @@ function print_eldy_menu($db,$atarget,$type_user,&$tabMenu,&$menu,$noout=0)
|
||||
if (empty($noout)) print_end_menu_entry($showmode);
|
||||
$menu->add('/projet/index.php?mainmenu=project&leftmenu=', $langs->trans("Projects"), 0, $showmode, $atarget, "project", '');
|
||||
}
|
||||
|
||||
|
||||
// HRM
|
||||
$tmpentry=array('enabled'=>(! empty($conf->holiday->enabled)),
|
||||
'perms'=>(! empty($user->rights->holiday->write)),
|
||||
@ -201,19 +201,19 @@ function print_eldy_menu($db,$atarget,$type_user,&$tabMenu,&$menu,$noout=0)
|
||||
if ($showmode)
|
||||
{
|
||||
$langs->load("holiday");
|
||||
|
||||
|
||||
$classname="";
|
||||
if ($_SESSION["mainmenu"] && $_SESSION["mainmenu"] == "hrm") { $classname='class="tmenusel"'; $_SESSION['idmenu']=''; }
|
||||
else $classname = 'class="tmenu"';
|
||||
$idsel='hrm';
|
||||
|
||||
|
||||
if (empty($noout)) print_start_menu_entry($idsel,$classname,$showmode);
|
||||
if (empty($noout)) print_text_menu_entry($langs->trans("HRM"), $showmode, DOL_URL_ROOT.'/holiday/index.php?mainmenu=hrm&leftmenu=', $id, $idsel, $classname, $atarget);
|
||||
if (empty($noout)) print_end_menu_entry($showmode);
|
||||
$menu->add('/holiday/index.php?mainmenu=holiday&leftmenu=', $langs->trans("HRM"), 0, $showmode, $atarget, "hrm", '');
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// Tools
|
||||
$tmpentry=array('enabled'=>(! empty($conf->mailing->enabled) || ! empty($conf->export->enabled) || ! empty($conf->import->enabled)),
|
||||
@ -289,16 +289,14 @@ function print_eldy_menu($db,$atarget,$type_user,&$tabMenu,&$menu,$noout=0)
|
||||
$url = $shorturl = $newTabMenu[$i]['url'];
|
||||
if (! preg_match("/^(http:\/\/|https:\/\/)/i",$newTabMenu[$i]['url']))
|
||||
{
|
||||
$param='';
|
||||
if (! preg_match('/mainmenu/i',$url) || ! preg_match('/leftmenu/i',$url))
|
||||
{
|
||||
if (! preg_match('/\?/',$url)) $param.='?';
|
||||
else $param.='&';
|
||||
$param.='mainmenu='.$newTabMenu[$i]['mainmenu'].'&leftmenu=';
|
||||
}
|
||||
$tmp=explode('?',$newTabMenu[$i]['url'],2);
|
||||
$url = $shorturl = $tmp[0];
|
||||
$param = (isset($tmp[1])?$tmp[1]:'');
|
||||
|
||||
if (! preg_match('/mainmenu/i',$url) || ! preg_match('/leftmenu/i',$url)) $param.=($param?'&':'').'mainmenu='.$newTabMenu[$i]['mainmenu'].'&leftmenu=';
|
||||
//$url.="idmenu=".$newTabMenu[$i]['rowid']; // Already done by menuLoad
|
||||
$url = dol_buildpath($url,1).$param;
|
||||
$shorturl = $newTabMenu[$i]['url'].$param;
|
||||
$url = dol_buildpath($url,1).($param?'?'.$param:'');
|
||||
$shorturl = $shorturl.($param?'?'.$param:'');
|
||||
}
|
||||
$url=preg_replace('/__LOGIN__/',$user->login,$url);
|
||||
$shorturl=preg_replace('/__LOGIN__/',$user->login,$shorturl);
|
||||
@ -523,13 +521,14 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
|
||||
$newmenu->add('/admin/system/phpinfo.php?mainmenu=home&leftmenu=admintools', $langs->trans('InfoPHP'), 1);
|
||||
//if (function_exists('xdebug_is_enabled')) $newmenu->add('/admin/system/xdebug.php', $langs->trans('XDebug'),1);
|
||||
$newmenu->add('/admin/system/database.php?mainmenu=home&leftmenu=admintools', $langs->trans('InfoDatabase'), 1);
|
||||
if (function_exists('eaccelerator_info')) $newmenu->add("/admin/tools/eaccelerator.php?mainmenu=home&leftmenu=admintools", $langs->trans("EAccelerator"),1);
|
||||
//$newmenu->add("/admin/system/perf.php?mainmenu=home&leftmenu=admintools", $langs->trans("InfoPerf"),1);
|
||||
$newmenu->add("/admin/tools/purge.php?mainmenu=home&leftmenu=admintools", $langs->trans("Purge"),1);
|
||||
$newmenu->add("/admin/tools/dolibarr_export.php?mainmenu=home&leftmenu=admintools", $langs->trans("Backup"),1);
|
||||
$newmenu->add("/admin/tools/dolibarr_import.php?mainmenu=home&leftmenu=admintools", $langs->trans("Restore"),1);
|
||||
$newmenu->add("/admin/tools/update.php?mainmenu=home&leftmenu=admintools", $langs->trans("MenuUpgrade"),1);
|
||||
if (function_exists('eaccelerator_info')) $newmenu->add("/admin/tools/eaccelerator.php?mainmenu=home&leftmenu=admintools", $langs->trans("EAccelerator"),1);
|
||||
$newmenu->add("/admin/tools/listevents.php?mainmenu=home&leftmenu=admintools", $langs->trans("Audit"),1);
|
||||
$newmenu->add("/admin/tools/listsessions.php?mainmenu=home&leftmenu=admintools", $langs->trans("Sessions"),1);
|
||||
$newmenu->add("/admin/tools/purge.php?mainmenu=home&leftmenu=admintools", $langs->trans("Purge"),1);
|
||||
$newmenu->add('/admin/system/about.php?mainmenu=home&leftmenu=admintools', $langs->trans('About'), 1);
|
||||
$newmenu->add("/support/index.php?mainmenu=home&leftmenu=admintools", $langs->trans("HelpCenter"),1,1,'targethelp');
|
||||
}
|
||||
@ -1099,7 +1098,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
|
||||
$newmenu->add("/projet/activity/list.php", $langs->trans("NewTimeSpent"), 1, $user->rights->projet->creer && $user->rights->projet->creer);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Menu HRM
|
||||
*/
|
||||
@ -1108,14 +1107,14 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
|
||||
if (! empty($conf->holiday->enabled))
|
||||
{
|
||||
$langs->load("holiday");
|
||||
|
||||
|
||||
// HRM: Holiday module
|
||||
$newmenu->add("/holiday/index.php?&leftmenu=hrm", $langs->trans("CPTitreMenu"), 0, $user->rights->holiday->write, '', $mainmenu, 'hrm');
|
||||
$newmenu->add("/holiday/fiche.php?&action=request", $langs->trans("MenuAddCP"), 1,$user->rights->holiday->write);
|
||||
$newmenu->add("/holiday/define_holiday.php?&action=request", $langs->trans("MenuConfCP"), 1, $user->rights->holiday->define_holiday);
|
||||
$newmenu->add("/holiday/view_log.php?&action=request", $langs->trans("MenuLogCP"), 1, $user->rights->holiday->view_log);
|
||||
$newmenu->add("/holiday/month_report.php?&action=request", $langs->trans("MenuReportMonth"), 1, $user->rights->holiday->view_log);
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -1302,7 +1301,11 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
|
||||
}
|
||||
|
||||
// For external modules
|
||||
$url = dol_buildpath($menu_array[$i]['url'], 1);
|
||||
$tmp=explode('?',$menu_array[$i]['url'],2);
|
||||
$url = $tmp[0];
|
||||
$param = (isset($tmp[1])?$tmp[1]:'');
|
||||
$url = dol_buildpath($url,1).($param?'?'.$param:'');
|
||||
|
||||
$url=preg_replace('/__LOGIN__/',$user->login,$url);
|
||||
$url=preg_replace('/__USERID__/',$user->id,$url);
|
||||
|
||||
|
||||
@ -174,10 +174,10 @@ class modFacture extends DolibarrModules
|
||||
$this->export_label[$r]='CustomersInvoicesAndInvoiceLines'; // Translation key (used only if key ExportDataset_xxx_z not found)
|
||||
$this->export_icon[$r]='bill';
|
||||
$this->export_permission[$r]=array(array("facture","facture","export"));
|
||||
$this->export_fields_array[$r]=array('s.rowid'=>"IdCompany",'s.nom'=>'CompanyName','s.address'=>'Address','s.zip'=>'Zip','s.town'=>'Town','c.code'=>'CountryCode','s.phone'=>'Phone','s.siren'=>'ProfId1','s.siret'=>'ProfId2','s.ape'=>'ProfId3','s.idprof4'=>'ProfId4','s.code_compta'=>'CustomerAccountancyCode','s.code_compta_fournisseur'=>'SupplierAccountancyCode','s.tva_intra'=>'VATIntra','f.rowid'=>"InvoiceId",'f.facnumber'=>"InvoiceRef",'f.datec'=>"InvoiceDateCreation",'f.datef'=>"DateInvoice",'f.date_lim_reglement'=>"DateDue",'f.total'=>"TotalHT",'f.total_ttc'=>"TotalTTC",'f.tva'=>"TotalVAT",'f.paye'=>"InvoicePaid",'f.fk_statut'=>'InvoiceStatus','f.note'=>"NotePrivate",'f.note_public'=>"NotePublic",'fd.rowid'=>'LineId','fd.label'=>"Label",'fd.description'=>"LineDescription",'fd.price'=>"LineUnitPrice",'fd.tva_tx'=>"LineVATRate",'fd.qty'=>"LineQty",'fd.total_ht'=>"LineTotalHT",'fd.total_tva'=>"LineTotalVAT",'fd.total_ttc'=>"LineTotalTTC",'fd.date_start'=>"DateStart",'fd.date_end'=>"DateEnd",'fd.product_type'=>"TypeOfLineServiceOrProduct",'fd.fk_product'=>'ProductId','p.ref'=>'ProductRef','p.label'=>'ProductLabel');
|
||||
$this->export_fields_array[$r]=array('s.rowid'=>"IdCompany",'s.nom'=>'CompanyName','s.address'=>'Address','s.zip'=>'Zip','s.town'=>'Town','c.code'=>'CountryCode','s.phone'=>'Phone','s.siren'=>'ProfId1','s.siret'=>'ProfId2','s.ape'=>'ProfId3','s.idprof4'=>'ProfId4','s.code_compta'=>'CustomerAccountancyCode','s.code_compta_fournisseur'=>'SupplierAccountancyCode','s.tva_intra'=>'VATIntra','f.rowid'=>"InvoiceId",'f.facnumber'=>"InvoiceRef",'f.datec'=>"InvoiceDateCreation",'f.datef'=>"DateInvoice",'f.date_lim_reglement'=>"DateDue",'f.total'=>"TotalHT",'f.total_ttc'=>"TotalTTC",'f.tva'=>"TotalVAT",'f.paye'=>"InvoicePaid",'f.fk_statut'=>'InvoiceStatus','f.note'=>"NotePrivate",'f.note_public'=>"NotePublic",'fd.rowid'=>'LineId','fd.label'=>"Label",'fd.description'=>"LineDescription",'fd.price'=>"LineUnitPrice",'fd.tva_tx'=>"LineVATRate",'fd.qty'=>"LineQty",'fd.total_ht'=>"LineTotalHT",'fd.total_tva'=>"LineTotalVAT",'fd.total_ttc'=>"LineTotalTTC",'fd.date_start'=>"DateStart",'fd.date_end'=>"DateEnd",'fd.product_type'=>"TypeOfLineServiceOrProduct",'fd.fk_product'=>'ProductId','p.ref'=>'ProductRef','p.label'=>'ProductLabel','p.accountancy_code_sell'=>'ProductAccountancyBuyCode');
|
||||
//$this->export_TypeFields_array[$r]=array('s.rowid'=>"List:societe:nom",'s.nom'=>'Text','s.address'=>'Text','s.zip'=>'Text','s.town'=>'Text','c.code'=>'Text','s.phone'=>'Text','s.siren'=>'Text','s.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','s.code_compta'=>'Text','s.code_compta_fournisseur'=>'Text','s.tva_intra'=>'Text','f.facnumber'=>"Text",'f.datec'=>"Date",'f.datef'=>"Date",'f.date_lim_reglement'=>"Date",'f.total'=>"Numeric",'f.total_ttc'=>"Numeric",'f.tva'=>"Numeric",'f.paye'=>"Boolean",'f.fk_statut'=>'Status','f.note'=>"Text",'f.note_public'=>"Text",'fd.description'=>"Text",'fd.price'=>"Numeric",'fd.tva_tx'=>"Numeric",'fd.qty'=>"Numeric",'fd.total_ht'=>"Numeric",'fd.total_tva'=>"Numeric",'fd.total_ttc'=>"Numeric",'fd.date_start'=>"Date",'fd.date_end'=>"Date",'fd.product_type'=>"Numeric",'fd.fk_product'=>'List:Product:label','p.ref'=>'Text','p.label'=>'Text');
|
||||
$this->export_TypeFields_array[$r]=array('s.nom'=>'Text','s.address'=>'Text','s.zip'=>'Text','s.town'=>'Text','c.code'=>'Text','s.phone'=>'Text','s.siren'=>'Text','s.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','s.code_compta'=>'Text','s.code_compta_fournisseur'=>'Text','s.tva_intra'=>'Text','f.facnumber'=>"Text",'f.datec'=>"Date",'f.datef'=>"Date",'f.date_lim_reglement'=>"Date",'f.total'=>"Numeric",'f.total_ttc'=>"Numeric",'f.tva'=>"Numeric",'f.paye'=>"Boolean",'f.fk_statut'=>'Status','f.note'=>"Text",'f.note_public'=>"Text",'fd.description'=>"Text",'fd.price'=>"Numeric",'fd.tva_tx'=>"Numeric",'fd.qty'=>"Numeric",'fd.total_ht'=>"Numeric",'fd.total_tva'=>"Numeric",'fd.total_ttc'=>"Numeric",'fd.date_start'=>"Date",'fd.date_end'=>"Date",'fd.product_type'=>"Numeric",'fd.fk_product'=>'List:Product:label','p.ref'=>'Text','p.label'=>'Text');
|
||||
$this->export_entities_array[$r]=array('s.rowid'=>"company",'s.nom'=>'company','s.address'=>'company','s.zip'=>'company','s.town'=>'company','c.code'=>'company','s.phone'=>'company','s.siren'=>'company','s.siret'=>'company','s.ape'=>'company','s.idprof4'=>'company','s.code_compta'=>'company','s.code_compta_fournisseur'=>'company','s.tva_intra'=>'company','f.rowid'=>"invoice",'f.facnumber'=>"invoice",'f.datec'=>"invoice",'f.datef'=>"invoice",'f.date_lim_reglement'=>"invoice",'f.total'=>"invoice",'f.total_ttc'=>"invoice",'f.tva'=>"invoice",'f.paye'=>"invoice",'f.fk_statut'=>'invoice','f.note'=>"invoice",'f.note_public'=>"invoice",'fd.rowid'=>'invoice_line','fd.label'=>"invoice_line",'fd.description'=>"invoice_line",'fd.price'=>"invoice_line",'fd.total_ht'=>"invoice_line",'fd.total_tva'=>"invoice_line",'fd.total_ttc'=>"invoice_line",'fd.tva_tx'=>"invoice_line",'fd.qty'=>"invoice_line",'fd.date_start'=>"invoice_line",'fd.date_end'=>"invoice_line",'fd.product_type'=>'invoice_line','fd.fk_product'=>'product','p.ref'=>'product','p.label'=>'product');
|
||||
$this->export_TypeFields_array[$r]=array('s.nom'=>'Text','s.address'=>'Text','s.zip'=>'Text','s.town'=>'Text','c.code'=>'Text','s.phone'=>'Text','s.siren'=>'Text','s.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','s.code_compta'=>'Text','s.code_compta_fournisseur'=>'Text','s.tva_intra'=>'Text','f.facnumber'=>"Text",'f.datec'=>"Date",'f.datef'=>"Date",'f.date_lim_reglement'=>"Date",'f.total'=>"Numeric",'f.total_ttc'=>"Numeric",'f.tva'=>"Numeric",'f.paye'=>"Boolean",'f.fk_statut'=>'Status','f.note'=>"Text",'f.note_public'=>"Text",'fd.description'=>"Text",'fd.price'=>"Numeric",'fd.tva_tx'=>"Numeric",'fd.qty'=>"Numeric",'fd.total_ht'=>"Numeric",'fd.total_tva'=>"Numeric",'fd.total_ttc'=>"Numeric",'fd.date_start'=>"Date",'fd.date_end'=>"Date",'fd.product_type'=>"Numeric",'fd.fk_product'=>'List:Product:label','p.ref'=>'Text','p.label'=>'Text','p.accountancy_code_sell'=>'Text');
|
||||
$this->export_entities_array[$r]=array('s.rowid'=>"company",'s.nom'=>'company','s.address'=>'company','s.zip'=>'company','s.town'=>'company','c.code'=>'company','s.phone'=>'company','s.siren'=>'company','s.siret'=>'company','s.ape'=>'company','s.idprof4'=>'company','s.code_compta'=>'company','s.code_compta_fournisseur'=>'company','s.tva_intra'=>'company','f.rowid'=>"invoice",'f.facnumber'=>"invoice",'f.datec'=>"invoice",'f.datef'=>"invoice",'f.date_lim_reglement'=>"invoice",'f.total'=>"invoice",'f.total_ttc'=>"invoice",'f.tva'=>"invoice",'f.paye'=>"invoice",'f.fk_statut'=>'invoice','f.note'=>"invoice",'f.note_public'=>"invoice",'fd.rowid'=>'invoice_line','fd.label'=>"invoice_line",'fd.description'=>"invoice_line",'fd.price'=>"invoice_line",'fd.total_ht'=>"invoice_line",'fd.total_tva'=>"invoice_line",'fd.total_ttc'=>"invoice_line",'fd.tva_tx'=>"invoice_line",'fd.qty'=>"invoice_line",'fd.date_start'=>"invoice_line",'fd.date_end'=>"invoice_line",'fd.product_type'=>'invoice_line','fd.fk_product'=>'product','p.ref'=>'product','p.label'=>'product','p.accountancy_code_sell'=>'product');
|
||||
$this->export_dependencies_array[$r]=array('invoice_line'=>'fd.rowid','product'=>'fd.rowid'); // To add unique key if we ask a field of a child to avoid the DISTINCT to discard them
|
||||
|
||||
$this->export_sql_start[$r]='SELECT DISTINCT ';
|
||||
|
||||
@ -58,7 +58,7 @@ $(document).ready(function () {
|
||||
<input type="hidden" name="dol_no_mouse_hover" id="dol_no_mouse_hover" value="<?php echo $dol_no_mouse_hover; ?>" />
|
||||
<input type="hidden" name="dol_use_jmobile" id="dol_use_jmobile" value="<?php echo $dol_use_jmobile; ?>" />
|
||||
|
||||
<table class="login_table_title" summary="<?php echo dol_escape_htmltag($title); ?>" cellpadding="0" cellspacing="0" border="0" align="center">
|
||||
<table class="login_table_title" summary="<?php echo dol_escape_htmltag($title); ?>" align="center">
|
||||
<tr class="vmenu"><td align="center"><?php echo $title; ?></td></tr>
|
||||
</table>
|
||||
<br>
|
||||
|
||||
@ -45,7 +45,7 @@ $(document).ready(function () {
|
||||
<input type="hidden" name="token" value="<?php echo $_SESSION['newtoken']; ?>">
|
||||
<input type="hidden" name="action" value="buildnewpassword">
|
||||
|
||||
<table class="login_table_title" summary="<?php echo dol_escape_htmltag($title); ?>" cellpadding="0" cellspacing="0" border="0" align="center">
|
||||
<table class="login_table_title" summary="<?php echo dol_escape_htmltag($title); ?>" align="center">
|
||||
<tr class="vmenu"><td align="center"><?php echo $title; ?></td></tr>
|
||||
</table>
|
||||
<br>
|
||||
|
||||
@ -555,6 +555,23 @@ class InterfaceActionsAuto
|
||||
$ok=1;
|
||||
}
|
||||
|
||||
// Projects
|
||||
elseif ($action == 'PROJECT_CREATE')
|
||||
{
|
||||
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
|
||||
$langs->load("other");
|
||||
$langs->load("projects");
|
||||
$langs->load("agenda");
|
||||
|
||||
$object->actiontypecode='AC_OTH_AUTO';
|
||||
if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("ProjectCreatedInDolibarr",$object->ref);
|
||||
$object->actionmsg=$langs->transnoentities("ProjectCreatedInDolibarr",$object->ref);
|
||||
$object->actionmsg.="\n".$langs->transnoentities("Project").': '.$object->ref;
|
||||
$object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login;
|
||||
$object->sendtoid=0;
|
||||
$ok=1;
|
||||
}
|
||||
|
||||
// If not found
|
||||
/*
|
||||
else
|
||||
|
||||
@ -533,8 +533,9 @@ class Fichinter extends CommonObject
|
||||
/**
|
||||
* Return clicable name (with picto eventually)
|
||||
*
|
||||
* @param int $withpicto 0=_No picto, 1=Includes the picto in the linkn, 2=Picto only
|
||||
* @return string String with URL
|
||||
* @param int $withpicto 0=_No picto, 1=Includes the picto in the linkn, 2=Picto only
|
||||
* @param string $option Options
|
||||
* @return string String with URL
|
||||
*/
|
||||
function getNomUrl($withpicto=0,$option='')
|
||||
{
|
||||
@ -659,8 +660,9 @@ class Fichinter extends CommonObject
|
||||
/**
|
||||
* Delete intervetnion
|
||||
*
|
||||
* @param User $user Object user who delete
|
||||
* @return int <0 if KO, >0 if OK
|
||||
* @param User $user Object user who delete
|
||||
* @param int $notrigger Disable trigger
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function delete($user, $notrigger=0)
|
||||
{
|
||||
@ -830,8 +832,8 @@ class Fichinter extends CommonObject
|
||||
* Define the label of the contract
|
||||
*
|
||||
* @param User $user Object user who modify
|
||||
* @param string $description description
|
||||
* @return int <0 if ko, >0 if ok
|
||||
* @param int $contractid Description
|
||||
* @return int <0 if ko, >0 if ok
|
||||
*/
|
||||
function set_contrat($user, $contratid)
|
||||
{
|
||||
|
||||
@ -145,10 +145,6 @@ if (empty($dolibarr_main_data_root))
|
||||
define('DOL_CLASS_PATH', 'class/'); // Filesystem path to class dir (defined only for some code that want to be compatible with old versions without this parameter)
|
||||
define('DOL_DATA_ROOT', $dolibarr_main_data_root); // Filesystem data (documents)
|
||||
define('DOL_DOCUMENT_ROOT', $dolibarr_main_document_root); // Filesystem core php (htdocs)
|
||||
if (! empty($dolibarr_main_document_root_alt))
|
||||
{
|
||||
define('DOL_DOCUMENT_ROOT_ALT', $dolibarr_main_document_root_alt); // Filesystem paths to alternate core php (alternate htdocs)
|
||||
}
|
||||
// Define DOL_MAIN_URL_ROOT and DOL_URL_ROOT
|
||||
$tmp='';
|
||||
$found=0;
|
||||
@ -175,25 +171,11 @@ else $tmp='http'.(((empty($_SERVER["HTTPS"]) || $_SERVER["HTTPS"] != 'on') && (e
|
||||
if (! empty($dolibarr_main_force_https)) $tmp=preg_replace('/^http:/i','https:',$tmp);
|
||||
define('DOL_MAIN_URL_ROOT', $tmp); // URL absolute root (https://sss/dolibarr, ...)
|
||||
$uri=preg_replace('/^http(s?):\/\//i','',constant('DOL_MAIN_URL_ROOT')); // $uri contains url without http*
|
||||
$suburi = strstr($uri, '/'); // $suburi contains url without domain
|
||||
$suburi = strstr($uri, '/'); // $suburi contains url without domain:port
|
||||
if ($suburi == '/') $suburi = ''; // If $suburi is /, it is now ''
|
||||
define('DOL_URL_ROOT', $suburi); // URL relative root ('', '/dolibarr', ...)
|
||||
|
||||
// Define DOL_MAIN_URL_ROOT_ALT and DOL_URL_ROOT_ALT
|
||||
if (! empty($dolibarr_main_url_root_alt))
|
||||
{
|
||||
$altpart=str_replace($dolibarr_main_url_root,'',$dolibarr_main_url_root_alt);
|
||||
if (! preg_match('/^\//',$altpart) && ! empty($altpart)) { $tmp_alt=$dolibarr_main_url_root_alt; } // Manage case url=http://localhost/aaa and url_alt=http://localhost/aaabbb
|
||||
else $tmp_alt=$tmp.((preg_match('/\/$/',$tmp)||preg_match('/^\//',$altpart))?'':'/').$altpart;
|
||||
//$tmp_alt=$dolibarr_main_url_root_alt;
|
||||
define('DOL_MAIN_URL_ROOT_ALT', $tmp_alt); // URL absolute root (https://sss/dolibarr/custom, ...)
|
||||
$uri=preg_replace('/^http(s?):\/\//i','',constant('DOL_MAIN_URL_ROOT_ALT')); // $uri contains url without http*
|
||||
$suburi = strstr($uri, '/'); // $suburi contains url without domain
|
||||
if ($suburi == '/') $suburi = ''; // If $suburi is /, it is now ''
|
||||
define('DOL_URL_ROOT_ALT', $suburi); // URL relative root ('', '/dolibarr/custom', ...)
|
||||
}
|
||||
|
||||
//print DOL_URL_ROOT.'-'.DOL_URL_ROOT_ALT;
|
||||
//print DOL_URL_ROOT;
|
||||
|
||||
// Define prefix MAIN_DB_PREFIX
|
||||
define('MAIN_DB_PREFIX',$dolibarr_main_db_prefix);
|
||||
|
||||
@ -1422,11 +1422,10 @@ class FactureFournisseur extends CommonInvoice
|
||||
}
|
||||
|
||||
$obj = new $classname();
|
||||
|
||||
$numref = "";
|
||||
$numref = $obj->getNumRef($soc,$this,$mode);
|
||||
|
||||
if ( $numref != "")
|
||||
if ($numref != "")
|
||||
{
|
||||
return $numref;
|
||||
}
|
||||
|
||||
@ -48,6 +48,7 @@ if (!empty($conf->projet->enabled)) {
|
||||
$langs->load('bills');
|
||||
$langs->load('suppliers');
|
||||
$langs->load('companies');
|
||||
$langs->load('products');
|
||||
|
||||
$mesg='';
|
||||
$errors=array();
|
||||
@ -1173,7 +1174,7 @@ if ($action == 'create')
|
||||
if (! empty($conf->projet->enabled))
|
||||
{
|
||||
$formproject=new FormProjets($db);
|
||||
|
||||
|
||||
$langs->load('projects');
|
||||
print '<tr><td>'.$langs->trans('Project').'</td><td colspan="2">';
|
||||
$formproject->select_projects(-1, $projectid, 'projectid');
|
||||
|
||||
935
htdocs/includes/jquery/plugins/flot/API.txt → htdocs/includes/jquery/plugins/flot/API.md
Executable file → Normal file
935
htdocs/includes/jquery/plugins/flot/API.txt → htdocs/includes/jquery/plugins/flot/API.md
Executable file → Normal file
File diff suppressed because it is too large
Load Diff
99
htdocs/includes/jquery/plugins/flot/CONTRIBUTING.md
Normal file
99
htdocs/includes/jquery/plugins/flot/CONTRIBUTING.md
Normal file
@ -0,0 +1,99 @@
|
||||
## Contributing to Flot ##
|
||||
|
||||
We welcome all contributions, but following these guidelines results in less
|
||||
work for us, and a faster and better response.
|
||||
|
||||
### Issues ###
|
||||
|
||||
Issues are not a way to ask general questions about Flot. If you see unexpected
|
||||
behavior but are not 100% certain that it is a bug, please try posting to the
|
||||
[forum](http://groups.google.com/group/flot-graphs) first, and confirm that
|
||||
what you see is really a Flot problem before creating a new issue for it.
|
||||
|
||||
When reporting a bug, please include a working demonstration of the problem, if
|
||||
possible, or at least a clear description of the options you're using and the
|
||||
environment (browser and version, jQuery version, other libraries) that you're
|
||||
running under.
|
||||
|
||||
If you have suggestions for new features, or changes to existing ones, we'd
|
||||
love to hear them! Please submit each suggestion as a separate new issue.
|
||||
|
||||
If you would like to work on an existing issue, please make sure it is not
|
||||
already assigned to someone else. If an issue is assigned to someone, that
|
||||
person has already started working on it. So, pick unassigned issues to prevent
|
||||
duplicated efforts.
|
||||
|
||||
### Pull Requests ###
|
||||
|
||||
To make merging as easy as possible, please keep these rules in mind:
|
||||
|
||||
1. Divide larger changes into a series of small, logical commits with
|
||||
descriptive messages.
|
||||
|
||||
2. Format your code according to the style guidelines below.
|
||||
|
||||
3. Submit new features or architectural changes to the <version>-work branch
|
||||
for the next major release. Submit bug fixes to the master branch.
|
||||
|
||||
4. Rebase, if necessary, before submitting your pull request, to reduce the
|
||||
work we need to do to merge it.
|
||||
|
||||
### Flot Style Guidelines ###
|
||||
|
||||
Flot follows the [jQuery Core Style Guidelines](http://docs.jquery.com/JQuery_Core_Style_Guidelines),
|
||||
with the following updates and exceptions:
|
||||
|
||||
#### Spacing ####
|
||||
|
||||
Do not add horizontal space around parameter lists, loop definitions, or
|
||||
array/object indices. For example:
|
||||
|
||||
```js
|
||||
for ( var i = 0; i < data.length; i++ ) { // This block is wrong!
|
||||
if ( data[ i ] > 1 ) {
|
||||
data[ i ] = 2;
|
||||
}
|
||||
}
|
||||
|
||||
for (var i = 0; i < data.length; i++) { // This block is correct!
|
||||
if (data[i] > 1) {
|
||||
data[i] = 2;
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
#### Comments ####
|
||||
|
||||
Use // for all comments except the header at the top of a file or inline
|
||||
include.
|
||||
|
||||
All // comment blocks should have an empty line above *and* below them. For
|
||||
example:
|
||||
|
||||
```js
|
||||
var a = 5;
|
||||
|
||||
// We're going to loop here
|
||||
// TODO: Make this loop faster, better, stronger!
|
||||
|
||||
for (var x = 0; x < 10; x++) {}
|
||||
```
|
||||
|
||||
#### Wrapping ####
|
||||
|
||||
Block comments should be wrapped at 80 characters.
|
||||
|
||||
Code should attempt to wrap at 80 characters, but may run longer if wrapping
|
||||
would hurt readability more than having to scroll horizontally. This is a
|
||||
judgement call made on a situational basis.
|
||||
|
||||
Statements containing complex logic should not be wrapped arbitrarily if they
|
||||
do not exceed 80 characters. For example:
|
||||
|
||||
```js
|
||||
if (a == 1 && // This block is wrong!
|
||||
b == 2 &&
|
||||
c == 3) {}
|
||||
|
||||
if (a == 1 && b == 2 && c == 3) {} // This block is correct!
|
||||
```
|
||||
43
htdocs/includes/jquery/plugins/flot/FAQ.txt → htdocs/includes/jquery/plugins/flot/FAQ.md
Executable file → Normal file
43
htdocs/includes/jquery/plugins/flot/FAQ.txt → htdocs/includes/jquery/plugins/flot/FAQ.md
Executable file → Normal file
@ -1,12 +1,12 @@
|
||||
Frequently asked questions
|
||||
--------------------------
|
||||
## Frequently asked questions ##
|
||||
|
||||
Q: How much data can Flot cope with?
|
||||
#### How much data can Flot cope with? ####
|
||||
|
||||
A: Flot will happily draw everything you send to it so the answer
|
||||
Flot will happily draw everything you send to it so the answer
|
||||
depends on the browser. The excanvas emulation used for IE (built with
|
||||
VML) makes IE by far the slowest browser so be sure to test with that
|
||||
if IE users are in your target group.
|
||||
if IE users are in your target group (for large plots in IE, you can
|
||||
also check out Flashcanvas which may be faster).
|
||||
|
||||
1000 points is not a problem, but as soon as you start having more
|
||||
points than the pixel width, you should probably start thinking about
|
||||
@ -14,35 +14,36 @@ downsampling/aggregation as this is near the resolution limit of the
|
||||
chart anyway. If you downsample server-side, you also save bandwidth.
|
||||
|
||||
|
||||
Q: Flot isn't working when I'm using JSON data as source!
|
||||
#### Flot isn't working when I'm using JSON data as source! ####
|
||||
|
||||
A: Actually, Flot loves JSON data, you just got the format wrong.
|
||||
Actually, Flot loves JSON data, you just got the format wrong.
|
||||
Double check that you're not inputting strings instead of numbers,
|
||||
like [["0", "-2.13"], ["5", "4.3"]]. This is most common mistake, and
|
||||
the error might not show up immediately because Javascript can do some
|
||||
conversion automatically.
|
||||
|
||||
|
||||
Q: Can I export the graph?
|
||||
#### Can I export the graph? ####
|
||||
|
||||
A: This is a limitation of the canvas technology. There's a hook in
|
||||
the canvas object for getting an image out, but you won't get the tick
|
||||
labels. And it's not likely to be supported by IE. At this point, your
|
||||
best bet is probably taking a screenshot, e.g. with PrtScn.
|
||||
You can grab the image rendered by the canvas element used by Flot
|
||||
as a PNG or JPEG (remember to set a background). Note that it won't
|
||||
include anything not drawn in the canvas (such as the legend). And it
|
||||
doesn't work with excanvas which uses VML, but you could try
|
||||
Flashcanvas.
|
||||
|
||||
|
||||
Q: The bars are all tiny in time mode?
|
||||
#### The bars are all tiny in time mode? ####
|
||||
|
||||
A: It's not really possible to determine the bar width automatically.
|
||||
It's not really possible to determine the bar width automatically.
|
||||
So you have to set the width with the barWidth option which is NOT in
|
||||
pixels, but in the units of the x axis (or the y axis for horizontal
|
||||
bars). For time mode that's milliseconds so the default value of 1
|
||||
makes the bars 1 millisecond wide.
|
||||
|
||||
|
||||
Q: Can I use Flot with libraries like Mootools or Prototype?
|
||||
#### Can I use Flot with libraries like Mootools or Prototype? ####
|
||||
|
||||
A: Yes, Flot supports it out of the box and it's easy! Just use jQuery
|
||||
Yes, Flot supports it out of the box and it's easy! Just use jQuery
|
||||
instead of $, e.g. call jQuery.plot instead of $.plot and use
|
||||
jQuery(something) instead of $(something). As a convenience, you can
|
||||
put in a DOM element for the graph placeholder where the examples and
|
||||
@ -54,13 +55,11 @@ libraries, see the documentation in jQuery ("Using jQuery with other
|
||||
libraries") for details.
|
||||
|
||||
|
||||
Q: Flot doesn't work with [insert name of Javascript UI framework]!
|
||||
#### Flot doesn't work with [insert name of Javascript UI framework]! ####
|
||||
|
||||
A: The only non-standard thing used by Flot is the canvas tag;
|
||||
otherwise it is simply a series of absolute positioned divs within the
|
||||
placeholder tag you put in. If this is not working, it's probably
|
||||
because the framework you're using is doing something weird with the
|
||||
DOM, or you're using it the wrong way.
|
||||
Flot is using standard HTML to make charts. If this is not working,
|
||||
it's probably because the framework you're using is doing something
|
||||
weird with the DOM or with the CSS that is interfering with Flot.
|
||||
|
||||
A common problem is that there's display:none on a container until the
|
||||
user does something. Many tab widgets work this way, and there's
|
||||
2
htdocs/includes/jquery/plugins/flot/LICENSE.txt
Executable file → Normal file
2
htdocs/includes/jquery/plugins/flot/LICENSE.txt
Executable file → Normal file
@ -1,4 +1,4 @@
|
||||
Copyright (c) 2007-2009 IOLA and Ole Laursen
|
||||
Copyright (c) 2007-2013 IOLA and Ole Laursen
|
||||
|
||||
Permission is hereby granted, free of charge, to any person
|
||||
obtaining a copy of this software and associated documentation
|
||||
|
||||
21
htdocs/includes/jquery/plugins/flot/Makefile
Executable file → Normal file
21
htdocs/includes/jquery/plugins/flot/Makefile
Executable file → Normal file
@ -1,9 +1,12 @@
|
||||
# Makefile for generating minified files
|
||||
|
||||
.PHONY: all
|
||||
|
||||
# we cheat and process all .js files instead of an exhaustive list
|
||||
all: $(patsubst %.js,%.min.js,$(filter-out %.min.js,$(wildcard *.js)))
|
||||
|
||||
%.min.js: %.js
|
||||
yui-compressor $< -o $@
|
||||
# Makefile for generating minified files
|
||||
|
||||
.PHONY: all
|
||||
|
||||
# we cheat and process all .js files instead of an exhaustive list
|
||||
all: $(patsubst %.js,%.min.js,$(filter-out %.min.js,$(wildcard *.js)))
|
||||
|
||||
%.min.js: %.js
|
||||
yui-compressor $< -o $@
|
||||
|
||||
test:
|
||||
./node_modules/.bin/jshint *jquery.flot.js
|
||||
|
||||
893
htdocs/includes/jquery/plugins/flot/NEWS.md
Normal file
893
htdocs/includes/jquery/plugins/flot/NEWS.md
Normal file
@ -0,0 +1,893 @@
|
||||
## Flot 0.8.1 ##
|
||||
|
||||
### Bug fixes ###
|
||||
|
||||
- Fixed a regression in the time plugin, introduced in 0.8, that caused dates
|
||||
to align to the minute rather than to the highest appropriate unit. This
|
||||
caused many x-axes in 0.8 to have different ticks than they did in 0.7.
|
||||
(reported by Tom Sheppard, patch by Daniel Shapiro, issue #1017, pull
|
||||
request #1023)
|
||||
|
||||
- Fixed a regression in text rendering, introduced in 0.8, that caused axis
|
||||
labels with the same text as another label on the same axis to disappear.
|
||||
More generally, it's again possible to have the same text in two locations.
|
||||
(issue #1032)
|
||||
|
||||
- Fixed a regression in text rendering, introduced in 0.8, where axis labels
|
||||
were no longer assigned an explicit width, and their text could not wrap.
|
||||
(reported by sabregreen, issue #1019)
|
||||
|
||||
- Fixed a regression in the pie plugin, introduced in 0.8, that prevented it
|
||||
from accepting data in the format '[[x, y]]'.
|
||||
(patch by Nicolas Morel, pull request #1024)
|
||||
|
||||
- The 'zero' series option and 'autoscale' format option are no longer
|
||||
ignored when the series contains a null value.
|
||||
(reported by Daniel Shapiro, issue #1033)
|
||||
|
||||
- Avoid triggering the time-mode plugin exception when there are zero series.
|
||||
(reported by Daniel Rothig, patch by Mark Raymond, issue #1016)
|
||||
|
||||
- When a custom color palette has fewer colors than the default palette, Flot
|
||||
no longer fills out the colors with the remainder of the default.
|
||||
(patch by goorpy, issue #1031, pull request #1034)
|
||||
|
||||
- Fixed missing update for bar highlights after a zoom or other redraw.
|
||||
(reported by Paolo Valleri, issue #1030)
|
||||
|
||||
- Fixed compatibility with jQuery versions earlier than 1.7.
|
||||
(patch by Lee Willis, issue #1027, pull request #1027)
|
||||
|
||||
- The mouse wheel no longer scrolls the page when using the navigate plugin.
|
||||
(patch by vird, pull request #1020)
|
||||
|
||||
- Fixed missing semicolons in the core library.
|
||||
(reported by Michal Zglinski)
|
||||
|
||||
|
||||
## Flot 0.8.0 ##
|
||||
|
||||
### API changes ###
|
||||
|
||||
Support for time series has been moved into a plugin, jquery.flot.time.js.
|
||||
This results in less code if time series are not used. The functionality
|
||||
remains the same (plus timezone support, as described below); however, the
|
||||
plugin must be included if axis.mode is set to "time".
|
||||
|
||||
When the axis mode is "time", the axis option "timezone" can be set to null,
|
||||
"browser", or a particular timezone (e.g. "America/New_York") to control how
|
||||
the dates are displayed. If null, the dates are displayed as UTC. If
|
||||
"browser", the dates are displayed in the time zone of the user's browser.
|
||||
|
||||
Date/time formatting has changed and now follows a proper subset of the
|
||||
standard strftime specifiers, plus one nonstandard specifier for quarters.
|
||||
Additionally, if a strftime function is found in the Date object's prototype,
|
||||
it will be used instead of the built-in formatter.
|
||||
|
||||
Axis tick labels now use the class 'flot-tick-label' instead of 'tickLabel'.
|
||||
The text containers for each axis now use the classes 'flot-[x|y]-axis' and
|
||||
'flot-[x|y]#-axis' instead of '[x|y]Axis' and '[x|y]#Axis'. For compatibility
|
||||
with Flot 0.7 and earlier text will continue to use the old classes as well,
|
||||
but they are considered deprecated and will be removed in a future version.
|
||||
|
||||
In previous versions the axis 'color' option was used to set the color of tick
|
||||
marks and their label text. It now controls the color of the axis line, which
|
||||
previously could not be changed separately, and continues to act as a default
|
||||
for the tick-mark color. The color of tick label text is now set either by
|
||||
overriding the 'flot-tick-label' CSS rule or via the axis 'font' option.
|
||||
|
||||
A new plugin, jquery.flot.canvas.js, allows axis tick labels to be rendered
|
||||
directly to the canvas, rather than using HTML elements. This feature can be
|
||||
toggled with a simple option, making it easy to create interactive plots in the
|
||||
browser using HTML, then re-render them to canvas for export as an image.
|
||||
|
||||
The plugin tries to remain as faithful as possible to the original HTML render,
|
||||
and goes so far as to automatically extract styles from CSS, to avoid having to
|
||||
provide a separate set of styles when rendering to canvas. Due to limitations
|
||||
of the canvas text API, the plugin cannot reproduce certain features, including
|
||||
HTML markup embedded in labels, and advanced text styles such as 'em' units.
|
||||
|
||||
The plugin requires support for canvas text, which may not be present in some
|
||||
older browsers, even if they support the canvas tag itself. To use the plugin
|
||||
with these browsers try using a shim such as canvas-text or FlashCanvas.
|
||||
|
||||
The base and overlay canvas are now using the CSS classes "flot-base" and
|
||||
"flot-overlay" to prevent accidental clashes (issue 540).
|
||||
|
||||
### Changes ###
|
||||
|
||||
- Addition of nonstandard %q specifier to date/time formatting. (patch
|
||||
by risicle, issue 49)
|
||||
|
||||
- Date/time formatting follows proper subset of strftime specifiers, and
|
||||
support added for Date.prototype.strftime, if found. (patch by Mark Cote,
|
||||
issues 419 and 558)
|
||||
|
||||
- Fixed display of year ticks. (patch by Mark Cote, issue 195)
|
||||
|
||||
- Support for time series moved to plugin. (patch by Mark Cote)
|
||||
|
||||
- Display time series in different time zones. (patch by Knut Forkalsrud,
|
||||
issue 141)
|
||||
|
||||
- Added a canvas plugin to enable rendering axis tick labels to the canvas.
|
||||
(sponsored by YCharts.com, implementation by Ole Laursen and David Schnur)
|
||||
|
||||
- Support for setting the interval between redraws of the overlay canvas with
|
||||
redrawOverlayInterval. (suggested in issue 185)
|
||||
|
||||
- Support for multiple thresholds in thresholds plugin. (patch by Arnaud
|
||||
Bellec, issue 523)
|
||||
|
||||
- Support for plotting categories/textual data directly with new categories
|
||||
plugin.
|
||||
|
||||
- Tick generators now get the whole axis rather than just min/max.
|
||||
|
||||
- Added processOffset and drawBackground hooks. (suggested in issue 639)
|
||||
|
||||
- Added a grid "margin" option to set the space between the canvas edge and
|
||||
the grid.
|
||||
|
||||
- Prevent the pie example page from generating single-slice pies. (patch by
|
||||
Shane Reustle)
|
||||
|
||||
- In addition to "left" and "center", bars now recognize "right" as an
|
||||
alignment option. (patch by Michael Mayer, issue 520)
|
||||
|
||||
- Switched from toFixed to a much faster default tickFormatter. (patch by
|
||||
Clemens Stolle)
|
||||
|
||||
- Added to a more helpful error when using a time-mode axis without including
|
||||
the flot.time plugin. (patch by Yael Elmatad)
|
||||
|
||||
- Added a legend "sorted" option to control sorting of legend entries
|
||||
independent of their series order. (patch by Tom Cleaveland)
|
||||
|
||||
- Added a series "highlightColor" option to control the color of the
|
||||
translucent overlay that identifies the dataset when the mouse hovers over
|
||||
it. (patch by Eric Wendelin and Nate Abele, issues 168 and 299)
|
||||
|
||||
- Added a plugin jquery.flot.errorbars, with an accompanying example, that
|
||||
adds the ability to plot error bars, commonly used in many kinds of
|
||||
statistical data visualizations. (patch by Rui Pereira, issue 215)
|
||||
|
||||
- The legend now omits entries whose labelFormatter returns null. (patch by
|
||||
Tom Cleaveland, Christopher Lambert, and Simon Strandgaard)
|
||||
|
||||
- Added support for high pixel density (retina) displays, resulting in much
|
||||
crisper charts on such devices. (patch by Olivier Guerriat, additional
|
||||
fixes by Julien Thomas, maimairel, and Lau Bech Lauritzen)
|
||||
|
||||
- Added the ability to control pie shadow position and alpha via a new pie
|
||||
'shadow' option. (patch by Julien Thomas, pull request #78)
|
||||
|
||||
- Added the ability to set width and color for individual sides of the grid.
|
||||
(patch by Ara Anjargolian, additional fixes by Karl Swedberg, pull requests #855
|
||||
and #880)
|
||||
|
||||
- The selection plugin's getSelection now returns null when the selection
|
||||
has been cleared. (patch by Nick Campbell, pull request #852)
|
||||
|
||||
- Added a new option called 'zero' to bars and filled lines series, to control
|
||||
whether the y-axis minimum is scaled to fit the data or set to zero.
|
||||
(patch by David Schnur, issues #316, #529, and #856, pull request #911)
|
||||
|
||||
- The plot function is now also a jQuery chainable property.
|
||||
(patch by David Schnur, issues #734 and #816, pull request #953)
|
||||
|
||||
- When only a single pie slice is beneath the combine threshold it is no longer
|
||||
replaced by an 'other' slice. (suggested by Devin Bayer, issue #638)
|
||||
|
||||
- Added lineJoin and minSize options to the selection plugin to control the
|
||||
corner style and minimum size of the selection, respectively.
|
||||
(patch by Ruth Linehan, pull request #963)
|
||||
|
||||
### Bug fixes ###
|
||||
|
||||
- Fix problem with null values and pie plugin. (patch by gcruxifix,
|
||||
issue 500)
|
||||
|
||||
- Fix problem with threshold plugin and bars. (based on patch by
|
||||
kaarlenkaski, issue 348)
|
||||
|
||||
- Fix axis box calculations so the boxes include the outermost part of the
|
||||
labels too.
|
||||
|
||||
- Fix problem with event clicking and hovering in IE 8 by updating Excanvas
|
||||
and removing previous work-around. (test case by Ara Anjargolian)
|
||||
|
||||
- Fix issues with blurry 1px border when some measures aren't integer.
|
||||
(reported by Ara Anjargolian)
|
||||
|
||||
- Fix bug with formats in the data processor. (reported by Peter Hull,
|
||||
issue 534)
|
||||
|
||||
- Prevent i from being declared global in extractRange. (reported by
|
||||
Alexander Obukhov, issue 627)
|
||||
|
||||
- Throw errors in a more cross-browser-compatible manner. (patch by
|
||||
Eddie Kay)
|
||||
|
||||
- Prevent pie slice outlines from being drawn when the stroke width is zero.
|
||||
(reported by Chris Minett, issue 585)
|
||||
|
||||
- Updated the navigate plugin's inline copy of jquery.mousewheel to fix
|
||||
Webkit zoom problems. (reported by Hau Nguyen, issue 685)
|
||||
|
||||
- Axis labels no longer appear as decimals rather than integers in certain
|
||||
cases. (patch by Clemens Stolle, issue 541)
|
||||
|
||||
- Automatic color generation no longer produces only whites and blacks when
|
||||
there are many series. (patch by David Schnur and Tom Cleaveland)
|
||||
|
||||
- Fixed an error when custom tick labels weren't provided as strings. (patch
|
||||
by Shad Downey)
|
||||
|
||||
- Prevented the local insertSteps and fmt variables from becoming global.
|
||||
(first reported by Marc Bennewitz and Szymon Barglowski, patch by Nick
|
||||
Campbell, issues #825 and #831, pull request #851)
|
||||
|
||||
- Prevented several threshold plugin variables from becoming global. (patch
|
||||
by Lasse Dahl Ebert)
|
||||
|
||||
- Fixed various jQuery 1.8 compatibility issues. (issues #814 and #819,
|
||||
pull request #877)
|
||||
|
||||
- Pie charts with a slice equal to or approaching 100% of the pie no longer
|
||||
appear invisible. (patch by David Schnur, issues #444, #658, #726, #824
|
||||
and #850, pull request #879)
|
||||
|
||||
- Prevented several local variables from becoming global. (patch by aaa707)
|
||||
|
||||
- Ensure that the overlay and primary canvases remain aligned. (issue #670,
|
||||
pull request #901)
|
||||
|
||||
- Added support for jQuery 1.9 by removing and replacing uses of $.browser.
|
||||
(analysis and patch by Anthony Ryan, pull request #905)
|
||||
|
||||
- Pie charts no longer disappear when redrawn during a resize or update.
|
||||
(reported by Julien Bec, issue #656, pull request #910)
|
||||
|
||||
- Avoided floating-point precision errors when calculating pie percentages.
|
||||
(patch by James Ward, pull request #918)
|
||||
|
||||
- Fixed compatibility with jQuery 1.2.6, which has no 'mouseleave' shortcut.
|
||||
(reported by Bevan, original pull request #920, replaced by direct patch)
|
||||
|
||||
- Fixed sub-pixel rendering issues with crosshair and selection lines.
|
||||
(patches by alanayoub and Daniel Shapiro, pull requests #17 and #925)
|
||||
|
||||
- Fixed rendering issues when using the threshold plugin with several series.
|
||||
(patch by Ivan Novikov, pull request #934)
|
||||
|
||||
- Pie charts no longer disappear when redrawn after calling setData().
|
||||
(reported by zengge1984 and pareeohnos, issues #810 and #945)
|
||||
|
||||
- Added a work-around for the problem where points with a lineWidth of zero
|
||||
still showed up with a visible line. (reported by SalvoSav, issue #842,
|
||||
patch by Jamie Hamel-Smith, pull request #937)
|
||||
|
||||
- Pie charts now accept values in string form, like other plot types.
|
||||
(reported by laerdal.no, issue #534)
|
||||
|
||||
- Avoid rounding errors in the threshold plugin.
|
||||
(reported by jerikojerk, issue #895)
|
||||
|
||||
- Fixed an error when using the navigate plugin with jQuery 1.9.x or later.
|
||||
(reported by Paolo Valleri, issue #964)
|
||||
|
||||
- Fixed inconsistencies between the highlight and unhighlight functions.
|
||||
(reported by djamshed, issue #987)
|
||||
|
||||
- Fixed recalculation of tickSize and tickDecimals on calls to setupGrid.
|
||||
(patch by thecountofzero, pull request #861, issues #860, #1000)
|
||||
|
||||
|
||||
## Flot 0.7 ##
|
||||
|
||||
### API changes ###
|
||||
|
||||
Multiple axes support. Code using dual axes should be changed from using
|
||||
x2axis/y2axis in the options to using an array (although backwards-
|
||||
compatibility hooks are in place). For instance,
|
||||
|
||||
```js
|
||||
{
|
||||
xaxis: { ... }, x2axis: { ... },
|
||||
yaxis: { ... }, y2axis: { ... }
|
||||
}
|
||||
```
|
||||
|
||||
becomes
|
||||
|
||||
```js
|
||||
{
|
||||
xaxes: [ { ... }, { ... } ],
|
||||
yaxes: [ { ... }, { ... } ]
|
||||
}
|
||||
```
|
||||
|
||||
Note that if you're just using one axis, continue to use the xaxis/yaxis
|
||||
directly (it now sets the default settings for the arrays). Plugins touching
|
||||
the axes must be ported to take the extra axes into account, check the source
|
||||
to see some examples.
|
||||
|
||||
A related change is that the visibility of axes is now auto-detected. So if
|
||||
you were relying on an axis to show up even without any data in the chart, you
|
||||
now need to set the axis "show" option explicitly.
|
||||
|
||||
"tickColor" on the grid options is now deprecated in favour of a corresponding
|
||||
option on the axes, so:
|
||||
|
||||
```js
|
||||
{ grid: { tickColor: "#000" }}
|
||||
```
|
||||
|
||||
becomes
|
||||
|
||||
```js
|
||||
{ xaxis: { tickColor: "#000"}, yaxis: { tickColor: "#000"} }
|
||||
```
|
||||
|
||||
But if you just configure a base color Flot will now autogenerate a tick color
|
||||
by adding transparency. Backwards-compatibility hooks are in place.
|
||||
|
||||
Final note: now that IE 9 is coming out with canvas support, you may want to
|
||||
adapt the excanvas include to skip loading it in IE 9 (the examples have been
|
||||
adapted thanks to Ryley Breiddal). An alternative to excanvas using Flash has
|
||||
also surfaced, if your graphs are slow in IE, you may want to give it a spin:
|
||||
|
||||
http://code.google.com/p/flashcanvas/
|
||||
|
||||
### Changes ###
|
||||
|
||||
- Support for specifying a bottom for each point for line charts when filling
|
||||
them, this means that an arbitrary bottom can be used instead of just the x
|
||||
axis. (based on patches patiently provided by Roman V. Prikhodchenko)
|
||||
|
||||
- New fillbetween plugin that can compute a bottom for a series from another
|
||||
series, useful for filling areas between lines.
|
||||
|
||||
See new example percentiles.html for a use case.
|
||||
|
||||
- More predictable handling of gaps for the stacking plugin, now all
|
||||
undefined ranges are skipped.
|
||||
|
||||
- Stacking plugin can stack horizontal bar charts.
|
||||
|
||||
- Navigate plugin now redraws the plot while panning instead of only after
|
||||
the fact. (raised by lastthemy, issue 235)
|
||||
|
||||
Can be disabled by setting the pan.frameRate option to null.
|
||||
|
||||
- Date formatter now accepts %0m and %0d to get a zero-padded month or day.
|
||||
(issue raised by Maximillian Dornseif)
|
||||
|
||||
- Revamped internals to support an unlimited number of axes, not just dual.
|
||||
(sponsored by Flight Data Services, www.flightdataservices.com)
|
||||
|
||||
- New setting on axes, "tickLength", to control the size of ticks or turn
|
||||
them off without turning off the labels.
|
||||
|
||||
- Axis labels are now put in container divs with classes, for instance labels
|
||||
in the x axes can be reached via ".xAxis .tickLabel".
|
||||
|
||||
- Support for setting the color of an axis. (sponsored by Flight Data
|
||||
Services, www.flightdataservices.com)
|
||||
|
||||
- Tick color is now auto-generated as the base color with some transparency,
|
||||
unless you override it.
|
||||
|
||||
- Support for aligning ticks in the axes with "alignTicksWithAxis" to ensure
|
||||
that they appear next to each other rather than in between, at the expense
|
||||
of possibly awkward tick steps. (sponsored by Flight Data Services,
|
||||
www.flightdataservices.com)
|
||||
|
||||
- Support for customizing the point type through a callback when plotting
|
||||
points and new symbol plugin with some predefined point types. (sponsored
|
||||
by Utility Data Corporation)
|
||||
|
||||
- Resize plugin for automatically redrawing when the placeholder changes
|
||||
size, e.g. on window resizes. (sponsored by Novus Partners)
|
||||
|
||||
A resize() method has been added to plot object facilitate this.
|
||||
|
||||
- Support Infinity/-Infinity for plotting asymptotes by hacking it into
|
||||
+/-Number.MAX_VALUE. (reported by rabaea.mircea)
|
||||
|
||||
- Support for restricting navigate plugin to not pan/zoom an axis. (based on
|
||||
patch by kkaefer)
|
||||
|
||||
- Support for providing the drag cursor for the navigate plugin as an option.
|
||||
(based on patch by Kelly T. Moore)
|
||||
|
||||
- Options for controlling whether an axis is shown or not (suggestion by Timo
|
||||
Tuominen) and whether to reserve space for it even if it isn't shown.
|
||||
|
||||
- New attribute $.plot.version with the Flot version as a string.
|
||||
|
||||
- The version comment is now included in the minified jquery.flot.min.js.
|
||||
|
||||
- New options.grid.minBorderMargin for adjusting the minimum margin provided
|
||||
around the border (based on patch by corani, issue 188).
|
||||
|
||||
- Refactor replot behaviour so Flot tries to reuse the existing canvas,
|
||||
adding shutdown() methods to the plot. (based on patch by Ryley Breiddal,
|
||||
issue 269)
|
||||
|
||||
This prevents a memory leak in Chrome and hopefully makes replotting faster
|
||||
for those who are using $.plot instead of .setData()/.draw(). Also update
|
||||
jQuery to 1.5.1 to prevent IE leaks fixed in jQuery.
|
||||
|
||||
- New real-time line chart example.
|
||||
|
||||
- New hooks: drawSeries, shutdown.
|
||||
|
||||
### Bug fixes ###
|
||||
|
||||
- Fixed problem with findNearbyItem and bars on top of each other. (reported
|
||||
by ragingchikn, issue 242)
|
||||
|
||||
- Fixed problem with ticks and the border. (based on patch from
|
||||
ultimatehustler69, issue 236)
|
||||
|
||||
- Fixed problem with plugins adding options to the series objects.
|
||||
|
||||
- Fixed a problem introduced in 0.6 with specifying a gradient with:
|
||||
|
||||
```{brightness: x, opacity: y }```
|
||||
|
||||
- Don't use $.browser.msie, check for getContext on the created canvas element
|
||||
instead and try to use excanvas if it's not found.
|
||||
|
||||
Fixes IE 9 compatibility.
|
||||
|
||||
- highlight(s, index) was looking up the point in the original s.data instead
|
||||
of in the computed datapoints array, which breaks with plugins that modify
|
||||
the datapoints, such as the stacking plugin. (reported by curlypaul924,
|
||||
issue 316)
|
||||
|
||||
- More robust handling of axis from data passed in from getData(). (reported)
|
||||
by Morgan)
|
||||
|
||||
- Fixed problem with turning off bar outline. (fix by Jordi Castells,
|
||||
issue 253)
|
||||
|
||||
- Check the selection passed into setSelection in the selection
|
||||
plugin, to guard against errors when synchronizing plots (fix by Lau
|
||||
Bech Lauritzen).
|
||||
|
||||
- Fix bug in crosshair code with mouseout resetting the crosshair even
|
||||
if it is locked (fix by Lau Bech Lauritzen and Banko Adam).
|
||||
|
||||
- Fix bug with points plotting using line width from lines rather than
|
||||
points.
|
||||
|
||||
- Fix bug with passing non-array 0 data (for plugins that don't expect
|
||||
arrays, patch by vpapp1).
|
||||
|
||||
- Fix errors in JSON in examples so they work with jQuery 1.4.2
|
||||
(fix reported by honestbleeps, issue 357).
|
||||
|
||||
- Fix bug with tooltip in interacting.html, this makes the tooltip
|
||||
much smoother (fix by bdkahn). Fix related bug inside highlighting
|
||||
handler in Flot.
|
||||
|
||||
- Use closure trick to make inline colorhelpers plugin respect
|
||||
jQuery.noConflict(true), renaming the global jQuery object (reported
|
||||
by Nick Stielau).
|
||||
|
||||
- Listen for mouseleave events and fire a plothover event with empty
|
||||
item when it occurs to drop highlights when the mouse leaves the
|
||||
plot (reported by by outspirit).
|
||||
|
||||
- Fix bug with using aboveData with a background (reported by
|
||||
amitayd).
|
||||
|
||||
- Fix possible excanvas leak (report and suggested fix by tom9729).
|
||||
|
||||
- Fix bug with backwards compatibility for shadowSize = 0 (report and
|
||||
suggested fix by aspinak).
|
||||
|
||||
- Adapt examples to skip loading excanvas (fix by Ryley Breiddal).
|
||||
|
||||
- Fix bug that prevent a simple f(x) = -x transform from working
|
||||
correctly (fix by Mike, issue 263).
|
||||
|
||||
- Fix bug in restoring cursor in navigate plugin (reported by Matteo
|
||||
Gattanini, issue 395).
|
||||
|
||||
- Fix bug in picking items when transform/inverseTransform is in use
|
||||
(reported by Ofri Raviv, and patches and analysis by Jan and Tom
|
||||
Paton, issue 334 and 467).
|
||||
|
||||
- Fix problem with unaligned ticks and hover/click events caused by
|
||||
padding on the placeholder by hardcoding the placeholder padding to
|
||||
0 (reported by adityadineshsaxena, Matt Sommer, Daniel Atos and some
|
||||
other people, issue 301).
|
||||
|
||||
- Update colorhelpers plugin to avoid dying when trying to parse an
|
||||
invalid string (reported by cadavor, issue 483).
|
||||
|
||||
|
||||
|
||||
## Flot 0.6 ##
|
||||
|
||||
### API changes ###
|
||||
|
||||
Selection support has been moved to a plugin. Thus if you're passing
|
||||
selection: { mode: something }, you MUST include the file
|
||||
jquery.flot.selection.js after jquery.flot.js. This reduces the size of
|
||||
base Flot and makes it easier to customize the selection as well as
|
||||
improving code clarity. The change is based on a patch from andershol.
|
||||
|
||||
In the global options specified in the $.plot command, "lines", "points",
|
||||
"bars" and "shadowSize" have been moved to a sub-object called "series":
|
||||
|
||||
```js
|
||||
$.plot(placeholder, data, { lines: { show: true }})
|
||||
```
|
||||
|
||||
should be changed to
|
||||
|
||||
```js
|
||||
$.plot(placeholder, data, { series: { lines: { show: true }}})
|
||||
```
|
||||
|
||||
All future series-specific options will go into this sub-object to
|
||||
simplify plugin writing. Backward-compatibility code is in place, so
|
||||
old code should not break.
|
||||
|
||||
"plothover" no longer provides the original data point, but instead a
|
||||
normalized one, since there may be no corresponding original point.
|
||||
|
||||
Due to a bug in previous versions of jQuery, you now need at least
|
||||
jQuery 1.2.6. But if you can, try jQuery 1.3.2 as it got some improvements
|
||||
in event handling speed.
|
||||
|
||||
## Changes ##
|
||||
|
||||
- Added support for disabling interactivity for specific data series.
|
||||
(request from Ronald Schouten and Steve Upton)
|
||||
|
||||
- Flot now calls $() on the placeholder and optional legend container passed
|
||||
in so you can specify DOM elements or CSS expressions to make it easier to
|
||||
use Flot with libraries like Prototype or Mootools or through raw JSON from
|
||||
Ajax responses.
|
||||
|
||||
- A new "plotselecting" event is now emitted while the user is making a
|
||||
selection.
|
||||
|
||||
- The "plothover" event is now emitted immediately instead of at most 10
|
||||
times per second, you'll have to put in a setTimeout yourself if you're
|
||||
doing something really expensive on this event.
|
||||
|
||||
- The built-in date formatter can now be accessed as $.plot.formatDate(...)
|
||||
(suggestion by Matt Manela) and even replaced.
|
||||
|
||||
- Added "borderColor" option to the grid. (patches from Amaury Chamayou and
|
||||
Mike R. Williamson)
|
||||
|
||||
- Added support for gradient backgrounds for the grid. (based on patch from
|
||||
Amaury Chamayou, issue 90)
|
||||
|
||||
The "setting options" example provides a demonstration.
|
||||
|
||||
- Gradient bars. (suggestion by stefpet)
|
||||
|
||||
- Added a "plotunselected" event which is triggered when the selection is
|
||||
removed, see "selection" example. (suggestion by Meda Ugo)
|
||||
|
||||
- The option legend.margin can now specify horizontal and vertical margins
|
||||
independently. (suggestion by someone who's annoyed)
|
||||
|
||||
- Data passed into Flot is now copied to a new canonical format to enable
|
||||
further processing before it hits the drawing routines. As a side-effect,
|
||||
this should make Flot more robust in the face of bad data. (issue 112)
|
||||
|
||||
- Step-wise charting: line charts have a new option "steps" that when set to
|
||||
true connects the points with horizontal/vertical steps instead of diagonal
|
||||
lines.
|
||||
|
||||
- The legend labelFormatter now passes the series in addition to just the
|
||||
label. (suggestion by Vincent Lemeltier)
|
||||
|
||||
- Horizontal bars (based on patch by Jason LeBrun).
|
||||
|
||||
- Support for partial bars by specifying a third coordinate, i.e. they don't
|
||||
have to start from the axis. This can be used to make stacked bars.
|
||||
|
||||
- New option to disable the (grid.show).
|
||||
|
||||
- Added pointOffset method for converting a point in data space to an offset
|
||||
within the placeholder.
|
||||
|
||||
- Plugin system: register an init method in the $.flot.plugins array to get
|
||||
started, see PLUGINS.txt for details on how to write plugins (it's easy).
|
||||
There are also some extra methods to enable access to internal state.
|
||||
|
||||
- Hooks: you can register functions that are called while Flot is crunching
|
||||
the data and doing the plot. This can be used to modify Flot without
|
||||
changing the source, useful for writing plugins. Some hooks are defined,
|
||||
more are likely to come.
|
||||
|
||||
- Threshold plugin: you can set a threshold and a color, and the data points
|
||||
below that threshold will then get the color. Useful for marking data
|
||||
below 0, for instance.
|
||||
|
||||
- Stack plugin: you can specify a stack key for each series to have them
|
||||
summed. This is useful for drawing additive/cumulative graphs with bars and
|
||||
(currently unfilled) lines.
|
||||
|
||||
- Crosshairs plugin: trace the mouse position on the axes, enable with
|
||||
crosshair: { mode: "x"} (see the new tracking example for a use).
|
||||
|
||||
- Image plugin: plot prerendered images.
|
||||
|
||||
- Navigation plugin for panning and zooming a plot.
|
||||
|
||||
- More configurable grid.
|
||||
|
||||
- Axis transformation support, useful for non-linear plots, e.g. log axes and
|
||||
compressed time axes (like omitting weekends).
|
||||
|
||||
- Support for twelve-hour date formatting (patch by Forrest Aldridge).
|
||||
|
||||
- The color parsing code in Flot has been cleaned up and split out so it's
|
||||
now available as a separate jQuery plugin. It's included inline in the Flot
|
||||
source to make dependency managing easier. This also makes it really easy
|
||||
to use the color helpers in Flot plugins.
|
||||
|
||||
## Bug fixes ##
|
||||
|
||||
- Fixed two corner-case bugs when drawing filled curves. (report and analysis
|
||||
by Joshua Varner)
|
||||
|
||||
- Fix auto-adjustment code when setting min to 0 for an axis where the
|
||||
dataset is completely flat on that axis. (report by chovy)
|
||||
|
||||
- Fixed a bug with passing in data from getData to setData when the secondary
|
||||
axes are used. (reported by nperelman, issue 65)
|
||||
|
||||
- Fixed so that it is possible to turn lines off when no other chart type is
|
||||
shown (based on problem reported by Glenn Vanderburg), and fixed so that
|
||||
setting lineWidth to 0 also hides the shadow. (based on problem reported by
|
||||
Sergio Nunes)
|
||||
|
||||
- Updated mousemove position expression to the latest from jQuery. (reported
|
||||
by meyuchas)
|
||||
|
||||
- Use CSS borders instead of background in legend. (issues 25 and 45)
|
||||
|
||||
- Explicitly convert axis min/max to numbers.
|
||||
|
||||
- Fixed a bug with drawing marking lines with different colors. (reported by
|
||||
Khurram)
|
||||
|
||||
- Fixed a bug with returning y2 values in the selection event. (fix by
|
||||
exists, issue 75)
|
||||
|
||||
- Only set position relative on placeholder if it hasn't already a position
|
||||
different from static. (reported by kyberneticist, issue 95)
|
||||
|
||||
- Don't round markings to prevent sub-pixel problems. (reported by
|
||||
Dan Lipsitt)
|
||||
|
||||
- Make the grid border act similarly to a regular CSS border, i.e. prevent
|
||||
it from overlapping the plot itself. This also fixes a problem with anti-
|
||||
aliasing when the width is 1 pixel. (reported by Anthony Ettinger)
|
||||
|
||||
- Imported version 3 of excanvas and fixed two issues with the newer version.
|
||||
Hopefully, this will make Flot work with IE8. (nudge by Fabien Menager,
|
||||
further analysis by Booink, issue 133)
|
||||
|
||||
- Changed the shadow code for lines to hopefully look a bit better with
|
||||
vertical lines.
|
||||
|
||||
- Round tick positions to avoid possible problems with fractions. (suggestion
|
||||
by Fred, issue 130)
|
||||
|
||||
- Made the heuristic for determining how many ticks to aim for a bit smarter.
|
||||
|
||||
- Fix for uneven axis margins (report and patch by Paul Kienzle) and snapping
|
||||
to ticks. (report and patch by lifthrasiir)
|
||||
|
||||
- Fixed bug with slicing in findNearbyItems. (patch by zollman)
|
||||
|
||||
- Make heuristic for x axis label widths more dynamic. (patch by
|
||||
rickinhethuis)
|
||||
|
||||
- Make sure points on top take precedence when finding nearby points when
|
||||
hovering. (reported by didroe, issue 224)
|
||||
|
||||
|
||||
|
||||
## Flot 0.5 ##
|
||||
|
||||
Timestamps are now in UTC. Also "selected" event -> becomes "plotselected"
|
||||
with new data, the parameters for setSelection are now different (but
|
||||
backwards compatibility hooks are in place), coloredAreas becomes markings
|
||||
with a new interface (but backwards compatibility hooks are in place).
|
||||
|
||||
### API changes ###
|
||||
|
||||
Timestamps in time mode are now displayed according to UTC instead of the time
|
||||
zone of the visitor. This affects the way the timestamps should be input;
|
||||
you'll probably have to offset the timestamps according to your local time
|
||||
zone. It also affects any custom date handling code (which basically now
|
||||
should use the equivalent UTC date mehods, e.g. .setUTCMonth() instead of
|
||||
.setMonth().
|
||||
|
||||
Markings, previously coloredAreas, are now specified as ranges on the axes,
|
||||
like ```{ xaxis: { from: 0, to: 10 }}```. Furthermore with markings you can
|
||||
now draw horizontal/vertical lines by setting from and to to the same
|
||||
coordinate. (idea from line support patch by by Ryan Funduk)
|
||||
|
||||
Interactivity: added a new "plothover" event and this and the "plotclick"
|
||||
event now returns the closest data item (based on patch by /david, patch by
|
||||
Mark Byers for bar support). See the revamped "interacting with the data"
|
||||
example for some hints on what you can do.
|
||||
|
||||
Highlighting: you can now highlight points and datapoints are autohighlighted
|
||||
when you hover over them (if hovering is turned on).
|
||||
|
||||
Support for dual axis has been added (based on patch by someone who's annoyed
|
||||
and /david). For each data series you can specify which axes it belongs to,
|
||||
and there are two more axes, x2axis and y2axis, to customize. This affects the
|
||||
"selected" event which has been renamed to "plotselected" and spews out
|
||||
```{ xaxis: { from: -10, to: 20 } ... },``` setSelection in which the
|
||||
parameters are on a new form (backwards compatible hooks are in place so old
|
||||
code shouldn't break) and markings (formerly coloredAreas).
|
||||
|
||||
## Changes ##
|
||||
|
||||
- Added support for specifying the size of tick labels (axis.labelWidth,
|
||||
axis.labelHeight). Useful for specifying a max label size to keep multiple
|
||||
plots aligned.
|
||||
|
||||
- The "fill" option can now be a number that specifies the opacity of the
|
||||
fill.
|
||||
|
||||
- You can now specify a coordinate as null (like [2, null]) and Flot will
|
||||
take the other coordinate into account when scaling the axes. (based on
|
||||
patch by joebno)
|
||||
|
||||
- New option for bars "align". Set it to "center" to center the bars on the
|
||||
value they represent.
|
||||
|
||||
- setSelection now takes a second parameter which you can use to prevent the
|
||||
method from firing the "plotselected" handler.
|
||||
|
||||
- Improved the handling of axis auto-scaling with bars.
|
||||
|
||||
## Bug fixes ##
|
||||
|
||||
- Fixed a bug in calculating spacing around the plot. (reported by
|
||||
timothytoe)
|
||||
|
||||
- Fixed a bug in finding max values for all-negative data sets.
|
||||
|
||||
- Prevent the possibility of eternal looping in tick calculations.
|
||||
|
||||
- Fixed a bug when borderWidth is set to 0. (reported by Rob/sanchothefat)
|
||||
|
||||
- Fixed a bug with drawing bars extending below 0. (reported by James Hewitt,
|
||||
patch by Ryan Funduk).
|
||||
|
||||
- Fixed a bug with line widths of bars. (reported by MikeM)
|
||||
|
||||
- Fixed a bug with 'nw' and 'sw' legend positions.
|
||||
|
||||
- Fixed a bug with multi-line x-axis tick labels. (reported by Luca Ciano,
|
||||
IE-fix help by Savage Zhang)
|
||||
|
||||
- Using the "container" option in legend now overwrites the container element
|
||||
instead of just appending to it, fixing the infinite legend bug. (reported
|
||||
by several people, fix by Brad Dewey)
|
||||
|
||||
|
||||
|
||||
## Flot 0.4 ##
|
||||
|
||||
### API changes ###
|
||||
|
||||
Deprecated axis.noTicks in favor of just specifying the number as axis.ticks.
|
||||
So ```xaxis: { noTicks: 10 }``` becomes ```xaxis: { ticks: 10 }```.
|
||||
|
||||
Time series support. Specify axis.mode: "time", put in Javascript timestamps
|
||||
as data, and Flot will automatically spit out sensible ticks. Take a look at
|
||||
the two new examples. The format can be customized with axis.timeformat and
|
||||
axis.monthNames, or if that fails with axis.tickFormatter.
|
||||
|
||||
Support for colored background areas via grid.coloredAreas. Specify an array
|
||||
of { x1, y1, x2, y2 } objects or a function that returns these given
|
||||
{ xmin, xmax, ymin, ymax }.
|
||||
|
||||
More members on the plot object (report by Chris Davies and others).
|
||||
"getData" for inspecting the assigned settings on data series (e.g. color) and
|
||||
"setData", "setupGrid" and "draw" for updating the contents without a total
|
||||
replot.
|
||||
|
||||
The default number of ticks to aim for is now dependent on the size of the
|
||||
plot in pixels. Support for customizing tick interval sizes directly with
|
||||
axis.minTickSize and axis.tickSize.
|
||||
|
||||
Cleaned up the automatic axis scaling algorithm and fixed how it interacts
|
||||
with ticks. Also fixed a couple of tick-related corner case bugs (one reported
|
||||
by mainstreetmark, another reported by timothytoe).
|
||||
|
||||
The option axis.tickFormatter now takes a function with two parameters, the
|
||||
second parameter is an optional object with information about the axis. It has
|
||||
min, max, tickDecimals, tickSize.
|
||||
|
||||
## Changes ##
|
||||
|
||||
- Added support for segmented lines. (based on patch from Michael MacDonald)
|
||||
|
||||
- Added support for ignoring null and bad values. (suggestion from Nick
|
||||
Konidaris and joshwaihi)
|
||||
|
||||
- Added support for changing the border width. (thanks to joebno and safoo)
|
||||
|
||||
- Label colors can be changed via CSS by selecting the tickLabel class.
|
||||
|
||||
## Bug fixes ##
|
||||
|
||||
- Fixed a bug in handling single-item bar series. (reported by Emil Filipov)
|
||||
|
||||
- Fixed erratic behaviour when interacting with the plot with IE 7. (reported
|
||||
by Lau Bech Lauritzen).
|
||||
|
||||
- Prevent IE/Safari text selection when selecting stuff on the canvas.
|
||||
|
||||
|
||||
|
||||
## Flot 0.3 ##
|
||||
|
||||
This is mostly a quick-fix release because jquery.js wasn't included in the
|
||||
previous zip/tarball.
|
||||
|
||||
## Changes ##
|
||||
|
||||
- Include jquery.js in the zip/tarball.
|
||||
|
||||
- Support clicking on the plot. Turn it on with grid: { clickable: true },
|
||||
then you get a "plotclick" event on the graph placeholder with the position
|
||||
in units of the plot.
|
||||
|
||||
## Bug fixes ##
|
||||
|
||||
- Fixed a bug in dealing with data where min = max. (thanks to Michael
|
||||
Messinides)
|
||||
|
||||
|
||||
|
||||
## Flot 0.2 ##
|
||||
|
||||
The API should now be fully documented.
|
||||
|
||||
### API changes ###
|
||||
|
||||
Moved labelMargin option to grid from x/yaxis.
|
||||
|
||||
## Changes ##
|
||||
|
||||
- Added support for putting a background behind the default legend. The
|
||||
default is the partly transparent background color. Added backgroundColor
|
||||
and backgroundOpacity to the legend options to control this.
|
||||
|
||||
- The ticks options can now be a callback function that takes one parameter,
|
||||
an object with the attributes min and max. The function should return a
|
||||
ticks array.
|
||||
|
||||
- Added labelFormatter option in legend, useful for turning the legend
|
||||
labels into links.
|
||||
|
||||
- Reduced the size of the code. (patch by Guy Fraser)
|
||||
|
||||
|
||||
|
||||
## Flot 0.1 ##
|
||||
|
||||
First public release.
|
||||
@ -1,508 +0,0 @@
|
||||
Flot 0.7
|
||||
--------
|
||||
|
||||
API changes:
|
||||
|
||||
Multiple axes support. Code using dual axes should be changed from
|
||||
using x2axis/y2axis in the options to using an array (although
|
||||
backwards-compatibility hooks are in place). For instance,
|
||||
|
||||
{
|
||||
xaxis: { ... }, x2axis: { ... },
|
||||
yaxis: { ... }, y2axis: { ... }
|
||||
}
|
||||
|
||||
becomes
|
||||
|
||||
{
|
||||
xaxes: [ { ... }, { ... } ],
|
||||
yaxes: [ { ... }, { ... } ]
|
||||
}
|
||||
|
||||
Note that if you're just using one axis, continue to use the
|
||||
xaxis/yaxis directly (it now sets the default settings for the
|
||||
arrays). Plugins touching the axes must be ported to take the extra
|
||||
axes into account, check the source to see some examples.
|
||||
|
||||
A related change is that the visibility of axes is now auto-detected.
|
||||
So if you were relying on an axis to show up even without any data in
|
||||
the chart, you now need to set the axis "show" option explicitly.
|
||||
|
||||
"tickColor" on the grid options is now deprecated in favour of a
|
||||
corresponding option on the axes, so { grid: { tickColor: "#000" }}
|
||||
becomes { xaxis: { tickColor: "#000"}, yaxis: { tickColor: "#000"} },
|
||||
but if you just configure a base color Flot will now autogenerate a
|
||||
tick color by adding transparency. Backwards-compatibility hooks are
|
||||
in place.
|
||||
|
||||
Final note: now that IE 9 is coming out with canvas support, you may
|
||||
want to adapt the excanvas include to skip loading it in IE 9 (the
|
||||
examples have been adapted thanks to Ryley Breiddal). An alternative
|
||||
to excanvas using Flash has also surfaced, if your graphs are slow in
|
||||
IE, you may want to give it a spin:
|
||||
|
||||
http://code.google.com/p/flashcanvas/
|
||||
|
||||
|
||||
Changes:
|
||||
|
||||
- Support for specifying a bottom for each point for line charts when
|
||||
filling them, this means that an arbitrary bottom can be used
|
||||
instead of just the x axis (based on patches patiently provided by
|
||||
Roman V. Prikhodchenko).
|
||||
- New fillbetween plugin that can compute a bottom for a series from
|
||||
another series, useful for filling areas between lines (see new
|
||||
example percentiles.html for a use case).
|
||||
- More predictable handling of gaps for the stacking plugin, now all
|
||||
undefined ranges are skipped.
|
||||
- Stacking plugin can stack horizontal bar charts.
|
||||
- Navigate plugin now redraws the plot while panning instead of only
|
||||
after the fact (can be disabled by setting the pan.frameRate option
|
||||
to null), raised by lastthemy (issue 235).
|
||||
- Date formatter now accepts %0m and %0d to get a zero-padded month or
|
||||
day (issue raised by Maximillian Dornseif).
|
||||
- Revamped internals to support an unlimited number of axes, not just
|
||||
dual (sponsored by Flight Data Services,
|
||||
www.flightdataservices.com).
|
||||
- New setting on axes, "tickLength", to control the size of ticks or
|
||||
turn them off without turning off the labels.
|
||||
- Axis labels are now put in container divs with classes, for instance
|
||||
labels in the x axes can be reached via ".xAxis .tickLabel".
|
||||
- Support for setting the color of an axis (sponsored by Flight Data
|
||||
Services, www.flightdataservices.com).
|
||||
- Tick color is now auto-generated as the base color with some
|
||||
transparency (unless you override it).
|
||||
- Support for aligning ticks in the axes with "alignTicksWithAxis" to
|
||||
ensure that they appear next to each other rather than in between,
|
||||
at the expense of possibly awkward tick steps (sponsored by Flight
|
||||
Data Services, www.flightdataservices.com).
|
||||
- Support for customizing the point type through a callback when
|
||||
plotting points and new symbol plugin with some predefined point
|
||||
types (sponsored by Utility Data Corporation).
|
||||
- Resize plugin for automatically redrawing when the placeholder
|
||||
changes size, e.g. on window resizes (sponsored by Novus Partners).
|
||||
A resize() method has been added to plot object facilitate this.
|
||||
- Support Infinity/-Infinity for plotting asymptotes by hacking it
|
||||
into +/-Number.MAX_VALUE (reported by rabaea.mircea).
|
||||
- Support for restricting navigate plugin to not pan/zoom an axis (based
|
||||
on patch by kkaefer).
|
||||
- Support for providing the drag cursor for the navigate plugin as an
|
||||
option (based on patch by Kelly T. Moore).
|
||||
- Options for controlling whether an axis is shown or not (suggestion
|
||||
by Timo Tuominen) and whether to reserve space for it even if it
|
||||
isn't shown.
|
||||
- New attribute $.plot.version with the Flot version as a string.
|
||||
- The version comment is now included in the minified jquery.flot.min.js.
|
||||
- New options.grid.minBorderMargin for adjusting the minimum margin
|
||||
provided around the border (based on patch by corani, issue 188).
|
||||
- Refactor replot behaviour so Flot tries to reuse the existing
|
||||
canvas, adding shutdown() methods to the plot (based on patch by
|
||||
Ryley Breiddal, issue 269). This prevents a memory leak in Chrome
|
||||
and hopefully makes replotting faster for those who are using $.plot
|
||||
instead of .setData()/.draw(). Also update jQuery to 1.5.1 to
|
||||
prevent IE leaks fixed in jQuery.
|
||||
- New real-time line chart example.
|
||||
|
||||
- New hooks: drawSeries, shutdown
|
||||
|
||||
Bug fixes:
|
||||
|
||||
- Fixed problem with findNearbyItem and bars on top of each other
|
||||
(reported by ragingchikn, issue 242).
|
||||
- Fixed problem with ticks and the border (based on patch from
|
||||
ultimatehustler69, issue 236).
|
||||
- Fixed problem with plugins adding options to the series objects.
|
||||
- Fixed a problem introduced in 0.6 with specifying a gradient with {
|
||||
brightness: x, opacity: y }.
|
||||
- Don't use $.browser.msie, check for getContext on the created canvas
|
||||
element instead and try to use excanvas if it's not found (fixes IE
|
||||
9 compatibility).
|
||||
- highlight(s, index) was looking up the point in the original s.data
|
||||
instead of in the computed datapoints array, which breaks with
|
||||
plugins that modify the datapoints (such as the stacking plugin).
|
||||
Issue 316 reported by curlypaul924.
|
||||
- More robust handling of axis from data passed in from getData()
|
||||
(problem reported by Morgan).
|
||||
- Fixed problem with turning off bar outline (issue 253, fix by Jordi
|
||||
Castells).
|
||||
- Check the selection passed into setSelection in the selection
|
||||
plugin, to guard against errors when synchronizing plots (fix by Lau
|
||||
Bech Lauritzen).
|
||||
- Fix bug in crosshair code with mouseout resetting the crosshair even
|
||||
if it is locked (fix by Lau Bech Lauritzen and Banko Adam).
|
||||
- Fix bug with points plotting using line width from lines rather than
|
||||
points.
|
||||
- Fix bug with passing non-array 0 data (for plugins that don't expect
|
||||
arrays, patch by vpapp1).
|
||||
- Fix errors in JSON in examples so they work with jQuery 1.4.2
|
||||
(fix reported by honestbleeps, issue 357).
|
||||
- Fix bug with tooltip in interacting.html, this makes the tooltip
|
||||
much smoother (fix by bdkahn). Fix related bug inside highlighting
|
||||
handler in Flot.
|
||||
- Use closure trick to make inline colorhelpers plugin respect
|
||||
jQuery.noConflict(true), renaming the global jQuery object (reported
|
||||
by Nick Stielau).
|
||||
- Listen for mouseleave events and fire a plothover event with empty
|
||||
item when it occurs to drop highlights when the mouse leaves the
|
||||
plot (reported by by outspirit).
|
||||
- Fix bug with using aboveData with a background (reported by
|
||||
amitayd).
|
||||
- Fix possible excanvas leak (report and suggested fix by tom9729).
|
||||
- Fix bug with backwards compatibility for shadowSize = 0 (report and
|
||||
suggested fix by aspinak).
|
||||
- Adapt examples to skip loading excanvas (fix by Ryley Breiddal).
|
||||
- Fix bug that prevent a simple f(x) = -x transform from working
|
||||
correctly (fix by Mike, issue 263).
|
||||
- Fix bug in restoring cursor in navigate plugin (reported by Matteo
|
||||
Gattanini, issue 395).
|
||||
- Fix bug in picking items when transform/inverseTransform is in use
|
||||
(reported by Ofri Raviv, and patches and analysis by Jan and Tom
|
||||
Paton, issue 334 and 467).
|
||||
- Fix problem with unaligned ticks and hover/click events caused by
|
||||
padding on the placeholder by hardcoding the placeholder padding to
|
||||
0 (reported by adityadineshsaxena, Matt Sommer, Daniel Atos and some
|
||||
other people, issue 301).
|
||||
- Update colorhelpers plugin to avoid dying when trying to parse an
|
||||
invalid string (reported by cadavor, issue 483).
|
||||
|
||||
|
||||
Flot 0.6
|
||||
--------
|
||||
|
||||
API changes:
|
||||
|
||||
1. Selection support has been moved to a plugin. Thus if you're
|
||||
passing selection: { mode: something }, you MUST include the file
|
||||
jquery.flot.selection.js after jquery.flot.js. This reduces the size
|
||||
of base Flot and makes it easier to customize the selection as well as
|
||||
improving code clarity. The change is based on a patch from andershol.
|
||||
|
||||
2. In the global options specified in the $.plot command,
|
||||
"lines", "points", "bars" and "shadowSize" have been moved to a
|
||||
sub-object called "series", i.e.
|
||||
|
||||
$.plot(placeholder, data, { lines: { show: true }})
|
||||
|
||||
should be changed to
|
||||
|
||||
$.plot(placeholder, data, { series: { lines: { show: true }}})
|
||||
|
||||
All future series-specific options will go into this sub-object to
|
||||
simplify plugin writing. Backward-compatibility code is in place, so
|
||||
old code should not break.
|
||||
|
||||
3. "plothover" no longer provides the original data point, but instead
|
||||
a normalized one, since there may be no corresponding original point.
|
||||
|
||||
4. Due to a bug in previous versions of jQuery, you now need at least
|
||||
jQuery 1.2.6. But if you can, try jQuery 1.3.2 as it got some
|
||||
improvements in event handling speed.
|
||||
|
||||
|
||||
Changes:
|
||||
|
||||
- Added support for disabling interactivity for specific data series
|
||||
(request from Ronald Schouten and Steve Upton).
|
||||
|
||||
- Flot now calls $() on the placeholder and optional legend container
|
||||
passed in so you can specify DOM elements or CSS expressions to make
|
||||
it easier to use Flot with libraries like Prototype or Mootools or
|
||||
through raw JSON from Ajax responses.
|
||||
|
||||
- A new "plotselecting" event is now emitted while the user is making
|
||||
a selection.
|
||||
|
||||
- The "plothover" event is now emitted immediately instead of at most
|
||||
10 times per second, you'll have to put in a setTimeout yourself if
|
||||
you're doing something really expensive on this event.
|
||||
|
||||
- The built-in date formatter can now be accessed as
|
||||
$.plot.formatDate(...) (suggestion by Matt Manela) and even
|
||||
replaced.
|
||||
|
||||
- Added "borderColor" option to the grid (patch from Amaury Chamayou
|
||||
and patch from Mike R. Williamson).
|
||||
|
||||
- Added support for gradient backgrounds for the grid, take a look at
|
||||
the "setting options" example (based on patch from Amaury Chamayou,
|
||||
issue 90).
|
||||
|
||||
- Gradient bars (suggestion by stefpet).
|
||||
|
||||
- Added a "plotunselected" event which is triggered when the selection
|
||||
is removed, see "selection" example (suggestion by Meda Ugo);
|
||||
|
||||
- The option legend.margin can now specify horizontal and vertical
|
||||
margins independently (suggestion by someone who's annoyed).
|
||||
|
||||
- Data passed into Flot is now copied to a new canonical format to
|
||||
enable further processing before it hits the drawing routines. As a
|
||||
side-effect, this should make Flot more robust in the face of bad
|
||||
data (and fixes issue 112).
|
||||
|
||||
- Step-wise charting: line charts have a new option "steps" that when
|
||||
set to true connects the points with horizontal/vertical steps
|
||||
instead of diagonal lines.
|
||||
|
||||
- The legend labelFormatter now passes the series in addition to just
|
||||
the label (suggestion by Vincent Lemeltier).
|
||||
|
||||
- Horizontal bars (based on patch by Jason LeBrun).
|
||||
|
||||
- Support for partial bars by specifying a third coordinate, i.e. they
|
||||
don't have to start from the axis. This can be used to make stacked
|
||||
bars.
|
||||
|
||||
- New option to disable the (grid.show).
|
||||
|
||||
- Added pointOffset method for converting a point in data space to an
|
||||
offset within the placeholder.
|
||||
|
||||
- Plugin system: register an init method in the $.flot.plugins array
|
||||
to get started, see PLUGINS.txt for details on how to write plugins
|
||||
(it's easy). There are also some extra methods to enable access to
|
||||
internal state.
|
||||
|
||||
- Hooks: you can register functions that are called while Flot is
|
||||
crunching the data and doing the plot. This can be used to modify
|
||||
Flot without changing the source, useful for writing plugins. Some
|
||||
hooks are defined, more are likely to come.
|
||||
|
||||
- Threshold plugin: you can set a threshold and a color, and the data
|
||||
points below that threshold will then get the color. Useful for
|
||||
marking data below 0, for instance.
|
||||
|
||||
- Stack plugin: you can specify a stack key for each series to have
|
||||
them summed. This is useful for drawing additive/cumulative graphs
|
||||
with bars and (currently unfilled) lines.
|
||||
|
||||
- Crosshairs plugin: trace the mouse position on the axes, enable with
|
||||
crosshair: { mode: "x"} (see the new tracking example for a use).
|
||||
|
||||
- Image plugin: plot prerendered images.
|
||||
|
||||
- Navigation plugin for panning and zooming a plot.
|
||||
|
||||
- More configurable grid.
|
||||
|
||||
- Axis transformation support, useful for non-linear plots, e.g. log
|
||||
axes and compressed time axes (like omitting weekends).
|
||||
|
||||
- Support for twelve-hour date formatting (patch by Forrest Aldridge).
|
||||
|
||||
- The color parsing code in Flot has been cleaned up and split out so
|
||||
it's now available as a separate jQuery plugin. It's included inline
|
||||
in the Flot source to make dependency managing easier. This also
|
||||
makes it really easy to use the color helpers in Flot plugins.
|
||||
|
||||
Bug fixes:
|
||||
|
||||
- Fixed two corner-case bugs when drawing filled curves (report and
|
||||
analysis by Joshua Varner).
|
||||
- Fix auto-adjustment code when setting min to 0 for an axis where the
|
||||
dataset is completely flat on that axis (report by chovy).
|
||||
- Fixed a bug with passing in data from getData to setData when the
|
||||
secondary axes are used (issue 65, reported by nperelman).
|
||||
- Fixed so that it is possible to turn lines off when no other chart
|
||||
type is shown (based on problem reported by Glenn Vanderburg), and
|
||||
fixed so that setting lineWidth to 0 also hides the shadow (based on
|
||||
problem reported by Sergio Nunes).
|
||||
- Updated mousemove position expression to the latest from jQuery (bug
|
||||
reported by meyuchas).
|
||||
- Use CSS borders instead of background in legend (fix printing issue 25
|
||||
and 45).
|
||||
- Explicitly convert axis min/max to numbers.
|
||||
- Fixed a bug with drawing marking lines with different colors
|
||||
(reported by Khurram).
|
||||
- Fixed a bug with returning y2 values in the selection event (fix
|
||||
by exists, issue 75).
|
||||
- Only set position relative on placeholder if it hasn't already a
|
||||
position different from static (reported by kyberneticist, issue 95).
|
||||
- Don't round markings to prevent sub-pixel problems (reported by Dan
|
||||
Lipsitt).
|
||||
- Make the grid border act similarly to a regular CSS border, i.e.
|
||||
prevent it from overlapping the plot itself. This also fixes a
|
||||
problem with anti-aliasing when the width is 1 pixel (reported by
|
||||
Anthony Ettinger).
|
||||
- Imported version 3 of excanvas and fixed two issues with the newer
|
||||
version. Hopefully, this will make Flot work with IE8 (nudge by
|
||||
Fabien Menager, further analysis by Booink, issue 133).
|
||||
- Changed the shadow code for lines to hopefully look a bit better
|
||||
with vertical lines.
|
||||
- Round tick positions to avoid possible problems with fractions
|
||||
(suggestion by Fred, issue 130).
|
||||
- Made the heuristic for determining how many ticks to aim for a bit
|
||||
smarter.
|
||||
- Fix for uneven axis margins (report and patch by Paul Kienzle) and
|
||||
snapping to ticks (concurrent report and patch by lifthrasiir).
|
||||
- Fixed bug with slicing in findNearbyItems (patch by zollman).
|
||||
- Make heuristic for x axis label widths more dynamic (patch by
|
||||
rickinhethuis).
|
||||
- Make sure points on top take precedence when finding nearby points
|
||||
when hovering (reported by didroe, issue 224).
|
||||
|
||||
Flot 0.5
|
||||
--------
|
||||
|
||||
Backwards API change summary: Timestamps are now in UTC. Also
|
||||
"selected" event -> becomes "plotselected" with new data, the
|
||||
parameters for setSelection are now different (but backwards
|
||||
compatibility hooks are in place), coloredAreas becomes markings with
|
||||
a new interface (but backwards compatibility hooks are in place).
|
||||
|
||||
|
||||
Interactivity: added a new "plothover" event and this and the
|
||||
"plotclick" event now returns the closest data item (based on patch by
|
||||
/david, patch by Mark Byers for bar support). See the revamped
|
||||
"interacting with the data" example for some hints on what you can do.
|
||||
|
||||
Highlighting: you can now highlight points and datapoints are
|
||||
autohighlighted when you hover over them (if hovering is turned on).
|
||||
|
||||
Support for dual axis has been added (based on patch by someone who's
|
||||
annoyed and /david). For each data series you can specify which axes
|
||||
it belongs to, and there are two more axes, x2axis and y2axis, to
|
||||
customize. This affects the "selected" event which has been renamed to
|
||||
"plotselected" and spews out { xaxis: { from: -10, to: 20 } ... },
|
||||
setSelection in which the parameters are on a new form (backwards
|
||||
compatible hooks are in place so old code shouldn't break) and
|
||||
markings (formerly coloredAreas).
|
||||
|
||||
Timestamps in time mode are now displayed according to
|
||||
UTC instead of the time zone of the visitor. This affects the way the
|
||||
timestamps should be input; you'll probably have to offset the
|
||||
timestamps according to your local time zone. It also affects any
|
||||
custom date handling code (which basically now should use the
|
||||
equivalent UTC date mehods, e.g. .setUTCMonth() instead of
|
||||
.setMonth().
|
||||
|
||||
Added support for specifying the size of tick labels (axis.labelWidth,
|
||||
axis.labelHeight). Useful for specifying a max label size to keep
|
||||
multiple plots aligned.
|
||||
|
||||
Markings, previously coloredAreas, are now specified as ranges on the
|
||||
axes, like { xaxis: { from: 0, to: 10 }}. Furthermore with markings
|
||||
you can now draw horizontal/vertical lines by setting from and to to
|
||||
the same coordinate (idea from line support patch by by Ryan Funduk).
|
||||
|
||||
The "fill" option can now be a number that specifies the opacity of
|
||||
the fill.
|
||||
|
||||
You can now specify a coordinate as null (like [2, null]) and Flot
|
||||
will take the other coordinate into account when scaling the axes
|
||||
(based on patch by joebno).
|
||||
|
||||
New option for bars "align". Set it to "center" to center the bars on
|
||||
the value they represent.
|
||||
|
||||
setSelection now takes a second parameter which you can use to prevent
|
||||
the method from firing the "plotselected" handler.
|
||||
|
||||
Using the "container" option in legend now overwrites the container
|
||||
element instead of just appending to it (fixes infinite legend bug,
|
||||
reported by several people, fix by Brad Dewey).
|
||||
|
||||
Fixed a bug in calculating spacing around the plot (reported by
|
||||
timothytoe). Fixed a bug in finding max values for all-negative data
|
||||
sets. Prevent the possibility of eternal looping in tick calculations.
|
||||
Fixed a bug when borderWidth is set to 0 (reported by
|
||||
Rob/sanchothefat). Fixed a bug with drawing bars extending below 0
|
||||
(reported by James Hewitt, patch by Ryan Funduk). Fixed a
|
||||
bug with line widths of bars (reported by MikeM). Fixed a bug with
|
||||
'nw' and 'sw' legend positions. Improved the handling of axis
|
||||
auto-scaling with bars. Fixed a bug with multi-line x-axis tick
|
||||
labels (reported by Luca Ciano). IE-fix help by Savage Zhang.
|
||||
|
||||
|
||||
Flot 0.4
|
||||
--------
|
||||
|
||||
API changes: deprecated axis.noTicks in favor of just specifying the
|
||||
number as axis.ticks. So "xaxis: { noTicks: 10 }" becomes
|
||||
"xaxis: { ticks: 10 }"
|
||||
|
||||
Time series support. Specify axis.mode: "time", put in Javascript
|
||||
timestamps as data, and Flot will automatically spit out sensible
|
||||
ticks. Take a look at the two new examples. The format can be
|
||||
customized with axis.timeformat and axis.monthNames, or if that fails
|
||||
with axis.tickFormatter.
|
||||
|
||||
Support for colored background areas via grid.coloredAreas. Specify an
|
||||
array of { x1, y1, x2, y2 } objects or a function that returns these
|
||||
given { xmin, xmax, ymin, ymax }.
|
||||
|
||||
More members on the plot object (report by Chris Davies and others).
|
||||
"getData" for inspecting the assigned settings on data series (e.g.
|
||||
color) and "setData", "setupGrid" and "draw" for updating the contents
|
||||
without a total replot.
|
||||
|
||||
The default number of ticks to aim for is now dependent on the size of
|
||||
the plot in pixels. Support for customizing tick interval sizes
|
||||
directly with axis.minTickSize and axis.tickSize.
|
||||
|
||||
Cleaned up the automatic axis scaling algorithm and fixed how it
|
||||
interacts with ticks. Also fixed a couple of tick-related corner case
|
||||
bugs (one reported by mainstreetmark, another reported by timothytoe).
|
||||
|
||||
The option axis.tickFormatter now takes a function with two
|
||||
parameters, the second parameter is an optional object with
|
||||
information about the axis. It has min, max, tickDecimals, tickSize.
|
||||
|
||||
Added support for segmented lines (based on patch from Michael
|
||||
MacDonald) and for ignoring null and bad values (suggestion from Nick
|
||||
Konidaris and joshwaihi).
|
||||
|
||||
Added support for changing the border width (joebno and safoo).
|
||||
Label colors can be changed via CSS by selecting the tickLabel class.
|
||||
|
||||
Fixed a bug in handling single-item bar series (reported by Emil
|
||||
Filipov). Fixed erratic behaviour when interacting with the plot
|
||||
with IE 7 (reported by Lau Bech Lauritzen). Prevent IE/Safari text
|
||||
selection when selecting stuff on the canvas.
|
||||
|
||||
|
||||
|
||||
Flot 0.3
|
||||
--------
|
||||
|
||||
This is mostly a quick-fix release because jquery.js wasn't included
|
||||
in the previous zip/tarball.
|
||||
|
||||
Support clicking on the plot. Turn it on with grid: { clickable: true },
|
||||
then you get a "plotclick" event on the graph placeholder with the
|
||||
position in units of the plot.
|
||||
|
||||
Fixed a bug in dealing with data where min = max, thanks to Michael
|
||||
Messinides.
|
||||
|
||||
Include jquery.js in the zip/tarball.
|
||||
|
||||
|
||||
Flot 0.2
|
||||
--------
|
||||
|
||||
Added support for putting a background behind the default legend. The
|
||||
default is the partly transparent background color. Added
|
||||
backgroundColor and backgroundOpacity to the legend options to control
|
||||
this.
|
||||
|
||||
The ticks options can now be a callback function that takes one
|
||||
parameter, an object with the attributes min and max. The function
|
||||
should return a ticks array.
|
||||
|
||||
Added labelFormatter option in legend, useful for turning the legend
|
||||
labels into links.
|
||||
|
||||
Fixed a couple of bugs.
|
||||
|
||||
The API should now be fully documented.
|
||||
|
||||
Patch from Guy Fraser to make parts of the code smaller.
|
||||
|
||||
API changes: Moved labelMargin option to grid from x/yaxis.
|
||||
|
||||
|
||||
Flot 0.1
|
||||
--------
|
||||
|
||||
First public release.
|
||||
90
htdocs/includes/jquery/plugins/flot/PLUGINS.txt → htdocs/includes/jquery/plugins/flot/PLUGINS.md
Executable file → Normal file
90
htdocs/includes/jquery/plugins/flot/PLUGINS.txt → htdocs/includes/jquery/plugins/flot/PLUGINS.md
Executable file → Normal file
@ -1,18 +1,19 @@
|
||||
Writing plugins
|
||||
---------------
|
||||
## Writing plugins ##
|
||||
|
||||
All you need to do to make a new plugin is creating an init function
|
||||
and a set of options (if needed), stuffing it into an object and
|
||||
putting it in the $.plot.plugins array. For example:
|
||||
|
||||
function myCoolPluginInit(plot) {
|
||||
```js
|
||||
function myCoolPluginInit(plot) {
|
||||
plot.coolstring = "Hello!";
|
||||
};
|
||||
};
|
||||
|
||||
$.plot.plugins.push({ init: myCoolPluginInit, options: { ... } });
|
||||
$.plot.plugins.push({ init: myCoolPluginInit, options: { ... } });
|
||||
|
||||
// if $.plot is called, it will return a plot object with the
|
||||
// attribute "coolstring"
|
||||
// if $.plot is called, it will return a plot object with the
|
||||
// attribute "coolstring"
|
||||
```
|
||||
|
||||
Now, given that the plugin might run in many different places, it's
|
||||
a good idea to avoid leaking names. The usual trick here is wrap the
|
||||
@ -21,53 +22,56 @@ this: (function () { inner code ... })(). To make it even more robust
|
||||
in case $ is not bound to jQuery but some other Javascript library, we
|
||||
can write it as
|
||||
|
||||
(function ($) {
|
||||
```js
|
||||
(function ($) {
|
||||
// plugin definition
|
||||
// ...
|
||||
})(jQuery);
|
||||
})(jQuery);
|
||||
```
|
||||
|
||||
There's a complete example below, but you should also check out the
|
||||
plugins bundled with Flot.
|
||||
|
||||
|
||||
Complete example
|
||||
----------------
|
||||
## Complete example ##
|
||||
|
||||
Here is a simple debug plugin which alerts each of the series in the
|
||||
plot. It has a single option that control whether it is enabled and
|
||||
how much info to output:
|
||||
|
||||
(function ($) {
|
||||
```js
|
||||
(function ($) {
|
||||
function init(plot) {
|
||||
var debugLevel = 1;
|
||||
|
||||
function checkDebugEnabled(plot, options) {
|
||||
if (options.debug) {
|
||||
debugLevel = options.debug;
|
||||
|
||||
plot.hooks.processDatapoints.push(alertSeries);
|
||||
}
|
||||
}
|
||||
var debugLevel = 1;
|
||||
|
||||
function alertSeries(plot, series, datapoints) {
|
||||
var msg = "series " + series.label;
|
||||
if (debugLevel > 1)
|
||||
msg += " with " + series.data.length + " points";
|
||||
alert(msg);
|
||||
}
|
||||
|
||||
plot.hooks.processOptions.push(checkDebugEnabled);
|
||||
function checkDebugEnabled(plot, options) {
|
||||
if (options.debug) {
|
||||
debugLevel = options.debug;
|
||||
plot.hooks.processDatapoints.push(alertSeries);
|
||||
}
|
||||
}
|
||||
|
||||
function alertSeries(plot, series, datapoints) {
|
||||
var msg = "series " + series.label;
|
||||
if (debugLevel > 1) {
|
||||
msg += " with " + series.data.length + " points";
|
||||
alert(msg);
|
||||
}
|
||||
}
|
||||
|
||||
plot.hooks.processOptions.push(checkDebugEnabled);
|
||||
}
|
||||
|
||||
var options = { debug: 0 };
|
||||
|
||||
|
||||
$.plot.plugins.push({
|
||||
init: init,
|
||||
options: options,
|
||||
name: "simpledebug",
|
||||
version: "0.1"
|
||||
});
|
||||
})(jQuery);
|
||||
})(jQuery);
|
||||
```
|
||||
|
||||
We also define "name" and "version". It's not used by Flot, but might
|
||||
be helpful for other plugins in resolving dependencies.
|
||||
@ -75,7 +79,9 @@ be helpful for other plugins in resolving dependencies.
|
||||
Put the above in a file named "jquery.flot.debug.js", include it in an
|
||||
HTML page and then it can be used with:
|
||||
|
||||
$.plot($("#placeholder"), [...], { debug: 2 });
|
||||
```js
|
||||
$.plot($("#placeholder"), [...], { debug: 2 });
|
||||
```
|
||||
|
||||
This simple plugin illustrates a couple of points:
|
||||
|
||||
@ -88,8 +94,7 @@ The two last points are important because there may be multiple plots
|
||||
on the same page, and you'd want to make sure they are not mixed up.
|
||||
|
||||
|
||||
Shutting down a plugin
|
||||
----------------------
|
||||
## Shutting down a plugin ##
|
||||
|
||||
Each plot object has a shutdown hook which is run when plot.shutdown()
|
||||
is called. This usually mostly happens in case another plot is made on
|
||||
@ -107,8 +112,7 @@ garbage collected yet, and worse, if your handler eventually runs, it
|
||||
may overwrite stuff on a completely different plot.
|
||||
|
||||
|
||||
Some hints on the options
|
||||
-------------------------
|
||||
## Some hints on the options ##
|
||||
|
||||
Plugins should always support appropriate options to enable/disable
|
||||
them because the plugin user may have several plots on the same page
|
||||
@ -120,14 +124,16 @@ If the plugin needs options that are specific to each series, like the
|
||||
points or lines options in core Flot, you can put them in "series" in
|
||||
the options object, e.g.
|
||||
|
||||
var options = {
|
||||
```js
|
||||
var options = {
|
||||
series: {
|
||||
downsample: {
|
||||
algorithm: null,
|
||||
maxpoints: 1000
|
||||
}
|
||||
downsample: {
|
||||
algorithm: null,
|
||||
maxpoints: 1000
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Then they will be copied by Flot into each series, providing default
|
||||
values in case none are specified.
|
||||
110
htdocs/includes/jquery/plugins/flot/README.md
Normal file
110
htdocs/includes/jquery/plugins/flot/README.md
Normal file
@ -0,0 +1,110 @@
|
||||
# Flot [](https://travis-ci.org/flot/flot)
|
||||
|
||||
## About ##
|
||||
|
||||
Flot is a Javascript plotting library for jQuery.
|
||||
Read more at the website: <http://www.flotcharts.org/>
|
||||
|
||||
Take a look at the the examples in examples/index.html; they should give a good
|
||||
impression of what Flot can do, and the source code of the examples is probably
|
||||
the fastest way to learn how to use Flot.
|
||||
|
||||
|
||||
## Installation ##
|
||||
|
||||
Just include the Javascript file after you've included jQuery.
|
||||
|
||||
Generally, all browsers that support the HTML5 canvas tag are
|
||||
supported.
|
||||
|
||||
For support for Internet Explorer < 9, you can use [Excanvas]
|
||||
[excanvas], a canvas emulator; this is used in the examples bundled
|
||||
with Flot. You just include the excanvas script like this:
|
||||
|
||||
```html
|
||||
<!--[if lte IE 8]><script language="javascript" type="text/javascript" src="excanvas.min.js"></script><![endif]-->
|
||||
```
|
||||
|
||||
If it's not working on your development IE 6.0, check that it has
|
||||
support for VML which Excanvas is relying on. It appears that some
|
||||
stripped down versions used for test environments on virtual machines
|
||||
lack the VML support.
|
||||
|
||||
You can also try using [Flashcanvas][flashcanvas], which uses Flash to
|
||||
do the emulation. Although Flash can be a bit slower to load than VML,
|
||||
if you've got a lot of points, the Flash version can be much faster
|
||||
overall. Flot contains some wrapper code for activating Excanvas which
|
||||
Flashcanvas is compatible with.
|
||||
|
||||
You need at least jQuery 1.2.6, but try at least 1.3.2 for interactive
|
||||
charts because of performance improvements in event handling.
|
||||
|
||||
|
||||
## Basic usage ##
|
||||
|
||||
Create a placeholder div to put the graph in:
|
||||
|
||||
```html
|
||||
<div id="placeholder"></div>
|
||||
```
|
||||
|
||||
You need to set the width and height of this div, otherwise the plot
|
||||
library doesn't know how to scale the graph. You can do it inline like
|
||||
this:
|
||||
|
||||
```html
|
||||
<div id="placeholder" style="width:600px;height:300px"></div>
|
||||
```
|
||||
|
||||
You can also do it with an external stylesheet. Make sure that the
|
||||
placeholder isn't within something with a display:none CSS property -
|
||||
in that case, Flot has trouble measuring label dimensions which
|
||||
results in garbled looks and might have trouble measuring the
|
||||
placeholder dimensions which is fatal (it'll throw an exception).
|
||||
|
||||
Then when the div is ready in the DOM, which is usually on document
|
||||
ready, run the plot function:
|
||||
|
||||
```js
|
||||
$.plot($("#placeholder"), data, options);
|
||||
```
|
||||
|
||||
Here, data is an array of data series and options is an object with
|
||||
settings if you want to customize the plot. Take a look at the
|
||||
examples for some ideas of what to put in or look at the
|
||||
[API reference](API.md). Here's a quick example that'll draw a line
|
||||
from (0, 0) to (1, 1):
|
||||
|
||||
```js
|
||||
$.plot($("#placeholder"), [ [[0, 0], [1, 1]] ], { yaxis: { max: 1 } });
|
||||
```
|
||||
|
||||
The plot function immediately draws the chart and then returns a plot
|
||||
object with a couple of methods.
|
||||
|
||||
|
||||
## What's with the name? ##
|
||||
|
||||
First: it's pronounced with a short o, like "plot". Not like "flawed".
|
||||
|
||||
So "Flot" rhymes with "plot".
|
||||
|
||||
And if you look up "flot" in a Danish-to-English dictionary, some of
|
||||
the words that come up are "good-looking", "attractive", "stylish",
|
||||
"smart", "impressive", "extravagant". One of the main goals with Flot
|
||||
is pretty looks.
|
||||
|
||||
|
||||
## Notes about the examples ##
|
||||
|
||||
In order to have a useful, functional example of time-series plots using time
|
||||
zones, date.js from [timezone-js][timezone-js] (released under the Apache 2.0
|
||||
license) and the [Olson][olson] time zone database (released to the public
|
||||
domain) have been included in the examples directory. They are used in
|
||||
examples/axes-time-zones/index.html.
|
||||
|
||||
|
||||
[excanvas]: http://code.google.com/p/explorercanvas/
|
||||
[flashcanvas]: http://code.google.com/p/flashcanvas/
|
||||
[timezone-js]: https://github.com/mde/timezone-js
|
||||
[olson]: ftp://ftp.iana.org/tz/
|
||||
@ -1,90 +0,0 @@
|
||||
About
|
||||
-----
|
||||
|
||||
Flot is a Javascript plotting library for jQuery. Read more at the
|
||||
website:
|
||||
|
||||
http://code.google.com/p/flot/
|
||||
|
||||
Take a look at the examples linked from above, they should give a good
|
||||
impression of what Flot can do and the source code of the examples is
|
||||
probably the fastest way to learn how to use Flot.
|
||||
|
||||
|
||||
Installation
|
||||
------------
|
||||
|
||||
Just include the Javascript file after you've included jQuery.
|
||||
|
||||
Generally, all browsers that support the HTML5 canvas tag are
|
||||
supported.
|
||||
|
||||
For support for Internet Explorer < 9, you can use Excanvas, a canvas
|
||||
emulator; this is used in the examples bundled with Flot. You just
|
||||
include the excanvas script like this:
|
||||
|
||||
<!--[if lte IE 8]><script language="javascript" type="text/javascript" src="excanvas.min.js"></script><![endif]-->
|
||||
|
||||
If it's not working on your development IE 6.0, check that it has
|
||||
support for VML which Excanvas is relying on. It appears that some
|
||||
stripped down versions used for test environments on virtual machines
|
||||
lack the VML support.
|
||||
|
||||
You can also try using Flashcanvas (see
|
||||
http://code.google.com/p/flashcanvas/), which uses Flash to do the
|
||||
emulation. Although Flash can be a bit slower to load than VML, if
|
||||
you've got a lot of points, the Flash version can be much faster
|
||||
overall. Flot contains some wrapper code for activating Excanvas which
|
||||
Flashcanvas is compatible with.
|
||||
|
||||
You need at least jQuery 1.2.6, but try at least 1.3.2 for interactive
|
||||
charts because of performance improvements in event handling.
|
||||
|
||||
|
||||
Basic usage
|
||||
-----------
|
||||
|
||||
Create a placeholder div to put the graph in:
|
||||
|
||||
<div id="placeholder"></div>
|
||||
|
||||
You need to set the width and height of this div, otherwise the plot
|
||||
library doesn't know how to scale the graph. You can do it inline like
|
||||
this:
|
||||
|
||||
<div id="placeholder" style="width:600px;height:300px"></div>
|
||||
|
||||
You can also do it with an external stylesheet. Make sure that the
|
||||
placeholder isn't within something with a display:none CSS property -
|
||||
in that case, Flot has trouble measuring label dimensions which
|
||||
results in garbled looks and might have trouble measuring the
|
||||
placeholder dimensions which is fatal (it'll throw an exception).
|
||||
|
||||
Then when the div is ready in the DOM, which is usually on document
|
||||
ready, run the plot function:
|
||||
|
||||
$.plot($("#placeholder"), data, options);
|
||||
|
||||
Here, data is an array of data series and options is an object with
|
||||
settings if you want to customize the plot. Take a look at the
|
||||
examples for some ideas of what to put in or look at the reference
|
||||
in the file "API.txt". Here's a quick example that'll draw a line from
|
||||
(0, 0) to (1, 1):
|
||||
|
||||
$.plot($("#placeholder"), [ [[0, 0], [1, 1]] ], { yaxis: { max: 1 } });
|
||||
|
||||
The plot function immediately draws the chart and then returns a plot
|
||||
object with a couple of methods.
|
||||
|
||||
|
||||
What's with the name?
|
||||
---------------------
|
||||
|
||||
First: it's pronounced with a short o, like "plot". Not like "flawed".
|
||||
|
||||
So "Flot" rhymes with "plot".
|
||||
|
||||
And if you look up "flot" in a Danish-to-English dictionary, some up
|
||||
the words that come up are "good-looking", "attractive", "stylish",
|
||||
"smart", "impressive", "extravagant". One of the main goals with Flot
|
||||
is pretty looks.
|
||||
131
htdocs/includes/jquery/plugins/flot/excanvas.js
vendored
Executable file → Normal file
131
htdocs/includes/jquery/plugins/flot/excanvas.js
vendored
Executable file → Normal file
@ -49,6 +49,8 @@ if (!document.createElement('canvas').getContext) {
|
||||
var Z = 10;
|
||||
var Z2 = Z / 2;
|
||||
|
||||
var IE_VERSION = +navigator.userAgent.match(/MSIE ([\d.]+)?/)[1];
|
||||
|
||||
/**
|
||||
* This funtion is assigned to the <canvas> elements as element.getContext().
|
||||
* @this {HTMLElement}
|
||||
@ -88,17 +90,15 @@ if (!document.createElement('canvas').getContext) {
|
||||
return String(s).replace(/&/g, '&').replace(/"/g, '"');
|
||||
}
|
||||
|
||||
function addNamespacesAndStylesheet(doc) {
|
||||
// create xmlns
|
||||
if (!doc.namespaces['g_vml_']) {
|
||||
doc.namespaces.add('g_vml_', 'urn:schemas-microsoft-com:vml',
|
||||
'#default#VML');
|
||||
function addNamespace(doc, prefix, urn) {
|
||||
if (!doc.namespaces[prefix]) {
|
||||
doc.namespaces.add(prefix, urn, '#default#VML');
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
if (!doc.namespaces['g_o_']) {
|
||||
doc.namespaces.add('g_o_', 'urn:schemas-microsoft-com:office:office',
|
||||
'#default#VML');
|
||||
}
|
||||
function addNamespacesAndStylesheet(doc) {
|
||||
addNamespace(doc, 'g_vml_', 'urn:schemas-microsoft-com:vml');
|
||||
addNamespace(doc, 'g_o_', 'urn:schemas-microsoft-com:office:office');
|
||||
|
||||
// Setup default CSS. Only add one style sheet per document
|
||||
if (!doc.styleSheets['ex_canvas_']) {
|
||||
@ -115,13 +115,11 @@ if (!document.createElement('canvas').getContext) {
|
||||
|
||||
var G_vmlCanvasManager_ = {
|
||||
init: function(opt_doc) {
|
||||
if (/MSIE/.test(navigator.userAgent) && !window.opera) {
|
||||
var doc = opt_doc || document;
|
||||
// Create a dummy element so that IE will allow canvas elements to be
|
||||
// recognized.
|
||||
doc.createElement('canvas');
|
||||
doc.attachEvent('onreadystatechange', bind(this.init_, this, doc));
|
||||
}
|
||||
var doc = opt_doc || document;
|
||||
// Create a dummy element so that IE will allow canvas elements to be
|
||||
// recognized.
|
||||
doc.createElement('canvas');
|
||||
doc.attachEvent('onreadystatechange', bind(this.init_, this, doc));
|
||||
},
|
||||
|
||||
init_: function(doc) {
|
||||
@ -398,9 +396,7 @@ if (!document.createElement('canvas').getContext) {
|
||||
var end = styleString.indexOf(')', start + 1);
|
||||
var parts = styleString.substring(start + 1, end).split(',');
|
||||
// add alpha if needed
|
||||
if (parts.length == 4 && styleString.substr(3, 1) == 'a') {
|
||||
alpha = Number(parts[3]);
|
||||
} else {
|
||||
if (parts.length != 4 || styleString.charAt(3) != 'a') {
|
||||
parts[3] = 1;
|
||||
}
|
||||
return parts;
|
||||
@ -415,7 +411,7 @@ if (!document.createElement('canvas').getContext) {
|
||||
}
|
||||
|
||||
function hslToRgb(parts){
|
||||
var r, g, b;
|
||||
var r, g, b, h, s, l;
|
||||
h = parseFloat(parts[0]) / 360 % 360;
|
||||
if (h < 0)
|
||||
h++;
|
||||
@ -452,7 +448,13 @@ if (!document.createElement('canvas').getContext) {
|
||||
return m1;
|
||||
}
|
||||
|
||||
var processStyleCache = {};
|
||||
|
||||
function processStyle(styleString) {
|
||||
if (styleString in processStyleCache) {
|
||||
return processStyleCache[styleString];
|
||||
}
|
||||
|
||||
var str, alpha = 1;
|
||||
|
||||
styleString = String(styleString);
|
||||
@ -465,11 +467,11 @@ if (!document.createElement('canvas').getContext) {
|
||||
if (parts[i].indexOf('%') != -1) {
|
||||
n = Math.floor(percent(parts[i]) * 255);
|
||||
} else {
|
||||
n = Number(parts[i]);
|
||||
n = +parts[i];
|
||||
}
|
||||
str += decToHex[clamp(n, 0, 255)];
|
||||
}
|
||||
alpha = parts[3];
|
||||
alpha = +parts[3];
|
||||
} else if (/^hsl/.test(styleString)) {
|
||||
var parts = getRgbHslContent(styleString);
|
||||
str = hslToRgb(parts);
|
||||
@ -477,7 +479,7 @@ if (!document.createElement('canvas').getContext) {
|
||||
} else {
|
||||
str = colorData[styleString] || styleString;
|
||||
}
|
||||
return {color: str, alpha: alpha};
|
||||
return processStyleCache[styleString] = {color: str, alpha: alpha};
|
||||
}
|
||||
|
||||
var DEFAULT_STYLE = {
|
||||
@ -550,25 +552,22 @@ if (!document.createElement('canvas').getContext) {
|
||||
style.size + 'px ' + style.family;
|
||||
}
|
||||
|
||||
var lineCapMap = {
|
||||
'butt': 'flat',
|
||||
'round': 'round'
|
||||
};
|
||||
|
||||
function processLineCap(lineCap) {
|
||||
switch (lineCap) {
|
||||
case 'butt':
|
||||
return 'flat';
|
||||
case 'round':
|
||||
return 'round';
|
||||
case 'square':
|
||||
default:
|
||||
return 'square';
|
||||
}
|
||||
return lineCapMap[lineCap] || 'square';
|
||||
}
|
||||
|
||||
/**
|
||||
* This class implements CanvasRenderingContext2D interface as described by
|
||||
* the WHATWG.
|
||||
* @param {HTMLElement} surfaceElement The element that the 2D context should
|
||||
* @param {HTMLElement} canvasElement The element that the 2D context should
|
||||
* be associated with
|
||||
*/
|
||||
function CanvasRenderingContext2D_(surfaceElement) {
|
||||
function CanvasRenderingContext2D_(canvasElement) {
|
||||
this.m_ = createMatrixIdentity();
|
||||
|
||||
this.mStack_ = [];
|
||||
@ -587,14 +586,19 @@ if (!document.createElement('canvas').getContext) {
|
||||
this.font = '10px sans-serif';
|
||||
this.textAlign = 'left';
|
||||
this.textBaseline = 'alphabetic';
|
||||
this.canvas = surfaceElement;
|
||||
this.canvas = canvasElement;
|
||||
|
||||
var el = surfaceElement.ownerDocument.createElement('div');
|
||||
el.style.width = surfaceElement.clientWidth + 'px';
|
||||
el.style.height = surfaceElement.clientHeight + 'px';
|
||||
el.style.overflow = 'hidden';
|
||||
el.style.position = 'absolute';
|
||||
surfaceElement.appendChild(el);
|
||||
var cssText = 'width:' + canvasElement.clientWidth + 'px;height:' +
|
||||
canvasElement.clientHeight + 'px;overflow:hidden;position:absolute';
|
||||
var el = canvasElement.ownerDocument.createElement('div');
|
||||
el.style.cssText = cssText;
|
||||
canvasElement.appendChild(el);
|
||||
|
||||
var overlayEl = el.cloneNode(false);
|
||||
// Use a non transparent background.
|
||||
overlayEl.style.backgroundColor = 'red';
|
||||
overlayEl.style.filter = 'alpha(opacity=0)';
|
||||
canvasElement.appendChild(overlayEl);
|
||||
|
||||
this.element_ = el;
|
||||
this.arcScaleX_ = 1;
|
||||
@ -618,14 +622,14 @@ if (!document.createElement('canvas').getContext) {
|
||||
};
|
||||
|
||||
contextPrototype.moveTo = function(aX, aY) {
|
||||
var p = this.getCoords_(aX, aY);
|
||||
var p = getCoords(this, aX, aY);
|
||||
this.currentPath_.push({type: 'moveTo', x: p.x, y: p.y});
|
||||
this.currentX_ = p.x;
|
||||
this.currentY_ = p.y;
|
||||
};
|
||||
|
||||
contextPrototype.lineTo = function(aX, aY) {
|
||||
var p = this.getCoords_(aX, aY);
|
||||
var p = getCoords(this, aX, aY);
|
||||
this.currentPath_.push({type: 'lineTo', x: p.x, y: p.y});
|
||||
|
||||
this.currentX_ = p.x;
|
||||
@ -635,9 +639,9 @@ if (!document.createElement('canvas').getContext) {
|
||||
contextPrototype.bezierCurveTo = function(aCP1x, aCP1y,
|
||||
aCP2x, aCP2y,
|
||||
aX, aY) {
|
||||
var p = this.getCoords_(aX, aY);
|
||||
var cp1 = this.getCoords_(aCP1x, aCP1y);
|
||||
var cp2 = this.getCoords_(aCP2x, aCP2y);
|
||||
var p = getCoords(this, aX, aY);
|
||||
var cp1 = getCoords(this, aCP1x, aCP1y);
|
||||
var cp2 = getCoords(this, aCP2x, aCP2y);
|
||||
bezierCurveTo(this, cp1, cp2, p);
|
||||
};
|
||||
|
||||
@ -660,8 +664,8 @@ if (!document.createElement('canvas').getContext) {
|
||||
// the following is lifted almost directly from
|
||||
// http://developer.mozilla.org/en/docs/Canvas_tutorial:Drawing_shapes
|
||||
|
||||
var cp = this.getCoords_(aCPx, aCPy);
|
||||
var p = this.getCoords_(aX, aY);
|
||||
var cp = getCoords(this, aCPx, aCPy);
|
||||
var p = getCoords(this, aX, aY);
|
||||
|
||||
var cp1 = {
|
||||
x: this.currentX_ + 2.0 / 3.0 * (cp.x - this.currentX_),
|
||||
@ -692,9 +696,9 @@ if (!document.createElement('canvas').getContext) {
|
||||
// that can be represented in binary
|
||||
}
|
||||
|
||||
var p = this.getCoords_(aX, aY);
|
||||
var pStart = this.getCoords_(xStart, yStart);
|
||||
var pEnd = this.getCoords_(xEnd, yEnd);
|
||||
var p = getCoords(this, aX, aY);
|
||||
var pStart = getCoords(this, xStart, yStart);
|
||||
var pEnd = getCoords(this, xEnd, yEnd);
|
||||
|
||||
this.currentPath_.push({type: arcType,
|
||||
x: p.x,
|
||||
@ -808,7 +812,7 @@ if (!document.createElement('canvas').getContext) {
|
||||
throw Error('Invalid number of arguments');
|
||||
}
|
||||
|
||||
var d = this.getCoords_(dx, dy);
|
||||
var d = getCoords(this, dx, dy);
|
||||
|
||||
var w2 = sw / 2;
|
||||
var h2 = sh / 2;
|
||||
@ -844,9 +848,9 @@ if (!document.createElement('canvas').getContext) {
|
||||
// Bounding box calculation (need to minimize displayed area so that
|
||||
// filters don't waste time on unused pixels.
|
||||
var max = d;
|
||||
var c2 = this.getCoords_(dx + dw, dy);
|
||||
var c3 = this.getCoords_(dx, dy + dh);
|
||||
var c4 = this.getCoords_(dx + dw, dy + dh);
|
||||
var c2 = getCoords(this, dx + dw, dy);
|
||||
var c3 = getCoords(this, dx, dy + dh);
|
||||
var c4 = getCoords(this, dx + dw, dy + dh);
|
||||
|
||||
max.x = m.max(max.x, c2.x, c3.x, c4.x);
|
||||
max.y = m.max(max.y, c2.y, c3.y, c4.y);
|
||||
@ -1015,8 +1019,8 @@ if (!document.createElement('canvas').getContext) {
|
||||
var y0 = fillStyle.y0_ / arcScaleY;
|
||||
var x1 = fillStyle.x1_ / arcScaleX;
|
||||
var y1 = fillStyle.y1_ / arcScaleY;
|
||||
var p0 = ctx.getCoords_(x0, y0);
|
||||
var p1 = ctx.getCoords_(x1, y1);
|
||||
var p0 = getCoords(ctx, x0, y0);
|
||||
var p1 = getCoords(ctx, x1, y1);
|
||||
var dx = p1.x - p0.x;
|
||||
var dy = p1.y - p0.y;
|
||||
angle = Math.atan2(dx, dy) * 180 / Math.PI;
|
||||
@ -1032,7 +1036,7 @@ if (!document.createElement('canvas').getContext) {
|
||||
angle = 0;
|
||||
}
|
||||
} else {
|
||||
var p0 = ctx.getCoords_(fillStyle.x0_, fillStyle.y0_);
|
||||
var p0 = getCoords(ctx, fillStyle.x0_, fillStyle.y0_);
|
||||
focus = {
|
||||
x: (p0.x - min.x) / width,
|
||||
y: (p0.y - min.y) / height
|
||||
@ -1105,11 +1109,8 @@ if (!document.createElement('canvas').getContext) {
|
||||
this.currentPath_.push({type: 'close'});
|
||||
};
|
||||
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
contextPrototype.getCoords_ = function(aX, aY) {
|
||||
var m = this.m_;
|
||||
function getCoords(ctx, aX, aY) {
|
||||
var m = ctx.m_;
|
||||
return {
|
||||
x: Z * (aX * m[0][0] + aY * m[1][0] + m[2][0]) - Z2,
|
||||
y: Z * (aX * m[0][1] + aY * m[1][1] + m[2][1]) - Z2
|
||||
@ -1270,7 +1271,7 @@ if (!document.createElement('canvas').getContext) {
|
||||
break;
|
||||
}
|
||||
|
||||
var d = this.getCoords_(x + offset.x, y + offset.y);
|
||||
var d = getCoords(this, x + offset.x, y + offset.y);
|
||||
|
||||
lineStr.push('<g_vml_:line from="', -left ,' 0" to="', right ,' 0.05" ',
|
||||
' coordsize="100 100" coordorigin="0 0"',
|
||||
|
||||
2
htdocs/includes/jquery/plugins/flot/excanvas.min.js
vendored
Executable file → Normal file
2
htdocs/includes/jquery/plugins/flot/excanvas.min.js
vendored
Executable file → Normal file
File diff suppressed because one or more lines are too long
0
htdocs/includes/jquery/plugins/flot/jquery.colorhelpers.js
Executable file → Normal file
0
htdocs/includes/jquery/plugins/flot/jquery.colorhelpers.js
Executable file → Normal file
22
htdocs/includes/jquery/plugins/flot/jquery.colorhelpers.min.js
vendored
Executable file → Normal file
22
htdocs/includes/jquery/plugins/flot/jquery.colorhelpers.min.js
vendored
Executable file → Normal file
@ -1 +1,21 @@
|
||||
(function(b){b.color={};b.color.make=function(f,e,c,d){var h={};h.r=f||0;h.g=e||0;h.b=c||0;h.a=d!=null?d:1;h.add=function(k,j){for(var g=0;g<k.length;++g){h[k.charAt(g)]+=j}return h.normalize()};h.scale=function(k,j){for(var g=0;g<k.length;++g){h[k.charAt(g)]*=j}return h.normalize()};h.toString=function(){if(h.a>=1){return"rgb("+[h.r,h.g,h.b].join(",")+")"}else{return"rgba("+[h.r,h.g,h.b,h.a].join(",")+")"}};h.normalize=function(){function g(j,k,i){return k<j?j:(k>i?i:k)}h.r=g(0,parseInt(h.r),255);h.g=g(0,parseInt(h.g),255);h.b=g(0,parseInt(h.b),255);h.a=g(0,h.a,1);return h};h.clone=function(){return b.color.make(h.r,h.b,h.g,h.a)};return h.normalize()};b.color.extract=function(e,d){var f;do{f=e.css(d).toLowerCase();if(f!=""&&f!="transparent"){break}e=e.parent()}while(!b.nodeName(e.get(0),"body"));if(f=="rgba(0, 0, 0, 0)"){f="transparent"}return b.color.parse(f)};b.color.parse=function(f){var e,c=b.color.make;if(e=/rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(f)){return c(parseInt(e[1],10),parseInt(e[2],10),parseInt(e[3],10))}if(e=/rgba\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]+(?:\.[0-9]+)?)\s*\)/.exec(f)){return c(parseInt(e[1],10),parseInt(e[2],10),parseInt(e[3],10),parseFloat(e[4]))}if(e=/rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)/.exec(f)){return c(parseFloat(e[1])*2.55,parseFloat(e[2])*2.55,parseFloat(e[3])*2.55)}if(e=/rgba\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\s*\)/.exec(f)){return c(parseFloat(e[1])*2.55,parseFloat(e[2])*2.55,parseFloat(e[3])*2.55,parseFloat(e[4]))}if(e=/#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(f)){return c(parseInt(e[1],16),parseInt(e[2],16),parseInt(e[3],16))}if(e=/#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec(f)){return c(parseInt(e[1]+e[1],16),parseInt(e[2]+e[2],16),parseInt(e[3]+e[3],16))}var d=b.trim(f).toLowerCase();if(d=="transparent"){return c(255,255,255,0)}else{e=a[d]||[0,0,0];return c(e[0],e[1],e[2])}};var a={aqua:[0,255,255],azure:[240,255,255],beige:[245,245,220],black:[0,0,0],blue:[0,0,255],brown:[165,42,42],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgrey:[169,169,169],darkgreen:[0,100,0],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkviolet:[148,0,211],fuchsia:[255,0,255],gold:[255,215,0],green:[0,128,0],indigo:[75,0,130],khaki:[240,230,140],lightblue:[173,216,230],lightcyan:[224,255,255],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightyellow:[255,255,224],lime:[0,255,0],magenta:[255,0,255],maroon:[128,0,0],navy:[0,0,128],olive:[128,128,0],orange:[255,165,0],pink:[255,192,203],purple:[128,0,128],violet:[128,0,128],red:[255,0,0],silver:[192,192,192],white:[255,255,255],yellow:[255,255,0]}})(jQuery);
|
||||
/* Plugin for jQuery for working with colors.
|
||||
*
|
||||
* Version 1.1.
|
||||
*
|
||||
* Inspiration from jQuery color animation plugin by John Resig.
|
||||
*
|
||||
* Released under the MIT license by Ole Laursen, October 2009.
|
||||
*
|
||||
* Examples:
|
||||
*
|
||||
* $.color.parse("#fff").scale('rgb', 0.25).add('a', -0.5).toString()
|
||||
* var c = $.color.extract($("#mydiv"), 'background-color');
|
||||
* console.log(c.r, c.g, c.b, c.a);
|
||||
* $.color.make(100, 50, 25, 0.4).toString() // returns "rgba(100,50,25,0.4)"
|
||||
*
|
||||
* Note that .scale() and .add() return the same modified object
|
||||
* instead of making a new one.
|
||||
*
|
||||
* V. 1.1: Fix error handling so e.g. parsing an empty string does
|
||||
* produce a color rather than just crashing.
|
||||
*/(function(e){e.color={},e.color.make=function(t,n,r,i){var s={};return s.r=t||0,s.g=n||0,s.b=r||0,s.a=i!=null?i:1,s.add=function(e,t){for(var n=0;n<e.length;++n)s[e.charAt(n)]+=t;return s.normalize()},s.scale=function(e,t){for(var n=0;n<e.length;++n)s[e.charAt(n)]*=t;return s.normalize()},s.toString=function(){return s.a>=1?"rgb("+[s.r,s.g,s.b].join(",")+")":"rgba("+[s.r,s.g,s.b,s.a].join(",")+")"},s.normalize=function(){function e(e,t,n){return t<e?e:t>n?n:t}return s.r=e(0,parseInt(s.r),255),s.g=e(0,parseInt(s.g),255),s.b=e(0,parseInt(s.b),255),s.a=e(0,s.a,1),s},s.clone=function(){return e.color.make(s.r,s.b,s.g,s.a)},s.normalize()},e.color.extract=function(t,n){var r;do{r=t.css(n).toLowerCase();if(r!=""&&r!="transparent")break;t=t.parent()}while(!e.nodeName(t.get(0),"body"));return r=="rgba(0, 0, 0, 0)"&&(r="transparent"),e.color.parse(r)},e.color.parse=function(n){var r,i=e.color.make;if(r=/rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(n))return i(parseInt(r[1],10),parseInt(r[2],10),parseInt(r[3],10));if(r=/rgba\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]+(?:\.[0-9]+)?)\s*\)/.exec(n))return i(parseInt(r[1],10),parseInt(r[2],10),parseInt(r[3],10),parseFloat(r[4]));if(r=/rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)/.exec(n))return i(parseFloat(r[1])*2.55,parseFloat(r[2])*2.55,parseFloat(r[3])*2.55);if(r=/rgba\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\s*\)/.exec(n))return i(parseFloat(r[1])*2.55,parseFloat(r[2])*2.55,parseFloat(r[3])*2.55,parseFloat(r[4]));if(r=/#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(n))return i(parseInt(r[1],16),parseInt(r[2],16),parseInt(r[3],16));if(r=/#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec(n))return i(parseInt(r[1]+r[1],16),parseInt(r[2]+r[2],16),parseInt(r[3]+r[3],16));var s=e.trim(n).toLowerCase();return s=="transparent"?i(255,255,255,0):(r=t[s]||[0,0,0],i(r[0],r[1],r[2]))};var t={aqua:[0,255,255],azure:[240,255,255],beige:[245,245,220],black:[0,0,0],blue:[0,0,255],brown:[165,42,42],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgrey:[169,169,169],darkgreen:[0,100,0],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkviolet:[148,0,211],fuchsia:[255,0,255],gold:[255,215,0],green:[0,128,0],indigo:[75,0,130],khaki:[240,230,140],lightblue:[173,216,230],lightcyan:[224,255,255],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightyellow:[255,255,224],lime:[0,255,0],magenta:[255,0,255],maroon:[128,0,0],navy:[0,0,128],olive:[128,128,0],orange:[255,165,0],pink:[255,192,203],purple:[128,0,128],violet:[128,0,128],red:[255,0,0],silver:[192,192,192],white:[255,255,255],yellow:[255,255,0]}})(jQuery);
|
||||
345
htdocs/includes/jquery/plugins/flot/jquery.flot.canvas.js
Normal file
345
htdocs/includes/jquery/plugins/flot/jquery.flot.canvas.js
Normal file
@ -0,0 +1,345 @@
|
||||
/* Flot plugin for drawing all elements of a plot on the canvas.
|
||||
|
||||
Copyright (c) 2007-2013 IOLA and Ole Laursen.
|
||||
Licensed under the MIT license.
|
||||
|
||||
Flot normally produces certain elements, like axis labels and the legend, using
|
||||
HTML elements. This permits greater interactivity and customization, and often
|
||||
looks better, due to cross-browser canvas text inconsistencies and limitations.
|
||||
|
||||
It can also be desirable to render the plot entirely in canvas, particularly
|
||||
if the goal is to save it as an image, or if Flot is being used in a context
|
||||
where the HTML DOM does not exist, as is the case within Node.js. This plugin
|
||||
switches out Flot's standard drawing operations for canvas-only replacements.
|
||||
|
||||
Currently the plugin supports only axis labels, but it will eventually allow
|
||||
every element of the plot to be rendered directly to canvas.
|
||||
|
||||
The plugin supports these options:
|
||||
|
||||
{
|
||||
canvas: boolean
|
||||
}
|
||||
|
||||
The "canvas" option controls whether full canvas drawing is enabled, making it
|
||||
possible to toggle on and off. This is useful when a plot uses HTML text in the
|
||||
browser, but needs to redraw with canvas text when exporting as an image.
|
||||
|
||||
*/
|
||||
|
||||
(function($) {
|
||||
|
||||
var options = {
|
||||
canvas: true
|
||||
};
|
||||
|
||||
var render, getTextInfo, addText;
|
||||
|
||||
// Cache the prototype hasOwnProperty for faster access
|
||||
|
||||
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
||||
|
||||
function init(plot, classes) {
|
||||
|
||||
var Canvas = classes.Canvas;
|
||||
|
||||
// We only want to replace the functions once; the second time around
|
||||
// we would just get our new function back. This whole replacing of
|
||||
// prototype functions is a disaster, and needs to be changed ASAP.
|
||||
|
||||
if (render == null) {
|
||||
getTextInfo = Canvas.prototype.getTextInfo,
|
||||
addText = Canvas.prototype.addText,
|
||||
render = Canvas.prototype.render;
|
||||
}
|
||||
|
||||
// Finishes rendering the canvas, including overlaid text
|
||||
|
||||
Canvas.prototype.render = function() {
|
||||
|
||||
if (!plot.getOptions().canvas) {
|
||||
return render.call(this);
|
||||
}
|
||||
|
||||
var context = this.context,
|
||||
cache = this._textCache;
|
||||
|
||||
// For each text layer, render elements marked as active
|
||||
|
||||
context.save();
|
||||
context.textBaseline = "middle";
|
||||
|
||||
for (var layerKey in cache) {
|
||||
if (hasOwnProperty.call(cache, layerKey)) {
|
||||
var layerCache = cache[layerKey];
|
||||
for (var styleKey in layerCache) {
|
||||
if (hasOwnProperty.call(layerCache, styleKey)) {
|
||||
var styleCache = layerCache[styleKey],
|
||||
updateStyles = true;
|
||||
for (var key in styleCache) {
|
||||
if (hasOwnProperty.call(styleCache, key)) {
|
||||
|
||||
var info = styleCache[key],
|
||||
positions = info.positions,
|
||||
lines = info.lines;
|
||||
|
||||
// Since every element at this level of the cache have the
|
||||
// same font and fill styles, we can just change them once
|
||||
// using the values from the first element.
|
||||
|
||||
if (updateStyles) {
|
||||
context.fillStyle = info.font.color;
|
||||
context.font = info.font.definition;
|
||||
updateStyles = false;
|
||||
}
|
||||
|
||||
for (var i = 0, position; position = positions[i]; i++) {
|
||||
if (position.active) {
|
||||
for (var j = 0, line; line = position.lines[j]; j++) {
|
||||
context.fillText(lines[j].text, line[0], line[1]);
|
||||
}
|
||||
} else {
|
||||
positions.splice(i--, 1);
|
||||
}
|
||||
}
|
||||
|
||||
if (positions.length == 0) {
|
||||
delete styleCache[key];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
context.restore();
|
||||
};
|
||||
|
||||
// Creates (if necessary) and returns a text info object.
|
||||
//
|
||||
// When the canvas option is set, the object looks like this:
|
||||
//
|
||||
// {
|
||||
// width: Width of the text's bounding box.
|
||||
// height: Height of the text's bounding box.
|
||||
// positions: Array of positions at which this text is drawn.
|
||||
// lines: [{
|
||||
// height: Height of this line.
|
||||
// widths: Width of this line.
|
||||
// text: Text on this line.
|
||||
// }],
|
||||
// font: {
|
||||
// definition: Canvas font property string.
|
||||
// color: Color of the text.
|
||||
// },
|
||||
// }
|
||||
//
|
||||
// The positions array contains objects that look like this:
|
||||
//
|
||||
// {
|
||||
// active: Flag indicating whether the text should be visible.
|
||||
// lines: Array of [x, y] coordinates at which to draw the line.
|
||||
// x: X coordinate at which to draw the text.
|
||||
// y: Y coordinate at which to draw the text.
|
||||
// }
|
||||
|
||||
Canvas.prototype.getTextInfo = function(layer, text, font, angle, width) {
|
||||
|
||||
if (!plot.getOptions().canvas) {
|
||||
return getTextInfo.call(this, layer, text, font, angle, width);
|
||||
}
|
||||
|
||||
var textStyle, layerCache, styleCache, info;
|
||||
|
||||
// Cast the value to a string, in case we were given a number
|
||||
|
||||
text = "" + text;
|
||||
|
||||
// If the font is a font-spec object, generate a CSS definition
|
||||
|
||||
if (typeof font === "object") {
|
||||
textStyle = font.style + " " + font.variant + " " + font.weight + " " + font.size + "px " + font.family;
|
||||
} else {
|
||||
textStyle = font;
|
||||
}
|
||||
|
||||
// Retrieve (or create) the cache for the text's layer and styles
|
||||
|
||||
layerCache = this._textCache[layer];
|
||||
|
||||
if (layerCache == null) {
|
||||
layerCache = this._textCache[layer] = {};
|
||||
}
|
||||
|
||||
styleCache = layerCache[textStyle];
|
||||
|
||||
if (styleCache == null) {
|
||||
styleCache = layerCache[textStyle] = {};
|
||||
}
|
||||
|
||||
info = styleCache[text];
|
||||
|
||||
if (info == null) {
|
||||
|
||||
var context = this.context;
|
||||
|
||||
// If the font was provided as CSS, create a div with those
|
||||
// classes and examine it to generate a canvas font spec.
|
||||
|
||||
if (typeof font !== "object") {
|
||||
|
||||
var element = $("<div> </div>")
|
||||
.css("position", "absolute")
|
||||
.addClass(typeof font === "string" ? font : null)
|
||||
.appendTo(this.getTextLayer(layer));
|
||||
|
||||
font = {
|
||||
lineHeight: element.height(),
|
||||
style: element.css("font-style"),
|
||||
variant: element.css("font-variant"),
|
||||
weight: element.css("font-weight"),
|
||||
family: element.css("font-family"),
|
||||
color: element.css("color")
|
||||
};
|
||||
|
||||
// Setting line-height to 1, without units, sets it equal
|
||||
// to the font-size, even if the font-size is abstract,
|
||||
// like 'smaller'. This enables us to read the real size
|
||||
// via the element's height, working around browsers that
|
||||
// return the literal 'smaller' value.
|
||||
|
||||
font.size = element.css("line-height", 1).height();
|
||||
|
||||
element.remove();
|
||||
}
|
||||
|
||||
textStyle = font.style + " " + font.variant + " " + font.weight + " " + font.size + "px " + font.family;
|
||||
|
||||
// Create a new info object, initializing the dimensions to
|
||||
// zero so we can count them up line-by-line.
|
||||
|
||||
info = styleCache[text] = {
|
||||
width: 0,
|
||||
height: 0,
|
||||
positions: [],
|
||||
lines: [],
|
||||
font: {
|
||||
definition: textStyle,
|
||||
color: font.color
|
||||
}
|
||||
};
|
||||
|
||||
context.save();
|
||||
context.font = textStyle;
|
||||
|
||||
// Canvas can't handle multi-line strings; break on various
|
||||
// newlines, including HTML brs, to build a list of lines.
|
||||
// Note that we could split directly on regexps, but IE < 9 is
|
||||
// broken; revisit when we drop IE 7/8 support.
|
||||
|
||||
var lines = (text + "").replace(/<br ?\/?>|\r\n|\r/g, "\n").split("\n");
|
||||
|
||||
for (var i = 0; i < lines.length; ++i) {
|
||||
|
||||
var lineText = lines[i],
|
||||
measured = context.measureText(lineText);
|
||||
|
||||
info.width = Math.max(measured.width, info.width);
|
||||
info.height += font.lineHeight;
|
||||
|
||||
info.lines.push({
|
||||
text: lineText,
|
||||
width: measured.width,
|
||||
height: font.lineHeight
|
||||
});
|
||||
}
|
||||
|
||||
context.restore();
|
||||
}
|
||||
|
||||
return info;
|
||||
};
|
||||
|
||||
// Adds a text string to the canvas text overlay.
|
||||
|
||||
Canvas.prototype.addText = function(layer, x, y, text, font, angle, width, halign, valign) {
|
||||
|
||||
if (!plot.getOptions().canvas) {
|
||||
return addText.call(this, layer, x, y, text, font, angle, width, halign, valign);
|
||||
}
|
||||
|
||||
var info = this.getTextInfo(layer, text, font, angle, width),
|
||||
positions = info.positions,
|
||||
lines = info.lines;
|
||||
|
||||
// Text is drawn with baseline 'middle', which we need to account
|
||||
// for by adding half a line's height to the y position.
|
||||
|
||||
y += info.height / lines.length / 2;
|
||||
|
||||
// Tweak the initial y-position to match vertical alignment
|
||||
|
||||
if (valign == "middle") {
|
||||
y = Math.round(y - info.height / 2);
|
||||
} else if (valign == "bottom") {
|
||||
y = Math.round(y - info.height);
|
||||
} else {
|
||||
y = Math.round(y);
|
||||
}
|
||||
|
||||
// FIXME: LEGACY BROWSER FIX
|
||||
// AFFECTS: Opera < 12.00
|
||||
|
||||
// Offset the y coordinate, since Opera is off pretty
|
||||
// consistently compared to the other browsers.
|
||||
|
||||
if (!!(window.opera && window.opera.version().split(".")[0] < 12)) {
|
||||
y -= 2;
|
||||
}
|
||||
|
||||
// Determine whether this text already exists at this position.
|
||||
// If so, mark it for inclusion in the next render pass.
|
||||
|
||||
for (var i = 0, position; position = positions[i]; i++) {
|
||||
if (position.x == x && position.y == y) {
|
||||
position.active = true;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// If the text doesn't exist at this position, create a new entry
|
||||
|
||||
position = {
|
||||
active: true,
|
||||
lines: [],
|
||||
x: x,
|
||||
y: y
|
||||
};
|
||||
|
||||
positions.push(position);
|
||||
|
||||
// Fill in the x & y positions of each line, adjusting them
|
||||
// individually for horizontal alignment.
|
||||
|
||||
for (var i = 0, line; line = lines[i]; i++) {
|
||||
if (halign == "center") {
|
||||
position.lines.push([Math.round(x - line.width / 2), y]);
|
||||
} else if (halign == "right") {
|
||||
position.lines.push([Math.round(x - line.width), y]);
|
||||
} else {
|
||||
position.lines.push([Math.round(x), y]);
|
||||
}
|
||||
y += line.height;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
$.plot.plugins.push({
|
||||
init: init,
|
||||
options: options,
|
||||
name: "canvas",
|
||||
version: "1.0"
|
||||
});
|
||||
|
||||
})(jQuery);
|
||||
28
htdocs/includes/jquery/plugins/flot/jquery.flot.canvas.min.js
vendored
Normal file
28
htdocs/includes/jquery/plugins/flot/jquery.flot.canvas.min.js
vendored
Normal file
@ -0,0 +1,28 @@
|
||||
/* Flot plugin for drawing all elements of a plot on the canvas.
|
||||
|
||||
Copyright (c) 2007-2013 IOLA and Ole Laursen.
|
||||
Licensed under the MIT license.
|
||||
|
||||
Flot normally produces certain elements, like axis labels and the legend, using
|
||||
HTML elements. This permits greater interactivity and customization, and often
|
||||
looks better, due to cross-browser canvas text inconsistencies and limitations.
|
||||
|
||||
It can also be desirable to render the plot entirely in canvas, particularly
|
||||
if the goal is to save it as an image, or if Flot is being used in a context
|
||||
where the HTML DOM does not exist, as is the case within Node.js. This plugin
|
||||
switches out Flot's standard drawing operations for canvas-only replacements.
|
||||
|
||||
Currently the plugin supports only axis labels, but it will eventually allow
|
||||
every element of the plot to be rendered directly to canvas.
|
||||
|
||||
The plugin supports these options:
|
||||
|
||||
{
|
||||
canvas: boolean
|
||||
}
|
||||
|
||||
The "canvas" option controls whether full canvas drawing is enabled, making it
|
||||
possible to toggle on and off. This is useful when a plot uses HTML text in the
|
||||
browser, but needs to redraw with canvas text when exporting as an image.
|
||||
|
||||
*/(function(e){function o(t,o){var u=o.Canvas;n==null&&(r=u.prototype.getTextInfo,i=u.prototype.addText,n=u.prototype.render),u.prototype.render=function(){if(!t.getOptions().canvas)return n.call(this);var e=this.context,r=this._textCache;e.save(),e.textBaseline="middle";for(var i in r)if(s.call(r,i)){var o=r[i];for(var u in o)if(s.call(o,u)){var a=o[u],f=!0;for(var l in a)if(s.call(a,l)){var c=a[l],h=c.positions,p=c.lines;f&&(e.fillStyle=c.font.color,e.font=c.font.definition,f=!1);for(var d=0,v;v=h[d];d++)if(v.active)for(var m=0,g;g=v.lines[m];m++)e.fillText(p[m].text,g[0],g[1]);else h.splice(d--,1);h.length==0&&delete a[l]}}}e.restore()},u.prototype.getTextInfo=function(n,i,s,o,u){if(!t.getOptions().canvas)return r.call(this,n,i,s,o,u);var a,f,l,c;i=""+i,typeof s=="object"?a=s.style+" "+s.variant+" "+s.weight+" "+s.size+"px "+s.family:a=s,f=this._textCache[n],f==null&&(f=this._textCache[n]={}),l=f[a],l==null&&(l=f[a]={}),c=l[i];if(c==null){var h=this.context;if(typeof s!="object"){var p=e("<div> </div>").css("position","absolute").addClass(typeof s=="string"?s:null).appendTo(this.getTextLayer(n));s={lineHeight:p.height(),style:p.css("font-style"),variant:p.css("font-variant"),weight:p.css("font-weight"),family:p.css("font-family"),color:p.css("color")},s.size=p.css("line-height",1).height(),p.remove()}a=s.style+" "+s.variant+" "+s.weight+" "+s.size+"px "+s.family,c=l[i]={width:0,height:0,positions:[],lines:[],font:{definition:a,color:s.color}},h.save(),h.font=a;var d=(i+"").replace(/<br ?\/?>|\r\n|\r/g,"\n").split("\n");for(var v=0;v<d.length;++v){var m=d[v],g=h.measureText(m);c.width=Math.max(g.width,c.width),c.height+=s.lineHeight,c.lines.push({text:m,width:g.width,height:s.lineHeight})}h.restore()}return c},u.prototype.addText=function(e,n,r,s,o,u,a,f,l){if(!t.getOptions().canvas)return i.call(this,e,n,r,s,o,u,a,f,l);var c=this.getTextInfo(e,s,o,u,a),h=c.positions,p=c.lines;r+=c.height/p.length/2,l=="middle"?r=Math.round(r-c.height/2):l=="bottom"?r=Math.round(r-c.height):r=Math.round(r),!(window.opera&&window.opera.version().split(".")[0]<12)||(r-=2);for(var d=0,v;v=h[d];d++)if(v.x==n&&v.y==r){v.active=!0;return}v={active:!0,lines:[],x:n,y:r},h.push(v);for(var d=0,m;m=p[d];d++)f=="center"?v.lines.push([Math.round(n-m.width/2),r]):f=="right"?v.lines.push([Math.round(n-m.width),r]):v.lines.push([Math.round(n),r]),r+=m.height}}var t={canvas:!0},n,r,i,s=Object.prototype.hasOwnProperty;e.plot.plugins.push({init:o,options:t,name:"canvas",version:"1.0"})})(jQuery);
|
||||
190
htdocs/includes/jquery/plugins/flot/jquery.flot.categories.js
Normal file
190
htdocs/includes/jquery/plugins/flot/jquery.flot.categories.js
Normal file
@ -0,0 +1,190 @@
|
||||
/* Flot plugin for plotting textual data or categories.
|
||||
|
||||
Copyright (c) 2007-2013 IOLA and Ole Laursen.
|
||||
Licensed under the MIT license.
|
||||
|
||||
Consider a dataset like [["February", 34], ["March", 20], ...]. This plugin
|
||||
allows you to plot such a dataset directly.
|
||||
|
||||
To enable it, you must specify mode: "categories" on the axis with the textual
|
||||
labels, e.g.
|
||||
|
||||
$.plot("#placeholder", data, { xaxis: { mode: "categories" } });
|
||||
|
||||
By default, the labels are ordered as they are met in the data series. If you
|
||||
need a different ordering, you can specify "categories" on the axis options
|
||||
and list the categories there:
|
||||
|
||||
xaxis: {
|
||||
mode: "categories",
|
||||
categories: ["February", "March", "April"]
|
||||
}
|
||||
|
||||
If you need to customize the distances between the categories, you can specify
|
||||
"categories" as an object mapping labels to values
|
||||
|
||||
xaxis: {
|
||||
mode: "categories",
|
||||
categories: { "February": 1, "March": 3, "April": 4 }
|
||||
}
|
||||
|
||||
If you don't specify all categories, the remaining categories will be numbered
|
||||
from the max value plus 1 (with a spacing of 1 between each).
|
||||
|
||||
Internally, the plugin works by transforming the input data through an auto-
|
||||
generated mapping where the first category becomes 0, the second 1, etc.
|
||||
Hence, a point like ["February", 34] becomes [0, 34] internally in Flot (this
|
||||
is visible in hover and click events that return numbers rather than the
|
||||
category labels). The plugin also overrides the tick generator to spit out the
|
||||
categories as ticks instead of the values.
|
||||
|
||||
If you need to map a value back to its label, the mapping is always accessible
|
||||
as "categories" on the axis object, e.g. plot.getAxes().xaxis.categories.
|
||||
|
||||
*/
|
||||
|
||||
(function ($) {
|
||||
var options = {
|
||||
xaxis: {
|
||||
categories: null
|
||||
},
|
||||
yaxis: {
|
||||
categories: null
|
||||
}
|
||||
};
|
||||
|
||||
function processRawData(plot, series, data, datapoints) {
|
||||
// if categories are enabled, we need to disable
|
||||
// auto-transformation to numbers so the strings are intact
|
||||
// for later processing
|
||||
|
||||
var xCategories = series.xaxis.options.mode == "categories",
|
||||
yCategories = series.yaxis.options.mode == "categories";
|
||||
|
||||
if (!(xCategories || yCategories))
|
||||
return;
|
||||
|
||||
var format = datapoints.format;
|
||||
|
||||
if (!format) {
|
||||
// FIXME: auto-detection should really not be defined here
|
||||
var s = series;
|
||||
format = [];
|
||||
format.push({ x: true, number: true, required: true });
|
||||
format.push({ y: true, number: true, required: true });
|
||||
|
||||
if (s.bars.show || (s.lines.show && s.lines.fill)) {
|
||||
var autoscale = !!((s.bars.show && s.bars.zero) || (s.lines.show && s.lines.zero));
|
||||
format.push({ y: true, number: true, required: false, defaultValue: 0, autoscale: autoscale });
|
||||
if (s.bars.horizontal) {
|
||||
delete format[format.length - 1].y;
|
||||
format[format.length - 1].x = true;
|
||||
}
|
||||
}
|
||||
|
||||
datapoints.format = format;
|
||||
}
|
||||
|
||||
for (var m = 0; m < format.length; ++m) {
|
||||
if (format[m].x && xCategories)
|
||||
format[m].number = false;
|
||||
|
||||
if (format[m].y && yCategories)
|
||||
format[m].number = false;
|
||||
}
|
||||
}
|
||||
|
||||
function getNextIndex(categories) {
|
||||
var index = -1;
|
||||
|
||||
for (var v in categories)
|
||||
if (categories[v] > index)
|
||||
index = categories[v];
|
||||
|
||||
return index + 1;
|
||||
}
|
||||
|
||||
function categoriesTickGenerator(axis) {
|
||||
var res = [];
|
||||
for (var label in axis.categories) {
|
||||
var v = axis.categories[label];
|
||||
if (v >= axis.min && v <= axis.max)
|
||||
res.push([v, label]);
|
||||
}
|
||||
|
||||
res.sort(function (a, b) { return a[0] - b[0]; });
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
function setupCategoriesForAxis(series, axis, datapoints) {
|
||||
if (series[axis].options.mode != "categories")
|
||||
return;
|
||||
|
||||
if (!series[axis].categories) {
|
||||
// parse options
|
||||
var c = {}, o = series[axis].options.categories || {};
|
||||
if ($.isArray(o)) {
|
||||
for (var i = 0; i < o.length; ++i)
|
||||
c[o[i]] = i;
|
||||
}
|
||||
else {
|
||||
for (var v in o)
|
||||
c[v] = o[v];
|
||||
}
|
||||
|
||||
series[axis].categories = c;
|
||||
}
|
||||
|
||||
// fix ticks
|
||||
if (!series[axis].options.ticks)
|
||||
series[axis].options.ticks = categoriesTickGenerator;
|
||||
|
||||
transformPointsOnAxis(datapoints, axis, series[axis].categories);
|
||||
}
|
||||
|
||||
function transformPointsOnAxis(datapoints, axis, categories) {
|
||||
// go through the points, transforming them
|
||||
var points = datapoints.points,
|
||||
ps = datapoints.pointsize,
|
||||
format = datapoints.format,
|
||||
formatColumn = axis.charAt(0),
|
||||
index = getNextIndex(categories);
|
||||
|
||||
for (var i = 0; i < points.length; i += ps) {
|
||||
if (points[i] == null)
|
||||
continue;
|
||||
|
||||
for (var m = 0; m < ps; ++m) {
|
||||
var val = points[i + m];
|
||||
|
||||
if (val == null || !format[m][formatColumn])
|
||||
continue;
|
||||
|
||||
if (!(val in categories)) {
|
||||
categories[val] = index;
|
||||
++index;
|
||||
}
|
||||
|
||||
points[i + m] = categories[val];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function processDatapoints(plot, series, datapoints) {
|
||||
setupCategoriesForAxis(series, "xaxis", datapoints);
|
||||
setupCategoriesForAxis(series, "yaxis", datapoints);
|
||||
}
|
||||
|
||||
function init(plot) {
|
||||
plot.hooks.processRawData.push(processRawData);
|
||||
plot.hooks.processDatapoints.push(processDatapoints);
|
||||
}
|
||||
|
||||
$.plot.plugins.push({
|
||||
init: init,
|
||||
options: options,
|
||||
name: 'categories',
|
||||
version: '1.0'
|
||||
});
|
||||
})(jQuery);
|
||||
44
htdocs/includes/jquery/plugins/flot/jquery.flot.categories.min.js
vendored
Normal file
44
htdocs/includes/jquery/plugins/flot/jquery.flot.categories.min.js
vendored
Normal file
@ -0,0 +1,44 @@
|
||||
/* Flot plugin for plotting textual data or categories.
|
||||
|
||||
Copyright (c) 2007-2013 IOLA and Ole Laursen.
|
||||
Licensed under the MIT license.
|
||||
|
||||
Consider a dataset like [["February", 34], ["March", 20], ...]. This plugin
|
||||
allows you to plot such a dataset directly.
|
||||
|
||||
To enable it, you must specify mode: "categories" on the axis with the textual
|
||||
labels, e.g.
|
||||
|
||||
$.plot("#placeholder", data, { xaxis: { mode: "categories" } });
|
||||
|
||||
By default, the labels are ordered as they are met in the data series. If you
|
||||
need a different ordering, you can specify "categories" on the axis options
|
||||
and list the categories there:
|
||||
|
||||
xaxis: {
|
||||
mode: "categories",
|
||||
categories: ["February", "March", "April"]
|
||||
}
|
||||
|
||||
If you need to customize the distances between the categories, you can specify
|
||||
"categories" as an object mapping labels to values
|
||||
|
||||
xaxis: {
|
||||
mode: "categories",
|
||||
categories: { "February": 1, "March": 3, "April": 4 }
|
||||
}
|
||||
|
||||
If you don't specify all categories, the remaining categories will be numbered
|
||||
from the max value plus 1 (with a spacing of 1 between each).
|
||||
|
||||
Internally, the plugin works by transforming the input data through an auto-
|
||||
generated mapping where the first category becomes 0, the second 1, etc.
|
||||
Hence, a point like ["February", 34] becomes [0, 34] internally in Flot (this
|
||||
is visible in hover and click events that return numbers rather than the
|
||||
category labels). The plugin also overrides the tick generator to spit out the
|
||||
categories as ticks instead of the values.
|
||||
|
||||
If you need to map a value back to its label, the mapping is always accessible
|
||||
as "categories" on the axis object, e.g. plot.getAxes().xaxis.categories.
|
||||
|
||||
*/(function(e){function n(e,t,n,r){var i=t.xaxis.options.mode=="categories",s=t.yaxis.options.mode=="categories";if(!i&&!s)return;var o=r.format;if(!o){var u=t;o=[],o.push({x:!0,number:!0,required:!0}),o.push({y:!0,number:!0,required:!0});if(u.bars.show||u.lines.show&&u.lines.fill){var a=!!(u.bars.show&&u.bars.zero||u.lines.show&&u.lines.zero);o.push({y:!0,number:!0,required:!1,defaultValue:0,autoscale:a}),u.bars.horizontal&&(delete o[o.length-1].y,o[o.length-1].x=!0)}r.format=o}for(var f=0;f<o.length;++f)o[f].x&&i&&(o[f].number=!1),o[f].y&&s&&(o[f].number=!1)}function r(e){var t=-1;for(var n in e)e[n]>t&&(t=e[n]);return t+1}function i(e){var t=[];for(var n in e.categories){var r=e.categories[n];r>=e.min&&r<=e.max&&t.push([r,n])}return t.sort(function(e,t){return e[0]-t[0]}),t}function s(t,n,r){if(t[n].options.mode!="categories")return;if(!t[n].categories){var s={},u=t[n].options.categories||{};if(e.isArray(u))for(var a=0;a<u.length;++a)s[u[a]]=a;else for(var f in u)s[f]=u[f];t[n].categories=s}t[n].options.ticks||(t[n].options.ticks=i),o(r,n,t[n].categories)}function o(e,t,n){var i=e.points,s=e.pointsize,o=e.format,u=t.charAt(0),a=r(n);for(var f=0;f<i.length;f+=s){if(i[f]==null)continue;for(var l=0;l<s;++l){var c=i[f+l];if(c==null||!o[l][u])continue;c in n||(n[c]=a,++a),i[f+l]=n[c]}}}function u(e,t,n){s(t,"xaxis",n),s(t,"yaxis",n)}function a(e){e.hooks.processRawData.push(n),e.hooks.processDatapoints.push(u)}var t={xaxis:{categories:null},yaxis:{categories:null}};e.plot.plugins.push({init:a,options:t,name:"categories",version:"1.0"})})(jQuery);
|
||||
89
htdocs/includes/jquery/plugins/flot/jquery.flot.crosshair.js
Executable file → Normal file
89
htdocs/includes/jquery/plugins/flot/jquery.flot.crosshair.js
Executable file → Normal file
@ -1,29 +1,31 @@
|
||||
/*
|
||||
Flot plugin for showing crosshairs, thin lines, when the mouse hovers
|
||||
over the plot.
|
||||
/* Flot plugin for showing crosshairs when the mouse hovers over the plot.
|
||||
|
||||
crosshair: {
|
||||
mode: null or "x" or "y" or "xy"
|
||||
color: color
|
||||
lineWidth: number
|
||||
}
|
||||
Copyright (c) 2007-2013 IOLA and Ole Laursen.
|
||||
Licensed under the MIT license.
|
||||
|
||||
Set the mode to one of "x", "y" or "xy". The "x" mode enables a
|
||||
vertical crosshair that lets you trace the values on the x axis, "y"
|
||||
enables a horizontal crosshair and "xy" enables them both. "color" is
|
||||
the color of the crosshair (default is "rgba(170, 0, 0, 0.80)"),
|
||||
"lineWidth" is the width of the drawn lines (default is 1).
|
||||
The plugin supports these options:
|
||||
|
||||
crosshair: {
|
||||
mode: null or "x" or "y" or "xy"
|
||||
color: color
|
||||
lineWidth: number
|
||||
}
|
||||
|
||||
Set the mode to one of "x", "y" or "xy". The "x" mode enables a vertical
|
||||
crosshair that lets you trace the values on the x axis, "y" enables a
|
||||
horizontal crosshair and "xy" enables them both. "color" is the color of the
|
||||
crosshair (default is "rgba(170, 0, 0, 0.80)"), "lineWidth" is the width of
|
||||
the drawn lines (default is 1).
|
||||
|
||||
The plugin also adds four public methods:
|
||||
|
||||
- setCrosshair(pos)
|
||||
- setCrosshair( pos )
|
||||
|
||||
Set the position of the crosshair. Note that this is cleared if
|
||||
the user moves the mouse. "pos" is in coordinates of the plot and
|
||||
should be on the form { x: xpos, y: ypos } (you can use x2/x3/...
|
||||
if you're using multiple axes), which is coincidentally the same
|
||||
format as what you get from a "plothover" event. If "pos" is null,
|
||||
the crosshair is cleared.
|
||||
Set the position of the crosshair. Note that this is cleared if the user
|
||||
moves the mouse. "pos" is in coordinates of the plot and should be on the
|
||||
form { x: xpos, y: ypos } (you can use x2/x3/... if you're using multiple
|
||||
axes), which is coincidentally the same format as what you get from a
|
||||
"plothover" event. If "pos" is null, the crosshair is cleared.
|
||||
|
||||
- clearCrosshair()
|
||||
|
||||
@ -31,22 +33,25 @@ The plugin also adds four public methods:
|
||||
|
||||
- lockCrosshair(pos)
|
||||
|
||||
Cause the crosshair to lock to the current location, no longer
|
||||
updating if the user moves the mouse. Optionally supply a position
|
||||
(passed on to setCrosshair()) to move it to.
|
||||
Cause the crosshair to lock to the current location, no longer updating if
|
||||
the user moves the mouse. Optionally supply a position (passed on to
|
||||
setCrosshair()) to move it to.
|
||||
|
||||
Example usage:
|
||||
var myFlot = $.plot( $("#graph"), ..., { crosshair: { mode: "x" } } };
|
||||
$("#graph").bind("plothover", function (evt, position, item) {
|
||||
if (item) {
|
||||
// Lock the crosshair to the data point being hovered
|
||||
myFlot.lockCrosshair({ x: item.datapoint[0], y: item.datapoint[1] });
|
||||
}
|
||||
else {
|
||||
// Return normal crosshair operation
|
||||
myFlot.unlockCrosshair();
|
||||
}
|
||||
});
|
||||
|
||||
var myFlot = $.plot( $("#graph"), ..., { crosshair: { mode: "x" } } };
|
||||
$("#graph").bind( "plothover", function ( evt, position, item ) {
|
||||
if ( item ) {
|
||||
// Lock the crosshair to the data point being hovered
|
||||
myFlot.lockCrosshair({
|
||||
x: item.datapoint[ 0 ],
|
||||
y: item.datapoint[ 1 ]
|
||||
});
|
||||
} else {
|
||||
// Return normal crosshair operation
|
||||
myFlot.unlockCrosshair();
|
||||
}
|
||||
});
|
||||
|
||||
- unlockCrosshair()
|
||||
|
||||
@ -84,11 +89,11 @@ The plugin also adds four public methods:
|
||||
if (pos)
|
||||
plot.setCrosshair(pos);
|
||||
crosshair.locked = true;
|
||||
}
|
||||
};
|
||||
|
||||
plot.unlockCrosshair = function unlockCrosshair() {
|
||||
crosshair.locked = false;
|
||||
}
|
||||
};
|
||||
|
||||
function onMouseOut(e) {
|
||||
if (crosshair.locked)
|
||||
@ -134,18 +139,22 @@ The plugin also adds four public methods:
|
||||
ctx.translate(plotOffset.left, plotOffset.top);
|
||||
|
||||
if (crosshair.x != -1) {
|
||||
var adj = plot.getOptions().crosshair.lineWidth % 2 === 0 ? 0 : 0.5;
|
||||
|
||||
ctx.strokeStyle = c.color;
|
||||
ctx.lineWidth = c.lineWidth;
|
||||
ctx.lineJoin = "round";
|
||||
|
||||
ctx.beginPath();
|
||||
if (c.mode.indexOf("x") != -1) {
|
||||
ctx.moveTo(crosshair.x, 0);
|
||||
ctx.lineTo(crosshair.x, plot.height());
|
||||
var drawX = Math.round(crosshair.x) + adj;
|
||||
ctx.moveTo(drawX, 0);
|
||||
ctx.lineTo(drawX, plot.height());
|
||||
}
|
||||
if (c.mode.indexOf("y") != -1) {
|
||||
ctx.moveTo(0, crosshair.y);
|
||||
ctx.lineTo(plot.width(), crosshair.y);
|
||||
var drawY = Math.round(crosshair.y) + adj;
|
||||
ctx.moveTo(0, drawY);
|
||||
ctx.lineTo(plot.width(), drawY);
|
||||
}
|
||||
ctx.stroke();
|
||||
}
|
||||
|
||||
60
htdocs/includes/jquery/plugins/flot/jquery.flot.crosshair.min.js
vendored
Executable file → Normal file
60
htdocs/includes/jquery/plugins/flot/jquery.flot.crosshair.min.js
vendored
Executable file → Normal file
@ -1 +1,59 @@
|
||||
(function(b){var a={crosshair:{mode:null,color:"rgba(170, 0, 0, 0.80)",lineWidth:1}};function c(h){var j={x:-1,y:-1,locked:false};h.setCrosshair=function e(l){if(!l){j.x=-1}else{var k=h.p2c(l);j.x=Math.max(0,Math.min(k.left,h.width()));j.y=Math.max(0,Math.min(k.top,h.height()))}h.triggerRedrawOverlay()};h.clearCrosshair=h.setCrosshair;h.lockCrosshair=function f(k){if(k){h.setCrosshair(k)}j.locked=true};h.unlockCrosshair=function g(){j.locked=false};function d(k){if(j.locked){return}if(j.x!=-1){j.x=-1;h.triggerRedrawOverlay()}}function i(k){if(j.locked){return}if(h.getSelection&&h.getSelection()){j.x=-1;return}var l=h.offset();j.x=Math.max(0,Math.min(k.pageX-l.left,h.width()));j.y=Math.max(0,Math.min(k.pageY-l.top,h.height()));h.triggerRedrawOverlay()}h.hooks.bindEvents.push(function(l,k){if(!l.getOptions().crosshair.mode){return}k.mouseout(d);k.mousemove(i)});h.hooks.drawOverlay.push(function(m,k){var n=m.getOptions().crosshair;if(!n.mode){return}var l=m.getPlotOffset();k.save();k.translate(l.left,l.top);if(j.x!=-1){k.strokeStyle=n.color;k.lineWidth=n.lineWidth;k.lineJoin="round";k.beginPath();if(n.mode.indexOf("x")!=-1){k.moveTo(j.x,0);k.lineTo(j.x,m.height())}if(n.mode.indexOf("y")!=-1){k.moveTo(0,j.y);k.lineTo(m.width(),j.y)}k.stroke()}k.restore()});h.hooks.shutdown.push(function(l,k){k.unbind("mouseout",d);k.unbind("mousemove",i)})}b.plot.plugins.push({init:c,options:a,name:"crosshair",version:"1.0"})})(jQuery);
|
||||
/* Flot plugin for showing crosshairs when the mouse hovers over the plot.
|
||||
|
||||
Copyright (c) 2007-2013 IOLA and Ole Laursen.
|
||||
Licensed under the MIT license.
|
||||
|
||||
The plugin supports these options:
|
||||
|
||||
crosshair: {
|
||||
mode: null or "x" or "y" or "xy"
|
||||
color: color
|
||||
lineWidth: number
|
||||
}
|
||||
|
||||
Set the mode to one of "x", "y" or "xy". The "x" mode enables a vertical
|
||||
crosshair that lets you trace the values on the x axis, "y" enables a
|
||||
horizontal crosshair and "xy" enables them both. "color" is the color of the
|
||||
crosshair (default is "rgba(170, 0, 0, 0.80)"), "lineWidth" is the width of
|
||||
the drawn lines (default is 1).
|
||||
|
||||
The plugin also adds four public methods:
|
||||
|
||||
- setCrosshair( pos )
|
||||
|
||||
Set the position of the crosshair. Note that this is cleared if the user
|
||||
moves the mouse. "pos" is in coordinates of the plot and should be on the
|
||||
form { x: xpos, y: ypos } (you can use x2/x3/... if you're using multiple
|
||||
axes), which is coincidentally the same format as what you get from a
|
||||
"plothover" event. If "pos" is null, the crosshair is cleared.
|
||||
|
||||
- clearCrosshair()
|
||||
|
||||
Clear the crosshair.
|
||||
|
||||
- lockCrosshair(pos)
|
||||
|
||||
Cause the crosshair to lock to the current location, no longer updating if
|
||||
the user moves the mouse. Optionally supply a position (passed on to
|
||||
setCrosshair()) to move it to.
|
||||
|
||||
Example usage:
|
||||
|
||||
var myFlot = $.plot( $("#graph"), ..., { crosshair: { mode: "x" } } };
|
||||
$("#graph").bind( "plothover", function ( evt, position, item ) {
|
||||
if ( item ) {
|
||||
// Lock the crosshair to the data point being hovered
|
||||
myFlot.lockCrosshair({
|
||||
x: item.datapoint[ 0 ],
|
||||
y: item.datapoint[ 1 ]
|
||||
});
|
||||
} else {
|
||||
// Return normal crosshair operation
|
||||
myFlot.unlockCrosshair();
|
||||
}
|
||||
});
|
||||
|
||||
- unlockCrosshair()
|
||||
|
||||
Free the crosshair to move again after locking it.
|
||||
*/(function(e){function n(e){function n(n){if(t.locked)return;t.x!=-1&&(t.x=-1,e.triggerRedrawOverlay())}function r(n){if(t.locked)return;if(e.getSelection&&e.getSelection()){t.x=-1;return}var r=e.offset();t.x=Math.max(0,Math.min(n.pageX-r.left,e.width())),t.y=Math.max(0,Math.min(n.pageY-r.top,e.height())),e.triggerRedrawOverlay()}var t={x:-1,y:-1,locked:!1};e.setCrosshair=function(r){if(!r)t.x=-1;else{var i=e.p2c(r);t.x=Math.max(0,Math.min(i.left,e.width())),t.y=Math.max(0,Math.min(i.top,e.height()))}e.triggerRedrawOverlay()},e.clearCrosshair=e.setCrosshair,e.lockCrosshair=function(r){r&&e.setCrosshair(r),t.locked=!0},e.unlockCrosshair=function(){t.locked=!1},e.hooks.bindEvents.push(function(e,t){if(!e.getOptions().crosshair.mode)return;t.mouseout(n),t.mousemove(r)}),e.hooks.drawOverlay.push(function(e,n){var r=e.getOptions().crosshair;if(!r.mode)return;var i=e.getPlotOffset();n.save(),n.translate(i.left,i.top);if(t.x!=-1){var s=e.getOptions().crosshair.lineWidth%2===0?0:.5;n.strokeStyle=r.color,n.lineWidth=r.lineWidth,n.lineJoin="round",n.beginPath();if(r.mode.indexOf("x")!=-1){var o=Math.round(t.x)+s;n.moveTo(o,0),n.lineTo(o,e.height())}if(r.mode.indexOf("y")!=-1){var u=Math.round(t.y)+s;n.moveTo(0,u),n.lineTo(e.width(),u)}n.stroke()}n.restore()}),e.hooks.shutdown.push(function(e,t){t.unbind("mouseout",n),t.unbind("mousemove",r)})}var t={crosshair:{mode:null,color:"rgba(170, 0, 0, 0.80)",lineWidth:1}};e.plot.plugins.push({init:n,options:t,name:"crosshair",version:"1.0"})})(jQuery);
|
||||
353
htdocs/includes/jquery/plugins/flot/jquery.flot.errorbars.js
Normal file
353
htdocs/includes/jquery/plugins/flot/jquery.flot.errorbars.js
Normal file
@ -0,0 +1,353 @@
|
||||
/* Flot plugin for plotting error bars.
|
||||
|
||||
Copyright (c) 2007-2013 IOLA and Ole Laursen.
|
||||
Licensed under the MIT license.
|
||||
|
||||
Error bars are used to show standard deviation and other statistical
|
||||
properties in a plot.
|
||||
|
||||
* Created by Rui Pereira - rui (dot) pereira (at) gmail (dot) com
|
||||
|
||||
This plugin allows you to plot error-bars over points. Set "errorbars" inside
|
||||
the points series to the axis name over which there will be error values in
|
||||
your data array (*even* if you do not intend to plot them later, by setting
|
||||
"show: null" on xerr/yerr).
|
||||
|
||||
The plugin supports these options:
|
||||
|
||||
series: {
|
||||
points: {
|
||||
errorbars: "x" or "y" or "xy",
|
||||
xerr: {
|
||||
show: null/false or true,
|
||||
asymmetric: null/false or true,
|
||||
upperCap: null or "-" or function,
|
||||
lowerCap: null or "-" or function,
|
||||
color: null or color,
|
||||
radius: null or number
|
||||
},
|
||||
yerr: { same options as xerr }
|
||||
}
|
||||
}
|
||||
|
||||
Each data point array is expected to be of the type:
|
||||
|
||||
"x" [ x, y, xerr ]
|
||||
"y" [ x, y, yerr ]
|
||||
"xy" [ x, y, xerr, yerr ]
|
||||
|
||||
Where xerr becomes xerr_lower,xerr_upper for the asymmetric error case, and
|
||||
equivalently for yerr. Eg., a datapoint for the "xy" case with symmetric
|
||||
error-bars on X and asymmetric on Y would be:
|
||||
|
||||
[ x, y, xerr, yerr_lower, yerr_upper ]
|
||||
|
||||
By default no end caps are drawn. Setting upperCap and/or lowerCap to "-" will
|
||||
draw a small cap perpendicular to the error bar. They can also be set to a
|
||||
user-defined drawing function, with (ctx, x, y, radius) as parameters, as eg.
|
||||
|
||||
function drawSemiCircle( ctx, x, y, radius ) {
|
||||
ctx.beginPath();
|
||||
ctx.arc( x, y, radius, 0, Math.PI, false );
|
||||
ctx.moveTo( x - radius, y );
|
||||
ctx.lineTo( x + radius, y );
|
||||
ctx.stroke();
|
||||
}
|
||||
|
||||
Color and radius both default to the same ones of the points series if not
|
||||
set. The independent radius parameter on xerr/yerr is useful for the case when
|
||||
we may want to add error-bars to a line, without showing the interconnecting
|
||||
points (with radius: 0), and still showing end caps on the error-bars.
|
||||
shadowSize and lineWidth are derived as well from the points series.
|
||||
|
||||
*/
|
||||
|
||||
(function ($) {
|
||||
var options = {
|
||||
series: {
|
||||
points: {
|
||||
errorbars: null, //should be 'x', 'y' or 'xy'
|
||||
xerr: { err: 'x', show: null, asymmetric: null, upperCap: null, lowerCap: null, color: null, radius: null},
|
||||
yerr: { err: 'y', show: null, asymmetric: null, upperCap: null, lowerCap: null, color: null, radius: null}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
function processRawData(plot, series, data, datapoints){
|
||||
if (!series.points.errorbars)
|
||||
return;
|
||||
|
||||
// x,y values
|
||||
var format = [
|
||||
{ x: true, number: true, required: true },
|
||||
{ y: true, number: true, required: true }
|
||||
];
|
||||
|
||||
var errors = series.points.errorbars;
|
||||
// error bars - first X then Y
|
||||
if (errors == 'x' || errors == 'xy') {
|
||||
// lower / upper error
|
||||
if (series.points.xerr.asymmetric) {
|
||||
format.push({ x: true, number: true, required: true });
|
||||
format.push({ x: true, number: true, required: true });
|
||||
} else
|
||||
format.push({ x: true, number: true, required: true });
|
||||
}
|
||||
if (errors == 'y' || errors == 'xy') {
|
||||
// lower / upper error
|
||||
if (series.points.yerr.asymmetric) {
|
||||
format.push({ y: true, number: true, required: true });
|
||||
format.push({ y: true, number: true, required: true });
|
||||
} else
|
||||
format.push({ y: true, number: true, required: true });
|
||||
}
|
||||
datapoints.format = format;
|
||||
}
|
||||
|
||||
function parseErrors(series, i){
|
||||
|
||||
var points = series.datapoints.points;
|
||||
|
||||
// read errors from points array
|
||||
var exl = null,
|
||||
exu = null,
|
||||
eyl = null,
|
||||
eyu = null;
|
||||
var xerr = series.points.xerr,
|
||||
yerr = series.points.yerr;
|
||||
|
||||
var eb = series.points.errorbars;
|
||||
// error bars - first X
|
||||
if (eb == 'x' || eb == 'xy') {
|
||||
if (xerr.asymmetric) {
|
||||
exl = points[i + 2];
|
||||
exu = points[i + 3];
|
||||
if (eb == 'xy')
|
||||
if (yerr.asymmetric){
|
||||
eyl = points[i + 4];
|
||||
eyu = points[i + 5];
|
||||
} else eyl = points[i + 4];
|
||||
} else {
|
||||
exl = points[i + 2];
|
||||
if (eb == 'xy')
|
||||
if (yerr.asymmetric) {
|
||||
eyl = points[i + 3];
|
||||
eyu = points[i + 4];
|
||||
} else eyl = points[i + 3];
|
||||
}
|
||||
// only Y
|
||||
} else if (eb == 'y')
|
||||
if (yerr.asymmetric) {
|
||||
eyl = points[i + 2];
|
||||
eyu = points[i + 3];
|
||||
} else eyl = points[i + 2];
|
||||
|
||||
// symmetric errors?
|
||||
if (exu == null) exu = exl;
|
||||
if (eyu == null) eyu = eyl;
|
||||
|
||||
var errRanges = [exl, exu, eyl, eyu];
|
||||
// nullify if not showing
|
||||
if (!xerr.show){
|
||||
errRanges[0] = null;
|
||||
errRanges[1] = null;
|
||||
}
|
||||
if (!yerr.show){
|
||||
errRanges[2] = null;
|
||||
errRanges[3] = null;
|
||||
}
|
||||
return errRanges;
|
||||
}
|
||||
|
||||
function drawSeriesErrors(plot, ctx, s){
|
||||
|
||||
var points = s.datapoints.points,
|
||||
ps = s.datapoints.pointsize,
|
||||
ax = [s.xaxis, s.yaxis],
|
||||
radius = s.points.radius,
|
||||
err = [s.points.xerr, s.points.yerr];
|
||||
|
||||
//sanity check, in case some inverted axis hack is applied to flot
|
||||
var invertX = false;
|
||||
if (ax[0].p2c(ax[0].max) < ax[0].p2c(ax[0].min)) {
|
||||
invertX = true;
|
||||
var tmp = err[0].lowerCap;
|
||||
err[0].lowerCap = err[0].upperCap;
|
||||
err[0].upperCap = tmp;
|
||||
}
|
||||
|
||||
var invertY = false;
|
||||
if (ax[1].p2c(ax[1].min) < ax[1].p2c(ax[1].max)) {
|
||||
invertY = true;
|
||||
var tmp = err[1].lowerCap;
|
||||
err[1].lowerCap = err[1].upperCap;
|
||||
err[1].upperCap = tmp;
|
||||
}
|
||||
|
||||
for (var i = 0; i < s.datapoints.points.length; i += ps) {
|
||||
|
||||
//parse
|
||||
var errRanges = parseErrors(s, i);
|
||||
|
||||
//cycle xerr & yerr
|
||||
for (var e = 0; e < err.length; e++){
|
||||
|
||||
var minmax = [ax[e].min, ax[e].max];
|
||||
|
||||
//draw this error?
|
||||
if (errRanges[e * err.length]){
|
||||
|
||||
//data coordinates
|
||||
var x = points[i],
|
||||
y = points[i + 1];
|
||||
|
||||
//errorbar ranges
|
||||
var upper = [x, y][e] + errRanges[e * err.length + 1],
|
||||
lower = [x, y][e] - errRanges[e * err.length];
|
||||
|
||||
//points outside of the canvas
|
||||
if (err[e].err == 'x')
|
||||
if (y > ax[1].max || y < ax[1].min || upper < ax[0].min || lower > ax[0].max)
|
||||
continue;
|
||||
if (err[e].err == 'y')
|
||||
if (x > ax[0].max || x < ax[0].min || upper < ax[1].min || lower > ax[1].max)
|
||||
continue;
|
||||
|
||||
// prevent errorbars getting out of the canvas
|
||||
var drawUpper = true,
|
||||
drawLower = true;
|
||||
|
||||
if (upper > minmax[1]) {
|
||||
drawUpper = false;
|
||||
upper = minmax[1];
|
||||
}
|
||||
if (lower < minmax[0]) {
|
||||
drawLower = false;
|
||||
lower = minmax[0];
|
||||
}
|
||||
|
||||
//sanity check, in case some inverted axis hack is applied to flot
|
||||
if ((err[e].err == 'x' && invertX) || (err[e].err == 'y' && invertY)) {
|
||||
//swap coordinates
|
||||
var tmp = lower;
|
||||
lower = upper;
|
||||
upper = tmp;
|
||||
tmp = drawLower;
|
||||
drawLower = drawUpper;
|
||||
drawUpper = tmp;
|
||||
tmp = minmax[0];
|
||||
minmax[0] = minmax[1];
|
||||
minmax[1] = tmp;
|
||||
}
|
||||
|
||||
// convert to pixels
|
||||
x = ax[0].p2c(x),
|
||||
y = ax[1].p2c(y),
|
||||
upper = ax[e].p2c(upper);
|
||||
lower = ax[e].p2c(lower);
|
||||
minmax[0] = ax[e].p2c(minmax[0]);
|
||||
minmax[1] = ax[e].p2c(minmax[1]);
|
||||
|
||||
//same style as points by default
|
||||
var lw = err[e].lineWidth ? err[e].lineWidth : s.points.lineWidth,
|
||||
sw = s.points.shadowSize != null ? s.points.shadowSize : s.shadowSize;
|
||||
|
||||
//shadow as for points
|
||||
if (lw > 0 && sw > 0) {
|
||||
var w = sw / 2;
|
||||
ctx.lineWidth = w;
|
||||
ctx.strokeStyle = "rgba(0,0,0,0.1)";
|
||||
drawError(ctx, err[e], x, y, upper, lower, drawUpper, drawLower, radius, w + w/2, minmax);
|
||||
|
||||
ctx.strokeStyle = "rgba(0,0,0,0.2)";
|
||||
drawError(ctx, err[e], x, y, upper, lower, drawUpper, drawLower, radius, w/2, minmax);
|
||||
}
|
||||
|
||||
ctx.strokeStyle = err[e].color? err[e].color: s.color;
|
||||
ctx.lineWidth = lw;
|
||||
//draw it
|
||||
drawError(ctx, err[e], x, y, upper, lower, drawUpper, drawLower, radius, 0, minmax);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function drawError(ctx,err,x,y,upper,lower,drawUpper,drawLower,radius,offset,minmax){
|
||||
|
||||
//shadow offset
|
||||
y += offset;
|
||||
upper += offset;
|
||||
lower += offset;
|
||||
|
||||
// error bar - avoid plotting over circles
|
||||
if (err.err == 'x'){
|
||||
if (upper > x + radius) drawPath(ctx, [[upper,y],[Math.max(x + radius,minmax[0]),y]]);
|
||||
else drawUpper = false;
|
||||
if (lower < x - radius) drawPath(ctx, [[Math.min(x - radius,minmax[1]),y],[lower,y]] );
|
||||
else drawLower = false;
|
||||
}
|
||||
else {
|
||||
if (upper < y - radius) drawPath(ctx, [[x,upper],[x,Math.min(y - radius,minmax[0])]] );
|
||||
else drawUpper = false;
|
||||
if (lower > y + radius) drawPath(ctx, [[x,Math.max(y + radius,minmax[1])],[x,lower]] );
|
||||
else drawLower = false;
|
||||
}
|
||||
|
||||
//internal radius value in errorbar, allows to plot radius 0 points and still keep proper sized caps
|
||||
//this is a way to get errorbars on lines without visible connecting dots
|
||||
radius = err.radius != null? err.radius: radius;
|
||||
|
||||
// upper cap
|
||||
if (drawUpper) {
|
||||
if (err.upperCap == '-'){
|
||||
if (err.err=='x') drawPath(ctx, [[upper,y - radius],[upper,y + radius]] );
|
||||
else drawPath(ctx, [[x - radius,upper],[x + radius,upper]] );
|
||||
} else if ($.isFunction(err.upperCap)){
|
||||
if (err.err=='x') err.upperCap(ctx, upper, y, radius);
|
||||
else err.upperCap(ctx, x, upper, radius);
|
||||
}
|
||||
}
|
||||
// lower cap
|
||||
if (drawLower) {
|
||||
if (err.lowerCap == '-'){
|
||||
if (err.err=='x') drawPath(ctx, [[lower,y - radius],[lower,y + radius]] );
|
||||
else drawPath(ctx, [[x - radius,lower],[x + radius,lower]] );
|
||||
} else if ($.isFunction(err.lowerCap)){
|
||||
if (err.err=='x') err.lowerCap(ctx, lower, y, radius);
|
||||
else err.lowerCap(ctx, x, lower, radius);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function drawPath(ctx, pts){
|
||||
ctx.beginPath();
|
||||
ctx.moveTo(pts[0][0], pts[0][1]);
|
||||
for (var p=1; p < pts.length; p++)
|
||||
ctx.lineTo(pts[p][0], pts[p][1]);
|
||||
ctx.stroke();
|
||||
}
|
||||
|
||||
function draw(plot, ctx){
|
||||
var plotOffset = plot.getPlotOffset();
|
||||
|
||||
ctx.save();
|
||||
ctx.translate(plotOffset.left, plotOffset.top);
|
||||
$.each(plot.getData(), function (i, s) {
|
||||
if (s.points.errorbars && (s.points.xerr.show || s.points.yerr.show))
|
||||
drawSeriesErrors(plot, ctx, s);
|
||||
});
|
||||
ctx.restore();
|
||||
}
|
||||
|
||||
function init(plot) {
|
||||
plot.hooks.processRawData.push(processRawData);
|
||||
plot.hooks.draw.push(draw);
|
||||
}
|
||||
|
||||
$.plot.plugins.push({
|
||||
init: init,
|
||||
options: options,
|
||||
name: 'errorbars',
|
||||
version: '1.0'
|
||||
});
|
||||
})(jQuery);
|
||||
63
htdocs/includes/jquery/plugins/flot/jquery.flot.errorbars.min.js
vendored
Normal file
63
htdocs/includes/jquery/plugins/flot/jquery.flot.errorbars.min.js
vendored
Normal file
@ -0,0 +1,63 @@
|
||||
/* Flot plugin for plotting error bars.
|
||||
|
||||
Copyright (c) 2007-2013 IOLA and Ole Laursen.
|
||||
Licensed under the MIT license.
|
||||
|
||||
Error bars are used to show standard deviation and other statistical
|
||||
properties in a plot.
|
||||
|
||||
* Created by Rui Pereira - rui (dot) pereira (at) gmail (dot) com
|
||||
|
||||
This plugin allows you to plot error-bars over points. Set "errorbars" inside
|
||||
the points series to the axis name over which there will be error values in
|
||||
your data array (*even* if you do not intend to plot them later, by setting
|
||||
"show: null" on xerr/yerr).
|
||||
|
||||
The plugin supports these options:
|
||||
|
||||
series: {
|
||||
points: {
|
||||
errorbars: "x" or "y" or "xy",
|
||||
xerr: {
|
||||
show: null/false or true,
|
||||
asymmetric: null/false or true,
|
||||
upperCap: null or "-" or function,
|
||||
lowerCap: null or "-" or function,
|
||||
color: null or color,
|
||||
radius: null or number
|
||||
},
|
||||
yerr: { same options as xerr }
|
||||
}
|
||||
}
|
||||
|
||||
Each data point array is expected to be of the type:
|
||||
|
||||
"x" [ x, y, xerr ]
|
||||
"y" [ x, y, yerr ]
|
||||
"xy" [ x, y, xerr, yerr ]
|
||||
|
||||
Where xerr becomes xerr_lower,xerr_upper for the asymmetric error case, and
|
||||
equivalently for yerr. Eg., a datapoint for the "xy" case with symmetric
|
||||
error-bars on X and asymmetric on Y would be:
|
||||
|
||||
[ x, y, xerr, yerr_lower, yerr_upper ]
|
||||
|
||||
By default no end caps are drawn. Setting upperCap and/or lowerCap to "-" will
|
||||
draw a small cap perpendicular to the error bar. They can also be set to a
|
||||
user-defined drawing function, with (ctx, x, y, radius) as parameters, as eg.
|
||||
|
||||
function drawSemiCircle( ctx, x, y, radius ) {
|
||||
ctx.beginPath();
|
||||
ctx.arc( x, y, radius, 0, Math.PI, false );
|
||||
ctx.moveTo( x - radius, y );
|
||||
ctx.lineTo( x + radius, y );
|
||||
ctx.stroke();
|
||||
}
|
||||
|
||||
Color and radius both default to the same ones of the points series if not
|
||||
set. The independent radius parameter on xerr/yerr is useful for the case when
|
||||
we may want to add error-bars to a line, without showing the interconnecting
|
||||
points (with radius: 0), and still showing end caps on the error-bars.
|
||||
shadowSize and lineWidth are derived as well from the points series.
|
||||
|
||||
*/(function(e){function n(e,t,n,r){if(!t.points.errorbars)return;var i=[{x:!0,number:!0,required:!0},{y:!0,number:!0,required:!0}],s=t.points.errorbars;if(s=="x"||s=="xy")t.points.xerr.asymmetric?(i.push({x:!0,number:!0,required:!0}),i.push({x:!0,number:!0,required:!0})):i.push({x:!0,number:!0,required:!0});if(s=="y"||s=="xy")t.points.yerr.asymmetric?(i.push({y:!0,number:!0,required:!0}),i.push({y:!0,number:!0,required:!0})):i.push({y:!0,number:!0,required:!0});r.format=i}function r(e,t){var n=e.datapoints.points,r=null,i=null,s=null,o=null,u=e.points.xerr,a=e.points.yerr,f=e.points.errorbars;f=="x"||f=="xy"?u.asymmetric?(r=n[t+2],i=n[t+3],f=="xy"&&(a.asymmetric?(s=n[t+4],o=n[t+5]):s=n[t+4])):(r=n[t+2],f=="xy"&&(a.asymmetric?(s=n[t+3],o=n[t+4]):s=n[t+3])):f=="y"&&(a.asymmetric?(s=n[t+2],o=n[t+3]):s=n[t+2]),i==null&&(i=r),o==null&&(o=s);var l=[r,i,s,o];return u.show||(l[0]=null,l[1]=null),a.show||(l[2]=null,l[3]=null),l}function i(e,t,n){var i=n.datapoints.points,o=n.datapoints.pointsize,u=[n.xaxis,n.yaxis],a=n.points.radius,f=[n.points.xerr,n.points.yerr],l=!1;if(u[0].p2c(u[0].max)<u[0].p2c(u[0].min)){l=!0;var c=f[0].lowerCap;f[0].lowerCap=f[0].upperCap,f[0].upperCap=c}var h=!1;if(u[1].p2c(u[1].min)<u[1].p2c(u[1].max)){h=!0;var c=f[1].lowerCap;f[1].lowerCap=f[1].upperCap,f[1].upperCap=c}for(var p=0;p<n.datapoints.points.length;p+=o){var d=r(n,p);for(var v=0;v<f.length;v++){var m=[u[v].min,u[v].max];if(d[v*f.length]){var g=i[p],y=i[p+1],b=[g,y][v]+d[v*f.length+1],w=[g,y][v]-d[v*f.length];if(f[v].err=="x")if(y>u[1].max||y<u[1].min||b<u[0].min||w>u[0].max)continue;if(f[v].err=="y")if(g>u[0].max||g<u[0].min||b<u[1].min||w>u[1].max)continue;var E=!0,S=!0;b>m[1]&&(E=!1,b=m[1]),w<m[0]&&(S=!1,w=m[0]);if(f[v].err=="x"&&l||f[v].err=="y"&&h){var c=w;w=b,b=c,c=S,S=E,E=c,c=m[0],m[0]=m[1],m[1]=c}g=u[0].p2c(g),y=u[1].p2c(y),b=u[v].p2c(b),w=u[v].p2c(w),m[0]=u[v].p2c(m[0]),m[1]=u[v].p2c(m[1]);var x=f[v].lineWidth?f[v].lineWidth:n.points.lineWidth,T=n.points.shadowSize!=null?n.points.shadowSize:n.shadowSize;if(x>0&&T>0){var N=T/2;t.lineWidth=N,t.strokeStyle="rgba(0,0,0,0.1)",s(t,f[v],g,y,b,w,E,S,a,N+N/2,m),t.strokeStyle="rgba(0,0,0,0.2)",s(t,f[v],g,y,b,w,E,S,a,N/2,m)}t.strokeStyle=f[v].color?f[v].color:n.color,t.lineWidth=x,s(t,f[v],g,y,b,w,E,S,a,0,m)}}}}function s(t,n,r,i,s,u,a,f,l,c,h){i+=c,s+=c,u+=c,n.err=="x"?(s>r+l?o(t,[[s,i],[Math.max(r+l,h[0]),i]]):a=!1,u<r-l?o(t,[[Math.min(r-l,h[1]),i],[u,i]]):f=!1):(s<i-l?o(t,[[r,s],[r,Math.min(i-l,h[0])]]):a=!1,u>i+l?o(t,[[r,Math.max(i+l,h[1])],[r,u]]):f=!1),l=n.radius!=null?n.radius:l,a&&(n.upperCap=="-"?n.err=="x"?o(t,[[s,i-l],[s,i+l]]):o(t,[[r-l,s],[r+l,s]]):e.isFunction(n.upperCap)&&(n.err=="x"?n.upperCap(t,s,i,l):n.upperCap(t,r,s,l))),f&&(n.lowerCap=="-"?n.err=="x"?o(t,[[u,i-l],[u,i+l]]):o(t,[[r-l,u],[r+l,u]]):e.isFunction(n.lowerCap)&&(n.err=="x"?n.lowerCap(t,u,i,l):n.lowerCap(t,r,u,l)))}function o(e,t){e.beginPath(),e.moveTo(t[0][0],t[0][1]);for(var n=1;n<t.length;n++)e.lineTo(t[n][0],t[n][1]);e.stroke()}function u(t,n){var r=t.getPlotOffset();n.save(),n.translate(r.left,r.top),e.each(t.getData(),function(e,r){r.points.errorbars&&(r.points.xerr.show||r.points.yerr.show)&&i(t,n,r)}),n.restore()}function a(e){e.hooks.processRawData.push(n),e.hooks.draw.push(u)}var t={series:{points:{errorbars:null,xerr:{err:"x",show:null,asymmetric:null,upperCap:null,lowerCap:null,color:null,radius:null},yerr:{err:"y",show:null,asymmetric:null,upperCap:null,lowerCap:null,color:null,radius:null}}}};e.plot.plugins.push({init:a,options:t,name:"errorbars",version:"1.0"})})(jQuery);
|
||||
365
htdocs/includes/jquery/plugins/flot/jquery.flot.fillbetween.js
Executable file → Normal file
365
htdocs/includes/jquery/plugins/flot/jquery.flot.fillbetween.js
Executable file → Normal file
@ -1,183 +1,226 @@
|
||||
/*
|
||||
Flot plugin for computing bottoms for filled line and bar charts.
|
||||
/* Flot plugin for computing bottoms for filled line and bar charts.
|
||||
|
||||
The case: you've got two series that you want to fill the area
|
||||
between. In Flot terms, you need to use one as the fill bottom of the
|
||||
other. You can specify the bottom of each data point as the third
|
||||
coordinate manually, or you can use this plugin to compute it for you.
|
||||
Copyright (c) 2007-2013 IOLA and Ole Laursen.
|
||||
Licensed under the MIT license.
|
||||
|
||||
In order to name the other series, you need to give it an id, like this
|
||||
The case: you've got two series that you want to fill the area between. In Flot
|
||||
terms, you need to use one as the fill bottom of the other. You can specify the
|
||||
bottom of each data point as the third coordinate manually, or you can use this
|
||||
plugin to compute it for you.
|
||||
|
||||
var dataset = [
|
||||
{ data: [ ... ], id: "foo" } , // use default bottom
|
||||
{ data: [ ... ], fillBetween: "foo" }, // use first dataset as bottom
|
||||
];
|
||||
In order to name the other series, you need to give it an id, like this:
|
||||
|
||||
$.plot($("#placeholder"), dataset, { line: { show: true, fill: true }});
|
||||
var dataset = [
|
||||
{ data: [ ... ], id: "foo" } , // use default bottom
|
||||
{ data: [ ... ], fillBetween: "foo" }, // use first dataset as bottom
|
||||
];
|
||||
|
||||
$.plot($("#placeholder"), dataset, { lines: { show: true, fill: true }});
|
||||
|
||||
As a convenience, if the id given is a number that doesn't appear as an id in
|
||||
the series, it is interpreted as the index in the array instead (so fillBetween:
|
||||
0 can also mean the first series).
|
||||
|
||||
Internally, the plugin modifies the datapoints in each series. For line series,
|
||||
extra data points might be inserted through interpolation. Note that at points
|
||||
where the bottom line is not defined (due to a null point or start/end of line),
|
||||
the current line will show a gap too. The algorithm comes from the
|
||||
jquery.flot.stack.js plugin, possibly some code could be shared.
|
||||
|
||||
As a convenience, if the id given is a number that doesn't appear as
|
||||
an id in the series, it is interpreted as the index in the array
|
||||
instead (so fillBetween: 0 can also mean the first series).
|
||||
|
||||
Internally, the plugin modifies the datapoints in each series. For
|
||||
line series, extra data points might be inserted through
|
||||
interpolation. Note that at points where the bottom line is not
|
||||
defined (due to a null point or start/end of line), the current line
|
||||
will show a gap too. The algorithm comes from the jquery.flot.stack.js
|
||||
plugin, possibly some code could be shared.
|
||||
*/
|
||||
|
||||
(function ($) {
|
||||
var options = {
|
||||
series: { fillBetween: null } // or number
|
||||
};
|
||||
|
||||
function init(plot) {
|
||||
function findBottomSeries(s, allseries) {
|
||||
var i;
|
||||
for (i = 0; i < allseries.length; ++i) {
|
||||
if (allseries[i].id == s.fillBetween)
|
||||
return allseries[i];
|
||||
}
|
||||
(function ( $ ) {
|
||||
|
||||
if (typeof s.fillBetween == "number") {
|
||||
i = s.fillBetween;
|
||||
|
||||
if (i < 0 || i >= allseries.length)
|
||||
return null;
|
||||
var options = {
|
||||
series: {
|
||||
fillBetween: null // or number
|
||||
}
|
||||
};
|
||||
|
||||
return allseries[i];
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
function computeFillBottoms(plot, s, datapoints) {
|
||||
if (s.fillBetween == null)
|
||||
return;
|
||||
function init( plot ) {
|
||||
|
||||
var other = findBottomSeries(s, plot.getData());
|
||||
if (!other)
|
||||
return;
|
||||
function findBottomSeries( s, allseries ) {
|
||||
|
||||
var ps = datapoints.pointsize,
|
||||
points = datapoints.points,
|
||||
otherps = other.datapoints.pointsize,
|
||||
otherpoints = other.datapoints.points,
|
||||
newpoints = [],
|
||||
px, py, intery, qx, qy, bottom,
|
||||
withlines = s.lines.show,
|
||||
withbottom = ps > 2 && datapoints.format[2].y,
|
||||
withsteps = withlines && s.lines.steps,
|
||||
fromgap = true,
|
||||
i = 0, j = 0, l;
|
||||
var i;
|
||||
|
||||
while (true) {
|
||||
if (i >= points.length)
|
||||
break;
|
||||
for ( i = 0; i < allseries.length; ++i ) {
|
||||
if ( allseries[ i ].id === s.fillBetween ) {
|
||||
return allseries[ i ];
|
||||
}
|
||||
}
|
||||
|
||||
l = newpoints.length;
|
||||
if ( typeof s.fillBetween === "number" ) {
|
||||
if ( s.fillBetween < 0 || s.fillBetween >= allseries.length ) {
|
||||
return null;
|
||||
}
|
||||
return allseries[ s.fillBetween ];
|
||||
}
|
||||
|
||||
if (points[i] == null) {
|
||||
// copy gaps
|
||||
for (m = 0; m < ps; ++m)
|
||||
newpoints.push(points[i + m]);
|
||||
i += ps;
|
||||
}
|
||||
else if (j >= otherpoints.length) {
|
||||
// for lines, we can't use the rest of the points
|
||||
if (!withlines) {
|
||||
for (m = 0; m < ps; ++m)
|
||||
newpoints.push(points[i + m]);
|
||||
}
|
||||
i += ps;
|
||||
}
|
||||
else if (otherpoints[j] == null) {
|
||||
// oops, got a gap
|
||||
for (m = 0; m < ps; ++m)
|
||||
newpoints.push(null);
|
||||
fromgap = true;
|
||||
j += otherps;
|
||||
}
|
||||
else {
|
||||
// cases where we actually got two points
|
||||
px = points[i];
|
||||
py = points[i + 1];
|
||||
qx = otherpoints[j];
|
||||
qy = otherpoints[j + 1];
|
||||
bottom = 0;
|
||||
return null;
|
||||
}
|
||||
|
||||
if (px == qx) {
|
||||
for (m = 0; m < ps; ++m)
|
||||
newpoints.push(points[i + m]);
|
||||
function computeFillBottoms( plot, s, datapoints ) {
|
||||
|
||||
//newpoints[l + 1] += qy;
|
||||
bottom = qy;
|
||||
|
||||
i += ps;
|
||||
j += otherps;
|
||||
}
|
||||
else if (px > qx) {
|
||||
// we got past point below, might need to
|
||||
// insert interpolated extra point
|
||||
if (withlines && i > 0 && points[i - ps] != null) {
|
||||
intery = py + (points[i - ps + 1] - py) * (qx - px) / (points[i - ps] - px);
|
||||
newpoints.push(qx);
|
||||
newpoints.push(intery)
|
||||
for (m = 2; m < ps; ++m)
|
||||
newpoints.push(points[i + m]);
|
||||
bottom = qy;
|
||||
}
|
||||
if ( s.fillBetween == null ) {
|
||||
return;
|
||||
}
|
||||
|
||||
j += otherps;
|
||||
}
|
||||
else { // px < qx
|
||||
if (fromgap && withlines) {
|
||||
// if we come from a gap, we just skip this point
|
||||
i += ps;
|
||||
continue;
|
||||
}
|
||||
|
||||
for (m = 0; m < ps; ++m)
|
||||
newpoints.push(points[i + m]);
|
||||
|
||||
// we might be able to interpolate a point below,
|
||||
// this can give us a better y
|
||||
if (withlines && j > 0 && otherpoints[j - otherps] != null)
|
||||
bottom = qy + (otherpoints[j - otherps + 1] - qy) * (px - qx) / (otherpoints[j - otherps] - qx);
|
||||
var other = findBottomSeries( s, plot.getData() );
|
||||
|
||||
//newpoints[l + 1] += bottom;
|
||||
|
||||
i += ps;
|
||||
}
|
||||
if ( !other ) {
|
||||
return;
|
||||
}
|
||||
|
||||
fromgap = false;
|
||||
|
||||
if (l != newpoints.length && withbottom)
|
||||
newpoints[l + 2] = bottom;
|
||||
}
|
||||
var ps = datapoints.pointsize,
|
||||
points = datapoints.points,
|
||||
otherps = other.datapoints.pointsize,
|
||||
otherpoints = other.datapoints.points,
|
||||
newpoints = [],
|
||||
px, py, intery, qx, qy, bottom,
|
||||
withlines = s.lines.show,
|
||||
withbottom = ps > 2 && datapoints.format[2].y,
|
||||
withsteps = withlines && s.lines.steps,
|
||||
fromgap = true,
|
||||
i = 0,
|
||||
j = 0,
|
||||
l, m;
|
||||
|
||||
// maintain the line steps invariant
|
||||
if (withsteps && l != newpoints.length && l > 0
|
||||
&& newpoints[l] != null
|
||||
&& newpoints[l] != newpoints[l - ps]
|
||||
&& newpoints[l + 1] != newpoints[l - ps + 1]) {
|
||||
for (m = 0; m < ps; ++m)
|
||||
newpoints[l + ps + m] = newpoints[l + m];
|
||||
newpoints[l + 1] = newpoints[l - ps + 1];
|
||||
}
|
||||
}
|
||||
while ( true ) {
|
||||
|
||||
if ( i >= points.length ) {
|
||||
break;
|
||||
}
|
||||
|
||||
l = newpoints.length;
|
||||
|
||||
if ( points[ i ] == null ) {
|
||||
|
||||
// copy gaps
|
||||
|
||||
for ( m = 0; m < ps; ++m ) {
|
||||
newpoints.push( points[ i + m ] );
|
||||
}
|
||||
|
||||
i += ps;
|
||||
|
||||
} else if ( j >= otherpoints.length ) {
|
||||
|
||||
// for lines, we can't use the rest of the points
|
||||
|
||||
if ( !withlines ) {
|
||||
for ( m = 0; m < ps; ++m ) {
|
||||
newpoints.push( points[ i + m ] );
|
||||
}
|
||||
}
|
||||
|
||||
i += ps;
|
||||
|
||||
} else if ( otherpoints[ j ] == null ) {
|
||||
|
||||
// oops, got a gap
|
||||
|
||||
for ( m = 0; m < ps; ++m ) {
|
||||
newpoints.push( null );
|
||||
}
|
||||
|
||||
fromgap = true;
|
||||
j += otherps;
|
||||
|
||||
} else {
|
||||
|
||||
// cases where we actually got two points
|
||||
|
||||
px = points[ i ];
|
||||
py = points[ i + 1 ];
|
||||
qx = otherpoints[ j ];
|
||||
qy = otherpoints[ j + 1 ];
|
||||
bottom = 0;
|
||||
|
||||
if ( px === qx ) {
|
||||
|
||||
for ( m = 0; m < ps; ++m ) {
|
||||
newpoints.push( points[ i + m ] );
|
||||
}
|
||||
|
||||
//newpoints[ l + 1 ] += qy;
|
||||
bottom = qy;
|
||||
|
||||
i += ps;
|
||||
j += otherps;
|
||||
|
||||
} else if ( px > qx ) {
|
||||
|
||||
// we got past point below, might need to
|
||||
// insert interpolated extra point
|
||||
|
||||
if ( withlines && i > 0 && points[ i - ps ] != null ) {
|
||||
intery = py + ( points[ i - ps + 1 ] - py ) * ( qx - px ) / ( points[ i - ps ] - px );
|
||||
newpoints.push( qx );
|
||||
newpoints.push( intery );
|
||||
for ( m = 2; m < ps; ++m ) {
|
||||
newpoints.push( points[ i + m ] );
|
||||
}
|
||||
bottom = qy;
|
||||
}
|
||||
|
||||
j += otherps;
|
||||
|
||||
} else { // px < qx
|
||||
|
||||
// if we come from a gap, we just skip this point
|
||||
|
||||
if ( fromgap && withlines ) {
|
||||
i += ps;
|
||||
continue;
|
||||
}
|
||||
|
||||
for ( m = 0; m < ps; ++m ) {
|
||||
newpoints.push( points[ i + m ] );
|
||||
}
|
||||
|
||||
// we might be able to interpolate a point below,
|
||||
// this can give us a better y
|
||||
|
||||
if ( withlines && j > 0 && otherpoints[ j - otherps ] != null ) {
|
||||
bottom = qy + ( otherpoints[ j - otherps + 1 ] - qy ) * ( px - qx ) / ( otherpoints[ j - otherps ] - qx );
|
||||
}
|
||||
|
||||
//newpoints[l + 1] += bottom;
|
||||
|
||||
i += ps;
|
||||
}
|
||||
|
||||
fromgap = false;
|
||||
|
||||
if ( l !== newpoints.length && withbottom ) {
|
||||
newpoints[ l + 2 ] = bottom;
|
||||
}
|
||||
}
|
||||
|
||||
// maintain the line steps invariant
|
||||
|
||||
if ( withsteps && l !== newpoints.length && l > 0 &&
|
||||
newpoints[ l ] !== null &&
|
||||
newpoints[ l ] !== newpoints[ l - ps ] &&
|
||||
newpoints[ l + 1 ] !== newpoints[ l - ps + 1 ] ) {
|
||||
for (m = 0; m < ps; ++m) {
|
||||
newpoints[ l + ps + m ] = newpoints[ l + m ];
|
||||
}
|
||||
newpoints[ l + 1 ] = newpoints[ l - ps + 1 ];
|
||||
}
|
||||
}
|
||||
|
||||
datapoints.points = newpoints;
|
||||
}
|
||||
|
||||
plot.hooks.processDatapoints.push( computeFillBottoms );
|
||||
}
|
||||
|
||||
$.plot.plugins.push({
|
||||
init: init,
|
||||
options: options,
|
||||
name: "fillbetween",
|
||||
version: "1.0"
|
||||
});
|
||||
|
||||
datapoints.points = newpoints;
|
||||
}
|
||||
|
||||
plot.hooks.processDatapoints.push(computeFillBottoms);
|
||||
}
|
||||
|
||||
$.plot.plugins.push({
|
||||
init: init,
|
||||
options: options,
|
||||
name: 'fillbetween',
|
||||
version: '1.0'
|
||||
});
|
||||
})(jQuery);
|
||||
|
||||
31
htdocs/includes/jquery/plugins/flot/jquery.flot.fillbetween.min.js
vendored
Executable file → Normal file
31
htdocs/includes/jquery/plugins/flot/jquery.flot.fillbetween.min.js
vendored
Executable file → Normal file
@ -1 +1,30 @@
|
||||
(function(b){var a={series:{fillBetween:null}};function c(f){function d(j,h){var g;for(g=0;g<h.length;++g){if(h[g].id==j.fillBetween){return h[g]}}if(typeof j.fillBetween=="number"){g=j.fillBetween;if(g<0||g>=h.length){return null}return h[g]}return null}function e(B,u,g){if(u.fillBetween==null){return}var p=d(u,B.getData());if(!p){return}var y=g.pointsize,E=g.points,h=p.datapoints.pointsize,x=p.datapoints.points,r=[],w,v,k,G,F,q,t=u.lines.show,o=y>2&&g.format[2].y,n=t&&u.lines.steps,D=true,C=0,A=0,z;while(true){if(C>=E.length){break}z=r.length;if(E[C]==null){for(m=0;m<y;++m){r.push(E[C+m])}C+=y}else{if(A>=x.length){if(!t){for(m=0;m<y;++m){r.push(E[C+m])}}C+=y}else{if(x[A]==null){for(m=0;m<y;++m){r.push(null)}D=true;A+=h}else{w=E[C];v=E[C+1];G=x[A];F=x[A+1];q=0;if(w==G){for(m=0;m<y;++m){r.push(E[C+m])}q=F;C+=y;A+=h}else{if(w>G){if(t&&C>0&&E[C-y]!=null){k=v+(E[C-y+1]-v)*(G-w)/(E[C-y]-w);r.push(G);r.push(k);for(m=2;m<y;++m){r.push(E[C+m])}q=F}A+=h}else{if(D&&t){C+=y;continue}for(m=0;m<y;++m){r.push(E[C+m])}if(t&&A>0&&x[A-h]!=null){q=F+(x[A-h+1]-F)*(w-G)/(x[A-h]-G)}C+=y}}D=false;if(z!=r.length&&o){r[z+2]=q}}}}if(n&&z!=r.length&&z>0&&r[z]!=null&&r[z]!=r[z-y]&&r[z+1]!=r[z-y+1]){for(m=0;m<y;++m){r[z+y+m]=r[z+m]}r[z+1]=r[z-y+1]}}g.points=r}f.hooks.processDatapoints.push(e)}b.plot.plugins.push({init:c,options:a,name:"fillbetween",version:"1.0"})})(jQuery);
|
||||
/* Flot plugin for computing bottoms for filled line and bar charts.
|
||||
|
||||
Copyright (c) 2007-2013 IOLA and Ole Laursen.
|
||||
Licensed under the MIT license.
|
||||
|
||||
The case: you've got two series that you want to fill the area between. In Flot
|
||||
terms, you need to use one as the fill bottom of the other. You can specify the
|
||||
bottom of each data point as the third coordinate manually, or you can use this
|
||||
plugin to compute it for you.
|
||||
|
||||
In order to name the other series, you need to give it an id, like this:
|
||||
|
||||
var dataset = [
|
||||
{ data: [ ... ], id: "foo" } , // use default bottom
|
||||
{ data: [ ... ], fillBetween: "foo" }, // use first dataset as bottom
|
||||
];
|
||||
|
||||
$.plot($("#placeholder"), dataset, { lines: { show: true, fill: true }});
|
||||
|
||||
As a convenience, if the id given is a number that doesn't appear as an id in
|
||||
the series, it is interpreted as the index in the array instead (so fillBetween:
|
||||
0 can also mean the first series).
|
||||
|
||||
Internally, the plugin modifies the datapoints in each series. For line series,
|
||||
extra data points might be inserted through interpolation. Note that at points
|
||||
where the bottom line is not defined (due to a null point or start/end of line),
|
||||
the current line will show a gap too. The algorithm comes from the
|
||||
jquery.flot.stack.js plugin, possibly some code could be shared.
|
||||
|
||||
*/(function(e){function n(e){function t(e,t){var n;for(n=0;n<t.length;++n)if(t[n].id===e.fillBetween)return t[n];return typeof e.fillBetween=="number"?e.fillBetween<0||e.fillBetween>=t.length?null:t[e.fillBetween]:null}function n(e,n,r){if(n.fillBetween==null)return;var i=t(n,e.getData());if(!i)return;var s=r.pointsize,o=r.points,u=i.datapoints.pointsize,a=i.datapoints.points,f=[],l,c,h,p,d,v,m=n.lines.show,g=s>2&&r.format[2].y,y=m&&n.lines.steps,b=!0,w=0,E=0,S,x;for(;;){if(w>=o.length)break;S=f.length;if(o[w]==null){for(x=0;x<s;++x)f.push(o[w+x]);w+=s}else if(E>=a.length){if(!m)for(x=0;x<s;++x)f.push(o[w+x]);w+=s}else if(a[E]==null){for(x=0;x<s;++x)f.push(null);b=!0,E+=u}else{l=o[w],c=o[w+1],p=a[E],d=a[E+1],v=0;if(l===p){for(x=0;x<s;++x)f.push(o[w+x]);v=d,w+=s,E+=u}else if(l>p){if(m&&w>0&&o[w-s]!=null){h=c+(o[w-s+1]-c)*(p-l)/(o[w-s]-l),f.push(p),f.push(h);for(x=2;x<s;++x)f.push(o[w+x]);v=d}E+=u}else{if(b&&m){w+=s;continue}for(x=0;x<s;++x)f.push(o[w+x]);m&&E>0&&a[E-u]!=null&&(v=d+(a[E-u+1]-d)*(l-p)/(a[E-u]-p)),w+=s}b=!1,S!==f.length&&g&&(f[S+2]=v)}if(y&&S!==f.length&&S>0&&f[S]!==null&&f[S]!==f[S-s]&&f[S+1]!==f[S-s+1]){for(x=0;x<s;++x)f[S+s+x]=f[S+x];f[S+1]=f[S-s+1]}}r.points=f}e.hooks.processDatapoints.push(n)}var t={series:{fillBetween:null}};e.plot.plugins.push({init:n,options:t,name:"fillbetween",version:"1.0"})})(jQuery);
|
||||
79
htdocs/includes/jquery/plugins/flot/jquery.flot.image.js
Executable file → Normal file
79
htdocs/includes/jquery/plugins/flot/jquery.flot.image.js
Executable file → Normal file
@ -1,51 +1,54 @@
|
||||
/*
|
||||
Flot plugin for plotting images, e.g. useful for putting ticks on a
|
||||
prerendered complex visualization.
|
||||
/* Flot plugin for plotting images.
|
||||
|
||||
The data syntax is [[image, x1, y1, x2, y2], ...] where (x1, y1) and
|
||||
(x2, y2) are where you intend the two opposite corners of the image to
|
||||
end up in the plot. Image must be a fully loaded Javascript image (you
|
||||
can make one with new Image()). If the image is not complete, it's
|
||||
skipped when plotting.
|
||||
Copyright (c) 2007-2013 IOLA and Ole Laursen.
|
||||
Licensed under the MIT license.
|
||||
|
||||
There are two helpers included for retrieving images. The easiest work
|
||||
the way that you put in URLs instead of images in the data (like
|
||||
["myimage.png", 0, 0, 10, 10]), then call $.plot.image.loadData(data,
|
||||
options, callback) where data and options are the same as you pass in
|
||||
to $.plot. This loads the images, replaces the URLs in the data with
|
||||
the corresponding images and calls "callback" when all images are
|
||||
loaded (or failed loading). In the callback, you can then call $.plot
|
||||
with the data set. See the included example.
|
||||
The data syntax is [ [ image, x1, y1, x2, y2 ], ... ] where (x1, y1) and
|
||||
(x2, y2) are where you intend the two opposite corners of the image to end up
|
||||
in the plot. Image must be a fully loaded Javascript image (you can make one
|
||||
with new Image()). If the image is not complete, it's skipped when plotting.
|
||||
|
||||
A more low-level helper, $.plot.image.load(urls, callback) is also
|
||||
included. Given a list of URLs, it calls callback with an object
|
||||
mapping from URL to Image object when all images are loaded or have
|
||||
failed loading.
|
||||
There are two helpers included for retrieving images. The easiest work the way
|
||||
that you put in URLs instead of images in the data, like this:
|
||||
|
||||
Options for the plugin are
|
||||
[ "myimage.png", 0, 0, 10, 10 ]
|
||||
|
||||
series: {
|
||||
images: {
|
||||
show: boolean
|
||||
anchor: "corner" or "center"
|
||||
alpha: [0,1]
|
||||
}
|
||||
}
|
||||
Then call $.plot.image.loadData( data, options, callback ) where data and
|
||||
options are the same as you pass in to $.plot. This loads the images, replaces
|
||||
the URLs in the data with the corresponding images and calls "callback" when
|
||||
all images are loaded (or failed loading). In the callback, you can then call
|
||||
$.plot with the data set. See the included example.
|
||||
|
||||
which can be specified for a specific series
|
||||
A more low-level helper, $.plot.image.load(urls, callback) is also included.
|
||||
Given a list of URLs, it calls callback with an object mapping from URL to
|
||||
Image object when all images are loaded or have failed loading.
|
||||
|
||||
$.plot($("#placeholder"), [{ data: [ ... ], images: { ... } ])
|
||||
The plugin supports these options:
|
||||
|
||||
Note that because the data format is different from usual data points,
|
||||
you can't use images with anything else in a specific data series.
|
||||
series: {
|
||||
images: {
|
||||
show: boolean
|
||||
anchor: "corner" or "center"
|
||||
alpha: [ 0, 1 ]
|
||||
}
|
||||
}
|
||||
|
||||
Setting "anchor" to "center" causes the pixels in the image to be
|
||||
anchored at the corner pixel centers inside of at the pixel corners,
|
||||
effectively letting half a pixel stick out to each side in the plot.
|
||||
They can be specified for a specific series:
|
||||
|
||||
$.plot( $("#placeholder"), [{
|
||||
data: [ ... ],
|
||||
images: { ... }
|
||||
])
|
||||
|
||||
A possible future direction could be support for tiling for large
|
||||
images (like Google Maps).
|
||||
Note that because the data format is different from usual data points, you
|
||||
can't use images with anything else in a specific data series.
|
||||
|
||||
Setting "anchor" to "center" causes the pixels in the image to be anchored at
|
||||
the corner pixel centers inside of at the pixel corners, effectively letting
|
||||
half a pixel stick out to each side in the plot.
|
||||
|
||||
A possible future direction could be support for tiling for large images (like
|
||||
Google Maps).
|
||||
|
||||
*/
|
||||
|
||||
@ -110,7 +113,7 @@ images (like Google Maps).
|
||||
|
||||
$('<img />').load(handler).error(handler).attr('src', url);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
function drawSeries(plot, ctx, series) {
|
||||
var plotOffset = plot.getPlotOffset();
|
||||
|
||||
54
htdocs/includes/jquery/plugins/flot/jquery.flot.image.min.js
vendored
Executable file → Normal file
54
htdocs/includes/jquery/plugins/flot/jquery.flot.image.min.js
vendored
Executable file → Normal file
@ -1 +1,53 @@
|
||||
(function(c){var a={series:{images:{show:false,alpha:1,anchor:"corner"}}};c.plot.image={};c.plot.image.loadDataImages=function(g,f,k){var j=[],h=[];var i=f.series.images.show;c.each(g,function(l,m){if(!(i||m.images.show)){return}if(m.data){m=m.data}c.each(m,function(n,o){if(typeof o[0]=="string"){j.push(o[0]);h.push(o)}})});c.plot.image.load(j,function(l){c.each(h,function(n,o){var m=o[0];if(l[m]){o[0]=l[m]}});k()})};c.plot.image.load=function(h,i){var g=h.length,f={};if(g==0){i({})}c.each(h,function(k,j){var l=function(){--g;f[j]=this;if(g==0){i(f)}};c("<img />").load(l).error(l).attr("src",j)})};function d(q,o,l){var m=q.getPlotOffset();if(!l.images||!l.images.show){return}var r=l.datapoints.points,n=l.datapoints.pointsize;for(var t=0;t<r.length;t+=n){var y=r[t],w=r[t+1],g=r[t+2],v=r[t+3],f=r[t+4],h=l.xaxis,u=l.yaxis,x;if(!y||y.width<=0||y.height<=0){continue}if(w>v){x=v;v=w;w=x}if(g>f){x=f;f=g;g=x}if(l.images.anchor=="center"){x=0.5*(v-w)/(y.width-1);w-=x;v+=x;x=0.5*(f-g)/(y.height-1);g-=x;f+=x}if(w==v||g==f||w>=h.max||v<=h.min||g>=u.max||f<=u.min){continue}var k=0,s=0,j=y.width,p=y.height;if(w<h.min){k+=(j-k)*(h.min-w)/(v-w);w=h.min}if(v>h.max){j+=(j-k)*(h.max-v)/(v-w);v=h.max}if(g<u.min){p+=(s-p)*(u.min-g)/(f-g);g=u.min}if(f>u.max){s+=(s-p)*(u.max-f)/(f-g);f=u.max}w=h.p2c(w);v=h.p2c(v);g=u.p2c(g);f=u.p2c(f);if(w>v){x=v;v=w;w=x}if(g>f){x=f;f=g;g=x}x=o.globalAlpha;o.globalAlpha*=l.images.alpha;o.drawImage(y,k,s,j-k,p-s,w+m.left,g+m.top,v-w,f-g);o.globalAlpha=x}}function b(i,f,g,h){if(!f.images.show){return}h.format=[{required:true},{x:true,number:true,required:true},{y:true,number:true,required:true},{x:true,number:true,required:true},{y:true,number:true,required:true}]}function e(f){f.hooks.processRawData.push(b);f.hooks.drawSeries.push(d)}c.plot.plugins.push({init:e,options:a,name:"image",version:"1.1"})})(jQuery);
|
||||
/* Flot plugin for plotting images.
|
||||
|
||||
Copyright (c) 2007-2013 IOLA and Ole Laursen.
|
||||
Licensed under the MIT license.
|
||||
|
||||
The data syntax is [ [ image, x1, y1, x2, y2 ], ... ] where (x1, y1) and
|
||||
(x2, y2) are where you intend the two opposite corners of the image to end up
|
||||
in the plot. Image must be a fully loaded Javascript image (you can make one
|
||||
with new Image()). If the image is not complete, it's skipped when plotting.
|
||||
|
||||
There are two helpers included for retrieving images. The easiest work the way
|
||||
that you put in URLs instead of images in the data, like this:
|
||||
|
||||
[ "myimage.png", 0, 0, 10, 10 ]
|
||||
|
||||
Then call $.plot.image.loadData( data, options, callback ) where data and
|
||||
options are the same as you pass in to $.plot. This loads the images, replaces
|
||||
the URLs in the data with the corresponding images and calls "callback" when
|
||||
all images are loaded (or failed loading). In the callback, you can then call
|
||||
$.plot with the data set. See the included example.
|
||||
|
||||
A more low-level helper, $.plot.image.load(urls, callback) is also included.
|
||||
Given a list of URLs, it calls callback with an object mapping from URL to
|
||||
Image object when all images are loaded or have failed loading.
|
||||
|
||||
The plugin supports these options:
|
||||
|
||||
series: {
|
||||
images: {
|
||||
show: boolean
|
||||
anchor: "corner" or "center"
|
||||
alpha: [ 0, 1 ]
|
||||
}
|
||||
}
|
||||
|
||||
They can be specified for a specific series:
|
||||
|
||||
$.plot( $("#placeholder"), [{
|
||||
data: [ ... ],
|
||||
images: { ... }
|
||||
])
|
||||
|
||||
Note that because the data format is different from usual data points, you
|
||||
can't use images with anything else in a specific data series.
|
||||
|
||||
Setting "anchor" to "center" causes the pixels in the image to be anchored at
|
||||
the corner pixel centers inside of at the pixel corners, effectively letting
|
||||
half a pixel stick out to each side in the plot.
|
||||
|
||||
A possible future direction could be support for tiling for large images (like
|
||||
Google Maps).
|
||||
|
||||
*/(function(e){function n(e,t,n){var r=e.getPlotOffset();if(!n.images||!n.images.show)return;var i=n.datapoints.points,s=n.datapoints.pointsize;for(var o=0;o<i.length;o+=s){var u=i[o],a=i[o+1],f=i[o+2],l=i[o+3],c=i[o+4],h=n.xaxis,p=n.yaxis,d;if(!u||u.width<=0||u.height<=0)continue;a>l&&(d=l,l=a,a=d),f>c&&(d=c,c=f,f=d),n.images.anchor=="center"&&(d=.5*(l-a)/(u.width-1),a-=d,l+=d,d=.5*(c-f)/(u.height-1),f-=d,c+=d);if(a==l||f==c||a>=h.max||l<=h.min||f>=p.max||c<=p.min)continue;var v=0,m=0,g=u.width,y=u.height;a<h.min&&(v+=(g-v)*(h.min-a)/(l-a),a=h.min),l>h.max&&(g+=(g-v)*(h.max-l)/(l-a),l=h.max),f<p.min&&(y+=(m-y)*(p.min-f)/(c-f),f=p.min),c>p.max&&(m+=(m-y)*(p.max-c)/(c-f),c=p.max),a=h.p2c(a),l=h.p2c(l),f=p.p2c(f),c=p.p2c(c),a>l&&(d=l,l=a,a=d),f>c&&(d=c,c=f,f=d),d=t.globalAlpha,t.globalAlpha*=n.images.alpha,t.drawImage(u,v,m,g-v,y-m,a+r.left,f+r.top,l-a,c-f),t.globalAlpha=d}}function r(e,t,n,r){if(!t.images.show)return;r.format=[{required:!0},{x:!0,number:!0,required:!0},{y:!0,number:!0,required:!0},{x:!0,number:!0,required:!0},{y:!0,number:!0,required:!0}]}function i(e){e.hooks.processRawData.push(r),e.hooks.drawSeries.push(n)}var t={series:{images:{show:!1,alpha:1,anchor:"corner"}}};e.plot.image={},e.plot.image.loadDataImages=function(t,n,r){var i=[],s=[],o=n.series.images.show;e.each(t,function(t,n){if(!o&&!n.images.show)return;n.data&&(n=n.data),e.each(n,function(e,t){typeof t[0]=="string"&&(i.push(t[0]),s.push(t))})}),e.plot.image.load(i,function(t){e.each(s,function(e,n){var r=n[0];t[r]&&(n[0]=t[r])}),r()})},e.plot.image.load=function(t,n){var r=t.length,i={};r==0&&n({}),e.each(t,function(t,s){var o=function(){--r,i[s]=this,r==0&&n(i)};e("<img />").load(o).error(o).attr("src",s)})},e.plot.plugins.push({init:i,options:t,name:"image",version:"1.1"})})(jQuery);
|
||||
1986
htdocs/includes/jquery/plugins/flot/jquery.flot.js
Executable file → Normal file
1986
htdocs/includes/jquery/plugins/flot/jquery.flot.js
Executable file → Normal file
File diff suppressed because it is too large
Load Diff
31
htdocs/includes/jquery/plugins/flot/jquery.flot.min.js
vendored
Executable file → Normal file
31
htdocs/includes/jquery/plugins/flot/jquery.flot.min.js
vendored
Executable file → Normal file
File diff suppressed because one or more lines are too long
168
htdocs/includes/jquery/plugins/flot/jquery.flot.navigate.js
Executable file → Normal file
168
htdocs/includes/jquery/plugins/flot/jquery.flot.navigate.js
Executable file → Normal file
@ -1,108 +1,106 @@
|
||||
/*
|
||||
Flot plugin for adding panning and zooming capabilities to a plot.
|
||||
/* Flot plugin for adding the ability to pan and zoom the plot.
|
||||
|
||||
The default behaviour is double click and scrollwheel up/down to zoom
|
||||
in, drag to pan. The plugin defines plot.zoom({ center }),
|
||||
plot.zoomOut() and plot.pan(offset) so you easily can add custom
|
||||
controls. It also fires a "plotpan" and "plotzoom" event when
|
||||
something happens, useful for synchronizing plots.
|
||||
Copyright (c) 2007-2013 IOLA and Ole Laursen.
|
||||
Licensed under the MIT license.
|
||||
|
||||
Options:
|
||||
The default behaviour is double click and scrollwheel up/down to zoom in, drag
|
||||
to pan. The plugin defines plot.zoom({ center }), plot.zoomOut() and
|
||||
plot.pan( offset ) so you easily can add custom controls. It also fires
|
||||
"plotpan" and "plotzoom" events, useful for synchronizing plots.
|
||||
|
||||
zoom: {
|
||||
interactive: false
|
||||
trigger: "dblclick" // or "click" for single click
|
||||
amount: 1.5 // 2 = 200% (zoom in), 0.5 = 50% (zoom out)
|
||||
}
|
||||
|
||||
pan: {
|
||||
interactive: false
|
||||
cursor: "move" // CSS mouse cursor value used when dragging, e.g. "pointer"
|
||||
frameRate: 20
|
||||
}
|
||||
The plugin supports these options:
|
||||
|
||||
zoom: {
|
||||
interactive: false
|
||||
trigger: "dblclick" // or "click" for single click
|
||||
amount: 1.5 // 2 = 200% (zoom in), 0.5 = 50% (zoom out)
|
||||
}
|
||||
|
||||
pan: {
|
||||
interactive: false
|
||||
cursor: "move" // CSS mouse cursor value used when dragging, e.g. "pointer"
|
||||
frameRate: 20
|
||||
}
|
||||
|
||||
xaxis, yaxis, x2axis, y2axis: {
|
||||
zoomRange: null // or [ number, number ] (min range, max range) or false
|
||||
panRange: null // or [ number, number ] (min, max) or false
|
||||
}
|
||||
|
||||
xaxis, yaxis, x2axis, y2axis: {
|
||||
zoomRange: null // or [number, number] (min range, max range) or false
|
||||
panRange: null // or [number, number] (min, max) or false
|
||||
}
|
||||
|
||||
"interactive" enables the built-in drag/click behaviour. If you enable
|
||||
interactive for pan, then you'll have a basic plot that supports
|
||||
moving around; the same for zoom.
|
||||
interactive for pan, then you'll have a basic plot that supports moving
|
||||
around; the same for zoom.
|
||||
|
||||
"amount" specifies the default amount to zoom in (so 1.5 = 150%)
|
||||
relative to the current viewport.
|
||||
"amount" specifies the default amount to zoom in (so 1.5 = 150%) relative to
|
||||
the current viewport.
|
||||
|
||||
"cursor" is a standard CSS mouse cursor string used for visual
|
||||
feedback to the user when dragging.
|
||||
"cursor" is a standard CSS mouse cursor string used for visual feedback to the
|
||||
user when dragging.
|
||||
|
||||
"frameRate" specifies the maximum number of times per second the plot
|
||||
will update itself while the user is panning around on it (set to null
|
||||
to disable intermediate pans, the plot will then not update until the
|
||||
mouse button is released).
|
||||
"frameRate" specifies the maximum number of times per second the plot will
|
||||
update itself while the user is panning around on it (set to null to disable
|
||||
intermediate pans, the plot will then not update until the mouse button is
|
||||
released).
|
||||
|
||||
"zoomRange" is the interval in which zooming can happen, e.g. with
|
||||
zoomRange: [1, 100] the zoom will never scale the axis so that the
|
||||
difference between min and max is smaller than 1 or larger than 100.
|
||||
You can set either end to null to ignore, e.g. [1, null]. If you set
|
||||
zoomRange to false, zooming on that axis will be disabled.
|
||||
"zoomRange" is the interval in which zooming can happen, e.g. with zoomRange:
|
||||
[1, 100] the zoom will never scale the axis so that the difference between min
|
||||
and max is smaller than 1 or larger than 100. You can set either end to null
|
||||
to ignore, e.g. [1, null]. If you set zoomRange to false, zooming on that axis
|
||||
will be disabled.
|
||||
|
||||
"panRange" confines the panning to stay within a range, e.g. with
|
||||
panRange: [-10, 20] panning stops at -10 in one end and at 20 in the
|
||||
other. Either can be null, e.g. [-10, null]. If you set
|
||||
panRange to false, panning on that axis will be disabled.
|
||||
"panRange" confines the panning to stay within a range, e.g. with panRange:
|
||||
[-10, 20] panning stops at -10 in one end and at 20 in the other. Either can
|
||||
be null, e.g. [-10, null]. If you set panRange to false, panning on that axis
|
||||
will be disabled.
|
||||
|
||||
Example API usage:
|
||||
|
||||
plot = $.plot(...);
|
||||
|
||||
// zoom default amount in on the pixel (10, 20)
|
||||
plot.zoom({ center: { left: 10, top: 20 } });
|
||||
plot = $.plot(...);
|
||||
|
||||
// zoom out again
|
||||
plot.zoomOut({ center: { left: 10, top: 20 } });
|
||||
// zoom default amount in on the pixel ( 10, 20 )
|
||||
plot.zoom({ center: { left: 10, top: 20 } });
|
||||
|
||||
// zoom 200% in on the pixel (10, 20)
|
||||
plot.zoom({ amount: 2, center: { left: 10, top: 20 } });
|
||||
|
||||
// pan 100 pixels to the left and 20 down
|
||||
plot.pan({ left: -100, top: 20 })
|
||||
// zoom out again
|
||||
plot.zoomOut({ center: { left: 10, top: 20 } });
|
||||
|
||||
Here, "center" specifies where the center of the zooming should
|
||||
happen. Note that this is defined in pixel space, not the space of the
|
||||
data points (you can use the p2c helpers on the axes in Flot to help
|
||||
you convert between these).
|
||||
// zoom 200% in on the pixel (10, 20)
|
||||
plot.zoom({ amount: 2, center: { left: 10, top: 20 } });
|
||||
|
||||
// pan 100 pixels to the left and 20 down
|
||||
plot.pan({ left: -100, top: 20 })
|
||||
|
||||
Here, "center" specifies where the center of the zooming should happen. Note
|
||||
that this is defined in pixel space, not the space of the data points (you can
|
||||
use the p2c helpers on the axes in Flot to help you convert between these).
|
||||
|
||||
"amount" is the amount to zoom the viewport relative to the current range, so
|
||||
1 is 100% (i.e. no change), 1.5 is 150% (zoom in), 0.7 is 70% (zoom out). You
|
||||
can set the default in the options.
|
||||
|
||||
"amount" is the amount to zoom the viewport relative to the current
|
||||
range, so 1 is 100% (i.e. no change), 1.5 is 150% (zoom in), 0.7 is
|
||||
70% (zoom out). You can set the default in the options.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
// First two dependencies, jquery.event.drag.js and
|
||||
// jquery.mousewheel.js, we put them inline here to save people the
|
||||
// effort of downloading them.
|
||||
|
||||
/*
|
||||
jquery.event.drag.js ~ v1.5 ~ Copyright (c) 2008, Three Dub Media (http://threedubmedia.com)
|
||||
jquery.event.drag.js ~ v1.5 ~ Copyright (c) 2008, Three Dub Media (http://threedubmedia.com)
|
||||
Licensed under the MIT License ~ http://threedubmedia.googlecode.com/files/MIT-LICENSE.txt
|
||||
*/
|
||||
(function(E){E.fn.drag=function(L,K,J){if(K){this.bind("dragstart",L)}if(J){this.bind("dragend",J)}return !L?this.trigger("drag"):this.bind("drag",K?K:L)};var A=E.event,B=A.special,F=B.drag={not:":input",distance:0,which:1,dragging:false,setup:function(J){J=E.extend({distance:F.distance,which:F.which,not:F.not},J||{});J.distance=I(J.distance);A.add(this,"mousedown",H,J);if(this.attachEvent){this.attachEvent("ondragstart",D)}},teardown:function(){A.remove(this,"mousedown",H);if(this===F.dragging){F.dragging=F.proxy=false}G(this,true);if(this.detachEvent){this.detachEvent("ondragstart",D)}}};B.dragstart=B.dragend={setup:function(){},teardown:function(){}};function H(L){var K=this,J,M=L.data||{};if(M.elem){K=L.dragTarget=M.elem;L.dragProxy=F.proxy||K;L.cursorOffsetX=M.pageX-M.left;L.cursorOffsetY=M.pageY-M.top;L.offsetX=L.pageX-L.cursorOffsetX;L.offsetY=L.pageY-L.cursorOffsetY}else{if(F.dragging||(M.which>0&&L.which!=M.which)||E(L.target).is(M.not)){return }}switch(L.type){case"mousedown":E.extend(M,E(K).offset(),{elem:K,target:L.target,pageX:L.pageX,pageY:L.pageY});A.add(document,"mousemove mouseup",H,M);G(K,false);F.dragging=null;return false;case !F.dragging&&"mousemove":if(I(L.pageX-M.pageX)+I(L.pageY-M.pageY)<M.distance){break}L.target=M.target;J=C(L,"dragstart",K);if(J!==false){F.dragging=K;F.proxy=L.dragProxy=E(J||K)[0]}case"mousemove":if(F.dragging){J=C(L,"drag",K);if(B.drop){B.drop.allowed=(J!==false);B.drop.handler(L)}if(J!==false){break}L.type="mouseup"}case"mouseup":A.remove(document,"mousemove mouseup",H);if(F.dragging){if(B.drop){B.drop.handler(L)}C(L,"dragend",K)}G(K,true);F.dragging=F.proxy=M.elem=false;break}return true}function C(M,K,L){M.type=K;var J=E.event.handle.call(L,M);return J===false?false:J||M.result}function I(J){return Math.pow(J,2)}function D(){return(F.dragging===false)}function G(K,J){if(!K){return }K.unselectable=J?"off":"on";K.onselectstart=function(){return J};if(K.style){K.style.MozUserSelect=J?"":"none"}}})(jQuery);
|
||||
|
||||
(function(a){function e(h){var k,j=this,l=h.data||{};if(l.elem)j=h.dragTarget=l.elem,h.dragProxy=d.proxy||j,h.cursorOffsetX=l.pageX-l.left,h.cursorOffsetY=l.pageY-l.top,h.offsetX=h.pageX-h.cursorOffsetX,h.offsetY=h.pageY-h.cursorOffsetY;else if(d.dragging||l.which>0&&h.which!=l.which||a(h.target).is(l.not))return;switch(h.type){case"mousedown":return a.extend(l,a(j).offset(),{elem:j,target:h.target,pageX:h.pageX,pageY:h.pageY}),b.add(document,"mousemove mouseup",e,l),i(j,!1),d.dragging=null,!1;case!d.dragging&&"mousemove":if(g(h.pageX-l.pageX)+g(h.pageY-l.pageY)<l.distance)break;h.target=l.target,k=f(h,"dragstart",j),k!==!1&&(d.dragging=j,d.proxy=h.dragProxy=a(k||j)[0]);case"mousemove":if(d.dragging){if(k=f(h,"drag",j),c.drop&&(c.drop.allowed=k!==!1,c.drop.handler(h)),k!==!1)break;h.type="mouseup"}case"mouseup":b.remove(document,"mousemove mouseup",e),d.dragging&&(c.drop&&c.drop.handler(h),f(h,"dragend",j)),i(j,!0),d.dragging=d.proxy=l.elem=!1}return!0}function f(b,c,d){b.type=c;var e=a.event.dispatch.call(d,b);return e===!1?!1:e||b.result}function g(a){return Math.pow(a,2)}function h(){return d.dragging===!1}function i(a,b){a&&(a.unselectable=b?"off":"on",a.onselectstart=function(){return b},a.style&&(a.style.MozUserSelect=b?"":"none"))}a.fn.drag=function(a,b,c){return b&&this.bind("dragstart",a),c&&this.bind("dragend",c),a?this.bind("drag",b?b:a):this.trigger("drag")};var b=a.event,c=b.special,d=c.drag={not:":input",distance:0,which:1,dragging:!1,setup:function(c){c=a.extend({distance:d.distance,which:d.which,not:d.not},c||{}),c.distance=g(c.distance),b.add(this,"mousedown",e,c),this.attachEvent&&this.attachEvent("ondragstart",h)},teardown:function(){b.remove(this,"mousedown",e),this===d.dragging&&(d.dragging=d.proxy=!1),i(this,!0),this.detachEvent&&this.detachEvent("ondragstart",h)}};c.dragstart=c.dragend={setup:function(){},teardown:function(){}}})(jQuery);
|
||||
|
||||
/* jquery.mousewheel.min.js
|
||||
* Copyright (c) 2009 Brandon Aaron (http://brandonaaron.net)
|
||||
* Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php)
|
||||
* and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses.
|
||||
* Copyright (c) 2011 Brandon Aaron (http://brandonaaron.net)
|
||||
* Licensed under the MIT License (LICENSE.txt).
|
||||
* Thanks to: http://adomas.org/javascript-mouse-wheel/ for some pointers.
|
||||
* Thanks to: Mathias Bank(http://www.mathias-bank.de) for a scope bug fix.
|
||||
* Thanks to: Seamus Leahy for adding deltaX and deltaY
|
||||
*
|
||||
* Version: 3.0.6
|
||||
*
|
||||
* Version: 3.0.2
|
||||
*
|
||||
* Requires: 1.2.2+
|
||||
*/
|
||||
(function(c){var a=["DOMMouseScroll","mousewheel"];c.event.special.mousewheel={setup:function(){if(this.addEventListener){for(var d=a.length;d;){this.addEventListener(a[--d],b,false)}}else{this.onmousewheel=b}},teardown:function(){if(this.removeEventListener){for(var d=a.length;d;){this.removeEventListener(a[--d],b,false)}}else{this.onmousewheel=null}}};c.fn.extend({mousewheel:function(d){return d?this.bind("mousewheel",d):this.trigger("mousewheel")},unmousewheel:function(d){return this.unbind("mousewheel",d)}});function b(f){var d=[].slice.call(arguments,1),g=0,e=true;f=c.event.fix(f||window.event);f.type="mousewheel";if(f.wheelDelta){g=f.wheelDelta/120}if(f.detail){g=-f.detail/3}d.unshift(f,g);return c.event.handle.apply(this,d)}})(jQuery);
|
||||
(function(d){function e(a){var b=a||window.event,c=[].slice.call(arguments,1),f=0,e=0,g=0,a=d.event.fix(b);a.type="mousewheel";b.wheelDelta&&(f=b.wheelDelta/120);b.detail&&(f=-b.detail/3);g=f;void 0!==b.axis&&b.axis===b.HORIZONTAL_AXIS&&(g=0,e=-1*f);void 0!==b.wheelDeltaY&&(g=b.wheelDeltaY/120);void 0!==b.wheelDeltaX&&(e=-1*b.wheelDeltaX/120);c.unshift(a,f,e,g);return(d.event.dispatch||d.event.handle).apply(this,c)}var c=["DOMMouseScroll","mousewheel"];if(d.event.fixHooks)for(var h=c.length;h;)d.event.fixHooks[c[--h]]=d.event.mouseHooks;d.event.special.mousewheel={setup:function(){if(this.addEventListener)for(var a=c.length;a;)this.addEventListener(c[--a],e,!1);else this.onmousewheel=e},teardown:function(){if(this.removeEventListener)for(var a=c.length;a;)this.removeEventListener(c[--a],e,!1);else this.onmousewheel=null}};d.fn.extend({mousewheel:function(a){return a?this.bind("mousewheel",a):this.trigger("mousewheel")},unmousewheel:function(a){return this.unbind("mousewheel",a)}})})(jQuery);
|
||||
|
||||
|
||||
|
||||
@ -137,6 +135,7 @@ Licensed under the MIT License ~ http://threedubmedia.googlecode.com/files/MIT-L
|
||||
}
|
||||
|
||||
function onMouseWheel(e, delta) {
|
||||
e.preventDefault();
|
||||
onZoomClick(e, delta < 0);
|
||||
return false;
|
||||
}
|
||||
@ -200,11 +199,11 @@ Licensed under the MIT License ~ http://threedubmedia.googlecode.com/files/MIT-L
|
||||
args = {};
|
||||
|
||||
if (!args.amount)
|
||||
args.amount = plot.getOptions().zoom.amount
|
||||
args.amount = plot.getOptions().zoom.amount;
|
||||
|
||||
args.amount = 1 / args.amount;
|
||||
plot.zoom(args);
|
||||
}
|
||||
};
|
||||
|
||||
plot.zoom = function (args) {
|
||||
if (!args)
|
||||
@ -234,7 +233,8 @@ Licensed under the MIT License ~ http://threedubmedia.googlecode.com/files/MIT-L
|
||||
var opts = axis.options,
|
||||
min = minmax[axis.direction].min,
|
||||
max = minmax[axis.direction].max,
|
||||
zr = opts.zoomRange;
|
||||
zr = opts.zoomRange,
|
||||
pr = opts.panRange;
|
||||
|
||||
if (zr === false) // no zooming on this axis
|
||||
return;
|
||||
@ -248,6 +248,16 @@ Licensed under the MIT License ~ http://threedubmedia.googlecode.com/files/MIT-L
|
||||
max = tmp;
|
||||
}
|
||||
|
||||
//Check that we are in panRange
|
||||
if (pr) {
|
||||
if (pr[0] != null && min < pr[0]) {
|
||||
min = pr[0];
|
||||
}
|
||||
if (pr[1] != null && max > pr[1]) {
|
||||
max = pr[1];
|
||||
}
|
||||
}
|
||||
|
||||
var range = max - min;
|
||||
if (zr &&
|
||||
((zr[0] != null && range < zr[0]) ||
|
||||
@ -262,8 +272,8 @@ Licensed under the MIT License ~ http://threedubmedia.googlecode.com/files/MIT-L
|
||||
plot.draw();
|
||||
|
||||
if (!args.preventEvent)
|
||||
plot.getPlaceholder().trigger("plotzoom", [ plot ]);
|
||||
}
|
||||
plot.getPlaceholder().trigger("plotzoom", [ plot, args ]);
|
||||
};
|
||||
|
||||
plot.pan = function (args) {
|
||||
var delta = {
|
||||
@ -310,8 +320,8 @@ Licensed under the MIT License ~ http://threedubmedia.googlecode.com/files/MIT-L
|
||||
plot.draw();
|
||||
|
||||
if (!args.preventEvent)
|
||||
plot.getPlaceholder().trigger("plotpan", [ plot ]);
|
||||
}
|
||||
plot.getPlaceholder().trigger("plotpan", [ plot, args ]);
|
||||
};
|
||||
|
||||
function shutdown(plot, eventHolder) {
|
||||
eventHolder.unbind(plot.getOptions().zoom.trigger, onZoomClick);
|
||||
|
||||
87
htdocs/includes/jquery/plugins/flot/jquery.flot.navigate.min.js
vendored
Executable file → Normal file
87
htdocs/includes/jquery/plugins/flot/jquery.flot.navigate.min.js
vendored
Executable file → Normal file
File diff suppressed because one or more lines are too long
1091
htdocs/includes/jquery/plugins/flot/jquery.flot.pie.js
Executable file → Normal file
1091
htdocs/includes/jquery/plugins/flot/jquery.flot.pie.js
Executable file → Normal file
File diff suppressed because it is too large
Load Diff
57
htdocs/includes/jquery/plugins/flot/jquery.flot.pie.min.js
vendored
Executable file → Normal file
57
htdocs/includes/jquery/plugins/flot/jquery.flot.pie.min.js
vendored
Executable file → Normal file
File diff suppressed because one or more lines are too long
24
htdocs/includes/jquery/plugins/flot/jquery.flot.resize.js
Executable file → Normal file
24
htdocs/includes/jquery/plugins/flot/jquery.flot.resize.js
Executable file → Normal file
@ -1,26 +1,26 @@
|
||||
/*
|
||||
Flot plugin for automatically redrawing plots when the placeholder
|
||||
size changes, e.g. on window resizes.
|
||||
/* Flot plugin for automatically redrawing plots as the placeholder resizes.
|
||||
|
||||
It works by listening for changes on the placeholder div (through the
|
||||
jQuery resize event plugin) - if the size changes, it will redraw the
|
||||
plot.
|
||||
Copyright (c) 2007-2013 IOLA and Ole Laursen.
|
||||
Licensed under the MIT license.
|
||||
|
||||
It works by listening for changes on the placeholder div (through the jQuery
|
||||
resize event plugin) - if the size changes, it will redraw the plot.
|
||||
|
||||
There are no options. If you need to disable the plugin for some plots, you
|
||||
can just fix the size of their placeholders.
|
||||
|
||||
There are no options. If you need to disable the plugin for some
|
||||
plots, you can just fix the size of their placeholders.
|
||||
*/
|
||||
|
||||
|
||||
/* Inline dependency:
|
||||
/* Inline dependency:
|
||||
* jQuery resize event - v1.1 - 3/14/2010
|
||||
* http://benalman.com/projects/jquery-resize-plugin/
|
||||
*
|
||||
*
|
||||
* Copyright (c) 2010 "Cowboy" Ben Alman
|
||||
* Dual licensed under the MIT and GPL licenses.
|
||||
* http://benalman.com/about/license/
|
||||
*/
|
||||
(function($,h,c){var a=$([]),e=$.resize=$.extend($.resize,{}),i,k="setTimeout",j="resize",d=j+"-special-event",b="delay",f="throttleWindow";e[b]=250;e[f]=true;$.event.special[j]={setup:function(){if(!e[f]&&this[k]){return false}var l=$(this);a=a.add(l);$.data(this,d,{w:l.width(),h:l.height()});if(a.length===1){g()}},teardown:function(){if(!e[f]&&this[k]){return false}var l=$(this);a=a.not(l);l.removeData(d);if(!a.length){clearTimeout(i)}},add:function(l){if(!e[f]&&this[k]){return false}var n;function m(s,o,p){var q=$(this),r=$.data(this,d);r.w=o!==c?o:q.width();r.h=p!==c?p:q.height();n.apply(this,arguments)}if($.isFunction(l)){n=l;return m}else{n=l.handler;l.handler=m}}};function g(){i=h[k](function(){a.each(function(){var n=$(this),m=n.width(),l=n.height(),o=$.data(this,d);if(m!==o.w||l!==o.h){n.trigger(j,[o.w=m,o.h=l])}});g()},e[b])}})(jQuery,this);
|
||||
|
||||
(function($,h,c){var a=$([]),e=$.resize=$.extend($.resize,{}),i,k="setTimeout",j="resize",d=j+"-special-event",b="delay",f="throttleWindow";e[b]=250;e[f]=true;$.event.special[j]={setup:function(){if(!e[f]&&this[k]){return false}var l=$(this);a=a.add(l);$.data(this,d,{w:l.width(),h:l.height()});if(a.length===1){g()}},teardown:function(){if(!e[f]&&this[k]){return false}var l=$(this);a=a.not(l);l.removeData(d);if(!a.length){clearTimeout(i)}},add:function(l){if(!e[f]&&this[k]){return false}var n;function m(s,o,p){var q=$(this),r=$.data(this,d);r.w=o!==c?o:q.width();r.h=p!==c?p:q.height();n.apply(this,arguments)}if($.isFunction(l)){n=l;return m}else{n=l.handler;l.handler=m}}};function g(){i=h[k](function(){a.each(function(){var n=$(this),m=n.width(),l=n.height(),o=$.data(this,d);if(m!==o.w||l!==o.h){n.trigger(j,[o.w=m,o.h=l])}});g()},e[b])}})(jQuery,this);
|
||||
|
||||
(function ($) {
|
||||
var options = { }; // no options
|
||||
|
||||
20
htdocs/includes/jquery/plugins/flot/jquery.flot.resize.min.js
vendored
Executable file → Normal file
20
htdocs/includes/jquery/plugins/flot/jquery.flot.resize.min.js
vendored
Executable file → Normal file
@ -1 +1,19 @@
|
||||
(function(n,p,u){var w=n([]),s=n.resize=n.extend(n.resize,{}),o,l="setTimeout",m="resize",t=m+"-special-event",v="delay",r="throttleWindow";s[v]=250;s[r]=true;n.event.special[m]={setup:function(){if(!s[r]&&this[l]){return false}var a=n(this);w=w.add(a);n.data(this,t,{w:a.width(),h:a.height()});if(w.length===1){q()}},teardown:function(){if(!s[r]&&this[l]){return false}var a=n(this);w=w.not(a);a.removeData(t);if(!w.length){clearTimeout(o)}},add:function(b){if(!s[r]&&this[l]){return false}var c;function a(d,h,g){var f=n(this),e=n.data(this,t);e.w=h!==u?h:f.width();e.h=g!==u?g:f.height();c.apply(this,arguments)}if(n.isFunction(b)){c=b;return a}else{c=b.handler;b.handler=a}}};function q(){o=p[l](function(){w.each(function(){var d=n(this),a=d.width(),b=d.height(),c=n.data(this,t);if(a!==c.w||b!==c.h){d.trigger(m,[c.w=a,c.h=b])}});q()},s[v])}})(jQuery,this);(function(b){var a={};function c(f){function e(){var h=f.getPlaceholder();if(h.width()==0||h.height()==0){return}f.resize();f.setupGrid();f.draw()}function g(i,h){i.getPlaceholder().resize(e)}function d(i,h){i.getPlaceholder().unbind("resize",e)}f.hooks.bindEvents.push(g);f.hooks.shutdown.push(d)}b.plot.plugins.push({init:c,options:a,name:"resize",version:"1.0"})})(jQuery);
|
||||
/* Flot plugin for automatically redrawing plots as the placeholder resizes.
|
||||
|
||||
Copyright (c) 2007-2013 IOLA and Ole Laursen.
|
||||
Licensed under the MIT license.
|
||||
|
||||
It works by listening for changes on the placeholder div (through the jQuery
|
||||
resize event plugin) - if the size changes, it will redraw the plot.
|
||||
|
||||
There are no options. If you need to disable the plugin for some plots, you
|
||||
can just fix the size of their placeholders.
|
||||
|
||||
*//* Inline dependency:
|
||||
* jQuery resize event - v1.1 - 3/14/2010
|
||||
* http://benalman.com/projects/jquery-resize-plugin/
|
||||
*
|
||||
* Copyright (c) 2010 "Cowboy" Ben Alman
|
||||
* Dual licensed under the MIT and GPL licenses.
|
||||
* http://benalman.com/about/license/
|
||||
*/(function(e,t,n){function c(){s=t[o](function(){r.each(function(){var t=e(this),n=t.width(),r=t.height(),i=e.data(this,a);(n!==i.w||r!==i.h)&&t.trigger(u,[i.w=n,i.h=r])}),c()},i[f])}var r=e([]),i=e.resize=e.extend(e.resize,{}),s,o="setTimeout",u="resize",a=u+"-special-event",f="delay",l="throttleWindow";i[f]=250,i[l]=!0,e.event.special[u]={setup:function(){if(!i[l]&&this[o])return!1;var t=e(this);r=r.add(t),e.data(this,a,{w:t.width(),h:t.height()}),r.length===1&&c()},teardown:function(){if(!i[l]&&this[o])return!1;var t=e(this);r=r.not(t),t.removeData(a),r.length||clearTimeout(s)},add:function(t){function s(t,i,s){var o=e(this),u=e.data(this,a);u.w=i!==n?i:o.width(),u.h=s!==n?s:o.height(),r.apply(this,arguments)}if(!i[l]&&this[o])return!1;var r;if(e.isFunction(t))return r=t,s;r=t.handler,t.handler=s}}})(jQuery,this),function(e){function n(e){function t(){var t=e.getPlaceholder();if(t.width()==0||t.height()==0)return;e.resize(),e.setupGrid(),e.draw()}function n(e,n){e.getPlaceholder().resize(t)}function r(e,n){e.getPlaceholder().unbind("resize",t)}e.hooks.bindEvents.push(n),e.hooks.shutdown.push(r)}var t={};e.plot.plugins.push({init:n,options:t,name:"resize",version:"1.0"})}(jQuery);
|
||||
122
htdocs/includes/jquery/plugins/flot/jquery.flot.selection.js
Executable file → Normal file
122
htdocs/includes/jquery/plugins/flot/jquery.flot.selection.js
Executable file → Normal file
@ -1,68 +1,80 @@
|
||||
/*
|
||||
Flot plugin for selecting regions.
|
||||
/* Flot plugin for selecting regions of a plot.
|
||||
|
||||
The plugin defines the following options:
|
||||
Copyright (c) 2007-2013 IOLA and Ole Laursen.
|
||||
Licensed under the MIT license.
|
||||
|
||||
selection: {
|
||||
mode: null or "x" or "y" or "xy",
|
||||
color: color
|
||||
}
|
||||
The plugin supports these options:
|
||||
|
||||
Selection support is enabled by setting the mode to one of "x", "y" or
|
||||
"xy". In "x" mode, the user will only be able to specify the x range,
|
||||
similarly for "y" mode. For "xy", the selection becomes a rectangle
|
||||
where both ranges can be specified. "color" is color of the selection
|
||||
(if you need to change the color later on, you can get to it with
|
||||
plot.getOptions().selection.color).
|
||||
selection: {
|
||||
mode: null or "x" or "y" or "xy",
|
||||
color: color,
|
||||
shape: "round" or "miter" or "bevel",
|
||||
minSize: number of pixels
|
||||
}
|
||||
|
||||
When selection support is enabled, a "plotselected" event will be
|
||||
emitted on the DOM element you passed into the plot function. The
|
||||
event handler gets a parameter with the ranges selected on the axes,
|
||||
like this:
|
||||
Selection support is enabled by setting the mode to one of "x", "y" or "xy".
|
||||
In "x" mode, the user will only be able to specify the x range, similarly for
|
||||
"y" mode. For "xy", the selection becomes a rectangle where both ranges can be
|
||||
specified. "color" is color of the selection (if you need to change the color
|
||||
later on, you can get to it with plot.getOptions().selection.color). "shape"
|
||||
is the shape of the corners of the selection.
|
||||
|
||||
placeholder.bind("plotselected", function(event, ranges) {
|
||||
alert("You selected " + ranges.xaxis.from + " to " + ranges.xaxis.to)
|
||||
// similar for yaxis - with multiple axes, the extra ones are in
|
||||
// x2axis, x3axis, ...
|
||||
});
|
||||
"minSize" is the minimum size a selection can be in pixels. This value can
|
||||
be customized to determine the smallest size a selection can be and still
|
||||
have the selection rectangle be displayed. When customizing this value, the
|
||||
fact that it refers to pixels, not axis units must be taken into account.
|
||||
Thus, for example, if there is a bar graph in time mode with BarWidth set to 1
|
||||
minute, setting "minSize" to 1 will not make the minimum selection size 1
|
||||
minute, but rather 1 pixel. Note also that setting "minSize" to 0 will prevent
|
||||
"plotunselected" events from being fired when the user clicks the mouse without
|
||||
dragging.
|
||||
|
||||
The "plotselected" event is only fired when the user has finished
|
||||
making the selection. A "plotselecting" event is fired during the
|
||||
process with the same parameters as the "plotselected" event, in case
|
||||
you want to know what's happening while it's happening,
|
||||
When selection support is enabled, a "plotselected" event will be emitted on
|
||||
the DOM element you passed into the plot function. The event handler gets a
|
||||
parameter with the ranges selected on the axes, like this:
|
||||
|
||||
A "plotunselected" event with no arguments is emitted when the user
|
||||
clicks the mouse to remove the selection.
|
||||
placeholder.bind( "plotselected", function( event, ranges ) {
|
||||
alert("You selected " + ranges.xaxis.from + " to " + ranges.xaxis.to)
|
||||
// similar for yaxis - with multiple axes, the extra ones are in
|
||||
// x2axis, x3axis, ...
|
||||
});
|
||||
|
||||
The "plotselected" event is only fired when the user has finished making the
|
||||
selection. A "plotselecting" event is fired during the process with the same
|
||||
parameters as the "plotselected" event, in case you want to know what's
|
||||
happening while it's happening,
|
||||
|
||||
A "plotunselected" event with no arguments is emitted when the user clicks the
|
||||
mouse to remove the selection. As stated above, setting "minSize" to 0 will
|
||||
destroy this behavior.
|
||||
|
||||
The plugin allso adds the following methods to the plot object:
|
||||
|
||||
- setSelection(ranges, preventEvent)
|
||||
- setSelection( ranges, preventEvent )
|
||||
|
||||
Set the selection rectangle. The passed in ranges is on the same
|
||||
form as returned in the "plotselected" event. If the selection mode
|
||||
is "x", you should put in either an xaxis range, if the mode is "y"
|
||||
you need to put in an yaxis range and both xaxis and yaxis if the
|
||||
selection mode is "xy", like this:
|
||||
Set the selection rectangle. The passed in ranges is on the same form as
|
||||
returned in the "plotselected" event. If the selection mode is "x", you
|
||||
should put in either an xaxis range, if the mode is "y" you need to put in
|
||||
an yaxis range and both xaxis and yaxis if the selection mode is "xy", like
|
||||
this:
|
||||
|
||||
setSelection({ xaxis: { from: 0, to: 10 }, yaxis: { from: 40, to: 60 } });
|
||||
setSelection({ xaxis: { from: 0, to: 10 }, yaxis: { from: 40, to: 60 } });
|
||||
|
||||
setSelection will trigger the "plotselected" event when called. If
|
||||
you don't want that to happen, e.g. if you're inside a
|
||||
"plotselected" handler, pass true as the second parameter. If you
|
||||
are using multiple axes, you can specify the ranges on any of those,
|
||||
e.g. as x2axis/x3axis/... instead of xaxis, the plugin picks the
|
||||
first one it sees.
|
||||
|
||||
- clearSelection(preventEvent)
|
||||
setSelection will trigger the "plotselected" event when called. If you don't
|
||||
want that to happen, e.g. if you're inside a "plotselected" handler, pass
|
||||
true as the second parameter. If you are using multiple axes, you can
|
||||
specify the ranges on any of those, e.g. as x2axis/x3axis/... instead of
|
||||
xaxis, the plugin picks the first one it sees.
|
||||
|
||||
- clearSelection( preventEvent )
|
||||
|
||||
Clear the selection rectangle. Pass in true to avoid getting a
|
||||
"plotunselected" event.
|
||||
|
||||
- getSelection()
|
||||
|
||||
Returns the current selection in the same format as the
|
||||
"plotselected" event. If there's currently no selection, the
|
||||
function returns null.
|
||||
Returns the current selection in the same format as the "plotselected"
|
||||
event. If there's currently no selection, the function returns null.
|
||||
|
||||
*/
|
||||
|
||||
@ -146,6 +158,8 @@ The plugin allso adds the following methods to the plot object:
|
||||
function getSelection() {
|
||||
if (!selectionIsSane())
|
||||
return null;
|
||||
|
||||
if (!selection.show) return null;
|
||||
|
||||
var r = {}, c1 = selection.first, c2 = selection.second;
|
||||
$.each(plot.getAxes(), function (name, axis) {
|
||||
@ -274,7 +288,7 @@ The plugin allso adds the following methods to the plot object:
|
||||
}
|
||||
|
||||
function selectionIsSane() {
|
||||
var minSize = 5;
|
||||
var minSize = plot.getOptions().selection.minSize;
|
||||
return Math.abs(selection.second.x - selection.first.x) >= minSize &&
|
||||
Math.abs(selection.second.y - selection.first.y) >= minSize;
|
||||
}
|
||||
@ -305,13 +319,13 @@ The plugin allso adds the following methods to the plot object:
|
||||
|
||||
ctx.strokeStyle = c.scale('a', 0.8).toString();
|
||||
ctx.lineWidth = 1;
|
||||
ctx.lineJoin = "round";
|
||||
ctx.lineJoin = o.selection.shape;
|
||||
ctx.fillStyle = c.scale('a', 0.4).toString();
|
||||
|
||||
var x = Math.min(selection.first.x, selection.second.x),
|
||||
y = Math.min(selection.first.y, selection.second.y),
|
||||
w = Math.abs(selection.second.x - selection.first.x),
|
||||
h = Math.abs(selection.second.y - selection.first.y);
|
||||
var x = Math.min(selection.first.x, selection.second.x) + 0.5,
|
||||
y = Math.min(selection.first.y, selection.second.y) + 0.5,
|
||||
w = Math.abs(selection.second.x - selection.first.x) - 1,
|
||||
h = Math.abs(selection.second.y - selection.first.y) - 1;
|
||||
|
||||
ctx.fillRect(x, y, w, h);
|
||||
ctx.strokeRect(x, y, w, h);
|
||||
@ -335,7 +349,9 @@ The plugin allso adds the following methods to the plot object:
|
||||
options: {
|
||||
selection: {
|
||||
mode: null, // one of null, "x", "y" or "xy"
|
||||
color: "#e8cfac"
|
||||
color: "#e8cfac",
|
||||
shape: "round", // one of "round", "miter", or "bevel"
|
||||
minSize: 5 // minimum number of pixels
|
||||
}
|
||||
},
|
||||
name: 'selection',
|
||||
|
||||
80
htdocs/includes/jquery/plugins/flot/jquery.flot.selection.min.js
vendored
Executable file → Normal file
80
htdocs/includes/jquery/plugins/flot/jquery.flot.selection.min.js
vendored
Executable file → Normal file
@ -1 +1,79 @@
|
||||
(function(a){function b(k){var p={first:{x:-1,y:-1},second:{x:-1,y:-1},show:false,active:false};var m={};var r=null;function e(s){if(p.active){l(s);k.getPlaceholder().trigger("plotselecting",[g()])}}function n(s){if(s.which!=1){return}document.body.focus();if(document.onselectstart!==undefined&&m.onselectstart==null){m.onselectstart=document.onselectstart;document.onselectstart=function(){return false}}if(document.ondrag!==undefined&&m.ondrag==null){m.ondrag=document.ondrag;document.ondrag=function(){return false}}d(p.first,s);p.active=true;r=function(t){j(t)};a(document).one("mouseup",r)}function j(s){r=null;if(document.onselectstart!==undefined){document.onselectstart=m.onselectstart}if(document.ondrag!==undefined){document.ondrag=m.ondrag}p.active=false;l(s);if(f()){i()}else{k.getPlaceholder().trigger("plotunselected",[]);k.getPlaceholder().trigger("plotselecting",[null])}return false}function g(){if(!f()){return null}var u={},t=p.first,s=p.second;a.each(k.getAxes(),function(v,w){if(w.used){var y=w.c2p(t[w.direction]),x=w.c2p(s[w.direction]);u[v]={from:Math.min(y,x),to:Math.max(y,x)}}});return u}function i(){var s=g();k.getPlaceholder().trigger("plotselected",[s]);if(s.xaxis&&s.yaxis){k.getPlaceholder().trigger("selected",[{x1:s.xaxis.from,y1:s.yaxis.from,x2:s.xaxis.to,y2:s.yaxis.to}])}}function h(t,u,s){return u<t?t:(u>s?s:u)}function d(w,t){var v=k.getOptions();var u=k.getPlaceholder().offset();var s=k.getPlotOffset();w.x=h(0,t.pageX-u.left-s.left,k.width());w.y=h(0,t.pageY-u.top-s.top,k.height());if(v.selection.mode=="y"){w.x=w==p.first?0:k.width()}if(v.selection.mode=="x"){w.y=w==p.first?0:k.height()}}function l(s){if(s.pageX==null){return}d(p.second,s);if(f()){p.show=true;k.triggerRedrawOverlay()}else{q(true)}}function q(s){if(p.show){p.show=false;k.triggerRedrawOverlay();if(!s){k.getPlaceholder().trigger("plotunselected",[])}}}function c(s,w){var t,y,z,A,x=k.getAxes();for(var u in x){t=x[u];if(t.direction==w){A=w+t.n+"axis";if(!s[A]&&t.n==1){A=w+"axis"}if(s[A]){y=s[A].from;z=s[A].to;break}}}if(!s[A]){t=w=="x"?k.getXAxes()[0]:k.getYAxes()[0];y=s[w+"1"];z=s[w+"2"]}if(y!=null&&z!=null&&y>z){var v=y;y=z;z=v}return{from:y,to:z,axis:t}}function o(t,s){var v,u,w=k.getOptions();if(w.selection.mode=="y"){p.first.x=0;p.second.x=k.width()}else{u=c(t,"x");p.first.x=u.axis.p2c(u.from);p.second.x=u.axis.p2c(u.to)}if(w.selection.mode=="x"){p.first.y=0;p.second.y=k.height()}else{u=c(t,"y");p.first.y=u.axis.p2c(u.from);p.second.y=u.axis.p2c(u.to)}p.show=true;k.triggerRedrawOverlay();if(!s&&f()){i()}}function f(){var s=5;return Math.abs(p.second.x-p.first.x)>=s&&Math.abs(p.second.y-p.first.y)>=s}k.clearSelection=q;k.setSelection=o;k.getSelection=g;k.hooks.bindEvents.push(function(t,s){var u=t.getOptions();if(u.selection.mode!=null){s.mousemove(e);s.mousedown(n)}});k.hooks.drawOverlay.push(function(v,D){if(p.show&&f()){var t=v.getPlotOffset();var s=v.getOptions();D.save();D.translate(t.left,t.top);var z=a.color.parse(s.selection.color);D.strokeStyle=z.scale("a",0.8).toString();D.lineWidth=1;D.lineJoin="round";D.fillStyle=z.scale("a",0.4).toString();var B=Math.min(p.first.x,p.second.x),A=Math.min(p.first.y,p.second.y),C=Math.abs(p.second.x-p.first.x),u=Math.abs(p.second.y-p.first.y);D.fillRect(B,A,C,u);D.strokeRect(B,A,C,u);D.restore()}});k.hooks.shutdown.push(function(t,s){s.unbind("mousemove",e);s.unbind("mousedown",n);if(r){a(document).unbind("mouseup",r)}})}a.plot.plugins.push({init:b,options:{selection:{mode:null,color:"#e8cfac"}},name:"selection",version:"1.1"})})(jQuery);
|
||||
/* Flot plugin for selecting regions of a plot.
|
||||
|
||||
Copyright (c) 2007-2013 IOLA and Ole Laursen.
|
||||
Licensed under the MIT license.
|
||||
|
||||
The plugin supports these options:
|
||||
|
||||
selection: {
|
||||
mode: null or "x" or "y" or "xy",
|
||||
color: color,
|
||||
shape: "round" or "miter" or "bevel",
|
||||
minSize: number of pixels
|
||||
}
|
||||
|
||||
Selection support is enabled by setting the mode to one of "x", "y" or "xy".
|
||||
In "x" mode, the user will only be able to specify the x range, similarly for
|
||||
"y" mode. For "xy", the selection becomes a rectangle where both ranges can be
|
||||
specified. "color" is color of the selection (if you need to change the color
|
||||
later on, you can get to it with plot.getOptions().selection.color). "shape"
|
||||
is the shape of the corners of the selection.
|
||||
|
||||
"minSize" is the minimum size a selection can be in pixels. This value can
|
||||
be customized to determine the smallest size a selection can be and still
|
||||
have the selection rectangle be displayed. When customizing this value, the
|
||||
fact that it refers to pixels, not axis units must be taken into account.
|
||||
Thus, for example, if there is a bar graph in time mode with BarWidth set to 1
|
||||
minute, setting "minSize" to 1 will not make the minimum selection size 1
|
||||
minute, but rather 1 pixel. Note also that setting "minSize" to 0 will prevent
|
||||
"plotunselected" events from being fired when the user clicks the mouse without
|
||||
dragging.
|
||||
|
||||
When selection support is enabled, a "plotselected" event will be emitted on
|
||||
the DOM element you passed into the plot function. The event handler gets a
|
||||
parameter with the ranges selected on the axes, like this:
|
||||
|
||||
placeholder.bind( "plotselected", function( event, ranges ) {
|
||||
alert("You selected " + ranges.xaxis.from + " to " + ranges.xaxis.to)
|
||||
// similar for yaxis - with multiple axes, the extra ones are in
|
||||
// x2axis, x3axis, ...
|
||||
});
|
||||
|
||||
The "plotselected" event is only fired when the user has finished making the
|
||||
selection. A "plotselecting" event is fired during the process with the same
|
||||
parameters as the "plotselected" event, in case you want to know what's
|
||||
happening while it's happening,
|
||||
|
||||
A "plotunselected" event with no arguments is emitted when the user clicks the
|
||||
mouse to remove the selection. As stated above, setting "minSize" to 0 will
|
||||
destroy this behavior.
|
||||
|
||||
The plugin allso adds the following methods to the plot object:
|
||||
|
||||
- setSelection( ranges, preventEvent )
|
||||
|
||||
Set the selection rectangle. The passed in ranges is on the same form as
|
||||
returned in the "plotselected" event. If the selection mode is "x", you
|
||||
should put in either an xaxis range, if the mode is "y" you need to put in
|
||||
an yaxis range and both xaxis and yaxis if the selection mode is "xy", like
|
||||
this:
|
||||
|
||||
setSelection({ xaxis: { from: 0, to: 10 }, yaxis: { from: 40, to: 60 } });
|
||||
|
||||
setSelection will trigger the "plotselected" event when called. If you don't
|
||||
want that to happen, e.g. if you're inside a "plotselected" handler, pass
|
||||
true as the second parameter. If you are using multiple axes, you can
|
||||
specify the ranges on any of those, e.g. as x2axis/x3axis/... instead of
|
||||
xaxis, the plugin picks the first one it sees.
|
||||
|
||||
- clearSelection( preventEvent )
|
||||
|
||||
Clear the selection rectangle. Pass in true to avoid getting a
|
||||
"plotunselected" event.
|
||||
|
||||
- getSelection()
|
||||
|
||||
Returns the current selection in the same format as the "plotselected"
|
||||
event. If there's currently no selection, the function returns null.
|
||||
|
||||
*/(function(e){function t(t){function s(e){n.active&&(h(e),t.getPlaceholder().trigger("plotselecting",[a()]))}function o(t){if(t.which!=1)return;document.body.focus(),document.onselectstart!==undefined&&r.onselectstart==null&&(r.onselectstart=document.onselectstart,document.onselectstart=function(){return!1}),document.ondrag!==undefined&&r.ondrag==null&&(r.ondrag=document.ondrag,document.ondrag=function(){return!1}),c(n.first,t),n.active=!0,i=function(e){u(e)},e(document).one("mouseup",i)}function u(e){return i=null,document.onselectstart!==undefined&&(document.onselectstart=r.onselectstart),document.ondrag!==undefined&&(document.ondrag=r.ondrag),n.active=!1,h(e),m()?f():(t.getPlaceholder().trigger("plotunselected",[]),t.getPlaceholder().trigger("plotselecting",[null])),!1}function a(){if(!m())return null;if(!n.show)return null;var r={},i=n.first,s=n.second;return e.each(t.getAxes(),function(e,t){if(t.used){var n=t.c2p(i[t.direction]),o=t.c2p(s[t.direction]);r[e]={from:Math.min(n,o),to:Math.max(n,o)}}}),r}function f(){var e=a();t.getPlaceholder().trigger("plotselected",[e]),e.xaxis&&e.yaxis&&t.getPlaceholder().trigger("selected",[{x1:e.xaxis.from,y1:e.yaxis.from,x2:e.xaxis.to,y2:e.yaxis.to}])}function l(e,t,n){return t<e?e:t>n?n:t}function c(e,r){var i=t.getOptions(),s=t.getPlaceholder().offset(),o=t.getPlotOffset();e.x=l(0,r.pageX-s.left-o.left,t.width()),e.y=l(0,r.pageY-s.top-o.top,t.height()),i.selection.mode=="y"&&(e.x=e==n.first?0:t.width()),i.selection.mode=="x"&&(e.y=e==n.first?0:t.height())}function h(e){if(e.pageX==null)return;c(n.second,e),m()?(n.show=!0,t.triggerRedrawOverlay()):p(!0)}function p(e){n.show&&(n.show=!1,t.triggerRedrawOverlay(),e||t.getPlaceholder().trigger("plotunselected",[]))}function d(e,n){var r,i,s,o,u=t.getAxes();for(var a in u){r=u[a];if(r.direction==n){o=n+r.n+"axis",!e[o]&&r.n==1&&(o=n+"axis");if(e[o]){i=e[o].from,s=e[o].to;break}}}e[o]||(r=n=="x"?t.getXAxes()[0]:t.getYAxes()[0],i=e[n+"1"],s=e[n+"2"]);if(i!=null&&s!=null&&i>s){var f=i;i=s,s=f}return{from:i,to:s,axis:r}}function v(e,r){var i,s,o=t.getOptions();o.selection.mode=="y"?(n.first.x=0,n.second.x=t.width()):(s=d(e,"x"),n.first.x=s.axis.p2c(s.from),n.second.x=s.axis.p2c(s.to)),o.selection.mode=="x"?(n.first.y=0,n.second.y=t.height()):(s=d(e,"y"),n.first.y=s.axis.p2c(s.from),n.second.y=s.axis.p2c(s.to)),n.show=!0,t.triggerRedrawOverlay(),!r&&m()&&f()}function m(){var e=t.getOptions().selection.minSize;return Math.abs(n.second.x-n.first.x)>=e&&Math.abs(n.second.y-n.first.y)>=e}var n={first:{x:-1,y:-1},second:{x:-1,y:-1},show:!1,active:!1},r={},i=null;t.clearSelection=p,t.setSelection=v,t.getSelection=a,t.hooks.bindEvents.push(function(e,t){var n=e.getOptions();n.selection.mode!=null&&(t.mousemove(s),t.mousedown(o))}),t.hooks.drawOverlay.push(function(t,r){if(n.show&&m()){var i=t.getPlotOffset(),s=t.getOptions();r.save(),r.translate(i.left,i.top);var o=e.color.parse(s.selection.color);r.strokeStyle=o.scale("a",.8).toString(),r.lineWidth=1,r.lineJoin=s.selection.shape,r.fillStyle=o.scale("a",.4).toString();var u=Math.min(n.first.x,n.second.x)+.5,a=Math.min(n.first.y,n.second.y)+.5,f=Math.abs(n.second.x-n.first.x)-1,l=Math.abs(n.second.y-n.first.y)-1;r.fillRect(u,a,f,l),r.strokeRect(u,a,f,l),r.restore()}}),t.hooks.shutdown.push(function(t,n){n.unbind("mousemove",s),n.unbind("mousedown",o),i&&e(document).unbind("mouseup",i)})}e.plot.plugins.push({init:t,options:{selection:{mode:null,color:"#e8cfac",shape:"round",minSize:5}},name:"selection",version:"1.1"})})(jQuery);
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user