Index: /elgg/trunk/mod/forum/userdetails_edit.php =================================================================== --- /elgg/trunk/mod/forum/userdetails_edit.php (revision 176) +++ /elgg/trunk/mod/forum/userdetails_edit.php (revision 176) @@ -0,0 +1,63 @@ +dirroot . 'mod/forum/config.php'); + + + if ((logged_on) && run("users:type:get", $page_owner) == "community") + { + $forum_title = __gettext("Blog/Forum View:"); + $forumRules = __gettext("Set this to 'yes' if you would like to default this user/community blog to a 'forum' view."); + + $body = <<< END + +

$forum_title

+

+ $forumRules +

+ +END; + $forum=""; + $forum = user_flag_get('forum', $page_owner); + //echo $forum . '
'; + if ($forum=="") + { + //echo "NO FORUM flag - set to default from config..."; + if ($forum_default == 0){ + $forum = "yes"; + } else { + $forum = "no"; + } + } + + + if ($forum == "no") + { + //echo "NO FORUM! flag set to no"; + $body .= templates_draw( array( + 'context' => 'databox', + 'name' => __gettext("Default Blog View to 'Forum' type: "), + 'column1' => " " + ) + ); + } else + { + //echo "FORUM! flag set to yes"; + $body .= templates_draw( array( + 'context' => 'databox', + 'name' => __gettext("Default Blog View to 'Forum' type: "), + 'column1' => " " + ) + ); + } + + + $run_result .= $body; + + } + +?> Index: /elgg/trunk/mod/forum/LICENSE =================================================================== --- /elgg/trunk/mod/forum/LICENSE (revision 176) +++ /elgg/trunk/mod/forum/LICENSE (revision 176) @@ -0,0 +1,340 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Library General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + , 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Library General +Public License instead of this License. Index: /elgg/trunk/mod/forum/css =================================================================== --- /elgg/trunk/mod/forum/css (revision 176) +++ /elgg/trunk/mod/forum/css (revision 176) @@ -0,0 +1,68 @@ +#forum_table { + width: 100%; + padding: 0; + margin: 0; +} + + + +#forum_table th { + font: bold 11px "Trebuchet MS", Verdana, Arial, Helvetica, sans-serif; + background:url({{url}}mod/forum/images/toolbar_nav_grey.gif) repeat-x bottom; + border-right: solid 1px #eeeeee; + border-bottom: 0; + border-top: solid 1px #eeeeee; + border-left: solid 1px #eeeeee; + letter-spacing: 2px; + text-transform: uppercase; + text-align: left; + padding: 6px 6px 6px 6px; +} + +#forum_table th.nobg { + border-top: 0; + border-left: 0; + border-right: dotted 0px #eeeeee; + border-bottom: dotted 1px #eeeeee; + background: none; +} + +#forum_table th.cent { + text-align: center; + background:url({{url}}mod/forum/images/toolbar_nav_grey.gif) repeat-x bottom; +} + +#forum_table td { + border-right: dotted 1px #eeeeee; + border-bottom: dotted 1px #eeeeee; + border-left: dotted 0px #eeeeee; + border-top: dotted 0px #eeeeee; + padding: 6px 6px 6px 6px; +} + +#forum_table td.cent { + text-align:center; +} + + +#forum_table td.smallprint { + font: 9px "Trebuchet MS", Verdana, Arial, Helvetica, sans-serif; +} + + +#forum_table td.usercol { + border-left: dotted 1px #eeeeee; + border-right: dotted 1px #eeeeee; + border-bottom: dotted 1px #eeeeee; + border-top: 0; + font: bold 10px "Trebuchet MS", Verdana, Arial, Helvetica, sans-serif; +} + +#forum_table .edit_delete { + vertical-align: bottom; + text-align: right; +} + +#forum_table img { + width: inherit; +} Index: /elgg/trunk/mod/forum/userdetails_actions.php =================================================================== --- /elgg/trunk/mod/forum/userdetails_actions.php (revision 176) +++ /elgg/trunk/mod/forum/userdetails_actions.php (revision 176) @@ -0,0 +1,26 @@ + Index: /elgg/trunk/mod/forum/config.php =================================================================== --- /elgg/trunk/mod/forum/config.php (revision 176) +++ /elgg/trunk/mod/forum/config.php (revision 176) @@ -0,0 +1,18 @@ + Index: /elgg/trunk/mod/forum/lib.php =================================================================== --- /elgg/trunk/mod/forum/lib.php (revision 176) +++ /elgg/trunk/mod/forum/lib.php (revision 176) @@ -0,0 +1,261 @@ +menu_sub) + 1; + + $PAGE->menu_sub[$num]['name'] = "weblog:forum"; + $PAGE->menu_sub[$num]['html'] = '' . __gettext("View as Forum") . ''; + } + + $forum_menu = run('sidebar:forum'); // get the output of legacy sidebar + $forum_menu = sidebar_legacy_wrap($forum_menu); // remove legacy unneeded html code
  • + + sidebar_add(20, 'sidebar-forum', $forum_menu, true, "Your Forum"); // add the block to sidebar with weight 20 + sidebar_remove('sidebar-blog'); + + } + + function forum_init() + { + + + global $function, $CFG, $page_owner, $profile_id, $db, $METATABLES; + include(dirname(__FILE__) . '/config.php'); + + + + + if (in_array($CFG->prefix . "weblog_posts", $METATABLES)) { + $messagesTable = $db->MetaColumnNames($CFG->prefix . "weblog_posts", true); + // If dosn't exists adding the colummns 'last_updated' + if (!in_array("last_updated", $messagesTable)) { + if (file_exists($CFG->dirroot . "mod/forum/$CFG->dbtype.sql")) { + modify_database($CFG->dirroot . "mod/forum/$CFG->dbtype.sql"); + } else { + error("Error: Your database ($CFG->dbtype) is not yet fully supported by the Elgg forum plug-in. See the mod/forum directory."); + } + print_continue($CFG->wwwroot); + exit(); + } + } + + $CFG->widgets->list[]= array ('name' => __gettext("Forum widget"), + 'description' => __gettext("Displays the latest posts from a Community Forum of your choice."), + 'type' => "forum::forum"); + + listen_for_event("weblog_post","publish","forum_publish_blog"); + listen_for_event("weblog_post","republish","forum_publish_blog"); + listen_for_event("weblog_post","delete","forum_publish_blog"); + listen_for_event("weblog_comment","publish","forum_publish_blog"); + listen_for_event("weblog_comment","delete","forum_publish_blog"); + + + + //redirect some functions to use our custom pages for community details... + $function['userdetails:edit:details'][] = $CFG->dirroot . "mod/forum/userdetails_edit.php"; + $function['userdetails:init'][] = $CFG->dirroot . "mod/forum/userdetails_actions.php"; + + + //foreach($function['display:sidebar'] as $key => $file) + //{ + + // if ($file == $CFG->dirroot . "mod/blog/lib/weblogs_user_info_menu.php") + // { + // $custom_sidebar=$CFG->dirroot . 'mod/forum/forum_user_info_menu.php'; + // $function['display:sidebar'][$key] = $custom_sidebar; + // } + + //} + + $function['sidebar:forum'][] = $CFG->dirroot . 'mod/forum/forum_user_info_menu.php'; + + + } // end function forum_init + + +function forum_publish_blog($object_type, $event, $object) +{ + global $CFG, $PAGE, $profile_id, $page_owner; + global $redirect_url; + + + include(dirname(__FILE__) . '/config.php'); + + //echo run("users:type:get", page_owner()); + + if ($object_type == "weblog_comment") { + $post = get_record('weblog_posts','ident',$object->post_id); + $post_id = $post->ident; + $community=$post->weblog; + + if ($forum_sort == 1){ + //NOW UPDATE THE LAST_MODIFIED STATUS OF THE WEBLOG_POST TO BE NOW SO THAT WE CAN SORT ON THIS IN THE FORUM VIEW... + $post->last_updated=time(); + update_record('weblog_posts',$post); + } + + } + + if ($object_type == "weblog_post") { + $post_id = $object->ident; + $community=$object->weblog; + + if ($forum_sort == 1){ + //NOW UPDATE THE LAST_MODIFIED STATUS OF THE WEBLOG_POST TO BE NOW SO THAT WE CAN SORT ON THIS IN THE FORUM VIEW... + $object->last_updated=time(); + update_record('weblog_posts',$object); + } + } + + + + $forum_flag = user_flag_get('forum', $community); + + //echo $forum_flag; + //echo $forum_default; + + if ((!$forum_flag) && ($forum_default == 0)) + { + $use_forum= "yes"; + } + else if ((!$forum_flag) && ($forum_default == 1)) + { + $use_forum= "no"; + } + else + { + $use_forum= $forum_flag; + } + + + if ($use_forum == "yes" && run('users:type:get', $community) == 'community') + { + if ($object_type == 'weblog_post') { + if ($event == 'delete') { + $community_record=get_record('users','ident',$community); + $redirect_url = $CFG->wwwroot . 'mod/forum/forum.php?weblog=' . $community_record->username; + define('redirect_url',$redirect_url); + } else { + $redirect_url = $CFG->wwwroot . 'mod/forum/forum_view_thread.php?post=' . $post_id; + define('redirect_url',$redirect_url); + } + } + + if ($object_type == 'weblog_comment') { + $redirect_url = $CFG->wwwroot . 'mod/forum/forum_view_thread.php?post=' . $post_id; + define('redirect_url',$redirect_url); + } + + } + + return $object; +} + + + + + +function forum_widget_display($widget) { + + global $CFG; + + $blog_id= widget_get_data("blog_id", $widget->ident); + $blog_posts= widget_get_data("blog_posts", $widget->ident); + + $style .= ""; + + $body= ""; + $body .=$style; + + + + if (empty ($blog_id)) { + global $page_owner; + $blog_id= $page_owner; + } + if (empty ($blog_posts)) { + $blog_posts= 1; + } + + $body .='
    '; + $where= run("users:access_level_sql_where", $_SESSION['userid']); + $posts= get_records_sql("select * from " . $CFG->prefix . "weblog_posts where ($where) and weblog = $blog_id order by last_updated desc limit $blog_posts"); + + if (is_array($posts) && !empty ($posts)) { + $body .="'; + } + $body .= '
    '; + + return array ('title' => __gettext('Forum').' :: ' . htmlspecialchars(user_name($blog_id), ENT_COMPAT, 'utf-8') . '', 'content' => $body); + +} + + + + + + +function forum_widget_edit($widget) { + + global $CFG, $page_owner; + + $blog_id= widget_get_data("blog_id", $widget->ident); + $blog_posts= widget_get_data("blog_posts", $widget->ident); + if (empty ($blog_posts)) { + $blog_posts= 1; + } + if (empty ($blog_id)) { + $blog_id= $page_owner; + } + + $connections= get_records_sql("select u.ident, u.name from " . $CFG->prefix . "friends f join " . $CFG->prefix . "users u on u.ident = f.friend where f.owner = " . $_SESSION['userid'] . " AND u.user_type=\"community\" order by u.name asc"); + $data= new stdClass; + $data->ident= $page_owner; + $data->name= run("profile:display:name", $page_owner); + $connections[]= $data; + if ($page_owner != $_SESSION['userid']) { + $data= new stdClass; + $data->ident= $_SESSION['userid']; + $data->name= run("profile:display:name", $_SESSION['userid']); + $connections[]= $data; + } + + $body= "

    " . __gettext("Forum widget") . "

    "; + $body .= "

    " . __gettext("This widget displays the last couple of forum posts from a community forum. To begin, select the community from your connections below:") . "

    "; + + $body .= "

    \n"; + + $body .= "

    " . __gettext("Then enter the number of forum posts you'd like to display:") . "

    "; + + $body .= "

    "; + + return $body; + +} + +?> Index: /elgg/trunk/mod/forum/forum_view_thread.php =================================================================== --- /elgg/trunk/mod/forum/forum_view_thread.php (revision 176) +++ /elgg/trunk/mod/forum/forum_view_thread.php (revision 176) @@ -0,0 +1,156 @@ +"; +$metatags .= str_replace('{{url}}', $CFG->wwwroot, file_get_contents($CFG->dirroot . "mod/forum/css")); +$metatags .= ""; + +define("context", "forum"); + +$individual = 1; + +$post = $_GET["post"]; +if (!empty($post)) { + + $where = run("users:access_level_sql_where",$_SESSION['userid']); + + if (!$post = get_record_select('weblog_posts','('.$where.') AND ident = '.$post)) { + $post = new StdClass; + $post->weblog = -1; + $post->owner = -1; + $post->title = __gettext("Access denied or post not found"); + $post->posted = time(); + $post->ident = -1; + $post->body = __gettext("Either this blog post doesn't exist or you don't currently have access privileges to view it."); + } + + global $page_owner; + global $profile_id; + $profile_id = $post->weblog; + $page_owner = $post->weblog; + $weblog = user_info('username', $post->weblog); + + $_SESSION['redirect_url'] = $CFG->wwwroot . 'mod/forum/forum.php?weblog=' . $weblog; + + if ((context == "forum") && run("users:type:get", $profile_id) == "community") + { + // Add to the submenu + + $num = count($PAGE->menu_sub) + 1; + + $PAGE->menu_sub[$num]['name'] = "forum:blogview"; + $PAGE->menu_sub[$num]['html'] = '' . __gettext("Return to Forum") . ''; + + $num = count($PAGE->menu_sub) + 1; + $PAGE->menu_sub[$num]['name'] = "forum:blogview"; + $PAGE->menu_sub[$num]['html'] = "wwwroot . $weblog . "/weblog/" . $post->ident . ".html#new_weblog_comment\" title=\"" . __gettext("Add a comment...") . "\">" . __gettext("Add new comment") . ""; + } + + + templates_page_setup(); + + $time = gmstrftime("%b %d, %y",$post->posted); + $body = " + + + + + "; + + + $body .= " + + + + + +"; + + + $select='select * from ' . $CFG->prefix . 'weblog_comments Where post_id='. $post->ident . ' ORDER by posted ASC'; + //echo $select; + $comments = get_records_sql($select); + $numberofcomments = get_record_sql("select count(*) as numberofcomments from ".$CFG->prefix."weblog_comments WHERE post_id =" . $post->ident); + $numberofcomments = $numberofcomments->numberofcomments; + + + + if (!empty($comments)){ + + foreach($comments as $comment) { + $body .= ""; + } + + } + + + $body .= "
    " . __gettext("From") . "" . $post->title . "
    " . run("weblogs:text:process", $post->body) . ""; + + if (run("permissions:check",array("weblog:edit",$post->owner))) + { + $Edit = __gettext("Edit"); + $returnConfirm = __gettext("Are you sure you want to permanently delete this forum post?"); + $Delete = __gettext("Delete"); + $body .="
    " . run("weblogs:text:process", $comment->body); + + if (logged_on && ($comment->owner == $_SESSION['userid'] || run("permissions:check",array("weblog:edit",$post->owner)))) + { + $returnConfirm = __gettext("Are you sure you want to permanently delete this forum comment?"); + $Delete = __gettext("Delete"); + $body .="

    + wwwroot}mod/blog/action_redirection.php?action=weblog_comment_delete&weblog_comment_delete={$comment->ident}&extension=weblog\" onclick=\"return confirm('$returnConfirm')\" title=\"$Delete\"> +

    + "; + } + + + + $body .= "

    wwwroot . user_info('username',$post->weblog) . "/weblog/" . $post->ident . ".html#new_weblog_comment\" title=\"" . __gettext("Add new comment...") . "\">" . __gettext("Add new comment...") . "

    "; + } + + + + + + + + + + // Draw page + $title = run("profile:display:name") . " :: " . __gettext("Forum"); + + $body = templates_draw(array( + 'context' => 'contentholder', + 'title' => $title, + 'body' => $body + ) + ); + + echo templates_page_draw( array( + $title, $body + ) + ); + +?> Index: /elgg/trunk/mod/forum/lib.bak =================================================================== --- /elgg/trunk/mod/forum/lib.bak (revision 176) +++ /elgg/trunk/mod/forum/lib.bak (revision 176) @@ -0,0 +1,152 @@ +menu_sub) + 1; + + $PAGE->menu_sub[$num]['name'] = "weblog:forum"; + $PAGE->menu_sub[$num]['html'] = '' . __gettext("View as Forum") . ''; + } + + + + } + + function forum_init() + { + + + global $function, $CFG, $page_owner, $profile_id, $db, $METATABLES; + include(dirname(__FILE__) . '/config.php'); + + + + + if (in_array($CFG->prefix . "weblog_posts", $METATABLES)) { + $messagesTable = $db->MetaColumnNames($CFG->prefix . "weblog_posts", true); + // If dosn't exists adding the colummns 'last_updated' + if (!in_array("last_updated", $messagesTable)) { + if (file_exists($CFG->dirroot . "mod/forum/$CFG->dbtype.sql")) { + modify_database($CFG->dirroot . "mod/forum/$CFG->dbtype.sql"); + } else { + error("Error: Your database ($CFG->dbtype) is not yet fully supported by the Elgg forum plug-in. See the mod/forum directory."); + } + print_continue($CFG->wwwroot); + exit(); + } + } + + listen_for_event("weblog_post","publish","forum_publish_blog"); + listen_for_event("weblog_post","republish","forum_publish_blog"); + listen_for_event("weblog_post","delete","forum_publish_blog"); + listen_for_event("weblog_comment","publish","forum_publish_blog"); + listen_for_event("weblog_comment","delete","forum_publish_blog"); + + + + //redirect some functions to use our custom pages for community details... + $function['userdetails:edit:details'][] = $CFG->dirroot . "mod/forum/userdetails_edit.php"; + $function['userdetails:init'][] = $CFG->dirroot . "mod/forum/userdetails_actions.php"; + + + foreach($function['display:sidebar'] as $key => $file) + { + + if ($file == $CFG->dirroot . "mod/blog/lib/weblogs_user_info_menu.php") + { + $custom_sidebar=$CFG->dirroot . 'mod/forum/forum_user_info_menu.php'; + $function['display:sidebar'][$key] = $custom_sidebar; + } + + } + + + } // end function forum_init + + +function forum_publish_blog($object_type, $event, $object) +{ + global $CFG, $PAGE, $profile_id, $page_owner; + global $redirect_url; + + + include(dirname(__FILE__) . '/config.php'); + + //echo run("users:type:get", page_owner()); + + if ($object_type == "weblog_comment") { + $post = get_record('weblog_posts','ident',$object->post_id); + $post_id = $post->ident; + $community=$post->weblog; + + if ($forum_sort == 1){ + //NOW UPDATE THE LAST_MODIFIED STATUS OF THE WEBLOG_POST TO BE NOW SO THAT WE CAN SORT ON THIS IN THE FORUM VIEW... + $post->last_updated=time(); + update_record('weblog_posts',$post); + } + + } + + if ($object_type == "weblog_post") { + $post_id = $object->ident; + $community=$object->weblog; + + if ($forum_sort == 1){ + //NOW UPDATE THE LAST_MODIFIED STATUS OF THE WEBLOG_POST TO BE NOW SO THAT WE CAN SORT ON THIS IN THE FORUM VIEW... + $object->last_updated=time(); + update_record('weblog_posts',$object); + } + } + + + + $forum_flag = user_flag_get('forum', $community); + + //echo $forum_flag; + //echo $forum_default; + + if ((!$forum_flag) && ($forum_default == 0)) + { + $use_forum= "yes"; + } + else if ((!$forum_flag) && ($forum_default == 1)) + { + $use_forum= "no"; + } + else + { + $use_forum= $forum_flag; + } + + + if ($use_forum == "yes" && run('users:type:get', $community) == 'community') + { + if ($object_type == 'weblog_post') { + if ($event == 'delete') { + $community_record=get_record('users','ident',$community); + $redirect_url = $CFG->wwwroot . 'mod/forum/forum.php?weblog=' . $community_record->username; + define('redirect_url',$redirect_url); + } else { + $redirect_url = $CFG->wwwroot . 'mod/forum/forum_view_thread.php?post=' . $post_id; + define('redirect_url',$redirect_url); + } + } + + if ($object_type == 'weblog_comment') { + $redirect_url = $CFG->wwwroot . 'mod/forum/forum_view_thread.php?post=' . $post_id; + define('redirect_url',$redirect_url); + } + + } + + return $object; +} + +?> Index: /elgg/trunk/mod/forum/mysql.sql =================================================================== --- /elgg/trunk/mod/forum/mysql.sql (revision 176) +++ /elgg/trunk/mod/forum/mysql.sql (revision 176) @@ -0,0 +1,1 @@ +alter table prefix_weblog_posts add column last_updated int(11) NOT NULL default '0' COMMENT 'unix timestamp'; Index: /elgg/trunk/mod/forum/trunk/forum_view_thread.php =================================================================== --- /elgg/trunk/mod/forum/trunk/forum_view_thread.php (revision 176) +++ /elgg/trunk/mod/forum/trunk/forum_view_thread.php (revision 176) @@ -0,0 +1,156 @@ +"; +$metatags .= str_replace('{{url}}', $CFG->wwwroot, file_get_contents($CFG->dirroot . "mod/forum/css")); +$metatags .= ""; + +define("context", "forum"); + +$individual = 1; + +$post = $_GET["post"]; +if (!empty($post)) { + + $where = run("users:access_level_sql_where",$_SESSION['userid']); + + if (!$post = get_record_select('weblog_posts','('.$where.') AND ident = '.$post)) { + $post = new StdClass; + $post->weblog = -1; + $post->owner = -1; + $post->title = __gettext("Access denied or post not found"); + $post->posted = time(); + $post->ident = -1; + $post->body = __gettext("Either this blog post doesn't exist or you don't currently have access privileges to view it."); + } + + global $page_owner; + global $profile_id; + $profile_id = $post->weblog; + $page_owner = $post->weblog; + $weblog = user_info('username', $post->weblog); + + $_SESSION['redirect_url'] = $CFG->wwwroot . 'mod/forum/forum.php?weblog=' . $weblog; + + if ((context == "forum") && run("users:type:get", $profile_id) == "community") + { + // Add to the submenu + + $num = count($PAGE->menu_sub) + 1; + + $PAGE->menu_sub[$num]['name'] = "forum:blogview"; + $PAGE->menu_sub[$num]['html'] = '' . __gettext("Return to Forum") . ''; + + $num = count($PAGE->menu_sub) + 1; + $PAGE->menu_sub[$num]['name'] = "forum:blogview"; + $PAGE->menu_sub[$num]['html'] = "wwwroot . $weblog . "/weblog/" . $post->ident . ".html#new_weblog_comment\" title=\"" . __gettext("Add a comment...") . "\">" . __gettext("Add new comment") . ""; + } + + + templates_page_setup(); + + $time = gmstrftime("%b %d, %y",$post->posted); + $body = " + + + + + "; + + + $body .= " + + + + + +"; + + + $select='select * from ' . $CFG->prefix . 'weblog_comments Where post_id='. $post->ident . ' ORDER by posted ASC'; + //echo $select; + $comments = get_records_sql($select); + $numberofcomments = get_record_sql("select count(*) as numberofcomments from ".$CFG->prefix."weblog_comments WHERE post_id =" . $post->ident); + $numberofcomments = $numberofcomments->numberofcomments; + + + + if (!empty($comments)){ + + foreach($comments as $comment) { + $body .= ""; + } + + } + + + $body .= "
    " . __gettext("From") . "" . $post->title . "
    " . run("weblogs:text:process", $post->body) . ""; + + if (run("permissions:check",array("weblog:edit",$post->owner))) + { + $Edit = __gettext("Edit"); + $returnConfirm = __gettext("Are you sure you want to permanently delete this forum post?"); + $Delete = __gettext("Delete"); + $body .="
    " . run("weblogs:text:process", $comment->body); + + if (logged_on && ($comment->owner == $_SESSION['userid'] || run("permissions:check",array("weblog:edit",$post->owner)))) + { + $returnConfirm = __gettext("Are you sure you want to permanently delete this forum comment?"); + $Delete = __gettext("Delete"); + $body .="

    + wwwroot}mod/blog/action_redirection.php?action=weblog_comment_delete&weblog_comment_delete={$comment->ident}&extension=weblog\" onclick=\"return confirm('$returnConfirm')\" title=\"$Delete\"> +

    + "; + } + + + + $body .= "

    wwwroot . user_info('username',$post->weblog) . "/weblog/" . $post->ident . ".html#new_weblog_comment\" title=\"" . __gettext("Add new comment...") . "\">" . __gettext("Add new comment...") . "

    "; + } + + + + + + + + + + // Draw page + $title = run("profile:display:name") . " :: " . __gettext("Forum"); + + $body = templates_draw(array( + 'context' => 'contentholder', + 'title' => $title, + 'body' => $body + ) + ); + + echo templates_page_draw( array( + $title, $body + ) + ); + +?> Index: /elgg/trunk/mod/forum/trunk/userdetails_edit.php =================================================================== --- /elgg/trunk/mod/forum/trunk/userdetails_edit.php (revision 176) +++ /elgg/trunk/mod/forum/trunk/userdetails_edit.php (revision 176) @@ -0,0 +1,63 @@ +dirroot . 'mod/forum/config.php'); + + + if ((logged_on) && run("users:type:get", $page_owner) == "community") + { + $forum_title = __gettext("Blog/Forum View:"); + $forumRules = __gettext("Set this to 'yes' if you would like to default this user/community blog to a 'forum' view."); + + $body = <<< END + +

    $forum_title

    +

    + $forumRules +

    + +END; + $forum=""; + $forum = user_flag_get('forum', $page_owner); + //echo $forum . '
    '; + if ($forum=="") + { + //echo "NO FORUM flag - set to default from config..."; + if ($forum_default == 0){ + $forum = "yes"; + } else { + $forum = "no"; + } + } + + + if ($forum == "no") + { + //echo "NO FORUM! flag set to no"; + $body .= templates_draw( array( + 'context' => 'databox', + 'name' => __gettext("Default Blog View to 'Forum' type: "), + 'column1' => " " + ) + ); + } else + { + //echo "FORUM! flag set to yes"; + $body .= templates_draw( array( + 'context' => 'databox', + 'name' => __gettext("Default Blog View to 'Forum' type: "), + 'column1' => " " + ) + ); + } + + + $run_result .= $body; + + } + +?> Index: /elgg/trunk/mod/forum/trunk/LICENSE =================================================================== --- /elgg/trunk/mod/forum/trunk/LICENSE (revision 176) +++ /elgg/trunk/mod/forum/trunk/LICENSE (revision 176) @@ -0,0 +1,340 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Library General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + , 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Library General +Public License instead of this License. Index: /elgg/trunk/mod/forum/trunk/mysql.sql =================================================================== --- /elgg/trunk/mod/forum/trunk/mysql.sql (revision 176) +++ /elgg/trunk/mod/forum/trunk/mysql.sql (revision 176) @@ -0,0 +1,1 @@ +alter table prefix_weblog_posts add column last_updated int(11) NOT NULL default '0' COMMENT 'unix timestamp'; Index: /elgg/trunk/mod/forum/trunk/languages/es_BO/LC_MESSAGES/es_BO.po =================================================================== --- /elgg/trunk/mod/forum/trunk/languages/es_BO/LC_MESSAGES/es_BO.po (revision 176) +++ /elgg/trunk/mod/forum/trunk/languages/es_BO/LC_MESSAGES/es_BO.po (revision 176) @@ -0,0 +1,179 @@ +# Español translation of PACKAGE. +# Copyright (C) 2007 THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# Rolando Espinoza La Fuente , 2007. +# , fuzzy +# +# +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2007-07-04 16:56-0400\n" +"PO-Revision-Date: 2007-07-04 17:35-0400\n" +"Last-Translator: Rolando Espinoza La Fuente \n" +"Language-Team: Español \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit" + +#: forum_user_info_menu.php:10 +msgid "Recent Activity" +msgstr "" + +#: forum_user_info_menu.php:12 +msgid "View your activity" +msgstr "" + +#: forum_user_info_menu.php:29 +msgid "Forum & Blogs" +msgstr "Foros & Blogs" + +#: forum_user_info_menu.php:36 +msgid "Personal blog" +msgstr "" + +#: forum_user_info_menu.php:41 +msgid "Community Forum" +msgstr "Foro de la comunidad" + +#: forum_user_info_menu.php:49 +msgid "Archive" +msgstr "" + +#: forum_user_info_menu.php:50 +msgid "Members blog" +msgstr "Blogs de miembros" + +#: forum_view_thread.php:34 +msgid "Access denied or post not found" +msgstr "" + +#: forum_view_thread.php:37 +msgid "" +"Either this blog post doesn't exist or you don't currently have access " +"privileges to view it." +msgstr "" + +#: forum_view_thread.php:53 +msgid "Return to Forum" +msgstr "Regresar al foro" + +#: forum_view_thread.php:57 +msgid "Add a comment..." +msgstr "Añadir comentario..." + +#: forum_view_thread.php:57 +msgid "Add new comment" +msgstr "Añadir nuevo comentario" + +#: forum_view_thread.php:67 +msgid "From" +msgstr "De" + +#: forum_view_thread.php:75 forum_view_thread.php:108 forum.php:125 +msgid "View profile..." +msgstr "Ver perfil..." + +#: forum_view_thread.php:80 +msgid "Edit" +msgstr "Editar" + +#: forum_view_thread.php:81 +msgid "Are you sure you want to permanently delete this forum post?" +msgstr "Estas seguro de querer borrar esta entrada del foro?" + +#: forum_view_thread.php:82 forum_view_thread.php:113 +msgid "Delete" +msgstr "Borrar" + +#: forum_view_thread.php:112 +msgid "Are you sure you want to permanently delete this forum comment?" +msgstr "Estas seguro de borrar este comentario del foro?" + +#: forum_view_thread.php:128 +msgid "Add new comment..." +msgstr "Añadir nuevo comentario..." + +#: forum_view_thread.php:140 forum.php:164 forum.php:171 +msgid "Forum" +msgstr "Foro" + +#: lib.php:15 +msgid "View as Forum" +msgstr "Ver como foro" + +#: userdetails_actions.php:15 +msgid "Your forum view preferences have been saved" +msgstr "Se ha guardado tu configuració de vista como foro" + +#: userdetails_actions.php:18 +msgid "Your forum view preferences have been changed" +msgstr "Se ha cambiado tu configuración de vista como foro" + +#: userdetails_actions.php:20 +msgid "Your forum view preferences could not be changed" +msgstr "No se pudo cambiar tu configuración de vista como foro" + +#: userdetails_edit.php:11 +msgid "Blog/Forum View:" +msgstr "Blog/Foro vista:" + +#: userdetails_edit.php:12 +msgid "" +"Set this to 'yes' if you would like to default this user/community blog to a " +"'forum' view." +msgstr "Selecciona 'Si' si quieres que el blog se vea como foro" + +#: userdetails_edit.php:33 userdetails_edit.php:41 +msgid "Default Blog View to 'Forum' type: " +msgstr "Ver blog como foro por defecto:" + +#: userdetails_edit.php:34 userdetails_edit.php:42 +msgid "Yes" +msgstr "Si" + +#: userdetails_edit.php:34 userdetails_edit.php:42 +msgid "No" +msgstr "No" + +#: forum.php:40 forum.php:136 +msgid "Add New Item" +msgstr "Añadir entrada" + +#: forum.php:45 +msgid "View as Blog" +msgstr "Ver como blog" + +#: forum.php:89 +msgid "Discussion Topic" +msgstr "Tema de discusión" + +#: forum.php:90 +msgid "Started by" +msgstr "Empezado por" + +#: forum.php:91 +msgid "Comments" +msgstr "Comentarios" + +#: forum.php:124 +msgid "View full discussion..." +msgstr "Ver discusión completa..." + +#: forum.php:126 +msgid "View comments..." +msgstr "Ver comentarios..." + +#: forum.php:142 +msgid "Back" +msgstr "" + +#: forum.php:154 +msgid "Next" +msgstr "" + +#: forum.php:169 +msgid "This forum doesn't exists." +msgstr "El foro no existe" + Index: /elgg/trunk/mod/forum/trunk/languages/it/LC_MESSAGES/it.po =================================================================== --- /elgg/trunk/mod/forum/trunk/languages/it/LC_MESSAGES/it.po (revision 176) +++ /elgg/trunk/mod/forum/trunk/languages/it/LC_MESSAGES/it.po (revision 176) @@ -0,0 +1,222 @@ +# Español translation of PACKAGE. +# Copyright (C) 2007 THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# Rolando Espinoza La Fuente , 2007. +# , fuzzy +# +# +msgid "" +msgstr "" +"Project-Id-Version: Elgg Forum\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2007-07-04 16:56-0400\n" +"PO-Revision-Date: 2007-12-17 12:41+0100\n" +"Last-Translator: Simone Tolotti \n" +"Language-Team: Italiano \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Poedit-Language: Italian\n" +"X-Poedit-KeywordsList: __gettext\n" +"X-Poedit-Basepath: ../../../\n" +"X-Poedit-SearchPath-0: .\n" + +#: userdetails_edit.php:13 +msgid "Blog/Forum View:" +msgstr "Vista Blog/Forum:" + +#: userdetails_edit.php:14 +msgid "Set this to 'yes' if you would like to default this user/community blog to a 'forum' view." +msgstr "Seleziona 'Si' se vuoi che questo blog sia visualizzato come forum" + +#: userdetails_edit.php:43 +#: userdetails_edit.php:52 +msgid "Default Blog View to 'Forum' type: " +msgstr "Visualizza blog come Forum:" + +#: userdetails_edit.php:44 +#: userdetails_edit.php:53 +msgid "Yes" +msgstr "Si" + +#: userdetails_edit.php:44 +#: userdetails_edit.php:53 +msgid "No" +msgstr "No" + +#: forum_user_info_menu.php:12 +msgid "Recent Activity" +msgstr "Attività recente" + +#: forum_user_info_menu.php:14 +msgid "View your activity" +msgstr "Vedi la tua attività" + +#: forum_user_info_menu.php:31 +msgid "Forum & Blogs" +msgstr "Forum & Blog" + +#: forum_user_info_menu.php:38 +msgid "Personal blog" +msgstr "Blog personale" + +#: forum_user_info_menu.php:65 +msgid "Community Forum" +msgstr "Forum della comunità" + +#: forum_user_info_menu.php:72 +#: forum_user_info_menu.php:87 +msgid "Archive" +msgstr "Archivio" + +#: forum_user_info_menu.php:73 +msgid "Members blog" +msgstr "Blog dei Membri" + +#: forum_user_info_menu.php:80 +msgid "Community Blog" +msgstr "Blog della comunità" + +#: forum_user_info_menu.php:88 +msgid "Friends blog" +msgstr "Blog degli amici" + +#: userdetails_actions.php:15 +msgid "Your forum view preferences have been saved" +msgstr "Le tue preferenze per la vista del forum sono state salvate" + +#: userdetails_actions.php:18 +msgid "Your forum view preferences have been changed" +msgstr "Le tue preferenze per la vista del forum sono state modificate" + +#: userdetails_actions.php:20 +msgid "Your forum view preferences could not be changed" +msgstr "Le tue preferenze per la vista del forum non possono essere modificate" + +#: lib.php:15 +msgid "View as Forum" +msgstr "Vedi come forum" + +#: lib.php:50 +#: lib.php:214 +msgid "Forum widget" +msgstr "Widget Forum" + +#: lib.php:51 +msgid "Displays the latest posts from a Community Forum of your choice." +msgstr "Mostra gli ultimi post del forum di una comunità a tua scelta." + +#: lib.php:194 +msgid "Forum :: " +msgstr "Forum ::" + +#: lib.php:215 +msgid "This widget displays the last couple of posts from a Community Forum. To begin, select the Community from your connections below:" +msgstr "Questo widget mostra gli ultimi post del forum di una comunità. Per iniziare, scegli la comunità dalle tue connessioni qua sotto:" + +#: lib.php:219 +msgid "Then enter the number of posts you'd like to display:" +msgstr "Poi inserisci quanti post vuoi che siano mostrati:" + +#: forum_view_thread.php:34 +msgid "Access denied or post not found" +msgstr "Accesso non permesso o post non trovato" + +#: forum_view_thread.php:37 +msgid "Either this blog post doesn't exist or you don't currently have access privileges to view it." +msgstr "Questo articolo del blog non esiste oppure non hai il permesso di visualizzarlo." + +#: forum_view_thread.php:55 +msgid "Return to Forum" +msgstr "Torna al Forum" + +#: forum_view_thread.php:59 +msgid "Add a comment..." +msgstr "Aggiungi un commento..." + +#: forum_view_thread.php:59 +msgid "Add new comment" +msgstr "Aggiungi un nuovo commento" + +#: forum_view_thread.php:69 +msgid "From" +msgstr "Da" + +#: forum_view_thread.php:77 +#: forum_view_thread.php:110 +#: forum.php:144 +msgid "View profile..." +msgstr "Vedi profilo..." + +#: forum_view_thread.php:82 +msgid "Edit" +msgstr "Modifica" + +#: forum_view_thread.php:83 +msgid "Are you sure you want to permanently delete this forum post?" +msgstr "Sei sicuro di voler eliminare definitivamente questo post del forum?" + +#: forum_view_thread.php:84 +#: forum_view_thread.php:115 +msgid "Delete" +msgstr "Elimina" + +#: forum_view_thread.php:114 +msgid "Are you sure you want to permanently delete this forum comment?" +msgstr "Sei sicuro di voler eliminare definitivamente questo commento del forum?" + +#: forum_view_thread.php:130 +msgid "Add new comment..." +msgstr "Aggiungi nuovo commento..." + +#: forum_view_thread.php:142 +#: forum.php:188 +#: forum.php:195 +msgid "Forum" +msgstr "Forum" + +#: forum.php:40 +#: forum.php:158 +msgid "Add New Item" +msgstr "Aggiungi nuovo elemento" + +#: forum.php:45 +msgid "View as Blog" +msgstr "Vedi come blog" + +#: forum.php:93 +msgid "Discussion Topic" +msgstr "Tema della discussione" + +#: forum.php:94 +msgid "Started by" +msgstr "Iniziato da" + +#: forum.php:95 +msgid "Comments" +msgstr "Commenti" + +#: forum.php:96 +msgid "Latest Comment" +msgstr "Ultimi commenti" + +#: forum.php:143 +msgid "View full discussion..." +msgstr "Vedi tutta la discussione..." + +#: forum.php:145 +msgid "View comments..." +msgstr "Vedi commenti..." + +#: forum.php:166 +msgid "Back" +msgstr "Indietro" + +#: forum.php:178 +msgid "Next" +msgstr "Prossimo" + +#: forum.php:193 +msgid "This forum doesn't exists." +msgstr "Questo Forum non esiste" + Index: /elgg/trunk/mod/forum/trunk/css =================================================================== --- /elgg/trunk/mod/forum/trunk/css (revision 176) +++ /elgg/trunk/mod/forum/trunk/css (revision 176) @@ -0,0 +1,68 @@ +#forum_table { + width: 100%; + padding: 0; + margin: 0; +} + + + +#forum_table th { + font: bold 11px "Trebuchet MS", Verdana, Arial, Helvetica, sans-serif; + background:url({{url}}mod/forum/images/toolbar_nav_grey.gif) repeat-x bottom; + border-right: solid 1px #eeeeee; + border-bottom: 0; + border-top: solid 1px #eeeeee; + border-left: solid 1px #eeeeee; + letter-spacing: 2px; + text-transform: uppercase; + text-align: left; + padding: 6px 6px 6px 6px; +} + +#forum_table th.nobg { + border-top: 0; + border-left: 0; + border-right: dotted 0px #eeeeee; + border-bottom: dotted 1px #eeeeee; + background: none; +} + +#forum_table th.cent { + text-align: center; + background:url({{url}}mod/forum/images/toolbar_nav_grey.gif) repeat-x bottom; +} + +#forum_table td { + border-right: dotted 1px #eeeeee; + border-bottom: dotted 1px #eeeeee; + border-left: dotted 0px #eeeeee; + border-top: dotted 0px #eeeeee; + padding: 6px 6px 6px 6px; +} + +#forum_table td.cent { + text-align:center; +} + + +#forum_table td.smallprint { + font: 9px "Trebuchet MS", Verdana, Arial, Helvetica, sans-serif; +} + + +#forum_table td.usercol { + border-left: dotted 1px #eeeeee; + border-right: dotted 1px #eeeeee; + border-bottom: dotted 1px #eeeeee; + border-top: 0; + font: bold 10px "Trebuchet MS", Verdana, Arial, Helvetica, sans-serif; +} + +#forum_table .edit_delete { + vertical-align: bottom; + text-align: right; +} + +#forum_table img { + width: inherit; +} Index: /elgg/trunk/mod/forum/trunk/plugin.info =================================================================== --- /elgg/trunk/mod/forum/trunk/plugin.info (revision 176) +++ /elgg/trunk/mod/forum/trunk/plugin.info (revision 176) @@ -0,0 +1,10 @@ +Maintainer: Tim Hawes +Title: Explode Widget +Version: 0.1 +Package: forum +Distribution-URL: http://elgg.org/mod/plugins/plugin.php?id=6 +Source-URL: https://svn.elgg.org/plugins/forum +Depends: elgg (>= 0.9) +Tags: blog, forum, sidebar +Priority: optional +Description: This is plugin extends blog functionality for be used like a forum system. Index: /elgg/trunk/mod/forum/trunk/userdetails_actions.php =================================================================== --- /elgg/trunk/mod/forum/trunk/userdetails_actions.php (revision 176) +++ /elgg/trunk/mod/forum/trunk/userdetails_actions.php (revision 176) @@ -0,0 +1,26 @@ + Index: /elgg/trunk/mod/forum/trunk/README.txt =================================================================== --- /elgg/trunk/mod/forum/trunk/README.txt (revision 176) +++ /elgg/trunk/mod/forum/trunk/README.txt (revision 176) @@ -0,0 +1,53 @@ +Forum Plugin for Elgg +GPL v2, yada yada yada... + +***REQUIRES ELGG v0.9*** + +To install: +-copy the forum folder to your /mod/ folder +-login as "news" (executes a minor database upgrade) +-edit mod/forum/config.php to change config (optional) +-visit a community blog that has a few posts and comments to those posts +-on the community blog, find the link that says "View as Forum" + +Add the following lines to the end of your .htaccess file (just above the ): + +#FORUM PLUGIN REWRITE ELEMENTS +RewriteRule ^([A-Za-z0-9]+)\/forum\/?$ mod/forum/forum.php?weblog=$1 +RewriteRule ^([A-Za-z0-9]+)\/forum\/skip=([0-9]+)$ mod/forum/forum.php?weblog=$1&weblog_offset=$2 +RewriteRule ^[A-Za-z0-9]+\/forum\/([0-9]+)(\.html)?$ mod/forum/forum_view_thread.php?post=$1 + + + + +History: + +v0.4 (December 2007) +-updated for compatability with new elgg sidebar block mechanism (Elgg 0.9) + +v0.31 (November 2007) +-added a profile widget so that the latest forum threads can be displayed on the community's profile page +-added a "latest comment by" column on forum view + +v0.3 (July 2007) +-major cleanup of code/sloppiness +-fixed issues with Elgg v0.8 +-lots of contribution to this revision by Rho (http://elgg.org/rho) + + +v0.2 (March 10, 2007) +-added sorting based on last updated threads +-added better handling of default behaviour (forum vs. community blog) + +v0.1 (Feb 8, 2007) +-finally usable! +-now has a more master/detail view +-moved to tables for layout rather than pure CSS +-uses post_icon to display image for each thread +-uses list_for_event API to return to approapriate view after adding, editing, deleting a post or comment + +v0.000000000001 (Jan, 2007) +-actually getting a bit useful! +-added linking/posting new comments +-fixed bug where sidebar showed current user rather than the community profile +-now displays posters name, tooltip of comment content Index: /elgg/trunk/mod/forum/trunk/config.php =================================================================== --- /elgg/trunk/mod/forum/trunk/config.php (revision 176) +++ /elgg/trunk/mod/forum/trunk/config.php (revision 176) @@ -0,0 +1,18 @@ + Index: /elgg/trunk/mod/forum/trunk/forum_user_info_menu.php =================================================================== --- /elgg/trunk/mod/forum/trunk/forum_user_info_menu.php (revision 176) +++ /elgg/trunk/mod/forum/trunk/forum_user_info_menu.php (revision 176) @@ -0,0 +1,112 @@ +dirroot . 'mod/forum/config.php'); + + +if (logged_on && $page_owner == $_SESSION['userid']) { + + $title = __gettext("Recent Activity"); + $body = ""; + + $run_result .= "
  • "; + $run_result .= templates_draw(array( + 'context' => 'sidebarholder', + 'title' => $title, + 'body' => $body, + ) + ); + $run_result .= "
  • "; + +} else { + + //$posts = count_records_select('weblog_posts','('.run("users:access_level_sql_where",$profile_id).") and owner = $profile_id"); + + if (logged_on || (isset($page_owner) && $page_owner != -1)) { + + $title = __gettext("Forum & Blogs"); + + $weblog_username = user_info('username', $profile_id); + $body = <<< END +
      +END; + if (user_type($page_owner) == "person") { + $personalWeblog = __gettext("Personal blog"); + $body .= <<< END +
    • $personalWeblog (RSS)
    • +END; + } else if (user_type($page_owner) == "community") { + + + + $forum_flag = user_flag_get('forum', $profile_id); + //echo $forum_flag; + //echo $forum_default; + + if ((!$forum_flag) && ($forum_default == 0)) + { + $use_forum= "yes"; + } + else if ((!$forum_flag) && ($forum_default == 1)) + { + $use_forum= "no"; + } + else + { + $use_forum= $forum_flag; + } + + if ($use_forum=="yes"){ + + $communityWeblog = __gettext("Community Forum"); + $body .= <<< END +
    • + $communityWeblog + RSS
    • +END; + + $blogArchive = __gettext("Archive"); + $membersWeblog = __gettext("Members blog"); + $body .= <<< END +
    • $blogArchive
    • +
    • $membersWeblog
    • +END; + } else { + + $communityWeblog = __gettext("Community Blog"); + $body .= <<< END +
    • + $communityWeblog + (RSS)
    • +END; + + $blogArchive = __gettext("Archive"); + $membersWeblog = __gettext("Friends blog"); + $body .= <<< END +
    • $blogArchive
    • +
    • $membersWeblog
    • +END; + + } + + + +} + $run_result .= "
    • "; + $run_result .= templates_draw(array( + 'context' => 'sidebarholder', + 'title' => $title, + 'body' => $body, + ) + ); + $run_result .= "
    "; + } +} + +?> Index: /elgg/trunk/mod/forum/trunk/lib.php =================================================================== --- /elgg/trunk/mod/forum/trunk/lib.php (revision 176) +++ /elgg/trunk/mod/forum/trunk/lib.php (revision 176) @@ -0,0 +1,261 @@ +menu_sub) + 1; + + $PAGE->menu_sub[$num]['name'] = "weblog:forum"; + $PAGE->menu_sub[$num]['html'] = '' . __gettext("View as Forum") . ''; + } + + $forum_menu = run('sidebar:forum'); // get the output of legacy sidebar + $forum_menu = sidebar_legacy_wrap($forum_menu); // remove legacy unneeded html code
  • + + sidebar_add(20, 'sidebar-forum', $forum_menu, true, "Your Forum"); // add the block to sidebar with weight 20 + sidebar_remove('sidebar-blog'); + + } + + function forum_init() + { + + + global $function, $CFG, $page_owner, $profile_id, $db, $METATABLES; + include(dirname(__FILE__) . '/config.php'); + + + + + if (in_array($CFG->prefix . "weblog_posts", $METATABLES)) { + $messagesTable = $db->MetaColumnNames($CFG->prefix . "weblog_posts", true); + // If dosn't exists adding the colummns 'last_updated' + if (!in_array("last_updated", $messagesTable)) { + if (file_exists($CFG->dirroot . "mod/forum/$CFG->dbtype.sql")) { + modify_database($CFG->dirroot . "mod/forum/$CFG->dbtype.sql"); + } else { + error("Error: Your database ($CFG->dbtype) is not yet fully supported by the Elgg forum plug-in. See the mod/forum directory."); + } + print_continue($CFG->wwwroot); + exit(); + } + } + + $CFG->widgets->list[]= array ('name' => __gettext("Forum widget"), + 'description' => __gettext("Displays the latest posts from a Community Forum of your choice."), + 'type' => "forum::forum"); + + listen_for_event("weblog_post","publish","forum_publish_blog"); + listen_for_event("weblog_post","republish","forum_publish_blog"); + listen_for_event("weblog_post","delete","forum_publish_blog"); + listen_for_event("weblog_comment","publish","forum_publish_blog"); + listen_for_event("weblog_comment","delete","forum_publish_blog"); + + + + //redirect some functions to use our custom pages for community details... + $function['userdetails:edit:details'][] = $CFG->dirroot . "mod/forum/userdetails_edit.php"; + $function['userdetails:init'][] = $CFG->dirroot . "mod/forum/userdetails_actions.php"; + + + //foreach($function['display:sidebar'] as $key => $file) + //{ + + // if ($file == $CFG->dirroot . "mod/blog/lib/weblogs_user_info_menu.php") + // { + // $custom_sidebar=$CFG->dirroot . 'mod/forum/forum_user_info_menu.php'; + // $function['display:sidebar'][$key] = $custom_sidebar; + // } + + //} + + $function['sidebar:forum'][] = $CFG->dirroot . 'mod/forum/forum_user_info_menu.php'; + + + } // end function forum_init + + +function forum_publish_blog($object_type, $event, $object) +{ + global $CFG, $PAGE, $profile_id, $page_owner; + global $redirect_url; + + + include(dirname(__FILE__) . '/config.php'); + + //echo run("users:type:get", page_owner()); + + if ($object_type == "weblog_comment") { + $post = get_record('weblog_posts','ident',$object->post_id); + $post_id = $post->ident; + $community=$post->weblog; + + if ($forum_sort == 1){ + //NOW UPDATE THE LAST_MODIFIED STATUS OF THE WEBLOG_POST TO BE NOW SO THAT WE CAN SORT ON THIS IN THE FORUM VIEW... + $post->last_updated=time(); + update_record('weblog_posts',$post); + } + + } + + if ($object_type == "weblog_post") { + $post_id = $object->ident; + $community=$object->weblog; + + if ($forum_sort == 1){ + //NOW UPDATE THE LAST_MODIFIED STATUS OF THE WEBLOG_POST TO BE NOW SO THAT WE CAN SORT ON THIS IN THE FORUM VIEW... + $object->last_updated=time(); + update_record('weblog_posts',$object); + } + } + + + + $forum_flag = user_flag_get('forum', $community); + + //echo $forum_flag; + //echo $forum_default; + + if ((!$forum_flag) && ($forum_default == 0)) + { + $use_forum= "yes"; + } + else if ((!$forum_flag) && ($forum_default == 1)) + { + $use_forum= "no"; + } + else + { + $use_forum= $forum_flag; + } + + + if ($use_forum == "yes" && run('users:type:get', $community) == 'community') + { + if ($object_type == 'weblog_post') { + if ($event == 'delete') { + $community_record=get_record('users','ident',$community); + $redirect_url = $CFG->wwwroot . 'mod/forum/forum.php?weblog=' . $community_record->username; + define('redirect_url',$redirect_url); + } else { + $redirect_url = $CFG->wwwroot . 'mod/forum/forum_view_thread.php?post=' . $post_id; + define('redirect_url',$redirect_url); + } + } + + if ($object_type == 'weblog_comment') { + $redirect_url = $CFG->wwwroot . 'mod/forum/forum_view_thread.php?post=' . $post_id; + define('redirect_url',$redirect_url); + } + + } + + return $object; +} + + + + + +function forum_widget_display($widget) { + + global $CFG; + + $blog_id= widget_get_data("blog_id", $widget->ident); + $blog_posts= widget_get_data("blog_posts", $widget->ident); + + $style .= ""; + + $body= ""; + $body .=$style; + + + + if (empty ($blog_id)) { + global $page_owner; + $blog_id= $page_owner; + } + if (empty ($blog_posts)) { + $blog_posts= 1; + } + + $body .='
    '; + $where= run("users:access_level_sql_where", $_SESSION['userid']); + $posts= get_records_sql("select * from " . $CFG->prefix . "weblog_posts where ($where) and weblog = $blog_id order by last_updated desc limit $blog_posts"); + + if (is_array($posts) && !empty ($posts)) { + $body .="'; + } + $body .= '
    '; + + return array ('title' => __gettext('Forum').' :: ' . htmlspecialchars(user_name($blog_id), ENT_COMPAT, 'utf-8') . '', 'content' => $body); + +} + + + + + + +function forum_widget_edit($widget) { + + global $CFG, $page_owner; + + $blog_id= widget_get_data("blog_id", $widget->ident); + $blog_posts= widget_get_data("blog_posts", $widget->ident); + if (empty ($blog_posts)) { + $blog_posts= 1; + } + if (empty ($blog_id)) { + $blog_id= $page_owner; + } + + $connections= get_records_sql("select u.ident, u.name from " . $CFG->prefix . "friends f join " . $CFG->prefix . "users u on u.ident = f.friend where f.owner = " . $_SESSION['userid'] . " AND u.user_type=\"community\" order by u.name asc"); + $data= new stdClass; + $data->ident= $page_owner; + $data->name= run("profile:display:name", $page_owner); + $connections[]= $data; + if ($page_owner != $_SESSION['userid']) { + $data= new stdClass; + $data->ident= $_SESSION['userid']; + $data->name= run("profile:display:name", $_SESSION['userid']); + $connections[]= $data; + } + + $body= "

    " . __gettext("Forum widget") . "

    "; + $body .= "

    " . __gettext("This widget displays the last couple of forum posts from a community forum. To begin, select the community from your connections below:") . "

    "; + + $body .= "

    \n"; + + $body .= "

    " . __gettext("Then enter the number of forum posts you'd like to display:") . "

    "; + + $body .= "

    "; + + return $body; + +} + +?> Index: /elgg/trunk/mod/forum/trunk/forum.php =================================================================== --- /elgg/trunk/mod/forum/trunk/forum.php (revision 176) +++ /elgg/trunk/mod/forum/trunk/forum.php (revision 176) @@ -0,0 +1,243 @@ +"; + $metatags .= str_replace('{{url}}', $CFG->wwwroot, file_get_contents($CFG->dirroot . "mod/forum/css")); + $metatags .= ""; + + $profile_id = optional_param('owner', 0, PARAM_INT); + + if (empty($profile_id)) { + // try to get weblog name and then id + $weblog = optional_param('weblog'); + + if (!empty($weblog)) { + $profile_id = get_field('users', 'ident', 'username', $weblog); + } + } else { + // get weblog from id + $weblog = user_info('username', $profile_id); + } + + $page_owner = $profile_id; + + define("context", "forum"); + + if ((context == "forum") && run("users:type:get", $page_owner) == "community") + { + // Add to the submenu + $num = count($PAGE->menu_sub) + 1; + $PAGE->menu_sub[$num]['name'] = "forum:rssfeed"; + $PAGE->menu_sub[$num]['html'] = 'rss'; + + if(run("permissions:check", "weblog")){ + $num = $num + 1; + $PAGE->menu_sub[$num]['name'] = "forum:add_discussion"; + $PAGE->menu_sub[$num]['html'] = "wwwroot}{$weblog}/weblog/edit\">" . __gettext("Add New Item") . ""; + } + + $num = $num + 1; + $PAGE->menu_sub[$num]['name'] = "forum:blogview"; + $PAGE->menu_sub[$num]['html'] = '' . __gettext("View as Blog") . ''; + + + } + + + templates_page_setup(); + + + + + + + if (!empty($profile_id) && $profile_id > 0 && user_info('user_type', $profile_id) == 'community') { + + // If the weblog offset hasn't been set, it's 0 + $weblog_offset = optional_param('weblog_offset',0,PARAM_INT); + $filter = optional_param('filter'); + + // Get all posts in the system that we can see + + $where = run("users:access_level_sql_where",$_SESSION['userid']); + + if ($forum_sort == 1){ + $forum_sort_string="last_updated DESC, posted DESC"; + } + else + { + $forum_sort_string="posted DESC"; + } + + + if (empty($filter)) { + $posts = get_records_select('weblog_posts','('.$where.') AND weblog = '.$profile_id,null,$forum_sort_string,'*',$weblog_offset,'25'); + $numberofposts = count_records_select('weblog_posts','('.$where.') AND weblog = '.$profile_id); + //echo $numberofposts; + } else { + $where = str_replace("access","wp.access",$where); + $where = str_replace("owner","wp.owner",$where); + $posts = get_records_sql("select * from ".$CFG->prefix."tags t join ".$CFG->prefix."weblog_posts wp on wp.ident = t.ref where ($where) AND t.tagtype = 'weblog' AND wp.weblog = $profile_id AND t.tag = " . $db->qstr($filter) . " order by " . $forum_sort_string . " limit $weblog_offset,25"); + $numberofposts = get_record_sql("select count(wp.ident) as numberofposts from ".$CFG->prefix."tags t join ".$CFG->prefix."weblog_posts wp on wp.ident = t.ref where ($where) AND t.tagtype = 'weblog' AND wp.weblog = $profile_id AND t.tag = " . $db->qstr($filter)); + $numberofposts = $numberofposts->numberofposts; + } + + + $body=" + + + + + + + "; + + + if (!empty($posts)) { + + + foreach($posts as $post) { + + $time = strftime("%B %d, %Y",$post->posted); + + $select='select * from ' . $CFG->prefix . 'weblog_comments Where post_id='. $post->ident . ' ORDER by posted DESC Limit 1'; + //echo $select; + $lastcomment = get_records_sql($select); + + $lastcommenter=""; + $lastcommenttime=""; + + if ($lastcomment){ + foreach($lastcomment as $comment) { + $lastcommenter=$comment->postedname; + $lastcommenttime=textify_age($comment->posted); + } + } + + + $numberofcomments = get_record_sql("select count(*) as numberofcomments from ".$CFG->prefix."weblog_comments WHERE post_id =" . $post->ident); + $numberofcomments = $numberofcomments->numberofcomments; + + //$body .= run("weblogs:posts:view",$post); + // + + // handle empty titles + if(empty($post->title)){ + $words = 6; // 5 words, really + $cut_body = preg_replace("/<[^<>]>/","",$post->body); + $cut_body = explode(" ",$cut_body,$words); + array_pop($cut_body); + $post->title = "".implode(" ",$cut_body)." ..."; + } + + + + + $body .= " + + + + + + + "; + + } + + + + } + + $body .= '
    " . __gettext("Discussion Topic") . "" . __gettext("Started by") . "" . __gettext("Comments") . "" . __gettext("Latest Comment") . "
    wwwroot . user_info("username",$page_owner) . "/weblog/" . $post->ident . ".html\" title=\"View full discussion...\">" . $post->title . "
    wwwroot . "mod/forum/" . $post->ident . ".html\" title=\"" . __gettext("View full discussion...") . "\">" . $post->title . "wwwroot . user_info("username",$post->owner) . "/" . "\" title=\"" . __gettext("View profile...") . "\">" . user_info("name",$post->owner) . "ident . "\" title=\"" . __gettext("View comments...") . "\">" . $numberofcomments . "" . $lastcommenter . "
    " . $lastcommenttime . "

    '; + + if (run("permissions:check", "weblog")) { + $body .= '' . __gettext("Add New Item") . '...

    '; + + } + +if (!empty($posts)) { + + if ($numberofposts - ($weblog_offset + 25) > 0) { + $display_weblog_offset = $weblog_offset + 25; + $back = __gettext("Back"); + $body .= <<< END + + << $back + +END; + } + if ($weblog_offset > 0) { + $display_weblog_offset = $weblog_offset - 25; + if ($display_weblog_offset < 0) { + $display_weblog_offset = 0; + } + $next = __gettext("Next"); + $body .= <<< END + + $next >> + +END; + } + +} + + $title = run("profile:display:name") . " :: " . __gettext("Forum"); + } // end !empty($profile_id) + + else { + global $messages; + $messages[] = __gettext("This forum doesn't exists."); + + $title = __gettext("Forum"); + $body = ""; + + $profile_id = -1; + $page_owner = -1; + } + + // Draw page + + $body = templates_draw(array( + 'context' => 'contentholder', + 'title' => $title, + 'body' => $body + ) + ); + + echo templates_page_draw( array( + $title, $body + ) + ); + + + +function textify_age($input) +{ + $age=time()-$input; + if($age<60) + return "about a minute ago"; + elseif($age<300) + return "about five minutes ago"; + elseif($age<600) + return "about ten minutes ago"; + elseif($age<1800) + return "about thirty minutes ago"; + elseif($age<7200) + return "about an hour ago"; + elseif($age>=7200&&$age<86400) + return "about ".round(floor($age/3600))." hours ago"; + elseif($age>=86400&&$age<129600) + return "yesterday"; + elseif($age>=129600&&$age<249600) + return round(ceil($age/86400))." days ago"; + else + return "on " . gmstrftime("%b %d, %y",$input); +} + +?> + + Index: /elgg/trunk/mod/forum/languages/es_BO/LC_MESSAGES/es_BO.po =================================================================== --- /elgg/trunk/mod/forum/languages/es_BO/LC_MESSAGES/es_BO.po (revision 176) +++ /elgg/trunk/mod/forum/languages/es_BO/LC_MESSAGES/es_BO.po (revision 176) @@ -0,0 +1,179 @@ +# Español translation of PACKAGE. +# Copyright (C) 2007 THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# Rolando Espinoza La Fuente , 2007. +# , fuzzy +# +# +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2007-07-04 16:56-0400\n" +"PO-Revision-Date: 2007-07-04 17:35-0400\n" +"Last-Translator: Rolando Espinoza La Fuente \n" +"Language-Team: Español \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit" + +#: forum_user_info_menu.php:10 +msgid "Recent Activity" +msgstr "" + +#: forum_user_info_menu.php:12 +msgid "View your activity" +msgstr "" + +#: forum_user_info_menu.php:29 +msgid "Forum & Blogs" +msgstr "Foros & Blogs" + +#: forum_user_info_menu.php:36 +msgid "Personal blog" +msgstr "" + +#: forum_user_info_menu.php:41 +msgid "Community Forum" +msgstr "Foro de la comunidad" + +#: forum_user_info_menu.php:49 +msgid "Archive" +msgstr "" + +#: forum_user_info_menu.php:50 +msgid "Members blog" +msgstr "Blogs de miembros" + +#: forum_view_thread.php:34 +msgid "Access denied or post not found" +msgstr "" + +#: forum_view_thread.php:37 +msgid "" +"Either this blog post doesn't exist or you don't currently have access " +"privileges to view it." +msgstr "" + +#: forum_view_thread.php:53 +msgid "Return to Forum" +msgstr "Regresar al foro" + +#: forum_view_thread.php:57 +msgid "Add a comment..." +msgstr "Añadir comentario..." + +#: forum_view_thread.php:57 +msgid "Add new comment" +msgstr "Añadir nuevo comentario" + +#: forum_view_thread.php:67 +msgid "From" +msgstr "De" + +#: forum_view_thread.php:75 forum_view_thread.php:108 forum.php:125 +msgid "View profile..." +msgstr "Ver perfil..." + +#: forum_view_thread.php:80 +msgid "Edit" +msgstr "Editar" + +#: forum_view_thread.php:81 +msgid "Are you sure you want to permanently delete this forum post?" +msgstr "Estas seguro de querer borrar esta entrada del foro?" + +#: forum_view_thread.php:82 forum_view_thread.php:113 +msgid "Delete" +msgstr "Borrar" + +#: forum_view_thread.php:112 +msgid "Are you sure you want to permanently delete this forum comment?" +msgstr "Estas seguro de borrar este comentario del foro?" + +#: forum_view_thread.php:128 +msgid "Add new comment..." +msgstr "Añadir nuevo comentario..." + +#: forum_view_thread.php:140 forum.php:164 forum.php:171 +msgid "Forum" +msgstr "Foro" + +#: lib.php:15 +msgid "View as Forum" +msgstr "Ver como foro" + +#: userdetails_actions.php:15 +msgid "Your forum view preferences have been saved" +msgstr "Se ha guardado tu configuració de vista como foro" + +#: userdetails_actions.php:18 +msgid "Your forum view preferences have been changed" +msgstr "Se ha cambiado tu configuración de vista como foro" + +#: userdetails_actions.php:20 +msgid "Your forum view preferences could not be changed" +msgstr "No se pudo cambiar tu configuración de vista como foro" + +#: userdetails_edit.php:11 +msgid "Blog/Forum View:" +msgstr "Blog/Foro vista:" + +#: userdetails_edit.php:12 +msgid "" +"Set this to 'yes' if you would like to default this user/community blog to a " +"'forum' view." +msgstr "Selecciona 'Si' si quieres que el blog se vea como foro" + +#: userdetails_edit.php:33 userdetails_edit.php:41 +msgid "Default Blog View to 'Forum' type: " +msgstr "Ver blog como foro por defecto:" + +#: userdetails_edit.php:34 userdetails_edit.php:42 +msgid "Yes" +msgstr "Si" + +#: userdetails_edit.php:34 userdetails_edit.php:42 +msgid "No" +msgstr "No" + +#: forum.php:40 forum.php:136 +msgid "Add New Item" +msgstr "Añadir entrada" + +#: forum.php:45 +msgid "View as Blog" +msgstr "Ver como blog" + +#: forum.php:89 +msgid "Discussion Topic" +msgstr "Tema de discusión" + +#: forum.php:90 +msgid "Started by" +msgstr "Empezado por" + +#: forum.php:91 +msgid "Comments" +msgstr "Comentarios" + +#: forum.php:124 +msgid "View full discussion..." +msgstr "Ver discusión completa..." + +#: forum.php:126 +msgid "View comments..." +msgstr "Ver comentarios..." + +#: forum.php:142 +msgid "Back" +msgstr "" + +#: forum.php:154 +msgid "Next" +msgstr "" + +#: forum.php:169 +msgid "This forum doesn't exists." +msgstr "El foro no existe" + Index: /elgg/trunk/mod/forum/languages/it/LC_MESSAGES/it.po =================================================================== --- /elgg/trunk/mod/forum/languages/it/LC_MESSAGES/it.po (revision 176) +++ /elgg/trunk/mod/forum/languages/it/LC_MESSAGES/it.po (revision 176) @@ -0,0 +1,222 @@ +# Español translation of PACKAGE. +# Copyright (C) 2007 THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# Rolando Espinoza La Fuente , 2007. +# , fuzzy +# +# +msgid "" +msgstr "" +"Project-Id-Version: Elgg Forum\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2007-07-04 16:56-0400\n" +"PO-Revision-Date: 2007-12-17 12:41+0100\n" +"Last-Translator: Simone Tolotti \n" +"Language-Team: Italiano \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Poedit-Language: Italian\n" +"X-Poedit-KeywordsList: __gettext\n" +"X-Poedit-Basepath: ../../../\n" +"X-Poedit-SearchPath-0: .\n" + +#: userdetails_edit.php:13 +msgid "Blog/Forum View:" +msgstr "Vista Blog/Forum:" + +#: userdetails_edit.php:14 +msgid "Set this to 'yes' if you would like to default this user/community blog to a 'forum' view." +msgstr "Seleziona 'Si' se vuoi che questo blog sia visualizzato come forum" + +#: userdetails_edit.php:43 +#: userdetails_edit.php:52 +msgid "Default Blog View to 'Forum' type: " +msgstr "Visualizza blog come Forum:" + +#: userdetails_edit.php:44 +#: userdetails_edit.php:53 +msgid "Yes" +msgstr "Si" + +#: userdetails_edit.php:44 +#: userdetails_edit.php:53 +msgid "No" +msgstr "No" + +#: forum_user_info_menu.php:12 +msgid "Recent Activity" +msgstr "Attività recente" + +#: forum_user_info_menu.php:14 +msgid "View your activity" +msgstr "Vedi la tua attività" + +#: forum_user_info_menu.php:31 +msgid "Forum & Blogs" +msgstr "Forum & Blog" + +#: forum_user_info_menu.php:38 +msgid "Personal blog" +msgstr "Blog personale" + +#: forum_user_info_menu.php:65 +msgid "Community Forum" +msgstr "Forum della comunità" + +#: forum_user_info_menu.php:72 +#: forum_user_info_menu.php:87 +msgid "Archive" +msgstr "Archivio" + +#: forum_user_info_menu.php:73 +msgid "Members blog" +msgstr "Blog dei Membri" + +#: forum_user_info_menu.php:80 +msgid "Community Blog" +msgstr "Blog della comunità" + +#: forum_user_info_menu.php:88 +msgid "Friends blog" +msgstr "Blog degli amici" + +#: userdetails_actions.php:15 +msgid "Your forum view preferences have been saved" +msgstr "Le tue preferenze per la vista del forum sono state salvate" + +#: userdetails_actions.php:18 +msgid "Your forum view preferences have been changed" +msgstr "Le tue preferenze per la vista del forum sono state modificate" + +#: userdetails_actions.php:20 +msgid "Your forum view preferences could not be changed" +msgstr "Le tue preferenze per la vista del forum non possono essere modificate" + +#: lib.php:15 +msgid "View as Forum" +msgstr "Vedi come forum" + +#: lib.php:50 +#: lib.php:214 +msgid "Forum widget" +msgstr "Widget Forum" + +#: lib.php:51 +msgid "Displays the latest posts from a Community Forum of your choice." +msgstr "Mostra gli ultimi post del forum di una comunità a tua scelta." + +#: lib.php:194 +msgid "Forum :: " +msgstr "Forum ::" + +#: lib.php:215 +msgid "This widget displays the last couple of posts from a Community Forum. To begin, select the Community from your connections below:" +msgstr "Questo widget mostra gli ultimi post del forum di una comunità. Per iniziare, scegli la comunità dalle tue connessioni qua sotto:" + +#: lib.php:219 +msgid "Then enter the number of posts you'd like to display:" +msgstr "Poi inserisci quanti post vuoi che siano mostrati:" + +#: forum_view_thread.php:34 +msgid "Access denied or post not found" +msgstr "Accesso non permesso o post non trovato" + +#: forum_view_thread.php:37 +msgid "Either this blog post doesn't exist or you don't currently have access privileges to view it." +msgstr "Questo articolo del blog non esiste oppure non hai il permesso di visualizzarlo." + +#: forum_view_thread.php:55 +msgid "Return to Forum" +msgstr "Torna al Forum" + +#: forum_view_thread.php:59 +msgid "Add a comment..." +msgstr "Aggiungi un commento..." + +#: forum_view_thread.php:59 +msgid "Add new comment" +msgstr "Aggiungi un nuovo commento" + +#: forum_view_thread.php:69 +msgid "From" +msgstr "Da" + +#: forum_view_thread.php:77 +#: forum_view_thread.php:110 +#: forum.php:144 +msgid "View profile..." +msgstr "Vedi profilo..." + +#: forum_view_thread.php:82 +msgid "Edit" +msgstr "Modifica" + +#: forum_view_thread.php:83 +msgid "Are you sure you want to permanently delete this forum post?" +msgstr "Sei sicuro di voler eliminare definitivamente questo post del forum?" + +#: forum_view_thread.php:84 +#: forum_view_thread.php:115 +msgid "Delete" +msgstr "Elimina" + +#: forum_view_thread.php:114 +msgid "Are you sure you want to permanently delete this forum comment?" +msgstr "Sei sicuro di voler eliminare definitivamente questo commento del forum?" + +#: forum_view_thread.php:130 +msgid "Add new comment..." +msgstr "Aggiungi nuovo commento..." + +#: forum_view_thread.php:142 +#: forum.php:188 +#: forum.php:195 +msgid "Forum" +msgstr "Forum" + +#: forum.php:40 +#: forum.php:158 +msgid "Add New Item" +msgstr "Aggiungi nuovo elemento" + +#: forum.php:45 +msgid "View as Blog" +msgstr "Vedi come blog" + +#: forum.php:93 +msgid "Discussion Topic" +msgstr "Tema della discussione" + +#: forum.php:94 +msgid "Started by" +msgstr "Iniziato da" + +#: forum.php:95 +msgid "Comments" +msgstr "Commenti" + +#: forum.php:96 +msgid "Latest Comment" +msgstr "Ultimi commenti" + +#: forum.php:143 +msgid "View full discussion..." +msgstr "Vedi tutta la discussione..." + +#: forum.php:145 +msgid "View comments..." +msgstr "Vedi commenti..." + +#: forum.php:166 +msgid "Back" +msgstr "Indietro" + +#: forum.php:178 +msgid "Next" +msgstr "Prossimo" + +#: forum.php:193 +msgid "This forum doesn't exists." +msgstr "Questo Forum non esiste" + Index: /elgg/trunk/mod/forum/README.txt =================================================================== --- /elgg/trunk/mod/forum/README.txt (revision 176) +++ /elgg/trunk/mod/forum/README.txt (revision 176) @@ -0,0 +1,50 @@ +Forum Plugin for Elgg +GPL v2, yada yada yada... + +***REQUIRES ELGG v0.9*** + +To install: +-copy the forum folder to your /mod/ folder +-login as "news" (executes a minor database upgrade) +-edit mod/forum/config.php to change config (optional) +-visit a community blog that has a few posts and comments to those posts +-on the community blog, find the link that says "View as Forum" + +Add the following lines to the end of your .htaccess file (just above the ): + +#FORUM PLUGIN REWRITE ELEMENTSRewriteRule ^([A-Za-z0-9]+)\/forum\/?$ mod/forum/forum.php?weblog=$1RewriteRule ^([A-Za-z0-9]+)\/forum\/skip=([0-9]+)$ mod/forum/forum.php?weblog=$1&weblog_offset=$2RewriteRule ^[A-Za-z0-9]+\/forum\/([0-9]+)(\.html)?$ mod/forum/forum_view_thread.php?post=$1 + + + + +History: + +v0.4 (December 2007) +-updated for compatability with new elgg sidebar block mechanism (Elgg 0.9) + +v0.31 (November 2007) +-added a profile widget so that the latest forum threads can be displayed on the community's profile page +-added a "latest comment by" column on forum view + +v0.3 (July 2007) +-major cleanup of code/sloppiness +-fixed issues with Elgg v0.8 +-lots of contribution to this revision by Rho (http://elgg.org/rho) + + +v0.2 (March 10, 2007) +-added sorting based on last updated threads +-added better handling of default behaviour (forum vs. community blog) + +v0.1 (Feb 8, 2007) +-finally usable! +-now has a more master/detail view +-moved to tables for layout rather than pure CSS +-uses post_icon to display image for each thread +-uses list_for_event API to return to approapriate view after adding, editing, deleting a post or comment + +v0.000000000001 (Jan, 2007) +-actually getting a bit useful! +-added linking/posting new comments +-fixed bug where sidebar showed current user rather than the community profile +-now displays posters name, tooltip of comment content Index: /elgg/trunk/mod/forum/forum_user_info_menu.php =================================================================== --- /elgg/trunk/mod/forum/forum_user_info_menu.php (revision 176) +++ /elgg/trunk/mod/forum/forum_user_info_menu.php (revision 176) @@ -0,0 +1,112 @@ +dirroot . 'mod/forum/config.php'); + + +if (logged_on && $page_owner == $_SESSION['userid']) { + + $title = __gettext("Recent Activity"); + $body = ""; + + $run_result .= "
  • "; + $run_result .= templates_draw(array( + 'context' => 'sidebarholder', + 'title' => $title, + 'body' => $body, + ) + ); + $run_result .= "
  • "; + +} else { + + //$posts = count_records_select('weblog_posts','('.run("users:access_level_sql_where",$profile_id).") and owner = $profile_id"); + + if (logged_on || (isset($page_owner) && $page_owner != -1)) { + + $title = __gettext("Forum & Blogs"); + + $weblog_username = user_info('username', $profile_id); + $body = <<< END +
      +END; + if (user_type($page_owner) == "person") { + $personalWeblog = __gettext("Personal blog"); + $body .= <<< END +
    • $personalWeblog (RSS)
    • +END; + } else if (user_type($page_owner) == "community") { + + + + $forum_flag = user_flag_get('forum', $profile_id); + //echo $forum_flag; + //echo $forum_default; + + if ((!$forum_flag) && ($forum_default == 0)) + { + $use_forum= "yes"; + } + else if ((!$forum_flag) && ($forum_default == 1)) + { + $use_forum= "no"; + } + else + { + $use_forum= $forum_flag; + } + + if ($use_forum=="yes"){ + + $communityWeblog = __gettext("Community Forum"); + $body .= <<< END +
    • + $communityWeblog + RSS
    • +END; + + $blogArchive = __gettext("Archive"); + $membersWeblog = __gettext("Members blog"); + $body .= <<< END +
    • $blogArchive
    • +
    • $membersWeblog
    • +END; + } else { + + $communityWeblog = __gettext("Community Blog"); + $body .= <<< END +
    • + $communityWeblog + (RSS)
    • +END; + + $blogArchive = __gettext("Archive"); + $membersWeblog = __gettext("Friends blog"); + $body .= <<< END +
    • $blogArchive
    • +
    • $membersWeblog
    • +END; + + } + + + +} + $run_result .= "
    • "; + $run_result .= templates_draw(array( + 'context' => 'sidebarholder', + 'title' => $title, + 'body' => $body, + ) + ); + $run_result .= "
    "; + } +} + +?> Index: /elgg/trunk/mod/forum/forum.php =================================================================== --- /elgg/trunk/mod/forum/forum.php (revision 176) +++ /elgg/trunk/mod/forum/forum.php (revision 176) @@ -0,0 +1,243 @@ +"; + $metatags .= str_replace('{{url}}', $CFG->wwwroot, file_get_contents($CFG->dirroot . "mod/forum/css")); + $metatags .= ""; + + $profile_id = optional_param('owner', 0, PARAM_INT); + + if (empty($profile_id)) { + // try to get weblog name and then id + $weblog = optional_param('weblog'); + + if (!empty($weblog)) { + $profile_id = get_field('users', 'ident', 'username', $weblog); + } + } else { + // get weblog from id + $weblog = user_info('username', $profile_id); + } + + $page_owner = $profile_id; + + define("context", "forum"); + + if ((context == "forum") && run("users:type:get", $page_owner) == "community") + { + // Add to the submenu + $num = count($PAGE->menu_sub) + 1; + $PAGE->menu_sub[$num]['name'] = "forum:rssfeed"; + $PAGE->menu_sub[$num]['html'] = 'rss'; + + if(run("permissions:check", "weblog")){ + $num = $num + 1; + $PAGE->menu_sub[$num]['name'] = "forum:add_discussion"; + $PAGE->menu_sub[$num]['html'] = "wwwroot}{$weblog}/weblog/edit\">" . __gettext("Add New Item") . ""; + } + + $num = $num + 1; + $PAGE->menu_sub[$num]['name'] = "forum:blogview"; + $PAGE->menu_sub[$num]['html'] = '' . __gettext("View as Blog") . ''; + + + } + + + templates_page_setup(); + + + + + + + if (!empty($profile_id) && $profile_id > 0 && user_info('user_type', $profile_id) == 'community') { + + // If the weblog offset hasn't been set, it's 0 + $weblog_offset = optional_param('weblog_offset',0,PARAM_INT); + $filter = optional_param('filter'); + + // Get all posts in the system that we can see + + $where = run("users:access_level_sql_where",$_SESSION['userid']); + + if ($forum_sort == 1){ + $forum_sort_string="last_updated DESC, posted DESC"; + } + else + { + $forum_sort_string="posted DESC"; + } + + + if (empty($filter)) { + $posts = get_records_select('weblog_posts','('.$where.') AND weblog = '.$profile_id,null,$forum_sort_string,'*',$weblog_offset,'25'); + $numberofposts = count_records_select('weblog_posts','('.$where.') AND weblog = '.$profile_id); + //echo $numberofposts; + } else { + $where = str_replace("access","wp.access",$where); + $where = str_replace("owner","wp.owner",$where); + $posts = get_records_sql("select * from ".$CFG->prefix."tags t join ".$CFG->prefix."weblog_posts wp on wp.ident = t.ref where ($where) AND t.tagtype = 'weblog' AND wp.weblog = $profile_id AND t.tag = " . $db->qstr($filter) . " order by " . $forum_sort_string . " limit $weblog_offset,25"); + $numberofposts = get_record_sql("select count(wp.ident) as numberofposts from ".$CFG->prefix."tags t join ".$CFG->prefix."weblog_posts wp on wp.ident = t.ref where ($where) AND t.tagtype = 'weblog' AND wp.weblog = $profile_id AND t.tag = " . $db->qstr($filter)); + $numberofposts = $numberofposts->numberofposts; + } + + + $body=" + + + + + + + "; + + + if (!empty($posts)) { + + + foreach($posts as $post) { + + $time = strftime("%B %d, %Y",$post->posted); + + $select='select * from ' . $CFG->prefix . 'weblog_comments Where post_id='. $post->ident . ' ORDER by posted DESC Limit 1'; + //echo $select; + $lastcomment = get_records_sql($select); + + $lastcommenter=""; + $lastcommenttime=""; + + if ($lastcomment){ + foreach($lastcomment as $comment) { + $lastcommenter=$comment->postedname; + $lastcommenttime=textify_age($comment->posted); + } + } + + + $numberofcomments = get_record_sql("select count(*) as numberofcomments from ".$CFG->prefix."weblog_comments WHERE post_id =" . $post->ident); + $numberofcomments = $numberofcomments->numberofcomments; + + //$body .= run("weblogs:posts:view",$post); + // + + // handle empty titles + if(empty($post->title)){ + $words = 6; // 5 words, really + $cut_body = preg_replace("/<[^<>]>/","",$post->body); + $cut_body = explode(" ",$cut_body,$words); + array_pop($cut_body); + $post->title = "".implode(" ",$cut_body)." ..."; + } + + + + + $body .= " + + + + + + + "; + + } + + + + } + + $body .= '
    " . __gettext("Discussion Topic") . "" . __gettext("Started by") . "" . __gettext("Comments") . "" . __gettext("Latest Comment") . "
    wwwroot . user_info("username",$page_owner) . "/weblog/" . $post->ident . ".html\" title=\"View full discussion...\">" . $post->title . "
    wwwroot . "mod/forum/" . $post->ident . ".html\" title=\"" . __gettext("View full discussion...") . "\">" . $post->title . "wwwroot . user_info("username",$post->owner) . "/" . "\" title=\"" . __gettext("View profile...") . "\">" . user_info("name",$post->owner) . "ident . "\" title=\"" . __gettext("View comments...") . "\">" . $numberofcomments . "" . $lastcommenter . "
    " . $lastcommenttime . "

    '; + + if (run("permissions:check", "weblog")) { + $body .= '' . __gettext("Add New Item") . '...

    '; + + } + +if (!empty($posts)) { + + if ($numberofposts - ($weblog_offset + 25) > 0) { + $display_weblog_offset = $weblog_offset + 25; + $back = __gettext("Back"); + $body .= <<< END + + << $back + +END; + } + if ($weblog_offset > 0) { + $display_weblog_offset = $weblog_offset - 25; + if ($display_weblog_offset < 0) { + $display_weblog_offset = 0; + } + $next = __gettext("Next"); + $body .= <<< END + + $next >> + +END; + } + +} + + $title = run("profile:display:name") . " :: " . __gettext("Forum"); + } // end !empty($profile_id) + + else { + global $messages; + $messages[] = __gettext("This forum doesn't exists."); + + $title = __gettext("Forum"); + $body = ""; + + $profile_id = -1; + $page_owner = -1; + } + + // Draw page + + $body = templates_draw(array( + 'context' => 'contentholder', + 'title' => $title, + 'body' => $body + ) + ); + + echo templates_page_draw( array( + $title, $body + ) + ); + + + +function textify_age($input) +{ + $age=time()-$input; + if($age<60) + return "about a minute ago"; + elseif($age<300) + return "about five minutes ago"; + elseif($age<600) + return "about ten minutes ago"; + elseif($age<1800) + return "about thirty minutes ago"; + elseif($age<7200) + return "about an hour ago"; + elseif($age>=7200&&$age<86400) + return "about ".round(floor($age/3600))." hours ago"; + elseif($age>=86400&&$age<129600) + return "yesterday"; + elseif($age>=129600&&$age<249600) + return round(ceil($age/86400))." days ago"; + else + return "on " . gmstrftime("%b %d, %y",$input); +} + +?> + +