Squiz Matrix  4.12.2
 All Data Structures Namespaces Functions Variables Pages
hipo_job_clone_assets.inc
1 <?php
17 require_once SQ_SYSTEM_ROOT.'/core/hipo/hipo_job.inc';
18 
30 {
31 
32 
38  function HIPO_Job_Clone_Assets($code_name='')
39  {
40  $this->HIPO_Job($code_name);
41 
42  }//end constructor
43 
44 
54  public static function paintConfig(&$o, $class, $write_access)
55  {
56  // metadata regeneration threshhold HIPO config entry
57  $o->openField(translate('clone_asset_threshold'));
58 
59  if ($write_access) {
60  text_box($class.'[SQ_DUPE_ASSET_THRESHOLD]',SQ_DUPE_ASSET_THRESHOLD, 5);
61  } else {
62  echo SQ_DUPE_ASSET_THRESHOLD;
63  }
64  echo ' '.translate('assets');
65 
66  $o->closeField();
67 
68  }//end paintConfig()
69 
70 
77  public static function getConfigVars()
78  {
79  return Array(
80  'SQ_DUPE_ASSET_THRESHOLD' => Array('editable' => 1, 'default' => 1),
81  );
82 
83  }//end getConfigVars()
84 
85 
97  function getCodeName()
98  {
99  return parent::getCodeName().'-'.md5(implode('-',array_keys($this->_running_vars['assets'])));
100 
101  }//end getCodeName()
102 
103 
110  function getHipoName()
111  {
112  return translate('hipo_name_clone_assets');
113 
114  }//end getHipoName()
115 
116 
125  {
126  return Array(
127  Array(
128  'name' => translate('hipo_clone_options'),
129  'function_call' => Array(
130  'paint_function' => 'paintCloneOptions',
131  'process_function' => 'processCloneOptions',
132  ),
133  'running_mode' => 'web',
134  'skip_step' => FALSE,
135  'auto_step' => FALSE,
136  'allow_cancel' => TRUE,
137  'percent_done' => 0,
138  'complete' => FALSE,
139  'message' => '',
140  ),
141  Array(
142  'name' => translate('hipo_acquiring_locks'),
143  'hipo_job' => Array(
144  'init_details_function' => 'getLockAssetDetails',
145  ),
146  'running_mode' => 'server',
147  'auto_step' => TRUE,
148  'allow_cancel' => FALSE,
149  'percent_done' => 0,
150  'complete' => FALSE,
151  'message' => '',
152  ),
153  Array(
154  'name' => translate('hipo_cloning_assets'),
155  'function_call' => Array(
156  'process_function' => 'processCloneAssets',
157  ),
158  'running_mode' => 'server',
159  'skip_step' => FALSE,
160  'auto_step' => TRUE,
161  'allow_cancel' => TRUE,
162  'percent_done' => 0,
163  'complete' => FALSE,
164  'message' => '',
165  ),
166  Array(
167  'name' => translate('hipo_remapping_assets'),
168  'function_call' => Array(
169  'process_function' => 'processRemap',
170  ),
171  'running_mode' => 'server',
172  'skip_step' => FALSE,
173  'auto_step' => TRUE,
174  'allow_cancel' => FALSE,
175  'percent_done' => 0,
176  'complete' => FALSE,
177  'message' => '',
178  ),
179  Array(
180  'name' => translate('hipo_releasing_locks'),
181  'function_call' => Array(
182  'process_function' => 'releaseLocks',
183  ),
184  'running_mode' => 'server',
185  'auto_step' => TRUE,
186  'skip_step' => FALSE,
187  'allow_cancel' => FALSE,
188  'percent_done' => 0,
189  'complete' => FALSE,
190  'message' => '',
191  ),
192  Array(
193  'name' => translate('hipo_refreshing_asset_map'),
194  'function_call' => Array(
195  'paint_function' => 'paintRefresh',
196  'process_function' => 'processRefresh',
197  ),
198  'running_mode' => 'web',
199  'auto_step' => TRUE,
200  'skip_step' => FALSE,
201  'allow_cancel' => FALSE,
202  'percent_done' => 0,
203  'complete' => FALSE,
204  'message' => '',
205  ),
206  );
207 
208  }//end getInitialStepData()
209 
210 
221  {
222  if (SQ_DUPE_ASSET_THRESHOLD == 0) return 0;
223  if (!isset($this->_running_vars['todo_assetids'])) {
224  return 0;
225  }
226  return ((count($this->_running_vars['todo_assetids']) / SQ_DUPE_ASSET_THRESHOLD) * 100);
227 
228  }//end getThresholdPercentageRequired()
229 
230 
237  function freestyle()
238  {
239  $hh = $GLOBALS['SQ_SYSTEM']->getHipoHerder();
240  $step_data = Array();
241 
242  // skip the confirmation screen, go straight into locking
243  $job_type = '';
244  $running_vars = Array();
245  $options = '';
246  $this->getLockAssetDetails($job_type, $running_vars, $options);
247  $errors = $hh->freestyleHipo($job_type, $running_vars);
248  if (!empty($errors)) {
249  $this->_addError('acquiring locks failed');
250  return FALSE;
251  }
252 
253  $success = TRUE;
254 
255  // clone assets
256  if ($success && !$this->processCloneAssets($step_data, '')) {
257  $this->_addError('clone assets failed');
258  $success = FALSE;
259  }
260 
261  // handle remaps
262  if ($success && !$this->processRemap($step_data, '')) {
263  $this->_addError('remap failed');
264  $success = FALSE;
265  }
266 
267 
268  // unlock assets - release locks regardless of previous non-lock-related failures
269  if (!$this->releaseLocks($step_data, '')) {
270  $this->_addError('releasing locks failed');
271  return FALSE;
272  }
273 
274  return TRUE;
275 
276  }//end freestyle()
277 
278 
285  function prepare()
286  {
287  // there must be assets in the _running_vars to clone
288  if (empty($this->_running_vars['assets'])) {
289  trigger_localised_error('HIPO0031', E_USER_WARNING);
290  return FALSE;
291  }
292 
293  foreach ($this->_running_vars['assets'] as $assetid => $info) {
294  $id_parts = explode(':', $assetid);
295  if (isset($id_parts[1])) {
296  trigger_localised_error('HIPO0084', E_USER_WARNING, $assetid);
297  return FALSE;
298  }
299  }
300 
301  $this->_running_vars['remap'] = Array();
302 
303  return parent::prepare();
304 
305  }//end prepare()
306 
307 
318  function getLockAssetDetails(&$job_type, &$running_vars, &$options)
319  {
320  $job_type = 'hipo_job_acquire_locks';
321 
322  $options['auto_complete'] = TRUE;
323 
324  $running_vars = Array(
325  'assetids' => array_keys($this->_running_vars['assets']),
326  'lock_type' => Array('all'),
327  'forceably_acquire' => FALSE,
328  'dependants_only' => TRUE,
329  );
330 
331  }//end getLockAssetDetails()
332 
333 
343  function releaseLocks(&$step_data, $prefix)
344  {
345  if (!isset($this->_running_vars['re_lock_assets'])) {
346  $this->_running_vars['re_lock_assets'] = $this->_running_vars['assets'];
347  }
348 
349  $assetid = key($this->_running_vars['re_lock_assets']);
350  unset($this->_running_vars['re_lock_assets'][$assetid]);
351 
352  $children = $GLOBALS['SQ_SYSTEM']->am->getDependantChildren($assetid);
353 
354  foreach ($children as $dep_child_id => $dep_child_data) {
355  $GLOBALS['SQ_SYSTEM']->am->releaseLock($dep_child_id, 'all');
356  }
357 
358  $asset_info = $GLOBALS['SQ_SYSTEM']->am->getAssetInfo(Array($assetid));
359 
360  $step_data['message'] = translate('hipo_release_locks', $asset_info[$assetid]['name']).translate('hipo_release_locks_dependents');
361 
362  $GLOBALS['SQ_SYSTEM']->am->releaseLock($assetid, 'all');
363 
364  $this->_running_vars['done_assetids'][] = $assetid;
365 
366  if (empty($this->_running_vars['re_lock_assets'])) {
367  unset($this->_running_vars['done_assetids']);
368  $step_data['percent_done'] = 100;
369  $step_data['complete'] = TRUE;
370  } else {
371  $step_data['percent_done'] = (count($this->_running_vars['done_assetids']) / count($this->_running_vars['assets'])) * 100;
372  $step_data['complete'] = FALSE;
373  }
374 
375  return TRUE;
376 
377  }//end releaseLocks()
378 
379 
393  function paintCloneOptions(&$step_data, &$o, $prefix)
394  {
395  $to_parent = $GLOBALS['SQ_SYSTEM']->am->getAsset($this->_running_vars['to_parent_assetid']);
396 
397  $o->openSection(translate('cloning_confirmation'));
398  $o->openField(translate('confirm'));
399  $o->addHiddenField('form_submitted', 1);
400  ?>
401  <p><?php echo translate('hipo_cloning_confirm', htmlentities($to_parent->name, ENT_COMPAT, SQ_CONF_DEFAULT_CHARACTER_SET)); ?></p>
402  <ul>
403  <?php
404  $assets = $this->_running_vars['assets'];
405  for (reset($assets); NULL !== ($assetid = key($assets)); next($assets)) {
406  $asset_info = $GLOBALS['SQ_SYSTEM']->am->getAssetInfo(Array($assetid));
407  ?><li>"<?php echo htmlentities($asset_info[$assetid]['short_name'], ENT_COMPAT, SQ_CONF_DEFAULT_CHARACTER_SET); ?>"</li><?php
408  }
409  ?>
410  </ul>
411  </p>
412  <p><!-- Show the change name dialog -->
413  <script type="text/javascript">
414  <!--
415  function toggleChangeName() {
416  toggleBox = document.getElementById('<?php echo $prefix; ?>_change_name');
417  renamedialog = document.getElementById('<?php echo $prefix; ?>_rename_assets');
418  if (toggleBox.checked == true) {
419  renamedialog.style.visibility = "visible";
420  renamedialog.style.display = "block";
421  } else {
422  renamedialog.style.visibility = "hidden";
423  renamedialog.style.display = "none";
424  }
425  }
426  -->
427  </script>
428  <input type="checkbox" id="<?php echo $prefix; ?>_change_name" name="<?php echo $prefix; ?>_change_name" onclick="toggleChangeName();">
429  <label for="<?php echo $prefix; ?>_change_name">(Optionally) Change the name of the cloned assets</label>
430  <div id="<?php echo $prefix; ?>_rename_assets" style="display:none;visibility:hidden;">
431  <ul><table>
432  <?php
433  require_once(SQ_LIB_PATH.'/html_form/html_form.inc');
434  $assets = $this->_running_vars['assets'];
435  for (reset($assets); NULL !== ($assetid = key($assets)); next($assets)) {
436  $asset_info = $GLOBALS['SQ_SYSTEM']->am->getAssetInfo(Array($assetid));
437  ?>
438  <tr>
439  <td><li>Change from</li></td>
440  <td>"<?php echo htmlentities($asset_info[$assetid]['short_name'], ENT_COMPAT, SQ_CONF_DEFAULT_CHARACTER_SET); ?>"</td>
441  <td> to </td>
442  <td><?php text_box($prefix.'_new_names['.$assetid.']', $asset_info[$assetid]['short_name'], '25'); ?></td>
443  </tr>
444  <?php
445  }//end for
446  ?>
447  </table>
448  </ul>
449  </div>
450  </p>
451  <p><?php echo translate('hipo_confirm_abort');?></p>
452  <?php
453  $o->closeField();
454  $o->closeSection();
455 
456  }//end paintCloneOptions()
457 
458 
468  function processCloneOptions(&$step_data, $prefix)
469  {
470  if (isset($_POST['form_submitted'])) {
471  // Shortcut, if name change ticked change the names
472  if (isset($_POST[$prefix.'_change_name']) && $_POST[$prefix.'_change_name']) {
473  foreach ($_POST[$prefix.'_new_names'] as $assetid => $name) {
474  if (!empty($name)) {
475  $this->_running_vars['assets'][$assetid]['new_name'] = $name;
476  }
477  }
478  }//end if
479  }//end if
480 
481  if ($step_data['percent_done'] == 0) {
482  $step_data['percent_done'] = 50;
483  } else {
484  $step_data['percent_done'] = 100;
485  $step_data['complete'] = TRUE;
486  }
487 
488  return TRUE;
489 
490  }//end processCloneOptions()
491 
492 
502  function processCloneAssets(&$step_data, $prefix)
503  {
504  if (!isset($this->_running_vars['clone_assets'])) {
505  $this->_running_vars['clone_assets'] = $this->_running_vars['assets'];
506  $this->_running_vars['done_asset_count'] = 0;
507  $this->_running_vars['todo_asset_count'] = 0;
508  foreach ($this->_running_vars['clone_assets'] as $info) {
509  $this->_running_vars['todo_asset_count'] += array_get_index($info, 'number_of_clones', 1);
510  }
511  reset($this->_running_vars['clone_assets']);
512  }
513 
514  $assetid = key($this->_running_vars['clone_assets']);
515 
516  $parent_asset = $GLOBALS['SQ_SYSTEM']->am->getAsset($this->_running_vars['to_parent_assetid']);
517 
518  if (is_null($parent_asset)) {
519  trigger_localised_error('HIPO0030', E_USER_WARNING, $this->_running_vars['to_parent_assetid']);
520  return FALSE;
521  }
522 
523  $orig = $GLOBALS['SQ_SYSTEM']->am->getAsset($assetid);
524 
525  if (is_null($orig)) {
526  trigger_localised_error('HIPO0029', E_USER_WARNING, $assetid);
527  return FALSE;
528  }
529 
530  $link = Array(
531  'asset' => $parent_asset,
532  'sort_order' => $this->_running_vars['to_parent_pos'],
533  'value' => '',
534  );
535  if (!isset($this->_running_vars['link_type'])) {
536  $orig_link = $GLOBALS['SQ_SYSTEM']->am->getLinkByAsset($this->_running_vars['clone_assets'][$assetid]['parentid'], $orig->id, SQ_LINK_TYPE_1 | SQ_LINK_TYPE_2 | SQ_LINK_TYPE_3);
537  $link['link_type'] = $orig_link['link_type'];
538  } else {
539  $link['link_type'] = $this->_running_vars['link_type'];
540  }
541 
542  if (!isset($this->_running_vars['value'])) {
543  if (empty($orig_link)) {
544  $orig_link = $GLOBALS['SQ_SYSTEM']->am->getLinkByAsset($this->_running_vars['clone_assets'][$assetid]['parentid'], $orig->id, SQ_LINK_TYPE_1 | SQ_LINK_TYPE_2 | SQ_LINK_TYPE_3);
545  }//end if
546  $link['value'] = $orig_link['value'];
547  } else {
548  $link['value'] = $this->_running_vars['value'];
549  }
550 
551  if ($this->_running_vars['to_parent_pos'] != -1) {
552  $this->_running_vars['to_parent_pos']++;
553  }
554 
555  // NOTE: Content tags are not cloned as a component because the link
556  // cloning will take care of that
557  $components = Array(
558  'attributes',
559  'metadata_schemas',
560  'metadata',
561  'workflow',
562  'permissions',
563  'roles',
564  );
565 
566  $step_data['message'] = 'Cloning "'.htmlentities($orig->name, ENT_COMPAT, SQ_CONF_DEFAULT_CHARACTER_SET).'" to "'.htmlentities($parent_asset->name, ENT_COMPAT, SQ_CONF_DEFAULT_CHARACTER_SET).'".';
567 
568  $clone = $GLOBALS['SQ_SYSTEM']->am->cloneAsset($orig, $link, $remap, $components, TRUE);
569  if (is_null($clone)) {
570  trigger_localised_error('HIPO0028', E_USER_WARNING);
571  return FALSE;
572  }
573 
574  // Rename the cloned asset if specified
575  if (isset($this->_running_vars['clone_assets'][$assetid]['new_name']) && !empty($this->_running_vars['clone_assets'][$assetid]['new_name'])) {
576  if (isset($clone->vars['name'])) {
577  $clone->setAttrValue('name', $this->_running_vars['clone_assets'][$assetid]['new_name']);
578  }
579  if (isset($clone->vars['short_name'])) {
580  $clone->setAttrValue('short_name', $this->_running_vars['clone_assets'][$assetid]['new_name']);
581  }
582  if (isset($clone->vars['id_name'])) {
583  $clone->setAttrValue('id_name', $this->_running_vars['clone_assets'][$assetid]['new_name']);
584  }
585  if (!$clone->saveAttributes()) {
586  trigger_localised_error('HIPO0028', E_USER_WARNING);
587  return FALSE;
588  }
589  }
590 
591  // the web path of this asset may confict with the children
592  // of the parent asset that we are linking to, so check the integrity
593  // of the path before using it
594  require_once SQ_INCLUDE_PATH.'/general_occasional.inc';
595  if (isset($this->_running_vars['clone_assets'][$assetid]['new_name']) && !empty($this->_running_vars['clone_assets'][$assetid]['new_name'])) {
596  if(isset($clone->vars['id_name'])){
597  $valid_paths = make_valid_web_paths(Array(strtolower($clone->attr('id_name'))));
598  }
599  else {
600  $valid_paths = make_valid_web_paths(Array(strtolower($clone->attr('name'))));
601  }
602  $good_paths = $GLOBALS['SQ_SYSTEM']->am->webPathsInUse($link['asset'], $valid_paths, $clone->id, TRUE);
603  } else {
604  $valid_paths = make_valid_web_paths($orig->getWebPaths());
605  $good_paths = $GLOBALS['SQ_SYSTEM']->am->webPathsInUse($link['asset'], $valid_paths, $clone->id, TRUE);
606  }
607 
608  $link_info = $GLOBALS['SQ_SYSTEM']->am->getLinkByAsset($clone->id, $this->_running_vars['to_parent_assetid'], $link['link_type'], NULL, 'minor');
609 
610  $this->_running_vars['cloned_asset'][$clone->id]['linkid'] = $link_info['linkid'];
611  $this->_running_vars['cloned_asset'][$clone->id]['parentid'] = $this->_running_vars['to_parent_assetid'];
612 
613  if (!$clone->saveWebPaths($good_paths)) return FALSE;
614 
615  // Check for Additional processing
616  if (method_exists($orig, 'cloneDependantAdditional')) {
617  $orig->cloneDependantAdditional($clone);
618  }
619 
620  $GLOBALS['SQ_SYSTEM']->am->forgetAsset($parent_asset);
621  $GLOBALS['SQ_SYSTEM']->am->forgetAsset($orig);
622  $GLOBALS['SQ_SYSTEM']->am->forgetAsset($clone);
623 
624  $this->_running_vars['remap'][$assetid] = $remap;
625 
626  if (!empty($this->_running_vars['finalise_function'])) {
627  $GLOBALS['SQ_SYSTEM']->am->includeAsset($this->_running_vars['finalise_function'][0]);
628  call_user_func_array($this->_running_vars['finalise_function'], Array(&$clone, &$this->_running_vars));
629  }
630 
631  if (empty($this->_running_vars['clone_assets'][$assetid]['number_of_clones']) || ($this->_running_vars['clone_assets'][$assetid]['number_of_clones'] == 1)) {
632  unset($this->_running_vars['clone_assets'][$assetid]);
633  } else {
634  $this->_running_vars['clone_assets'][$assetid]['number_of_clones']--;
635  }
636  $this->_running_vars['done_asset_count']++;
637 
638  if (empty($this->_running_vars['clone_assets'])) {
639  unset($this->_running_vars['done_asset_count']);
640  unset($this->_running_vars['todo_asset_count']);
641  $step_data['percent_done'] = 100;
642  $step_data['complete'] = TRUE;
643  } else {
644  $step_data['percent_done'] = (int)(($this->_running_vars['done_asset_count'] / $this->_running_vars['todo_asset_count']) * 100);
645  $step_data['complete'] = FALSE;
646  }
647 
648  return TRUE;
649 
650  }//end processCloneAssets()
651 
652 
664  function processRemap(&$step_data, $prefix)
665  {
666  $assetid = key($this->_running_vars['remap']);
667 
668  $asset = $GLOBALS['SQ_SYSTEM']->am->getAsset($assetid);
669  $map = $this->_running_vars['remap'][$assetid];
670  unset($this->_running_vars['remap'][$assetid]);
671 
672  $step_data['message'] = 'Remapping "'.htmlentities($asset->name, ENT_COMPAT, SQ_CONF_DEFAULT_CHARACTER_SET).'" and its dependant assets.';
673 
674  if (!$asset->remapAssetids($map)) {
675  trigger_localised_error('HIPO0027', E_USER_WARNING, $asset->id);
676  return FALSE;
677  }
678 
679  $this->_running_vars['done_assetids'][] = $assetid;
680 
681  if (empty($this->_running_vars['remap'])) {
682  unset($this->_running_vars['done_assetids']);
683  $step_data['percent_done'] = 100;
684  $step_data['complete'] = TRUE;
685  } else {
686  $remap_total = count($this->_running_vars['done_assetids'])+count($this->_running_vars['remap']);
687  $remap_percentage = (int)(count($this->_running_vars['done_assetids']) / $remap_total * 100);
688  $step_data['percent_done'] = $remap_percentage;
689  $step_data['complete'] = FALSE;
690  }
691 
692  return TRUE;
693 
694  }//end processRemap()
695 
696 
707  function paintInterface(&$step_data, &$o, $prefix)
708  {
709  $hh = $GLOBALS['SQ_SYSTEM']->getHipoHerder();
710  if (is_null($hh)) return FALSE;
711 
712  $assets = $this->_running_vars['assets'];
713 
714  $c = 1;
715  for (reset($assets); NULL !== ($assetid = key($assets)); next($assets)) {
716  $o->addHiddenField('link_assetid['.$c.']', $assetid);
717  $c++;
718  }
719 
720  $o->addHiddenField('link_parentid', $this->_running_vars['to_parent_assetid']);
721 
722  $parent = $GLOBALS['SQ_SYSTEM']->am->getAsset($this->_running_vars['to_parent_assetid']);
723  if (is_null($parent)) {
724  trigger_localised_error('HIPO0018', E_USER_WARNING, $this->_running_vars['to_parent_assetid']);
725  return FALSE;
726  }
727 
728  $o->openSection(translate('note'));
729  $o->openField('&nbsp;');
730  $o->addHiddenField('link_completed', '0');
731 
732  if (count($this->_running_vars['assets']) > 0) {
733  echo '<p><b>'.translate('hipo_asset_cloning_successful', htmlentities($parent->name, ENT_COMPAT, SQ_CONF_DEFAULT_CHARACTER_SET)).'</b></p>';
734  echo '<ul>';
735  for (reset($assets); NULL !== ($assetid = key($assets)); next($assets)) {
736  $asset_info = $GLOBALS['SQ_SYSTEM']->am->getAssetInfo(Array($assetid,));
737  echo '<li>"'.$asset_info[$assetid]['name'].'"</li>';
738  }
739  echo '</ul>';
740  }
741 
742  ?>
743 
744  <p><?php echo translate('hipo_permission_workflow_metadata_display', htmlentities($parent->name, ENT_COMPAT, SQ_CONF_DEFAULT_CHARACTER_SET)); ?></p>
745  <p><?php echo translate('hipo_permission_workflow_metadata_cascade_select', htmlentities($parent->name, ENT_COMPAT, SQ_CONF_DEFAULT_CHARACTER_SET)); ?></p>
746  <p><?php echo translate('hipo_permission_workflow_metadata_cascade_none'); ?></p>
747  <?php
748  $ei = $parent->getEI();
749 
750  $ei->includeStaticScreen('permissions');
751  $pe = paintInlinePermissions($parent, $o, $ei);
752 
753  $ei->includeStaticScreen('workflow');
754  $wf = paintInlineWorkflow($parent, $o, $ei);
755 
756  $ei->includeStaticScreen('metadataSchemas');
757  $ms = paintInlineMetadataSchemas($parent, $o, $ei);
758 
759  $ei->includeStaticScreen('tagging');
760  $ta = paintInlineTagging($parent, $o, $ei);
761 
762  $ei->includeStaticScreen('roles');
763  $ro = paintInlineRoles($parent, $o, $ei);
764 
765  $o->addHiddenField('form_submitted', 1);
766  $o->closeField();
767  $o->closeSection();
768 
769  $o->openSection(translate('cascade'));
770  $o->openField('', 'cascade');
771  echo ($pe) ? translate('permissions').' '.check_box('cascade[]', 'cascade_pe').'<br />' : '';
772  echo ($ms) ? translate('metadata_schemas').' '.check_box('cascade[]', 'cascade_ms').'<br />' : '';
773  echo ($wf) ? translate('workflow').' '.check_box('cascade[]', 'cascade_wf').'<br />' : '';
774  echo ($ta) ? translate('content_tags').' '.check_box('cascade[]', 'cascade_ta').'<br />' : '';
775  echo ($ro) ? translate('roles').' '.check_box('cascade[]', 'cascade_ro').'<br />' : '';
776  $o->closeField();
777  $o->closeSection();
778 
779  $GLOBALS['SQ_SYSTEM']->am->forgetAsset($parent);
780  unset($parent);
781 
782  return TRUE;
783 
784  }//end paintInterface()
785 
786 
797  function paintRefresh(&$step_data, &$o, $prefix)
798  {
799  // Only paint in the later steps (otherwise it performs a double 'get_assets' request to the asset map)
800  if ($step_data['percent_done'] > 0) {
801  $o->addOnLoad('if (window.opener.parent.frames["sq_sidenav"] && window.opener.parent.frames["sq_sidenav"].reload_asset) window.opener.parent.frames["sq_sidenav"].reload_asset("'.$this->_running_vars['to_parent_assetid'].'");');
802  }//end if
803 
804  return TRUE;
805 
806  }//end paintRefresh()
807 
808 
818  function processRefresh(&$step_data, $prefix)
819  {
820  if ($step_data['percent_done'] == 0) {
821  $step_data['percent_done'] = 50;
822  } else {
823  $step_data['percent_done'] = 100;
824  $step_data['complete'] = TRUE;
825  }
826 
827  return TRUE;
828 
829  }//end processRefresh()
830 
831 
832 }//end class
833 
834 
835 ?>