--- /dev/null
+[% WRAPPER 'base.tt2' %]
+<script type="text/javascript" src='[% ctx.media_prefix %]/js/ui/default/serial/edit_siss.js'></script>
+<script type="text/javascript" src="[% ctx.media_prefix %]/js/ui/default/serial/subscription/caption_and_pattern.js"></script>
+<script type="text/javascript" src="[% ctx.media_prefix %]/js/ui/default/serial/subscription/issuance.js"></script>
+<script type="text/javascript">
+ dojo.require('openils.Util');
+ [% ctx.page_args = ctx.page_args.reverse %]
+ var siss_id = '[% ctx.page_args.0 %]';
+ var ssub_id = '[% ctx.page_args.1 %]';
+ openils.Util.addOnLoad(function() { drawSiss(siss_id, ssub_id) });
+</script>
+
+<div dojoType="dijit.layout.ContentPane" layoutAlign="client">
+ <div id='edit-pane'> </div>
+</div>
+
+[% END %]
--- /dev/null
+dojo.require('dijit.form.TextBox');
+dojo.require('dijit.form.Button');
+dojo.require('dijit.form.FilteringSelect');
+dojo.require('openils.PermaCrud');
+dojo.require('openils.widget.EditPane');
+dojo.require("openils.widget.HoldingCode");
+
+dojo.requireLocalization('openils.serial', 'serial');
+var localeStrings = dojo.i18n.getLocalization('openils.serial', 'serial');
+
+// fresh_scap_selector needs these defined as globals XXX rework?
+var pcrud;
+var sub_id;
+
+function drawSiss(siss_id, ssub_id) {
+ var iss_grid = { overrideEditWidgets : {} };
+
+ iss_grid.overrideEditWidgets.creator =
+ new dijit.form.TextBox({"disabled": true});
+ iss_grid.overrideEditWidgets.creator.shove = {
+ "create": openils.User.user.id()
+ };
+
+ iss_grid.overrideEditWidgets.editor =
+ new dijit.form.TextBox({
+ "disabled": true, "value": openils.User.user.id()
+ });
+
+ iss_grid.overrideEditWidgets.holding_type =
+ new dijit.form.TextBox({"disabled": true});
+
+ var pane_args = {
+ hideActionButtons : true,
+ overrideWidgets : iss_grid.overrideEditWidgets
+ }
+
+ var button_label;
+ pcrud = new openils.PermaCrud();
+ if (siss_id == 'new') {
+ sub_id = ssub_id;
+ pane_args.fmClass = 'siss';
+ pane_args.mode = 'create';
+ pane_args.onPostSubmit = function(req, cudResults){
+ //TODO: better success check
+ alert(localeStrings.SAVE_SUCCESSFUL);
+ //location.href = location.href.replace(/new\/.*/, cudResults[0].id());
+ parent.document.getElementById(window.name).refresh_command();
+ }
+ button_label = localeStrings.CREATE_ISSUANCE;
+ } else {
+ pane_args.fmObject = pcrud.retrieve('siss', siss_id);
+ pane_args.onPostSubmit = function(req, cudResults){
+ //alert('req: '+req.toSource());
+ //alert('cudResults: '+cudResults);
+ //TODO: better success check
+ alert(localeStrings.SAVE_SUCCESSFUL);
+ parent.document.getElementById(window.name).refresh_command();
+ }
+ sub_id = pane_args.fmObject.subscription();
+ button_label = localeStrings.MODIFY_ISSUANCE;
+ }
+ iss_grid.overrideEditWidgets.subscription =
+ new dijit.form.TextBox({
+ "disabled": true, "value": sub_id
+ });
+ fresh_scap_selector(iss_grid); // embed scap wizard into generated form
+
+ var pane = new openils.widget.EditPane(
+ pane_args, dojo.byId('edit-pane')
+ );
+
+ pane.fieldOrder = ['subscription','creator','editor','label','date_published','caption_and_pattern','holding_type'];
+ pane.suppressFields = ['id', 'holding_link_id','create_date','edit_date'];
+ pane.startup();
+
+ var tbody = pane.table.getElementsByTagName('tbody')[0];
+ var applySpan = document.createElement('span');
+ tbody.appendChild(document.createElement('tr').appendChild(document.createElement('td').appendChild(applySpan)));
+ new dijit.form.Button({
+ label: button_label,
+ onClick: function() {pane.performAutoEditAction();}
+ }, applySpan);
+
+}
var obj = this;
try {
$('serial_manage_subs_editor_deck').selectedIndex = obj.editor_indexes[type];
- var editor_type = type + '_editor';
- if (typeof obj[editor_type] == 'undefined') {
- JSAN.use('serial.' + editor_type);
- obj[editor_type] = new serial[editor_type]();
- }
- params.do_edit = true;
- params.handle_update = true;
- params.trigger_refresh = true;
- if (mode == 'add') {
- params.refresh_command = function () {obj.refresh_list();};
+ if (type == "siss") { // begin transition from xul to dojo editors
+ var iframe = dojo.byId('alt_siss_editor');
+ var src;
+ if (mode == "add") {
+ src = '/eg/serial/edit_siss/new/' + params.sisses[0].subscription();
+ iframe.refresh_command = function () {obj.refresh_list();};
+ } else {
+ src = '/eg/serial/edit_siss/' + params.siss_ids[0];
+ iframe.refresh_command = function () { /* TODO: redraw tree node */ };
+ }
+ iframe.setAttribute("src", src);
} else {
- params.refresh_command = function () {obj.remap_node(type, this);};
+ var editor_type = type + '_editor';
+ if (typeof obj[editor_type] == 'undefined') {
+ JSAN.use('serial.' + editor_type);
+ obj[editor_type] = new serial[editor_type]();
+ }
+
+ params.do_edit = true;
+ params.handle_update = true;
+ params.trigger_refresh = true;
+ if (mode == 'add') {
+ params.refresh_command = function () {obj.refresh_list();};
+ } else {
+ params.refresh_command = function () {obj.remap_node(type, this);};
+ }
+
+ obj[editor_type].init(params);
}
-
- obj[editor_type].init(params);
} catch(E) {
obj.error.standard_unexpected_error_alert('editor_init() error',E);
}
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<vbox flex="1" id="serial_siss_editor_panel" class="my_overflow">
- <vbox id="brief_display_box"/>
-
- <hbox flex="1" style="overflow: auto">
- <vbox flex="1" id="before_splitter1" oils_persist="width">
- <label value="Issuance" style="font-weight: bold; font-size: large"/>
- <vbox id="siss_editor_left_pane" flex="1"/>
- </vbox>
- <splitter id="splitter1" oils_persist="state hidden" oils_persist_peers="before_splitter1 after_splitter1"><grippy /></splitter>
- <vbox flex="1" id="after_splitter1" oils_persist="width">
- <vbox id="siss_editor_middle_pane"/>
- </vbox>
- <splitter id="splitter2" oils_persist="state hidden" oils_persist_peers="after_splitter1 after_splitter2"><grippy /></splitter>
- <vbox flex="1" id="after_splitter2" oils_persist="width">
- <vbox id="siss_editor_right_pane"/>
- </vbox>
- </hbox>
-
- <hbox id="siss_editor_nav">
- <spacer flex="1"/>
- <button id="siss_save" label="&staff.serial.siss_editor.modify.label;" hidden="true" accesskey="&staff.cat.copy_editor.save.accesskey;" oncommand="g.manage_subs.siss_editor.save()" />
- <!--<button id="cancel" label="&staff.cat.copy_editor.cancel.label;" accesskey="&staff.cat.copy_editor.cancel.accesskey;" oncommand="window.close();"/>-->
- </hbox>
-
- <spacer/>
+ <iframe flex="1" id="alt_siss_editor" name="alt_siss_editor"/>
</vbox>
</overlay>