Author: jablko
Date: Mon Oct 25 08:37:14 2010
New Revision: 8461
Log:
s/$term/$resource
Modified:
trunk/apps/qubit/modules/term/actions/editAction.class.php
trunk/apps/qubit/modules/term/templates/editSuccess.php
Modified: trunk/apps/qubit/modules/term/actions/editAction.class.php
==============================================================================
--- trunk/apps/qubit/modules/term/actions/editAction.class.php Mon Oct 25
08:33:59 2010 (r8460)
+++ trunk/apps/qubit/modules/term/actions/editAction.class.php Mon Oct 25
08:37:14 2010 (r8461)
@@ -46,7 +46,7 @@
{
case 'altLabels':
$criteria = new Criteria;
- $criteria->add(QubitOtherName::OBJECT_ID, $this->term->id);
+ $criteria->add(QubitOtherName::OBJECT_ID, $this->resource->id);
$criteria->add(QubitOtherName::TYPE_ID,
QubitTerm::ALTERNATIVE_LABEL_ID);
$value = $defaults = array();
@@ -62,14 +62,14 @@
break;
case 'code':
- $this->form->setDefault('code', $this->term->code);
+ $this->form->setDefault('code', $this->resource->code);
$this->form->setValidator('code', new sfValidatorString);
$this->form->setWidget('code', new sfWidgetFormInput);
break;
case 'name':
- $this->form->setDefault('name', $this->term->name);
+ $this->form->setDefault('name', $this->resource->name);
$this->form->setValidator('name', new
sfValidatorString(array('required' => true), array('required' =>
$this->context->i18n->__('This is a mandatory element.'))));
$this->form->setWidget('name', new sfWidgetFormInput);
@@ -82,13 +82,13 @@
break;
case 'parent':
- $this->form->setDefault('parent',
$this->context->routing->generate(null, array($this->term->parent, 'module' =>
'term')));
+ $this->form->setDefault('parent',
$this->context->routing->generate(null, array($this->resource->parent, 'module'
=> 'term')));
$this->form->setValidator('parent', new sfValidatorString);
$choices = array();
- if (isset($this->term->parent))
+ if (isset($this->resource->parent))
{
- $choices[$this->context->routing->generate(null,
array($this->term->parent, 'module' => 'term'))] = $this->term->parent;
+ $choices[$this->context->routing->generate(null,
array($this->resource->parent, 'module' => 'term'))] = $this->resource->parent;
}
$this->form->setWidget('parent', new
sfWidgetFormSelect(array('choices' => $choices)));
@@ -96,7 +96,7 @@
break;
case 'relatedTerms':
- $this->relations =
QubitRelation::getBySubjectOrObjectId($this->term->getId(), array('typeId' =>
QubitTerm::TERM_RELATION_ASSOCIATIVE_ID));
+ $this->relations =
QubitRelation::getBySubjectOrObjectId($this->resource->getId(), array('typeId'
=> QubitTerm::TERM_RELATION_ASSOCIATIVE_ID));
$value = $choices = array();
foreach ($this->relations as $relation)
@@ -111,13 +111,13 @@
break;
case 'taxonomy':
- $this->form->setDefault('taxonomy',
$this->context->routing->generate(null, array($this->term->taxonomy, 'module'
=> 'taxonomy')));
+ $this->form->setDefault('taxonomy',
$this->context->routing->generate(null, array($this->resource->taxonomy,
'module' => 'taxonomy')));
$this->form->setValidator('taxonomy', new
sfValidatorString(array('required' => true), array('required' =>
$this->context->i18n->__('This is a mandatory element.'))));
$choices = array();
- if (isset($this->term->taxonomy))
+ if (isset($this->resource->taxonomy))
{
- $choices[$this->context->routing->generate(null,
array($this->term->taxonomy, 'module' => 'taxonomy'))] = $this->term->taxonomy;
+ $choices[$this->context->routing->generate(null,
array($this->resource->taxonomy, 'module' => 'taxonomy'))] =
$this->resource->taxonomy;
}
$this->form->setWidget('taxonomy', new
sfWidgetFormSelect(array('choices' => $choices)));
@@ -128,7 +128,7 @@
case 'scopeNote':
case 'sourceNote':
$criteria = new Criteria;
- $criteria->add(QubitNote::OBJECT_ID, $this->term->id);
+ $criteria->add(QubitNote::OBJECT_ID, $this->resource->id);
switch ($name)
{
@@ -199,7 +199,7 @@
$otherName->name = $newName;
$this->updatedLabel = true;
}
- $this->term->otherNames[] = $otherName;
+ $this->resource->otherNames[] = $otherName;
}
// Delete any names that are missing from form data
@@ -217,7 +217,7 @@
case 'taxonomy':
$params =
$this->context->routing->parse(Qubit::pathInfo($this->form->getValue($field->getName())));
$fieldId = (isset($params['id']) && 0 < strlen($params['id'])) ?
$params['id'] : null;
- $this->term[$field->getName().'Id'] = $fieldId;
+ $this->resource[$field->getName().'Id'] = $fieldId;
break;
@@ -265,7 +265,7 @@
}
$note->content = $thisContent;
- $this->term->notes[] = $note;
+ $this->resource->notes[] = $note;
}
}
@@ -289,7 +289,7 @@
// Test to make sure term doesn't already exist
$criteria = new Criteria;
$criteria->addJoin(QubitTerm::ID, QubitTermI18n::ID);
- $criteria->add(QubitTerm::TAXONOMY_ID, $this->term->taxonomyId);
+ $criteria->add(QubitTerm::TAXONOMY_ID,
$this->resource->taxonomyId);
$criteria->add(QubitTermI18n::NAME, $thisName);
$criteria->add(QubitTermI18n::CULTURE,
$this->context->user->getCulture());
if (0 < count(QubitTermI18n::get($criteria)))
@@ -299,10 +299,10 @@
// Add term as child
$nt = new QubitTerm;
- $nt->taxonomyId = $this->term->taxonomyId;
+ $nt->taxonomyId = $this->resource->taxonomyId;
$nt->name = $thisName;
- $this->term->termsRelatedByparentId[] = $nt;
+ $this->resource->termsRelatedByparentId[] = $nt;
}
}
@@ -310,14 +310,14 @@
case 'name':
- if (!$this->term->isProtected())
+ if (!$this->resource->isProtected())
{
- $oldName = $this->term->name;
+ $oldName = $this->resource->name;
$newName = $this->form->getValue('name');
if ($oldName != $newName)
{
- $this->term->name = $newName;
+ $this->resource->name = $newName;
$this->updatedLabel = true;
}
}
@@ -354,13 +354,13 @@
$relation->objectId = $id;
$relation->typeId = QubitTerm::TERM_RELATION_ASSOCIATIVE_ID;
- $this->term->relationsRelatedBysubjectId[] = $relation;
+ $this->resource->relationsRelatedBysubjectId[] = $relation;
}
break;
default:
- $this->term[$field->getName()] =
$this->form->getValue($field->getName());
+ $this->resource[$field->getName()] =
$this->form->getValue($field->getName());
}
}
@@ -378,12 +378,12 @@
// Assign root node as parent, if another parent (broad-term) is not
// selected
- if (!isset($this->term->parent))
+ if (!isset($this->resource->parent))
{
- $this->term->parentId = QubitTerm::ROOT_ID;
+ $this->resource->parentId = QubitTerm::ROOT_ID;
}
- $this->term->save();
+ $this->resource->save();
// Update related info objects when term labels changes
if ($this->updatedLabel)
@@ -397,24 +397,24 @@
$this->form = new sfForm;
$this->form->getValidatorSchema()->setOption('allow_extra_fields', true);
- $this->term = new QubitTerm;
+ $this->resource = new QubitTerm;
if (isset($request->id))
{
- $this->term = QubitTerm::getById($request->id);
+ $this->resource = QubitTerm::getById($request->id);
- if (!$this->term instanceof QubitTerm)
+ if (!$this->resource instanceof QubitTerm)
{
$this->forward404();
}
// Check authorization
- if (!(QubitAcl::check($this->term, 'update') ||
QubitAcl::check($this->term, 'translate')))
+ if (!(QubitAcl::check($this->resource, 'update') ||
QubitAcl::check($this->resource, 'translate')))
{
QubitAcl::forwardUnauthorized();
}
// Add optimistic lock
- $this->form->setDefault('serialNumber', $this->term->serialNumber);
+ $this->form->setDefault('serialNumber', $this->resource->serialNumber);
$this->form->setValidator('serialNumber', new sfValidatorInteger);
$this->form->setWidget('serialNumber', new sfWidgetFormInputHidden);
@@ -425,20 +425,20 @@
if (isset($request->parent) && 0 < strlen($request->parent))
{
$params =
$this->context->routing->parse(Qubit::pathInfo($request->parent));
- $this->term->parentId = $params['id'];
+ $this->resource->parentId = $params['id'];
}
else
{
- $this->term->parentId = QubitTerm::ROOT_ID;
+ $this->resource->parentId = QubitTerm::ROOT_ID;
}
if (isset($request->taxonomyId))
{
- $this->term->taxonomyId = $request->taxonomyId;
+ $this->resource->taxonomyId = $request->taxonomyId;
}
// Check authorization to create term
- if (!QubitAcl::check($this->term, 'create', array('taxonomyId' =>
$request->taxonomyId)))
+ if (!QubitAcl::check($this->resource, 'create', array('taxonomyId' =>
$request->taxonomyId)))
{
QubitAcl::forwardUnauthorized();
}
@@ -460,14 +460,14 @@
{
$this->processForm();
- $this->redirect(array($this->term, 'module' => 'term'));
+ $this->redirect(array($this->resource, 'module' => 'term'));
}
}
}
protected function updateLinkedInfoObjects()
{
- foreach ($this->term->objectTermRelations as $item)
+ foreach ($this->resource->objectTermRelations as $item)
{
if ($item->object instanceof QubitInformationObject)
{
Modified: trunk/apps/qubit/modules/term/templates/editSuccess.php
==============================================================================
--- trunk/apps/qubit/modules/term/templates/editSuccess.php Mon Oct 25
08:33:59 2010 (r8460)
+++ trunk/apps/qubit/modules/term/templates/editSuccess.php Mon Oct 25
08:37:14 2010 (r8461)
@@ -1,9 +1,9 @@
<h1><?php echo (isset($sf_request->id)) ? __('Edit term') : __('Create term');
?></h1>
-<h1 class="label"><?php echo render_title($term) ?></h1>
+<h1 class="label"><?php echo render_title($resource) ?></h1>
<?php if (isset($sf_request->id)): ?>
- <?php echo $form->renderFormTag(url_for(array($term, 'module' => 'term',
'action' => 'edit'))) ?>
+ <?php echo $form->renderFormTag(url_for(array($resource, 'module' => 'term',
'action' => 'edit'))) ?>
<?php else: ?>
<?php echo $form->renderFormTag(url_for(array('module' => 'term', 'action'
=> 'create'))) ?>
<?php endif; ?>
@@ -18,20 +18,20 @@
<?php echo $form->taxonomy->renderLabel() ?>
<?php echo $form->taxonomy->renderError() ?>
<?php echo $form->taxonomy->render(array('class' =>
'form-autocomplete')) ?>
- <input class="list" type="hidden" value="<?php echo
url_for(array($term->taxonomy, 'module' => 'taxonomy', 'action' =>
'autocomplete')) ?>"/>
+ <input class="list" type="hidden" value="<?php echo
url_for(array($resource->taxonomy, 'module' => 'taxonomy', 'action' =>
'autocomplete')) ?>"/>
</div>
<div class="form-item">
- <?php echo $form->name->renderLabel() ?><?php if ($term->isProtected()):
?><?php echo image_tag('lock_mini') ?><?php endif; ?>
+ <?php echo $form->name->renderLabel() ?><?php if
($resource->isProtected()): ?><?php echo image_tag('lock_mini') ?><?php endif;
?>
- <?php if ($term->isProtected()): ?>
+ <?php if ($resource->isProtected()): ?>
<?php echo $form->name->render(array('class' => 'disabled', 'disabled'
=> 'disabled')) ?>
<?php else: ?>
<?php echo $form->name->renderError() ?>
- <?php if (0 < strlen($sourceCultureValue =
$term->getName(array('sourceCulture' => 'true'))) && $sf_user->getCulture() !=
$term->getSourceCulture()): ?>
+ <?php if (0 < strlen($sourceCultureValue =
$resource->getName(array('sourceCulture' => 'true'))) && $sf_user->getCulture()
!= $resource->getSourceCulture()): ?>
<div class="default-translation">
<?php echo $sourceCultureValue ?>
</div>
@@ -47,7 +47,7 @@
->label(__('Use for'))
->renderRow() ?>
- <?php echo render_field($form->code, $term) ?>
+ <?php echo render_field($form->code, $resource) ?>
<?php echo $form->scopeNote
->label(__('Scope note(s)'))
@@ -67,14 +67,14 @@
<legend><?php echo __('Relationships') ?></legend>
- <?php if (isset($term->id) || isset($term->taxonomyId)): ?>
+ <?php if (isset($resource->id) || isset($resource->taxonomyId)): ?>
<div class="form-item">
<?php echo $form->parent
->label(__('Broad term'))
->renderLabel() ?>
<?php echo $form->parent->render(array('class' =>
'form-autocomplete')) ?>
- <input class="list" type="hidden" value="<?php echo
url_for(array('module' => 'term', 'action' => 'autocomplete', 'taxonomyId' =>
$term->taxonomyId)) ?>"/>
+ <input class="list" type="hidden" value="<?php echo
url_for(array('module' => 'term', 'action' => 'autocomplete', 'taxonomyId' =>
$resource->taxonomyId)) ?>"/>
</div>
<div class="form-item">
@@ -82,7 +82,7 @@
->label(__('Related term(s)'))
->renderLabel() ?>
<?php echo $form->relatedTerms->render(array('class' =>
'form-autocomplete')) ?>
- <input class="list" type="hidden" value="<?php echo
url_for(array('module' => 'term', 'action' => 'autocomplete', 'taxonomyId' =>
$term->taxonomyId)) ?>"/>
+ <input class="list" type="hidden" value="<?php echo
url_for(array('module' => 'term', 'action' => 'autocomplete', 'taxonomyId' =>
$resource->taxonomyId)) ?>"/>
</div>
<?php endif; ?>
@@ -103,11 +103,11 @@
<div class="content">
<ul class="clearfix links">
<?php if (isset($sf_request->id)): ?>
- <li><?php echo link_to(__('Cancel'), array($term, 'module' =>
'term')) ?></li>
+ <li><?php echo link_to(__('Cancel'), array($resource, 'module' =>
'term')) ?></li>
<li><input class="form-submit" type="submit" value="<?php echo
__('Save') ?>"/></li>
<?php else: ?>
- <?php if (isset($term->taxonomy)): ?>
- <li><?php echo link_to(__('Cancel'), array($term->taxonomy, 'module'
=> 'taxonomy')) ?></li>
+ <?php if (isset($resource->taxonomy)): ?>
+ <li><?php echo link_to(__('Cancel'), array($resource->taxonomy,
'module' => 'taxonomy')) ?></li>
<?php else: ?>
<li><?php echo link_to(__('Cancel'), array('module' => 'taxonomy',
'action' => 'list')) ?></li>
<?php endif; ?>
--
You received this message because you are subscribed to the Google Groups
"Qubit Toolkit Commits" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/qubit-commits?hl=en.