From: erickson Date: Thu, 24 Apr 2008 00:38:57 +0000 (+0000) Subject: Merged revisions 9437,9440-9442 via svnmerge from X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=eff32249bf640b4559761d1dac386d415e41df0f;p=Evergreen.git Merged revisions 9437,9440-9442 via svnmerge from svn://svn.open-ils.org/ILS/trunk ........ r9437 | erickson | 2008-04-22 22:50:31 -0400 (Tue, 22 Apr 2008) | 1 line fixed what appears to be some copy paste errors. no longer requiring kwargs to be non-null on User create ........ r9440 | miker | 2008-04-23 08:23:10 -0400 (Wed, 23 Apr 2008) | 1 line adding helper views for overdue, running and pending reports ........ r9441 | erickson | 2008-04-23 11:13:45 -0400 (Wed, 23 Apr 2008) | 4 lines Removing dead code and their makefile counterparts ........ r9442 | miker | 2008-04-23 13:17:15 -0400 (Wed, 23 Apr 2008) | 1 line adding translation for description ........ git-svn-id: svn://svn.open-ils.org/ILS/branches/acq-experiment@9443 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- diff --git a/Open-ILS/src/Makefile b/Open-ILS/src/Makefile index c3ca073e91..7a09dd25a6 100644 --- a/Open-ILS/src/Makefile +++ b/Open-ILS/src/Makefile @@ -36,14 +36,6 @@ mod_xmlent: @echo $@ make -C apachemods mod_xmlent.so -oils_cgi: - @echo $@ - make -C apachemods oils_cgi.so - -oils_cgi-install: - @echo $@ - make -C apachemods oils_cgi-install - mod_xmlent-install: @echo $@ make -C apachemods mod_xmlent-install @@ -91,12 +83,6 @@ webcore-install: mkdir -p $(WEBDIR)/opac/extras/slimpac/ -libfieldmapper: - make -C apachemods libfieldmapper.so - -libfieldmapper-install: - make -C apachemods libfieldmapper-install - c_apps: @echo $@ make -C c-apps diff --git a/Open-ILS/src/apachemods/Makefile b/Open-ILS/src/apachemods/Makefile index 99e2536d91..88a84b7ec2 100644 --- a/Open-ILS/src/apachemods/Makefile +++ b/Open-ILS/src/apachemods/Makefile @@ -1,49 +1,14 @@ - LDLIBS += -lxml2 -lopensrf -lxslt -all: mod_xmlent.so libfieldmapper.so - -install: libfieldmapper-install mod_xmlent-install - - -apachetools.o: - cp ../../../OpenSRF/src/gateway/apachetools.o . - -json_xml.o: json_xml.c json_xml.h - -fieldmapper_lookup.o: fieldmapper_lookup.c fieldmapper_lookup.h - - -fieldmapper_lookup.c: - ./fieldmapper_lookup-gen.pl fieldmapper_lookup.c +all: mod_xmlent.so +install: mod_xmlent-install mod_xmlent.o: mod_xmlent.c mod_xmlent.so: mod_xmlent.o @echo $@ $(CC) $(LDFLAGS) $(LDLIBS) -shared -W1 mod_xmlent.o -lexpat -o $@ - -# ------------------------------------------------------ - -libfieldmapper.so: fieldmapper_lookup.o - @echo $@ - mkdir -p $(TMPDIR)/openils/ - cp fieldmapper_lookup.h $(TMPDIR)/openils/ - $(CC) $(LDFLAGS) $(LDLIBS) -shared -W1 fieldmapper_lookup.o -o $@ - cp libfieldmapper.so $(TMPDIR)/libfieldmapper.so - -# ------------------------------------------------------ - - -libfieldmapper-install: libfieldmapper.so - echo installing libfieldmapper.so - mkdir -p $(INCDIR)/ - @echo "Copying fieldmapper_lookup.h to $(INCDIR)" - cp fieldmapper_lookup.h $(INCDIR)/ - cp libfieldmapper.so $(LIBDIR)/libfieldmapper.so - - mod_xmlent-install: $(APXS2) -i -a -n xmlent mod_xmlent.so @@ -51,6 +16,3 @@ mod_xmlent-install: clean: echo $@ /bin/rm -f *.o *.so - /bin/rm -f fieldmapper_lookup.c - - diff --git a/Open-ILS/src/apachemods/fieldmapper_lookup-gen.pl b/Open-ILS/src/apachemods/fieldmapper_lookup-gen.pl deleted file mode 100755 index 8b17b3b0e5..0000000000 --- a/Open-ILS/src/apachemods/fieldmapper_lookup-gen.pl +++ /dev/null @@ -1,106 +0,0 @@ -#!/usr/bin/perl -use strict; -use lib qw(../perlmods/OpenILS/Utils/ ../../../OpenSRF/src/perlmods); - -use Fieldmapper (IDL => '../../examples/fm_IDL.xml'); - -my $map = {}; -$map = $Fieldmapper::fieldmap unless ($@); - -die $@ if ($@); - - -if(!$ARGV[0]) { - print "usage: $0 \n"; - exit; -} - -warn "Generating fieldmapper-c code...\n"; - - -print $ARGV[0] . "\n"; - -open(SOURCE, ">$ARGV[0]"); - -print SOURCE <{$object}->{hint}; - print SOURCE <<" C"; - else if (!strcmp(class, "$short_name")) { - switch (pos) { - C - for my $field (keys %{$map->{$object}->{fields}}) { - my $position = $map->{$object}->{fields}->{$field}->{position}; - print SOURCE <<" C"; - case $position: - return strdup("$field"); - break; - C - } - print SOURCE " }\n"; - print SOURCE " }\n"; -} -print SOURCE <{$object}->{hint}; - print SOURCE " else if (!strcmp(class, \"$short_name\")) return 1;\n"; -} -print SOURCE <{$object}->{hint}; - print SOURCE " else if (!strcmp(class, \"$short_name\")) {\n"; - for my $field (keys %{$map->{$object}->{fields}}) { - my $position = $map->{$object}->{fields}->{$field}->{position}; - print SOURCE " if (!strcmp(field,\"$field\")) return $position;\n"; - } - print SOURCE " }\n" -} - -print SOURCE " return -1;\n}\n"; - - - -print SOURCE <{$object}->{hint}; - $object =~ s/Fieldmapper:://o; - $object =~ s/::/./og; - print SOURCE "\tosrfListPush(__fm_classes, \"$short_name\");\n"; - print SOURCE "\tosrfListPush(__fm_classes, \"$object\");\n"; -} - -print SOURCE < -#include -#include "opensrf/osrf_list.h" -#include "opensrf/osrf_hash.h" - -int isFieldmapper(char*); -char * fm_pton(char *, int); -int fm_ntop(char *, char *); - -/** - * Returns a list of class names with the - * form [ hint, apiname, hint, apiname, ...] - * This list is static and should *not* be freed by the caller - */ -osrfList* fm_classes(); diff --git a/Open-ILS/src/apachemods/json_xml.c b/Open-ILS/src/apachemods/json_xml.c deleted file mode 100644 index 8b2195137b..0000000000 --- a/Open-ILS/src/apachemods/json_xml.c +++ /dev/null @@ -1,185 +0,0 @@ -#include "json_xml.h" -#include "fieldmapper_lookup.h" - -static void _rest_xml_output(growing_buffer*, const jsonObject*, char*, int, int); -static char* _escape_xml (const char*); - -char* json_string_to_xml(char* content) { - jsonObject * obj; - growing_buffer * res_xml; - int i; - - obj = json_parse_string( content ); - - if (!obj) - return NULL; - - res_xml = buffer_init(1024); - buffer_add(res_xml, ""); - - if(obj->type == JSON_ARRAY ) { - for( i = 0; i!= obj->size; i++ ) { - _rest_xml_output(res_xml, jsonObjectGetIndex(obj,i), NULL, 0,0); - } - } else { - _rest_xml_output(res_xml, obj, NULL, 0,0); - } - - buffer_add(res_xml, ""); - - jsonObjectFree(obj); - return buffer_release(res_xml); -} - -char* _escape_xml (const char* text) { - growing_buffer* b = buffer_init(256); - int len = strlen(text); - int i; - for (i = 0; i < len; i++) { - if (text[i] == '&') - buffer_add(b,"&"); - else if (text[i] == '<') - buffer_add(b,"<"); - else if (text[i] == '>') - buffer_add(b,">"); - else - buffer_add_char(b,text[i]); - } - return buffer_release(b); -} - -static void _rest_xml_output(growing_buffer* buf, const jsonObject* obj, - char * obj_class, int arr_index, int notag) { - char * tag; - int i; - - if(!obj) return; - - if (obj->classname) - notag = 1; - - if(isFieldmapper(obj_class)) { - tag = fm_pton(obj_class,arr_index); - } else if(obj_class) { - tag = strdup(obj_class); - } else { - tag = strdup("datum"); - } - - - /* add class hints if we have a class name */ - if(obj->classname) { - if(obj->type == JSON_NULL) { - buffer_fadd(buf,"<%s>", tag, obj->classname, tag); - free(tag); - return; - } else { - buffer_fadd(buf,"<%s>", tag, obj->classname); - } - } - - - /* now add the data */ - if(obj->type == JSON_NULL) { - if (!notag) - buffer_fadd(buf, "<%s/>",tag); - } else if(obj->type == JSON_BOOL && obj->value.b) { - if (notag) - buffer_add(buf, "true"); - else - buffer_fadd(buf, "<%s>true",tag,tag); - - } else if(obj->type == JSON_BOOL && ! obj->value.b) { - if (notag) - buffer_add(buf, "false"); - else - buffer_fadd(buf, "<%s>false",tag,tag); - - } else if (obj->type == JSON_STRING) { - if (notag) { - char * t = _escape_xml(jsonObjectGetString(obj)); - buffer_add(buf,t); - free(t); - } else { - char * t = _escape_xml(jsonObjectGetString(obj)); - buffer_fadd(buf,"<%s>%s",tag,t,tag); - free(t); - } - - } else if(obj->type == JSON_NUMBER) { - double x = jsonObjectGetNumber(obj); - if (notag) { - if (x == (int)x) - buffer_fadd(buf,"%d",(int)x); - else - buffer_fadd(buf,"%f",x); - } else { - if (x == (int)x) - buffer_fadd(buf,"<%s>%d",tag, (int)x,tag); - else - buffer_fadd(buf,"<%s>%f",tag, x,tag); - } - - } else if (obj->type == JSON_ARRAY) { - if (!notag) { - if(!isFieldmapper(obj_class)) - buffer_add(buf,""); - else - buffer_fadd(buf,"<%s>",tag); - } - - for( i = 0; i!= obj->size; i++ ) { - _rest_xml_output(buf, jsonObjectGetIndex(obj,i), obj->classname, i,0); - } - - if (!notag) { - if(!isFieldmapper(obj_class)) - buffer_add(buf,""); - else - buffer_fadd(buf,"",tag); - } - - } else if (obj->type == JSON_HASH) { - - if (!notag) { - if(!obj_class) - buffer_add(buf,""); - else - buffer_fadd(buf,"<%s>",tag); - } - - jsonObjectIterator* itr = jsonNewObjectIterator(obj); - jsonObjectNode* tmp; - while( (tmp = jsonObjectIteratorNext(itr)) ) { - if (notag) { - buffer_fadd(buf,"<%s>",tmp->key); - } else { - buffer_add(buf,""); - buffer_fadd(buf,"%s",tmp->key); - } - - _rest_xml_output(buf, tmp->item, NULL,0,notag); - - if (notag) { - buffer_fadd(buf,"",tmp->key); - } else { - buffer_add(buf,""); - } - } - jsonObjectIteratorFree(itr); - - if (!notag) { - if(!obj_class) - buffer_add(buf,""); - else - buffer_fadd(buf,"",tag); - } - - } - - if (obj->classname) - buffer_fadd(buf,"",tag); - - free(tag); -} - diff --git a/Open-ILS/src/apachemods/json_xml.h b/Open-ILS/src/apachemods/json_xml.h deleted file mode 100644 index e59996b1de..0000000000 --- a/Open-ILS/src/apachemods/json_xml.h +++ /dev/null @@ -1,9 +0,0 @@ - -#include -#include - -/* the JSON parser, so we can read the response we're XMLizing */ -#include -#include - -char* json_string_to_xml(char*); diff --git a/Open-ILS/src/apachemods/mod_xmlbuilder.h b/Open-ILS/src/apachemods/mod_xmlbuilder.h deleted file mode 100644 index 1b8a9ad2d4..0000000000 --- a/Open-ILS/src/apachemods/mod_xmlbuilder.h +++ /dev/null @@ -1,111 +0,0 @@ -#include "apachetools.h" -#include "opensrf/xml_utils.h" -#include "opensrf/osrf_hash.h" -#include "opensrf/osrf_list.h" -#include -#include -#include - -#define MODULE_NAME "xmlbuilder_module" /* our module name */ - -/* ------------------------------------------------------------------------------ */ -/* Apache config items. These are defaults which are only used if they are not - overriden by the Apache config or URL where appropriate */ -/* ------------------------------------------------------------------------------ */ -/* The default directory where the DTD files are stored */ -#define MODXMLB_DEFAULT_LOCALE_PARAM "locale" -#define MODXMLB_DEFAULT_BASE_DIR "/openils/var/web/locale" -#define MODXMLB_DEFAULT_LOCALE "en-US" -#define MODXMLB_DEFAULT_DTD NULL /* if defined, use this DTD only */ -/* ------------------------------------------------------------------------------ */ - -#define MODXMLB_CONFIG_LOCALE "XMLBuilderDefaultLocale" -#define MODXMLB_CONFIG_BASE_DIR "XMLBuilderBaseDir" -#define MODXMLB_CONFIG_POST_XSL "XMLBuilderPostXSL" -#define MODXMLB_CONFIG_DEFAULT_DTD "XMLBuilderDefaultDTD" -#define MODXMLB_CONFIG_LOCALE_PARAM "XMLBuilderLocaleParam" -#define MODXMLB_CONFIG_CONTENT_TYPE "XMLBuilderContentType" - - - -/* This module */ -module AP_MODULE_DECLARE_DATA xmlbuilder_module; - - -/* our config structure */ -typedef struct { - - char* baseDir; /* directory on disk where the DTD files live */ - char* defaultLocale; /* locale dir from config or default */ - char* defaultDtd; /* if defined, we load this DTD only */ - char* localeParam; /* the CGI param used to choose the locale dir dynamically */ - char* contentType; /* what content type to serve our files as (derfault is text/html) */ - xsltStylesheetPtr postXSL; /* if defined, run this XSL after parsing */ - -} xmlBuilderConfig; - -typedef struct { - xmlBuilderConfig* config; - xmlDocPtr doc; - osrfHash* entHash; - osrfHash* dtdHash; - osrfList* nodeList; - int xmlError; - char* xmlFile; -} xmlBuilderContext; - - - -xmlDocPtr xmlBuilderProcessFile( char* XMLFile, xmlBuilderConfig* config ); - -void xmlBuilderAddDtd( const char* sysId, xmlBuilderContext* context ); -void xmlBuilderAddAtts( xmlBuilderContext* ctx, xmlNodePtr ptr, const xmlChar** atts ); - -/* SAX Callbacks */ -void xmlBuilderStartElement( void* blob, const xmlChar *name, const xmlChar **atts ); -void xmlBuilderEndElement( void* blob, const xmlChar* name ); -void xmlBuilderHandleCharacter(void* blob, const xmlChar *ch, int len); -void xmlBuilderParseError( void* blob, const char* msg, ... ); -xmlEntityPtr xmlBuilderGetEntity( void* blob, const xmlChar* name ); -void xmlBuilderExtSubset( void* blob, const xmlChar* name, const xmlChar* extId, const xmlChar* sysId ); -void xmlBuilderProcInstruction( void* blob, const xmlChar* name, const xmlChar* data ); -void xmlBuilderComment( void* blob, const xmlChar* data ); - - -static xmlSAXHandler xmlBuilderSaxHandlerStruct = { - NULL, /* internalSubset */ - NULL, /* isStandalone */ - NULL, /* hasInternalSubset */ - NULL, /* hasExternalSubset */ - NULL, /* resolveEntity */ - xmlBuilderGetEntity, /* getEntity */ - NULL, /* entityDecl */ - NULL, /* notationDecl */ - NULL, /* attributeDecl */ - NULL, /* elementDecl */ - NULL, /* unparsedEntityDecl */ - NULL, /* setDocumentLocator */ - NULL, /* startDocument */ - NULL, /* endDocument */ - xmlBuilderStartElement, /* startElement */ - xmlBuilderEndElement, /* endElement */ - NULL, /* reference */ - xmlBuilderHandleCharacter, /* characters */ - NULL, /* ignorableWhitespace */ - xmlBuilderProcInstruction, /* processingInstruction */ - xmlBuilderComment, /* comment */ - xmlBuilderParseError, /* xmlParserWarning */ - xmlBuilderParseError, /* xmlParserError */ - NULL, /* xmlParserFatalError : unused */ - NULL, /* getParameterEntity */ - NULL, /* cdataBlock; */ - xmlBuilderExtSubset, /* externalSubset; */ - 1, - NULL, - NULL, /* startElementNs */ - NULL, /* endElementNs */ - NULL /* xmlStructuredErrorFunc */ -}; -static const xmlSAXHandlerPtr xmlBuilderSaxHandler = &xmlBuilderSaxHandlerStruct; - - diff --git a/Open-ILS/src/sql/Pg/reporter-schema.sql b/Open-ILS/src/sql/Pg/reporter-schema.sql index caf7a2025e..30b3bd0ef4 100644 --- a/Open-ILS/src/sql/Pg/reporter-schema.sql +++ b/Open-ILS/src/sql/Pg/reporter-schema.sql @@ -213,5 +213,29 @@ SELECT * AND (stop_fines NOT IN ('LOST','CLAIMSRETURNED') OR stop_fines IS NULL) AND due_date < now(); +CREATE OR REPLACE VIEW reporter.overdue_reports AS + SELECT s.id, c.barcode AS runner_barcode, r.name, s.run_time, s.run_time - now() AS scheduled_wait_time + FROM reporter.schedule s + JOIN reporter.report r ON r.id = s.report + JOIN actor.usr u ON s.runner = u.id + JOIN actor.card c ON c.id = u.card + WHERE s.start_time IS NULL AND s.run_time < now(); + +CREATE OR REPLACE VIEW reporter.pending_reports AS + SELECT s.id, c.barcode AS runner_barcode, r.name, s.run_time, s.run_time - now() AS scheduled_wait_time + FROM reporter.schedule s + JOIN reporter.report r ON r.id = s.report + JOIN actor.usr u ON s.runner = u.id + JOIN actor.card c ON c.id = u.card + WHERE s.start_time IS NULL; + +CREATE OR REPLACE VIEW reporter.currently_running AS + SELECT s.id, c.barcode AS runner_barcode, r.name, s.run_time, s.run_time - now() AS scheduled_wait_time + FROM reporter.schedule s + JOIN reporter.report r ON r.id = s.report + JOIN actor.usr u ON s.runner = u.id + JOIN actor.card c ON c.id = u.card + WHERE s.start_time IS NOT NULL AND s.complete_time IS NULL; + COMMIT; diff --git a/Open-ILS/web/conify/global/permission/perm_list.html b/Open-ILS/web/conify/global/permission/perm_list.html index 18aa9444eb..774a7b33ba 100644 --- a/Open-ILS/web/conify/global/permission/perm_list.html +++ b/Open-ILS/web/conify/global/permission/perm_list.html @@ -88,8 +88,32 @@ window.perm_grid_layout = [ { cells : [ [ - { name : "Code", field : "code", width : "300px", editor : dojox.grid.editors.Dijit }, - { name : "Description", field : "description", width : "auto", editor : dojox.grid.editors.Editor } + { name : "Code", field : "code", width : "300px", editor : dojox.grid.editors.Dijit, rowSpan : "2" }, + { name : "Description", field : "description", width : "auto", editor : dojox.grid.editors.Editor, style : "minHeight:1em;" } + ], + [ + { name : "Translation", + width : "10em", + height : "2em", + get : function (row) { + if (!window.perm_rows) window.perm_rows = []; + var r = window.perm_data_model.getRow(row); + if (r) { + window.perm_rows[row] = new ccs().fromHash(window.perm_data_model.getRow(row)); + setTimeout( + 'dojo.query(".perm_grid_trans_desc_' + row + '").'+ + 'instantiate(openils.I18N.translationWidget,{field:"description",'+ + 'targetObject:"window.perm_rows['+row+']",unique:"' + row + '"});'+ + 'perm_grid.rowHeightChanged('+row+')', + 0 + ); + var oldnode = dojo.byId('description_translation_' + row); + if (oldnode) dijit.byNode(oldnode).destroyRecursive(); + return ''; + } + return ''; + } + } ] ] } diff --git a/Open-ILS/web/conify/global/permission/perm_list.js b/Open-ILS/web/conify/global/permission/perm_list.js index 4dc76cffbb..55ea8591ee 100644 --- a/Open-ILS/web/conify/global/permission/perm_list.js +++ b/Open-ILS/web/conify/global/permission/perm_list.js @@ -16,6 +16,7 @@ */ dojo.require('fieldmapper.dojoData'); +dojo.require('openils.I18N'); dojo.require('dojo.parser'); dojo.require('dojo.string'); dojo.require('dojo.data.ItemFileWriteStore'); diff --git a/Open-ILS/web/js/dojo/openils/User.js b/Open-ILS/web/js/dojo/openils/User.js index 6039dc0fe3..2bc60dd94c 100644 --- a/Open-ILS/web/js/dojo/openils/User.js +++ b/Open-ILS/web/js/dojo/openils/User.js @@ -33,6 +33,7 @@ if(!dojo._hasResource["openils.User"]) { authtime : null, constructor : function ( kwargs ) { + kwargs = kwargs || {}; this.id = kwargs.id; this.user = kwargs.user; this.passwd = kwargs.passwd; @@ -54,7 +55,7 @@ if(!dojo._hasResource["openils.User"]) { req.oncomplete = function(r) { var user = r.recv().content(); _u.user = user; - if (!openils.User.user) !openils.User.user = _u.user; + if (!openils.User.user) openils.User.user = _u.user; if(onComplete) onComplete(user); } @@ -109,9 +110,9 @@ if(!dojo._hasResource["openils.User"]) { authReq.oncomplete = function(rr) { var data = rr.recv().content(); _u.authtoken = data.payload.authtoken; - if (!openils.User.authtoken) !openils.User.authtoken = _u.authtoken; + if (!openils.User.authtoken) openils.User.authtoken = _u.authtoken; _u.authtime = data.payload.authtime; - if (!openils.User.authtime) !openils.User.authtime = _u.authtime; + if (!openils.User.authtime) openils.User.authtime = _u.authtime; _u.getBySession(onComplete); } authReq.send();