<commit_before><!-- elements::ajax_event_template_lists end -->
<?php
  //$templateID = null;
  $templates = array();
  if ($eventTemplates!=null) {
    if (isset($view) && $view) {
		  foreach($eventTemplates as $row): $template = $row[$model];
				  if (isset($templateID) && $template['id'] == $templateID) {
				     echo $template['name'];
				  }
			endforeach;
    }
    else {?>
  		<select name="data[Event][template_id]" id="template_id" style="width:200px;" >
  			<?php foreach($eventTemplates as $row): $template = $row[$model];?>
  		  <option value="<?php echo trim($template['id']) ?>"<?php
  				  if (isset($templateID) && $template['id'] == $templateID) {
  				       echo ' selected';
  				  }
  				  ?>><?php echo $template['name'] ?></option>
  			<?php endforeach; ?>
  		</select>
      
      <script type="text/javascript" language="javascript">
        function getSimpleIndex(obj) {
          index = document.getElementById("template_id").selectedIndex;
          obj.href = "<?php echo $this->webroot.$this->themeWeb;?>simpleevaluations/view/"+(++index)+"/pop_up";
        }
        function getRubricIndex(obj) {
          index = document.getElementById("template_id").selectedIndex;
          obj.href = "<?php echo $this->webroot.$this->themeWeb;?>rubrics/view/"+(++index)+"/pop_up";
        }
        function getMixIndex(obj) {
          index = document.getElementById("template_id").selectedIndex;
          obj.href = "<?php echo $this->webroot.$this->themeWeb;?>mixevals/view/"+(++index)+"/pop_up";
        }
      </script>
    <?php
    }
    //echo '<br><br>';
    if ($model == 'SimpleEvaluation') { ?>
      <a title="Simple Evaluation Preview" target="_blank" href="<?php echo $this->webroot.$this->themeWeb;?>simpleevaluations/view/1/pop_up" onclick="getSimpleIndex(this); wopen(this.href, 'popup', 650, 500); return false;">&nbsp;Preview</a>
    <?php } 
    else if ($model == 'Rubric') { ?>
      <a title="Rubric Preview" target="_blank" href="<?php echo $this->webroot.$this->themeWeb;?>rubrics/view/1/pop_up" onclick="getRubricIndex(this); wopen(this.href, 'popup', 650, 500); return false;">&nbsp;Preview</a>
    <?php } 
    else if ($model == 'Mixeval') { ?>
      <a title="Mix Evaluation Preview" target="_blank" href="<?php echo $this->webroot.$this->themeWeb;?>mixevals/view/1/pop_up" onclick="getMixIndex(this); wopen(this.href, 'popup', 650, 500); return false;">&nbsp;Preview</a>
    <?php } ?>
<?php  }
  else {

    echo $html->selectTag('Event/template_id', array('-1'=>$default), isset($templateID)?$templateID:$templateID=null, null, null, false);

    //echo '<br><br>';
    if ($model == 'SimpleEvaluation')
    { ?>
    <a title="Rubric Preview" href="<?php echo $this->webroot.$this->themeWeb;?>simpleevaluations/view/1/pop_up" onclick="wopen(this.href, 'popup', 650, 500); return false;">&nbsp;Preview</a>
    <?php } else  if ($model == 'Rubric'){ ?>
    <a title="Preview Rubric" href="<?php echo $this->webroot.$this->themeWeb;?>rubrics/view/1/pop_up" onclick="wopen(this.href, 'popup', 650, 500); return false;">&nbsp;Preview </a>
    <?php } else  if ($model == 'Mixeval'){ ?>
    <a title="Preview Rubric" href="<?php echo $this->webroot.$this->themeWeb;?>mixevals/view/1/pop_up" onclick="wopen(this.href, 'popup', 650, 500); return false;">&nbsp;Preview</a>
    <?php } ?>
<?php  }?>  
<!-- elements::ajax_event_template_lists end -->
<commit_msg>As I was looking at fixing #87, I found out that the previews of the evaluations were not wokring corrctly. I compacted some JS code, and corrected the issue. #87 is still unfixed, though.<commit_after><!-- elements::ajax_event_template_lists end -->
<?php
  //$templateID = null;
  $templates = array();
  if ($eventTemplates!=null) {
    if (isset($view) && $view) {
		  foreach($eventTemplates as $row): $template = $row[$model];
				  if (isset($templateID) && $template['id'] == $templateID) {
				     echo $template['name'];
				  }
			endforeach;
    }
    else {?>
  		<select name="data[Event][template_id]" id="template_id" style="width:200px;" >
  			<?php foreach($eventTemplates as $row): $template = $row[$model];?>
  		  <option value="<?php echo trim($template['id']) ?>"<?php
  				  if (isset($templateID) && $template['id'] == $templateID) {
  				       echo ' selected';
  				  }
  				  ?>><?php echo $template['name'] ?></option>
  			<?php endforeach; ?>
  		</select>

      <script type="text/javascript" language="javascript">

        function getIndex(obj, type) {
          index = document.getElementById("template_id").value;
          obj.href = "<?php echo $this->webroot.$this->themeWeb;?>" + type + "/view/"+(index)+"/pop_up";
        }

      </script>
    <?php
    }
    //echo '<br><br>';
    if ($model == 'SimpleEvaluation') { ?>
      <a title="Simple Evaluation Preview" target="_blank" href="javascript:void;" onclick="getIndex(this,'simpleevaluations'); wopen(this.href, 'popup', 650, 500); return false;">&nbsp;Preview This Simple Evaluation</a>
    <?php }
    else if ($model == 'Rubric') { ?>
      <a title="Rubric Preview" target="_blank" href="javascript:void;" onclick="getIndex(this,'rubrics'); wopen(this.href, 'popup', 650, 500); return false;">&nbsp;Preview This Rubric</a>
    <?php }
    else if ($model == 'Mixeval') { ?>
      <a title="Mix Evaluation Preview" target="_blank" href="javascript:void;" onclick="getIndex(this,'mixevals'); wopen(this.href, 'popup', 650, 500); return false;">&nbsp;Preview this Mixed Evaluaiton</a>
    <?php } ?>
<?php  }
  else {

    echo $html->selectTag('Event/template_id', array('-1'=>$default), isset($templateID)?$templateID:$templateID=null, null, null, false);

    //echo '<br><br>';
    if ($model == 'SimpleEvaluation')
    { ?>
    <a title="Rubric Preview" href="<?php echo $this->webroot.$this->themeWeb;?>simpleevaluations/view/1/pop_up" onclick="wopen(this.href, 'popup', 650, 500); return false;">&nbsp;Preview</a>
    <?php } else  if ($model == 'Rubric'){ ?>
    <a title="Preview Rubric" href="<?php echo $this->webroot.$this->themeWeb;?>rubrics/view/1/pop_up" onclick="wopen(this.href, 'popup', 650, 500); return false;">&nbsp;Preview </a>
    <?php } else  if ($model == 'Mixeval'){ ?>
    <a title="Preview Rubric" href="<?php echo $this->webroot.$this->themeWeb;?>mixevals/view/1/pop_up" onclick="wopen(this.href, 'popup', 650, 500); return false;">&nbsp;Preview</a>
    <?php } ?>
<?php  }?>
<!-- elements::ajax_event_template_lists end -->

{'fraction_non_alphanumeric': 0.20235756385068762, 'fraction_numerical': 0.014054707571406982, 'mean_word_length': 3.589459084604716, 'pattern_counts': {'":': 0, '<': 94, '<?xml version=': 0, '>': 124, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2493609', 'n_tokens_mistral': 2320, 'n_tokens_neox': 2115, 'n_words': 438}