Skip to content

Commit

Permalink
Preventing saving the hits counter unless its resetted.
Browse files Browse the repository at this point in the history
Prevents a save2copy to also copy the hits.
  • Loading branch information
Thomas Hunziker committed Aug 18, 2015
1 parent ba33fcf commit a9e25ab
Show file tree
Hide file tree
Showing 9 changed files with 76 additions and 28 deletions.
11 changes: 8 additions & 3 deletions com_sermonspeaker/admin/models/forms/serie.xml
Expand Up @@ -122,10 +122,15 @@
filter="user_utc"
/>

<field name="hits" type="hits"
label="JGLOBAL_HITS" description="COM_SERMONSPEAKER_FIELD_HITS_DESC"
<field
name="hits"
type="hits"
label="JGLOBAL_HITS"
description="COM_SERMONSPEAKER_FIELD_HITS_DESC"
class="readonly"
readonly="true" />
readonly="true"
filter="unset"
/>

<field name="version" type="text"
label="COM_SERMONSPEAKER_FIELD_VERSION_LABEL" size="6" description="COM_SERMONSPEAKER_FIELD_VERSION_DESC"
Expand Down
1 change: 1 addition & 0 deletions com_sermonspeaker/admin/models/forms/sermon.xml
Expand Up @@ -199,6 +199,7 @@
description="COM_SERMONSPEAKER_FIELD_HITS_DESC"
class="readonly"
readonly="true"
filter="unset"
/>

<field
Expand Down
44 changes: 25 additions & 19 deletions com_sermonspeaker/admin/models/forms/speaker.xml
Expand Up @@ -111,33 +111,39 @@
size="22" />

<field
name="publish_up"
type="calendar"
label="JGLOBAL_FIELD_PUBLISH_UP_LABEL"
description="JGLOBAL_FIELD_PUBLISH_UP_DESC"
format="%Y-%m-%d %H:%M:%S"
filter="user_utc"
/>
name="publish_up"
type="calendar"
label="JGLOBAL_FIELD_PUBLISH_UP_LABEL"
description="JGLOBAL_FIELD_PUBLISH_UP_DESC"
format="%Y-%m-%d %H:%M:%S"
filter="user_utc"
/>

<field
name="publish_down"
type="calendar"
label="JGLOBAL_FIELD_PUBLISH_DOWN_LABEL"
description="JGLOBAL_FIELD_PUBLISH_DOWN_DESC"
format="%Y-%m-%d %H:%M:%S"
filter="user_utc"
/>

<field name="hits" type="hits"
label="JGLOBAL_HITS" description="COM_SERMONSPEAKER_FIELD_HITS_DESC"
name="publish_down"
type="calendar"
label="JGLOBAL_FIELD_PUBLISH_DOWN_LABEL"
description="JGLOBAL_FIELD_PUBLISH_DOWN_DESC"
format="%Y-%m-%d %H:%M:%S"
filter="user_utc"
/>

<field
name="hits"
type="hits"
label="JGLOBAL_HITS"
description="COM_SERMONSPEAKER_FIELD_HITS_DESC"
class="readonly"
readonly="true" />
readonly="true"
filter="unset"
/>

<field name="version" type="text"
label="COM_SERMONSPEAKER_FIELD_VERSION_LABEL" size="6" description="COM_SERMONSPEAKER_FIELD_VERSION_DESC"
class="readonly"
readonly="true"
filter="unset" />
filter="unset"
/>
</fieldset>

<fieldset name="detail">
Expand Down
6 changes: 6 additions & 0 deletions com_sermonspeaker/admin/models/serie.php
Expand Up @@ -106,6 +106,12 @@ public function getForm($data = array(), $loadData = true)
$form->setFieldAttribute('state', 'filter', 'unset');
}

// Modify the form to allow resetting the hits counter.
if (isset($data['hits']) && $data['hits'] == 0)
{
$form->setFieldAttribute('hits', 'filter', '');
}

return $form;
}

Expand Down
6 changes: 6 additions & 0 deletions com_sermonspeaker/admin/models/sermon.php
Expand Up @@ -217,6 +217,12 @@ public function getForm($data = array(), $loadData = true)
$form->setFieldAttribute('podcast', 'filter', 'unset');
}

// Modify the form to allow resetting the hits counter.
if (isset($data['hits']) && $data['hits'] == 0)
{
$form->setFieldAttribute('hits', 'filter', '');
}

return $form;
}

Expand Down
6 changes: 6 additions & 0 deletions com_sermonspeaker/admin/models/speaker.php
Expand Up @@ -99,6 +99,12 @@ public function getForm($data = array(), $loadData = true)
$form->setFieldAttribute('state', 'filter', 'unset');
}

// Modify the form to allow resetting the hits counter.
if (isset($data['hits']) && $data['hits'] == 0)
{
$form->setFieldAttribute('hits', 'filter', '');
}

return $form;
}

Expand Down
10 changes: 8 additions & 2 deletions com_sermonspeaker/site/models/forms/serie.xml
Expand Up @@ -94,8 +94,14 @@
format="%Y-%m-%d %H:%M:%S" filter="user_utc"
readonly="true" />

<field name="hits" type="hits" class="readonly"
label="JGLOBAL_HITS" description="COM_SERMONSPEAKER_FIELD_HITS_DESC" />
<field
name="hits"
type="hits"
class="readonly"
label="JGLOBAL_HITS"
description="COM_SERMONSPEAKER_FIELD_HITS_DESC"
filter="unset"
/>

</fieldset>

Expand Down
10 changes: 8 additions & 2 deletions com_sermonspeaker/site/models/forms/sermon.xml
Expand Up @@ -137,8 +137,14 @@
format="%Y-%m-%d %H:%M:%S" filter="user_utc"
readonly="true" />

<field name="hits" type="hits" class="readonly"
label="JGLOBAL_HITS" description="COM_SERMONSPEAKER_FIELD_HITS_DESC" />
<field
name="hits"
type="hits"
class="readonly"
label="JGLOBAL_HITS"
description="COM_SERMONSPEAKER_FIELD_HITS_DESC"
filter="unset"
/>

</fieldset>

Expand Down
10 changes: 8 additions & 2 deletions com_sermonspeaker/site/models/forms/speaker.xml
Expand Up @@ -99,8 +99,14 @@
format="%Y-%m-%d %H:%M:%S" filter="user_utc"
readonly="true" />

<field name="hits" type="hits" class="readonly"
label="JGLOBAL_HITS" description="COM_SERMONSPEAKER_FIELD_HITS_DESC" />
<field
name="hits"
type="hits"
class="readonly"
label="JGLOBAL_HITS"
description="COM_SERMONSPEAKER_FIELD_HITS_DESC"
filter="unset"
/>

</fieldset>

Expand Down

0 comments on commit a9e25ab

Please sign in to comment.