[livejournal] r17764: LJSUP-7440. Disable button "Yes, i want ...
Committer: gprochaev
LJSUP-7440. Disable button "Yes, i want to load" when communities are loadingU trunk/cgi-bin/LJ/Browse.pm U trunk/htdocs/admin/browse/load_all_structure.bml
Modified: trunk/cgi-bin/LJ/Browse.pm
===================================================================
--- trunk/cgi-bin/LJ/Browse.pm 2010-11-24 04:39:04 UTC (rev 17763)
+++ trunk/cgi-bin/LJ/Browse.pm 2010-11-24 06:55:34 UTC (rev 17764)
@@ -963,7 +963,7 @@
or die "unable to contact global db master to create category";
## Add community to category
- $dbh->do("REPLACE INTO categoryjournals VALUES (?,?)", undef,
+ my $res = $dbh->do("REPLACE INTO categoryjournals VALUES (?,?)", undef,
$self->catid, $uid);
die $dbh->errstr if $dbh->err;
Modified: trunk/htdocs/admin/browse/load_all_structure.bml
===================================================================
--- trunk/htdocs/admin/browse/load_all_structure.bml 2010-11-24 04:39:04 UTC (rev 17763)
+++ trunk/htdocs/admin/browse/load_all_structure.bml 2010-11-24 06:55:34 UTC (rev 17764)
@@ -52,6 +52,11 @@
my $v = LJ::Vertical->load_by_url ("/vertical" . $vert_url)
|| LJ::Vertical->create (name => $vert_name, url => $vert_url);
+ unless ($v) {
+ $ret .= "Can't find vertical '$vert_name'<br>";
+ next;
+ }
+
## Category name & url
my $cat_name = $columns[3];
my $cat_url = $columns[4];
@@ -61,6 +66,11 @@
$cat = LJ::Browse->create ( pretty_name => $cat_name, url_path => $cat_url, vertical => $v );
}
+ unless ($cat) {
+ $ret .= "Can't find category '$cat_name'<br>";
+ next;
+ }
+
my ($subcat_name, $subcat_url, $subcat) = ();
## Sub-Category name & url
@@ -72,6 +82,10 @@
unless ($subcat) {
$subcat = LJ::Browse->create ( pretty_name => $subcat_name, url_path => $subcat_url, parentcatid => $cat->catid, vertical => $cat->vertical );
}
+ unless ($subcat) {
+ $ret .= "Can't find sub-category '$subcat_name'<br>";
+ next;
+ }
}
## #7 - Full path for sanity check
@@ -83,9 +97,12 @@
my $comm_id = LJ::get_userid($comm_name);
## Wrong community name?
- next unless $comm_id;
+ unless ($comm_id) {
+ $ret .= "Community <$comm_name> not exist<br>";
+ next;
+ }
- $subcat
+ my $is_add = $subcat
? $subcat->add_community($comm_id, \@tags)
: $cat->add_community($comm_id, \@tags);
@@ -98,7 +115,7 @@
$ret .= LJ::form_auth();
$ret .= "<input type='file' name='all_structure'>";
- $ret .= "<br/><input type='submit' name='load' value='Yes, I want to load'>";
+ $ret .= "<br/><input type='submit' name='load' onclick='this.disabled=true;' value='Yes, I want to load'>";
$ret .= "</form>";
