These function solely to create and manage the data.
Signed-off-by: Bill Erickson <berick@esilibrary.com>
</permacrud>
</class>
- <class id="acqfc" controller="open-ils.cstore" oils_obj:fieldmapper="acq::fiscal_calendar" oils_persist:tablename="acq.fiscal_calendar" reporter:label="Fiscal Calendar">
+ <class id="acqfc" controller="open-ils.cstore open-ils.pcrud" oils_obj:fieldmapper="acq::fiscal_calendar" oils_persist:tablename="acq.fiscal_calendar" reporter:label="Fiscal Calendar">
<fields oils_persist:primary="id" oils_persist:sequence="acq.fiscal_calendar_id_seq">
<field reporter:label="Fiscal Calendar ID" name="id" reporter:datatype="id" reporter:selector='name'/>
<field reporter:label="Fiscal Calendar Name" name="name" reporter:datatype="text"/>
<links>
<link field="years" reltype="has_many" map="" key="calendar" class="acqfy"/>
</links>
- <!--
- For now, we don't have pcrud as one of the controllers, so the permacrud section is moot.
- But here's what it should look like if we ever do use pcrud.
- -->
<permacrud xmlns="http://open-ils.org/spec/opensrf/IDL/permacrud/v1">
<actions>
<create permission="ADMIN_ACQ_FISCAL_YEAR" global_required="true"/>
</permacrud>
</class>
- <class id="acqfy" controller="open-ils.cstore" oils_obj:fieldmapper="acq::fiscal_year" oils_persist:tablename="acq.fiscal_year" reporter:label="Fiscal Year">
+ <class id="acqfy" controller="open-ils.cstore open-ils.pcrud" oils_obj:fieldmapper="acq::fiscal_year" oils_persist:tablename="acq.fiscal_year" reporter:label="Fiscal Year">
<fields oils_persist:primary="id" oils_persist:sequence="acq.fiscal_year_id_seq">
<field reporter:label="Fiscal Year ID" name="id" reporter:datatype="id" reporter:selector='year'/>
<field reporter:label="Calendar" name="calendar" reporter:datatype="link"/>
<links>
<link field="calendar" reltype="has_a" key="id" map="" class="acqfc"/>
</links>
- <!--
- For now, we don't have pcrud as one of the controllers, so the permacrud section is moot.
- But here's what it should look like if we ever do use pcrud.
- -->
<permacrud xmlns="http://open-ils.org/spec/opensrf/IDL/permacrud/v1">
<actions>
<create permission="ADMIN_ACQ_FISCAL_YEAR" global_required="true"/>
--- /dev/null
+[% WRAPPER base.tt2 %]
+[% ctx.page_title = l('Fiscal Calendar') %]
+<div dojoType="dijit.layout.ContentPane" layoutAlign="client">
+ <div dojoType="dijit.layout.ContentPane" layoutAlign="top" class='oils-header-panel'>
+ <div>[% l('Fiscal Calendar') %]</div>
+ <div>
+ <button dojoType='dijit.form.Button' onClick='acqfcGrid.showCreateDialog()'>[% l('New Calendar') %]</button>
+ <button dojoType='dijit.form.Button' onClick='acqfcGrid.deleteSelected()'>[% l('Delete Selected') %]</button>
+ </div>
+ </div>
+ <table jsId="acqfcGrid"
+ dojoType="openils.widget.AutoGrid"
+ fieldOrder="['id', 'name']"
+ query="{id: '*'}"
+ defaultCellWidth='"auto"'
+ fmClass='acqfc'
+ showPaginator='true'
+ editOnEnter='true'>
+ <thead>
+ <tr><th field='name' get='getName' formatter='formatName'/></tr>
+ </thead>
+ </table>
+ </div>
+</div>
+<script>
+ dojo.require('openils.widget.AutoGrid');
+ function getName(rowIdx, item) {
+ if(!item) return '';
+ var id = this.grid.store.getValue(item, 'id');
+ var name = this.grid.store.getValue(item, 'name');
+ return id + ':' + name;
+ }
+ function formatName(nameId) {
+ var chunks = nameId.split(':');
+ if(!chunks && chunks[0]) return ''
+ return "<a href='fiscal_year/" + chunks[0] + "'>" + chunks[1] + "</a>";
+ }
+ dojo.addOnLoad(function() { acqfcGrid.loadAll(); });
+</script>
+[% END %]
+
+
--- /dev/null
+[% WRAPPER base.tt2 %]
+[% ctx.page_title = l('Fiscal Year') %]
+<div dojoType="dijit.layout.ContentPane" layoutAlign="client">
+ <div dojoType="dijit.layout.ContentPane" layoutAlign="top" class='oils-header-panel'>
+ <div>[% l('Fiscal Year') %]</div>
+ <div>
+ <button dojoType='dijit.form.Button' onClick='acqfyGrid.showCreateDialog()'>[% l('New Fiscal Year') %]</button>
+ <button dojoType='dijit.form.Button' onClick='acqfyGrid.deleteSelected()'>[% l('Delete Selected') %]</button>
+ </div>
+ </div>
+ <h2><i id='calendar-name'></i></h2>
+ <table jsId="acqfyGrid"
+ dojoType="openils.widget.AutoGrid"
+ fieldOrder="['id', 'calendar', 'year', 'year_begin', 'year_end']"
+ suppressEditFields="['id']"
+ query="{id: '*'}"
+ defaultCellWidth='"auto"'
+ fmClass='acqfy'
+ showPaginator='true'
+ editOnEnter='true'>
+ </table>
+ </div>
+</div>
+<script>
+ dojo.require('openils.widget.AutoGrid');
+ dojo.require('openils.widget.AutoFieldWidget');
+ dojo.require('openils.PermaCrud');
+ dojo.addOnLoad(function() {
+ var calendarId = '[% ctx.page_args.0 %]';
+ if (calendarId) {
+ var calendar = new openils.PermaCrud().retrieve('acqfc', calendarId);
+ dojo.byId('calendar-name').innerHTML = calendar.name();
+ acqfyGrid.overrideEditWidgets.calendar =
+ new dijit.form.TextBox({disabled : true, value : calendarId});
+ }
+ acqfyGrid.loadAll(
+ {order_by : {acqfy : 'year DESC'}},
+ {calendar : calendarId}
+ );
+ });
+</script>
+[% END %]
+
+