Commits

Joachim Werner committed 36facf5

Changed id's for guiders to fix prev./next buttons

Comments (0)

Files changed (2)

protected/modules/onlinehelp/components/OnlineHelpWidget.php

             $model = null;
         $this->model = $model;
 
-        $models = OnlineHelp::model()->findAllByAttributes(array('requestId'=>$this->pathInfo, 'isPageHelp'=>0), array('order'=>'sequenceNbr'));
+        $criteria = new CDbCriteria;
+        $criteria->compare('requestId', $this->pathInfo);
+        $criteria->compare('isPageHelp', 0);
+        $criteria->order = 'sequenceNbr';
+        $models = OnlineHelp::model()->findAll($criteria); //ByAttributes(array('requestId'=>$this->pathInfo, 'isPageHelp'=>0), array('order'=>'sequenceNbr'));
         if(count($models)==0)
             $models = null;
         $this->models = $models;

protected/modules/onlinehelp/components/views/onlineHelpWidget.php

     $content = $parser->safeTransform($model->content);
     // {{{ Page Help Guider
     $cfg = array(
-        'id'          => 'first',
+        'id'          => 'olHelpGuider_'.$model->id,
         'title'       => $model->title,
         'buttons'     => array(),
         'description' => $content.$checkbox,
         ).'</p>';
     }
     if(!is_null($models)) {
-        $cfg['next'] = 'olHelpGuider_1';
+        $cfg['next'] = 'olHelpGuider_'.$models[0]->id;
         $cfg['buttons'][] = array(
             'name'   => Yii::t('onlinehelp','Next'),
             'onclick'=> "js:function(){guiders.next();}"
 if(!is_null($models)) { // {{{ Element-specific help guiders
     foreach($models as $n=>$olHelp) {
         $cfg = array( 
-            'id'          => 'olHelpGuider_'.($n+1),
+            'id'          => 'olHelpGuider_'.$olHelp->id,
             'title'       => $olHelp->title,
             'description' => $parser->safeTransform($olHelp->content),
             'overlay'     => false,
         if($n==0 and !is_null($model) ) {
             $buttons[] = array(
                 'name'   => Yii::t('onlinehelp','Previous'),
-                'onclick'=> "js:function(){guiders.hideAll(); $('.highlight pre').hide(); guiders.show('first');}"
+                'onclick'=> "js:function(){guiders.hideAll(); $('.highlight pre').hide(); guiders.show('olHelpGuider_".$model->id."');}"
             );
         }
         if( $n>0 ) {
             $buttons[] = array(
                 'name'   => Yii::t('onlinehelp','Previous'),
-                'onclick'=> "js:function(){guiders.hideAll(); $('.highlight pre').hide(); guiders.show('first');}"
+                'onclick'=> "js:function(){guiders.hideAll(); $('.highlight pre').hide(); guiders.show('olHelpGuider_".$models[$n-1]->id."');}"
             );
         }
         if( isset( $models[$n+1] ) ) {
-            $cfg['next'] = 'olHelpGuider_'.($n+2);
+            $cfg['next'] = 'olHelpGuider_'.$models[$n+1]->id;
             $buttons[] = array(
                 'name'   => Yii::t('onlinehelp','Next'),
                 'onclick'=> "js:function(){guiders.next();}"