- web: after post to a thread, show thread in user's chosen order

instead of newest first.


svn path=/trunk/boinc/; revision=25931
This commit is contained in:
David Anderson 2012-08-01 17:57:56 +00:00
parent 2bec46bd80
commit ab120dea9e
10 changed files with 59 additions and 16 deletions

View File

@ -5095,3 +5095,20 @@ Rom 30 July 2012
clientgui/
sg_BoincSimpleFrame.cpp
David 1 Aug 2012
- web: after post to a thread, show thread in user's chosen order
instead of newest first.
db/
db_base.cpp,h
html/
inc/
forum.inc
user/
forum_reply.php
vda/
vda_lib.cpp
vdad.cpp
sched_vda.cpp
vda_lib2.cpp

View File

@ -348,7 +348,7 @@ int DB_BASE::lookup(const char* clause) {
return 0;
}
int DB_BASE::update_fields_noid(char* set_clause, char* where_clause) {
int DB_BASE::update_fields_noid(const char* set_clause, const char* where_clause) {
char query[MAX_QUERY_LEN];
sprintf(query,
"update %s set %s where %s",

View File

@ -96,7 +96,7 @@ public:
int insert_batch(std::string&);
int update();
int update_field(const char*, const char* where_clause=NULL);
int update_fields_noid(char* set_clause, char* where_clause);
int update_fields_noid(const char* set_clause, const char* where_clause);
int delete_from_db();
int delete_from_db_multi(const char* where_clause);
int get_field_ints(const char*, int, int*);

View File

@ -28,11 +28,11 @@ $biomed = array(
array(
array(
"FightMalaria@Home",
"http://boinc.ucd.ie/fmah",
"http://boinc.ucd.ie/fmah/",
tra("University College Dublin"),
tra("Antimalarial drug discovery"),
tra("The parasite that causes malaria continues to evolve resistance to available medication. We therefore urgently need to discover new drugs to replace existing drugs. Importantly, these new drugs need to target NEW proteins in the parasite. The FightMalaria@Home project is aimed at finding these new targets."),
"fmah_banner3.png"
"FMAH_banner3_wt.png"
),
array(
"POEM@HOME",

View File

@ -807,6 +807,7 @@ function create_post($content, $parent_id, $user, $forum, $thread, $signature) {
$user->prefs->update("posts=posts+1");
$thread->update("replies=replies+1, timestamp=$now");
$forum->update("posts=posts+1, timestamp=$now");
return $id;
}
// call this when hide or delete a post;

View File

@ -73,11 +73,15 @@ if ($content && (!$preview)){
$warning = tra("Your post has been flagged as spam by the Akismet anti-spam system. Please modify your text and try again.");
$preview = tra("Preview");
} else {
create_post(
$post_id = create_post(
$content, $parent_post_id, $logged_in_user, $forum,
$thread, $add_signature
);
header("Location: forum_thread.php?id=$thread->id&temp_sort_style=".CREATE_TIME_NEW);
if ($post_id) {
header("Location: forum_thread.php?id=$thread->id&postid=$post_id");
} else {
error_page("Can't create post.");
}
}
}

View File

@ -132,7 +132,7 @@ static int get_chunk_md5(char* chunk_dir, char* md5_buf) {
// delete from upload dir
//
static int process_completed_upload(char* chunk_name, CHUNK_LIST& chunks) {
char path[1024], client_filename[1024], dir[1024];
char path[1024], client_filename[1024], dir[1024], buf[256];
int retval;
physical_file_name(g_reply->host.id, chunk_name, client_filename);
@ -171,7 +171,11 @@ static int process_completed_upload(char* chunk_name, CHUNK_LIST& chunks) {
} else {
retval = vf.update_field("need_update=1");
if (retval) return retval;
retval = ch.update_field("transfer_in_progress=0");
sprintf(buf, "host_id=%d and physical_file_name='%s'",
ch.host_id,
ch.physical_file_name
);
retval = ch.update_fields_noid("transfer_in_progress=0", buf);
if (retval) return retval;
}
}
@ -241,7 +245,14 @@ static void process_present_file(FILE_INFO& fi, CHUNK_LIST& chunks) {
chp->transfer_in_progress = false;
chp->transfer_wait = false;
chp->present_on_host = true;
chp->update();
sprintf(buf,
"host_id=%d and physical_file_name='%s'",
chp->host_id, chp->physical_file_name
);
chp->update_fields_noid(
"transfer_in_progress=0, transfer_wait=0, present_on_host=1",
buf
);
}
mark_for_update(vf.id);
}

View File

@ -194,14 +194,14 @@ int META_CHUNK::recovery_action(double now) {
status = PRESENT;
}
#ifdef DEBUG_RECOVERY
printf("meta chunk action %s state %s unrec children %d\n",
printf(" meta chunk %s: state %s unrec children %d\n",
name, status_str(status), have_unrecoverable_children
);
#endif
for (i=0; i<children.size(); i++) {
DATA_UNIT* c = children[i];
#ifdef DEBUG_RECOVERY
printf(" child %s status %s in rec set %d\n",
printf(" child %s status %s in rec set %d\n",
c->name, status_str(c->status), c->in_recovery_set
);
#endif
@ -439,7 +439,7 @@ int CHUNK::recovery_plan() {
min_failures = 0;
}
#ifdef DEBUG_RECOVERY
printf("chunk plan %s: status %s\n", name, status_str(status));
printf(" chunk %s: status %s\n", name, status_str(status));
#endif
return 0;
}
@ -475,7 +475,7 @@ int CHUNK::recovery_action(double now) {
data_needed = true;
}
#ifdef DEBUG_RECOVERY
printf("chunk action: %s data_needed %d present_on_server %d\n",
printf(" chunk %s: data_needed %d present_on_server %d\n",
name, data_needed, present_on_server
);
#endif
@ -489,7 +489,7 @@ int CHUNK::recovery_action(double now) {
present_on_server = false;
status = RECOVERABLE;
min_failures = fp->policy.replication;
sprintf(buf, "%s replicated, removing from server\n", name);
sprintf(buf, " chunk %s: replicated, removing from server\n", name);
show_msg(buf);
parent->dfile->disk_usage.sample_inc(
-size,

View File

@ -291,6 +291,9 @@ int CHUNK::assign() {
log_messages.printf(MSG_CRITICAL, "ch.insert() failed\n");
return retval;
}
log_messages.printf(MSG_NORMAL,
" assigning chunk %s to host %d\n", name, host_id
);
return 0;
}
@ -437,8 +440,6 @@ int VDA_FILE_AUX::choose_host() {
int retval;
DB_HOST host;
return 467;
// replenish cache if needed
//
if (!available_hosts.size()) {
@ -463,6 +464,11 @@ int VDA_FILE_AUX::choose_host() {
host_alive_clause(), rand_id, 100-nhosts_scanned
);
}
// debugging
//
strcpy(buf, "where id=467 or id=166");
while (1) {
retval = host.enumerate(buf);
if (retval == ERR_DB_NOT_FOUND) break;

View File

@ -61,12 +61,14 @@ int handle_file(VDA_FILE_AUX& vf, DB_VDA_FILE& dvf) {
return retval;
}
if (vf.initialized) {
log_messages.printf(MSG_NORMAL, "Getting state\n");
retval = vf.get_state();
if (retval) {
log_messages.printf(MSG_CRITICAL, "vf.get_state failed %d\n", retval);
return retval;
}
} else {
log_messages.printf(MSG_NORMAL, "Initializing\n");
retval = vf.init();
if (retval) {
log_messages.printf(MSG_CRITICAL, "vf.init failed %d\n", retval);
@ -75,11 +77,13 @@ int handle_file(VDA_FILE_AUX& vf, DB_VDA_FILE& dvf) {
sprintf(buf, "initialized=1, chunk_size=%.0f", vf.policy.chunk_size());
dvf.update_field(buf);
}
log_messages.printf(MSG_NORMAL, "Recovery plan:\n");
retval = vf.meta_chunk->recovery_plan();
if (retval) {
log_messages.printf(MSG_CRITICAL, "vf.recovery_plan failed %d\n", retval);
return retval;
}
log_messages.printf(MSG_NORMAL, "Recovery action:\n");
retval = vf.meta_chunk->recovery_action(dtime());
if (retval) {
log_messages.printf(MSG_CRITICAL, "vf.recovery_action failed %d\n", retval);