-
-
Notifications
You must be signed in to change notification settings - Fork 384
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of https://github.com/openfoodfacts/openfoodfac…
- Loading branch information
Showing
258 changed files
with
3,717 additions
and
2,249 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
#!/usr/bin/perl -w | ||
|
||
# This file is part of Product Opener. | ||
# | ||
# Product Opener | ||
# Copyright (C) 2011-2016 Association Open Food Facts | ||
# Contact: [email protected] | ||
# Address: 21 rue des Iles, 94100 Saint-Maur des Fossés, France | ||
# | ||
# Product Opener is free software: you can redistribute it and/or modify | ||
# it under the terms of the GNU Affero 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 Affero General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU Affero General Public License | ||
# along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
|
||
use Modern::Perl '2012'; | ||
use utf8; | ||
|
||
use CGI::Carp qw(fatalsToBrowser); | ||
use CGI qw/:cgi :form escapeHTML/; | ||
|
||
use ProductOpener::Config qw/:all/; | ||
use ProductOpener::Store qw/:all/; | ||
use ProductOpener::Index qw/:all/; | ||
use ProductOpener::Display qw/:all/; | ||
use ProductOpener::Users qw/:all/; | ||
use ProductOpener::URL qw/:all/; | ||
use ProductOpener::Lang qw/:all/; | ||
|
||
use CGI qw/:cgi :form escapeHTML/; | ||
use URI::Escape::XS; | ||
use Storable qw/dclone/; | ||
use Encode; | ||
use JSON::PP; | ||
|
||
ProductOpener::Display::init(); | ||
|
||
my $short_name = lang("site_name"); | ||
my $long_name = $short_name; | ||
|
||
# http://stackoverflow.com/a/16533563/11963 | ||
$short_name =~ s/\b([A-Z])[a-z]+(?=\s+[A-Z][a-z])|\G(?!^)\s+([A-Z])[a-z]+/$1$2/g; | ||
|
||
if ($cc eq 'world') { | ||
$long_name .= " " . uc($lc); | ||
$short_name .= " " . uc($lc); | ||
} | ||
else { | ||
$long_name .= " " . uc($cc) . "/" . uc($lc); | ||
$short_name .= " " . uc($cc) . "/" . uc($lc); | ||
} | ||
|
||
my %manifest; | ||
$manifest{lang} = $lc; | ||
$manifest{name} = $long_name; | ||
$manifest{short_name} = $short_name; | ||
$manifest{description} = lang('site_description'); | ||
$manifest{start_url} = format_subdomain($subdomain); | ||
$manifest{scope} = '/'; | ||
$manifest{display} = 'standalone'; | ||
|
||
my @keys = qw(theme_color icons related_applications background_color); | ||
foreach my $key (@keys) { | ||
$manifest{$key} = $options{manifest}{$key} if $options{manifest}{$key}; | ||
} | ||
|
||
my $data = encode_json(\%manifest); | ||
|
||
print "Content-Type: application/manifest+json; charset=UTF-8\r\nCache-Control: max-age=86400\r\n\r\n" . $data; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,7 @@ | |
# This file is part of Product Opener. | ||
# | ||
# Product Opener | ||
# Copyright (C) 2011-2016 Association Open Food Facts | ||
# Copyright (C) 2011-2017 Association Open Food Facts | ||
# Contact: [email protected] | ||
# Address: 21 rue des Iles, 94100 Saint-Maur des Fossés, France | ||
# | ||
|
@@ -1584,7 +1584,7 @@ ($$$$$$) | |
} | ||
|
||
$input .= <<HTML | ||
<span id="nutriment_${enid}_unit_percent"$hide_percent>%</span> | ||
<span class="nutriment_unit_percent" id="nutriment_${enid}_unit_percent"$hide_percent>%</span> | ||
<select class="nutriment_unit" id="nutriment_${enid}_unit" name="nutriment_${enid}_unit"$hide_select> | ||
HTML | ||
; | ||
|
@@ -1890,17 +1890,13 @@ ($$$$$$) | |
$comment = $comment . remove_tags_and_quote(decode utf8=>param('comment')); | ||
store_product($product_ref, $comment); | ||
|
||
my $product_url = product_url($product_ref); | ||
|
||
# product that was moved to OBF from OFF etc. | ||
if (defined $product_ref->{server}) { | ||
$product_url = "https://" . $subdomain . "." . $options{other_servers}{$product_ref->{server}}{domain} . $product_url; | ||
# product that was moved to OBF from OFF etc. | ||
my $product_url = "https://" . $subdomain . "." . $options{other_servers}{$product_ref->{server}}{domain} . product_url($product_ref);; | ||
$html .= "<p>" . lang("product_changes_saved") . "</p><p>→ <a href=\"" . $product_url . "\">" | ||
. lang("see_product_page") . "</a></p>"; | ||
} | ||
|
||
$html .= "<p>" . lang("product_changes_saved") . "</p><p>→ <a href=\"" . $product_url . "\">" | ||
. lang("see_product_page") . "</a></p>"; | ||
|
||
if ($type eq 'delete') { | ||
elsif ($type eq 'delete') { | ||
my $email = <<MAIL | ||
$User_id $Lang{has_deleted_product}{$lc}: | ||
|
@@ -1910,6 +1906,17 @@ ($$$$$$) | |
; | ||
send_email_to_admin(lang("deleting_product"), $email); | ||
|
||
} else { | ||
my %request = ( | ||
'titleid'=>get_fileid(product_name_brand($product_ref)), | ||
'query_string'=>$ENV{QUERY_STRING}, | ||
'referer'=>referer(), | ||
'code'=>$code, | ||
'product_changes_saved'=>1, | ||
'sample_size'=>10 | ||
); | ||
|
||
display_product(\%request); | ||
} | ||
|
||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
// This file is part of Product Opener. | ||
// | ||
// Product Opener | ||
// Copyright (C) 2011-2015 Association Open Food Facts | ||
// Copyright (C) 2011-2017 Association Open Food Facts | ||
// Contact: [email protected] | ||
// Address: 21 rue des Iles, 94100 Saint-Maur des Fossés, France | ||
// | ||
|
@@ -159,6 +159,7 @@ function add_line(event, ui) { | |
newline.attr('id', newid + "_tr"); | ||
newline.find(".nutriment_label").attr("id",newid + "_label").attr("name",newid + "_label"); | ||
newline.find(".nutriment_unit").attr("id",newid + "_unit").attr("name",newid + "_unit"); | ||
newline.find(".nutriment_unit_percent").attr("id",newid + "_unit_percent").attr("name",newid + "_unit_percent"); | ||
newline.find(".nutriment_value").attr("id",newid).attr("name",newid); | ||
|
||
$('#nutrition_data_table > tbody:last').append(newline); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.