Changeset 115

Show
Ignore:
Timestamp:
06/25/07 23:20:32 (1 year ago)
Author:
wikiplugin
Message:

Updated to v.62, more bug fixes

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • folio/folio/config.php

    r112 r115  
    33 
    44global $CFG; 
    5 $FOLIO_CFG->version = 0.61
     5$FOLIO_CFG->version = 0.62
    66$FOLIO_CFG->ajaxprefix = 'folio_control_tree_'; 
    77 
     
    1212// Default permission level for a new page.  Can be PUBLIC, MODERATED, or PRIVATE 
    1313$FOLIO_CFG->page_defaultpermission = 'MODERATED'; 
     14 
     15// Keep old pages in the rss feed. AKA, if bob makes a change, and then tim, do you only want to see 
     16//      tim's?  If you want both, set to false, else true. 
     17//      Please note that this doesn't change the page history records, those are always kept.  it's just about 
     18//      exposing the record changes thru the feed system. 
     19$FOLIO_CFG->page_deleteoldpagesfromrss = false; 
     20 
    1421 
    1522/////////////////////////////////////////////////////////////////////////////////////// 
  • folio/folio/control/page_edit.php

    r101 r115  
    3232        global $metatags; 
    3333     
     34         
    3435    if (!$page && !isloggedin() ) { 
    3536                // We don't allow non-logged in users to create new pages 
     
    8788                <SCRIPT type="text/javascript" src="$url/mod/folio/control/yav1_2_3/js_compact/yav.js"></SCRIPT> 
    8889                <SCRIPT type="text/javascript" src="$url/mod/folio/control/yav1_2_3/js_compact/yav-config.js"></SCRIPT> 
    89             <script language="javascript" type="text/javascript" src="$url/_tinymce/jscripts/tiny_mce/tiny_mce_gzip.php"></script> 
    90             <script language="javascript" type="text/javascript"> 
    91                     tinyMCE.init({ 
    92                     language : "en", 
    93                     mode : "exact", 
    94                     convert_urls : false, 
    95                     relative_urls : false, 
    96                     elements : "new_weblog_post,new_weblog_comment,page_body", 
    97                     theme : "advanced", 
    98                     theme_advanced_buttons1 : "bold,italic,underline,separator,strikethrough,justifyleft,justifycenter,justifyright,justifyfull,bullist,numlist,image,undo,redo,link,unlink,code,fullscreen,spellchecker", 
    99                     theme_advanced_buttons2 : "", 
    100                     theme_advanced_buttons3 : "", 
    101                     theme_advanced_toolbar_location : "top", 
    102                     theme_advanced_toolbar_align : "left", 
    103                     theme_advanced_path_location : "bottom", 
    104                     extended_valid_elements : "a[name|href|target|title|onclick],img[class|src|border=0|alt|title|hspace|vspace|width|height|align|onmouseover|onmouseout|name],hr[class|width|size|noshade],font[face|size|color|style],span[class|align|style]", 
    105                     remove_linebreaks: true, 
    106                     theme_advanced_source_editor_width : "400", 
    107                     theme_advanced_source_editor_height : "300", 
    108                     plugins : "fullscreen,spellchecker", 
    109                     spellchecker_languages : "+English=en,Dutch=nl,German=de,Spanish=es,Danish=dk,Swedish=sv,French=fr,Japanese=jp", 
    110                     document_base_url : "http://localhost/dev/elgg/trunk", 
    111                     fullscreen_settings : { 
    112                         theme_advanced_path_location : "top" 
    113                     } 
    114                      
    115     }); 
    116         </script>\n 
     90            \n 
    11791<SCRIPT> 
    11892    var rules=new Array(); 
     
    12094</SCRIPT> 
    12195END; 
     96 
     97 
    12298 
    12399    // Restore the trailing slash in $url 
  • folio/folio/control/page_edit_post.php

    r112 r115  
    8383    insert_tags_from_string ($tags, 'page', $page->page_ident, $security, $page->user_ident); 
    8484 
    85         // We want to delete RSS records of changes to this page by this user within the last hour UNLESS they're by an anonymous user 
     85        // We want to delete history records of changes to this page by this user within the last hour UNLESS they're by an anonymous user 
    8686        if ( $page->creator_ident <> -1 ) { 
    8787                rss_deleteitem( 'page', $page->page_ident, $page->creator_ident, 3600 ); 
     88                rss_deleteitem( 'page', $page->page_ident, $page->creator_ident, 3600 ); 
     89        } 
     90         
     91        // If configured, remove all old history entries from the RSS feed. 
     92        if ( $FOLIO_CFG->page_deleteoldpagesfromrss ) { 
     93 
     94                // Delete 
     95                rss_deleteitem( 'page', $page->page_ident ); 
     96 
    8897        } 
    8998         
     
    98107        ); 
    99108 
     109                 
     110        // If the page security is private, then set all past RSS entries to private as well. 
     111        if ( optional_param('folio_control_page_edit_security_custom', 'PUBLIC') == 'PRIVATE' ) { 
     112 
     113                $stmt = $db->Prepare( "UPDATE {$CFG->prefix}folio_rss SET access = '{$security}' 
     114                                WHERE type_ident = {$insert_id} AND type='page' AND access <> 'PRIVATE'"); 
     115                $returnvalue = $db->Execute($stmt);   
     116        } 
     117         
     118         
    100119    // Update any comments to match the same permission level. 
    101120    $stmt = $db->Prepare("UPDATE {$CFG->prefix}folio_comment SET access = '{$security}' " . 
  • folio/folio/html/edit.php

    r101 r115  
    1818    require_once("../../../includes.php"); 
    1919    require_once("../control/page_edit.php"); 
     20        require_once("../../../units/tinymce/tinymce_js.php"); 
    2021         
    2122    //run("profile:init"); 
    2223    //run("friends:init"); 
    2324    //run("folio:init"); 
     25        global $metatags; 
     26         
     27        $metatags = str_replace( '    elements : "','    elements : "page_body,',$metatags); 
    2428         
    2529        $title = " Folio :: Edit Page"; 
  • folio/folio/html/feeds.php

    r111 r115  
    241241        if ( count( $friendlist ) > 0 ) { 
    242242            $where = ' owner_ident in (' . implode( ',', $friendlist) . ') and owner_ident <> ' . 
     243                     implode( ',', $arguments['user_ident']) . ' and user_ident <> ' . 
    243244                     implode( ',', $arguments['user_ident']) . ' '; 
    244245        } else { 
     
    333334                // Transfer into template & write. 
    334335                templates_page_setup(); 
    335  
     336                                 
     337                                $users = array(); 
     338                                foreach ( $arguments['username'] as $name ) { 
     339                                        $u = get_record_select('users',"username = '$name'"); 
     340                                        $users[] = $u->name; 
     341                                } 
    336342                $body = templates_draw(array( 
    337343                        'context' => 'contentholder', 
     
    339345                            array(  array( 'name'=>'format','value'=> 'rss'), 
    340346                                    array( 'name'=>'format','value'=> $arguments['format'][0])) ) .  
    341                         $rsskey . "'><img border=0 src='{$url}mod/folio/image/rss.png' /></a> " . 
    342                         implode( ', ', $arguments['username']) . " :: $pagetitle ", 
     347                        $rsskey . "'><img border=0 src='{$url}mod/folio/image/feed.png' /></a> " . 
     348                        implode( ', ', $users ) . " :: $pagetitle ", 
    343349                        'body' => $body )); 
    344350 
     
    355361                templates_page_setup(); 
    356362 
     363                                $users = array(); 
     364                                foreach ( $arguments['username'] as $name ) { 
     365                                        $u = get_record_select('users',"username = '$name'"); 
     366                                        $users[] = $u->name; 
     367                                } 
     368                                 
    357369                $body = templates_draw(array( 
    358370                        'context' => 'contentholder', 
     
    360372                            array(  array( 'name'=>'format','value'=> 'rss'), 
    361373                                    array( 'name'=>'format','value'=> $arguments['format'][0])) ) .  
    362                         $rsskey . "'><img border=0 src='{$url}mod/folio/image/rss.png' /></a> " . 
    363                         implode( ', ', $arguments['username']) . " :: $pagetitle ", 
     374                        $rsskey . "'><img border=0 src='{$url}mod/folio/image/feed.png' /></a> " . 
     375                        implode( ', ', $users ) . " :: $pagetitle ", 
    364376                        'body' => $body )); 
    365377 
  • folio/folio/html/history.php

    r101 r115  
    8585 
    8686        // Build nice titles 
    87         $html_title = "<a href='$url{$username}/subscribe/rss/page+page_comment/'><img border=0 src='{$url}mod/folio/image/rss.png' /></a> $name : " . folio_control_breadcrumb( $page, $username ) ; 
     87        $html_title = "<a href='$url{$username}/subscribe/rss/page+page_comment/'><img border=0 src='{$url}mod/folio/image/feed.png' /></a> $name : " . folio_control_breadcrumb( $page, $username ) ; 
    8888        $plain_title = $page->title; 
    8989 
  • folio/folio/html/setupdb.php

    r112 r115  
    1212 
    1313// The current version of the folio db scheme. 
    14 $folio_dbversion = 8
     14$folio_dbversion = 9
    1515 
    1616// Setup variables. 
     
    2020require_once '../config.php'; 
    2121require_once '../lib.php'; 
    22      
     22   
    2323// See if we're using postgreesss or an old version of mysql.  Cancel, as this only works with MySQL. 
    2424if ($CFG->dbtype == 'postgres7') { 
     
    6565                        case 7: 
    6666                           gotoVersion8(); 
     67                           // no break, need to continue updating.       
     68                        case 8: 
     69                           gotoVersion9(); 
    6770                           // no break, need to continue updating.       
    6871   } 
     
    101104 
    102105/**  
    103 * Update to version 8, re-do the auto-import blog entries, blog comments, & files into the global RSS table. 
    104 **/ 
    105 function gotoVersion8() { 
    106         global $CFG;     
    107         $prefix = $CFG->prefix; 
    108         $db = $CFG->dbname; 
    109  
    110     // Remove existing ones in case this is an upgrade. 
     106* Update to version 9, reset wiki permissions in the global RSS table. 
     107**/ 
     108function gotoVersion9() { 
     109        global $CFG;     
     110        $prefix = $CFG->prefix; 
     111        $db = $CFG->dbname; 
     112 
     113 
     114    // Pull records from DB & run the api to auto-load them. 
     115    $records = recordset_to_array(get_recordset_sql(  
     116        "SELECT * FROM " . $CFG->prefix . "folio_page e WHERE newest = 1")); 
     117                 
     118    if ( $records) { 
     119        foreach ( $records as $record) { 
     120 
     121                // Assume only a single access level per page. 
     122                        $security = get_record_select('folio_page_security','security_ident = ' . $record->page_ident ); 
     123                        $security = $security->accesslevel; 
     124                        if ( $security == 'PRIVATE' ) { 
     125                                $user = get_record_select('users','ident = ' . $record->user_ident ); 
     126                                if ( $user->user_type == 'community' ) { 
     127                                        $security = 'community' . $record->user_ident; 
     128                                } else { 
     129                                        $security = 'user' . $record->user_ident; 
     130                                } 
     131                        } 
     132                         
     133                        // Set all permissions to the permission of the latest wiki entry. 
     134                        execute_sql( "UPDATE {$db}.{$prefix}folio_rss SET access = '{$security}' 
     135                                        WHERE type_ident = {$record->page_ident} AND type='page'"); 
     136                                         
     137                                 
     138                                 
     139        } 
     140    } 
     141 
     142 
     143    // Re-do the load again of rss entries so that dates are correctly pulled. 
    111144        execute_sql( "DELETE FROM {$db}.{$prefix}folio_rss where type IN ( 'weblog', 'weblog_comment', 'file')"); 
    112145 
     
    127160    if ( $records) { 
    128161        foreach ( $records as $record) { 
    129             folio_rss_weblog_comment( 'weblog_comment', 'publish', $record ); 
     162            folio_rss_weblog_comment_post( 'weblog_comment', 'publish', $record ); 
    130163        } 
    131164    } 
     
    137170    if ( $records) { 
    138171        foreach ( $records as $record) { 
    139             folio_rss_file( 'file', 'publish', $record ); 
     172            folio_rss_file_post( 'file', 'publish', $record ); 
    140173        } 
    141174    } 
     175        $version = new StdClass; 
     176        $version->version = 9; 
     177        insert_record("folio_version",$version);         
     178} 
     179 
     180/**  
     181* Update to version 8, re-do the auto-import blog entries, blog comments, & files into the global RSS table. 
     182**/ 
     183function gotoVersion8() { 
     184        global $CFG;     
     185        $prefix = $CFG->prefix; 
     186        $db = $CFG->dbname; 
     187 
     188// depreciated 
    142189 
    143190        $version = new StdClass; 
     
    154201        $db = $CFG->dbname; 
    155202 
     203// depreciated 
    156204 
    157205        $version = new StdClass; 
  • folio/folio/html/view.php

    r111 r115  
    9595            // Build nice titles 
    9696            $plain_title = 'Create ' . $page_title; 
    97             $html_title = $username . ' : ' . $page_title; 
     97            $html_title = $username . ' :: ' . $page_title; 
    9898            // Run the command to actually retrieve the content.   
    9999            $body =  
     
    112112            $html_title = "<a href='{$url}activity/user/{$username}/rss/page+page_comment/all/1:" . 
    113113                    folio_createhash( $_SESSION['userid'] ) .  
    114                     "'><img border=0 src='{$url}mod/folio/image/rss.png' /></a> $name : " . folio_control_breadcrumb( $page, $username ) ; 
     114                    "'><img border=0 src='{$url}mod/folio/image/feed.png' /></a> $name : " . folio_control_breadcrumb( $page, $username ) ; 
    115115            $plain_title = $page->title; 
    116116             
  • folio/folio/html/view_old.php

    r101 r115  
    6565 
    6666        // Build nice titles 
    67         $html_title = "<a href='$url{$username}/subscribe/rss/page+page_comment/'><img border=0 src='{$url}mod/folio/image/rss.png' /></a> $name : " . folio_control_breadcrumb( $page, $username ) ; 
     67        $html_title = "<a href='$url{$username}/subscribe/rss/page+page_comment/'><img border=0 src='{$url}mod/folio/image/feed.png' /></a> $name : " . folio_control_breadcrumb( $page, $username ) ; 
    6868        $plain_title = $page->title; 
    6969 
  • folio/folio/lib.php

    r112 r115  
    2626    global $_SESSION; 
    2727 
     28    listen_for_event("weblog_post","delete","folio_rss_weblog_delete"); 
    2829    listen_for_event("weblog_post","publish","folio_rss_weblog_post"); 
    2930    listen_for_event("weblog_post","update","folio_rss_weblog_post"); 
    30     listen_for_event("weblog_comment","publish","folio_rss_weblog_comment"); 
    31     listen_for_event("file","publish","folio_rss_file"); 
    32     listen_for_event("file","update","folio_rss_file"); 
     31    listen_for_event("weblog_comment","publish","folio_rss_weblog_comment_post"); 
     32        listen_for_event("weblog_comment","delete","folio_rss_weblog_comment_delete"); 
     33    listen_for_event("file","publish","folio_rss_file_post"); 
     34    listen_for_event("file","update","folio_rss_file_post"); 
     35        listen_for_event("file","delete","folio_rss_file_delete"); 
    3336         
    3437    // Test to see if there has been a log-on event 
     
    122125    global $page_title; 
    123126    global $username; // this is who we're looking at, not the logged in user. 
     127                        // Depreciated in v.7?  Start referring to profile_id 
     128         
    124129   
    125130    // This will change the log-on page to a custom session variable 
     
    133138 
    134139    $currentusername = $_SESSION['username']; 
     140        $currentuserident = $_SESSION['userid']; 
     141        //var_dump( $_SESSION ); 
    135142     
    136143    // ----------------------------------------------- 
     
    139146    // Add Wiki Link 
    140147    if (isloggedin() & defined('context') ) { 
    141         if ( substr(context, 0, 5) == "folio" & $username == $currentusername) { 
     148        if ( substr(context, 0, 5) == "folio" & $page_owner == $currentuserident) { 
    142149                // Show selected 
    143150            $PAGE->menu[] = array( 'name' => 'folio',  
     
    157164    // Add Activity Link (as first option) 
    158165    if (isloggedin() & defined('context') ) { 
    159         if ( context == "feeds" & $username == $currentusername) { 
     166        if ( context == "feeds" & $page_owner == $currentuserident) { 
    160167            // Show selected 
    161168            array_splice( $PAGE->menu, 0,0, array( array( 'name' => 'folio_feeds',  
    162                 'html' => '<li><a href="'.$CFG->wwwroot . 'activity/inbox/' . $currentusername . '/html/all/all/1">Your Activity</a></li>'))); 
     169                'html' => '<li><a href="'.$CFG->wwwroot . 'activity/fac/' . $currentusername . '/summary/all/all/1" class="selected">Your Activity</a></li>'))); 
    163170        } else { 
    164171            // Show main menu unselected 
    165172            array_splice( $PAGE->menu, 0,0, array( array( 'name' => 'folio_feeds',  
    166                 'html' => '<li><a href="'.$CFG->wwwroot . 'activity/inbox/' . $currentusername . '/html/all/all/1">Your Activity</a></li>'))); 
     173                'html' => '<li><a href="'.$CFG->wwwroot . 'activity/fac/' . $currentusername . '/summary/all/all/1" >Your Activity</a></li>'))); 
    167174         
    168175        } 
     
    872879* @param string access (the permission level for the rss item, def=public). 
    873880**/ 
    874 function rss_additem( $owner_ident, $owner_username, $user_ident, $user_name, $user_username, $type, $type_ident, $tags, $title, $body, $link, $access='PUBLIC' ) { 
    875  
     881function rss_additem( $owner_ident, $owner_username, $user_ident, $user_name, $user_username, $type, $type_ident, $tags, $title, $body, $link, $access='PUBLIC', $created = -1 ) { 
     882 
     883        if ($created == -1 ) { 
     884                $created = time(); 
     885        } 
     886         
    876887    $rss = new StdClass; 
    877888    $rss->owner_ident = intval($owner_ident); 
     
    885896    $rss->body = $body; 
    886897    $rss->link = $link; 
    887     $rss->created = time()
     898    $rss->created = $created
    888899    $rss->access = $access; 
    889900     
     
    10181029 
    10191030/** 
    1020 * Post the new weblog post to the RSS table 
     1031* Post the new weblog post to the RSS table.  Also called for weblog edits. 
    10211032**/ 
    10221033function folio_rss_weblog_post($object_type, $event, $object) { 
     
    10381049    $type =  'weblog'; 
    10391050 
    1040     // Ugly hack to grab tags. 
     1051    // Ugly hack to grab tags.  Only works for new posts, not for edits.  Need to fix. 
     1052        // TODO: Fix to work with edits. 
    10411053    $tags = explode(',', trim(optional_param('new_weblog_keywords'))); 
    10421054 
     
    10441056 
    10451057    $link = $CFG->wwwroot . $owner_username . '/weblog/' . $type_ident . '.html'; 
    1046  
     1058        $created = $object->posted; 
     1059         
    10471060    //generate rss 
    10481061        rss_deleteitem( $type, $type_ident ); 
    1049     rss_additem( $owner_id, $owner_username, $user_id, $user_name, $user_username, $type, $type_ident, $tags, $title, $body, $link, $access); 
     1062    rss_additem( $owner_id, $owner_username, $user_id, $user_name, $user_username, $type, $type_ident, $tags, $title, $body, $link, $access, $created); 
    10501063 
    10511064    // Update RSS in comments to match the same permission level. 
     
    10591072} 
    10601073 
     1074 
     1075/** 
     1076* Deletes the post from the RSS table. 
     1077**/ 
     1078function folio_rss_weblog_delete($object_type, $event, $object) { 
     1079    global $db, $CFG; 
     1080   
     1081        $stmt = $db->Prepare( "DELETE FROM {$CFG->prefix}folio_rss  
     1082                        WHERE type_ident = {$object->ident} AND type='weblog'"); 
     1083        $returnvalue = $db->Execute($stmt);  
     1084 
     1085    // return results 
     1086    return $object; 
     1087} 
     1088 
     1089 
     1090/** 
     1091* Deletes the post from the RSS table. 
     1092**/ 
     1093function folio_rss_weblog_comment_delete($object_type, $event, $object) { 
     1094    global $db, $CFG; 
     1095        $stmt = $db->Prepare( "DELETE FROM {$CFG->prefix}folio_rss  
     1096                        WHERE type_ident = {$object->ident} AND type='weblog_comment'"); 
     1097        $returnvalue = $db->Execute($stmt);  
     1098 
     1099    // return results 
     1100    return $object; 
     1101} 
     1102 
    10611103/** 
    10621104* Post the new weblog comment to the RSS table 
    10631105**/ 
    1064 function folio_rss_weblog_comment($object_type, $event, $object) { 
     1106function folio_rss_weblog_comment_post($object_type, $event, $object) { 
    10651107    global $CFG; 
    10661108 
     
    10921134    $title = 'Comment on "' . $post->title . '"'; 
    10931135    $link = url . $owner_username. "/weblog/" . $post->ident . ".html"; 
    1094  
     1136        $created = $object->posted; 
     1137         
    10951138    //generate rss 
    10961139    rss_additem( $owner_id, $owner_username,  
    10971140        $user_id, $user_name, $user_username,  
    10981141        'weblog_comment', $object->ident, '', 
    1099         $title, $object->body, $link, $access ); 
     1142        $title, $object->body, $link, $access, $created ); 
    11001143} 
    11011144 
     
    11031146* Record a file upload or edit 
    11041147**/ 
    1105 function folio_rss_file($object_type, $event, $object) { 
     1148function folio_rss_file_post($object_type, $event, $object) { 
    11061149    global $CFG; 
    11071150     
     
    11491192    $link = url . $owner_username . '/files/' . $object->folder . '/' . $type_ident . '/filename' ; 
    11501193    $access = $object->access; 
     1194        $created = $object->time_uploaded; 
    11511195 
    11521196    //generate rss 
    11531197        rss_deleteitem( $type, $type_ident ); 
    1154     rss_additem( $owner_ident, $owner_username, $user_ident, $user_name, $user_username, $type, $type_ident, $tags, $title, $body, $link, $access ); 
    1155          
    1156  
    1157 
    1158  
    1159  
     1198    rss_additem( $owner_ident, $owner_username, $user_ident, $user_name, $user_username, $type, $type_ident, $tags, $title, $body, $link, $access, $created ); 
     1199         
     1200 
     1201
     1202 
     1203/** 
     1204* Deletes the file from the RSS table. 
     1205**/ 
     1206function folio_rss_file_delete($object_type, $event, $object) { 
     1207    global $db, $CFG; 
     1208        $stmt = $db->Prepare( "DELETE FROM {$CFG->prefix}folio_rss  
     1209                        WHERE type_ident = {$object->ident} AND type='file'"); 
     1210        $returnvalue = $db->Execute($stmt);  
     1211 
     1212    // return results 
     1213    return $object; 
     1214
    11601215 
    11611216 
  • folio/folio/readme.txt

    r112 r115  
    11---------------------------------------------------------------------------------- 
    22                                Elgg Folio Add-in 
    3                                 Updated 6/6/2007 
     3                                Updated 6/25/2007 
    44---------------------------------------------------------------------------------- 
    55 
     
    9393 
    9494Occurred: 
    95         2007.06.06 v0.61 Fixed more bugs.   
     95        2007.06.25 v0.62 Fixed bugs.  Updated DB Scheme 
     96        2007.06.06 v0.61 Fixed bugs.  Updated DB Scheme 
    9697        2007.06.06 v0.6 Fixed a number of bugs.  Added options via config.php for  
    9798                        different display options.