Changeset 17959

Show
Ignore:
Timestamp:
10/06/08 12:33:59 (2 months ago)
Author:
adrenalin
Message:

Working on converting org.openpsa.calendar to work with
midcom.helper.datamanager2 for better compatibility for the future use.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/MidCOM_2_8/org.openpsa.calendar/calendar_midcomdba.php

    r17251 r17959  
    16491649            } 
    16501650            $vcal_keys['ATTENDEE'][] = "mailto:{$person->email}"; 
    1651             $vcal_key_parameters['ATTENDEE'][] = array( 
     1651            $vcal_key_parameters['ATTENDEE'][] = array 
     1652                ( 
    16521653                    'ROLE' => 'REQ-PARTICIPANT', 
    16531654                    'CUTYPE' => 'INVIDUAL', 
  • branches/MidCOM_2_8/org.openpsa.calendar/config/manifest.inc

    r17454 r17959  
    1010    'midcom_dba_classes.inc', 
    1111), 
    12 'version' => '2.1.1', 
    13 'state' => 'stable', 
     12'version' => '3.0.0', 
     13'state' => 'beta', 
    1414'package.xml' => array 
    1515( 
     
    3030            'role' => 'lead', 
    3131        ), 
     32        'adrenalin' => array 
     33        ( 
     34            'name' => 'Arttu Manninen', 
     35            'email' => 'arttu@kaktus.cc', 
     36            'role' => 'developer', 
     37        ), 
    3238    ), 
    3339    'dependencies' => array 
    3440    ( 
    35         'midcom.helper.datamanager' => array(), 
     41        'midcom.helper.datamanager2' => array(), 
    3642        'org.openpsa.core' => array(), 
    3743        'org.openpsa.mail' => array(), 
  • branches/MidCOM_2_8/org.openpsa.calendar/config/schemadb_config.inc

    r3799 r17959  
    11'config' => array 
    22( 
    3     'name'        => 'config', 
    4     'description' => 'Default Configuration Schema', /* This is a topic */ 
     3    'name' => 'config', 
     4    'title' => 'Default Configuration Schema', /* This is a topic */ 
    55    'locktimeout' => 0, /* Don't lock this, we display the edit view always */ 
    6     'fields'      => array 
     6    'fields' => array 
    77    ( 
    88        /* view settings */ 
    99        'start_view' => array 
    1010        ( 
    11             'description'   => 'which view to start in', 
    12             'datatype'      => 'text', 
    13             'default'       => 'week', 
    14             'location'      => 'config', 
    15             'config_domain' => 'org.openpsa.calendar', 
    16             'config_key'    => 'start_view', 
    17             'start_fieldgroup' => array 
     11            'title' => 'which view to start in', 
     12            'type' => 'text', 
     13            'default' => 'week', 
     14            'storage' => array 
     15            ( 
     16                'location' => 'configuration', 
     17                'domain' => 'org.openpsa.calendar', 
     18                'name' => 'start_view' 
     19            ), 
     20            'start_fieldset' => array 
    1821            ( 
    1922                'title' => 'view settings', 
     
    2225        'calendar_popup_height' => array 
    2326        ( 
    24             'description'   => 'height of the event popup window (px)', 
    25             'datatype'      => 'integer', 
    26             'default'       => 450, 
    27             'location'      => 'config', 
    28             'config_domain' => 'org.openpsa.calendar', 
    29             'config_key'    => 'calendar_popup_height', 
     27            'title' => 'height of the event popup window (px)', 
     28            'type' => 'integer', 
     29            'default' => 450, 
     30            'storage' => array 
     31            ( 
     32                'location' => 'configuration', 
     33                'domain' => 'org.openpsa.calendar', 
     34                'name' => 'calendar_popup_height' 
     35            ), 
    3036        ), 
    3137        'calendar_popup_width' => array 
    3238        ( 
    33             'description'   => 'width of the event popup window (px)', 
    34             'datatype'      => 'integer', 
    35             'default'       => 300, 
    36             'location'      => 'config', 
    37             'config_domain' => 'org.openpsa.calendar', 
    38             'config_key'    => 'calendar_popup_width', 
    39             'end_fieldgroup' => '', 
     39            'title' => 'width of the event popup window (px)', 
     40            'type' => 'integer', 
     41            'default' => 300, 
     42            'storage' => array 
     43            ( 
     44                'location' => 'configuration', 
     45                'domain' => 'org.openpsa.calendar', 
     46                'name' => 'calendar_popup_width' 
     47            ), 
     48            'end_fieldset' => '', 
    4049        ), 
    4150        /* time settings */ 
    4251        'day_start_time' => array 
    4352        ( 
    44             'description'  => 'hour "working day" starts', 
    45             'datatype'      => 'integer', 
    46             'location'      => 'config', 
    47             'default'       => 8, 
     53            'title' => 'hour "working day" starts', 
     54            'type' => 'integer', 
     55            'storage' => 'config', 
     56            'default' => 8, 
    4857            'config_domain' => 'org.openpsa.calendar', 
    49             'config_key'    => 'day_start_time', 
    50             'start_fieldgroup' => array 
     58            'config_key' => 'day_start_time', 
     59            'start_fieldset' => array 
    5160            ( 
    5261                'title' => 'time settings', 
     
    5564        'day_end_time' => array 
    5665        ( 
    57             'description'  => 'hour "working day" ends', 
    58             'datatype'      => 'integer', 
    59             'location'      => 'config', 
    60             'default'       => 18, 
     66            'title' => 'hour "working day" ends', 
     67            'type' => 'integer', 
     68            'storage' => 'config', 
     69            'default' => 18, 
    6170            'config_domain' => 'org.openpsa.calendar', 
    62             'config_key'    => 'day_end_time', 
     71            'config_key' => 'day_end_time', 
    6372        ), 
    6473        'day_slot_length' => array 
    6574        ( 
    66             'description'  => 'size of week day slot (minutes)', 
    67             'datatype'      => 'integer', 
    68             'location'      => 'config', 
    69             'default'       => 60, 
     75            'title' => 'size of week day slot (minutes)', 
     76            'type' => 'integer', 
     77            'storage' => 'config', 
     78            'default' => 60, 
    7079            'config_domain' => 'org.openpsa.calendar', 
    71             'config_key'    => 'day_slot_length', 
     80            'config_key' => 'day_slot_length', 
    7281        ), 
    7382        'week_slot_length' => array 
    7483        ( 
    75             'description'  => 'size of week view slot (minutes)', 
    76             'datatype'      => 'integer', 
    77             'location'      => 'config', 
    78             'default'       => 120, 
     84            'title' => 'size of week view slot (minutes)', 
     85            'type' => 'integer', 
     86            'storage' => 'config', 
     87            'default' => 120, 
    7988            'config_domain' => 'org.openpsa.calendar', 
    80             'config_key'    => 'week_slot_length', 
    81             'end_fieldgroup' => '', 
     89            'config_key' => 'week_slot_length', 
     90            'end_fieldset' => '', 
    8291        ), 
    8392         
     
    8594        'schemadb' => array 
    8695        ( 
    87             'description' => 'schema database', 
    88             'datatype' => 'text', 
    89             'location' => 'config', 
    90             'config_domain' => 'org.openpsa.calendar', 
    91             'config_key' => 'schemadb', 
    92             'start_fieldgroup' => array 
     96            'title' => 'schema database', 
     97            'type' => 'text', 
     98            'storage' => array 
     99            ( 
     100                'location' => 'configuration', 
     101                'domain' => 'org.openpsa.calendar', 
     102                'name' => 'schemadb' 
     103            ), 
     104            'start_fieldset' => array 
    93105            (  
    94106                'title' => 'advanced schema and data settings', 
    95107            ), 
    96108        ), 
    97         'always_show_group' => array 
     109        'always_show_group' => array 
    98110        ( 
    99             'description' => 'always display group', 
    100             'datatype' => 'text', 
    101             'location' => 'config', 
    102             'config_domain' => 'org.openpsa.calendar', 
    103             'config_key' => 'always_show_group', 
     111            'title' => 'always display group', 
     112            'type' => 'text', 
     113            'storage' => array 
     114            ( 
     115                'location' => 'configuration', 
     116                'domain' => 'org.openpsa.calendar', 
     117                'name' => 'always_show_group' 
     118            ), 
    104119        ),  
    105         'always_show_self' => array 
     120        'always_show_self' => array 
    106121        ( 
    107             'description' => 'always display self', 
    108             'datatype' => 'text', 
    109             'location' => 'config', 
    110             'config_domain' => 'org.openpsa.calendar', 
    111             'config_key' => 'always_show_self', 
    112             'widget'       => 'select', 
    113             'widget_select_choices' => array( 
     122            'title' => 'always display self', 
     123            'type' => 'text', 
     124            'storage' => array 
     125            ( 
     126                'location' => 'configuration', 
     127                'domain' => 'org.openpsa.calendar', 
     128                'name' => 'always_show_self' 
     129            ), 
     130            'widget' => 'select', 
     131            'widget_select_choices' => array 
     132            ( 
    114133                1 => 'yes',             
    115134                0 => 'no', 
    116135            ), 
    117136        ),          
    118         'event_label' => array 
     137        'event_label' => array 
    119138        ( 
    120             'description' => 'event label field', 
    121             'datatype' => 'text', 
    122             'location' => 'config', 
    123             'config_domain' => 'org.openpsa.calendar', 
    124             'config_key' => 'event_label', 
    125             'end_fieldgroup' => '', 
     139            'title' => 'event label field', 
     140            'type' => 'text', 
     141            'storage' => array 
     142            ( 
     143                'location' => 'configuration', 
     144                'domain' => 'org.openpsa.calendar', 
     145                'name' => 'event_label' 
     146            ), 
     147            'end_fieldset' => '', 
    126148        ), 
    127149    ), 
  • branches/MidCOM_2_8/org.openpsa.calendar/config/schemadb_default.inc

    r4794 r17959  
    1 'default' => array ( 
    2  
    3     'name'        => 'default', 
     1'default' => array 
     2
     3    'name' => 'default', 
    44    'description' => 'event', 
    5     'fields'      => array ( 
     5    'fields' => array 
     6    ( 
    67        //Hidden field for orgOpenpsaObtype 
    7         'object_type'  => array( 
    8             'default'  => ORG_OPENPSA_OBTYPE_EVENT, 
    9             'hidden'   => true, 
    10             'location' => 'orgOpenpsaObtype', 
    11             'datatype' => 'integer', 
     8        'object_type' => array 
     9        ( 
     10            'title' => 'OpenPSA type', 
     11            'type' => 'number', 
     12            'storage' => 'orgOpenpsaObtype', 
     13            'widget' =>  'text', 
     14            'default' => ORG_OPENPSA_OBTYPE_EVENT, 
     15            'hidden' => true, 
    1216        ), 
    13         'title' => array ( 
    14             'description' => 'title', 
    15             'datatype'    => 'text', 
    16             'location'    => 'title', 
    17             'start_fieldgroup' => array ( 
     17        'title' => array 
     18        ( 
     19            'title' => 'title', 
     20            'storage' => 'title', 
     21            'type' => 'text', 
     22            'widget' =>  'text', 
     23            'start_fieldset' => array 
     24            ( 
    1825                'title' => 'event information', 
    1926                'css_group' => 'area', 
    2027            ), 
    21             'required'    => true, 
     28            'required' => true, 
    2229        ), 
    23         'location' => array ( 
    24             'description' => 'location', 
    25             'datatype'    => 'text', 
    26             'location'    => 'location', 
     30        'location' => array 
     31        ( 
     32            'title' => 'location', 
     33            'storage' => 'location', 
     34            'type' => 'text', 
     35            'widget' =>  'text', 
    2736        ), 
    28         'start' => array ( 
    29             'description' => 'start time', 
    30             'datatype'    => 'unixdate', 
    31             'location'    => 'start', 
    32             'date_withtime' => true, 
    33             'widget_date_enable_outside_ais' => true, 
     37        'start' => array 
     38        ( 
     39            'title' => 'start time', 
     40            'storage' => 'start', 
     41            'type' => 'date', 
     42            'type_config' => array 
     43            ( 
     44                'storage_type' => 'UNIXTIME', 
     45            ), 
     46            'widget' => 'jsdate', 
    3447        ), 
    35         'end' => array ( 
    36             'description' => 'end time', 
    37             'datatype'    => 'unixdate', 
    38             'location'    => 'end', 
    39             'date_withtime' => true, 
    40             'widget_date_enable_outside_ais' => true, 
     48        'end' => array 
     49        ( 
     50            'title' => 'end time', 
     51            'storage' => 'end', 
     52            'type' => 'date', 
     53            'type_config' => array 
     54            ( 
     55                'storage_type' => 'UNIXTIME', 
     56            ), 
     57            'widget' => 'jsdate', 
    4158        ), 
    42         'description' => array ( 
    43             'description' => 'description', 
    44             'datatype'    => 'markdown', 
    45             'location'    => 'description', 
    46             'widget_text_inputstyle' => 'longtext', 
    47             'end_fieldgroup' => '', 
     59        'description' => array 
     60        ( 
     61            'title' => 'title', 
     62            'storage' => 'description', 
     63            'type' => 'text', 
     64            'type_config' => array 
     65            ( 
     66                'output_mode' => 'markdown', 
     67            ), 
     68            'widget' => 'textarea', 
     69            'end_fieldset' => '', 
    4870        ), 
    49         'participants' => array ( 
    50             'description' => 'participants', 
    51             'datatype'    => 'array', 
    52             'location'    => 'participants', 
    53             'widget'      => 'contactchooser', 
    54             'default'     => org_openpsa_helpers_resources(), 
    55             'start_fieldgroup' => array ( 
     71        'participants' => array 
     72        ( 
     73            'title' => 'participants', 
     74            'storage' => 'participants', 
     75            'type' => 'mnrelation', 
     76            'type_config' => array 
     77            ( 
     78                'mapping_class_name' => 'midcom_db_eventmember', 
     79                'master_fieldname' => 'eid', 
     80                'member_fieldname' => 'uid', 
     81                'master_is_id' => true, 
     82            ), 
     83            'widget' => 'chooser', 
     84            'widget_config' => array 
     85            ( 
     86                'clever_class' => 'contact', 
     87                'id_field' => 'id', 
     88            ), 
     89            'start_fieldset' => array 
     90            ( 
    5691                'title' => 'participants', 
    5792                'css_group' => 'area', 
    5893            ), 
    5994        ), 
    60         'orgOpenpsaAccesstype' => array ( 
    61             'description' => 'access type', 
    62             'location'    => 'orgOpenpsaAccesstype', 
    63             'datatype'     => 'integer', 
    64             'widget'       => 'select', 
    65             'widget_select_choices' => array( 
    66                 ORG_OPENPSA_ACCESSTYPE_PUBLIC => 'public', 
    67                 ORG_OPENPSA_ACCESSTYPE_PRIVATE => 'private', 
     95        'orgOpenpsaAccesstype' => array 
     96        ( 
     97            'title' => 'access type', 
     98            'storage' => 'orgOpenpsaAccesstype', 
     99            'type' => 'select', 
     100            'type_config' => array 
     101            ( 
     102                'options' => array 
     103                ( 
     104                    ORG_OPENPSA_ACCESSTYPE_PUBLIC => 'public', 
     105                    ORG_OPENPSA_ACCESSTYPE_PRIVATE => 'private', 
     106                ), 
    68107            ), 
     108            'widget' => 'select', 
    69109        ), 
    70         'busy' => array ( 
    71             'description' => 'dont allow overlapping', 
    72             'datatype'    => 'integer', 
    73             'widget'      => 'checkbox', 
    74             'location'    => 'busy', 
    75             'default'     => 1, 
    76             'end_fieldgroup' => '', 
     110        'busy' => array 
     111        ( 
     112            'title' => 'dont allow overlapping', 
     113            'storage' => 'busy', 
     114            'type' => 'boolean', 
     115            'widget' => 'checkbox', 
     116            'default' => 1, 
     117            'end_fieldset' => '', 
    77118        ), 
    78119    ), 
  • branches/MidCOM_2_8/org.openpsa.calendar/handler/filters.php

    r4794 r17959  
    9494        { 
    9595            $this->_view_toolbar->add_item( 
    96                 Array( 
     96                array 
     97                ( 
    9798                    MIDCOM_TOOLBAR_URL => $_GET['org_openpsa_calendar_returnurl'], 
    9899                    MIDCOM_TOOLBAR_LABEL => $this->_request_data['l10n']->get('back to calendar'), 
  • branches/MidCOM_2_8/org.openpsa.calendar/midcom/interfaces.php

    r12017 r17959  
    1515        $this->_component = 'org.openpsa.calendar'; 
    1616        $this->_autoload_class_definitions = array('midcom_dba_classes.inc'); 
    17         $this->_autoload_files = array( 
     17        $this->_autoload_files = array 
     18        ( 
    1819            'admin.php', 
    1920            'calendar_midcomdba.php', 
     
    2425            'navigation.php', 
    2526        ); 
    26         $this->_autoload_libraries = Array( 
     27        $this->_autoload_libraries = array 
     28        ( 
    2729            'midcom.helper.datamanager', 
    2830            'org.openpsa.core', 
     
    324326 
    325327        // Transfer metadata dependencies from classes that we drive 
    326         $classes = array( 
     328        $classes = array 
     329        ( 
    327330            'org_openpsa_calendar_event', 
    328331            'org_openpsa_calendar_eventmember', 
     
    335338                { 
    336339                    default: 
    337                         $metadata_fields = array( 
     340                        $metadata_fields = array 
     341                        ( 
    338342                            'creator' => 'id', 
    339343                            'revisor' => 'id' // Though this will probably get touched on update we need to check it anyways to avoid invalid links 
  • branches/MidCOM_2_8/org.openpsa.calendar/viewer.php

    <
    r15517 r17959  
    3131        $this->_selected_time = time(); 
    3232 
    33         // Load schema database snippet or file 
    34         debug_add("Loading Schema Database", MIDCOM_LOG_DEBUG); 
    35         $schemadb_contents = midcom_get_snippet_content($this->_config->get('schemadb')); 
    36         eval("\$schemadb = Array ( {$schemadb_contents} );"); 
    37  
    38         // Initialize the datamanager with the schema 
    39         $this->_datamanager = new midcom_helper_datamanager($schemadb); 
    40  
    41         if (!$this->_datamanager) { 
    42             $_MIDCOM->generate_error(MIDCOM_ERRCRIT, "Datamanager could not be instantiated."); 
    43             // This will exit. 
    44         } 
     33        // Load schema database 
     34        $this->_schemadb = midcom_helper_datamanager2_schema::load_database($this->_config->get('schemadb')); 
     35        $this->_datamanager = new midcom_helper_datamanager2_datamanager($this->_schemadb); 
     36         
     37        $this->_request_data['schemadb'] =& $this->_schemadb; 
     38        $this->_request_data['datamanager'] =& $this->_datamanager; 
    4539 
    4640        // Always run in uncached mode 
    4741        $_MIDCOM->cache->content->no_cache(); 
    4842 
    49         if (   !isset($GLOBALS['midcom_component_data']['org.openpsa.calendar']['calendar_root_event']) 
    50             || !is_object($GLOBALS['midcom_component_data']['org.openpsa.calendar']['calendar_root_event'])) 
     43        if (!$this->_config->get('calendar_root_event')) 
    5144        { 
    5245            // Match / 
    53             $this->_request_switch[] = array( 
    54                 'handler' => 'notinitialized' 
     46            $this->_request_switch['not_initialized'] = array 
     47            ( 
     48                'handler' => 'notinitialized', 
    5549            ); 
    5650        } 
     
    5852        { 
    5953            // Match /month/<date> 
    60             $this->_request_switch[] = array( 
     54            $this->_request_switch['month_view_with_date'] = array 
     55            ( 
     56                'handler' => array 
     57                ( 
     58                    'org_openpsa_calendar_handler_view', 
     59                    'month', 
     60                ), 
    6161                'fixed_args' => 'month', 
    6262                'variable_args' => 1, 
    63                 'handler' => 'month' 
    6463            ); 
    6564            // Match /month/ 
    66             $this->_request_switch[] = array( 
     65            $this->_request_switch['month_view'] = array 
     66            ( 
     67                'handler' => array 
     68                ( 
     69                    'org_openpsa_calendar_handler_view', 
     70                    'month', 
     71                ), 
    6772                'fixed_args' => 'month', 
    68                 'handler' => 'month' 
    6973            ); 
    7074            // Match /week/<date> 
    71             $this->_request_switch[] = array( 
     75            $this->_request_switch['week_view_with_date'] = array 
     76            ( 
     77                'handler' => array 
     78                ( 
     79                    'org_openpsa_calendar_handler_view', 
     80                    'week', 
     81                ), 
    7282                'fixed_args' => 'week', 
    7383                'variable_args' => 1, 
    74                 'handler' => 'week' 
    7584            ); 
    7685            // Match /week/ 
    77             $this->_request_switch[] = array( 
     86            $this->_request_switch['week_view'] = array 
     87            ( 
     88                'handler' => array 
     89                ( 
     90                    'org_openpsa_calendar_handler_view', 
     91                    'week', 
     92                ), 
    7893                'fixed_args' => 'week', 
    79                 'handler' => 'week' 
    8094            ); 
    8195            // Match /day/<date> 
    82             $this->_request_switch[] = array( 
     96            $this->_request_switch['day_view_with_date'] = array 
     97            ( 
     98                'handler' => array 
     99                ( 
     100                    'org_openpsa_calendar_handler_view', 
     101                    'day', 
     102                ), 
    83103                'fixed_args' => 'day', 
    84104                'variable_args' => 1, 
    85                 'handler' => 'day' 
    86105            ); 
    87106            // Match /day/ 
    88             $this->_request_switch[] = array( 
     107            $this->_request_switch['day_view'] = array 
     108            ( 
     109                'handler' => array 
     110                ( 
     111                    'org_openpsa_calendar_handler_view', 
     112                    'day', 
     113                ), 
    89114                'fixed_args' => 'day', 
    90                 'handler' => 'day' 
    91115            ); 
    92116            // Match /event/new/<person_guid>/<timestamp> 
    93             $this->_request_switch[] = array( 
    94                 'fixed_args' => array('event', 'new'), 
     117            $this->_request_switch['new_event_for_person_with_time'] = array 
     118            ( 
     119                'handler' => array 
     120                ( 
     121                    'org_openpsa_calendar_handler_create', 
     122                    'create' 
     123                ), 
     124                'fixed_args' => array 
     125                ( 
     126                    'event', 
     127                    'new' 
     128                ), 
    95129                'variable_args' => 2, 
    96                 'handler' => 'event_new' 
    97130            ); 
    98131            // Match /event/new/<person_guid> 
    99             $this->_request_switch[] = array( 
    100                 'fixed_args' => array('event', 'new'), 
    101                 'variable_args' => 1, 
    102                 'handler' => 'event_new' 
     132            $this->_request_switch['new_event_for_person'] = array 
     133            ( 
     134                'handler' => array 
     135                ( 
     136                    'org_openpsa_calendar_handler_create', 
     137                    'create' 
     138                ), 
     139                'fixed_args' => array 
     140                ( 
     141                    'event', 
     142                    'new' 
     143                ), 
     144                'variable_args' => 1, 
    103145            ); 
    104146            // Match /event/new 
    105             $this->_request_switch[] = array( 
    106                 'fixed_args' => array('event', 'new'), 
    107                 'handler' => 'event_new' 
     147            $this->_request_switch['new_event'] = array 
     148            ( 
     149                'handler' => array 
     150                ( 
     151                    'org_openpsa_calendar_handler_create', 
     152                    'create' 
     153                ), 
     154                'fixed_args' => array 
     155                ( 
     156                    'event', 
     157                    'new' 
     158                ), 
    108159            ); 
    109160            // Match /event/raw/<guid> 
    110             $this->_request_switch['event_view_raw'] = array( 
     161            $this->_request_switch['event_view_raw'] = array 
     162            ( 
     163                'handler' => array 
     164                ( 
     165                    'org_openpsa_calendar_handler_view', 
     166                    'event', 
     167                ), 
    111168                'fixed_args' => array('event', 'raw'), 
    112169                'variable_args' => 1, 
    113                 'handler' => 'event' 
    114170            ); 
    115171            // Match /event/<guid>/<action> 
    116             $this->_request_switch[] = array( 
     172            $this->_request_switch['event_action'] = array 
     173            ( 
     174                'handler' => array 
     175                ( 
     176                    'org_openpsa_calendar_handler_admin', 
     177                    'admin', 
     178                ), 
    117179                'fixed_args' => 'event', 
    118180                'variable_args' => 2, 
    119                 'handler' => 'event_action' 
    120181            ); 
    121182            // Match /event/<guid> 
    122             $this->_request_switch['event_view'] = array( 
     183            $this->_request_switch['event_view'] = array 
     184            ( 
     185                'handler' => array 
     186                ( 
     187                    'org_openpsa_calendar_handler_view', 
     188                    'event', 
     189                ), 
    123190                'fixed_args' => 'event', 
    124191                'variable_args' => 1, 
    125                 'handler' => 'event' 
    126             ); 
    127             //Match /debug 
    128             $this->_request_switch[] = array( 
    129                 'fixed_args' => 'debug', 
    130                 'handler' => 'debug' 
    131             ); 
     192            ); 
     193             
     194            // This will redirect to the selected mode 
    132195            // Match / 
    133             $this->_request_switch[] = array( 
    134                 'handler' => 'frontpage' 
     196            $this->_request_switch[] = array 
     197            ( 
     198                'handler' => 'frontpage', 
    135199            ); 
    136200 
    137201            // Match /filters 
    138             $this->_request_switch['filters_edit'] = array( 
     202            $this->_request_switch['filters_edit'] = array 
     203            ( 
     204                'handler' => Array('org_openpsa_calendar_handler_filters', 'edit'), 
    139205                'fixed_args' => Array('filters'), 
    140                 'handler' => Array('org_openpsa_calendar_handler_filters', 'edit'), 
    141206            ); 
    142207 
    143208            // Match /agenda/day/<timestamp> 
    144             $this->_request_switch['agenda_day'] = array( 
     209            $this->_request_switch['agenda_day'] = array 
     210            ( 
     211                'handler' => Array('org_openpsa_calendar_handler_agenda', 'day'), 
    145212                'fixed_args' => Array('agenda', 'day'), 
    146213                'variable_args' => 1, 
    147                 'handler' => Array('org_openpsa_calendar_handler_agenda', 'day'), 
    148214            ); 
    149215 
    150216            // Match /ical/events/<username> 
    151             $this->_request_switch['ical_user_feed'] = array( 
     217            $this->_request_switch['ical_user_feed'] = array 
     218            ( 
     219                'handler' => Array('org_openpsa_calendar_handler_ical', 'user_events'), 
    152220                'fixed_args' => Array('ical', 'events'), 
    153221                'variable_args' => 1, 
    154                 'handler' => Array('org_openpsa_calendar_handler_ical', 'user_events'), 
    155222            ); 
    156223 
    157224            // Match /ical/busy/<username> 
    158             $this->_request_switch['ical_user_busy'] = array( 
     225            $this->_request_switch['ical_user_busy'] = array 
     226            ( 
     227                'handler' => Array('org_openpsa_calendar_handler_ical', 'user_busy'), 
    159228                'fixed_args' => Array('ical', 'busy'), 
    160229                'variable_args' => 1, 
    161                 'handler' => Array('org_openpsa_calendar_handler_ical', 'user_busy'), 
    162230            ); 
    163231 
     
    178246 
    179247        // This component uses Ajax, include the handler javascripts 
    180         $_MIDCOM->add_jsfile(MIDCOM_STATIC_URL."/org.openpsa.helpers/ajaxutils.js"); 
     248        $_MIDCOM->add_jsfile(MIDCOM_STATIC_URL.'/org.openpsa.helpers/ajaxutils.js'); 
    181249        $this->_request_data['view'] = 'default'; 
    182250         
     
    187255                'rel' => 'stylesheet', 
    188256                'type' => 'text/css', 
    189                 'href' => MIDCOM_STATIC_URL."/org.openpsa.core/ui-elements.css"
     257                'href' => MIDCOM_STATIC_URL.'/org.openpsa.core/ui-elements.css'
    190258            ) 
    191259        ); 
     
    208276    { 
    209277        // This is what Datamanager calls to actually create an event 
    210         $result = array ( 
    211             "storage" => null, 
    212             "success" => false, 
     278        $result = array 
     279        ( 
     280            'storage' => null, 
     281            'success' => false, 
    213282        ); 
    214283 
     
    240309            debug_add("org_openpsa_relatedto_handler returned \n===\n" . print_r($rel_ret) . "===\n"); 
    241310            $this->_request_data['event']->notify_force_add = true; 
    242             $result["storage"] =& $this->_request_data['event']; 
    243             $result["success"] = true; 
     311            $result['storage'] =& $this->_request_data['event']; 
     312            $result['success'] = true; 
    244313            //return $result; 
    245314        } 
     
    252321    } 
    253322 
    254     function _get_datestring($from = false) 
    255     { 
    256         if (!$from) 
    257         { 
    258             $from = $this->_selected_time; 
    259         } 
    260         $datestring = date('Y-m-d', $from); 
    261         return $datestring; 
    262     } 
    263  
    264     function _populate_toolbar($today_path = null) 
    265     { 
    266         // "New event" should always be in toolbar 
    267         $nap = new midcom_helper_nav(); 
    268         $this_node = $nap->get_node($nap->get_current_node()); 
    269         if ($_MIDCOM->auth->can_do('midgard:create', $GLOBALS['midcom_component_data']['org.openpsa.calendar']['calendar_root_event'])) 
    270         { 
    271             $this->_view_toolbar->add_item( 
    272                 Array( 
    273                     MIDCOM_TOOLBAR_URL => "#", 
    274                     MIDCOM_TOOLBAR_LABEL => $this->_request_data['l10n']->get('create event'), 
    275                     MIDCOM_TOOLBAR_HELPTEXT => null, 
    276                     MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/stock_new-event.png', 
    277                     MIDCOM_TOOLBAR_ENABLED => true, 
    278                     MIDCOM_TOOLBAR_OPTIONS  => Array( 
    279                         'rel' => 'directlink', 
    280                         'onClick' => org_openpsa_calendar_interface::calendar_newevent_js($this_node), 
    281                     ), 
    282                 ) 
    283             ); 
    284         } 
    285  
    286  
    287         if (   $this->_topic->can_do('midgard:update') 
    288             && $this->_topic->can_do('midcom:component_config')) 
    289         { 
    290             $this->_node_toolbar->add_item( 
    291                 Array( 
    292                     MIDCOM_TOOLBAR_URL => 'config.html', 
    293                     MIDCOM_TOOLBAR_LABEL => $this->_l10n_midcom->get('component configuration'), 
    294                     MIDCOM_TOOLBAR_HELPTEXT => $this->_l10n_midcom->get('component configuration helptext'), 
    295                     MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/stock_folder-properties.png', 
    296                 ) 
    297             ); 
    298         } 
    299  
    300         $prefix = MIDCOM_STATIC_URL . '/midcom.helper.datamanager/jscript-calendar'; 
    301         $_MIDCOM->add_jsfile("{$prefix}/calendar.js"); 
    302  
    303         // Select correct locale 
    304         $i18n =& $_MIDCOM->get_service("i18n"); 
    305         $language = $i18n->get_current_language(); 
    306         switch ($language) 
    307         { 
    308             // TODO: Add more languages here when corresponding locale files exist 
    309             case "fi": 
    310                 $_MIDCOM->add_jsfile("{$prefix}/calendar-fi.js"); 
    311                 break; 
    312             case "en": 
    313             default: 
    314                 $_MIDCOM->add_jsfile("{$prefix}/calendar-en.js"); 
    315                 break; 
    316         } 
    317  
    318         $_MIDCOM->add_jsfile("{$prefix}/calendar-setup.js"); 
    319  
    320         $dateopts = date('Y', $this->_selected_time).', '; 
    321         $dateopts .= date('n', $this->_selected_time) - 1; 
    322         $dateopts .= ', '.date('j', $this->_selected_time); 
    323  
    324         $_MIDCOM->add_jscript(' 
    325 var openPsaShowMonthSelectorCalendarShown = false; 
    326 var openPsaShowMonthSelectorCalendarInitialized = false;