[ Index ]
 

Code source de eGroupWare 1.2.106-2

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/workflow/doc/examples/ -> TestJoin2.xml (source)

   1  <process>
   2    <name>TestJoin2</name>
   3    <isValid>y</isValid>
   4    <version>1.7</version>
   5    <isActive>y</isActive>
   6     <description>Testing join activities</description>
   7    <lastModif>19/11/2005 [12:57:34]</lastModif>
   8    <sharedCode><![CDATA[<?php
   9  //***************************************************************************
  10  //* copyleft Regis dot Leroy at glconseil dot com                           *
  11  //* This program is free software; you can redistribute it and/or modify it *
  12  //*  under the terms of the GNU General Public License as published by the  *
  13  //*  Free Software Foundation; either version 2 of the License, or (at your *
  14  //*  option) any later version.                                             *
  15  //***************************************************************************
  16  ?>  ]]></sharedCode>
  17    <configs>
  18      <config>
  19        <wf_config_name>draw_select_next_user</wf_config_name>
  20        <wf_config_value></wf_config_value>
  21        <wf_config_value_int>1</wf_config_value_int>
  22      </config>
  23      <config>
  24        <wf_config_name>show_select_next_user</wf_config_name>
  25        <wf_config_value></wf_config_value>
  26        <wf_config_value_int>0</wf_config_value_int>
  27      </config>
  28      <config>
  29        <wf_config_name>display_please_wait_message</wf_config_name>
  30        <wf_config_value></wf_config_value>
  31        <wf_config_value_int>1</wf_config_value_int>
  32      </config>
  33      <config>
  34        <wf_config_name>use_automatic_parsing</wf_config_name>
  35        <wf_config_value></wf_config_value>
  36        <wf_config_value_int>1</wf_config_value_int>
  37      </config>
  38      <config>
  39        <wf_config_name>show_activity_title</wf_config_name>
  40        <wf_config_value></wf_config_value>
  41        <wf_config_value_int>1</wf_config_value_int>
  42      </config>
  43      <config>
  44        <wf_config_name>show_instance_name</wf_config_name>
  45        <wf_config_value></wf_config_value>
  46        <wf_config_value_int>1</wf_config_value_int>
  47      </config>
  48      <config>
  49        <wf_config_name>show_instance_owner</wf_config_name>
  50        <wf_config_value></wf_config_value>
  51        <wf_config_value_int>0</wf_config_value_int>
  52      </config>
  53      <config>
  54        <wf_config_name>show_multiple_submit_as_select</wf_config_name>
  55        <wf_config_value></wf_config_value>
  56        <wf_config_value_int>0</wf_config_value_int>
  57      </config>
  58      <config>
  59        <wf_config_name>show_activity_info_zone</wf_config_name>
  60        <wf_config_value></wf_config_value>
  61        <wf_config_value_int>1</wf_config_value_int>
  62      </config>
  63      <config>
  64        <wf_config_name>draw_roles</wf_config_name>
  65        <wf_config_value></wf_config_value>
  66        <wf_config_value_int>1</wf_config_value_int>
  67      </config>
  68      <config>
  69        <wf_config_name>font_size</wf_config_name>
  70        <wf_config_value></wf_config_value>
  71        <wf_config_value_int>10</wf_config_value_int>
  72      </config>
  73      <config>
  74        <wf_config_name>ownership_give_abort_right</wf_config_name>
  75        <wf_config_value></wf_config_value>
  76        <wf_config_value_int>0</wf_config_value_int>
  77      </config>
  78      <config>
  79        <wf_config_name>ownership_give_exception_right</wf_config_name>
  80        <wf_config_value></wf_config_value>
  81        <wf_config_value_int>0</wf_config_value_int>
  82      </config>
  83      <config>
  84        <wf_config_name>ownership_give_release_right</wf_config_name>
  85        <wf_config_value></wf_config_value>
  86        <wf_config_value_int>0</wf_config_value_int>
  87      </config>
  88      <config>
  89        <wf_config_name>role_give_abort_right</wf_config_name>
  90        <wf_config_value></wf_config_value>
  91        <wf_config_value_int>1</wf_config_value_int>
  92      </config>
  93      <config>
  94        <wf_config_name>role_give_release_right</wf_config_name>
  95        <wf_config_value></wf_config_value>
  96        <wf_config_value_int>1</wf_config_value_int>
  97      </config>
  98      <config>
  99        <wf_config_name>role_give_exception_right</wf_config_name>
 100        <wf_config_value></wf_config_value>
 101        <wf_config_value_int>1</wf_config_value_int>
 102      </config>
 103      <config>
 104        <wf_config_name>mail_smtp_profile</wf_config_name>
 105        <wf_config_value>default</wf_config_value>
 106        <wf_config_value_int></wf_config_value_int>
 107      </config>
 108      <config>
 109        <wf_config_name>mail_smtp_debug</wf_config_name>
 110        <wf_config_value></wf_config_value>
 111        <wf_config_value_int>1</wf_config_value_int>
 112      </config>
 113    </configs>
 114    <activities>
 115      <activity>
 116        <name>end</name>
 117        <type>end</type>
 118        <description>default end activity</description>
 119        <lastModif>19/11/2005 [12:57:35]</lastModif>
 120        <isInteractive>n</isInteractive>
 121        <isAutoRouted>y</isAutoRouted>
 122        <roles>
 123        </roles>
 124        <agents>
 125        </agents>
 126        <code><![CDATA[<?php
 127  ?>      ]]></code>    </activity>
 128      <activity>
 129        <name>Report</name>
 130        <type>standalone</type>
 131        <description>standalone activity used to make a report of the tests</description>
 132        <lastModif>19/11/2005 [12:57:35]</lastModif>
 133        <isInteractive>y</isInteractive>
 134        <isAutoRouted>n</isAutoRouted>
 135        <roles>
 136          <role>Role1</role>
 137        </roles>
 138        <agents>
 139        </agents>
 140        <code><![CDATA[<?php
 141  //! show all instances contained in the list to the table of instances
 142  function report_show_instances(&$mylist, &$template)
 143  {
 144    $template->set_block('template', 'block_instances_row', 'inst_row');
 145    foreach ($mylist as $inst)
 146    {
 147      $template->set_var(array(
 148                   'head_inst_name' => tra('inst. name'),
 149                   'head_inst_priority' => tra('inst. priority'),
 150                   'head_status' => tra('status'),
 151                   'head_act_name' => tra('act. name'),
 152                   'head_user' => tra('user'),
 153                   'instance_name' => $inst['insname'],
 154                   'instance_priority' => $inst['wf_priority'],
 155                   'instance_status' => $inst['wf_status'].'/'.$inst['wf_act_status'],
 156                   'activity_name' => $inst['wf_name'],
 157                   'user' => $inst['wf_user'],
 158                    ));
 159      $template->parse('inst_row', 'block_instances_row', true);
 160    }
 161  }
 162  
 163  //user commands   ****************
 164  $ActClose = get_var('ActClose','post',false);
 165  
 166  //--------------------------------------
 167  //
 168  // handling results from the form
 169  //
 170  //--------------------------------------
 171  
 172  if ($ActClose) 
 173  {
 174   $GLOBALS['workflow']['__leave_activity']=true;
 175  } 
 176  else 
 177  {
 178    //--------------------------------------
 179    //
 180    // showing the form
 181    //
 182    //--------------------------------------
 183  
 184    // we want to retrieve a list of all instances ordered by priority
 185    $sort_mode='wf_priority__desc';
 186    $wheres[] = '(gi.wf_p_id='.$GLOBALS['workflow']['wf_process_id'].')';
 187    $wheres[] = "(gi.wf_status<>'aborted')";
 188    $where = implode(' and ', $wheres);
 189    $inst_list = $this->GUI->gui_list_user_instances($GLOBALS['phpgw_info']['user']['account_id'], -1,-1, $sort_mode, '',$where);
 190    //_debug_array($inst_list['data']);
 191    report_show_instances($inst_list['data'], $this->wf_template);
 192  
 193    //Submit options we want
 194    //$this->submit_array['ActClose'] = lang('Close');
 195  }
 196  
 197  ?>      ]]></code>      <template><![CDATA[<!--******************** ROWS ********************* -->
 198  <table width="100%">
 199   <tr class="row_off">
 200     <td colspan="4">Here, with a standalone activity, we have a view on all instances for this process</td>
 201   </tr>
 202  <tr class="th">
 203      <td>{head_inst_priority}</td>
 204      <td>{head_inst_name}</td>
 205      <td>{head_status}</td>
 206      <td>{head_act_name}</td>
 207      <td>{head_user}</td>
 208    </tr>
 209  <!-- BEGIN block_instances_row -->
 210   <tr class="{row_class}">
 211      <td>{instance_priority}</td>
 212      <td>{instance_name}</td>
 213      <td>{instance_status}</td>
 214      <td>{activity_name}</td>
 215      <td>{user}</td>
 216    </tr>
 217  <!-- END block_instances_row -->
 218  </table>      ]]></template>    </activity>
 219      <activity>
 220        <name>Automatik</name>
 221        <type>activity</type>
 222        <description>non interactive auto-routed activity.
 223  add &quot;Tagged&quot; string at the end of PROPERTY_ONE and PROPERTY_TWO</description>
 224        <lastModif>19/11/2005 [12:57:35]</lastModif>
 225        <isInteractive>n</isInteractive>
 226        <isAutoRouted>y</isAutoRouted>
 227        <roles>
 228        </roles>
 229        <agents>
 230        </agents>
 231        <code><![CDATA[<?php
 232  ?>      ]]></code>    </activity>
 233      <activity>
 234        <name>After-Join</name>
 235        <type>activity</type>
 236        <description>Interactive activity after the join to check PROPERTY_ONE and PROPERTY_TWO values</description>
 237        <lastModif>19/11/2005 [12:57:35]</lastModif>
 238        <isInteractive>y</isInteractive>
 239        <isAutoRouted>y</isAutoRouted>
 240        <roles>
 241          <role>Role1</role>
 242        </roles>
 243        <agents>
 244        </agents>
 245        <code><![CDATA[<?php
 246  $array_vars = array(
 247      'PROPERTY_ONE' => '',
 248      'PROPERTY_TWO' => '',
 249      'EMPTY_ONE' => '',
 250      'EMPTY_TWO' => '',
 251      'EMPTY_COUNTER' => '',
 252      'BUZZ' => '',
 253  );
 254  
 255  //--------------------------------------
 256  //
 257  // handling data on the form
 258  //
 259  //--------------------------------------
 260  
 261  // init variables with POST and if POST is empty 
 262  // init with the property
 263  foreach ($array_vars as $prop => $value)
 264  {
 265    $array_vars[$prop] = get_var($prop,'any',$instance->get($prop));
 266  }
 267  //user commands   ****************
 268  $ActNextStage = get_var('ActNextStage','POST',false);
 269  $ActClose = get_var('ActClose','POST',false);
 270  $ActNothing = get_var('ActNothing', 'POST',false);
 271  $ActSleep = get_var('ActSleep', 'POST',false);
 272  
 273  //--------------------------------------
 274  //
 275  // handling results from the form
 276  //
 277  //--------------------------------------
 278  $leaveloop = false;
 279  
 280  if ($ActSleep)
 281  { 
 282    // to test the please wait message
 283    // waiting 30 seconds...
 284    sleep(30);
 285  }
 286  
 287  if (($ActNextStage) || ($ActClose)) 
 288  {
 289    // saving properties
 290    // if they changed
 291    $instance->setProperties($array_vars);
 292    if ($ActNextStage)
 293    {
 294       // going to next stage
 295       $leaveloop = $instance->complete();
 296    }
 297    elseif($ActClose)
 298    {
 299      $leaveloop = true;
 300      $GLOBALS['workflow']['__leave_activity']=true;
 301    } 
 302  } 
 303  if (!($leaveloop))
 304  {
 305    //--------------------------------------
 306    //
 307    // showing the form
 308    //
 309    //--------------------------------------
 310    foreach ($array_vars as $prop => $value) 
 311    {
 312      $template->set_var(array($prop => htmlspecialchars($array_vars[$prop])));
 313    }
 314    // submit options we want
 315    $this->submit_array['ActNextStage'] = lang('going to next stage');
 316    $this->submit_array['ActClose'] = lang('Close and get back later');
 317    $this->submit_array['ActSleep'] = lang('long loop for fun');
 318    $this->submit_array['ActNothing'] = lang('little loop');
 319    //special Cancel Value we wont get back here
 320    $this->submit_array['__Cancel'] = lang('Quit Without Saving');
 321    //special Print mode button
 322    $this->enable_print_mode = true;
 323    //priority levels we want
 324    $this->priority_array = array( 
 325          1 => lang('1 - low'),
 326          2 => lang('2 - medium'),
 327          3 => lang('3 - medium but better'),
 328          4 => lang('4 - high'),
 329    );
 330  }
 331  
 332  ?>      ]]></code>      <template><![CDATA[<table width="100%">
 333   <tr bgcolor="#DDDDDD">
 334      <td bgcolor="#EEEEEE" width="25%"> <div align="right">PROPERTY ONE&nbsp;:</td>
 335      <td bgcolor="#E8F0F0" width="25%"> <div align="left"><input type="text" name="PROPERTY_ONE" value="{PROPERTY_ONE}" size="38"></div></td>
 336      </td>
 337      <td bgcolor="#EEEEEE" width="25%"> <div align="right">PROPERTY TWO&nbsp;:</div></td>
 338      <td bgcolor="#E8F0F0" width="25%"> <div align="left"><input type="text" name="PROPERTY_TWO" value="{PROPERTY_TWO}" size="38"></div></td>
 339    </tr>
 340   <tr class="row_on">
 341      </td>
 342      <td> <div align="right">counter of empty PROPERTY ONE&nbsp;:</div></td>
 343      <td> <div align="left">{EMPTY_ONE}</div></td>
 344    </tr>
 345    <tr class="row_off">
 346      </td>
 347      <td> <div align="right">counter of empty PROPERTY TWO&nbsp;:</div></td>
 348      <td> <div align="left">{EMPTY_TWO}</div></td>
 349    </tr>  
 350    <tr class="row_on">
 351      </td>
 352      <td> <div align="right">counter of empty One or Two&nbsp;:</div></td>
 353      <td> <div align="left">{EMPTY_COUNTER}</div></td>
 354    </tr> 
 355    <tr class="row_off">
 356      </td>
 357      <td> <div align="right">The Buzz&nbsp;:</div></td>
 358      <td> <div align="left">{BUZZ}</div></td>
 359    </tr>  
 360   
 361  </table>      ]]></template>    </activity>
 362      <activity>
 363        <name>joiner</name>
 364        <type>join</type>
 365        <description>Join activities from left and right and then permits a send to  the end activity when both are Ok</description>
 366        <lastModif>19/11/2005 [12:57:35]</lastModif>
 367        <isInteractive>n</isInteractive>
 368        <isAutoRouted>n</isAutoRouted>
 369        <roles>
 370          <role>Role1</role>
 371          <role>Role3</role>
 372        </roles>
 373        <agents>
 374        </agents>
 375        <code><![CDATA[<?php
 376  ?>      ]]></code>    </activity>
 377      <activity>
 378        <name>right branch</name>
 379        <type>activity</type>
 380        <description>interactive activity on the right branch</description>
 381        <lastModif>19/11/2005 [12:57:35]</lastModif>
 382        <isInteractive>y</isInteractive>
 383        <isAutoRouted>y</isAutoRouted>
 384        <roles>
 385          <role>Role2</role>
 386        </roles>
 387        <agents>
 388          <agent>
 389             <agent_type>mail_smtp</agent_type>
 390             <agent_datas>
 391                 <agent_data>
 392                     <name>wf_to</name>
 393                     <value>%property_DEST%, %user%, Georges &amp;lt;gege@hotmail.com&amp;gt;</value>
 394                 </agent_data>
 395                 <agent_data>
 396                     <name>wf_cc</name>
 397                     <value>%roles%</value>
 398                 </agent_data>
 399                 <agent_data>
 400                     <name>wf_bcc</name>
 401                     <value></value>
 402                 </agent_data>
 403                 <agent_data>
 404                     <name>wf_from</name>
 405                     <value>Bernard &amp;lt;%user%&amp;gt;</value>
 406                 </agent_data>
 407                 <agent_data>
 408                     <name>wf_replyto</name>
 409                     <value>%user%</value>
 410                 </agent_data>
 411                 <agent_data>
 412                     <name>wf_subject</name>
 413                     <value>test</value>
 414                 </agent_data>
 415                 <agent_data>
 416                     <name>wf_message</name>
 417                     <value>test 1 
 418  mail sent from %activity_name% for instance %instance_name% (%instance_id%).
 419  </value>
 420                 </agent_data>
 421                 <agent_data>
 422                     <name>wf_send_mode</name>
 423                     <value>1</value>
 424                 </agent_data>
 425                 <agent_data>
 426                     <name>wf_agent_type</name>
 427                     <value>mail_smtp</value>
 428                 </agent_data>
 429             </agent_datas>
 430          </agent>
 431        </agents>
 432        <code><![CDATA[<?php
 433  $array_vars = array(
 434      'PROPERTY_ONE' => '',
 435      'PROPERTY_TWO' => '',
 436      'EMPTY_ONE' => '',
 437      'EMPTY_TWO' => '',
 438      'EMPTY_COUNTER' => '',
 439      'BUZZ' => '',
 440  );
 441  
 442  //--------------------------------------
 443  //
 444  // handling data on the form
 445  //
 446  //--------------------------------------
 447  
 448  // init variables with POST and if POST is empty 
 449  // init with the property
 450  foreach ($array_vars as $prop => $value)
 451  {
 452    $array_vars[$prop] = get_var($prop,'any',$instance->get($prop));
 453  }
 454  _debug_array($array_vars);
 455  //user commands   ****************
 456  $ActNextStage = get_var('ActNextStage','post',false);
 457  $ActClose = get_var('ActClose','post',false);
 458  $ActSave = get_var('ActSave','post',false);
 459  
 460  //--------------------------------------
 461  //
 462  // handling results from the form
 463  //
 464  //--------------------------------------
 465  $leaveloop = false;
 466  if (($ActNextStage) || ($ActClose)) 
 467  {
 468    // saving properties
 469    // if they changed
 470    foreach ($array_vars as $prop => $value)
 471    {
 472       if (($value === ($instance->get($prop))) ) 
 473       {
 474         $instance->set($prop,$value);
 475       }
 476    }
 477    if ($ActNextStage)
 478    {
 479       // going to next stage
 480       $leaveloop = $instance->complete();
 481    }
 482    elseif($ActClose)
 483    {
 484      $leaveloop = true;
 485      $GLOBALS['workflow']['__leave_activity']=true;
 486    } 
 487  } 
 488  if ($ActSave)
 489  {
 490    // saving properties
 491    // if they changed
 492    foreach ($array_vars as $prop => $value)
 493    {
 494      echo "<br> having $prop, was ".($instance->get($prop)). " is $value";
 495      if (!($value === ($instance->get($prop)) ))
 496      {
 497        echo " ...saving $prop to $value";
 498        $instance->set($prop,$value);
 499      }
 500    }
 501  }
 502  //showing the form if we are not leaving the loop
 503  if (!($leaveloop)) 
 504  {
 505    //--------------------------------------
 506    //
 507    // showing the form
 508    //
 509    //--------------------------------------
 510    foreach ($array_vars as $prop => $value) 
 511    {
 512      $template->set_var(array($prop => htmlspecialchars($array_vars[$prop])));
 513    }
 514  
 515    //we want to display the owner
 516    $this->display_owner = 1;
 517    //we want to display the next_user
 518    $this->display_next_user =1;
 519    // submit options we want
 520    $this->submit_array['ActNextStage'] = lang('going to next stage');
 521    $this->submit_array['ActClose'] = lang('Close and get back later');
 522    //special Cancel Value we wont get back here
 523    $this->submit_array['__Cancel'] = lang('Quit Without Saving');
 524    //A Save Button keeping on the form
 525    $this->submit_array['ActSave'] = lang('Save and stay on form');
 526    //special Print mode button
 527    $this->enable_print_mode = true;
 528    //priority levels we want
 529    $this->priority_array = array( 
 530          1 => lang('1 - low'),
 531          2 => lang('2 - medium'),
 532          3 => lang('3 - medium but better'),
 533          4 => lang('4 - high'),
 534          );
 535  }
 536  
 537  ?>      ]]></code>      <template><![CDATA[<!--******************** PROPERTIES ********************* -->
 538  <table width="100%">
 539   <tr class="th">
 540     <td colspan="2">Here we are in the 'right branch' activity, we can change properties if we want</td>
 541   </tr>
 542   <tr class="row_on">
 543      <td> <div align="right">PROPERTY ONE&nbsp;:</td>
 544      <td> <div align="left"><input type="text" name="PROPERTY_ONE" value="{PROPERTY_ONE}" size="38"></div></td>
 545    </tr>
 546    <tr class="row_off">
 547      </td>
 548      <td> <div align="right">PROPERTY TWO&nbsp;:</div></td>
 549      <td> <div align="left"><input type="text" name="PROPERTY_TWO" value="{PROPERTY_TWO}" size="38"></div></td>
 550    </tr> 
 551    <tr class="row_on">
 552      </td>
 553      <td> <div align="right">counter of empty PROPERTY ONE&nbsp;:</div></td>
 554      <td> <div align="left">{EMPTY_ONE}</div></td>
 555    </tr>
 556    <tr class="row_off">
 557      </td>
 558      <td> <div align="right">counter of empty PROPERTY TWO&nbsp;:</div></td>
 559      <td> <div align="left">{EMPTY_TWO}</div></td>
 560    </tr>  
 561    <tr class="row_on">
 562      </td>
 563      <td> <div align="right">counter of empty One or Two&nbsp;:</div></td>
 564      <td> <div align="left">{EMPTY_COUNTER}</div></td>
 565    </tr> 
 566    <tr class="row_off">
 567      </td>
 568      <td> <div align="right">the BUZZ property&nbsp;:</div></td>
 569      <td> <div align="left"><input type="text" name="BUZZ" value="{BUZZ}" size="38"></div></td>
 570    </tr> 
 571   
 572  </table>      ]]></template>    </activity>
 573      <activity>
 574        <name>Switch 1</name>
 575        <type>switch</type>
 576        <description>This automatic switch will decide which way he will take by looking at PROPERTY_ONE. If this property is empty it will go t the Empty_one, else it goes to the joiner</description>
 577        <lastModif>19/11/2005 [12:57:35]</lastModif>
 578        <isInteractive>n</isInteractive>
 579        <isAutoRouted>y</isAutoRouted>
 580        <roles>
 581        </roles>
 582        <agents>
 583        </agents>
 584        <code><![CDATA[<?php
 585   $choose = $instance->get('PROPERTY_ONE');
 586   if (empty($choose))
 587   {
 588      if (!($instance->setNextActivity('Empty One')))
 589      {
 590        $instance->setNextActivity('joiner');
 591      }
 592   }
 593   else
 594   {
 595     $instance->setNextActivity('joiner');
 596   }
 597  ?>      ]]></code>    </activity>
 598      <activity>
 599        <name>lonely branch 1</name>
 600        <type>activity</type>
 601        <description>another automatic activity somewhere</description>
 602        <lastModif>19/11/2005 [12:57:35]</lastModif>
 603        <isInteractive>n</isInteractive>
 604        <isAutoRouted>y</isAutoRouted>
 605        <roles>
 606        </roles>
 607        <agents>
 608        </agents>
 609        <code><![CDATA[<?php
 610  ?>      ]]></code>    </activity>
 611      <activity>
 612        <name>Lonely branch II</name>
 613        <type>activity</type>
 614        <description>yet another automatic lonely branch but this one need to be send manually</description>
 615        <lastModif>19/11/2005 [12:57:35]</lastModif>
 616        <isInteractive>n</isInteractive>
 617        <isAutoRouted>n</isAutoRouted>
 618        <roles>
 619          <role>Role1</role>
 620        </roles>
 621        <agents>
 622        </agents>
 623        <code><![CDATA[<?php
 624  ?>      ]]></code>    </activity>
 625      <activity>
 626        <name>Switch2</name>
 627        <type>switch</type>
 628        <description>A second automatic switch.
 629  It decide which branch to choose by looking at PROPERTY_TWO.
 630  If the property is empty it take the instance to Empty Two, else it goes to the joiner</description>
 631        <lastModif>19/11/2005 [12:57:35]</lastModif>
 632        <isInteractive>n</isInteractive>
 633        <isAutoRouted>y</isAutoRouted>
 634        <roles>
 635        </roles>
 636        <agents>
 637        </agents>
 638        <code><![CDATA[<?php
 639   $choose = $instance->get('PROPERTY_TWO');
 640   if (empty($choose))
 641   {
 642      if (!($instance->setNextActivity('Empty Two')))
 643      {
 644        $instance->setNextActivity('joiner');
 645      }
 646   }
 647   else
 648   {
 649     $instance->setNextActivity('joiner');
 650   }
 651  ?>      ]]></code>    </activity>
 652      <activity>
 653        <name>Empty Counter</name>
 654        <type>activity</type>
 655        <description>This automatic activity records a counter named EMPTY_COUNTER to remember how many times he has been launched for a given instance</description>
 656        <lastModif>19/11/2005 [12:57:35]</lastModif>
 657        <isInteractive>n</isInteractive>
 658        <isAutoRouted>y</isAutoRouted>
 659        <roles>
 660        </roles>
 661        <agents>
 662        </agents>
 663        <code><![CDATA[<?php
 664   $counter = $instance->get('EMPTY_COUNTER');
 665  echo "<br> counter is actually:".$counter;
 666   $counter++;
 667  echo "<br> now is set it to:".$counter;
 668   $instance->set('EMPTY_COUNTER',$counter);
 669  ?>      ]]></code>    </activity>
 670      <activity>
 671        <name>splitter2</name>
 672        <type>split</type>
 673        <description>second splitter after the first one</description>
 674        <lastModif>19/11/2005 [12:57:35]</lastModif>
 675        <isInteractive>n</isInteractive>
 676        <isAutoRouted>y</isAutoRouted>
 677        <roles>
 678        </roles>
 679        <agents>
 680        </agents>
 681        <code><![CDATA[<?php
 682  ?>      ]]></code>    </activity>
 683      <activity>
 684        <name>splitter</name>
 685        <type>split</type>
 686        <description>splitt the workflow in 2 branches</description>
 687        <lastModif>19/11/2005 [12:57:35]</lastModif>
 688        <isInteractive>n</isInteractive>
 689        <isAutoRouted>y</isAutoRouted>
 690        <roles>
 691        </roles>
 692        <agents>
 693        </agents>
 694        <code><![CDATA[<?php
 695  ?>      ]]></code>    </activity>
 696      <activity>
 697        <name>Empty One</name>
 698        <type>activity</type>
 699        <description>This automatic activity does nothing but is there to test if someone goes there when PROPERTY_ONE is empty.
 700  </description>
 701        <lastModif>19/11/2005 [12:57:35]</lastModif>
 702        <isInteractive>n</isInteractive>
 703        <isAutoRouted>y</isAutoRouted>
 704        <roles>
 705        </roles>
 706        <agents>
 707        </agents>
 708        <code><![CDATA[<?php
 709   $counter = $instance->get('EMPTY_ONE');
 710   $counter++;
 711   $instance->set('EMPTY_ONE',$counter);
 712  ?>      ]]></code>    </activity>
 713      <activity>
 714        <name>Empty Two</name>
 715        <type>activity</type>
 716        <description>This automatic activity does nothing but is there to test if someone goes there when PROPERTY_TWO is empty.</description>
 717        <lastModif>19/11/2005 [12:57:35]</lastModif>
 718        <isInteractive>n</isInteractive>
 719        <isAutoRouted>y</isAutoRouted>
 720        <roles>
 721        </roles>
 722        <agents>
 723        </agents>
 724        <code><![CDATA[<?php
 725   $counter = $instance->get('EMPTY_TWO');
 726   $counter++;
 727   $instance->set('EMPTY_TWO',$counter);
 728  ?>      ]]></code>    </activity>
 729      <activity>
 730        <name>left branch</name>
 731        <type>activity</type>
 732        <description>interactive form activity on the left branch.
 733  contains a test on changing the owner.
 734  After Left branch is finished we rerun splitter2, giving a new Right branch for the instance. This make a second right branch!</description>
 735        <lastModif>19/11/2005 [12:57:35]</lastModif>
 736        <isInteractive>y</isInteractive>
 737        <isAutoRouted>y</isAutoRouted>
 738        <roles>
 739          <role>Role1</role>
 740        </roles>
 741        <agents>
 742        </agents>
 743        <code><![CDATA[<?php
 744  $array_vars = array(
 745      'PROPERTY_ONE' => '',
 746      'PROPERTY_TWO' => '',
 747      'EMPTY_ONE' => '',
 748      'EMPTY_TWO' => '',
 749      'EMPTY_COUNTER' => '',
 750      'BUZZ' => '',
 751  );
 752  
 753  //--------------------------------------
 754  //
 755  // handling data on the form
 756  //
 757  //--------------------------------------
 758  
 759  // init variables with POST and if POST is empty 
 760  // init with the property
 761  foreach ($array_vars as $prop => $value)
 762  {
 763    $array_vars[$prop] = get_var($prop,'any',$instance->get($prop));
 764  }
 765  //user commands   ****************
 766  $ActNextStage = get_var('ActNextStage','post',false);
 767  $ActClose = get_var('ActClose','post',false);
 768  
 769  //--------------------------------------
 770  //
 771  // handling results from the form
 772  //
 773  //--------------------------------------
 774  $leaveloop = false;
 775  if (($ActNextStage) || ($ActClose)) 
 776  {
 777    // saving properties
 778    // if they changed
 779    $instance->setProperties($array_vars);
 780    if ($ActNextStage)
 781    {
 782       // going to next stage
 783       $leaveloop = $instance->complete();
 784    }
 785    elseif($ActClose)
 786    {
 787      $leaveloop = true;
 788      $GLOBALS['workflow']['__leave_activity']=true;
 789    } 
 790  } 
 791  if (!($leaveloop))
 792  {
 793    //--------------------------------------
 794    //
 795    // showing the form
 796    //
 797    //--------------------------------------
 798    foreach ($array_vars as $prop => $value) 
 799    {
 800      $template->set_var(array($prop => htmlspecialchars($array_vars[$prop])));
 801    }
 802    //we want to diplay the owner as well, and as a select
 803    //avaible users are people from Role1 and Role2 which have access to joiner
 804    //BUT if you have an user in Role3 which is in Role2 as well he wont be there
 805    //he would be there as a Role2 which is not allowed, you need the Role3 for it.
 806    $this->display_owner = array(
 807        'role' => array('Role1','Role2'),
 808        'activity' => 'joiner',
 809    );
 810    //we want to select the next user for the Join sending
 811    $this->display_next_user = array(
 812      'activity' => 'joiner',
 813    );
 814    // submit options we want
 815    $this->submit_array['ActNextStage'] = lang('going to next stage');
 816    $this->submit_array['ActClose'] = lang('Close and get back later');
 817    //special Cancel Value we wont get back here
 818    $this->submit_array['__Cancel'] = lang('Quit Without Saving');
 819    //special Print mode button
 820    $this->enable_print_mode = true;
 821    //priority levels we want
 822    $this->priority_array = array( 1 => lang('1 - low'),
 823          2 => lang('2 - medium'),
 824          3 => lang('3 - medium but better'),
 825          4 => lang('4 - high'),
 826    );
 827  }
 828  
 829  ?>      ]]></code>      <template><![CDATA[<!--******************** PROPERTIES ********************* -->
 830  <table width="100%">
 831   <tr class="th">
 832     <td colspan="2">Here we are in the 'left branch' activity, we can change properties if we want</td>
 833   </tr>
 834   <tr class="row_on">
 835      <td> <div align="right">PROPERTY ONE&nbsp;:</td>
 836      <td> <div align="left"><input type="text" name="PROPERTY_ONE" value="{PROPERTY_ONE}" size="38"></div></td>
 837    </tr>
 838    <tr class="row_off">
 839      </td>
 840      <td> <div align="right">PROPERTY TWO&nbsp;:</div></td>
 841      <td> <div align="left"><input type="text" name="PROPERTY_TWO" value="{PROPERTY_TWO}" size="38"></div></td>
 842    </tr>
 843   <tr class="row_on">
 844      </td>
 845      <td> <div align="right">counter of empty PROPERTY ONE&nbsp;:</div></td>
 846      <td> <div align="left">{EMPTY_ONE}</div></td>
 847    </tr>
 848    <tr class="row_off">
 849      </td>
 850      <td> <div align="right">counter of empty PROPERTY TWO&nbsp;:</div></td>
 851      <td> <div align="left">{EMPTY_TWO}</div></td>
 852    </tr>  
 853    <tr class="row_on">
 854      </td>
 855      <td> <div align="right">counter of empty One or Two&nbsp;:</div></td>
 856      <td> <div align="left">{EMPTY_COUNTER}</div></td>
 857    </tr>
 858    <tr class="row_off">
 859      </td>
 860      <td> <div align="right">The BUZZ property in a textarea&nbsp;:</div></td>
 861      <td> <textarea>{BUZZ}</textarea></td>
 862    </tr>  
 863  </table>      ]]></template>    </activity>
 864      <activity>
 865        <name>auto logger</name>
 866        <type>activity</type>
 867        <description>log some infos about the state of this process after the start</description>
 868        <lastModif>19/11/2005 [12:57:35]</lastModif>
 869        <isInteractive>n</isInteractive>
 870        <isAutoRouted>y</isAutoRouted>
 871        <roles>
 872        </roles>
 873        <agents>
 874        </agents>
 875        <code><![CDATA[<?php
 876  // saving some properties to retain the state we have just after starting
 877  $value = $instance->getName();
 878  $instance->set('auto_logger_NAME_START',$value);
 879  $value = $instance->getPriority();
 880  $instance->set('auto_logger_PRIORITY_START',$value);
 881  $instance->set('auto_logger_USER_START',$GLOBALS['user']);
 882  
 883  //Setting the default values for the properties we will use later
 884  $init = array(
 885      'PROPERTY_ONE' => 0,
 886      'PROPERTY_TWO' => 0,
 887      'EMPTY_ONE' => 0,
 888      'EMPTY_TWO' => 0,
 889      'EMPTY_COUNTER' => 0,
 890      'BUZZ' => ' here is a quote " double single '."'' escaped \'".' escaped slash \\ and escaped quote\", trying to end an input zone "> and trying to end a textarea </textarea> as well.',
 891  );
 892  $instance->setProperties($init);
 893  ?>      ]]></code>    </activity>
 894      <activity>
 895        <name>start the test</name>
 896        <type>start</type>
 897        <description>start activity for this test</description>
 898        <lastModif>19/11/2005 [12:57:34]</lastModif>
 899        <isInteractive>y</isInteractive>
 900        <isAutoRouted>y</isAutoRouted>
 901        <roles>
 902          <role>Role1</role>
 903          <role>Role3</role>
 904        </roles>
 905        <agents>
 906        </agents>
 907        <code><![CDATA[<?php
 908  
 909  // retrieve submit options ****************
 910  $ActNextStage = get_var('ActNextStage','post',false);
 911  
 912  //--------------------------------------
 913  //
 914  // handling results from the form
 915  //
 916  //--------------------------------------
 917  $leaveloop = false;
 918  if ($ActNextStage) 
 919  {
 920       // going to next stage
 921       $leaveloop = $instance->complete();
 922       // the 'wf_name' and 'wf_priority' special properties are saved in
 923       // start_pos.php when completing
 924  } 
 925  if (!$leaveloop)
 926  {
 927    //--------------------------------------
 928    //
 929    // let's run_activity show the form
 930    //
 931    //--------------------------------------
 932     // submit options we want
 933     $this->submit_array['ActNextStage'] = lang('Create this instance');
 934     //Special cancel value
 935     $this->submit_array['__Cancel'] = lang('Cancel');
 936     //priority levels we want
 937     $this->priority_array = array( 
 938          1 => lang('1 - low'),
 939          2 => lang('2 - medium'),
 940          3 => lang('3 - medium but better'),
 941          4 => lang('4 - high'),
 942          );
 943    // we want to select the owner 
 944    //(0:empty,1:display,2:select all people having a role on the process)
 945    // could be an array as well to define other values, see left branch
 946    $this->display_owner = 2;
 947    // we want to select the next user
 948    //(0:empty,1:display,2:select all people having a role on the process)
 949    // could be an array as well to define other values, see left branch
 950    $this->display_next_user = 2;
 951  }
 952  ?>      ]]></code>      <template><![CDATA[<!--******************** SPECIAL START PROPERTIES ********************* -->
 953  <table width="100%">
 954   <tr class="th">
 955      <td colspan="2">this activity will begin a new test process, an instance will be created</td>
 956   </tr>
 957   <tr class="row_on">
 958      <td> enter here a name for this test instance:</td>
 959      <td> <input type="text" name="wf_name" value=""</td>
 960    </tr>
 961  
 962  </table>      ]]></template>    </activity>
 963    </activities>
 964    <transitions>
 965       <transition>
 966         <from>start the test</from>
 967         <to>auto logger</to>
 968       </transition>
 969       <transition>
 970         <from>auto logger</from>
 971         <to>splitter</to>
 972       </transition>
 973       <transition>
 974         <from>left branch</from>
 975         <to>splitter2</to>
 976       </transition>
 977       <transition>
 978         <from>splitter</from>
 979         <to>left branch</to>
 980       </transition>
 981       <transition>
 982         <from>splitter2</from>
 983         <to>Switch 1</to>
 984       </transition>
 985       <transition>
 986         <from>splitter</from>
 987         <to>splitter2</to>
 988       </transition>
 989       <transition>
 990         <from>splitter2</from>
 991         <to>right branch</to>
 992       </transition>
 993       <transition>
 994         <from>splitter</from>
 995         <to>lonely branch 1</to>
 996       </transition>
 997       <transition>
 998         <from>splitter2</from>
 999         <to>Lonely branch II</to>
1000       </transition>
1001       <transition>
1002         <from>splitter2</from>
1003         <to>Switch2</to>
1004       </transition>
1005       <transition>
1006         <from>Empty One</from>
1007         <to>Empty Counter</to>
1008       </transition>
1009       <transition>
1010         <from>Empty Two</from>
1011         <to>Empty Counter</to>
1012       </transition>
1013       <transition>
1014         <from>right branch</from>
1015         <to>joiner</to>
1016       </transition>
1017       <transition>
1018         <from>Switch 1</from>
1019         <to>joiner</to>
1020       </transition>
1021       <transition>
1022         <from>lonely branch 1</from>
1023         <to>joiner</to>
1024       </transition>
1025       <transition>
1026         <from>Lonely branch II</from>
1027         <to>joiner</to>
1028       </transition>
1029       <transition>
1030         <from>Switch 1</from>
1031         <to>Empty One</to>
1032       </transition>
1033       <transition>
1034         <from>Switch2</from>
1035         <to>joiner</to>
1036       </transition>
1037       <transition>
1038         <from>Empty Counter</from>
1039         <to>joiner</to>
1040       </transition>
1041       <transition>
1042         <from>Switch2</from>
1043         <to>Empty Two</to>
1044       </transition>
1045       <transition>
1046         <from>joiner</from>
1047         <to>After-Join</to>
1048       </transition>
1049       <transition>
1050         <from>After-Join</from>
1051         <to>Automatik</to>
1052       </transition>
1053       <transition>
1054         <from>Automatik</from>
1055         <to>end</to>
1056       </transition>
1057    </transitions>
1058  </process>


Généré le : Sun Feb 25 17:20:01 2007 par Balluche grâce à PHPXref 0.7