mirror of https://github.com/BOINC/boinc.git
- lib: change XML_PARSER to handle attributes and spaces in tags.
e.g. it handles <foo /> correctly, and handles <foo attr="x"> (it doesn't return the attributes, but it doesn't choke on them). - GUI RPC client lib: use XML_PARSER to process authorization replies, e.g. so that it handles <authorized /> TODO: use XML_PARSER to parse all GUI RPC requests and replies - web: add a CSS entry for news item titles - web (news items): add an optional "category" field to news items: suggested values: "server status", "news", "emergency". These are not used to display the items, but are passed in the RSS feed and could be used by news aggregators. - manager: replace "BOINC-based account managers" with "account managers" svn path=/trunk/boinc/; revision=16028
This commit is contained in:
parent
7c6a64f9f2
commit
65a1bdab39
|
@ -7573,3 +7573,35 @@ Charlie 19 Sep 2008
|
|||
BOINCTaskBar.cpp
|
||||
MainDocument.cpp,.h
|
||||
sg_BoincSimpleGUI.cpp
|
||||
|
||||
David 19 Sept 2008
|
||||
- lib: change XML_PARSER to handle attributes and spaces in tags.
|
||||
e.g. it handles <foo /> correctly,
|
||||
and handles <foo attr="x">
|
||||
(it doesn't return the attributes, but it doesn't choke on them).
|
||||
- GUI RPC client lib:
|
||||
use XML_PARSER to process authorization replies,
|
||||
e.g. so that it handles <authorized />
|
||||
|
||||
TODO: use XML_PARSER to parse all GUI RPC requests and replies
|
||||
|
||||
- web: add a CSS entry for news item titles
|
||||
- web (news items): add an optional "category" field to news items:
|
||||
suggested values: "server status", "news", "emergency".
|
||||
These are not used to display the items,
|
||||
but are passed in the RSS feed and could be used by news aggregators.
|
||||
- manager: replace "BOINC-based account managers" with "account managers"
|
||||
|
||||
clientgui/
|
||||
AccountManagerInfoPage.cpp
|
||||
html/
|
||||
inc/
|
||||
news.inc
|
||||
project.sample/
|
||||
project_news.inc
|
||||
user/
|
||||
sample_rss_main.php
|
||||
white.css
|
||||
lib/
|
||||
gui_rpc_client.C
|
||||
parse.C
|
||||
|
|
|
@ -182,7 +182,7 @@ void CAccountManagerInfoPage::OnPageChanged( wxWizardExEvent& event ) {
|
|||
_("Account Manager &URL:")
|
||||
);
|
||||
m_pBOINCPromoStaticCtrl->SetLabel(
|
||||
_("For a list of BOINC-based account managers go to:")
|
||||
_("For a list of account managers go to:")
|
||||
);
|
||||
m_pBOINCPromoUrlCtrl->SetLabel(
|
||||
wxT("http://boinc.berkeley.edu/")
|
||||
|
|
|
@ -348,7 +348,7 @@ array('rc.boinc-slackware-linux-latest.txt',
|
|||
'http://markhill.me.uk',
|
||||
'Slackware',
|
||||
'rc.boinc is a script to start BOINC automatically on Slackware Linux. It is written for Slackware Linux but may work on similar Linux distributions',
|
||||
1111810676
|
||||
1221845757
|
||||
),
|
||||
);
|
||||
|
||||
|
|
|
@ -65,7 +65,6 @@ function show_news_items() {
|
|||
<center>
|
||||
<span class=section_title>News</span>
|
||||
</center>
|
||||
<br>
|
||||
";
|
||||
$nnews_items = 6;
|
||||
show_news($project_news, $nnews_items);
|
||||
|
|
|
@ -17,8 +17,11 @@
|
|||
// along with BOINC. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
function news_item($date, $text, $title="") {
|
||||
echo "<span class=\"news_date\">$date</span> <span class=\"news_title\">$title</span>
|
||||
<br><span class=\"news_content\">$text</span><br><br>
|
||||
echo "
|
||||
<span class=news_title>$title</span>
|
||||
<br><span class=news_date>$date</span>
|
||||
<br><span class=news_content>$text</span>
|
||||
<br>
|
||||
";
|
||||
}
|
||||
|
||||
|
@ -27,9 +30,9 @@ function show_news($items, $n) {
|
|||
$n = count($items);
|
||||
}
|
||||
for ($i=0; $i<$n; $i++) {
|
||||
$date = null;
|
||||
if (isset($items[$i][2])) $date = $items[$i][2];
|
||||
news_item($items[$i][0], $items[$i][1], $date);
|
||||
$title = null;
|
||||
if (isset($items[$i][2])) $title = $items[$i][2];
|
||||
news_item($items[$i][0], $items[$i][1], $title);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,14 @@
|
|||
<?php
|
||||
|
||||
// each news item is an array:
|
||||
// 0: date
|
||||
// 1: content
|
||||
// 2: title (optional)
|
||||
// 3: category (optional)
|
||||
// suggested values:
|
||||
// "server status"
|
||||
// "news"
|
||||
// "emergency"
|
||||
$project_news = array(
|
||||
array("March 1, 2004",
|
||||
"Sample news item",
|
||||
|
|
|
@ -80,27 +80,35 @@ echo "<?xml version=\"1.0\" encoding=\"ISO-8859-1\" ?>
|
|||
// write news items
|
||||
//
|
||||
$tot = count($project_news);
|
||||
$news = min( $tot, $news);
|
||||
for( $item=0; $item < $news; $item++ ) {
|
||||
$j = $tot - $item;
|
||||
if( count($project_news[$item]) >= 2) {
|
||||
$d = strtotime($project_news[$item][0]);
|
||||
$news_date=gmdate('D, d M Y H:i:s',$d) . ' GMT';
|
||||
$unique_url=URL_BASE."all_news.php#$j";
|
||||
if (isset($project_news[$item][2])) {
|
||||
$title = strip_tags($project_news[$item][2]);
|
||||
} else {
|
||||
$title = "Project News ".strip_tags($project_news[$item][0]);
|
||||
}
|
||||
echo "<item>
|
||||
<title>".$title."</title>
|
||||
<link>$unique_url</link>
|
||||
<guid isPermaLink=\"true\">$unique_url</guid>
|
||||
<description><![CDATA[".strip_tags($project_news[$item][1])."]]></description>
|
||||
<pubDate>$news_date</pubDate>
|
||||
</item>
|
||||
$news = min($tot, $news);
|
||||
for ($i=0; $i < $news; $i++) {
|
||||
$j = $tot - $i;
|
||||
$item = $project_news[$i];
|
||||
if (count($item) < 2) continue;
|
||||
$d = strtotime($item[0]);
|
||||
$news_date=gmdate('D, d M Y H:i:s',$d) . ' GMT';
|
||||
$unique_url=URL_BASE."all_news.php#$j";
|
||||
if (isset($item[2])) {
|
||||
$title = strip_tags($item[2]);
|
||||
} else {
|
||||
$title = "Project News ".strip_tags($$item[0]);
|
||||
}
|
||||
echo "<item>
|
||||
<title>".$title."</title>
|
||||
<link>$unique_url</link>
|
||||
<guid isPermaLink=\"true\">$unique_url</guid>
|
||||
<description><![CDATA[".strip_tags($item[1])."]]></description>
|
||||
<pubDate>$news_date</pubDate>
|
||||
";
|
||||
if (isset($item[3])) {
|
||||
$category = $item[3];
|
||||
echo "
|
||||
<category>$category</category>
|
||||
";
|
||||
}
|
||||
echo "
|
||||
</item>
|
||||
";
|
||||
}
|
||||
|
||||
// Close XML content
|
||||
|
|
|
@ -300,6 +300,9 @@ span.news_date {
|
|||
color: #646464;
|
||||
font-size: 0.9em;
|
||||
}
|
||||
span.news_title {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
span.inboxunread {
|
||||
font-weight: bold;
|
||||
|
|
|
@ -200,16 +200,19 @@ int RPC_CLIENT::init_poll() {
|
|||
}
|
||||
|
||||
int RPC_CLIENT::authorize(const char* passwd) {
|
||||
bool found=false;
|
||||
bool found=false, is_tag, authorized;
|
||||
int retval, n;
|
||||
char buf[256], nonce[256], nonce_hash[256];
|
||||
RPC rpc(this);
|
||||
XML_PARSER xp(&rpc.fin);
|
||||
|
||||
retval = rpc.do_rpc("<auth1/>\n");
|
||||
if (retval) return retval;
|
||||
while (rpc.fin.fgets(buf, 256)) {
|
||||
if (parse_str(buf, "<nonce>", nonce, sizeof(nonce))) {
|
||||
while (!xp.get(buf, sizeof(buf), is_tag)) {
|
||||
if (!is_tag) continue;
|
||||
if (xp.parse_str(buf, "nonce", nonce, sizeof(nonce))) {
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!found) {
|
||||
|
@ -223,9 +226,11 @@ int RPC_CLIENT::authorize(const char* passwd) {
|
|||
sprintf(buf, "<auth2>\n<nonce_hash>%s</nonce_hash>\n</auth2>\n", nonce_hash);
|
||||
retval = rpc.do_rpc(buf);
|
||||
if (retval) return retval;
|
||||
while (rpc.fin.fgets(buf, 256)) {
|
||||
if (match_tag(buf, "<authorized/>")) {
|
||||
return 0;
|
||||
while (!xp.get(buf, sizeof(buf), is_tag)) {
|
||||
if (!is_tag) continue;
|
||||
if (xp.parse_bool(buf, "authorized", authorized)) {
|
||||
if (authorized) return 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return ERR_AUTHENTICATOR;
|
||||
|
|
10
lib/parse.C
10
lib/parse.C
|
@ -461,6 +461,7 @@ int XML_PARSER::scan_comment() {
|
|||
int XML_PARSER::scan_tag(char* buf, int len) {
|
||||
int c;
|
||||
char* buf_start = buf;
|
||||
bool found_space = false;
|
||||
for (int i=0; ; i++) {
|
||||
c = f->_getc();
|
||||
if (c == EOF) return 2;
|
||||
|
@ -468,8 +469,13 @@ int XML_PARSER::scan_tag(char* buf, int len) {
|
|||
*buf = 0;
|
||||
return 0;
|
||||
}
|
||||
if (isspace(c)) {
|
||||
found_space = true;
|
||||
}
|
||||
if (--len > 0) {
|
||||
*buf++ = c;
|
||||
if (c == '/' || !found_space) {
|
||||
*buf++ = c;
|
||||
}
|
||||
}
|
||||
|
||||
// check for comment start
|
||||
|
@ -803,7 +809,7 @@ void parse(FILE* f) {
|
|||
printf("got bool: %d\n", flag);
|
||||
} else {
|
||||
printf("unparsed tag: %s\n", tag);
|
||||
xp.skip_unexpected(tag);
|
||||
xp.skip_unexpected(tag, true, "xml test");
|
||||
}
|
||||
}
|
||||
printf("unexpected EOF\n");
|
||||
|
|
Loading…
Reference in New Issue