[ui,logic] Expose source title in the source form

This commit is contained in:
amercader 2012-02-15 11:49:59 +00:00
parent 3489a004ad
commit e03c2545ca
4 changed files with 16 additions and 4 deletions

View File

@ -189,7 +189,7 @@ def create_harvest_source(data_dict):
source.url = data['url']
source.type = data['type']
opt = ['active','description','user_id','publisher_id','config']
opt = ['active','title','description','user_id','publisher_id','config']
for o in opt:
if o in data and data[o] is not None:
source.__setattr__(o,data[o])
@ -216,9 +216,9 @@ def edit_harvest_source(source_id,data_dict):
Session.rollback()
raise ValidationError(errors,_error_summary(errors))
fields = ['url','type','description','user_id','publisher_id']
fields = ['url','title','type','description','user_id','publisher_id']
for f in fields:
if f in data and data[f] is not None and data[f] != '':
if f in data and data[f] is not None:
source.__setattr__(f,data[f])
if 'active' in data_dict:

View File

@ -17,7 +17,8 @@ def default_harvest_source_schema():
'id': [ignore_missing, unicode, harvest_source_id_exists],
'url': [not_empty, unicode, harvest_source_url_validator],
'type': [not_empty, unicode, harvest_source_type_exists],
'description': [ignore_missing],
'title': [ignore_missing,unicode],
'description': [ignore_missing,unicode],
'active': [ignore_missing,harvest_source_active_validator],
'user_id': [ignore_missing],
'publisher_id': [ignore_missing],

View File

@ -35,6 +35,12 @@
</py:for>
</ul>
</dd>
<dt class="harvest-source-title"><label class="field_req" for="title">Title</label></dt>
<dd class="harvest-source-title"><input id="title" name="title" size="80" type="text" value="${data.get('title', '')}" /></dd>
<dd class="harvest-source-title field_error" py:if="errors.get('title', '')">${errors.get('title', '')}</dd>
<dd class="harvest-source-title instructions basic">This will be shown as the datasets source.</dd>
<dt><label class="field_opt" for="description">Description</label></dt>
<dd><textarea id="description" name="description" cols="30" rows="2" style="height:75px">${data.get('description', '')}</textarea></dd>
<dd class="instructions basic">You can add your own notes here about what the URL above represents to remind you later.</dd>

View File

@ -33,6 +33,11 @@
<th>Active</th>
<td>${c.source.active}</td>
</tr>
<tr py:if="c.source.title">
<th>Title</th>
<td>${c.source.title}</td>
</tr>
<tr>
<th>Description</th>
<td>${c.source.description}</td>