<commit_before><?php
/**
 * COmanage Registry CO Group Index View
 *
 * Copyright (C) 2010-15 University Corporation for Advanced Internet Development, Inc.
 * 
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
 * the License. You may obtain a copy of the License at
 * 
 * http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software distributed under
 * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 * KIND, either express or implied. See the License for the specific language governing
 * permissions and limitations under the License.
 *
 * @copyright     Copyright (C) 2011-15 University Corporation for Advanced Internet Development, Inc.
 * @link          http://www.internet2.edu/comanage COmanage Project
 * @package       registry
 * @since         COmanage Registry v0.1
 * @license       Apache License, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0)
 * @version       $Id$
 */

  if($this->action == 'select') {
    // Add breadcrumbs
    print $this->element("coCrumb");
    $args = array();
    $args['plugin'] = null;
    $args['controller'] = 'co_people';
    $args['action'] = 'index';
    $args['co'] = $cur_co['Co']['id'];
    $this->Html->addCrumb(_txt('me.population'), $args);
    $args = array(
      'controller' => 'co_people',
      'action' => 'canvas',
      $vv_co_person_id
    );
    $this->Html->addCrumb(_txt('ct.co_people.1'), $args);
    $this->Html->addCrumb(_txt('op.manage.grm'));

    // Add page title
    $params = array();
    $params['title'] = _txt('op.gr.memadd', array($name_for_title));

  } else {
    // Add breadcrumbs
    $this->Html->addCrumb(_txt('ct.co_groups.pl'));

    // Add page title
    $params = array();
    $params['title'] =  _txt('ct.co_groups.pl');

    // Add top links
    $params['topLinks'] = array();

    if($permissions['add']) {
      $params['topLinks'][] = $this->Html->link(
        _txt('op.add-a', array(_txt('ct.co_groups.1'))),
        array(
          'controller' => 'co_groups',
          'action' => 'add',
          'co' => $cur_co['Co']['id']
        ),
        array('class' => 'addbutton')
      );

      if($permissions['reconcile']) {
        $url = array();
        $url['controller'] = 'co_groups';
        $url['action'] = 'reconcile';
        $url['ext'] = 'json';
        $url['?'] = array('coid' => $cur_co['Co']['id']);
        $jsLink = $this->Html->url($url);
        $options = array();
        $options['class'] = 'reconcilebutton';
        $options['onclick'] = "javascript:js_confirm_reconcile('$jsLink');";
        $params['topLinks'][] = $this->Html->tag('a',_txt('op.gr.reconcile.all'), $options);
      }

      $params['topLinks'][] = $this->Html->link(
        _txt('op.grm.manage'),
        array(
          'controller' => 'co_groups',
          'action' => 'select',
          'copersonid' => $this->Session->read('Auth.User.co_person_id'),
          'co' => $cur_co['Co']['id']
        ),
        array('class' => 'linkbutton')
      );
    }
  }

  print $this->element("pageTitleAndButtons", $params);
  
  if($permissions['select'] && $this->action == 'select') {
    // We're using slightly the wrong permission here... edit group instead of add group member
    // (though they work out the same)
    print $this->Form->create('CoGroupMember',
                              array('action' => 'update',
                                    'inputDefaults' => array('label' => false,
                                                             'div' => false))) . "\n";
    // beforeFilter needs CO ID
    print $this->Form->hidden('CoGroupMember.co_id', array('default' => $cur_co['Co']['id'])) . "\n";
    // Group ID must be global for isAuthorized
    print $this->Form->hidden('CoGroupMember.co_person_id', array('default' => $vv_co_person_id)) . "\n";
  }
?>
<script type="text/javascript">
  // This is based in large part on CoProvisioningTargets/index.ctp
  
  // IDs of the members groups to be reconciled individually
  var ids = [ ];
  
  // Have we been interrupted by the user?
  var canceled = 0;
  
  function js_confirm_reconcile(targetUrl) {
    // Prep confirmation dialog
    $("#reconcile-dialog").dialog("option",
                                     "buttons",
                                     [ { text: "<?php print _txt('op.cancel'); ?>", click: function() { $(this).dialog("close"); } },
                                       { text: "<?php print _txt('op.gr.reconcile'); ?>", click: function() {
                                         $(this).dialog("close");
                                         js_request_reconcile(targetUrl);
                                       } }
                                     ] );
    
    // Open the dialog to confirm autogenerate
    $("#reconcile-dialog").dialog("open");
  }<commit_msg>Additional fix for CO-1268<commit_after><?php
/**
 * COmanage Registry CO Group Index View
 *
 * Copyright (C) 2010-15 University Corporation for Advanced Internet Development, Inc.
 * 
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
 * the License. You may obtain a copy of the License at
 * 
 * http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software distributed under
 * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 * KIND, either express or implied. See the License for the specific language governing
 * permissions and limitations under the License.
 *
 * @copyright     Copyright (C) 2011-15 University Corporation for Advanced Internet Development, Inc.
 * @link          http://www.internet2.edu/comanage COmanage Project
 * @package       registry
 * @since         COmanage Registry v0.1
 * @license       Apache License, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0)
 * @version       $Id$
 */

  if($this->action == 'select') {
    // Add breadcrumbs
    print $this->element("coCrumb");
    $args = array();
    $args['plugin'] = null;
    $args['controller'] = 'co_people';
    $args['action'] = 'index';
    $args['co'] = $cur_co['Co']['id'];
    $this->Html->addCrumb(_txt('me.population'), $args);
    $args = array(
      'controller' => 'co_people',
      'action' => 'canvas',
      $vv_co_person_id
    );
    $this->Html->addCrumb(_txt('ct.co_people.1'), $args);
    $this->Html->addCrumb(_txt('op.manage.grm'));

    // Add page title
    $params = array();
    $params['title'] = _txt('op.gr.memadd', array($name_for_title));

  } else {
    // Add breadcrumbs
    $this->Html->addCrumb(_txt('ct.co_groups.pl'));

    // Add page title
    $params = array();
    $params['title'] =  _txt('ct.co_groups.pl');

    // Add top links
    $params['topLinks'] = array();

    if($permissions['add']) {
      $params['topLinks'][] = $this->Html->link(
        _txt('op.add-a', array(_txt('ct.co_groups.1'))),
        array(
          'controller' => 'co_groups',
          'action' => 'add',
          'co' => $cur_co['Co']['id']
        ),
        array('class' => 'addbutton')
      );

      if($permissions['reconcile']) {
        $url = array();
        $url['controller'] = 'co_groups';
        $url['action'] = 'reconcile';
        $url['ext'] = 'json';
        $url['?'] = array('coid' => $cur_co['Co']['id']);
        $jsLink = $this->Html->url($url);
        $options = array();
        $options['class'] = 'reconcilebutton';
        $options['onclick'] = "javascript:js_confirm_reconcile('$jsLink');";
        $params['topLinks'][] = $this->Html->tag('a',_txt('op.gr.reconcile.all'), $options);
      }

      $params['topLinks'][] = $this->Html->link(
        _txt('op.grm.manage'),
        array(
          'controller' => 'co_groups',
          'action' => 'select',
          'copersonid' => $this->Session->read('Auth.User.co_person_id'),
          'co' => $cur_co['Co']['id']
        ),
        array('class' => 'linkbutton')
      );
    }
  }

  print $this->element("pageTitleAndButtons", $params);
  
  if($permissions['select'] && $this->action == 'select') {
    // We're using slightly the wrong permission here... edit group instead of add group member
    // (though they work out the same)
    print $this->Form->create('CoGroupMember',
                              array('url' => array('action' => 'update'),
                                    'inputDefaults' => array('label' => false,
                                                             'div' => false))) . "\n";
    // beforeFilter needs CO ID
    print $this->Form->hidden('CoGroupMember.co_id', array('default' => $cur_co['Co']['id'])) . "\n";
    // Group ID must be global for isAuthorized
    print $this->Form->hidden('CoGroupMember.co_person_id', array('default' => $vv_co_person_id)) . "\n";
  }
?>
<script type="text/javascript">
  // This is based in large part on CoProvisioningTargets/index.ctp
  
  // IDs of the members groups to be reconciled individually
  var ids = [ ];
  
  // Have we been interrupted by the user?
  var canceled = 0;
  
  function js_confirm_reconcile(targetUrl) {
    // Prep confirmation dialog
    $("#reconcile-dialog").dialog("option",
                                     "buttons",
                                     [ { text: "<?php print _txt('op.cancel'); ?>", click: function() { $(this).dialog("close"); } },
                                       { text: "<?php print _txt('op.gr.reconcile'); ?>", click: function() {
                                         $(this).dialog("close");
                                         js_request_reconcile(targetUrl);
                                       } }
                                     ] );
    
    // Open the dialog to confirm autogenerate
    $("#reconcile-dialog").dialog("open");
  }
{'fraction_non_alphanumeric': 0.17130513413041293, 'fraction_numerical': 0.0056264442881543255, 'mean_word_length': 2.2732653732324892, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 104, 'https://': 0, 'lorem ipsum': 0, 'www.': 6, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 32, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7290528', 'n_tokens_mistral': 2975, 'n_tokens_neox': 2894, 'n_words': 692}