comanage-dev - [comanage-dev] r552 - in registry/trunk/app: Config/Schema Controller Lib Model View/CoEnrollmentAttributes View/CoPetitions View/Layouts
Subject: COmanage Developers List
List archive
[comanage-dev] r552 - in registry/trunk/app: Config/Schema Controller Lib Model View/CoEnrollmentAttributes View/CoPetitions View/Layouts
Chronological Thread
- From:
- To:
- Subject: [comanage-dev] r552 - in registry/trunk/app: Config/Schema Controller Lib Model View/CoEnrollmentAttributes View/CoPetitions View/Layouts
- Date: Fri, 5 Jul 2013 09:29:32 -0400
- Authentication-results: sfpop-ironport02.merit.edu; dkim=neutral (message not signed) header.i=none
Author: benno
Date: 2013-07-05 09:29:31 -0400 (Fri, 05 Jul 2013)
New Revision: 552
Added:
registry/trunk/app/Model/CoEnrollmentAttributeDefault.php
Modified:
registry/trunk/app/Config/Schema/schema.xml
registry/trunk/app/Controller/CoEnrollmentAttributesController.php
registry/trunk/app/Lib/lang.php
registry/trunk/app/Model/CoEnrollmentAttribute.php
registry/trunk/app/Model/CoExtendedAttribute.php
registry/trunk/app/View/CoEnrollmentAttributes/fields.inc
registry/trunk/app/View/CoEnrollmentAttributes/index.ctp
registry/trunk/app/View/CoPetitions/petition-attributes.inc
registry/trunk/app/View/Layouts/default.ctp
Log:
Implement default values for enrollment flows (CO-283)
Modified: registry/trunk/app/Config/Schema/schema.xml
===================================================================
--- registry/trunk/app/Config/Schema/schema.xml 2013-06-28 23:15:34 UTC (rev
551)
+++ registry/trunk/app/Config/Schema/schema.xml 2013-07-05 13:29:31 UTC (rev
552)
@@ -578,6 +578,26 @@
</index>
</table>
+ <table name="co_enrollment_attribute_defaults">
+ <field name="id" type="I">
+ <key />
+ <autoincrement />
+ </field>
+ <field name="co_enrollment_attribute_id" type="I">
+ <notnull />
+ <constraint>REFERENCES cm_co_enrollment_attributes(id)</constraint>
+ </field>
+ <field name="affiliation" type="C" size="32" />
+ <field name="value" type="C" size="80" />
+ <field name="modifiable" type="L" />
+ <field name="created" type="T" />
+ <field name="modified" type="T" />
+
+ <index name="co_enrollment_attribute_defaults_i1">
+ <col>co_enrollment_attribute_id</col>
+ </index>
+ </table>
+
<table name="co_petitions">
<field name="id" type="I">
<key />
Modified: registry/trunk/app/Controller/CoEnrollmentAttributesController.php
===================================================================
--- registry/trunk/app/Controller/CoEnrollmentAttributesController.php
2013-06-28 23:15:34 UTC (rev 551)
+++ registry/trunk/app/Controller/CoEnrollmentAttributesController.php
2013-07-05 13:29:31 UTC (rev 552)
@@ -76,8 +76,16 @@
*/
function beforeFilter() {
+ global $cm_lang, $cm_texts;
+
parent::beforeFilter();
-
+
+ // Sub optimally, we need to unlock add and edit so that the javascript
form manipulation
+ // magic works. XXX It would be good to be more specific, and just call
unlockField()
+ // on specific fields, but some initial testing does not make it obvious
which
+ // fields need to be unlocked.
+ $this->Security->unlockedActions = array('add', 'edit');
+
// Strictly speaking, this controller doesn't require a CO except to
redirect/render views.
// Figure out the CO ID associated with the current enrollment flow.
We'll specifically
// not set $this->cur_co since it will break things like pagination
setup.
@@ -90,19 +98,71 @@
$coefid =
$this->request->data['CoEnrollmentAttribute']['co_enrollment_flow_id'];
$this->CoEnrollmentAttribute->CoEnrollmentFlow->id = $coefid;
+
+ $this->set('vv_coefid', Sanitize::html($coefid));
+
$coid = $this->CoEnrollmentAttribute->CoEnrollmentFlow->field('co_id');
-
+
if(!empty($coid))
{
- $this->set("coid", $coid);
+ $this->set('vv_coid', $coid);
// Assemble the set of available attributes for the view to render
- $this->set('available_attributes',
$this->CoEnrollmentAttribute->availableAttributes($coid));
+ $this->set('vv_available_attributes',
$this->CoEnrollmentAttribute->availableAttributes($coid));
+
+ // And pull details of extended attributes so views can determine types
+
+ $args = array();
+ $args['conditions']['co_id'] = $coid;
+ $args['fields'] = array('CoExtendedAttribute.name',
'CoExtendedAttribute.type');
+ $args['contain'] = false;
+
+ $this->set('vv_ext_attr_types',
+
$this->CoEnrollmentAttribute->CoEnrollmentFlow->Co->CoExtendedAttribute->find('list',
$args));
+
+ // Assemble the list of available COUs
+
+ $this->set('vv_cous',
$this->CoEnrollmentAttribute->CoEnrollmentFlow->Co->Cou->allCous($coid));
+
+ // Assemble the list of available affiliations
+
+ $this->set('vv_affiliations', $cm_texts[ $cm_lang ]['en.affil']);
}
}
/**
+ * Perform any followups following a write operation. Note that if this
+ * method fails, it must return a warning or REST response, but that the
+ * overall transaction is still considered a success (add/edit is not
+ * rolled back).
+ *
+ * @since COmanage Registry v0.8.1
+ * @param Array Request data
+ * @param Array Current data
+ * @return boolean true if dependency checks succeed, false otherwise.
+ */
+
+ function checkWriteFollowups($reqdata, $curdata = null) {
+ // Perform a quick check to see if the attribute can no longer have a
default attribute.
+ // Currently, only types 'o', 'r', and 'x' can.
+
+ if(!empty($curdata['CoEnrollmentAttributeDefault'][0]['id'])) {
+ // There is an existing default
+
+ $attrinfo = explode(':',
$reqdata['CoEnrollmentAttribute']['attribute']);
+
+ if($attrinfo[0] != 'o' && $attrinfo[0] != 'r' && $attrinfo[0] != 'x') {
+ // Ignore return code
+
$this->CoEnrollmentAttribute->CoEnrollmentAttributeDefault->delete($curdata['CoEnrollmentAttributeDefault'][0]['id'],
+
false);
+ }
+ }
+
+ return true;
+ }
+
+ /**
* Authorization for this Controller, called by Auth component
* - precondition: Session.Auth holds data used for authz decisions
* - postcondition: $permissions set with calculated permissions
Modified: registry/trunk/app/Lib/lang.php
===================================================================
--- registry/trunk/app/Lib/lang.php 2013-06-28 23:15:34 UTC (rev 551)
+++ registry/trunk/app/Lib/lang.php 2013-07-05 13:29:31 UTC (rev 552)
@@ -402,12 +402,19 @@
'fd.directory' => 'Directory',
'fd.domain' => 'Domain',
// Enrollment configuration fields
- 'fd.ea.desc' => 'Description',
+ 'fd.ea.desc' => 'Description',
'fd.ea.desc.desc' => 'Descriptive text to be displayed when prompting for
this attribute (like this text you\'re reading now)',
- 'fd.ea.label' => 'Label',
+ 'fd.ea.label' => 'Label',
'fd.ea.label.desc' => 'The label to be displayed when prompting for this
attribute as part of the enrollment process',
- 'fd.ea.order' => 'Order',
+ 'fd.ea.order' => 'Order',
'fd.ea.order.desc' => 'The order in which this attribute will be presented
(leave blank to append at the end of the current attributes)',
+ 'fd.ed.date.fixed' => 'On',
+ 'fd.ed.date.next' => 'On the next',
+ 'fd.ed.date.next-note' => '(year is ignored)',
+ 'fd.ed.date.offset' => 'days from the Petition creation',
+ 'fd.ed.default' => 'Default Value',
+ 'fd.ed.modify' => 'Modifiable',
+ 'fd.ed.modify.desc' => 'If false, the Petitioner cannot change the default
value placed into the Petition',
'fd.et.forattr' => 'For Attribute',
'fd.ef.aea' => 'Require Authentication For Administrator Enrollment',
'fd.ef.aea.desc' => 'If administrator enrollment is enabled, require
enrollees to authenticate to the platform in order to complete their
enrollment',
Modified: registry/trunk/app/Model/CoEnrollmentAttribute.php
===================================================================
--- registry/trunk/app/Model/CoEnrollmentAttribute.php 2013-06-28 23:15:34
UTC (rev 551)
+++ registry/trunk/app/Model/CoEnrollmentAttribute.php 2013-07-05 13:29:31
UTC (rev 552)
@@ -14,7 +14,7 @@
* KIND, either express or implied. See the License for the specific
language governing
* permissions and limitations under the License.
*
- * @copyright Copyright (C) 2011-12 University Corporation for Advanced
Internet Development, Inc.
+ * @copyright Copyright (C) 2011-13 University Corporation for Advanced
Internet Development, Inc.
* @link http://www.internet2.edu/comanage COmanage Project
* @package registry
* @since COmanage Registry v0.3
@@ -29,10 +29,14 @@
// Current schema version for API
public $version = "1.0";
+ // Add behaviors
+ public $actsAs = array('Containable');
+
// Association rules from this model to other models
public $belongsTo = array("CoEnrollmentFlow"); // A CO Enrollment
Attribute is part of a CO Enrollment Flow
public $hasMany = array(
+ "CoEnrollmentAttributeDefault" => array('dependent' => true),
// A CO Petition Attribute is defined by a CO Enrollment Attribute
"CoPetitionAttribute" => array('dependent' => true)
);
@@ -177,10 +181,14 @@
// First, retrieve the configured attributes
- $efAttrs = $this->findAllByCoEnrollmentFlowId($coef,
- array(),
-
array('CoEnrollmentAttribute.ordr' => 'asc'));
+ $args = array();
+ $args['conditions']['CoEnrollmentAttribute.co_enrollment_flow_id'] =
$coef;
+ $args['order']['CoEnrollmentAttribute.ordr'] = 'asc';
+ $args['contain'][] = 'CoEnrollmentAttributeDefault';
+ $args['contain'][] = 'CoEnrollmentFlow';
+ $efAttrs = $this->find('all', $args);
+
foreach($efAttrs as $efAttr) {
$attr = array();
@@ -248,9 +256,56 @@
// Field, in cake's Model.field
$attr['field'] = $attrName;
- // See if there is a default value for this field
+ // See if there is a default value for this field. If so, determine
if it
+ // is modifiable.
+
if(isset($defaultValues[ $attr['model'] ][ $attr['field'] ])) {
+ // These are default values created by the Controller, eg for
prepopulating Name.
+ // Currently, they are always modifiable.
$attr['default'] = $defaultValues[ $attr['model'] ][
$attr['field'] ];
+ $attr['modifiable'] = true;
+ }
elseif(!empty($efAttr['CoEnrollmentAttributeDefault'][0]['value'])) {
+ // These are the default values configured per-enrollment flow
attribute
+
+ if(($attrCode == 'r'
+ && ($attrName == 'valid_from' || $attrName == 'valid_through'))
+ ||
+ // Extended attribute of type Timestamp?
+ ($attrCode == 'x'
+ && ($attrModel->field('type',
+ array('co_id' =>
$efAttr['CoEnrollmentFlow']['co_id'],
+ 'name' => $attrName)) ==
ExtendedAttributeEnum::Timestamp))) {
+ // For date types, convert to an actual date
+
+ if(preg_match("/^[0-2][0-9]\-[0-9]{2}$/",
+
$efAttr['CoEnrollmentAttributeDefault'][0]['value'])) {
+ // MM-DD indicates next MM-DD. Rather than muck around with
PHP date parsing,
+ // we'll see if {THISYEAR}-MM-DD is before now(). If it is,
we'll increment
+ // the year.
+
+ $curyear = date("Y");
+ $mmdd = explode("-",
$efAttr['CoEnrollmentAttributeDefault'][0]['value'], 2);
+
+ if(mktime(0, 0, 0, $mmdd[0], $mmdd[1], $curyear) < time()) {
+ $curyear++;
+ }
+
+ $attr['default'] = $curyear . "-" .
$efAttr['CoEnrollmentAttributeDefault'][0]['value'];
+ } elseif(preg_match("/^\+[0-9]+$/",
+
$efAttr['CoEnrollmentAttributeDefault'][0]['value'])) {
+ // Format +## indicates days from today
+
+ $attr['default'] = strftime("%F",
+
strtotime($efAttr['CoEnrollmentAttributeDefault'][0]['value'] . " days"));
+ } else {
+ // Just copy the string
+ $attr['default'] =
$efAttr['CoEnrollmentAttributeDefault'][0]['value'];
+ }
+ } else {
+ $attr['default'] =
$efAttr['CoEnrollmentAttributeDefault'][0]['value'];
+ }
+
+ $attr['modifiable'] =
$efAttr['CoEnrollmentAttributeDefault'][0]['modifiable'];
}
// Attach the validation rules so the form knows how to render the
field.
Modified: registry/trunk/app/Model/CoExtendedAttribute.php
===================================================================
--- registry/trunk/app/Model/CoExtendedAttribute.php 2013-06-28 23:15:34
UTC (rev 551)
+++ registry/trunk/app/Model/CoExtendedAttribute.php 2013-07-05 13:29:31
UTC (rev 552)
@@ -2,7 +2,7 @@
/**
* COmanage Registry CO Extended Attribute Model
*
- * Copyright (C) 2011-12 University Corporation for Advanced Internet
Development, Inc.
+ * Copyright (C) 2011-13 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
@@ -14,7 +14,7 @@
* KIND, either express or implied. See the License for the specific
language governing
* permissions and limitations under the License.
*
- * @copyright Copyright (C) 2011-12 University Corporation for Advanced
Internet Development, Inc.
+ * @copyright Copyright (C) 2011-13 University Corporation for Advanced
Internet Development, Inc.
* @link http://www.internet2.edu/comanage COmanage Project
* @package registry
* @since COmanage Registry v0.2
@@ -29,6 +29,9 @@
// Current schema version for API
public $version = "1.0";
+ // Add behaviors
+ public $actsAs = array('Containable');
+
// Association rules from this model to other models
public $belongsTo = array("Co"); // A CO has zero or
more extended attributes
Modified: registry/trunk/app/View/CoEnrollmentAttributes/fields.inc
===================================================================
--- registry/trunk/app/View/CoEnrollmentAttributes/fields.inc 2013-06-28
23:15:34 UTC (rev 551)
+++ registry/trunk/app/View/CoEnrollmentAttributes/fields.inc 2013-07-05
13:29:31 UTC (rev 552)
@@ -2,7 +2,7 @@
/**
* COmanage Registry CMP Enrollment Attribute Fields
*
- * Copyright (C) 2011-12 University Corporation for Advanced Internet
Development, Inc.
+ * Copyright (C) 2011-13 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
@@ -14,7 +14,7 @@
* KIND, either express or implied. See the License for the specific
language governing
* permissions and limitations under the License.
*
- * @copyright Copyright (C) 2011-12 University Corporation for Advanced
Internet Development, Inc.
+ * @copyright Copyright (C) 2011-13 University Corporation for Advanced
Internet Development, Inc.
* @link http://www.internet2.edu/comanage COmanage Project
* @package registry
* @since COmanage Registry v0.3
@@ -22,6 +22,112 @@
* @version $Id$
*/
-->
+<script type="text/javascript">
+ function js_local_onload() {
+ toggle_attr_def_div();
+ }
+
+ function ext_attr_type(attrname) {
+ // Determine the type of an extended attribute. We use PHP code to
generate
+ // javascript based on the view variable $vv_ext_attr_types.
+
+ switch(attrname) {
+ <?php foreach(array_keys($vv_ext_attr_types) as $xa): ?>
+ case "<?php print $xa; ?>":
+ return "<?php print $vv_ext_attr_types[$xa]; ?>";
+ break;
+ <?php endforeach; ?>
+ }
+
+ // We shouldn't get here
+ return "UNKNOWN";
+ }
+
+ function set_attr_def_from_date(datetype) {
+ // Offset date requires a + prefix
+ document.getElementById('CoEnrollmentAttributeDefault0Value').value =
+ (datetype == "offset" ? "+" : "") +
+ document.getElementById('def_date_val_' + datetype).value;
+ }
+
+ function set_attr_def_date_radio(datetype) {
+ document.getElementById('def_date_' + datetype).checked=true;
+ set_attr_def_from_date(datetype)
+ }
+
+ function set_attr_def_value(elementid) {
+ // Offset date requires a + prefix
+ document.getElementById('CoEnrollmentAttributeDefault0Value').value =
+ (elementid == "def_date_val_offset" ? "+" : "") +
+ document.getElementById(elementid).value
+ }
+
+ function toggle_attr_def_div() {
+ // For now, only CO Person Role attributes (type 'r'), Organizational
Identity
+ // attributes (type 'o'), or Extended Attributes (type 'x') can have
default values.
+
+ var curattr =
document.getElementById('CoEnrollmentAttributeAttribute').value;
+ var attrtype = curattr[0];
+
+ if(attrtype == "r" || attrtype == "o" || attrtype == "x") {
+ $("#attr_def_div").show("slide", { "direction" : "up" });
+
+ // Adjust the gadgets shown
+
+ $("#attr_def_val_div").hide();
+ $("#attr_def_val_affil_div").hide();
+ $("#attr_def_val_cou_div").hide();
+ $("#attr_def_val_date_div").hide();
+
+ var curval =
document.getElementById('CoEnrollmentAttributeDefault0Value').value;
+
+ var curattrarr = curattr.split(":");
+ var curattrcode = curattrarr[0];
+ var curattrname = curattrarr[1];
+
+ // if x:foo then pull foo and lookup in $vv_ext_attr_types to find type
+ // (write javascript array based on $vv_ext contents?)
+
+ if((curattrcode == "o" || curattrcode == "r")
+ && curattrname == "affiliation") {
+ // Set current value before showing
+ document.getElementById('def_affil_val').value = curval;
+ $("#attr_def_val_affil_div").show("fade");
+ } else if(curattrcode == "r" && curattrname == "cou_id") {
+ // Set current value before showing
+ document.getElementById('def_cou_val').value = curval;
+ $("#attr_def_val_cou_div").show("fade");
+ } else if((curattrcode == "r"
+ && (curattrname == "valid_from" || curattrname ==
"valid_through"))
+ ||
+ (curattrcode == "x"
+ && ext_attr_type(curattrname) == "<?php print
ExtendedAttributeEnum::Timestamp; ?>")) {
+ // Set current value before showing
+ var fixedre = /^[0-9]{4}\-[0-2][0-9]\-[0-9]{2}$/; // YYYY-MM-DD
+ var nextre = /^[0-2][0-9]\-[0-9]{2}$/; // MM-DD
+ var offsetre = /^\+[0-9]+$/; // +DD
+
+ if(fixedre.test(curval)) {
+ document.getElementById('def_date_val_fixed').value = curval;
+ set_attr_def_date_radio('fixed');
+ } else if(nextre.test(curval)) {
+ document.getElementById('def_date_val_next').value = curval;
+ set_attr_def_date_radio('next');
+ } else if(offsetre.test(curval)) {
+ // Trim the leading plus (it will get added back to curval by
set_attr_def_date_radio)
+ document.getElementById('def_date_val_offset').value =
curval.replace("+", "");
+ set_attr_def_date_radio('offset');
+ }
+
+ $("#attr_def_val_date_div").show("fade");
+ } else {
+ $("#attr_def_val_div").show();
+ }
+ } else {
+ $("#attr_def_div").hide("slide", { "direction" : "up" });
+ }
+ }
+</script>
<?php
// Determine if fields are editable
$e = false;
@@ -39,12 +145,14 @@
$this->set('sidebarButtons', $sidebarButtons);
- print $this->Form->hidden('co_enrollment_flow_id', array('default' =>
Sanitize::html($this->request->params['named']['coef']))) . "\n";
+ // Populate cross references
+ print $this->Form->hidden('co_enrollment_flow_id', array('default' =>
$vv_coefid)) . "\n";
+ print $this->Form->hidden('CoEnrollmentAttributeDefault.0.id') . "\n";
?>
<table id="<?php print $this->action; ?>_co_enrollment_attribute"
class="ui-widget">
<tbody>
<tr class="line1">
- <td>
+ <td width="50%"> <!-- force a width here and below so the two tables
line up -->
<b><?php print _txt('fd.ea.label'); ?></b><br />
<font class="desc"><?php print _txt('fd.ea.label.desc'); ?></font>
</td>
@@ -61,7 +169,7 @@
</td>
<td>
<?php print ($e
- ? $this->Form->input('description')
+ ? $this->Form->input('description', array('size' => 40))
:
Sanitize::html($co_enrollment_attributes[0]['CoEnrollmentAttribute']['description']));
?>
</td>
</tr>
@@ -75,10 +183,11 @@
?
$co_enrollment_attributes[0]['CoEnrollmentAttribute']['attribute']
: null);
$attrs['empty'] = false;
+ $attrs['onchange'] = "toggle_attr_def_div()";
if($e) {
print $this->Form->select('attribute',
- $available_attributes,
+ $vv_available_attributes,
$attrs);
if($this->Form->isFieldError('attribute')) {
@@ -129,6 +238,109 @@
</tr>
</tbody>
</table>
+<div id="attr_def_div" style="display: none">
+ <table id="<?php print $this->action; ?>_co_enrollment_attribute_default"
class="ui-widget">
+ <tbody>
+ <tr class="line2">
+ <td width="50%">
+ <b><?php print _txt('fd.ed.default'); ?></b><br />
+ </td>
+ <td>
+ <div id="attr_def_val_div">
+ <?php print ($e
+ ?
$this->Form->input('CoEnrollmentAttributeDefault.0.value', array('size' =>
40))
+ :
Sanitize::html($co_enrollment_attributes[0]['CoEnrollmentAttributeDefault'][0]['value']));
?>
+ </div>
+ <div id="attr_def_val_affil_div">
+ <?php if($e): ?>
+ <select name="def_affil_val"
+ id="def_affil_val"
+ onchange="set_attr_def_value('def_affil_val')">
+ <option value=""></option>
+ <?php foreach(array_keys($vv_affiliations) as $k): ?>
+ <option value="<?php print Sanitize::html($k); ?>"><?php
print Sanitize::html($vv_affiliations[$k]); ?></option>
+ <?php endforeach; ?>
+ </select>
+ <?php endif; ?>
+ </div>
+ <div id="attr_def_val_cou_div">
+ <?php if($e): ?>
+ <select name="def_cou_val"
+ id="def_cou_val"
+ onchange="set_attr_def_value('def_cou_val')">
+ <option value=""></option>
+ <?php foreach(array_keys($vv_cous) as $k): ?>
+ <option value="<?php print Sanitize::html($k); ?>"><?php
print Sanitize::html($vv_cous[$k]); ?></option>
+ <?php endforeach; ?>
+ </select>
+ <?php endif; ?>
+ </div>
+ <div id="attr_def_val_date_div">
+ <?php if($e): ?>
+ <input name="def_date_type"
+ id="def_date_fixed"
+ type="radio"
+ value="fixed"
+ onchange="set_attr_def_from_date('fixed')"
+ />
+ <?php print _txt('fd.ed.date.fixed'); ?>
+ <input name="def_date_val_fixed"
+ id="def_date_val_fixed"
+ class="datepicker"
+ onclick="set_attr_def_date_radio('fixed')"
+ onchange="set_attr_def_value('def_date_val_fixed')"
+ />
+ <br />
+ <input name="def_date_type"
+ id="def_date_next"
+ type="radio"
+ value="next"
+ onchange="set_attr_def_from_date('next')"
+ />
+ <?php print _txt('fd.ed.date.next'); ?>
+ <input name="def_date_val_next"
+ id="def_date_val_next"
+ size="12"
+ class="datepicker-m"
+ onclick="set_attr_def_date_radio('next')"
+ onchange="set_attr_def_value('def_date_val_next')"
+ />
+ <?php print _txt('fd.ed.date.next-note'); ?>
+ <br />
+ <input name="def_date_type"
+ id="def_date_offset"
+ size="6"
+ type="radio"
+ value="offset"
+ onchange="set_attr_def_from_date('offset')"
+ />
+ <input name="def_date_val_offset"
+ id="def_date_val_offset"
+ size="4"
+ onclick="set_attr_def_date_radio('offset')"
+ onkeyup="set_attr_def_value('def_date_val_offset')"
+ />
+ <?php print _txt('fd.ed.date.offset'); ?>
+ <br />
+ <?php endif; ?>
+ </div>
+ </td>
+ </tr>
+ <tr class="line1">
+ <td>
+ <b><?php print _txt('fd.ed.modify'); ?></b><br />
+ <font class="desc"><?php print _txt('fd.ed.modify.desc'); ?></font>
+ </td>
+ <td>
+ <?php print ($e
+ ?
$this->Form->input('CoEnrollmentAttributeDefault.0.modifiable',
+ array('default' => true))
+ :
($co_enrollment_attributes[0]['CoEnrollmentAttributeDefault'][0]['modifiable']
+ ? _txt('fd.yes') : _txt('fd.no'))); ?>
+ </td>
+ </tr>
+ </table>
+</div>
<?php
if($e) {
print $this->Form->submit($submit_label, array('onClick' =>
'on_submit()'));
Modified: registry/trunk/app/View/CoEnrollmentAttributes/index.ctp
===================================================================
--- registry/trunk/app/View/CoEnrollmentAttributes/index.ctp 2013-06-28
23:15:34 UTC (rev 551)
+++ registry/trunk/app/View/CoEnrollmentAttributes/index.ctp 2013-07-05
13:29:31 UTC (rev 552)
@@ -2,7 +2,7 @@
/**
* COmanage Registry CO Enrollment Attribute Index View
*
- * Copyright (C) 2011-12 University Corporation for Advanced Internet
Development, Inc.
+ * Copyright (C) 2011-13 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
@@ -14,7 +14,7 @@
* KIND, either express or implied. See the License for the specific
language governing
* permissions and limitations under the License.
*
- * @copyright Copyright (C) 2011-12 University Corporation for Advanced
Internet Development, Inc.
+ * @copyright Copyright (C) 2011-13 University Corporation for Advanced
Internet Development, Inc.
* @link http://www.internet2.edu/comanage COmanage Project
* @package registry
* @since COmanage Registry v0.3
@@ -37,8 +37,8 @@
'url' => array(
'controller' => 'co_enrollment_flows',
'action' => ($permissions['edit'] ? 'edit' : 'view'),
- Sanitize::html($this->request->params['named']['coef']),
- 'co' => $coid
+ $vv_coefid,
+ 'co' => $vv_coid
)
);
@@ -50,7 +50,7 @@
'url' => array(
'controller' => 'co_enrollment_attributes',
'action' => 'add',
- 'coef' => Sanitize::html($this->request->params['named']['coef'])
+ 'coef' => $vv_coefid
)
);
}
@@ -77,20 +77,25 @@
<?php
print $this->Html->link($c['CoEnrollmentAttribute']['label'],
array('controller' =>
'co_enrollment_attributes',
- 'action' => ($permissions['edit'] ?
'edit' : ($permissions['view'] ? 'view' : '')),
$c['CoEnrollmentAttribute']['id'], 'coef' =>
$this->request->params['named']['coef']));
+ 'action' => ($permissions['edit'] ?
'edit' : ($permissions['view'] ? 'view' : '')),
+ $c['CoEnrollmentAttribute']['id'],
+ 'coef' => $vv_coefid));
?>
</td>
- <td><?php print $available_attributes[
$c['CoEnrollmentAttribute']['attribute'] ]; ?></td>
+ <td><?php print $vv_available_attributes[
$c['CoEnrollmentAttribute']['attribute'] ]; ?></td>
<td><?php print Sanitize::html($c['CoEnrollmentAttribute']['ordr']);
?></td>
<td>
<?php
if($permissions['edit'])
print $this->Html->link(_txt('op.edit'),
- array('controller' =>
'co_enrollment_attributes', 'action' => 'edit',
$c['CoEnrollmentAttribute']['id'], 'coef' =>
$this->request->params['named']['coef']),
+ array('controller' =>
'co_enrollment_attributes',
+ 'action' => 'edit',
+ $c['CoEnrollmentAttribute']['id'],
+ 'coef' => $vv_coefid),
array('class' => 'editbutton')) . "\n";
if($permissions['delete'])
- print '<button class="deletebutton" title="' . _txt('op.delete')
. '" onclick="javascript:js_confirm_delete(\'' .
_jtxt(Sanitize::html($c['CoEnrollmentAttribute']['label'])) . '\', \'' .
$this->Html->url(array('controller' => 'co_enrollment_attributes', 'action'
=> 'delete', $c['CoEnrollmentAttribute']['id'], 'coef' =>
$this->request->params['named']['coef'])) . '\')";>' . _txt('op.delete') .
'</button>';
+ print '<button class="deletebutton" title="' . _txt('op.delete')
. '" onclick="javascript:js_confirm_delete(\'' .
_jtxt(Sanitize::html($c['CoEnrollmentAttribute']['label'])) . '\', \'' .
$this->Html->url(array('controller' => 'co_enrollment_attributes', 'action'
=> 'delete', $c['CoEnrollmentAttribute']['id'], 'coef' => $vv_coefid)) .
'\')";>' . _txt('op.delete') . '</button>';
?>
<?php ; ?>
</td>
Modified: registry/trunk/app/View/CoPetitions/petition-attributes.inc
===================================================================
--- registry/trunk/app/View/CoPetitions/petition-attributes.inc 2013-06-28
23:15:34 UTC (rev 551)
+++ registry/trunk/app/View/CoPetitions/petition-attributes.inc 2013-07-05
13:29:31 UTC (rev 552)
@@ -2,7 +2,7 @@
/**
* COmanage Registry Petition Fields (used to display both petitions and
petition-based invitations)
*
- * Copyright (C) 2012 University Corporation for Advanced Internet
Development, Inc.
+ * Copyright (C) 2012-13 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
@@ -14,7 +14,7 @@
* KIND, either express or implied. See the License for the specific
language governing
* permissions and limitations under the License.
*
- * @copyright Copyright (C) 2012 University Corporation for Advanced
Internet Development, Inc.
+ * @copyright Copyright (C) 2012-13 University Corporation for Advanced
Internet Development, Inc.
* @link http://www.internet2.edu/comanage COmanage Project
* @package registry
* @since COmanage Registry v0.7
@@ -69,15 +69,17 @@
switch($ruleType) {
case 'inList':
// This is a select
- $attrs = array();
- // $attrs['value'] =
(isset($co_person_roles[0]['CoPersonRole']['affiliation'])
- // ?
$co_person_roles[0]['CoPersonRole']['affiliation']
- // : "M");
- $attrs['empty'] = !$ea['required'];
+ $args = array();
+ // Set a default value if provided
+ if(isset($ea['default'])) {
+ $args['value'] = $ea['default'];
+ $args['disabled'] = !$ea['modifiable'];
+ }
+ $args['empty'] = !$ea['required'];
print $this->Form->select($fieldName,
$ea['select'],
- $attrs);
+ $args);
if($this->Form->isFieldError($fieldName)) {
print $this->Form->error($fieldName);
@@ -92,8 +94,16 @@
elseif($ea['field'] == 'valid_until')
$c = 'datepicker-c';
- print $this->Form->text($fieldName, array('class' => $c));
+ $args = array();
+ $args['class'] = $c;
+ if(isset($ea['default'])) {
+ $args['default'] = $ea['default'];
+ $args['disabled'] = !$ea['modifiable'];
+ }
+
+ print $this->Form->text($fieldName, $args);
+
if($this->Form->isFieldError($fieldName)) {
print $this->Form->error($fieldName);
}
@@ -107,6 +117,7 @@
// Use a provided default value, if one specified
if(isset($ea['default'])) {
$args['default'] = $ea['default'];
+ $args['disabled'] = !$ea['modifiable'];
}
if($permissions['match']
Modified: registry/trunk/app/View/Layouts/default.ctp
===================================================================
--- registry/trunk/app/View/Layouts/default.ctp 2013-06-28 23:15:34 UTC (rev
551)
+++ registry/trunk/app/View/Layouts/default.ctp 2013-07-05 13:29:31 UTC (rev
552)
@@ -317,6 +317,15 @@
selectOtherMonths: true
});
+ $(".datepicker-m").datepicker({
+ changeMonth: true,
+ dateFormat: "mm-dd",
+ numberOfMonths: 1,
+ showButtonPanel: false,
+ showOtherMonths: true,
+ selectOtherMonths: true
+ });
+
$(".datepicker-u").datepicker({
changeMonth: true,
changeYear: true,
- [comanage-dev] r552 - in registry/trunk/app: Config/Schema Controller Lib Model View/CoEnrollmentAttributes View/CoPetitions View/Layouts, svnlog, 07/05/2013
Archive powered by MHonArc 2.6.16.