Changeset 1366

Show
Ignore:
Timestamp:
12/05/07 16:28:15 (1 year ago)
Author:
rho
Message:

addfile content toolbar button moved to pagesetup function

This because if page_owner() it's called from _init cause
to set page_owner = -1 if not setup yet by -for example- run('profile:init')

Signed-off: Rolando Espinoza La fuente <rho@prosoftpeople.com>

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • devel/mod/file/lib.php

    r1339 r1366  
    4141        } 
    4242    } 
    43 
    44  
    45 function file_init() { 
    46     global $CFG; 
    47     global $function; 
    48     global $metatags; 
    49  
    50     // Styles for file icons 
    51         $metatags .= "<style type=\"text/css\">"; 
    52         $metatags .= str_replace("{{url}}", $CFG->wwwroot, file_get_contents(dirname(__FILE__). "/file-icons.css")); 
    53         $metatags .= "</style>"; 
    54          
    55     // Functions to perform upon initialisation 
    56         $function['files:init'][] = $CFG->dirroot . "mod/file/lib/files_init.php"; 
    57         $function['files:init'][] = $CFG->dirroot . "mod/file/lib/metadata_defaults.php"; 
    58         $function['files:init'][] = $CFG->dirroot . "mod/file/lib/inline_mimetypes.php"; 
    59      
    60     // Mime-type init 
    61         $function['files:metadata:init'][] = $CFG->dirroot . "mod/file/lib/inline_mimetypes.php"; 
    62          
    63     // Actions to perform 
    64         $function['files:init'][] = $CFG->dirroot . "mod/file/lib/files_actions.php"; 
    65  
    66     // Init for search 
    67         $function['search:init'][] = $CFG->dirroot . "mod/file/lib/files_init.php"; 
    68         $function['search:all:tagtypes'][] = $CFG->dirroot . "mod/file/lib/function_search_all_tagtypes.php"; 
    69          
    70     // Function to search through weblog posts 
    71         $function['search:display_results'][] = $CFG->dirroot . "mod/file/lib/function_search.php"; 
    72         $function['search:display_results:rss'][] = $CFG->dirroot . "mod/file/lib/function_search_rss.php"; 
    73          
    74     // Determines whether or not a file should be displayed in the browser 
    75         $function['files:mimetype:inline'][] = $CFG->dirroot . "mod/file/lib/files_mimetype_inline.php"; 
    76          
    77     // View files 
    78         $function['files:view'][] = $CFG->dirroot . "mod/file/lib/files_view.php"; 
    79  
    80     // View the contents of a specific folder 
    81         $function['files:folder:view'][] = $CFG->dirroot . "mod/file/lib/folder_view.php"; 
    82          
    83     // Edit the contents of a specific folder 
    84         $function['files:folder:edit'][] = $CFG->dirroot . "mod/file/lib/edit_folder.php"; 
    85  
    86     // Add files through the wizard 
    87         $function['files:wizard:add:file'][] = $CFG->dirroot . "mod/file/lib/add_file.php"; 
    88          
    89     // Edit the metadata for a specific file 
    90         $function['files:edit'][] = $CFG->dirroot . "mod/file/lib/edit_file.php"; 
    91         $function['folder:select'][] = $CFG->dirroot . "mod/file/lib/select_folder.php"; 
    92      
    93     // Edit metadata 
    94         $function['metadata:edit'][] = $CFG->dirroot . "mod/file/lib/metadata_edit.php"; 
    95          
    96     // Turn file ID into a link 
    97         $function['files:links:make'][] = $CFG->dirroot . "mod/file/lib/files_links_make.php"; 
    98          
    99     // Allow users to embed files in weblog posts 
    100         $function['weblogs:text:process'][] = $CFG->dirroot . "mod/file/lib/weblogs_text_process.php"; 
    101  
    102         $function['weblogs:posts:add:fields'][] = $CFG->dirroot . "mod/file/lib/weblogs_posts_add_fields.php"; 
    103         $function['weblogs:posts:edit:fields'][] = $CFG->dirroot . "mod/file/lib/weblogs_posts_add_fields.php"; 
    104                      
    105     // Log on bar down the right hand side 
    106         $function['display:sidebar'][] = $CFG->dirroot . "mod/file/lib/files_user_info_menu.php"; 
    107          
    108     // Template preview 
    109         $function['templates:preview'][] = $CFG->dirroot . "mod/file/lib/templates_preview.php"; 
    110  
    111     // Establish permissions 
    112         $function['permissions:check'][] = $CFG->dirroot . "mod/file/lib/permissions_check.php"; 
    113  
    114     // Actions to perform when an access group is deleted 
    115         $function['groups:delete'][] = $CFG->dirroot . "mod/file/lib/groups_delete.php"; 
    116  
    117     // Publish static RSS file of files 
    118         $function['files:rss:getitems'][] = $CFG->dirroot . "mod/file/lib/function_rss_getitems.php"; 
    119         $function['files:rss:publish'][] = $CFG->dirroot . "mod/file/lib/function_rss_publish.php"; 
    120      
    121     // Has the $CFG->files->default_handler been set? If not, set it to local 
    122         if (empty($CFG->files->default_handler)) { 
    123             $CFG->files->default_handler = "elgg"; 
    124         } 
    125         if (empty($CFG->folders->default_handler)) { 
    126             $CFG->folders->default_handler = "elgg"; 
    127         } 
    128         $CFG->folders->handler["elgg"]['menuitem'] = __gettext("Default file folder"); 
    129         $CFG->folders->handler["elgg"]['view'] = "file_folder_view"; 
    130         $CFG->folders->handler["elgg"]['preview'] = "file_folder_preview"; 
    131          
    132         $CFG->widgets->list[] = array( 
    133                                         'name' => __gettext("Files widget"), 
    134                                         'description' => __gettext("Displays images of some of your files."), 
    135                                         'type' => "file::files" 
    136                                 ); 
    137          
    138    // Delete users 
    139         listen_for_event("user","delete","file_user_delete"); 
    140                  
     43 
    14144  // Adding the file's selector wizard 
    14245  $options = array('options'=> 'width=600,height=300,left=20,top=20,scrollbars=yes,resizable=yes', 
     
    14548                   'url' => $CFG->wwwroot."mod/file/file_include_wizard.php?owner=".page_owner()); 
    14649  add_content_tool_button("mediapopup",__gettext("Add File"), "image.png", "f", $options); 
    147          
    148  
     50 
     51
     52 
     53function file_init() { 
     54    global $CFG; 
     55    global $function; 
     56    global $metatags; 
     57 
     58    // Styles for file icons 
     59        $metatags .= "<style type=\"text/css\">"; 
     60        $metatags .= str_replace("{{url}}", $CFG->wwwroot, file_get_contents(dirname(__FILE__). "/file-icons.css")); 
     61        $metatags .= "</style>"; 
     62         
     63    // Functions to perform upon initialisation 
     64        $function['files:init'][] = $CFG->dirroot . "mod/file/lib/files_init.php"; 
     65        $function['files:init'][] = $CFG->dirroot . "mod/file/lib/metadata_defaults.php"; 
     66        $function['files:init'][] = $CFG->dirroot . "mod/file/lib/inline_mimetypes.php"; 
     67     
     68    // Mime-type init 
     69        $function['files:metadata:init'][] = $CFG->dirroot . "mod/file/lib/inline_mimetypes.php"; 
     70         
     71    // Actions to perform 
     72        $function['files:init'][] = $CFG->dirroot . "mod/file/lib/files_actions.php"; 
     73 
     74    // Init for search 
     75        $function['search:init'][] = $CFG->dirroot . "mod/file/lib/files_init.php"; 
     76        $function['search:all:tagtypes'][] = $CFG->dirroot . "mod/file/lib/function_search_all_tagtypes.php"; 
     77         
     78    // Function to search through weblog posts 
     79        $function['search:display_results'][] = $CFG->dirroot . "mod/file/lib/function_search.php"; 
     80        $function['search:display_results:rss'][] = $CFG->dirroot . "mod/file/lib/function_search_rss.php"; 
     81         
     82    // Determines whether or not a file should be displayed in the browser 
     83        $function['files:mimetype:inline'][] = $CFG->dirroot . "mod/file/lib/files_mimetype_inline.php"; 
     84         
     85    // View files 
     86        $function['files:view'][] = $CFG->dirroot . "mod/file/lib/files_view.php"; 
     87 
     88    // View the contents of a specific folder 
     89        $function['files:folder:view'][] = $CFG->dirroot . "mod/file/lib/folder_view.php"; 
     90         
     91    // Edit the contents of a specific folder 
     92        $function['files:folder:edit'][] = $CFG->dirroot . "mod/file/lib/edit_folder.php"; 
     93 
     94    // Add files through the wizard 
     95        $function['files:wizard:add:file'][] = $CFG->dirroot . "mod/file/lib/add_file.php"; 
     96         
     97    // Edit the metadata for a specific file 
     98        $function['files:edit'][] = $CFG->dirroot . "mod/file/lib/edit_file.php"; 
     99        $function['folder:select'][] = $CFG->dirroot . "mod/file/lib/select_folder.php"; 
     100     
     101    // Edit metadata 
     102        $function['metadata:edit'][] = $CFG->dirroot . "mod/file/lib/metadata_edit.php"; 
     103         
     104    // Turn file ID into a link 
     105        $function['files:links:make'][] = $CFG->dirroot . "mod/file/lib/files_links_make.php"; 
     106         
     107    // Allow users to embed files in weblog posts 
     108        $function['weblogs:text:process'][] = $CFG->dirroot . "mod/file/lib/weblogs_text_process.php"; 
     109 
     110        $function['weblogs:posts:add:fields'][] = $CFG->dirroot . "mod/file/lib/weblogs_posts_add_fields.php"; 
     111        $function['weblogs:posts:edit:fields'][] = $CFG->dirroot . "mod/file/lib/weblogs_posts_add_fields.php"; 
     112                     
     113    // Log on bar down the right hand side 
     114        $function['display:sidebar'][] = $CFG->dirroot . "mod/file/lib/files_user_info_menu.php"; 
     115         
     116    // Template preview 
     117        $function['templates:preview'][] = $CFG->dirroot . "mod/file/lib/templates_preview.php"; 
     118 
     119    // Establish permissions 
     120        $function['permissions:check'][] = $CFG->dirroot . "mod/file/lib/permissions_check.php"; 
     121 
     122    // Actions to perform when an access group is deleted 
     123        $function['groups:delete'][] = $CFG->dirroot . "mod/file/lib/groups_delete.php"; 
     124 
     125    // Publish static RSS file of files 
     126        $function['files:rss:getitems'][] = $CFG->dirroot . "mod/file/lib/function_rss_getitems.php"; 
     127        $function['files:rss:publish'][] = $CFG->dirroot . "mod/file/lib/function_rss_publish.php"; 
     128     
     129    // Has the $CFG->files->default_handler been set? If not, set it to local 
     130        if (empty($CFG->files->default_handler)) { 
     131            $CFG->files->default_handler = "elgg"; 
     132        } 
     133        if (empty($CFG->folders->default_handler)) { 
     134            $CFG->folders->default_handler = "elgg"; 
     135        } 
     136        $CFG->folders->handler["elgg"]['menuitem'] = __gettext("Default file folder"); 
     137        $CFG->folders->handler["elgg"]['view'] = "file_folder_view"; 
     138        $CFG->folders->handler["elgg"]['preview'] = "file_folder_preview"; 
     139         
     140        $CFG->widgets->list[] = array( 
     141                                        'name' => __gettext("Files widget"), 
     142                                        'description' => __gettext("Displays images of some of your files."), 
     143                                        'type' => "file::files" 
     144                                ); 
     145         
     146   // Delete users 
     147        listen_for_event("user","delete","file_user_delete"); 
     148                 
    149149        // Register a display object function 
    150150        display_set_display_function('file', 'file_displayobject');