Changeset 16090

Show
Ignore:
Timestamp:
04/15/08 14:29:57 (6 months ago)
Author:
rambo
Message:

raise UIMessage if object cannot be replicated due to one of its parents being not-approved

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/MidCOM_2_8/midcom.helper.replicator/exporter/staging2live.php

    r16086 r16090  
    184184    function _check_approval(&$object) 
    185185    { 
     186        static $parent_check_stack = array(); 
    186187        debug_push_class(__CLASS__, __FUNCTION__); 
    187188        debug_add("Called for {$object->guid}"); 
     
    240241            // Check the parent also, as that may be unapproved 
    241242            $parent = $object->get_parent(); 
    242             if ($parent) 
    243             { 
     243            if (   is_object($parent) 
     244                && isset($parent->guid) 
     245                && !empty($parent->guid)) 
     246            { 
     247                array_push($parent_check_stack, $object->guid); 
    244248                $this->exportability[$object->guid] = $this->is_exportable($parent, false); 
    245  
     249                array_pop($parent_check_stack); 
    246250                if (!$this->exportability[$object->guid]) 
    247251                { 
    248252                    // TODO: Uimessage, but how to give only one ?? 
    249253                    $GLOBALS['midcom_helper_replicator_logger']->log_object($object, 'Parent not approved, skipping'); 
     254                    if (empty($parent_check_stack)) 
     255                    { 
     256                        // Empty stack means we're  not inside parent recursion, thus we can raise an UIMessage 
     257                        $_MIDCOM->load_library('midcom.helper.reflector'); 
     258                        $ref = new midcom_helper_reflector($object); 
     259                        $_MIDCOM->uimessages->add 
     260                        ( 
     261                            $this->_l10n->get('midcom.helper.replicator'), 
     262                            sprintf 
     263                            ( 
     264                                $this->_l10n->get('%s %s could not be exported for replication because one of its parents is not approved'),  
     265                                $ref->get_class_label(),  
     266                                $ref->get_object_label($object) 
     267                            ), 
     268                            'warning' 
     269                        ); 
     270                    } 
    250271                } 
    251272            } 
  • branches/MidCOM_2_8/midcom.helper.replicator/locale/default.en.txt

    r15832 r16090  
    5656---STRINGEND 
    5757 
     58---STRING http post transport 
     59HTTP POST transport 
     60---STRINGEND 
     61 
    5862---STRING imported 
    5963Imported to database 
     
    6973 
    7074---STRING mirroring subscription 
    71 Mirror 
     75Mirroring Subscription 
    7276---STRINGEND 
    7377 
     
    8892---STRINGEND 
    8993 
     94---STRING replication queue %s cannot be written by Apache user 
     95Replication queue %s cannot be written by Apache user 
     96---STRINGEND 
     97 
    9098---STRING replication queue %s does not exist 
    9199Replication queue %s does not exist 
    92 ---STRINGEND 
    93  
    94 ---STRING replication queue %s cannot be written by Apache user 
    95 Replication queue %s cannot be written by Apache user 
    96100---STRINGEND 
    97101 
     
    106110---STRING staging2live subscription 
    107111Staging/live 
     112---STRINGEND 
     113 
     114---STRING staging2live subscription with type filter 
     115Staging2live subscription with type filter 
    108116---STRINGEND 
    109117 
     
    132140---STRINGEND 
    133141 
    134 ---STRING http post transport 
    135 HTTP POST transport 
     142---STRING %s %s could not be exported for replication because one of its parents is not approved 
     143%s %s could not be exported for replication because one of its parents is not approved 
    136144---STRINGEND 
    137145 
    138 ---STRING mirroring subscription 
    139 Mirroring Subscription 
    140 ---STRINGEND 
    141  
    142 ---STRING staging2live subscription with type filter 
    143 Staging2live subscription with type filter 
    144 ---STRINGEND 
  • branches/MidCOM_2_8/midcom.helper.replicator/locale/default.fi.txt

    r13072 r16090  
    120120---STRINGEND 
    121121 
     122---STRING %s %s could not be exported for replication because one of its parents is not approved 
     123%s %s ei voida replikoida koska jokin sen vanhemmista ei ole hyvÀksytty. 
     124---STRINGEND 
     125