Fossil SCM
Remove unsupported and incomplete webpage functionality: The admin_sql page and the "my" page.
Commit
07f6780c981a2a69fadac09d51dff77c7d11ec43
Parent
ef432c201469375…
8 files changed
-90
-163
+9
-3
+2
-32
-3
-156
+1
-22
-292
D
src/admin.c
-90
| --- a/src/admin.c | ||
| +++ b/src/admin.c | ||
| @@ -1,90 +0,0 @@ | ||
| 1 | -/* | |
| 2 | -** Copyright (c) 2007 D. Richard Hipp | |
| 3 | -** Copyright (c) 2008 Stephan Beal | |
| 4 | -** | |
| 5 | -** This program is free software; you can redistribute it and/or | |
| 6 | -** modify it under the terms of the GNU General Public | |
| 7 | -** License as published by the Free Software Foundation; either | |
| 8 | -** version 2 of the License, or (at your option) any later version. | |
| 9 | -** | |
| 10 | -** This program is distributed in the hope that it will be useful, | |
| 11 | -** but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 12 | -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
| 13 | -** General Public License for more details. | |
| 14 | -** | |
| 15 | -** You should have received a copy of the GNU General Public | |
| 16 | -** License along with this library; if not, write to the | |
| 17 | -** Free Software Foundation, Inc., 59 Temple Place - Suite 330, | |
| 18 | -** Boston, MA 02111-1307, USA. | |
| 19 | -** | |
| 20 | -** Author contact information: | |
| 21 | -** [email protected] | |
| 22 | -** http://www.hwaci.com/drh/ | |
| 23 | -** | |
| 24 | -******************************************************************************* | |
| 25 | -** | |
| 26 | -** Implementation of the Admin SQL | |
| 27 | -*/ | |
| 28 | -#include <assert.h> | |
| 29 | -#include "config.h" | |
| 30 | -#include "admin.h" | |
| 31 | - | |
| 32 | -/* | |
| 33 | -** This SQLite authorizer callback prevents any SQL other than | |
| 34 | -** SELECT statements from running. | |
| 35 | -*/ | |
| 36 | -static int selectOnly( | |
| 37 | - void *NotUsed, /* Application data - not used */ | |
| 38 | - int type, /* Operation type */ | |
| 39 | - const char *zArg1, /* Arguments.... */ | |
| 40 | - const char *zArg2, | |
| 41 | - const char *zArg3, | |
| 42 | - const char *zArg4 | |
| 43 | -){ | |
| 44 | - int rc = SQLITE_DENY; | |
| 45 | - switch( type ){ | |
| 46 | - case SQLITE_READ: { | |
| 47 | - if( strcmp(zArg2,"pw")==0 ){ | |
| 48 | - rc = SQLITE_IGNORE; | |
| 49 | - }else{ | |
| 50 | - rc = SQLITE_OK; | |
| 51 | - } | |
| 52 | - break; | |
| 53 | - } | |
| 54 | - case SQLITE_FUNCTION: | |
| 55 | - case SQLITE_SELECT: { | |
| 56 | - rc = SQLITE_OK; | |
| 57 | - break; | |
| 58 | - } | |
| 59 | - } | |
| 60 | - return rc; | |
| 61 | -} | |
| 62 | - | |
| 63 | -/* | |
| 64 | -** WEBPAGE: admin_sql | |
| 65 | -*/ | |
| 66 | -void admin_sql_page(void){ | |
| 67 | - const char *zSql = PD("sql",""); | |
| 68 | - login_check_credentials(); | |
| 69 | - if( !g.okAdmin ){ | |
| 70 | - login_needed(); | |
| 71 | - return; | |
| 72 | - } | |
| 73 | - style_header("Admin SQL"); | |
| 74 | - @ <h2>SQL:</h2> | |
| 75 | - @ You can enter only SELECT statements here, and some SQL-side functions | |
| 76 | - @ are also restricted.<br/> | |
| 77 | - @ <form action='' method='post'> | |
| 78 | - login_insert_csrf_secret(); | |
| 79 | - @ <textarea style='border:2px solid black' name='sql' | |
| 80 | - @ cols='80' rows='5'>%h(zSql)</textarea> | |
| 81 | - @ <br/><input type='submit' name='sql_submit'/> <input type='reset'/> | |
| 82 | - @ </form> | |
| 83 | - if( zSql[0] ){ | |
| 84 | - login_verify_csrf_secret(); | |
| 85 | - sqlite3_set_authorizer(g.db, selectOnly, 0); | |
| 86 | - db_generic_query_view(zSql, 0); | |
| 87 | - sqlite3_set_authorizer(g.db, 0, 0); | |
| 88 | - } | |
| 89 | - style_footer(); | |
| 90 | -} |
| --- a/src/admin.c | |
| +++ b/src/admin.c | |
| @@ -1,90 +0,0 @@ | |
| 1 | /* |
| 2 | ** Copyright (c) 2007 D. Richard Hipp |
| 3 | ** Copyright (c) 2008 Stephan Beal |
| 4 | ** |
| 5 | ** This program is free software; you can redistribute it and/or |
| 6 | ** modify it under the terms of the GNU General Public |
| 7 | ** License as published by the Free Software Foundation; either |
| 8 | ** version 2 of the License, or (at your option) any later version. |
| 9 | ** |
| 10 | ** This program is distributed in the hope that it will be useful, |
| 11 | ** but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 13 | ** General Public License for more details. |
| 14 | ** |
| 15 | ** You should have received a copy of the GNU General Public |
| 16 | ** License along with this library; if not, write to the |
| 17 | ** Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
| 18 | ** Boston, MA 02111-1307, USA. |
| 19 | ** |
| 20 | ** Author contact information: |
| 21 | ** [email protected] |
| 22 | ** http://www.hwaci.com/drh/ |
| 23 | ** |
| 24 | ******************************************************************************* |
| 25 | ** |
| 26 | ** Implementation of the Admin SQL |
| 27 | */ |
| 28 | #include <assert.h> |
| 29 | #include "config.h" |
| 30 | #include "admin.h" |
| 31 | |
| 32 | /* |
| 33 | ** This SQLite authorizer callback prevents any SQL other than |
| 34 | ** SELECT statements from running. |
| 35 | */ |
| 36 | static int selectOnly( |
| 37 | void *NotUsed, /* Application data - not used */ |
| 38 | int type, /* Operation type */ |
| 39 | const char *zArg1, /* Arguments.... */ |
| 40 | const char *zArg2, |
| 41 | const char *zArg3, |
| 42 | const char *zArg4 |
| 43 | ){ |
| 44 | int rc = SQLITE_DENY; |
| 45 | switch( type ){ |
| 46 | case SQLITE_READ: { |
| 47 | if( strcmp(zArg2,"pw")==0 ){ |
| 48 | rc = SQLITE_IGNORE; |
| 49 | }else{ |
| 50 | rc = SQLITE_OK; |
| 51 | } |
| 52 | break; |
| 53 | } |
| 54 | case SQLITE_FUNCTION: |
| 55 | case SQLITE_SELECT: { |
| 56 | rc = SQLITE_OK; |
| 57 | break; |
| 58 | } |
| 59 | } |
| 60 | return rc; |
| 61 | } |
| 62 | |
| 63 | /* |
| 64 | ** WEBPAGE: admin_sql |
| 65 | */ |
| 66 | void admin_sql_page(void){ |
| 67 | const char *zSql = PD("sql",""); |
| 68 | login_check_credentials(); |
| 69 | if( !g.okAdmin ){ |
| 70 | login_needed(); |
| 71 | return; |
| 72 | } |
| 73 | style_header("Admin SQL"); |
| 74 | @ <h2>SQL:</h2> |
| 75 | @ You can enter only SELECT statements here, and some SQL-side functions |
| 76 | @ are also restricted.<br/> |
| 77 | @ <form action='' method='post'> |
| 78 | login_insert_csrf_secret(); |
| 79 | @ <textarea style='border:2px solid black' name='sql' |
| 80 | @ cols='80' rows='5'>%h(zSql)</textarea> |
| 81 | @ <br/><input type='submit' name='sql_submit'/> <input type='reset'/> |
| 82 | @ </form> |
| 83 | if( zSql[0] ){ |
| 84 | login_verify_csrf_secret(); |
| 85 | sqlite3_set_authorizer(g.db, selectOnly, 0); |
| 86 | db_generic_query_view(zSql, 0); |
| 87 | sqlite3_set_authorizer(g.db, 0, 0); |
| 88 | } |
| 89 | style_footer(); |
| 90 | } |
| --- a/src/admin.c | |
| +++ b/src/admin.c | |
| @@ -1,90 +0,0 @@ | |
M
src/db.c
-163
| --- src/db.c | ||
| +++ src/db.c | ||
| @@ -1514,168 +1514,5 @@ | ||
| 1514 | 1514 | } |
| 1515 | 1515 | }else{ |
| 1516 | 1516 | usage("?PROPERTY? ?VALUE?"); |
| 1517 | 1517 | } |
| 1518 | 1518 | } |
| 1519 | - | |
| 1520 | -/* | |
| 1521 | -** SQL function to render a UUID as a hyperlink to a page describing | |
| 1522 | -** that UUID. | |
| 1523 | -*/ | |
| 1524 | -static void hyperlinkUuidFunc( | |
| 1525 | - sqlite3_context *pCxt, /* function context */ | |
| 1526 | - int argc, /* number of arguments to the function */ | |
| 1527 | - sqlite3_value **argv /* values of all function arguments */ | |
| 1528 | -){ | |
| 1529 | - const char *zUuid; /* The UUID to render */ | |
| 1530 | - char *z; /* Rendered HTML text */ | |
| 1531 | - | |
| 1532 | - zUuid = (const char*)sqlite3_value_text(argv[0]); | |
| 1533 | - if( g.okHistory && zUuid && strlen(zUuid)>=10 ){ | |
| 1534 | - z = mprintf("<tt><a href='%s/info/%t'><span style='font-size:1.5em'>" | |
| 1535 | - "%#h</span>%h</a></tt>", | |
| 1536 | - g.zBaseURL, zUuid, 10, zUuid, &zUuid[10]); | |
| 1537 | - sqlite3_result_text(pCxt, z, -1, free); | |
| 1538 | - }else{ | |
| 1539 | - sqlite3_result_text(pCxt, zUuid, -1, SQLITE_TRANSIENT); | |
| 1540 | - } | |
| 1541 | -} | |
| 1542 | - | |
| 1543 | -/* | |
| 1544 | -** SQL function to render a TAGID as a hyperlink to a page describing | |
| 1545 | -** that tag. | |
| 1546 | -*/ | |
| 1547 | -static void hyperlinkTagidFunc( | |
| 1548 | - sqlite3_context *pCxt, /* function context */ | |
| 1549 | - int argc, /* number of arguments to the function */ | |
| 1550 | - sqlite3_value **argv /* values of all function arguments */ | |
| 1551 | -){ | |
| 1552 | - int tagid; /* The tagid to render */ | |
| 1553 | - char *z; /* rendered html text */ | |
| 1554 | - | |
| 1555 | - tagid = sqlite3_value_int(argv[0]); | |
| 1556 | - if( g.okHistory ){ | |
| 1557 | - z = mprintf("<a href='%s/tagview?tagid=%d'>%d</a>", | |
| 1558 | - g.zBaseURL, tagid, tagid); | |
| 1559 | - }else{ | |
| 1560 | - z = mprintf("%d", tagid); | |
| 1561 | - } | |
| 1562 | - sqlite3_result_text(pCxt, z, -1, free); | |
| 1563 | -} | |
| 1564 | - | |
| 1565 | -/* | |
| 1566 | -** SQL function to render a TAGNAME as a hyperlink to a page describing | |
| 1567 | -** that tag. | |
| 1568 | -*/ | |
| 1569 | -static void hyperlinkTagnameFunc( | |
| 1570 | - sqlite3_context *pCxt, /* function context */ | |
| 1571 | - int argc, /* number of arguments to the function */ | |
| 1572 | - sqlite3_value **argv /* values of all function arguments */ | |
| 1573 | -){ | |
| 1574 | - const char *zTag; /* The tag to render */ | |
| 1575 | - char *z; /* rendered html text */ | |
| 1576 | - | |
| 1577 | - zTag = (const char*)sqlite3_value_text(argv[0]); | |
| 1578 | - if( g.okHistory ){ | |
| 1579 | - z = mprintf("<a href='%s/tagview?name=%T&raw=y'>%h</a>", | |
| 1580 | - g.zBaseURL, zTag, zTag); | |
| 1581 | - }else{ | |
| 1582 | - z = mprintf("%h", zTag); | |
| 1583 | - } | |
| 1584 | - sqlite3_result_text(pCxt, z, -1, free); | |
| 1585 | -} | |
| 1586 | - | |
| 1587 | -/* | |
| 1588 | -** SQL function to escape all characters in a string that have special | |
| 1589 | -** meaning to HTML. | |
| 1590 | -*/ | |
| 1591 | -static void htmlizeFunc( | |
| 1592 | - sqlite3_context *pCxt, /* function context */ | |
| 1593 | - int argc, /* number of arguments to the function */ | |
| 1594 | - sqlite3_value **argv /* values of all function arguments */ | |
| 1595 | -){ | |
| 1596 | - const char *zText; /* Text to be htmlized */ | |
| 1597 | - char *z; /* rendered html text */ | |
| 1598 | - | |
| 1599 | - zText = (const char*)sqlite3_value_text(argv[0]); | |
| 1600 | - z = htmlize(zText, -1); | |
| 1601 | - sqlite3_result_text(pCxt, z, -1, free); | |
| 1602 | -} | |
| 1603 | - | |
| 1604 | -/* | |
| 1605 | -** This routine is a helper to run an SQL query and table-ize the | |
| 1606 | -** results. | |
| 1607 | -** | |
| 1608 | -** The zSql parameter should be a single, complete SQL statement. | |
| 1609 | -** Tableized output of the SQL statement is rendered back to the client. | |
| 1610 | -** | |
| 1611 | -** The isSafe flag is true if all query results have been processed | |
| 1612 | -** by routines such as | |
| 1613 | -** | |
| 1614 | -** linkuuid() | |
| 1615 | -** linktagid() | |
| 1616 | -** linktagname() | |
| 1617 | -** htmlize() | |
| 1618 | -** | |
| 1619 | -** and are therefore safe for direct rendering. If isSafe is false, | |
| 1620 | -** then all characters in the query result that have special meaning | |
| 1621 | -** to HTML are escaped. | |
| 1622 | -** | |
| 1623 | -** Returns SQLITE_OK on success and any other value on error. | |
| 1624 | -*/ | |
| 1625 | -int db_generic_query_view(const char *zSql, int isSafe){ | |
| 1626 | - sqlite3_stmt *pStmt; | |
| 1627 | - int rc; | |
| 1628 | - int nCol, i; | |
| 1629 | - int nRow; | |
| 1630 | - const char *zRow; | |
| 1631 | - static int once = 1; | |
| 1632 | - | |
| 1633 | - /* Install the special functions on the first call to this routine */ | |
| 1634 | - if( once ){ | |
| 1635 | - once = 0; | |
| 1636 | - sqlite3_create_function(g.db, "linkuuid", 1, SQLITE_UTF8, 0, | |
| 1637 | - hyperlinkUuidFunc, 0, 0); | |
| 1638 | - sqlite3_create_function(g.db, "linktagid", 1, SQLITE_UTF8, 0, | |
| 1639 | - hyperlinkTagidFunc, 0, 0); | |
| 1640 | - sqlite3_create_function(g.db, "linktagname", 1, SQLITE_UTF8, 0, | |
| 1641 | - hyperlinkTagnameFunc, 0, 0); | |
| 1642 | - sqlite3_create_function(g.db, "htmlize", 1, SQLITE_UTF8, 0, | |
| 1643 | - htmlizeFunc, 0, 0); | |
| 1644 | - } | |
| 1645 | - | |
| 1646 | - /* | |
| 1647 | - ** Use sqlite3_stmt directly rather than going through db_prepare(), | |
| 1648 | - ** so that we can treat errors a non-fatal. | |
| 1649 | - */ | |
| 1650 | - rc = sqlite3_prepare(g.db, zSql, -1, &pStmt, 0); | |
| 1651 | - if( SQLITE_OK != rc ){ | |
| 1652 | - @ <span style='color:red'>db_generic_query_view() SQL error: | |
| 1653 | - @ %h(sqlite3_errmsg(g.db))</span> | |
| 1654 | - return rc; | |
| 1655 | - } | |
| 1656 | - nCol = sqlite3_column_count(pStmt); | |
| 1657 | - @ <table class='fossil_db_generic_query_view'><tbody> | |
| 1658 | - @ <tr class='header'> | |
| 1659 | - for(i=0; i<nCol; ++i){ | |
| 1660 | - @ <td>%h(sqlite3_column_name(pStmt,i))</td> | |
| 1661 | - } | |
| 1662 | - @ </tr> | |
| 1663 | - | |
| 1664 | - nRow = 0; | |
| 1665 | - while( SQLITE_ROW==sqlite3_step(pStmt) ){ | |
| 1666 | - const char *azClass[] = { "even", "odd" }; | |
| 1667 | - @ <tr class='%s(azClass[(nRow++)&1])'> | |
| 1668 | - for(i=0; i<nCol; i++){ | |
| 1669 | - zRow = (char const*)sqlite3_column_text(pStmt,i); | |
| 1670 | - if( isSafe ){ | |
| 1671 | - @ <td>%s(zRow)</td> | |
| 1672 | - }else{ | |
| 1673 | - @ <td>%h(zRow)</td> | |
| 1674 | - } | |
| 1675 | - } | |
| 1676 | - @ </tr> | |
| 1677 | - } | |
| 1678 | - @ </tbody></table> | |
| 1679 | - sqlite3_finalize(pStmt); | |
| 1680 | - return SQLITE_OK; | |
| 1681 | -} | |
| 1682 | 1519 |
| --- src/db.c | |
| +++ src/db.c | |
| @@ -1514,168 +1514,5 @@ | |
| 1514 | } |
| 1515 | }else{ |
| 1516 | usage("?PROPERTY? ?VALUE?"); |
| 1517 | } |
| 1518 | } |
| 1519 | |
| 1520 | /* |
| 1521 | ** SQL function to render a UUID as a hyperlink to a page describing |
| 1522 | ** that UUID. |
| 1523 | */ |
| 1524 | static void hyperlinkUuidFunc( |
| 1525 | sqlite3_context *pCxt, /* function context */ |
| 1526 | int argc, /* number of arguments to the function */ |
| 1527 | sqlite3_value **argv /* values of all function arguments */ |
| 1528 | ){ |
| 1529 | const char *zUuid; /* The UUID to render */ |
| 1530 | char *z; /* Rendered HTML text */ |
| 1531 | |
| 1532 | zUuid = (const char*)sqlite3_value_text(argv[0]); |
| 1533 | if( g.okHistory && zUuid && strlen(zUuid)>=10 ){ |
| 1534 | z = mprintf("<tt><a href='%s/info/%t'><span style='font-size:1.5em'>" |
| 1535 | "%#h</span>%h</a></tt>", |
| 1536 | g.zBaseURL, zUuid, 10, zUuid, &zUuid[10]); |
| 1537 | sqlite3_result_text(pCxt, z, -1, free); |
| 1538 | }else{ |
| 1539 | sqlite3_result_text(pCxt, zUuid, -1, SQLITE_TRANSIENT); |
| 1540 | } |
| 1541 | } |
| 1542 | |
| 1543 | /* |
| 1544 | ** SQL function to render a TAGID as a hyperlink to a page describing |
| 1545 | ** that tag. |
| 1546 | */ |
| 1547 | static void hyperlinkTagidFunc( |
| 1548 | sqlite3_context *pCxt, /* function context */ |
| 1549 | int argc, /* number of arguments to the function */ |
| 1550 | sqlite3_value **argv /* values of all function arguments */ |
| 1551 | ){ |
| 1552 | int tagid; /* The tagid to render */ |
| 1553 | char *z; /* rendered html text */ |
| 1554 | |
| 1555 | tagid = sqlite3_value_int(argv[0]); |
| 1556 | if( g.okHistory ){ |
| 1557 | z = mprintf("<a href='%s/tagview?tagid=%d'>%d</a>", |
| 1558 | g.zBaseURL, tagid, tagid); |
| 1559 | }else{ |
| 1560 | z = mprintf("%d", tagid); |
| 1561 | } |
| 1562 | sqlite3_result_text(pCxt, z, -1, free); |
| 1563 | } |
| 1564 | |
| 1565 | /* |
| 1566 | ** SQL function to render a TAGNAME as a hyperlink to a page describing |
| 1567 | ** that tag. |
| 1568 | */ |
| 1569 | static void hyperlinkTagnameFunc( |
| 1570 | sqlite3_context *pCxt, /* function context */ |
| 1571 | int argc, /* number of arguments to the function */ |
| 1572 | sqlite3_value **argv /* values of all function arguments */ |
| 1573 | ){ |
| 1574 | const char *zTag; /* The tag to render */ |
| 1575 | char *z; /* rendered html text */ |
| 1576 | |
| 1577 | zTag = (const char*)sqlite3_value_text(argv[0]); |
| 1578 | if( g.okHistory ){ |
| 1579 | z = mprintf("<a href='%s/tagview?name=%T&raw=y'>%h</a>", |
| 1580 | g.zBaseURL, zTag, zTag); |
| 1581 | }else{ |
| 1582 | z = mprintf("%h", zTag); |
| 1583 | } |
| 1584 | sqlite3_result_text(pCxt, z, -1, free); |
| 1585 | } |
| 1586 | |
| 1587 | /* |
| 1588 | ** SQL function to escape all characters in a string that have special |
| 1589 | ** meaning to HTML. |
| 1590 | */ |
| 1591 | static void htmlizeFunc( |
| 1592 | sqlite3_context *pCxt, /* function context */ |
| 1593 | int argc, /* number of arguments to the function */ |
| 1594 | sqlite3_value **argv /* values of all function arguments */ |
| 1595 | ){ |
| 1596 | const char *zText; /* Text to be htmlized */ |
| 1597 | char *z; /* rendered html text */ |
| 1598 | |
| 1599 | zText = (const char*)sqlite3_value_text(argv[0]); |
| 1600 | z = htmlize(zText, -1); |
| 1601 | sqlite3_result_text(pCxt, z, -1, free); |
| 1602 | } |
| 1603 | |
| 1604 | /* |
| 1605 | ** This routine is a helper to run an SQL query and table-ize the |
| 1606 | ** results. |
| 1607 | ** |
| 1608 | ** The zSql parameter should be a single, complete SQL statement. |
| 1609 | ** Tableized output of the SQL statement is rendered back to the client. |
| 1610 | ** |
| 1611 | ** The isSafe flag is true if all query results have been processed |
| 1612 | ** by routines such as |
| 1613 | ** |
| 1614 | ** linkuuid() |
| 1615 | ** linktagid() |
| 1616 | ** linktagname() |
| 1617 | ** htmlize() |
| 1618 | ** |
| 1619 | ** and are therefore safe for direct rendering. If isSafe is false, |
| 1620 | ** then all characters in the query result that have special meaning |
| 1621 | ** to HTML are escaped. |
| 1622 | ** |
| 1623 | ** Returns SQLITE_OK on success and any other value on error. |
| 1624 | */ |
| 1625 | int db_generic_query_view(const char *zSql, int isSafe){ |
| 1626 | sqlite3_stmt *pStmt; |
| 1627 | int rc; |
| 1628 | int nCol, i; |
| 1629 | int nRow; |
| 1630 | const char *zRow; |
| 1631 | static int once = 1; |
| 1632 | |
| 1633 | /* Install the special functions on the first call to this routine */ |
| 1634 | if( once ){ |
| 1635 | once = 0; |
| 1636 | sqlite3_create_function(g.db, "linkuuid", 1, SQLITE_UTF8, 0, |
| 1637 | hyperlinkUuidFunc, 0, 0); |
| 1638 | sqlite3_create_function(g.db, "linktagid", 1, SQLITE_UTF8, 0, |
| 1639 | hyperlinkTagidFunc, 0, 0); |
| 1640 | sqlite3_create_function(g.db, "linktagname", 1, SQLITE_UTF8, 0, |
| 1641 | hyperlinkTagnameFunc, 0, 0); |
| 1642 | sqlite3_create_function(g.db, "htmlize", 1, SQLITE_UTF8, 0, |
| 1643 | htmlizeFunc, 0, 0); |
| 1644 | } |
| 1645 | |
| 1646 | /* |
| 1647 | ** Use sqlite3_stmt directly rather than going through db_prepare(), |
| 1648 | ** so that we can treat errors a non-fatal. |
| 1649 | */ |
| 1650 | rc = sqlite3_prepare(g.db, zSql, -1, &pStmt, 0); |
| 1651 | if( SQLITE_OK != rc ){ |
| 1652 | @ <span style='color:red'>db_generic_query_view() SQL error: |
| 1653 | @ %h(sqlite3_errmsg(g.db))</span> |
| 1654 | return rc; |
| 1655 | } |
| 1656 | nCol = sqlite3_column_count(pStmt); |
| 1657 | @ <table class='fossil_db_generic_query_view'><tbody> |
| 1658 | @ <tr class='header'> |
| 1659 | for(i=0; i<nCol; ++i){ |
| 1660 | @ <td>%h(sqlite3_column_name(pStmt,i))</td> |
| 1661 | } |
| 1662 | @ </tr> |
| 1663 | |
| 1664 | nRow = 0; |
| 1665 | while( SQLITE_ROW==sqlite3_step(pStmt) ){ |
| 1666 | const char *azClass[] = { "even", "odd" }; |
| 1667 | @ <tr class='%s(azClass[(nRow++)&1])'> |
| 1668 | for(i=0; i<nCol; i++){ |
| 1669 | zRow = (char const*)sqlite3_column_text(pStmt,i); |
| 1670 | if( isSafe ){ |
| 1671 | @ <td>%s(zRow)</td> |
| 1672 | }else{ |
| 1673 | @ <td>%h(zRow)</td> |
| 1674 | } |
| 1675 | } |
| 1676 | @ </tr> |
| 1677 | } |
| 1678 | @ </tbody></table> |
| 1679 | sqlite3_finalize(pStmt); |
| 1680 | return SQLITE_OK; |
| 1681 | } |
| 1682 |
| --- src/db.c | |
| +++ src/db.c | |
| @@ -1514,168 +1514,5 @@ | |
| 1514 | } |
| 1515 | }else{ |
| 1516 | usage("?PROPERTY? ?VALUE?"); |
| 1517 | } |
| 1518 | } |
| 1519 |
+9
-3
| --- src/login.c | ||
| +++ src/login.c | ||
| @@ -103,14 +103,20 @@ | ||
| 103 | 103 | " AND length(pw)>0 AND length(cap)>0"); |
| 104 | 104 | return uid; |
| 105 | 105 | } |
| 106 | 106 | |
| 107 | 107 | /* |
| 108 | -** WEBPAGE: /login | |
| 109 | -** WEBPAGE: /logout | |
| 108 | +** WEBPAGE: login | |
| 109 | +** WEBPAGE: logout | |
| 110 | +** WEBPAGE: my | |
| 111 | +** | |
| 112 | +** Generate the login page. | |
| 110 | 113 | ** |
| 111 | -** Generate the login page | |
| 114 | +** There used to be a page named "my" that was designed to show information | |
| 115 | +** about a specific user. The "my" page was linked from the "Logged in as USER" | |
| 116 | +** line on the title bar. The "my" page was never completed so it is now | |
| 117 | +** removed. Use this page as a placeholder in older installations. | |
| 112 | 118 | */ |
| 113 | 119 | void login_page(void){ |
| 114 | 120 | const char *zUsername, *zPasswd; |
| 115 | 121 | const char *zNew1, *zNew2; |
| 116 | 122 | const char *zAnonPw = 0; |
| 117 | 123 |
| --- src/login.c | |
| +++ src/login.c | |
| @@ -103,14 +103,20 @@ | |
| 103 | " AND length(pw)>0 AND length(cap)>0"); |
| 104 | return uid; |
| 105 | } |
| 106 | |
| 107 | /* |
| 108 | ** WEBPAGE: /login |
| 109 | ** WEBPAGE: /logout |
| 110 | ** |
| 111 | ** Generate the login page |
| 112 | */ |
| 113 | void login_page(void){ |
| 114 | const char *zUsername, *zPasswd; |
| 115 | const char *zNew1, *zNew2; |
| 116 | const char *zAnonPw = 0; |
| 117 |
| --- src/login.c | |
| +++ src/login.c | |
| @@ -103,14 +103,20 @@ | |
| 103 | " AND length(pw)>0 AND length(cap)>0"); |
| 104 | return uid; |
| 105 | } |
| 106 | |
| 107 | /* |
| 108 | ** WEBPAGE: login |
| 109 | ** WEBPAGE: logout |
| 110 | ** WEBPAGE: my |
| 111 | ** |
| 112 | ** Generate the login page. |
| 113 | ** |
| 114 | ** There used to be a page named "my" that was designed to show information |
| 115 | ** about a specific user. The "my" page was linked from the "Logged in as USER" |
| 116 | ** line on the title bar. The "my" page was never completed so it is now |
| 117 | ** removed. Use this page as a placeholder in older installations. |
| 118 | */ |
| 119 | void login_page(void){ |
| 120 | const char *zUsername, *zPasswd; |
| 121 | const char *zNew1, *zNew2; |
| 122 | const char *zAnonPw = 0; |
| 123 |
+2
-32
| --- src/main.mk | ||
| +++ src/main.mk | ||
| @@ -12,11 +12,10 @@ | ||
| 12 | 12 | XTCC = $(TCC) $(CFLAGS) -I. -I$(SRCDIR) |
| 13 | 13 | |
| 14 | 14 | |
| 15 | 15 | SRC = \ |
| 16 | 16 | $(SRCDIR)/add.c \ |
| 17 | - $(SRCDIR)/admin.c \ | |
| 18 | 17 | $(SRCDIR)/allrepo.c \ |
| 19 | 18 | $(SRCDIR)/bag.c \ |
| 20 | 19 | $(SRCDIR)/blob.c \ |
| 21 | 20 | $(SRCDIR)/branch.c \ |
| 22 | 21 | $(SRCDIR)/browse.c \ |
| @@ -47,11 +46,10 @@ | ||
| 47 | 46 | $(SRCDIR)/main.c \ |
| 48 | 47 | $(SRCDIR)/manifest.c \ |
| 49 | 48 | $(SRCDIR)/md5.c \ |
| 50 | 49 | $(SRCDIR)/merge.c \ |
| 51 | 50 | $(SRCDIR)/merge3.c \ |
| 52 | - $(SRCDIR)/my_page.c \ | |
| 53 | 51 | $(SRCDIR)/name.c \ |
| 54 | 52 | $(SRCDIR)/pivot.c \ |
| 55 | 53 | $(SRCDIR)/pqueue.c \ |
| 56 | 54 | $(SRCDIR)/printf.c \ |
| 57 | 55 | $(SRCDIR)/rebuild.c \ |
| @@ -64,11 +62,10 @@ | ||
| 64 | 62 | $(SRCDIR)/shun.c \ |
| 65 | 63 | $(SRCDIR)/stat.c \ |
| 66 | 64 | $(SRCDIR)/style.c \ |
| 67 | 65 | $(SRCDIR)/sync.c \ |
| 68 | 66 | $(SRCDIR)/tag.c \ |
| 69 | - $(SRCDIR)/tagview.c \ | |
| 70 | 67 | $(SRCDIR)/th_main.c \ |
| 71 | 68 | $(SRCDIR)/timeline.c \ |
| 72 | 69 | $(SRCDIR)/tkt.c \ |
| 73 | 70 | $(SRCDIR)/tktsetup.c \ |
| 74 | 71 | $(SRCDIR)/undo.c \ |
| @@ -83,11 +80,10 @@ | ||
| 83 | 80 | $(SRCDIR)/xfer.c \ |
| 84 | 81 | $(SRCDIR)/zip.c |
| 85 | 82 | |
| 86 | 83 | TRANS_SRC = \ |
| 87 | 84 | add_.c \ |
| 88 | - admin_.c \ | |
| 89 | 85 | allrepo_.c \ |
| 90 | 86 | bag_.c \ |
| 91 | 87 | blob_.c \ |
| 92 | 88 | branch_.c \ |
| 93 | 89 | browse_.c \ |
| @@ -118,11 +114,10 @@ | ||
| 118 | 114 | main_.c \ |
| 119 | 115 | manifest_.c \ |
| 120 | 116 | md5_.c \ |
| 121 | 117 | merge_.c \ |
| 122 | 118 | merge3_.c \ |
| 123 | - my_page_.c \ | |
| 124 | 119 | name_.c \ |
| 125 | 120 | pivot_.c \ |
| 126 | 121 | pqueue_.c \ |
| 127 | 122 | printf_.c \ |
| 128 | 123 | rebuild_.c \ |
| @@ -135,11 +130,10 @@ | ||
| 135 | 130 | shun_.c \ |
| 136 | 131 | stat_.c \ |
| 137 | 132 | style_.c \ |
| 138 | 133 | sync_.c \ |
| 139 | 134 | tag_.c \ |
| 140 | - tagview_.c \ | |
| 141 | 135 | th_main_.c \ |
| 142 | 136 | timeline_.c \ |
| 143 | 137 | tkt_.c \ |
| 144 | 138 | tktsetup_.c \ |
| 145 | 139 | undo_.c \ |
| @@ -154,11 +148,10 @@ | ||
| 154 | 148 | xfer_.c \ |
| 155 | 149 | zip_.c |
| 156 | 150 | |
| 157 | 151 | OBJ = \ |
| 158 | 152 | add.o \ |
| 159 | - admin.o \ | |
| 160 | 153 | allrepo.o \ |
| 161 | 154 | bag.o \ |
| 162 | 155 | blob.o \ |
| 163 | 156 | branch.o \ |
| 164 | 157 | browse.o \ |
| @@ -189,11 +182,10 @@ | ||
| 189 | 182 | main.o \ |
| 190 | 183 | manifest.o \ |
| 191 | 184 | md5.o \ |
| 192 | 185 | merge.o \ |
| 193 | 186 | merge3.o \ |
| 194 | - my_page.o \ | |
| 195 | 187 | name.o \ |
| 196 | 188 | pivot.o \ |
| 197 | 189 | pqueue.o \ |
| 198 | 190 | printf.o \ |
| 199 | 191 | rebuild.o \ |
| @@ -206,11 +198,10 @@ | ||
| 206 | 198 | shun.o \ |
| 207 | 199 | stat.o \ |
| 208 | 200 | style.o \ |
| 209 | 201 | sync.o \ |
| 210 | 202 | tag.o \ |
| 211 | - tagview.o \ | |
| 212 | 203 | th_main.o \ |
| 213 | 204 | timeline.o \ |
| 214 | 205 | tkt.o \ |
| 215 | 206 | tktsetup.o \ |
| 216 | 207 | undo.o \ |
| @@ -264,16 +255,16 @@ | ||
| 264 | 255 | # noop |
| 265 | 256 | |
| 266 | 257 | clean: |
| 267 | 258 | rm -f *.o *_.c $(APPNAME) VERSION.h |
| 268 | 259 | rm -f translate makeheaders mkindex page_index.h headers |
| 269 | - rm -f add.h admin.h allrepo.h bag.h blob.h branch.h browse.h captcha.h cgi.h checkin.h checkout.h clearsign.h clone.h comformat.h configure.h construct.h content.h db.h delta.h deltacmd.h descendants.h diff.h diffcmd.h doc.h encode.h file.h http.h http_socket.h http_transport.h info.h login.h main.h manifest.h md5.h merge.h merge3.h my_page.h name.h pivot.h pqueue.h printf.h rebuild.h report.h rss.h rstats.h schema.h setup.h sha1.h shun.h stat.h style.h sync.h tag.h tagview.h th_main.h timeline.h tkt.h tktsetup.h undo.h update.h url.h user.h verify.h vfile.h wiki.h wikiformat.h winhttp.h xfer.h zip.h | |
| 260 | + rm -f add.h allrepo.h bag.h blob.h branch.h browse.h captcha.h cgi.h checkin.h checkout.h clearsign.h clone.h comformat.h configure.h construct.h content.h db.h delta.h deltacmd.h descendants.h diff.h diffcmd.h doc.h encode.h file.h http.h http_socket.h http_transport.h info.h login.h main.h manifest.h md5.h merge.h merge3.h name.h pivot.h pqueue.h printf.h rebuild.h report.h rss.h rstats.h schema.h setup.h sha1.h shun.h stat.h style.h sync.h tag.h th_main.h timeline.h tkt.h tktsetup.h undo.h update.h url.h user.h verify.h vfile.h wiki.h wikiformat.h winhttp.h xfer.h zip.h | |
| 270 | 261 | |
| 271 | 262 | page_index.h: $(TRANS_SRC) mkindex |
| 272 | 263 | ./mkindex $(TRANS_SRC) >$@ |
| 273 | 264 | headers: page_index.h makeheaders VERSION.h |
| 274 | - ./makeheaders add_.c:add.h admin_.c:admin.h allrepo_.c:allrepo.h bag_.c:bag.h blob_.c:blob.h branch_.c:branch.h browse_.c:browse.h captcha_.c:captcha.h cgi_.c:cgi.h checkin_.c:checkin.h checkout_.c:checkout.h clearsign_.c:clearsign.h clone_.c:clone.h comformat_.c:comformat.h configure_.c:configure.h construct_.c:construct.h content_.c:content.h db_.c:db.h delta_.c:delta.h deltacmd_.c:deltacmd.h descendants_.c:descendants.h diff_.c:diff.h diffcmd_.c:diffcmd.h doc_.c:doc.h encode_.c:encode.h file_.c:file.h http_.c:http.h http_socket_.c:http_socket.h http_transport_.c:http_transport.h info_.c:info.h login_.c:login.h main_.c:main.h manifest_.c:manifest.h md5_.c:md5.h merge_.c:merge.h merge3_.c:merge3.h my_page_.c:my_page.h name_.c:name.h pivot_.c:pivot.h pqueue_.c:pqueue.h printf_.c:printf.h rebuild_.c:rebuild.h report_.c:report.h rss_.c:rss.h rstats_.c:rstats.h schema_.c:schema.h setup_.c:setup.h sha1_.c:sha1.h shun_.c:shun.h stat_.c:stat.h style_.c:style.h sync_.c:sync.h tag_.c:tag.h tagview_.c:tagview.h th_main_.c:th_main.h timeline_.c:timeline.h tkt_.c:tkt.h tktsetup_.c:tktsetup.h undo_.c:undo.h update_.c:update.h url_.c:url.h user_.c:user.h verify_.c:verify.h vfile_.c:vfile.h wiki_.c:wiki.h wikiformat_.c:wikiformat.h winhttp_.c:winhttp.h xfer_.c:xfer.h zip_.c:zip.h $(SRCDIR)/sqlite3.h $(SRCDIR)/th.h VERSION.h | |
| 265 | + ./makeheaders add_.c:add.h allrepo_.c:allrepo.h bag_.c:bag.h blob_.c:blob.h branch_.c:branch.h browse_.c:browse.h captcha_.c:captcha.h cgi_.c:cgi.h checkin_.c:checkin.h checkout_.c:checkout.h clearsign_.c:clearsign.h clone_.c:clone.h comformat_.c:comformat.h configure_.c:configure.h construct_.c:construct.h content_.c:content.h db_.c:db.h delta_.c:delta.h deltacmd_.c:deltacmd.h descendants_.c:descendants.h diff_.c:diff.h diffcmd_.c:diffcmd.h doc_.c:doc.h encode_.c:encode.h file_.c:file.h http_.c:http.h http_socket_.c:http_socket.h http_transport_.c:http_transport.h info_.c:info.h login_.c:login.h main_.c:main.h manifest_.c:manifest.h md5_.c:md5.h merge_.c:merge.h merge3_.c:merge3.h name_.c:name.h pivot_.c:pivot.h pqueue_.c:pqueue.h printf_.c:printf.h rebuild_.c:rebuild.h report_.c:report.h rss_.c:rss.h rstats_.c:rstats.h schema_.c:schema.h setup_.c:setup.h sha1_.c:sha1.h shun_.c:shun.h stat_.c:stat.h style_.c:style.h sync_.c:sync.h tag_.c:tag.h th_main_.c:th_main.h timeline_.c:timeline.h tkt_.c:tkt.h tktsetup_.c:tktsetup.h undo_.c:undo.h update_.c:update.h url_.c:url.h user_.c:user.h verify_.c:verify.h vfile_.c:vfile.h wiki_.c:wiki.h wikiformat_.c:wikiformat.h winhttp_.c:winhttp.h xfer_.c:xfer.h zip_.c:zip.h $(SRCDIR)/sqlite3.h $(SRCDIR)/th.h VERSION.h | |
| 275 | 266 | touch headers |
| 276 | 267 | headers: Makefile |
| 277 | 268 | Makefile: |
| 278 | 269 | add_.c: $(SRCDIR)/add.c translate |
| 279 | 270 | ./translate $(SRCDIR)/add.c >add_.c |
| @@ -280,17 +271,10 @@ | ||
| 280 | 271 | |
| 281 | 272 | add.o: add_.c add.h $(SRCDIR)/config.h |
| 282 | 273 | $(XTCC) -o add.o -c add_.c |
| 283 | 274 | |
| 284 | 275 | add.h: headers |
| 285 | -admin_.c: $(SRCDIR)/admin.c translate | |
| 286 | - ./translate $(SRCDIR)/admin.c >admin_.c | |
| 287 | - | |
| 288 | -admin.o: admin_.c admin.h $(SRCDIR)/config.h | |
| 289 | - $(XTCC) -o admin.o -c admin_.c | |
| 290 | - | |
| 291 | -admin.h: headers | |
| 292 | 276 | allrepo_.c: $(SRCDIR)/allrepo.c translate |
| 293 | 277 | ./translate $(SRCDIR)/allrepo.c >allrepo_.c |
| 294 | 278 | |
| 295 | 279 | allrepo.o: allrepo_.c allrepo.h $(SRCDIR)/config.h |
| 296 | 280 | $(XTCC) -o allrepo.o -c allrepo_.c |
| @@ -525,17 +509,10 @@ | ||
| 525 | 509 | |
| 526 | 510 | merge3.o: merge3_.c merge3.h $(SRCDIR)/config.h |
| 527 | 511 | $(XTCC) -o merge3.o -c merge3_.c |
| 528 | 512 | |
| 529 | 513 | merge3.h: headers |
| 530 | -my_page_.c: $(SRCDIR)/my_page.c translate | |
| 531 | - ./translate $(SRCDIR)/my_page.c >my_page_.c | |
| 532 | - | |
| 533 | -my_page.o: my_page_.c my_page.h $(SRCDIR)/config.h | |
| 534 | - $(XTCC) -o my_page.o -c my_page_.c | |
| 535 | - | |
| 536 | -my_page.h: headers | |
| 537 | 514 | name_.c: $(SRCDIR)/name.c translate |
| 538 | 515 | ./translate $(SRCDIR)/name.c >name_.c |
| 539 | 516 | |
| 540 | 517 | name.o: name_.c name.h $(SRCDIR)/config.h |
| 541 | 518 | $(XTCC) -o name.o -c name_.c |
| @@ -644,17 +621,10 @@ | ||
| 644 | 621 | |
| 645 | 622 | tag.o: tag_.c tag.h $(SRCDIR)/config.h |
| 646 | 623 | $(XTCC) -o tag.o -c tag_.c |
| 647 | 624 | |
| 648 | 625 | tag.h: headers |
| 649 | -tagview_.c: $(SRCDIR)/tagview.c translate | |
| 650 | - ./translate $(SRCDIR)/tagview.c >tagview_.c | |
| 651 | - | |
| 652 | -tagview.o: tagview_.c tagview.h $(SRCDIR)/config.h | |
| 653 | - $(XTCC) -o tagview.o -c tagview_.c | |
| 654 | - | |
| 655 | -tagview.h: headers | |
| 656 | 626 | th_main_.c: $(SRCDIR)/th_main.c translate |
| 657 | 627 | ./translate $(SRCDIR)/th_main.c >th_main_.c |
| 658 | 628 | |
| 659 | 629 | th_main.o: th_main_.c th_main.h $(SRCDIR)/config.h |
| 660 | 630 | $(XTCC) -o th_main.o -c th_main_.c |
| 661 | 631 |
| --- src/main.mk | |
| +++ src/main.mk | |
| @@ -12,11 +12,10 @@ | |
| 12 | XTCC = $(TCC) $(CFLAGS) -I. -I$(SRCDIR) |
| 13 | |
| 14 | |
| 15 | SRC = \ |
| 16 | $(SRCDIR)/add.c \ |
| 17 | $(SRCDIR)/admin.c \ |
| 18 | $(SRCDIR)/allrepo.c \ |
| 19 | $(SRCDIR)/bag.c \ |
| 20 | $(SRCDIR)/blob.c \ |
| 21 | $(SRCDIR)/branch.c \ |
| 22 | $(SRCDIR)/browse.c \ |
| @@ -47,11 +46,10 @@ | |
| 47 | $(SRCDIR)/main.c \ |
| 48 | $(SRCDIR)/manifest.c \ |
| 49 | $(SRCDIR)/md5.c \ |
| 50 | $(SRCDIR)/merge.c \ |
| 51 | $(SRCDIR)/merge3.c \ |
| 52 | $(SRCDIR)/my_page.c \ |
| 53 | $(SRCDIR)/name.c \ |
| 54 | $(SRCDIR)/pivot.c \ |
| 55 | $(SRCDIR)/pqueue.c \ |
| 56 | $(SRCDIR)/printf.c \ |
| 57 | $(SRCDIR)/rebuild.c \ |
| @@ -64,11 +62,10 @@ | |
| 64 | $(SRCDIR)/shun.c \ |
| 65 | $(SRCDIR)/stat.c \ |
| 66 | $(SRCDIR)/style.c \ |
| 67 | $(SRCDIR)/sync.c \ |
| 68 | $(SRCDIR)/tag.c \ |
| 69 | $(SRCDIR)/tagview.c \ |
| 70 | $(SRCDIR)/th_main.c \ |
| 71 | $(SRCDIR)/timeline.c \ |
| 72 | $(SRCDIR)/tkt.c \ |
| 73 | $(SRCDIR)/tktsetup.c \ |
| 74 | $(SRCDIR)/undo.c \ |
| @@ -83,11 +80,10 @@ | |
| 83 | $(SRCDIR)/xfer.c \ |
| 84 | $(SRCDIR)/zip.c |
| 85 | |
| 86 | TRANS_SRC = \ |
| 87 | add_.c \ |
| 88 | admin_.c \ |
| 89 | allrepo_.c \ |
| 90 | bag_.c \ |
| 91 | blob_.c \ |
| 92 | branch_.c \ |
| 93 | browse_.c \ |
| @@ -118,11 +114,10 @@ | |
| 118 | main_.c \ |
| 119 | manifest_.c \ |
| 120 | md5_.c \ |
| 121 | merge_.c \ |
| 122 | merge3_.c \ |
| 123 | my_page_.c \ |
| 124 | name_.c \ |
| 125 | pivot_.c \ |
| 126 | pqueue_.c \ |
| 127 | printf_.c \ |
| 128 | rebuild_.c \ |
| @@ -135,11 +130,10 @@ | |
| 135 | shun_.c \ |
| 136 | stat_.c \ |
| 137 | style_.c \ |
| 138 | sync_.c \ |
| 139 | tag_.c \ |
| 140 | tagview_.c \ |
| 141 | th_main_.c \ |
| 142 | timeline_.c \ |
| 143 | tkt_.c \ |
| 144 | tktsetup_.c \ |
| 145 | undo_.c \ |
| @@ -154,11 +148,10 @@ | |
| 154 | xfer_.c \ |
| 155 | zip_.c |
| 156 | |
| 157 | OBJ = \ |
| 158 | add.o \ |
| 159 | admin.o \ |
| 160 | allrepo.o \ |
| 161 | bag.o \ |
| 162 | blob.o \ |
| 163 | branch.o \ |
| 164 | browse.o \ |
| @@ -189,11 +182,10 @@ | |
| 189 | main.o \ |
| 190 | manifest.o \ |
| 191 | md5.o \ |
| 192 | merge.o \ |
| 193 | merge3.o \ |
| 194 | my_page.o \ |
| 195 | name.o \ |
| 196 | pivot.o \ |
| 197 | pqueue.o \ |
| 198 | printf.o \ |
| 199 | rebuild.o \ |
| @@ -206,11 +198,10 @@ | |
| 206 | shun.o \ |
| 207 | stat.o \ |
| 208 | style.o \ |
| 209 | sync.o \ |
| 210 | tag.o \ |
| 211 | tagview.o \ |
| 212 | th_main.o \ |
| 213 | timeline.o \ |
| 214 | tkt.o \ |
| 215 | tktsetup.o \ |
| 216 | undo.o \ |
| @@ -264,16 +255,16 @@ | |
| 264 | # noop |
| 265 | |
| 266 | clean: |
| 267 | rm -f *.o *_.c $(APPNAME) VERSION.h |
| 268 | rm -f translate makeheaders mkindex page_index.h headers |
| 269 | rm -f add.h admin.h allrepo.h bag.h blob.h branch.h browse.h captcha.h cgi.h checkin.h checkout.h clearsign.h clone.h comformat.h configure.h construct.h content.h db.h delta.h deltacmd.h descendants.h diff.h diffcmd.h doc.h encode.h file.h http.h http_socket.h http_transport.h info.h login.h main.h manifest.h md5.h merge.h merge3.h my_page.h name.h pivot.h pqueue.h printf.h rebuild.h report.h rss.h rstats.h schema.h setup.h sha1.h shun.h stat.h style.h sync.h tag.h tagview.h th_main.h timeline.h tkt.h tktsetup.h undo.h update.h url.h user.h verify.h vfile.h wiki.h wikiformat.h winhttp.h xfer.h zip.h |
| 270 | |
| 271 | page_index.h: $(TRANS_SRC) mkindex |
| 272 | ./mkindex $(TRANS_SRC) >$@ |
| 273 | headers: page_index.h makeheaders VERSION.h |
| 274 | ./makeheaders add_.c:add.h admin_.c:admin.h allrepo_.c:allrepo.h bag_.c:bag.h blob_.c:blob.h branch_.c:branch.h browse_.c:browse.h captcha_.c:captcha.h cgi_.c:cgi.h checkin_.c:checkin.h checkout_.c:checkout.h clearsign_.c:clearsign.h clone_.c:clone.h comformat_.c:comformat.h configure_.c:configure.h construct_.c:construct.h content_.c:content.h db_.c:db.h delta_.c:delta.h deltacmd_.c:deltacmd.h descendants_.c:descendants.h diff_.c:diff.h diffcmd_.c:diffcmd.h doc_.c:doc.h encode_.c:encode.h file_.c:file.h http_.c:http.h http_socket_.c:http_socket.h http_transport_.c:http_transport.h info_.c:info.h login_.c:login.h main_.c:main.h manifest_.c:manifest.h md5_.c:md5.h merge_.c:merge.h merge3_.c:merge3.h my_page_.c:my_page.h name_.c:name.h pivot_.c:pivot.h pqueue_.c:pqueue.h printf_.c:printf.h rebuild_.c:rebuild.h report_.c:report.h rss_.c:rss.h rstats_.c:rstats.h schema_.c:schema.h setup_.c:setup.h sha1_.c:sha1.h shun_.c:shun.h stat_.c:stat.h style_.c:style.h sync_.c:sync.h tag_.c:tag.h tagview_.c:tagview.h th_main_.c:th_main.h timeline_.c:timeline.h tkt_.c:tkt.h tktsetup_.c:tktsetup.h undo_.c:undo.h update_.c:update.h url_.c:url.h user_.c:user.h verify_.c:verify.h vfile_.c:vfile.h wiki_.c:wiki.h wikiformat_.c:wikiformat.h winhttp_.c:winhttp.h xfer_.c:xfer.h zip_.c:zip.h $(SRCDIR)/sqlite3.h $(SRCDIR)/th.h VERSION.h |
| 275 | touch headers |
| 276 | headers: Makefile |
| 277 | Makefile: |
| 278 | add_.c: $(SRCDIR)/add.c translate |
| 279 | ./translate $(SRCDIR)/add.c >add_.c |
| @@ -280,17 +271,10 @@ | |
| 280 | |
| 281 | add.o: add_.c add.h $(SRCDIR)/config.h |
| 282 | $(XTCC) -o add.o -c add_.c |
| 283 | |
| 284 | add.h: headers |
| 285 | admin_.c: $(SRCDIR)/admin.c translate |
| 286 | ./translate $(SRCDIR)/admin.c >admin_.c |
| 287 | |
| 288 | admin.o: admin_.c admin.h $(SRCDIR)/config.h |
| 289 | $(XTCC) -o admin.o -c admin_.c |
| 290 | |
| 291 | admin.h: headers |
| 292 | allrepo_.c: $(SRCDIR)/allrepo.c translate |
| 293 | ./translate $(SRCDIR)/allrepo.c >allrepo_.c |
| 294 | |
| 295 | allrepo.o: allrepo_.c allrepo.h $(SRCDIR)/config.h |
| 296 | $(XTCC) -o allrepo.o -c allrepo_.c |
| @@ -525,17 +509,10 @@ | |
| 525 | |
| 526 | merge3.o: merge3_.c merge3.h $(SRCDIR)/config.h |
| 527 | $(XTCC) -o merge3.o -c merge3_.c |
| 528 | |
| 529 | merge3.h: headers |
| 530 | my_page_.c: $(SRCDIR)/my_page.c translate |
| 531 | ./translate $(SRCDIR)/my_page.c >my_page_.c |
| 532 | |
| 533 | my_page.o: my_page_.c my_page.h $(SRCDIR)/config.h |
| 534 | $(XTCC) -o my_page.o -c my_page_.c |
| 535 | |
| 536 | my_page.h: headers |
| 537 | name_.c: $(SRCDIR)/name.c translate |
| 538 | ./translate $(SRCDIR)/name.c >name_.c |
| 539 | |
| 540 | name.o: name_.c name.h $(SRCDIR)/config.h |
| 541 | $(XTCC) -o name.o -c name_.c |
| @@ -644,17 +621,10 @@ | |
| 644 | |
| 645 | tag.o: tag_.c tag.h $(SRCDIR)/config.h |
| 646 | $(XTCC) -o tag.o -c tag_.c |
| 647 | |
| 648 | tag.h: headers |
| 649 | tagview_.c: $(SRCDIR)/tagview.c translate |
| 650 | ./translate $(SRCDIR)/tagview.c >tagview_.c |
| 651 | |
| 652 | tagview.o: tagview_.c tagview.h $(SRCDIR)/config.h |
| 653 | $(XTCC) -o tagview.o -c tagview_.c |
| 654 | |
| 655 | tagview.h: headers |
| 656 | th_main_.c: $(SRCDIR)/th_main.c translate |
| 657 | ./translate $(SRCDIR)/th_main.c >th_main_.c |
| 658 | |
| 659 | th_main.o: th_main_.c th_main.h $(SRCDIR)/config.h |
| 660 | $(XTCC) -o th_main.o -c th_main_.c |
| 661 |
| --- src/main.mk | |
| +++ src/main.mk | |
| @@ -12,11 +12,10 @@ | |
| 12 | XTCC = $(TCC) $(CFLAGS) -I. -I$(SRCDIR) |
| 13 | |
| 14 | |
| 15 | SRC = \ |
| 16 | $(SRCDIR)/add.c \ |
| 17 | $(SRCDIR)/allrepo.c \ |
| 18 | $(SRCDIR)/bag.c \ |
| 19 | $(SRCDIR)/blob.c \ |
| 20 | $(SRCDIR)/branch.c \ |
| 21 | $(SRCDIR)/browse.c \ |
| @@ -47,11 +46,10 @@ | |
| 46 | $(SRCDIR)/main.c \ |
| 47 | $(SRCDIR)/manifest.c \ |
| 48 | $(SRCDIR)/md5.c \ |
| 49 | $(SRCDIR)/merge.c \ |
| 50 | $(SRCDIR)/merge3.c \ |
| 51 | $(SRCDIR)/name.c \ |
| 52 | $(SRCDIR)/pivot.c \ |
| 53 | $(SRCDIR)/pqueue.c \ |
| 54 | $(SRCDIR)/printf.c \ |
| 55 | $(SRCDIR)/rebuild.c \ |
| @@ -64,11 +62,10 @@ | |
| 62 | $(SRCDIR)/shun.c \ |
| 63 | $(SRCDIR)/stat.c \ |
| 64 | $(SRCDIR)/style.c \ |
| 65 | $(SRCDIR)/sync.c \ |
| 66 | $(SRCDIR)/tag.c \ |
| 67 | $(SRCDIR)/th_main.c \ |
| 68 | $(SRCDIR)/timeline.c \ |
| 69 | $(SRCDIR)/tkt.c \ |
| 70 | $(SRCDIR)/tktsetup.c \ |
| 71 | $(SRCDIR)/undo.c \ |
| @@ -83,11 +80,10 @@ | |
| 80 | $(SRCDIR)/xfer.c \ |
| 81 | $(SRCDIR)/zip.c |
| 82 | |
| 83 | TRANS_SRC = \ |
| 84 | add_.c \ |
| 85 | allrepo_.c \ |
| 86 | bag_.c \ |
| 87 | blob_.c \ |
| 88 | branch_.c \ |
| 89 | browse_.c \ |
| @@ -118,11 +114,10 @@ | |
| 114 | main_.c \ |
| 115 | manifest_.c \ |
| 116 | md5_.c \ |
| 117 | merge_.c \ |
| 118 | merge3_.c \ |
| 119 | name_.c \ |
| 120 | pivot_.c \ |
| 121 | pqueue_.c \ |
| 122 | printf_.c \ |
| 123 | rebuild_.c \ |
| @@ -135,11 +130,10 @@ | |
| 130 | shun_.c \ |
| 131 | stat_.c \ |
| 132 | style_.c \ |
| 133 | sync_.c \ |
| 134 | tag_.c \ |
| 135 | th_main_.c \ |
| 136 | timeline_.c \ |
| 137 | tkt_.c \ |
| 138 | tktsetup_.c \ |
| 139 | undo_.c \ |
| @@ -154,11 +148,10 @@ | |
| 148 | xfer_.c \ |
| 149 | zip_.c |
| 150 | |
| 151 | OBJ = \ |
| 152 | add.o \ |
| 153 | allrepo.o \ |
| 154 | bag.o \ |
| 155 | blob.o \ |
| 156 | branch.o \ |
| 157 | browse.o \ |
| @@ -189,11 +182,10 @@ | |
| 182 | main.o \ |
| 183 | manifest.o \ |
| 184 | md5.o \ |
| 185 | merge.o \ |
| 186 | merge3.o \ |
| 187 | name.o \ |
| 188 | pivot.o \ |
| 189 | pqueue.o \ |
| 190 | printf.o \ |
| 191 | rebuild.o \ |
| @@ -206,11 +198,10 @@ | |
| 198 | shun.o \ |
| 199 | stat.o \ |
| 200 | style.o \ |
| 201 | sync.o \ |
| 202 | tag.o \ |
| 203 | th_main.o \ |
| 204 | timeline.o \ |
| 205 | tkt.o \ |
| 206 | tktsetup.o \ |
| 207 | undo.o \ |
| @@ -264,16 +255,16 @@ | |
| 255 | # noop |
| 256 | |
| 257 | clean: |
| 258 | rm -f *.o *_.c $(APPNAME) VERSION.h |
| 259 | rm -f translate makeheaders mkindex page_index.h headers |
| 260 | rm -f add.h allrepo.h bag.h blob.h branch.h browse.h captcha.h cgi.h checkin.h checkout.h clearsign.h clone.h comformat.h configure.h construct.h content.h db.h delta.h deltacmd.h descendants.h diff.h diffcmd.h doc.h encode.h file.h http.h http_socket.h http_transport.h info.h login.h main.h manifest.h md5.h merge.h merge3.h name.h pivot.h pqueue.h printf.h rebuild.h report.h rss.h rstats.h schema.h setup.h sha1.h shun.h stat.h style.h sync.h tag.h th_main.h timeline.h tkt.h tktsetup.h undo.h update.h url.h user.h verify.h vfile.h wiki.h wikiformat.h winhttp.h xfer.h zip.h |
| 261 | |
| 262 | page_index.h: $(TRANS_SRC) mkindex |
| 263 | ./mkindex $(TRANS_SRC) >$@ |
| 264 | headers: page_index.h makeheaders VERSION.h |
| 265 | ./makeheaders add_.c:add.h allrepo_.c:allrepo.h bag_.c:bag.h blob_.c:blob.h branch_.c:branch.h browse_.c:browse.h captcha_.c:captcha.h cgi_.c:cgi.h checkin_.c:checkin.h checkout_.c:checkout.h clearsign_.c:clearsign.h clone_.c:clone.h comformat_.c:comformat.h configure_.c:configure.h construct_.c:construct.h content_.c:content.h db_.c:db.h delta_.c:delta.h deltacmd_.c:deltacmd.h descendants_.c:descendants.h diff_.c:diff.h diffcmd_.c:diffcmd.h doc_.c:doc.h encode_.c:encode.h file_.c:file.h http_.c:http.h http_socket_.c:http_socket.h http_transport_.c:http_transport.h info_.c:info.h login_.c:login.h main_.c:main.h manifest_.c:manifest.h md5_.c:md5.h merge_.c:merge.h merge3_.c:merge3.h name_.c:name.h pivot_.c:pivot.h pqueue_.c:pqueue.h printf_.c:printf.h rebuild_.c:rebuild.h report_.c:report.h rss_.c:rss.h rstats_.c:rstats.h schema_.c:schema.h setup_.c:setup.h sha1_.c:sha1.h shun_.c:shun.h stat_.c:stat.h style_.c:style.h sync_.c:sync.h tag_.c:tag.h th_main_.c:th_main.h timeline_.c:timeline.h tkt_.c:tkt.h tktsetup_.c:tktsetup.h undo_.c:undo.h update_.c:update.h url_.c:url.h user_.c:user.h verify_.c:verify.h vfile_.c:vfile.h wiki_.c:wiki.h wikiformat_.c:wikiformat.h winhttp_.c:winhttp.h xfer_.c:xfer.h zip_.c:zip.h $(SRCDIR)/sqlite3.h $(SRCDIR)/th.h VERSION.h |
| 266 | touch headers |
| 267 | headers: Makefile |
| 268 | Makefile: |
| 269 | add_.c: $(SRCDIR)/add.c translate |
| 270 | ./translate $(SRCDIR)/add.c >add_.c |
| @@ -280,17 +271,10 @@ | |
| 271 | |
| 272 | add.o: add_.c add.h $(SRCDIR)/config.h |
| 273 | $(XTCC) -o add.o -c add_.c |
| 274 | |
| 275 | add.h: headers |
| 276 | allrepo_.c: $(SRCDIR)/allrepo.c translate |
| 277 | ./translate $(SRCDIR)/allrepo.c >allrepo_.c |
| 278 | |
| 279 | allrepo.o: allrepo_.c allrepo.h $(SRCDIR)/config.h |
| 280 | $(XTCC) -o allrepo.o -c allrepo_.c |
| @@ -525,17 +509,10 @@ | |
| 509 | |
| 510 | merge3.o: merge3_.c merge3.h $(SRCDIR)/config.h |
| 511 | $(XTCC) -o merge3.o -c merge3_.c |
| 512 | |
| 513 | merge3.h: headers |
| 514 | name_.c: $(SRCDIR)/name.c translate |
| 515 | ./translate $(SRCDIR)/name.c >name_.c |
| 516 | |
| 517 | name.o: name_.c name.h $(SRCDIR)/config.h |
| 518 | $(XTCC) -o name.o -c name_.c |
| @@ -644,17 +621,10 @@ | |
| 621 | |
| 622 | tag.o: tag_.c tag.h $(SRCDIR)/config.h |
| 623 | $(XTCC) -o tag.o -c tag_.c |
| 624 | |
| 625 | tag.h: headers |
| 626 | th_main_.c: $(SRCDIR)/th_main.c translate |
| 627 | ./translate $(SRCDIR)/th_main.c >th_main_.c |
| 628 | |
| 629 | th_main.o: th_main_.c th_main.h $(SRCDIR)/config.h |
| 630 | $(XTCC) -o th_main.o -c th_main_.c |
| 631 |
-3
| --- src/makemake.tcl | ||
| +++ src/makemake.tcl | ||
| @@ -6,11 +6,10 @@ | ||
| 6 | 6 | # Basenames of all source files that get preprocessed using |
| 7 | 7 | # "translate" and "makeheaders" |
| 8 | 8 | # |
| 9 | 9 | set src { |
| 10 | 10 | add |
| 11 | - admin | |
| 12 | 11 | allrepo |
| 13 | 12 | bag |
| 14 | 13 | blob |
| 15 | 14 | branch |
| 16 | 15 | browse |
| @@ -41,11 +40,10 @@ | ||
| 41 | 40 | main |
| 42 | 41 | manifest |
| 43 | 42 | md5 |
| 44 | 43 | merge |
| 45 | 44 | merge3 |
| 46 | - my_page | |
| 47 | 45 | name |
| 48 | 46 | pivot |
| 49 | 47 | pqueue |
| 50 | 48 | printf |
| 51 | 49 | rebuild |
| @@ -58,11 +56,10 @@ | ||
| 58 | 56 | shun |
| 59 | 57 | stat |
| 60 | 58 | style |
| 61 | 59 | sync |
| 62 | 60 | tag |
| 63 | - tagview | |
| 64 | 61 | th_main |
| 65 | 62 | timeline |
| 66 | 63 | tkt |
| 67 | 64 | tktsetup |
| 68 | 65 | undo |
| 69 | 66 | |
| 70 | 67 | DELETED src/my_page.c |
| --- src/makemake.tcl | |
| +++ src/makemake.tcl | |
| @@ -6,11 +6,10 @@ | |
| 6 | # Basenames of all source files that get preprocessed using |
| 7 | # "translate" and "makeheaders" |
| 8 | # |
| 9 | set src { |
| 10 | add |
| 11 | admin |
| 12 | allrepo |
| 13 | bag |
| 14 | blob |
| 15 | branch |
| 16 | browse |
| @@ -41,11 +40,10 @@ | |
| 41 | main |
| 42 | manifest |
| 43 | md5 |
| 44 | merge |
| 45 | merge3 |
| 46 | my_page |
| 47 | name |
| 48 | pivot |
| 49 | pqueue |
| 50 | printf |
| 51 | rebuild |
| @@ -58,11 +56,10 @@ | |
| 58 | shun |
| 59 | stat |
| 60 | style |
| 61 | sync |
| 62 | tag |
| 63 | tagview |
| 64 | th_main |
| 65 | timeline |
| 66 | tkt |
| 67 | tktsetup |
| 68 | undo |
| 69 | |
| 70 | ELETED src/my_page.c |
| --- src/makemake.tcl | |
| +++ src/makemake.tcl | |
| @@ -6,11 +6,10 @@ | |
| 6 | # Basenames of all source files that get preprocessed using |
| 7 | # "translate" and "makeheaders" |
| 8 | # |
| 9 | set src { |
| 10 | add |
| 11 | allrepo |
| 12 | bag |
| 13 | blob |
| 14 | branch |
| 15 | browse |
| @@ -41,11 +40,10 @@ | |
| 40 | main |
| 41 | manifest |
| 42 | md5 |
| 43 | merge |
| 44 | merge3 |
| 45 | name |
| 46 | pivot |
| 47 | pqueue |
| 48 | printf |
| 49 | rebuild |
| @@ -58,11 +56,10 @@ | |
| 56 | shun |
| 57 | stat |
| 58 | style |
| 59 | sync |
| 60 | tag |
| 61 | th_main |
| 62 | timeline |
| 63 | tkt |
| 64 | tktsetup |
| 65 | undo |
| 66 | |
| 67 | ELETED src/my_page.c |
D
src/my_page.c
-156
| --- a/src/my_page.c | ||
| +++ b/src/my_page.c | ||
| @@ -1,156 +0,0 @@ | ||
| 1 | -/* | |
| 2 | -** Copyright (c) 2007 D. Richard Hipp | |
| 3 | -** Copyright (c) 2008 Stephan Beal | |
| 4 | -** | |
| 5 | -** This program is free software; you can redistribute it and/or | |
| 6 | -** modify it under the terms of the GNU General Public | |
| 7 | -** License as published by the Free Software Foundation; either | |
| 8 | -** version 2 of the License, or (at your option) any later version. | |
| 9 | -** | |
| 10 | -** This program is distributed in the hope that it will be useful, | |
| 11 | -** but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 12 | -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
| 13 | -** General Public License for more details. | |
| 14 | -** | |
| 15 | -** You should have received a copy of the GNU General Public | |
| 16 | -** License along with this library; if not, write to the | |
| 17 | -** Free Software Foundation, Inc., 59 Temple Place - Suite 330, | |
| 18 | -** Boston, MA 02111-1307, USA. | |
| 19 | -** | |
| 20 | -** Author contact information: | |
| 21 | -** [email protected] | |
| 22 | -** http://www.hwaci.com/drh/ | |
| 23 | -** | |
| 24 | -******************************************************************************* | |
| 25 | -** | |
| 26 | -** Implementation of the Tag View page | |
| 27 | -*/ | |
| 28 | -#include <assert.h> | |
| 29 | -#include "config.h" | |
| 30 | -#include "my_page.h" | |
| 31 | - | |
| 32 | -/* | |
| 33 | -** Renders a logout button. | |
| 34 | -*/ | |
| 35 | -static void mypage_logout_button() | |
| 36 | -{ | |
| 37 | - if( g.zLogin ){ | |
| 38 | - @ <br clear="both"/><hr/> | |
| 39 | - @ <strong>Logout (or "log out", if you prefer):</strong><br/> | |
| 40 | - @ <form action='login' method='POST'> | |
| 41 | - @ <p>To log off the system (and delete your login cookie) | |
| 42 | - @ press the following button:<br> | |
| 43 | - @ <input type="submit" name="out" value="Logout"/></p> | |
| 44 | - @ </form> | |
| 45 | - } | |
| 46 | -} | |
| 47 | - | |
| 48 | -/* | |
| 49 | -** Renders a password changer. | |
| 50 | -*/ | |
| 51 | -static void mypage_password_changer() | |
| 52 | -{ | |
| 53 | - if( g.okPassword ){ | |
| 54 | - @ <br clear="both"/><hr/> | |
| 55 | - @ <strong>Change Password:</strong><br/> | |
| 56 | - @ <p>To change your password, enter your old password and your | |
| 57 | - @ new password twice below then press the "Change Password" | |
| 58 | - @ button.</p> | |
| 59 | - @ <form action="login" method="POST"> | |
| 60 | - @ <input type='hidden' name='g' value='my'/> | |
| 61 | - @ <table><tbody> | |
| 62 | - @ <tr><td align="right">Old Password:</td> | |
| 63 | - @ <td><input type="password" name="p" size=30></td></tr> | |
| 64 | - @ <tr><td align="right">New Password:</td> | |
| 65 | - @ <td><input type="password" name="n1" size=30></td></tr> | |
| 66 | - @ <tr><td align="right">Repeat New Password:</td> | |
| 67 | - @ <td><input type="password" name="n2" size=30></td></tr> | |
| 68 | - @ <tr><td></td> | |
| 69 | - @ <td><input type="submit" value="Change Password"></td></tr> | |
| 70 | - @ </tbody></table> | |
| 71 | - @ </form> | |
| 72 | - } | |
| 73 | - | |
| 74 | -} | |
| 75 | - | |
| 76 | -/* | |
| 77 | -** Default page rendered for /my. | |
| 78 | -*/ | |
| 79 | -static void mypage_page_default() | |
| 80 | -{ | |
| 81 | - int uid = g.userUid; | |
| 82 | - char * sql = mprintf( "SELECT login,cap,info FROM user WHERE uid=%d", | |
| 83 | - uid ); | |
| 84 | - Stmt st; | |
| 85 | - char const *uname; | |
| 86 | - char const *ucap; | |
| 87 | - char const *uinfo; | |
| 88 | - db_prepare( &st, sql ); | |
| 89 | - free( sql ); | |
| 90 | - db_step(&st); | |
| 91 | - uname = db_column_text( &st, 0 ); | |
| 92 | - ucap = db_column_text( &st, 1 ); | |
| 93 | - uinfo = db_column_text( &st, 2 ); | |
| 94 | - | |
| 95 | - @ <h2>Welcome, %s(uname)!</h2> | |
| 96 | - @ Your user ID is: %d(uid)<br/> | |
| 97 | - @ Your Fossil permissions are: [%s(ucap)] | |
| 98 | - @ [TODO: explain these]<br/> | |
| 99 | - if( g.okAdmin ){ | |
| 100 | - @ You are an <a href='%s(g.zBaseURL)/admin'>admin</a>.<br/> | |
| 101 | - } | |
| 102 | - @ Your additional info: [%s(uinfo)] | |
| 103 | - @ [TODO: make this editable]<br/> | |
| 104 | - | |
| 105 | - mypage_logout_button(); | |
| 106 | - | |
| 107 | - @ <hr/> | |
| 108 | - @ <h2>Your artifacts:</h2> | |
| 109 | - @ <ul> | |
| 110 | - @ <li><a href='%s(g.zBaseURL)/timeline?u=%s(uname)&y=ci'>Your latest commits</a>.</li> | |
| 111 | - @ <li><a href='%s(g.zBaseURL)/timeline?u=%s(uname)&y=w'>Your latest wiki changes</a>.</li> | |
| 112 | - @ <li><a href='%s(g.zBaseURL)/timeline?u=%s(uname)&y=t'>Your latest ticket changes</a>.</li> | |
| 113 | - @ <li>TODO: etc. etc. etc.</li> | |
| 114 | - @ </ul> | |
| 115 | - mypage_password_changer(); | |
| 116 | - | |
| 117 | - @ <hr/><h2>TODOs:</h2><ul> | |
| 118 | - @ <li>Change "additional info" field.</li> | |
| 119 | - @ <li>Search for changes made by you.</li> | |
| 120 | - @ <li>Search for files/wiki pages/tickets related to you.</li> | |
| 121 | - @ <li>Allow per-user setup of the page (e.g. reports).</li> | |
| 122 | - @ <li>... the list goes on ...</li> | |
| 123 | - @ </ul> | |
| 124 | - | |
| 125 | - db_finalize( &st ); | |
| 126 | - | |
| 127 | -} | |
| 128 | - | |
| 129 | -/* | |
| 130 | -** WEBPAGE: /my | |
| 131 | -*/ | |
| 132 | -void mypage_page(void){ | |
| 133 | - const char *name; | |
| 134 | - login_check_credentials(); | |
| 135 | - if( !g.okRdWiki ){ | |
| 136 | - login_needed(); | |
| 137 | - } | |
| 138 | - style_header("Your Home"); | |
| 139 | - name = P("name"); | |
| 140 | - if( name ) | |
| 141 | - { | |
| 142 | - if( 0 == strcmp(name,"tickets") ) | |
| 143 | - { | |
| 144 | - @ TODO: Tickets page. | |
| 145 | - } | |
| 146 | - else | |
| 147 | - { | |
| 148 | - @ TODO: handle /my/%s(name) | |
| 149 | - } | |
| 150 | - } | |
| 151 | - else | |
| 152 | - { | |
| 153 | - mypage_page_default(); | |
| 154 | - } | |
| 155 | - style_footer(); | |
| 156 | -} |
| --- a/src/my_page.c | |
| +++ b/src/my_page.c | |
| @@ -1,156 +0,0 @@ | |
| 1 | /* |
| 2 | ** Copyright (c) 2007 D. Richard Hipp |
| 3 | ** Copyright (c) 2008 Stephan Beal |
| 4 | ** |
| 5 | ** This program is free software; you can redistribute it and/or |
| 6 | ** modify it under the terms of the GNU General Public |
| 7 | ** License as published by the Free Software Foundation; either |
| 8 | ** version 2 of the License, or (at your option) any later version. |
| 9 | ** |
| 10 | ** This program is distributed in the hope that it will be useful, |
| 11 | ** but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 13 | ** General Public License for more details. |
| 14 | ** |
| 15 | ** You should have received a copy of the GNU General Public |
| 16 | ** License along with this library; if not, write to the |
| 17 | ** Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
| 18 | ** Boston, MA 02111-1307, USA. |
| 19 | ** |
| 20 | ** Author contact information: |
| 21 | ** [email protected] |
| 22 | ** http://www.hwaci.com/drh/ |
| 23 | ** |
| 24 | ******************************************************************************* |
| 25 | ** |
| 26 | ** Implementation of the Tag View page |
| 27 | */ |
| 28 | #include <assert.h> |
| 29 | #include "config.h" |
| 30 | #include "my_page.h" |
| 31 | |
| 32 | /* |
| 33 | ** Renders a logout button. |
| 34 | */ |
| 35 | static void mypage_logout_button() |
| 36 | { |
| 37 | if( g.zLogin ){ |
| 38 | @ <br clear="both"/><hr/> |
| 39 | @ <strong>Logout (or "log out", if you prefer):</strong><br/> |
| 40 | @ <form action='login' method='POST'> |
| 41 | @ <p>To log off the system (and delete your login cookie) |
| 42 | @ press the following button:<br> |
| 43 | @ <input type="submit" name="out" value="Logout"/></p> |
| 44 | @ </form> |
| 45 | } |
| 46 | } |
| 47 | |
| 48 | /* |
| 49 | ** Renders a password changer. |
| 50 | */ |
| 51 | static void mypage_password_changer() |
| 52 | { |
| 53 | if( g.okPassword ){ |
| 54 | @ <br clear="both"/><hr/> |
| 55 | @ <strong>Change Password:</strong><br/> |
| 56 | @ <p>To change your password, enter your old password and your |
| 57 | @ new password twice below then press the "Change Password" |
| 58 | @ button.</p> |
| 59 | @ <form action="login" method="POST"> |
| 60 | @ <input type='hidden' name='g' value='my'/> |
| 61 | @ <table><tbody> |
| 62 | @ <tr><td align="right">Old Password:</td> |
| 63 | @ <td><input type="password" name="p" size=30></td></tr> |
| 64 | @ <tr><td align="right">New Password:</td> |
| 65 | @ <td><input type="password" name="n1" size=30></td></tr> |
| 66 | @ <tr><td align="right">Repeat New Password:</td> |
| 67 | @ <td><input type="password" name="n2" size=30></td></tr> |
| 68 | @ <tr><td></td> |
| 69 | @ <td><input type="submit" value="Change Password"></td></tr> |
| 70 | @ </tbody></table> |
| 71 | @ </form> |
| 72 | } |
| 73 | |
| 74 | } |
| 75 | |
| 76 | /* |
| 77 | ** Default page rendered for /my. |
| 78 | */ |
| 79 | static void mypage_page_default() |
| 80 | { |
| 81 | int uid = g.userUid; |
| 82 | char * sql = mprintf( "SELECT login,cap,info FROM user WHERE uid=%d", |
| 83 | uid ); |
| 84 | Stmt st; |
| 85 | char const *uname; |
| 86 | char const *ucap; |
| 87 | char const *uinfo; |
| 88 | db_prepare( &st, sql ); |
| 89 | free( sql ); |
| 90 | db_step(&st); |
| 91 | uname = db_column_text( &st, 0 ); |
| 92 | ucap = db_column_text( &st, 1 ); |
| 93 | uinfo = db_column_text( &st, 2 ); |
| 94 | |
| 95 | @ <h2>Welcome, %s(uname)!</h2> |
| 96 | @ Your user ID is: %d(uid)<br/> |
| 97 | @ Your Fossil permissions are: [%s(ucap)] |
| 98 | @ [TODO: explain these]<br/> |
| 99 | if( g.okAdmin ){ |
| 100 | @ You are an <a href='%s(g.zBaseURL)/admin'>admin</a>.<br/> |
| 101 | } |
| 102 | @ Your additional info: [%s(uinfo)] |
| 103 | @ [TODO: make this editable]<br/> |
| 104 | |
| 105 | mypage_logout_button(); |
| 106 | |
| 107 | @ <hr/> |
| 108 | @ <h2>Your artifacts:</h2> |
| 109 | @ <ul> |
| 110 | @ <li><a href='%s(g.zBaseURL)/timeline?u=%s(uname)&y=ci'>Your latest commits</a>.</li> |
| 111 | @ <li><a href='%s(g.zBaseURL)/timeline?u=%s(uname)&y=w'>Your latest wiki changes</a>.</li> |
| 112 | @ <li><a href='%s(g.zBaseURL)/timeline?u=%s(uname)&y=t'>Your latest ticket changes</a>.</li> |
| 113 | @ <li>TODO: etc. etc. etc.</li> |
| 114 | @ </ul> |
| 115 | mypage_password_changer(); |
| 116 | |
| 117 | @ <hr/><h2>TODOs:</h2><ul> |
| 118 | @ <li>Change "additional info" field.</li> |
| 119 | @ <li>Search for changes made by you.</li> |
| 120 | @ <li>Search for files/wiki pages/tickets related to you.</li> |
| 121 | @ <li>Allow per-user setup of the page (e.g. reports).</li> |
| 122 | @ <li>... the list goes on ...</li> |
| 123 | @ </ul> |
| 124 | |
| 125 | db_finalize( &st ); |
| 126 | |
| 127 | } |
| 128 | |
| 129 | /* |
| 130 | ** WEBPAGE: /my |
| 131 | */ |
| 132 | void mypage_page(void){ |
| 133 | const char *name; |
| 134 | login_check_credentials(); |
| 135 | if( !g.okRdWiki ){ |
| 136 | login_needed(); |
| 137 | } |
| 138 | style_header("Your Home"); |
| 139 | name = P("name"); |
| 140 | if( name ) |
| 141 | { |
| 142 | if( 0 == strcmp(name,"tickets") ) |
| 143 | { |
| 144 | @ TODO: Tickets page. |
| 145 | } |
| 146 | else |
| 147 | { |
| 148 | @ TODO: handle /my/%s(name) |
| 149 | } |
| 150 | } |
| 151 | else |
| 152 | { |
| 153 | mypage_page_default(); |
| 154 | } |
| 155 | style_footer(); |
| 156 | } |
| --- a/src/my_page.c | |
| +++ b/src/my_page.c | |
| @@ -1,156 +0,0 @@ | |
+1
-22
| --- src/style.c | ||
| +++ src/style.c | ||
| @@ -197,11 +197,11 @@ | ||
| 197 | 197 | @ <nobr>$<project_name></nobr> |
| 198 | 198 | @ </div> |
| 199 | 199 | @ <div class="title">$<title></div> |
| 200 | 200 | @ <div class="status"><nobr><th1> |
| 201 | 201 | @ if {[info exists login]} { |
| 202 | -@ html "Logged in as <a href='$baseurl/my'>$login</a>" | |
| 202 | +@ puts "Logged in as $login" | |
| 203 | 203 | @ } else { |
| 204 | 204 | @ puts "Not logged in" |
| 205 | 205 | @ } |
| 206 | 206 | @ </th1></nobr></div> |
| 207 | 207 | @ </div> |
| @@ -392,31 +392,10 @@ | ||
| 392 | 392 | @ |
| 393 | 393 | @ div.miniform { |
| 394 | 394 | @ font-size: smaller; |
| 395 | 395 | @ margin: 8px; |
| 396 | 396 | @ } |
| 397 | -@ | |
| 398 | -@ table.fossil_db_generic_query_view { | |
| 399 | -@ border-spacing: 0px; | |
| 400 | -@ border: 1px solid black; | |
| 401 | -@ } | |
| 402 | -@ table.fossil_db_generic_query_view td { | |
| 403 | -@ padding: 2px 1em 2px 1em; | |
| 404 | -@ } | |
| 405 | -@ table.fossil_db_generic_query_view tr { | |
| 406 | -@ } | |
| 407 | -@ table.fossil_db_generic_query_view tr.even { | |
| 408 | -@ background: #ffffff; | |
| 409 | -@ } | |
| 410 | -@ table.fossil_db_generic_query_view tr.odd { | |
| 411 | -@ background: #e5e5e5; | |
| 412 | -@ } | |
| 413 | -@ table.fossil_db_generic_query_view tr.header { | |
| 414 | -@ background: #558195; | |
| 415 | -@ font-size: 1.5em; | |
| 416 | -@ color: #ffffff; | |
| 417 | -@ } | |
| 418 | 397 | ; |
| 419 | 398 | |
| 420 | 399 | /* |
| 421 | 400 | ** WEBPAGE: style.css |
| 422 | 401 | */ |
| 423 | 402 | |
| 424 | 403 | DELETED src/tagview.c |
| --- src/style.c | |
| +++ src/style.c | |
| @@ -197,11 +197,11 @@ | |
| 197 | @ <nobr>$<project_name></nobr> |
| 198 | @ </div> |
| 199 | @ <div class="title">$<title></div> |
| 200 | @ <div class="status"><nobr><th1> |
| 201 | @ if {[info exists login]} { |
| 202 | @ html "Logged in as <a href='$baseurl/my'>$login</a>" |
| 203 | @ } else { |
| 204 | @ puts "Not logged in" |
| 205 | @ } |
| 206 | @ </th1></nobr></div> |
| 207 | @ </div> |
| @@ -392,31 +392,10 @@ | |
| 392 | @ |
| 393 | @ div.miniform { |
| 394 | @ font-size: smaller; |
| 395 | @ margin: 8px; |
| 396 | @ } |
| 397 | @ |
| 398 | @ table.fossil_db_generic_query_view { |
| 399 | @ border-spacing: 0px; |
| 400 | @ border: 1px solid black; |
| 401 | @ } |
| 402 | @ table.fossil_db_generic_query_view td { |
| 403 | @ padding: 2px 1em 2px 1em; |
| 404 | @ } |
| 405 | @ table.fossil_db_generic_query_view tr { |
| 406 | @ } |
| 407 | @ table.fossil_db_generic_query_view tr.even { |
| 408 | @ background: #ffffff; |
| 409 | @ } |
| 410 | @ table.fossil_db_generic_query_view tr.odd { |
| 411 | @ background: #e5e5e5; |
| 412 | @ } |
| 413 | @ table.fossil_db_generic_query_view tr.header { |
| 414 | @ background: #558195; |
| 415 | @ font-size: 1.5em; |
| 416 | @ color: #ffffff; |
| 417 | @ } |
| 418 | ; |
| 419 | |
| 420 | /* |
| 421 | ** WEBPAGE: style.css |
| 422 | */ |
| 423 | |
| 424 | ELETED src/tagview.c |
| --- src/style.c | |
| +++ src/style.c | |
| @@ -197,11 +197,11 @@ | |
| 197 | @ <nobr>$<project_name></nobr> |
| 198 | @ </div> |
| 199 | @ <div class="title">$<title></div> |
| 200 | @ <div class="status"><nobr><th1> |
| 201 | @ if {[info exists login]} { |
| 202 | @ puts "Logged in as $login" |
| 203 | @ } else { |
| 204 | @ puts "Not logged in" |
| 205 | @ } |
| 206 | @ </th1></nobr></div> |
| 207 | @ </div> |
| @@ -392,31 +392,10 @@ | |
| 392 | @ |
| 393 | @ div.miniform { |
| 394 | @ font-size: smaller; |
| 395 | @ margin: 8px; |
| 396 | @ } |
| 397 | ; |
| 398 | |
| 399 | /* |
| 400 | ** WEBPAGE: style.css |
| 401 | */ |
| 402 | |
| 403 | ELETED src/tagview.c |
D
src/tagview.c
-292
| --- a/src/tagview.c | ||
| +++ b/src/tagview.c | ||
| @@ -1,292 +0,0 @@ | ||
| 1 | -/* | |
| 2 | -** Copyright (c) 2007 D. Richard Hipp | |
| 3 | -** Copyright (c) 2008 Stephan Beal | |
| 4 | -** | |
| 5 | -** This program is free software; you can redistribute it and/or | |
| 6 | -** modify it under the terms of the GNU General Public | |
| 7 | -** License as published by the Free Software Foundation; either | |
| 8 | -** version 2 of the License, or (at your option) any later version. | |
| 9 | -** | |
| 10 | -** This program is distributed in the hope that it will be useful, | |
| 11 | -** but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 12 | -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
| 13 | -** General Public License for more details. | |
| 14 | -** | |
| 15 | -** You should have received a copy of the GNU General Public | |
| 16 | -** License along with this library; if not, write to the | |
| 17 | -** Free Software Foundation, Inc., 59 Temple Place - Suite 330, | |
| 18 | -** Boston, MA 02111-1307, USA. | |
| 19 | -** | |
| 20 | -** Author contact information: | |
| 21 | -** [email protected] | |
| 22 | -** http://www.hwaci.com/drh/ | |
| 23 | -** | |
| 24 | -******************************************************************************* | |
| 25 | -** | |
| 26 | -** Implementation of the Tag View page | |
| 27 | -*/ | |
| 28 | -#include <assert.h> | |
| 29 | -#include "config.h" | |
| 30 | -#include "tagview.h" | |
| 31 | - | |
| 32 | -#if 0 /* DISABLED */ | |
| 33 | - | |
| 34 | -#if 0 | |
| 35 | -# define TAGVIEW_DEFAULT_FILTER "AND t.tagname NOT GLOB 'wiki-*' " | |
| 36 | -#else | |
| 37 | -# define TAGVIEW_DEFAULT_FILTER | |
| 38 | -#endif | |
| 39 | - | |
| 40 | -/* | |
| 41 | -** Lists all tags matching the given LIKE clause (which | |
| 42 | -** may be 0). | |
| 43 | -*/ | |
| 44 | -static void tagview_page_list_tags(const char *zLike){ | |
| 45 | - char *zLikeClause = 0; | |
| 46 | - const int limit = 10; | |
| 47 | - char *zLimit = 0; | |
| 48 | - char *zSql; | |
| 49 | - | |
| 50 | - if( zLike && zLike[0] ){ | |
| 51 | - zLikeClause = mprintf( "AND t.tagname LIKE '%%%q%%'", zLike ); | |
| 52 | - zLimit = ""; | |
| 53 | - @ <h2>Tags matching [%h(zLikeClause)]:</h2> | |
| 54 | - }else{ | |
| 55 | - zLimit = mprintf( "LIMIT %d", limit ); | |
| 56 | - zLikeClause = ""; | |
| 57 | - @ <h2>%d(limit) most recent tags:</h2> | |
| 58 | - } | |
| 59 | - zSql = mprintf( | |
| 60 | - "SELECT " | |
| 61 | - " linktagid(t.tagid) AS 'Tag ID'," | |
| 62 | - " linktagname(t.tagname) AS 'Name'," | |
| 63 | - " DATETIME(tx.mtime) AS 'Timestamp'," | |
| 64 | - " linkuuid(b.uuid) AS 'Version'" | |
| 65 | - " FROM tag t, tagxref tx, blob b " | |
| 66 | - " WHERE t.tagid=tx.tagid AND tx.rid=b.rid" | |
| 67 | - " %s " | |
| 68 | - TAGVIEW_DEFAULT_FILTER | |
| 69 | - " ORDER BY tx.mtime DESC %s", | |
| 70 | - zLikeClause, zLimit | |
| 71 | - ); | |
| 72 | - db_generic_query_view(zSql, 1); | |
| 73 | - free(zSql); | |
| 74 | - if( zLikeClause[0] ) free(zLikeClause); | |
| 75 | - if( zLimit[0] ) free(zLimit); | |
| 76 | -} | |
| 77 | - | |
| 78 | -/* | |
| 79 | -** A small search form which forwards to ?like=SEARCH_STRING | |
| 80 | -*/ | |
| 81 | -static void tagview_page_search_miniform(void){ | |
| 82 | - char const * like = P("like"); | |
| 83 | - @ <div class='miniform'> | |
| 84 | - @ <form action='tagview' method='post'> | |
| 85 | - @ Search for tags: | |
| 86 | - @ <input type='text' name='like' value='%h((like?like:""))' size='10'/> | |
| 87 | - @ <input type='submit'/> | |
| 88 | - @ <input type='hidden' name='raw' value='y'/> | |
| 89 | - @ </form> | |
| 90 | - @ </div> | |
| 91 | -} | |
| 92 | - | |
| 93 | -/* | |
| 94 | -** tagview_page_default() renders the default page for tagview_page(). | |
| 95 | -*/ | |
| 96 | -static void tagview_page_default(void){ | |
| 97 | - tagview_page_list_tags( 0 ); | |
| 98 | -} | |
| 99 | - | |
| 100 | -/* | |
| 101 | -** Lists all tags matching the given tagid. | |
| 102 | -*/ | |
| 103 | -static void tagview_page_tag_by_id( int tagid ){ | |
| 104 | - char *zSql; | |
| 105 | - @ <h2>Tag #%d(tagid):</h2> | |
| 106 | - zSql = mprintf( | |
| 107 | - "SELECT DISTINCT" | |
| 108 | - " linktagname(t.tagname) AS 'Tag Name'," | |
| 109 | - " DATETIME(tx.mtime) AS 'Timestamp'," | |
| 110 | - " linkuuid(b.uuid) AS 'Version'" | |
| 111 | - " FROM tag t, tagxref tx, blob b" | |
| 112 | - " WHERE t.tagid=%d AND t.tagid=tx.tagid AND tx.rid=b.rid " | |
| 113 | - TAGVIEW_DEFAULT_FILTER | |
| 114 | - " ORDER BY tx.mtime DESC", | |
| 115 | - tagid | |
| 116 | - ); | |
| 117 | - db_generic_query_view(zSql, 1); | |
| 118 | - free(zSql); | |
| 119 | -} | |
| 120 | - | |
| 121 | -/* | |
| 122 | -** Lists all tags matching the given tag name. | |
| 123 | -*/ | |
| 124 | -static void tagview_page_tag_by_name( char const * tagname ){ | |
| 125 | - char *zSql; | |
| 126 | - @ <h2>Tag '%s(tagname)':</h2> | |
| 127 | - zSql = mprintf( | |
| 128 | - "SELECT DISTINCT" | |
| 129 | - " linktagid(t.tagid) AS 'Tag ID'," | |
| 130 | - " linktagname(t.tagname) AS 'Name'," | |
| 131 | - " DATETIME(tx.mtime) AS 'Timestamp'," | |
| 132 | - " linkuuid(b.uuid) AS 'Version'" | |
| 133 | - " FROM tag t, tagxref tx, blob b " | |
| 134 | - " WHERE ( t.tagname='%q' OR t.tagname='sym-%q') " | |
| 135 | - " AND t.tagid=tx.tagid AND tx.rid=b.rid " | |
| 136 | - TAGVIEW_DEFAULT_FILTER | |
| 137 | - " ORDER BY tx.mtime DESC", | |
| 138 | - tagname,tagname); | |
| 139 | - db_generic_query_view(zSql, 1); | |
| 140 | - free(zSql); | |
| 141 | -} | |
| 142 | - | |
| 143 | -/* | |
| 144 | -** Internal view of tags | |
| 145 | -*/ | |
| 146 | -void raw_tagview_page(void){ | |
| 147 | - char const * check = 0; | |
| 148 | - login_check_credentials(); | |
| 149 | - /* if( !g.okRdWiki ){ */ | |
| 150 | - if( !g.okAdmin ){ | |
| 151 | - login_needed(); | |
| 152 | - } | |
| 153 | - style_header("Raw Tags"); | |
| 154 | - login_anonymous_available(); | |
| 155 | - tagview_page_search_miniform(); | |
| 156 | - @ <hr/> | |
| 157 | - if( 0 != (check = P("tagid")) ){ | |
| 158 | - tagview_page_tag_by_id( atoi(check) ); | |
| 159 | - }else if( 0 != (check = P("like")) ){ | |
| 160 | - tagview_page_list_tags( check ); | |
| 161 | - }else if( 0 != (check = P("name")) ){ | |
| 162 | - tagview_page_tag_by_name( check ); | |
| 163 | - }else{ | |
| 164 | - tagview_page_default(); | |
| 165 | - } | |
| 166 | - style_footer(); | |
| 167 | -} | |
| 168 | - | |
| 169 | -#undef TAGVIEW_DEFAULT_FILTER | |
| 170 | - | |
| 171 | -/* | |
| 172 | -** Generate a timeline for the chosen tag | |
| 173 | -*/ | |
| 174 | -void tagview_print_timeline(char const *zName, char const *zPrefix){ | |
| 175 | - char *zSql; | |
| 176 | - Stmt q; | |
| 177 | - int tagid = db_int(0, "SELECT tagid FROM tag WHERE tagname='%q%q'", | |
| 178 | - zPrefix, zName); | |
| 179 | - zSql = mprintf("%s AND EXISTS (SELECT 1" | |
| 180 | - " FROM tagxref" | |
| 181 | - " WHERE tagxref.rid = event.objid" | |
| 182 | - " AND tagxref.tagtype > 0" | |
| 183 | - " AND tagxref.tagid = %d)" | |
| 184 | - " ORDER BY 3 desc", | |
| 185 | - timeline_query_for_www(), tagid | |
| 186 | - ); | |
| 187 | - db_prepare(&q, zSql); | |
| 188 | - free(zSql); | |
| 189 | - www_print_timeline(&q, 0, 0); | |
| 190 | - db_finalize(&q); | |
| 191 | -} | |
| 192 | - | |
| 193 | -/* | |
| 194 | -** WEB PAGE: /tagview | |
| 195 | -*/ | |
| 196 | -void tagview_page(void){ | |
| 197 | - char const *zName = 0; | |
| 198 | - char const *zTitle = 0; | |
| 199 | - int nTag = 0; | |
| 200 | - login_check_credentials(); | |
| 201 | - if( !g.okRead ){ | |
| 202 | - login_needed(); | |
| 203 | - } | |
| 204 | - if ( P("tagid") || P("like") || P("raw") ) { | |
| 205 | - raw_tagview_page(); | |
| 206 | - return; | |
| 207 | - } | |
| 208 | - login_anonymous_available(); | |
| 209 | - if( 0 != (zName = P("name")) ){ | |
| 210 | - Blob uuid; | |
| 211 | - if( g.okAdmin ){ | |
| 212 | - style_submenu_element("RawTags", "Internal Ticket View", | |
| 213 | - "%s/tagview?name=%s&raw=y", g.zTop, zName); | |
| 214 | - } | |
| 215 | - zTitle = "Tagged Artifacts"; | |
| 216 | - @ <h2>%s(zName):</h2> | |
| 217 | - if( sym_tag_to_uuid(zName, &uuid) > 0){ | |
| 218 | - tagview_print_timeline(zName, "sym-"); | |
| 219 | - }else if( tag_to_uuid(zName, &uuid, "") > 0){ | |
| 220 | - tagview_print_timeline(zName, ""); | |
| 221 | - }else{ | |
| 222 | - @ There is no artifact with this tag. | |
| 223 | - } | |
| 224 | - }else{ | |
| 225 | - Stmt q; | |
| 226 | - const char *prefix = "sym-"; | |
| 227 | - int preflen = strlen(prefix); | |
| 228 | - if( g.okAdmin ){ | |
| 229 | - style_submenu_element("RawTags", "Internal Ticket View", | |
| 230 | - "%s/tagview?raw=y", g.zTop); | |
| 231 | - } | |
| 232 | - zTitle = "Tags"; | |
| 233 | - db_prepare(&q, | |
| 234 | - "SELECT tagname" | |
| 235 | - " FROM tag" | |
| 236 | - " WHERE EXISTS(SELECT 1 FROM tagxref" | |
| 237 | - " WHERE tagid=tag.tagid" | |
| 238 | - " AND tagtype>0)" | |
| 239 | - " AND tagid > %d" | |
| 240 | - " AND tagname NOT GLOB 'wiki-*'" | |
| 241 | - " AND tagname NOT GLOB 'tkt-*'" | |
| 242 | - " ORDER BY tagname", | |
| 243 | - MAX_INT_TAG | |
| 244 | - ); | |
| 245 | - @ <ul> | |
| 246 | - while( db_step(&q)==SQLITE_ROW ){ | |
| 247 | - const char *name = db_column_text(&q, 0); | |
| 248 | - nTag++; | |
| 249 | - if( g.okHistory ){ | |
| 250 | - if( strncmp(name, prefix, preflen)==0 ){ | |
| 251 | - @ <li><a href=%s(g.zBaseURL)/tagview?name=%s(name+preflen)> | |
| 252 | - @ %s(name+preflen)</a> | |
| 253 | - }else{ | |
| 254 | - @ <li><a href=%s(g.zBaseURL)/tagview?name=%s(name)> | |
| 255 | - @ %s(name)</a> | |
| 256 | - } | |
| 257 | - }else{ | |
| 258 | - if( strncmp(name, prefix, preflen)==0 ){ | |
| 259 | - @ <li><strong>%s(name+preflen)</strong> | |
| 260 | - }else{ | |
| 261 | - @ <li><strong>%s(name)</strong> | |
| 262 | - } | |
| 263 | - } | |
| 264 | - if( strncmp(name, prefix, preflen)==0 ){ | |
| 265 | - @ (symbolic label) | |
| 266 | - } | |
| 267 | - @ </li> | |
| 268 | - } | |
| 269 | - @ </ul> | |
| 270 | - if( nTag == 0) { | |
| 271 | - @ There are no relevant tags. | |
| 272 | - } | |
| 273 | - db_finalize(&q); | |
| 274 | - } | |
| 275 | - style_header(zTitle); | |
| 276 | - /* | |
| 277 | - * Put in dummy functions since www_print_timeline has generated calls to | |
| 278 | - * them. Some browsers don't seem to care, but better to be safe. | |
| 279 | - * Actually, it would be nice to use the functions on this page, but at | |
| 280 | - * the moment it looks to be too difficult. | |
| 281 | - */ | |
| 282 | - @ <script> | |
| 283 | - @ function xin(id){ | |
| 284 | - @ } | |
| 285 | - @ function xout(id){ | |
| 286 | - @ } | |
| 287 | - @ </script> | |
| 288 | - | |
| 289 | - style_footer(); | |
| 290 | -} | |
| 291 | - | |
| 292 | -#endif /* DISABLED */ |
| --- a/src/tagview.c | |
| +++ b/src/tagview.c | |
| @@ -1,292 +0,0 @@ | |
| 1 | /* |
| 2 | ** Copyright (c) 2007 D. Richard Hipp |
| 3 | ** Copyright (c) 2008 Stephan Beal |
| 4 | ** |
| 5 | ** This program is free software; you can redistribute it and/or |
| 6 | ** modify it under the terms of the GNU General Public |
| 7 | ** License as published by the Free Software Foundation; either |
| 8 | ** version 2 of the License, or (at your option) any later version. |
| 9 | ** |
| 10 | ** This program is distributed in the hope that it will be useful, |
| 11 | ** but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 13 | ** General Public License for more details. |
| 14 | ** |
| 15 | ** You should have received a copy of the GNU General Public |
| 16 | ** License along with this library; if not, write to the |
| 17 | ** Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
| 18 | ** Boston, MA 02111-1307, USA. |
| 19 | ** |
| 20 | ** Author contact information: |
| 21 | ** [email protected] |
| 22 | ** http://www.hwaci.com/drh/ |
| 23 | ** |
| 24 | ******************************************************************************* |
| 25 | ** |
| 26 | ** Implementation of the Tag View page |
| 27 | */ |
| 28 | #include <assert.h> |
| 29 | #include "config.h" |
| 30 | #include "tagview.h" |
| 31 | |
| 32 | #if 0 /* DISABLED */ |
| 33 | |
| 34 | #if 0 |
| 35 | # define TAGVIEW_DEFAULT_FILTER "AND t.tagname NOT GLOB 'wiki-*' " |
| 36 | #else |
| 37 | # define TAGVIEW_DEFAULT_FILTER |
| 38 | #endif |
| 39 | |
| 40 | /* |
| 41 | ** Lists all tags matching the given LIKE clause (which |
| 42 | ** may be 0). |
| 43 | */ |
| 44 | static void tagview_page_list_tags(const char *zLike){ |
| 45 | char *zLikeClause = 0; |
| 46 | const int limit = 10; |
| 47 | char *zLimit = 0; |
| 48 | char *zSql; |
| 49 | |
| 50 | if( zLike && zLike[0] ){ |
| 51 | zLikeClause = mprintf( "AND t.tagname LIKE '%%%q%%'", zLike ); |
| 52 | zLimit = ""; |
| 53 | @ <h2>Tags matching [%h(zLikeClause)]:</h2> |
| 54 | }else{ |
| 55 | zLimit = mprintf( "LIMIT %d", limit ); |
| 56 | zLikeClause = ""; |
| 57 | @ <h2>%d(limit) most recent tags:</h2> |
| 58 | } |
| 59 | zSql = mprintf( |
| 60 | "SELECT " |
| 61 | " linktagid(t.tagid) AS 'Tag ID'," |
| 62 | " linktagname(t.tagname) AS 'Name'," |
| 63 | " DATETIME(tx.mtime) AS 'Timestamp'," |
| 64 | " linkuuid(b.uuid) AS 'Version'" |
| 65 | " FROM tag t, tagxref tx, blob b " |
| 66 | " WHERE t.tagid=tx.tagid AND tx.rid=b.rid" |
| 67 | " %s " |
| 68 | TAGVIEW_DEFAULT_FILTER |
| 69 | " ORDER BY tx.mtime DESC %s", |
| 70 | zLikeClause, zLimit |
| 71 | ); |
| 72 | db_generic_query_view(zSql, 1); |
| 73 | free(zSql); |
| 74 | if( zLikeClause[0] ) free(zLikeClause); |
| 75 | if( zLimit[0] ) free(zLimit); |
| 76 | } |
| 77 | |
| 78 | /* |
| 79 | ** A small search form which forwards to ?like=SEARCH_STRING |
| 80 | */ |
| 81 | static void tagview_page_search_miniform(void){ |
| 82 | char const * like = P("like"); |
| 83 | @ <div class='miniform'> |
| 84 | @ <form action='tagview' method='post'> |
| 85 | @ Search for tags: |
| 86 | @ <input type='text' name='like' value='%h((like?like:""))' size='10'/> |
| 87 | @ <input type='submit'/> |
| 88 | @ <input type='hidden' name='raw' value='y'/> |
| 89 | @ </form> |
| 90 | @ </div> |
| 91 | } |
| 92 | |
| 93 | /* |
| 94 | ** tagview_page_default() renders the default page for tagview_page(). |
| 95 | */ |
| 96 | static void tagview_page_default(void){ |
| 97 | tagview_page_list_tags( 0 ); |
| 98 | } |
| 99 | |
| 100 | /* |
| 101 | ** Lists all tags matching the given tagid. |
| 102 | */ |
| 103 | static void tagview_page_tag_by_id( int tagid ){ |
| 104 | char *zSql; |
| 105 | @ <h2>Tag #%d(tagid):</h2> |
| 106 | zSql = mprintf( |
| 107 | "SELECT DISTINCT" |
| 108 | " linktagname(t.tagname) AS 'Tag Name'," |
| 109 | " DATETIME(tx.mtime) AS 'Timestamp'," |
| 110 | " linkuuid(b.uuid) AS 'Version'" |
| 111 | " FROM tag t, tagxref tx, blob b" |
| 112 | " WHERE t.tagid=%d AND t.tagid=tx.tagid AND tx.rid=b.rid " |
| 113 | TAGVIEW_DEFAULT_FILTER |
| 114 | " ORDER BY tx.mtime DESC", |
| 115 | tagid |
| 116 | ); |
| 117 | db_generic_query_view(zSql, 1); |
| 118 | free(zSql); |
| 119 | } |
| 120 | |
| 121 | /* |
| 122 | ** Lists all tags matching the given tag name. |
| 123 | */ |
| 124 | static void tagview_page_tag_by_name( char const * tagname ){ |
| 125 | char *zSql; |
| 126 | @ <h2>Tag '%s(tagname)':</h2> |
| 127 | zSql = mprintf( |
| 128 | "SELECT DISTINCT" |
| 129 | " linktagid(t.tagid) AS 'Tag ID'," |
| 130 | " linktagname(t.tagname) AS 'Name'," |
| 131 | " DATETIME(tx.mtime) AS 'Timestamp'," |
| 132 | " linkuuid(b.uuid) AS 'Version'" |
| 133 | " FROM tag t, tagxref tx, blob b " |
| 134 | " WHERE ( t.tagname='%q' OR t.tagname='sym-%q') " |
| 135 | " AND t.tagid=tx.tagid AND tx.rid=b.rid " |
| 136 | TAGVIEW_DEFAULT_FILTER |
| 137 | " ORDER BY tx.mtime DESC", |
| 138 | tagname,tagname); |
| 139 | db_generic_query_view(zSql, 1); |
| 140 | free(zSql); |
| 141 | } |
| 142 | |
| 143 | /* |
| 144 | ** Internal view of tags |
| 145 | */ |
| 146 | void raw_tagview_page(void){ |
| 147 | char const * check = 0; |
| 148 | login_check_credentials(); |
| 149 | /* if( !g.okRdWiki ){ */ |
| 150 | if( !g.okAdmin ){ |
| 151 | login_needed(); |
| 152 | } |
| 153 | style_header("Raw Tags"); |
| 154 | login_anonymous_available(); |
| 155 | tagview_page_search_miniform(); |
| 156 | @ <hr/> |
| 157 | if( 0 != (check = P("tagid")) ){ |
| 158 | tagview_page_tag_by_id( atoi(check) ); |
| 159 | }else if( 0 != (check = P("like")) ){ |
| 160 | tagview_page_list_tags( check ); |
| 161 | }else if( 0 != (check = P("name")) ){ |
| 162 | tagview_page_tag_by_name( check ); |
| 163 | }else{ |
| 164 | tagview_page_default(); |
| 165 | } |
| 166 | style_footer(); |
| 167 | } |
| 168 | |
| 169 | #undef TAGVIEW_DEFAULT_FILTER |
| 170 | |
| 171 | /* |
| 172 | ** Generate a timeline for the chosen tag |
| 173 | */ |
| 174 | void tagview_print_timeline(char const *zName, char const *zPrefix){ |
| 175 | char *zSql; |
| 176 | Stmt q; |
| 177 | int tagid = db_int(0, "SELECT tagid FROM tag WHERE tagname='%q%q'", |
| 178 | zPrefix, zName); |
| 179 | zSql = mprintf("%s AND EXISTS (SELECT 1" |
| 180 | " FROM tagxref" |
| 181 | " WHERE tagxref.rid = event.objid" |
| 182 | " AND tagxref.tagtype > 0" |
| 183 | " AND tagxref.tagid = %d)" |
| 184 | " ORDER BY 3 desc", |
| 185 | timeline_query_for_www(), tagid |
| 186 | ); |
| 187 | db_prepare(&q, zSql); |
| 188 | free(zSql); |
| 189 | www_print_timeline(&q, 0, 0); |
| 190 | db_finalize(&q); |
| 191 | } |
| 192 | |
| 193 | /* |
| 194 | ** WEB PAGE: /tagview |
| 195 | */ |
| 196 | void tagview_page(void){ |
| 197 | char const *zName = 0; |
| 198 | char const *zTitle = 0; |
| 199 | int nTag = 0; |
| 200 | login_check_credentials(); |
| 201 | if( !g.okRead ){ |
| 202 | login_needed(); |
| 203 | } |
| 204 | if ( P("tagid") || P("like") || P("raw") ) { |
| 205 | raw_tagview_page(); |
| 206 | return; |
| 207 | } |
| 208 | login_anonymous_available(); |
| 209 | if( 0 != (zName = P("name")) ){ |
| 210 | Blob uuid; |
| 211 | if( g.okAdmin ){ |
| 212 | style_submenu_element("RawTags", "Internal Ticket View", |
| 213 | "%s/tagview?name=%s&raw=y", g.zTop, zName); |
| 214 | } |
| 215 | zTitle = "Tagged Artifacts"; |
| 216 | @ <h2>%s(zName):</h2> |
| 217 | if( sym_tag_to_uuid(zName, &uuid) > 0){ |
| 218 | tagview_print_timeline(zName, "sym-"); |
| 219 | }else if( tag_to_uuid(zName, &uuid, "") > 0){ |
| 220 | tagview_print_timeline(zName, ""); |
| 221 | }else{ |
| 222 | @ There is no artifact with this tag. |
| 223 | } |
| 224 | }else{ |
| 225 | Stmt q; |
| 226 | const char *prefix = "sym-"; |
| 227 | int preflen = strlen(prefix); |
| 228 | if( g.okAdmin ){ |
| 229 | style_submenu_element("RawTags", "Internal Ticket View", |
| 230 | "%s/tagview?raw=y", g.zTop); |
| 231 | } |
| 232 | zTitle = "Tags"; |
| 233 | db_prepare(&q, |
| 234 | "SELECT tagname" |
| 235 | " FROM tag" |
| 236 | " WHERE EXISTS(SELECT 1 FROM tagxref" |
| 237 | " WHERE tagid=tag.tagid" |
| 238 | " AND tagtype>0)" |
| 239 | " AND tagid > %d" |
| 240 | " AND tagname NOT GLOB 'wiki-*'" |
| 241 | " AND tagname NOT GLOB 'tkt-*'" |
| 242 | " ORDER BY tagname", |
| 243 | MAX_INT_TAG |
| 244 | ); |
| 245 | @ <ul> |
| 246 | while( db_step(&q)==SQLITE_ROW ){ |
| 247 | const char *name = db_column_text(&q, 0); |
| 248 | nTag++; |
| 249 | if( g.okHistory ){ |
| 250 | if( strncmp(name, prefix, preflen)==0 ){ |
| 251 | @ <li><a href=%s(g.zBaseURL)/tagview?name=%s(name+preflen)> |
| 252 | @ %s(name+preflen)</a> |
| 253 | }else{ |
| 254 | @ <li><a href=%s(g.zBaseURL)/tagview?name=%s(name)> |
| 255 | @ %s(name)</a> |
| 256 | } |
| 257 | }else{ |
| 258 | if( strncmp(name, prefix, preflen)==0 ){ |
| 259 | @ <li><strong>%s(name+preflen)</strong> |
| 260 | }else{ |
| 261 | @ <li><strong>%s(name)</strong> |
| 262 | } |
| 263 | } |
| 264 | if( strncmp(name, prefix, preflen)==0 ){ |
| 265 | @ (symbolic label) |
| 266 | } |
| 267 | @ </li> |
| 268 | } |
| 269 | @ </ul> |
| 270 | if( nTag == 0) { |
| 271 | @ There are no relevant tags. |
| 272 | } |
| 273 | db_finalize(&q); |
| 274 | } |
| 275 | style_header(zTitle); |
| 276 | /* |
| 277 | * Put in dummy functions since www_print_timeline has generated calls to |
| 278 | * them. Some browsers don't seem to care, but better to be safe. |
| 279 | * Actually, it would be nice to use the functions on this page, but at |
| 280 | * the moment it looks to be too difficult. |
| 281 | */ |
| 282 | @ <script> |
| 283 | @ function xin(id){ |
| 284 | @ } |
| 285 | @ function xout(id){ |
| 286 | @ } |
| 287 | @ </script> |
| 288 | |
| 289 | style_footer(); |
| 290 | } |
| 291 | |
| 292 | #endif /* DISABLED */ |
| --- a/src/tagview.c | |
| +++ b/src/tagview.c | |
| @@ -1,292 +0,0 @@ | |